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()]


ans = 0

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


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

number_lis = []
ans = 0

for i in range(0,K+1):
    number_lis.append(i)

for j in number_lis:
    for k in number_lis:
        for l in number_lis:
            if 0<= (S - (j + k)) <=K:
                ans = ans + 1
                
print(ans)
            

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

number_lis = []
ans = 0

for i in range(0,K+1):
    number_lis.append(i)

for j in number_lis:
    for k in number_lis:
        for l in number_lis:
            if 0<= (S　-j -k) <=K:
                ans = ans + 1
                
print(ans)

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


Verdicts: Runtime Error

Runtime Error

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
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):
    for y in range(K):
        for z in range(K):
            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):
        if (S - (x + y) <= K) and (0 <= S - (x + y)):
            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 i in range(K+1):
    flg = False
    for j in range(K+1):
        if flg == True:
            break
        for k in range(K+1):
            ijk_sum = i + j + k
            if ijk_sum == S:
                flg = True
                cnt += (K+1 - j)
                break
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 k <= K:
            cnt += 1
print(cnt)

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):
#B - Sum of Three Integers
K,S = map(int,input().split())
#0<=S<=3K
res = 0
for X in range(0,K+1):
    if X > S:
        break
    for Y in range(0,K+1):
        if X + Y > S:
            break
        elif 0<=(X + Y - S) and (X + Y - S) <= K:
            res += 1
print(res)

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

K,S = map(int,input().split())
print(sum([0<=S-X-Y<=K for X in range(0,K+1) for Y in range(0,K+1)]))

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())
print([x+y+z==s for z in range(k+1) for y in range(k+1) for x in range(k+1)].count(s))

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

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


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):
#n = list(map(int, (input()).split(' ')))
n = [2500,7500]
#print(n)
x = [ i   for i in range(n[0]+1)]


#print(x)
counter = 0
if n[0]*3 >= n[1]:
  for x1 in x:
    for y1 in x:
      if 0<= n[1]-x1-y1 <=n[0]  :
          counter +=1

        
print(counter)        


n = list(map(int, (input()).split(' ')))
#n = [2500,7500]
#print(n)
x = [ i   for i in range(n[0]+1)]


#print(x)
counter = 0
if n[0]*3 >= n[1]:
  for x1 in x:
    for y1 in x:
      if 0<= n[1]-x1-y1 <=n[0]  :
          counter +=1

        
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())
print(len([z for x in range(k+1) for y in range(k+1) if 0<=s-x-y<=k]))

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

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

K,S = map(int,input().split())
alist = [i+j+h==S for i in range(0,K) for j in range(0,K) for h in range(0,K)]
print(len(alist))

K,S = map(int,input().split())
alist = [i+j+h==S for i in range(0,K+1) for j in range(0,K+1) for h in range(0,K+1)]
print(len(alist))

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

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):
  for j in range(k):
    fpr h in range(k):
      if i+j+h==s:
        ans+=1
print(ans)

k,s=map(int,input().split())
ans=0
def als(n):
  if n<=k:
    return n
  elif k+1<=n<=2*k:
    return 2*k+1-n
  else:
    return 0
for i in range(k+1):
  ans+=als(s-i)
print(ans)


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


k,s=map(int,input().split())
ans=0
def als(n):
  if 0<=n<=k:
    return n+1
  elif k+1<=n<=2*k:
    return 2*k+1-n
  else:
    return 0
for i in range(k+1):
  ans+=als(s-i)
print(ans)


Verdicts: Runtime Error

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):
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    if A<=(i//10)+(i%10) and (i//10)+(i%10)<=B:
        ans+=i
print(ans)

import itertools
K,S = map(int,input().split())
ans = 0
for i,j in itertools.product(range(K+1),range(K+1)):
    if 0<=S-i-j and S-i-j<=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())
cnt = 0
for x in range(K):
  for y in range(K):
    z = S-x-y
    if z > K:
      continue
    else:
      cnt += 1
print(cnt)

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

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):
line = input().split(" ")
k = int(line[0])
s = int(line[1])
count = 0
for i in range(k+1):
  for j in range(k+1):
    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):
    result = s - i - j
    if 0 <= result <= 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):
K, S = list(map(int, input().split()))
print(int((3 * K - S + 1) * (3 * K - S + 2) / 2))

K, S = list(map(int, input().split()))
if S <= K:
	print(int((S + 2) * (S + 1) / 2))
elif S <= 2 * K:
	ans = (-3 * (K ** 2) + 3 * K + 6 * S * K - 2 * (S ** 2) + 2) // 2
	print(int(ans))
else:
	print(int((3 * K - S + 1) * (3 * K - S + 2) / 2))

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(K >= S-(i+j) >= 0):
            count += 1
            print(i, j, S-(i+j))


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

count = 0
for i in range(K+1):
    for j in range(K+1):
        if(K >= S-(i+j) >= 0):
            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())
x=[0]*k
for i in range(0,k):
  x[i]=i
x.append(k)
a=int(s/3)-1
count=0
for i in range(0,len(x)):
  stemp=s-x[i]
  for j in range(0,min(k+1,stemp)):
    if stemp-x[j] in x:
      count=count+1
print(count)


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


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 itertools

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

print('K:{} S:{}'.format(K, S))

cnt = 0
for x, y, z in itertools.product(range(K + 1), repeat=3):
    if x + y + z == S:
        cnt += 1

print(cnt)


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

ans = 0
for x, y in itertools.product(range(K + 1), range(K + 1)):
    z = S - (x + y)
    if z >= 0 and z <= 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())
conut=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=int(input())
S=int(input())
conut=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())
conut=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            while 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):
            while x+y+z==S:
                count+=1
print(count)

K,S=map(int,inpit().split())
conut=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,inpit().split())
conut=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,inpit().split())
conut=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):
        sumz=S-x-y
        if sumz>=0 and sumz<=K:    
            count+=1
print(count)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Time Limit Exceeded

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 = map(int,input()split())

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

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

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


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 math
K, S = [int(i) for i in input().split()]
cnt = 0 
x_flg = bool()
out = int()
for x in range(0,K+1):
  for y in range(0,math.ceil(S/2)+1):
    z = S - (x + y)
    if K >= x and K >= y and K >= z and z >= 0:
      cnt += 1
    elif z < 0:
      break
print(cnt)

K, S = [int(i) for i in input().split()]
cnt = 0 
for x in range(0,K+1):
  if 0 <= S - x <= K:
    cnt += S - x + 1
  elif 0 <= S - x <= 2*K:
    cnt += 2*K - S + x + 1
print(cnt)

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):
    for l in range(k+1):
      if i+j+k==s:
        cnt+=1
print(cnt)
        

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

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):
for x in range(k + 1):
    for y in range(k + 1):
        if x + y > s:
            break
        for z in range(k + 1):
            count += (x + y + z == s)

print(count)


import numpy as np
K, S = map(int, input().split())
arrange = np.arange(K + 1)
T = S - np.add.outer(arrange, arrange)
print(((T >= 0) & (T <= K)).sum())

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

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

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())
combi = 0
for x in range(K+1):
  for y in range(x, K+1):
    z = S - x - y
    if z >= 0:
      if z <= K:
        combi += 1
print(combi)

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

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

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

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

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):
        z = s - x - y
        if z <= 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: 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(input())
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,n = map(int,input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    if 0 <= n-i-j <= 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):
import collections
import itertools
import functools
import math
import scipy.special

if __name__ == "__main__":
    k, s = map(int, input().split())
    res = 0
    mi = min(k, s)
    ma = max(k, s)
    for i in range(mi + 1):
        for j in range(mi + 1):
            res += int(0 == s - i - j - k)
    print(res)

import collections
import itertools
import functools
import math
import scipy.special

if __name__ == "__main__":
    k, s = map(int, input().split())
    res = 0
    mi = min(k, s)
    ma = max(k, s)
    for i in range(mi + 1):
        for j in range(mi + 1):
            if 0 <= s - i - j and s - i - j <= 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())

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

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 >= 0 and s - i - j <= k:
			cnt += 1
			#print(i,j,s-i-j)

print(cnt)

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(k + 1):
    for j in range(i + 1):
        l = s - (i + j)
        if i == j == l:
            ans += 1
        elif i == j or j == l or l == i:
            ans += 3
        else:
            ans += 6
print(ans)


k, s = map(int, input().split())
ans = 0
for i in range(k + 1):
    for j in range(i + 1):
        l = s - (i + j)
        if i + j + l == s:
            if i == j == l:
                ans += 1
            elif i == j or j == l or l == i:
                ans += 3
            else:
                ans += 6
print(ans)


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


k, s = map(int, input().split())
ans = 0
for i in range(k + 1):
    for j in range(i + 1):
        l = s - (i + j)
        if 0 <= l <= k and l <= j <= i:
            if i == j == l:
                ans += 1
            elif i == j or j == l or l == i:
                ans += 3
            else:
                ans += 6
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())

cnt = 0

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

print(cnt)

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

cnt = 0

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

print(cnt)

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())

xyz = [0, 0, 0]
index = 0
while min(k, s) != 0:
    xyz[index] = min(k, s)
    s = s - min(k, s)
    index = index + 1

count = 0

def cal(lis, n, m):
    lis[n] = lis[n] - 1
    lis[m] = lis[m] + 1

while xyz[0] >= 0:
    xyzCopy = list(xyz)

    while xyzCopy[1] >= 0 and xyzCopy[2] <= k:
        count = count + 1
        print(xyzCopy)
        cal(xyzCopy, 1, 2)

    if xyz[1] == k:
        cal(xyz, 0, 2)
    else:
        cal(xyz, 0, 1)

print(count)

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

count = 0

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

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

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

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

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

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

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

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

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

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):
def abc051_b():
    limit, sum_of_three_int = map(int, input().split())
    ans = 0

    for x in range(limit):
        for y in range(limit):
            z = sum_of_three_int - x + y
            
            if x + y + z == sum_of_three_int:
                ans += 1
    
    return ans 


if __name__ == '__main__':
    print(abc051_b())

a, b = map(int, input().split())
ans = 0

for x in range(a+1):
  for y in range(a+1):
    z = b - x - y
    
    if z >= 0 and a >= 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())
count=0
for i in range(K+1):
    for j in range(K+1):
        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<=K and S-i-j>=0:
            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):
import math


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    points = list(map(lambda x: sp(x), inputs))
    N = len(points)
    distances = []
    for i, _ in enumerate(points):
        for j in range(i + 1, N):
            distances.append(
                math.sqrt(
                    (points[i][0] - points[j][0]) ** 2
                    + (points[i][1] - points[j][1]) ** 2
                )
            )
    max = 0
    for d in distances:
        max = d if max < d else max
    return "%.6f" % max


def sp(s):
    new_s = s.split()
    return list(map(lambda x: int(x), new_s))


if __name__ == "__main__":
    N = int(input())
    ret = solve(inputs(N))
    print(ret)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [K, S] = list(map(lambda x: int(x), inputs[0].split()))
    pattern = 0
    for x in range(0, K + 1):
        for y in range(0, K + 1):
            tmp_z = S - x - y
            if tmp_z <= K and tmp_z >= 0:
                pattern += 1

    return pattern


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


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()))

min_x = max(0,S-2*K)

max_x = min(S,K)

for x in range(min_x+1,max_x+1):
    print(x)

count=0
for x in range(min_x,max_x+1):
    min_y = max(0,S-x-K)
    max_y = min(S-x,K)
    
    for y in range(min_y,max_y+1):
        
        if S-x-y <0 or S-x-y >K:
            print('error')
            
        count+=1

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):
        if S-x-y >=0 and S-x-y<=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):
vec = input().split(' ')
k = int(vec[0]) + 1
count = 0

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

print(count)

vec = input().split(' ')
k = int(vec[0])
s = int(vec[1])
count = 0
for x in range(k + 1):
    if x <= s:
        for y in range(k + 1):
            if x + y <= s:
                z = s - x - y
                if z >= 0 and z <= k:
                    count += 1
            else: break
    else: break
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(x) for x in input().split()]
ans = 0
for x in range(K+1):
    for y in range(K+1):
        a = S-x-y
        if a <= K:
            ans +=1
print(ans)

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

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

Verdicts: 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())
count = 0
for i in range(0, k+1):
        for j in range(0, k+1):
                l = k - (i + j)
                if i + j + l == s and l >= 0:
                        print("{} {} {}".format(i, j, l))
                        count += 1
print(count)

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

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

input_str = input().split()
k = int(input_str[0])
s = int(input_str[1])

count = 0
for x in range(k+1):
  for y in range(k+1):
    if x+y <= s:
      z = s-(x+y)
      if 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 range(K+1):
    for y in range(K+1):
        if S - K == x + y:
            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 S - (x + y) <= K and S - (x + y) >= 0:
            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())

sum_set = []
for i in range(k + 1):
    for j in range(k + 1):
        m = s - i - j
        if 0 <= m <= k:
            comb = [i, j, m]
            sum_set.append(comb)
            break
print(len(sum_set))


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

count = 0
for i in range(k + 1):
    for j in range(k + 1):
        m = s - i - j
        if 0 <= m <= 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())

c=0
for i in range(K+1):
  for j in range(K+1):
    if k > S-i-j:
        c+=1

print(c)
  

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

c=0
for i in range(K+1):
  for j in range(K+1):
    if S <= i+j+K and i+j<=S:
      # print("{} {}".format(i,j))
      c+=1

print(c)
  

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())
for i in range(k):
  for j in range(k):
    if 0<=(s-k-j)<=k:
      count+=1
print(count)

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

k, s = map(int, input().split())
count = 0
for a in range(k + 1):
    for b in range(k + 1):
        if 0 <= s - (a + b) <= 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):
a,sums=list(map(int,input().split()))
if a*3==sums:
  print(1)
else:
  ret=0
  mai=2 if sums%3==0 & sums // 3 <= a else 0
  for x in range(a+1):
    if sums-x <2*a:
      for y in range(a+1):
        if sums-x-y<a:
          if (sums-x-y == x) | (sums-x-y == y):
            ret+=1
          else:
            ret+=2
    if sums-x == 2*a:
      ret+=1
  print(ret-mai)

a,sums=list(map(int,input().split()))
if a*3==sums:
  print(1)
else:
  ret=0
  mai=2 if sums%3==0 & sums // 3 <= a else 0
  for x in range(a+1):
    if sums-x <=2*a:
      for y in range(a+1):
        if sums-x-y<=a:
          ret+=1
  print(ret-mai)

a,sums=list(map(int,input().split()))
if a*3==sums:
  print(1)
else:
  ret=0
  mai=2 if sums%3==0 & sums // 3 <= a else 0
  for i in range(a):
    if sums-i <2*a:
      for d in range(a):
        if sums-i-d<a:
          if (sums-i-d == i) | (sums-i-d == i):
            ret+=1
          else:
            ret+=2
    if sums-i == 2*a:
      ret+=1
  print(ret*3-mai)

a,sums=list(map(int,input().split()))
if a*3==sums:
  print(1)
else:
  ret=0
  mai=2 if sums%3==0 & sums // 3 <= a else 0
  for i in range(a):
    if sums-i <2*a:
      for d in range(a):
        if sums-i-d<a:
          if sums-i-d == d:
            ret+=1
          else:
            ret+=2
    if sums-i == 2*a:
      ret+=1
  print(ret*3-mai)

a,sums=list(map(int,input().split()))
if a*3==sums:
  print(1)
else:
  ret=0
  for x in range(a+1):
    if (sums-x <=2*a)&(sums>=x):
      for y in range(a+1):
        if (sums-x-y>=0)&(sums-x-y<=a):
          ret+=1
  print(ret)

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())

X=Y=Z=0
result = 0
while(X<=K):
    while(Y<=K):
        while(Z<=K):
            print("X,Y,Z",X,Y,Z)
            if X+Y+Z<S:
                pass
            elif X+Y+Z==S:
                result +=1
            else:
                break
            Z+=1
        Z=0
        Y+=1
    Y=0
    X+=1
print(result)




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

X=Y=Z=0
result = 0
while(X<=S):
    while(X+Y<=S):
        Z = S-X-Y
        print("X,Y,Z",X,Y,Z)
        if X+Y+Z == S:
            if X<=K and Y<=K and Z<=K :
                result+=1 
        # Z=X+Y-S
        # if X+Y+Z==S:
        #     result +=1
        # while(Z<=K):
        #     if X+Y+Z<S:
        
        #     elif X+Y+Z==S:
        #         result +=1
        #     else:
        #         break
        #     Z+=1
        # if X+Y+Z>S:
        #     break
        Y+=1
    Y=0
    X+=1
print(result)




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

X=Y=Z=0
result = 0
while(X<=S):
    while(X+Y<=S):
        Z = S-X-Y
        print("X,Y,Z",X,Y,Z)
        if X+Y+Z == S:
            if X<=K and Y<=K and Z<=K :
                result+=1 
        # Z=X+Y-S
        # if X+Y+Z==S:
        #     result +=1
        # while(Z<=K):
        #     if X+Y+Z<S:
        
        #     elif X+Y+Z==S:
        #         result +=1
        #     else:
        #         break
        #     Z+=1
        # if X+Y+Z>S:
        #     break
        if Y<K:
            Y+=1
        else:
            break
    if X<K:
        Y=0
        X+=1
    else:
        break

print(result)




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

X=Y=Z=0
result = 0
while(X<=K):
    while(Y<=K):
        while(Z<=K):
            if X+Y+Z<S:
                pass
            elif X+Y+Z==S:
                result +=1
            else:
                break
            Z+=1
        if X+Y+Z<=S:
            Z=0
            Y+=1
        else:
            break
    Y=0
    X+=1
print(result)




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

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

print(result)

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

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())
count = 0
print(k,s)
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
print(count)

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


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


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


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())
ans=0
if s%3==0:
  ans+=1
for i in range(k):
  if 2*k<=s<3*k:
    ans+=3
for i in range(k-1):
  for j in range(i+1,k):
    for k in range(j+1,k+1):
      if i+j+k==s:
        ans+=6


print(ans)

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

print(cnt)

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
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np

num = 0
for x in range(K+1):
    tmp = min(S-x, K) - max(0, S-K-x)
    if tmp >= 0:
        num += tmp + 1


print(num)

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np

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

print(num)

num = 0
for x in range(K+1):
    tmp = min(S-x, K) - max(0, S-K-x)
    if tmp >= 0:
        num += tmp + 1


print(num)

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np

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

num = 0
for x in range(K+1):
    tmp = min(S-x, K) - max(0, S-K-x)
    if tmp >= 0:
        num += tmp + 1


print(num)

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())
ans=0
for x in range(k+1):
  for y in range(k+1):
    z=s-x+y
    ans += 1 if z>=0 and z<=k
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
    ans += 1 if z>=0 and z<=k else 0
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())
p = 0
for x in range(0,k+1):
  for y in range(0,k+1):
    for z in range(0,k+1):
      if (x+y+z) == s:
        p+=1
      if (x+y+z) >= s:
        break
    if (x+y+Z) >= s:
      break
print(p)

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

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

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

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

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

count = 0
for i in range(k+1):
    for j in range(k+1):
        if k >= s-i-j >= 0:
            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(s+1):
	for j in range(i,s+12 2):
		if i<=k and j-i<=k and s-j<=k:
			cnt+=1
print(cnt)
		

k,s=map(int,input().split())
cnt=0
for i in range(s+1):
    if i>k:
        break
    cnt+= max(0,min(i+k,s)-max(s-k,i)+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 = list(map(int, input().split()))

res = 0

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

print(res)

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

res = 0

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

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

Verdicts: Wrong Answer

Accepted