TnT/Multi_CodeNet4Repair huggingface dataset:
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):
k,s=[int(i) for i in input().split()]
c=0
for i in range(k+1):
    for j in range(k+1):
        l=k-(i+j)
        if(0<=l<=k and i+j+k==s):
            c+=1
print(c)



k,s=[int(i) for i in input().split()]
c=0
for i in range(k+1):
    for j in range(k+1):
        l=s-(i+j)
        if(0<=l<=k):
            c+=1
print(c)



Verdicts: Wrong Answer

Accepted
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):
k,s=map(int,input().split())
count=0
for i in range(k+1):
    for j in range(k+1):
        if 0<=s-x-y<=k:
            count+=1
print(count)



k,s=map(int,input().split())
count=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            count+=1
print(count)


Verdicts: Runtime Error

Accepted
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 itertools
k,s=map(int,input().split())

arr=[]
cnt=0

for x in range(k+1):
  for y in range(x,k+1):
    z=s-x-y
    if 0<=z<=k:
      print((x,y,z))
      if x==y==z:
        cnt+=1
        print('add 1')
      elif x==y or y==z or z==x:
        cnt+=3
        print('add 3')
      else:
        cnt+=6
        print('add 6')
print(cnt)

import itertools
k,s=map(int,input().split())

arr=[]
cnt=0

for x in range(k+1):
  for y in range(x,k+1):
    z=s-x-y
    if 0<=z<=k:
      if x==y==z:
        cnt+=1
      elif x==y or y==z or z==x:
        cnt+=3
      else:
        cnt+=6
print(cnt)

import itertools
k,s=map(int,input().split())

arr=[]
cnt=0

for x in range(k+1):
  for y in range(x,k+1):
    z=s-x-y
    if y<=z<=k:
      if x==y==z:
        cnt+=1
      elif x==y or y==z or z==x:
        cnt+=3
      else:
        cnt+=6
print(cnt)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
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 and z<=k
            ans+=1
print(ans)


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

Verdicts: Runtime Error

Accepted
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):
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):
            z=S-x-y
            if 0<=z<=K:
                ans+=1

print(ans)

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)

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:
                ans+=1

print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
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):
K,S=map(int,input().split())

if S%3==0:
    x=int(S/3)
elif S%2==0:
    x=int(S/2)
else:
    x=int(S)

print("x=",x)
ans=0

for i in range(0,K+1):
    for j in range(0,K+1):
        for k in range(0,K+1):
            print(i,j,k)
            if i+j+k==S:
                ans+=1

print(ans)


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

if S%3==0:
    x=int(S/3)
elif S%2==0:
    x=int(S/2)
else:
    x=int(S)

ans=0

for i in range(0,K+1):
    for j in range(0,K+1):
        for k in range(0,K+1):
            print(i,j,k)
            if i+j+k==S:
                ans+=1

print(ans)


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

# if S%3==0:
#     x=int(S/3)
# elif S%2==0:
#     x=int(S/2)
# else:
#     x=int(S)

ans=0

for i in range(0,K+1):
    for j in range(0,K+1):
        for k in range(0,K+1):
            print(i,j,k)
            if i+j+k==S:
                ans+=1

print(ans)


k,s=map(int,input().split())
cnt=0

for i in range(k+1):
    if i <= s:
        for j in range(k+1):
            if i+j<=s:
                if 0<=s-i-j<=k:
                    cnt+=1
print(cnt)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
[K, S] = list(map(int, input().split()))
count = 0
total = 0
for X in range(K+1):
  if X > S:
    break
  for Y in range(K+1):
    add_xy = X + Y
    if S < add_xy and add_xy < (2/3) * S:
      break
    Z = S - X - Y
    if 0 <= Z and Z <= K:
      count +=1
  if S < add_xy:
    break
      
print(count)

[K, S] = list(map(int, input().split()))
count = 0
total = 0
flag = False
for X in range(K, -1, -1):
  for Y in range(K, -1, -1):
    Z = S - X - Y
    print(X, Y, Z)
    if 0 <= Z and Z <= K:
      count +=1
    if K < Z:
      flag = True
  if flag:
    break
        
print(count)

[K, S] = list(map(int, input().split()))
count = 0
for X in range(0, K+1):
  for Y in range(0, K+1):
    Z = S - X - Y
    if 0<=Z and Z<=K:
      count += 1
      
print(count)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
K, S = map(int, input().split())
count = 0
for x in range(0, min(S, K + 1)):
	for y in range(0, min(S, K + 1)):
		for z in range(0, min(S, K + 1)):
			if ((x + y + z) == S):
				count = count + 1
print(count)


K, S = map(int, input().split())
count = 0
for x in range(0, K+1):
	if (x > S):
		break
	for y in range(0, min(S-x+1, K+1)):
		if (S-x-y >= 0 and S-x-y <= K):
			count = count + 1

print(count)


Verdicts: Wrong Answer

Accepted
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):
(k, s) = list(map(int, input().split()))
count = 0
kmax = int(s / 3) if s % 3 == 0 else int(s / 3) + 1
print(kmax)
for x in range(kmax + 1):
    for y in range(kmax + 1):
        for z in range(kmax + 1):
            if s == x + y + z:
                print(s, x, y, z)
                count += 1
print(count)

(k, s) = list(map(int, input().split()))
count = 0
kmin = int(s / 3)
print(kmin)
for x in range(kmin, k + 1):
    for y in range(kmin, k + 1):
        for z in range(kmin, k + 1):
            if s == x + y + z:
                count += 1
print(count)

(k, s) = list(map(int, input().split()))
count = 0
kmax = (s / 3) if s % 3 == 0 else (s / 3 + 1)
for x in range(k + 1):
    if s - x > kmax * 2:
        continue
    for y in range(k + 1):
        if s - x - y > kmax:
            continue
        for z in range(k + 1):
            if s == x + y + z:
                count += 1
print(count)

(k, s) = list(map(int, input().split()))
count = 0
kmax = int(s / 3) + 1
for x in range(kmax + 1):
    for y in range(kmax + 1):
        for z in range(kmax + 1):
            if s == x + y + z:
                count += 1
print(count)

(k, s) = list(map(int, input().split()))
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if z >= 0 and z <= k:
            count += 1
print(count)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
K,S=map(int,input().split())
ans=0

for i in range(K+1):
  for j in range(K+1):
    if i+j+K>=S :
      ans+=1

print(ans)

K,S=map(int,input().split())
ans=1
a=max(0,S-2*K)
for i in range(a,K+1):
  if i>S:
    break
  for j in range(a,K+1):
    if i+j>S :
      break
    if S-i+j<=K :
      ans+=1

print(ans)

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

for i in range(K+1):
  for j in range(K+1):
    if i+j+K>=S and i+j<=S :
      ans+=1

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
r=range;k,s=map(int,input().split())
print(len([0 for x in r(k+1) for y in r(k+1) if s-x-y<=k]))

r=range;k,s=map(int,input().split())
print(len([0 for x in r(k+1) for y in r(k+1) if 0<=s-x-y<=k]))

Verdicts: Wrong Answer

Accepted
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 sys

num = sys.stdin.readline().split(' ')
K = int(num[0])
S = int(num[1])

counter = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(S-i-j):
            if i+j+k == S:
                counter += 1
            else:
                continue

print(counter)

import sys

num = sys.stdin.readline().split(' ')
K = int(num[0])
S = int(num[1])

counter = 0
for i in range(K+1):
    for j in range(K+1):
        if 0 <= S-i-j <= K:
            counter += 1
        else:
            continue

print(counter)

Verdicts: Wrong Answer

Accepted
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):
K, S = map(int, input().split())
 
count = 0

for x in range(K):
  for y in range(K):
    z = S - x - y
    if (z>=0) and (z<=K):
      count += 1
                   

      
print(count)

K, S = map(int, input().split())
 
count = 0
for x in range(S+1):
  print("x", x)
  for y in range(S-x+1):
    print("y" , y)
    z = S - x - y
    print("z", z)
    if (x>=0 and x<=K) and (y>=0 and y<=K) and (z>=0 and z<=K):
      count += 1
      
print(count)

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

count = 0
for x in K+1:
  for y in K-x:
    z = K - x - y
    if (x>=0) and (y>=0) and (z>=0):
      count += 1
      
print(count)

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

for x in range(K+1):
  for y in range(K+1):
    z = S - x - y
    if (z>=0) and (z<=K):
      count += 1

print(count)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
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):
k,s=map(int,input().split())
ans=0
z=[i for i in range(k+1)]
for x in range(k+1):
    for y in range(k+1):
        a=s-x-y
        if a<=k and z[bisect.bisect_left(z,a)]==a:
            ans+=1
print(ans)

k,s=map(int,input().split())
ans=0
z=[i for i in range(k+1)]
for x in range(k+1):
    for y in range(k+1):
        a=s-x-y
        a=min(s-x-y,k)
        if z[bisect.bisect_left(z,a)]==a:
            ans+=1
        
print(ans)

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:
            ans+=1
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
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):
N = int(input())
cards = []
for i in range(N):
	cards.append(list(map(int,input().split())))

points = []
for i in range(N):
	points.append(0)

for i in range(3):
	for j in range(N):
		flag = 0
		for k in range(j):
			if cards[j][i] == cards[k][i]:
				flag = 1
				break
		if j+1<N:
			for k in range(j+1,N):
				if cards[j][i] == cards[k][i]:
					flag = 1
					break
		if flag==0: points[j] += cards[j][i]

for i in range(N):
	print(points[i])


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

count = 0

if K>S: n=S
else: n=K
x=0
for i in range(n+1):
	if K>S-x: m=S-x
	else: m=K
	y=0
	for j in range(m+1):
		if S-x-y<=K: count +=1
		y+=1
	x+=1

print(count)


Verdicts: Runtime Error

Accepted
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):
k,s=[int(i) for i in input().split()]
count = 0
for y in range(k+1):
 if i < s - k * 2 or s - i < 0:
  continue
 for x in range(k+1):
   if s - x - y >= 0 and s - x - y <= k:
      count = count+1
print(count)

k,s=[int(i) for i in input().split()]
count = 0
for y in range(k+1):
 if y < s - k * 2 or s - y < 0:
  continue
 for x in range(k+1):
   if s - x - y >= 0 and s - x - y <= k:
      count = count+1
print(count)

Verdicts: Runtime Error

Accepted
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):
K, S = map(int, input().split())

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        Z = S - X - Y
        if 0 <= Z and  Z <= K:
            result += 1

print(result)

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

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        Z = S - X - Y
        if 0 <= Z <= K:
            result += 1

print(result)

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

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z <= K:
            result += 1

print(result)

Verdicts: Runtime Error

Runtime Error

Accepted
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):
k,s=map(int,input().split())
count=0
for i in range(0,k):
  for j in range(0,k):
    if 0<=(s-i+j)<=k:
      count+=1
print(count)

k,s=map(int,input().split())
count=0
for i in range(0,k+1):
  for j in range(0,k+1):
    if 0<=(s-i-j)<=k:
      count+=1
print(count)

Verdicts: Wrong Answer

Accepted
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):
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 k >= z >= 0:
            ans += 1
print(ans))

k, s = map(int, input().split())
ans = 0
for x in range(k+a):
    for y in range(k+1):
        z = s-x-y
        if k >= z >= 0:
            ans += 1
print(ans))

k, s = map(int, input().split())
arr = [[x, y, s-x-y] for x in range(k+1) for y in range(k+1) if k >= s-x-y > 0]
print(len(arr))

import sys
input = sys.stdin.readline
def main():
    K, S = map(int, input().split())
    CNT = 0
    for x in range(K+1):
        for y in range(K+1):
            if S - x -y >= 0 and S - x -y <= K:
                CNT += 1
    print(CNT)            

if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
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):

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

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        if S < x + y :
            break
        if S - i - j <= K :
            count += 1
print(count)



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

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        if S < i + j :
            break
        if S - i - j <= K :
            count += 1

print(count)


Verdicts: Runtime Error

Accepted
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):
K, S = list(map(int, input().split()))

answer = 0
for i in range(K+1):
  for j in range(K+1):
    if S - (i + j) <= K:
      answer += 1

print(str(answer))

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

answer = 0
for i in range(K+1):
  for j in range(K+1):
    if 0 <= S - (i + j) <= K:
      answer += 1

print(answer)

Verdicts: Wrong Answer

Accepted
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):
K,S=map(int,input())
cnt = 0
for x in range(K+1):
  for y in range(K+1):
    if 0 <= S-x-y <= K:
      cnt += 1
print(cnt)

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

for i in range(K+1):
  for j in range(K+1):
      if (S - i - j) <= K:
        cnt+=1

print(cnt)

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

for i in range(K+1):
  for j in range(K+1):
      if (S - i - j) <= K:
        if S - i - j >= 0:
          cnt+=1
          
print(cnt)

Verdicts: Runtime Error

Wrong Answer

Accepted
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):
n, s = map(int, (input().split()))
ans = 0

for x,y in product(range(n+1), range(n+1)):
    if 0 <= s - x - y <= n:
        ans += 1
print(ans)

from itertools import product

n, s = map(int, (input().split()))
ans = 0

for x,y in product(range(n+1), range(n+1)):
    if 0 <= s - x - y <= n:
        ans += 1
print(ans)

Verdicts: Runtime Error

Accepted
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):
K = int(input())
S = int(input())

ans = 0

for i in range(0,K+1):
    for j in range (0,K+1):
        for k in range (0,K+1):
            if (i + j + k) == S:
                ans = ans + 1
            

print(ans)


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

ans = 0

for i in range(0,K+1):
    for j in range (0,K+1):
        if (S-K) <= (i + j) <= S:
            ans = ans + 1
            continue
print(ans)


Verdicts: Runtime Error

Accepted
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):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(x, k+1):
        if x + y > s:
            break;
        for z in range(y, k+1):
            if x + y + z == s:
                if x == y and y == z:
                    ct += 1
                elif x != y and y != z and z != x:
                    ct += 3
                else:
                    ct += 2
                break;
print(ct)

import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

k, s = na()
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)











Verdicts: Wrong Answer

Accepted
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):
k, s = map(int, input().split())

ans = 0
num = max(k, s)

for i in range(num+1):
  for j in range(num+1):
    res = S - (i+j)
    if res >= 0:
      ans += res+1
      
print(ans)

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

ans=[1 for x in (K+1) for y in (K+1) if 0<=S-x-y <= K]

print(len(ans))


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

ans=[1 for x in (K+1) for y in (K+1) if K-x-y <= K]

print(len(ans))

k, s = map(int, input().split())

ans = 0
num = min(k, s)

for i in range(num+1):
  for j in range(num+1):
    res = s - (i+j)
    if (res >= 0) and (res <= k):
      ans += 1
      
print(ans)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
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):
k,s = [int(i) for i in input().split()]
ans = 0
for a in range(k+1):
    for b in range(k+1):
        if a + b == s or (s - (a + b)) <= k:
            ans += 1
        else:
            pass
print(ans)



k,s = [int(i) for i in input().split()]
ans = 0
for a in range(k+1):
    for b in range(k+1):
        c = s - a -b
        if  0 <= c <= k:
            ans += 1
print(ans)



Verdicts: Wrong Answer

Accepted
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):
x,y = list(map(int, input().split()))
count=0
for i in range(1,x+1):
    for j in range(1,x+1):
        for k in range(1,x+1):
            a=i+j+k
            if y==a:
                count+=1
print(count)

x,y = list(map(int, input().split()))
count=0
for i in range(x+1):
    for j in range(x+1):
        k=y-i-j
        if k<x and k>0:
          count+=1
print(count)

x,y = list(map(int, input().split()))
count=0
for i in range(x):
	for j in range(x):
      for k in range(x):
        a=i+j+K
        if y==a:
          count+=1
print(count)

x,y = list(map(int, input().split()))
count=0
for i in range(x+1):
    for j in range(x+1):
        k=y-i-j
        if k=<x and 0=<k:
          count+=1
print(count)

x,y = list(map(int, input().split()))
count=0
for i in range(x):
    for j in range(x):
        for k in range(x):
            a=i+j+k
            if y==a:
                count+=1
print(count)

x,y = list(map(int, input().split()))
count=0
for i in range(x+1):
    for j in range(x+1):
        k=y-i-j
        if k<=x and 0<=k:
          count+=1
print(count)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted
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):
K,S = map(int,input().split())
if S == 0:
  print(1)
  exit()
z = 0
o = 0
t = 0

for i in reversed(range(K+1)):
  if i < (S-1)//3 + 1:
    break
  else:
    num = min(S-i,i)-(S-i+1)//2 + 1
    z += num
    if (S-i) % 2 == 0:
      z -= 1
      o += 1
    if num > 1 and min(S-i,i) == i:
      z -= 1
      o += 1
if S % 3 == 0:
  t += 1
  o -= 1
print(z*6 + o*3 + t)

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

z = 0
o = 0
t = 0

for i in reversed(range(K+1)):
  if i < (S-1)//3 + 1:
    break
  else:
    num = min(S-i,i)-(S-i+1)//2 + 1
    z += num
    #print(num)
    if S-i % 2 == 0:
      z -= 1
      o += 1
    if min(S-i,i) == i:
      z -= 1
      o += 1 
if S % 3 == 0:
  t += 1
  o -= 1
#print(o,z,t)
print(z*6 + o*3 + t)

K,S = map(int,input().split())
if S == 0:
  print(1)
  exit()
z = 0
o = 0
t = 0
start = min(S,K)
for i in reversed(range(start+1)):
  if i < (S-1)//3 + 1:
    break
  else:
    num = min(S-i,i)-(S-i+1)//2 + 1
    z += num
    print(num)
    if num == 1:
      if (S-i) % 2 == 0 or min(S-i,i) == i:
        z -= 1
        o += 1
    else:
      if (S-i) % 2 == 0:
        z -= 1
        o += 1
      if min(S-i,i) == i:
        z -= 1
        o += 1
        
      
if S % 3 == 0:
  t += 1
  o -= 1
print(z*6 + o*3 + t)

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

z = 0
o = 0
t = 0

for i in reversed(range(K+1)):
  if i < (S-1)//3 + 1:
    break
  else:
    num = min(S-i,i)-(S-i+1)//2 + 1
    z += num
    print(num)
    if S-i % 2 == 0:
      z -= 1
      o += 1
    if min(S-i,i) == i:
      z -= 1
      o += 1 
if S % 3 == 0:
  t += 1
  o -= 1
print(o,z,t)
print(z*6 + o*3 + t)

K,S = map(int,input().split())
ans = 0
for X in range(K+1):
  for Y in range(K+1):
    if 0 <= S - X - Y and S - X - Y <= K:
      ans += 1
print(ans)
  

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
K, S = map(int, input().split())
count=0
for x in range(K+1):
    for y in range(K+1):
        if S - (x+y) <= (K):
            count += 1
print(count)

K, S = map(int, input().split())
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 += 1
print(count)

K, S = map(int, input().split())
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 += 1
print(count)

K, S = map(int, input().split())
count=0
for x in range(K+1):
    for y in range(K+1):
        z = S - (x+y)
        if (z <= K) & (z >= 0):
            count += 1
print(count)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
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):
k, s = (int(x) for x in input().split())

if s < 3 or k*3 < s:
    print(0)
    exit()

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


k, s = (int(x) for x in input().split())

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


Verdicts: Wrong Answer

Accepted
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):
k, s = map(int, input().split())

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


k, s = map(int, input().split())

ans = 0
for x in reversed(range(k+1)):
    for y in reversed(range(k+1)):
        if s-(x+y) >= 0 and s-(x+y) <= k:
            ans += 1
print(ans)


Verdicts: Wrong Answer

Accepted
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):
K,S = map(int, input().split())

if K == S:
	print( (K+5)*(K+4)//2 )
	sys.exit( ) 

ans = 0
for X in range(K+1):
	S1 = S - X
	if S1 < 0:
		break
	else:
		if S1 <= K:
			ans += S1 + 1
		elif S1 <= 2 * K:
			ans += S1 - 2*K + 1
		else:
			continue

print(ans)
		

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

if K == S:
	print( (K+5)*(K+4)//2 )
	exit() 

ans = 0
for X in range(K+1):
	S1 = S - X
	if S1 < 0:
		break
	else:
		if S1 <= K:
			ans += S1 + 1
		elif S1 <= 2 * K:
			ans += S1 - 2*K + 1
		else:
			continue

print(ans)

K,S = map(int, input().split())
 
ans = 0
 
for X in range(K+1):
	S1 = S - X
	if S1 < 0:
		break
	else:
		if S1 <= K:
			ans += S1 + 1
		elif S1 <= 2 * K:
			ans += 2*K - S1 + 1
 
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
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):
# Sum of Three Integers
K, S = map(int, input().split())
res = 0
for x in range(K+1):
    for y in range(K+1):
        if S - (x + y) <= K:
            res += 1
print(res)

# Sum of Three Integers
K, S = map(int, input().split())
res = 0
for x in range(K+1):
    for y in range(K+1):
        if x + y > S:
            continue
        if S - (x + y) <= K:
            res += 1
print(res)

Verdicts: Wrong Answer

Accepted
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):
k,s=map(int,input().split())
r=0
for i in range(k+1):
  r+=max(0,2*k+i-s+1)
print(r)

k,s=map(int,input().split())
r=0
for i in range(k+1):
  r+=max(0,min(2*k+i-s+1,s-i+1))
print(r)

Verdicts: Wrong Answer

Accepted
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):
K, S = map(int,input())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= S - x - y <= K:
            ans += 1
print(ans)


K, S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= S - x - y <= K:
            ans += 1
print(ans)


Verdicts: Runtime Error

Accepted
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):
# _*_ coding:utf-8 _*_


def  queueAnswer(maxValue,sumNumber):
	counter = 0
	for x in range(0,maxValue+1,1):
		for y in range(0,maxValue+1,1):
			for z in range(0,maxValue+1,1):
				thisSum = x+y+z
				if  thisSum=sumNumber:
					counter = counter + 1
	answer = counter
	return answer


if __name__ == '__main__':
	k,s = map(int,input().strip().split(' '))
	solution=queueAnswer(k,s)
	print(solution)

# _*_ coding:utf-8 _*_


def  queueAnswer(maxValue,sumNumber):
	counter = 0
	for x in range(0,maxValue+1,1):
		for y in range(0,maxValue+1,1):
			z = sumNumber-x-y
			if z <= maxValue:
				counter = counter + 1
	answer = counter
	return answer


if __name__ == '__main__':
	k,s = map(int,input().strip().split(' '))
	solution=queueAnswer(k,s)
	print(solution)


# Python  3rd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(maxNum, totalNum):
    result = 0
    for x in range(0,maxNum+1):
        for y in range(0,maxNum+1):
            z = totalNum - x - y
            if 0 <= z and z <= maxNum:
                result = result + 1
    return result


if __name__ == "__main__":
    K, S = MI()
    print("{}".format(solver(K, S)))


Verdicts: Runtime Error

Wrong Answer

Accepted
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):
K,S=map(int,input().split())
cnt=0
for X in range(K+1):
  for Y in range(K+1):
    if 0<=S-X-Y and S-X-Y <= k:
      cnt+=1
print(cnt)

K,S=map(int,input().split())
cnt=0
for X in range(K+1):
  for Y in range(K+1):
    if 0<=S-X-Y and S-X-Y<=K:
      cnt+=1
print(cnt)

Verdicts: Runtime Error

Accepted
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):
K,S = map(int,input().split())
ans=0
for x in range(K+1):
    for y in range(K+1):
            if S-(x+y) <= K:
                ans+=1
print(ans)

K,S = map(int,input().split())
ans=0
for x in range(K+1):
    for y in range(K+1):
        ans+=1 if K>=S-(x+y)>=0 else 0
print(ans)

Verdicts: Wrong Answer

Accepted
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):
K, S = map(int input().split())
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 += 1

print(count)


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

for X in range(K+1):
    for Y in range(K+1):
        if (0 <= S-(X+Y)) and (S-(X+Y) <= K) :
            count += 1

print(count)


Verdicts: Runtime Error

Accepted
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):
k,s = map(int,input().split())
ans = 0
for i in range(k+1):
	for j in range(k+1):
		z = s-x-y
		if(0 <= z and z <= k):
			ans += 1
print(ans)

k,s = map(int,input().split())
ans = 0
for i in range(k+1):
	for j in range(k+1):
		z = s-i-j
		if(0 <= z and z <= k):
			ans += 1
print(ans)

Verdicts: Runtime Error

Accepted
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):
K,S = map(int,input().split())
flag = 1
s = 0
for l in range(K):
  for m in range(K):
    for n in range(K):
      if l+m+n <= S:
        s = s+1
      else:
        flag = 0
        break
    if flag:
      break
  if flag:
    break
print(s)

K,S = map(int,input().split())
flag = 1
s = 0
for l in range(K+1):
  for m in range(K+1):
    if (0 <= S-l-m)and(S-l-m<=K):
      s = s+1
print(s)

Verdicts: Wrong Answer

Accepted
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):
k,s=map(int,input().split());n=abs(3*k-s+1);print(int(-~n*n/2))

k,s=map(int,input().split());n=abs(s-3*k)+1;print(int(-~n*n/2))


k,s=map(int,input().split())
c=0
for x in range(k+1):
  if x>s:break
  for y in range(k+1):
    if x+y>s:break
    z=s-x-y
    if z>=0:c+=z+1
    if 0<=z<=k:c+=1
print(c)

k,s=map(int,input().split())
c=0
for i in range(k+1):
  for j in range(min(k,s-i)+1):
    if s-i-j<=k:c+=1
print(c)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
def Sumofnum(K,S):
    A = min(K,S) + 1
    a = max(S - 2*K, 0)
    c = 0
    for x in range (a,A):
        B = min(S - x,K) + 1
        b = max(S - x - K,0)
        for y in range (b,B):
            c = c + 1
    print(c)
    
s = list(map(int,input().split()))
Sumofnum(K,S)

def Sumofnum(K,S):
    A = min(K,S) + 1
    a = max(S - 2*K, 0)
    c = 0
    for x in range (a,A):
        B = min(S - x,K) + 1
        b = max(S - x - K,0)
        for y in range (b,B):
            c = c + 1
    print(c)
    
s = list(map(int,input().split()))
K = s[0]
S = s[1]
Sumofnum(K,S)

Verdicts: Runtime Error

Accepted
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):
K,S = int(input())
c=0
L=list(range(0,K+1))
for i in L:
    for j in L:
        for k in L:
            if i+j+k == S:
                c+=1
print(c)

K,S = map(int, input().split())
res = 0
for x in range(0,K+1):
    for y in range(0,K+1):
        if 0 <= S - x - y <= K:
            res += 1
print(res)

Verdicts: Runtime Error

Accepted
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):
K, S = map(int,input().split())
listK = [i for i in range(K+1)]
list2K = [i for i in range(K**2)]
ans = 0
for i in range(K+1):
    id = bisect.bisect_left(list2K,S-i)
    if id < len(list2K) and list2K[id] == S-i:
        for j in range(K+1):
            id2 = bisect.bisect_left(listK,list2K[id]-j)
            if id2 < len(listK) and listK[id2] == list2K[id]-j:
                ans += 1
print(ans)

K, S = map(int,input().split())
listK = [i for i in range(K+1)]
ans = 0
for i in range(K+1):
    for j in range(K+1):
        id = bisect.bisect_left(listK,S-i-j)
        if id < len(listK) and listK[id] == S-i-j:
                ans += 1
print(ans)

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 and z <= K:
            ans += 1
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
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):
k, s = 5, 15
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)


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)


Verdicts: Wrong Answer

Accepted
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):
k, s = map(int, input().split())

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

print(count)


k, s = map(int, input().split())

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

print(count)


Verdicts: Wrong Answer

Accepted
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):
K, S = map(int, input().split())
cnt = 0
for i in range(K+1):
  for j in range(K+1):
    k = S - i -j:
    if k <= 0 and S <= k:
      cnt += 1
print(cnt)


K, S = map(int, input().split())
cnt = 0
for i in range(K+1):
  for j in range(K+1):
    k = S - i -j
    if k <= 0 and S <= k:
      cnt += 1
print(cnt)



K, S = map(int, input().split())
cnt = 0
for i in range(K+1):
  for j in range(K+1):
    k = S - i -j
    if 0 <= k and k <= K:
      cnt += 1
print(cnt)



Verdicts: Runtime Error

Wrong Answer

Accepted
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 itertools

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

l=[]
for i in range(K+1):
  for j in range(i,K+1):
    for k in range(j,K+1):
      if i+j+k==S:
        l.append([i,j,k])

print(itertools.permutations(l))

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

for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k==S:
                ans+=1
                break
        else:
            continue
        break

print(ans)

import itertools

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

ans=0
for i in range(K+1):
  for j in range(K+1):
    if 0<=S-(i+j)<=K:
      ans+=1
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
K, S = map(int, input().split())

cnt = 0
for x in range(K):
  for y in range(K):
    z = S-x-y
    if 0 <= z and z <= K:
      cnt+=1

print(cnt)

K, S = map(int, input().split())
ans = sum(0 <= S-x-y <= K for x in range(K+1) for y in range(K+1))
print(ans)

Verdicts: Wrong Answer

Accepted
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):
k,s=map(int,input().split())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        if i+j<=s-1:
            ans+=1
print(ans)

k,s=map(int,input().split())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        if s-i-j<=k and s-i-j>=1:
            ans+=1
print(ans)

k,s=map(int,input().split())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        if s-i-j<=k:
            ans+=1
print(ans)

k,s=map(int,input().split())
ans=0
for i in range(k+1):
    for j in range(k+1):
        if s-i-j<=k and s-i-j>=0:
            ans+=1
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
k, s = map(int, input().split())

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

print(ans)


k, s = map(int, input().split())

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

print(ans)


Verdicts: Wrong Answer

Accepted
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):
k,s=map(int,input().split());n,ans=k-(((s+2)//3)-1),0
for i in range(n):ans+=(k-i)*3-s+1
print(ans)

k,s=map(int,input().split());ans=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:ans+=1
print(ans)

Verdicts: Wrong Answer

Accepted
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):
k, s = [int(i) for i in input().split()]

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

    for y in range(a//2, -1, -1):
        z = a - y
        if z == k:
            count += 1
        elif z > k:
            break

print(count)

k, s = [int(i) for i in input().split()]

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

    for y in range(a//2, -1, -1):
        z = a - y
        if z == k:
            count += 1
        else:
            break

print(count)

k, s = [int(i) for i in input().split()]

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

print(count)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
k, s = map(int, input().split())
print(k, s)
count=0
for a in range(0, k+1):
  for b in range(0, k+1):
    for c in range(0, k+1):
      if a+b+c == s:
        count+=1
print(count)

import math
k, s = map(int, input().split())
count=0
if k < s/3:
  print(0)
  quit()
for a in range(math.ceil(s/3), k+1):
  for b in range(math.ceil(s/3), k+1):
    for c in range(math.ceil(s/3), k+1):
      if a+b+c == s:
        count+=1
print(count)

k, s = map(int, input().split())
count=0
for a in range(0, k+1):
  if a < s/3:
    continue
  for b in range(0, k+1):
    if b < s/3:
      continue
    for c in range(0, k+1):
      if c < s/3:
        continue
      if a+b+c == s:
        count+=1
print(count)

k, s = map(int, input().split())
count=0
for a in range(0, k+1):
  for b in range(0, k+1):
    if s-a-b >= 0 and s-a-b <= k:
      count+=1
print(count)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
K, S = map(int, input().split())

p = 0
for X in range(max(0, S - 2*K), min(K, S) +1):
  Y = S - X
  p += min(Y, K) - max(Y - K, 0) + 1
  print(X, Y, p)
  
print(p)

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

p = 0
for X in range(max(0, S - 2*K), min(K, S) +1):
  Y = S - X
  p += min(Y, K) - max(Y - K, 0) + 1
  
print(p)

Verdicts: Wrong Answer

Accepted