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):
#AtCoder Beginner Contest 051 B - Sum of Three Integers
k, s = map(int, input().split())
cnt = 0
for l in range(k+1):
    for m in range(k+1):
        if k<=l+m<=s and s-l-m<=k:
            cnt += 1
print(cnt)

#AtCoder Beginner Contest 051 B - Sum of Three Integers
k, s = map(int, input().split())
cnt = 0
for l in range(k+1):
    for m in range(k+1):
        if l+m<=s and s-l-m<=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 = (int(i) for i in 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 = (int(i) for i in input().split())
count = 0
for x in range(1,k+1):
    for y in range(1, k + 1):
        for z in range(1, k + 1):
            if x + y + z == s:
                count += 1

print(count)

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

count = 0
for i in range(K+1):
  for j in range(K+1):
    if  0 <= S <= 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):
    for k in range(K+1):
      if i + J + K == S:
        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  0 <= S - i - j <= 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):
import itertools

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

cnt = 0

K = list(range(K + 1))

for i, j in itertools.product(K, repeat=2):
    if 0 <= S - i - j <= K:
        cnt += 1

print(cnt)


import itertools

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

cnt = 0

l = list(range(K + 1))

for i, j in itertools.product(l, repeat=2):
    if 0 <= S - i - j <= 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())

count = 0

for i in range(k):
    x = i + 1
    if x < s:
        for j in range(k):
            y = j + 1
            if x + y < s:
                for l in range(k):
                    z = l + 1
                    if x + y + z == s:
                        count = count + 1
            elif x + y == s:
                count = count + 1
    elif x == s:
        count = count + 1

print(count)

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

count = 0

if s > 3 * k:
    print(count)

else:
    for i in range(k + 1):
        x = i
        if x < s:
            for j in range(k + 1):
                y = j
                if s - (x + y) <= k and x + y <= s:
                    count = count + 1
                elif x + y > s:
                    break
        elif x == s:
            count = count + 1
        else:
            break

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+1):
    for j in range(K+1):
        count += max(0, S-i-j+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):
if __name__ == '__main__':
    ks = input()
    k, s = [int(i) for i in ks.split()]

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

    print(c)


if __name__ == '__main__':
    ks = input()
    k, s = [int(i) for i in ks.split()]

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

def solve(K, S):
    count = 0
    for x in range(K+1):
        for y in range(K+1):
            if S - x - y <= K:
                count = count + 1
    return count


if __name__ == '__main__':
    K, S = map(int, input().split())
    print(solve(K, S))



def solve(K, S):
    count = 0
    for x in range(K+1):
        for y in range(K+1):
            for z in range(K+1):
                if x + y + z == S:
                    count = count + 1
                if x + y + z > S:
                    break
    return count


if __name__ == '__main__':
    K, S = input().split()
    print(solve(K, S))


def solve(K, S):
    count = 0
    for x in range(K+1):
        for y in range(K+1):
            z = S - x - y
            if K >= z >= 0:
                count = count + 1
    return count


if __name__ == '__main__':
    K, S = map(int, input().split())
    print(solve(K, S))


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):
from itertools import combinations_with_replacement

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

ans = 0
for x, y, z in combinations_with_replacement(range(k+1), 3):
    if x + y + z == s:
       ans += 1

print(ans)



from itertools import combinations_with_replacement

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

ans = 0
for i, j, k in combinations_with_replacement(range(k+1), 3):
    if i + j + k == 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 z % 1 == 0):
            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())
c = 0
for i in range(K+1):
    for j in range(K+1):
        b = S - i - j
        if b <= k and b >= 0:
            c += 1
print(c)

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

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

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

print(count)

a

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())
res = 0

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

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

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

k, s = 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

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):
def main():
	K,S = map(int,input().split())
	ans = 0
	ListK = [i+1 for i in range(K)]
	for x in ListK:
		for y in ListK:
			if S - (x + y) <= K:
				ans += 1

if __name__ == '__main__':
	main()

def main():
	K,S = map(int,input().split())
	ans = 0
	ListK = [i for i in range(K)]
	for x in ListK:
		for y in ListK:
			for z in ListK:
				if x + y + z == S:
					ans += 1
	print(ans)

if __name__ == '__main__':
	main()

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

if __name__ == '__main__':
	main()

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

if __name__ == '__main__':
	main()

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 x in range(1,k+1):
  for y in range(1,k+1):
    for z in range(1,k+1):
      if x+y+z==s:
        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 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 (s-(x+y)>=0)and(s-(x+y)<=k):
        cnt+=1
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):
import itertools
k,s = map(int,input().split())

cnt = 0

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

print(cnt)


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

cnt = 0

for i in range(0,k+1):
  for j in range(0,k+1):
    z = s - i -j
    if z >= 0 and 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):
from sys import stdin
def LI(): return list(map(int,stdin.readline().rstrip().split()))

tmp = LI()

k,s = [tmp.pop(0) for i in range(2)]

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

print(c)

from sys import stdin
def LI(): return list(map(int,stdin.readline().rstrip().split()))

tmp = LI()

k,s = [tmp.pop(0) for i in range(2)]

c=0
for i in range(k,-1,-1):
    if i<=s:
        for j in range(k,-1,-1):
            if 0<=s-i-j and s-i-j<=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())

ans = 0

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

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




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

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




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

Verdicts: Runtime Error

Runtime Error

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(x) for x in input().split()]

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

print(result)


K,S = (int(x) for x in 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 = 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)

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: 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(max(0, S - 2 * K), min(K + 1, S)):
  for j in range(max(0, S - 2 * K), min(K + 1, S)):
      if i + j <= S and i + j >= S - K:
        count += 1
print(count)

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

K, S = map(int, input().split())
count = 0
for i in range(max(0, S - 2 * K), min(K, S) + 1):
  for j in range(max(0, S - 2 * K), min(K, S) + 1):
      if i + j <= S and i + j >= S - 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())
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if (i+j+k)==S:
                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 S-i-j>=0 and 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())

cnt = 0

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

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 and x + y + z == S:
      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:
            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) & (x + y + z == S):
            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):
# -*- coding: utf-8 -*-

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

for x in range(0, K+1):
    for y in range(0, K+1):
        for z in range(0, K+1):
            print(x, y, z)
            if x + y + z == S:
                count += 1

print(count)


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

cnt = 0
for x, y, z in range(K):
  if x+y+z == S:
    cnt += 1
print(cnt)    

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

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

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):
 import sys
 import copy
 sys.setrecursionlimit(1000000)
 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 >= 0 and z <= K:
             ans += 1
 print(ans)

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

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

for i in range(K+1):
   if 3 * i == S:
       cnt += 1

print(cnt)

K, S = map(int, input().split())
res = 0
for XY in range(2*K+1):
    Z = S - XY
    if Z in range(K+1):
        res += 1

print(res)

K, S = map(int, input().split())
res = 0
for X in range(K+1):
    for Y in range(K+1):
        Z = S - X - Y
        if Z in range(K+1)
            res += 1

print(res)

K, S = map(int, input().split())
res = 0
for XY in range(2*K+1):
    Z = S - XY
    if Z in range(K):
        res += 2
    else:
        res += 1

print(res)

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

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 sys
input = sys.stdin.readline

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

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

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

print(sum(ans))

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

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

import sys
input = sys.stdin.readline
K,S=2500,5692

ans = []
 
for i in range(K+1):
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      ans.append(K*2 - s_z + 1)
  else:
    ans.append(s_z + 1)

print(sum(ans))

def f(K, S):
    z = list(range(0,K+1))
    answer = []

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

      else:
          answer.append(s_z + 1)

    return sum(answer)

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

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

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

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

print(len(answer))

import sys
input = sys.stdin.readline
 
K,S=map(int,input().split())

ans = []
 
for i in range(K+1):
  s_z = S - i

  if s_z < 0:
    pass

  elif K < s_z:
    if (K + 1) > (s_z - K):
      ans.append(K + K - s_z + 1)
      
  else:
    ans.append(s_z + 1)

print(sum(ans))

Verdicts: Runtime Error

Runtime Error

Runtime Error

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 = input().split()
c = 0
for i range(k+1):
  x = i
  for j range(k+1):
  	y = j
    for h range(k+1):
      z = h
      sum = x + y + z
      if sum == k:
        c += 1
        
print(c)


k, s = map(int, input().split())
c = 0
for i in range(k+1):
    x = i
    for j in range(k+1):
        y = j
    for h in range(k+1):
        z = h
        sum = x + y + z
        if sum == k:
            c += 1
        
print(c)

k, s = input()
c = 0
for i range(k+1):
  x = i
  for j range(k+1):
  	y = j
    for h range(k+1):
      z = h
      sum = x + y + z
      if sum == k:
        c += 1
        
print(c)

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

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

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

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

i = list(map(int, input().split()))
k = i[0]
s = i[1]
#print("k=",k,"s=",s)
ans = 0
for x in range(k+1):
  for y in range(k+1):
    z = k-x-y
    if x+y+z == s:
#        print("clear!")
        ans += 1
print(ans)


i = list(map(int, input().split()))
k = i[0]
s = i[1]
#print("k=",k,"s=",s)
ans = 0
for x in range(k+1):
  for y in range(k+1):
    z = s-x-y
    #print("x=",x,"y=",y,"z=",z)
    if k >= z and z >=0:
        #print("clear!")
        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 = tuple(map(int, input().split()))

ret = 0 
for X in range(K+1):
  for Y in range(X, K+1):
    Z = S - X - Y
    if Z < Y: break
    if Z >= 0 and Z <= K:
      print(X, Y, Z)
      if X == Y and Y == Z: ret += 1
      elif X != Y and Y != Z and Z != X: ret += 6
      else: ret += 3

print (ret)

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

ret = 0 
for X in range(K+1):
  for Y in range(X, K+1):
    Z = S - X - Y
    if Z < Y: break
    if Z >= 0 and Z <= K:
      if X == Y and Y == Z: ret += 1
      elif X != Y and Y != Z and Z != X: ret += 6
      else: ret += 3

print (ret)

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 random

data=int(input().split
b=data[0]
c=data[1]
count_data=0
random_data=random.randint(0,b)
random_data2=random.randint(0,b)
random_data3=random.randint(0,b)
resalt=random_data+random_data2+random_data3
if resart<= c:
     count_data=count_data+1
else:
	pass
print(count_data)

data=int(input().split
b=data[0]
c=data[1]
d=0
e=0
f=0
for i in range(b):	
	for j in range(b):
         for k in range(b):
         	d=i+j+k
         	if d <=15:
         		e=e+1
         	else:
         		pass
print(e)


import sys

data=input().split(' ')
data_1=int(data[0])
data_2=int(data[1])
d=0
e=0
for i in range(data_1):	
	for j in range(data_1):
         for k in range(data_1):
         	d=i+j+k
         	if d <data_2:
         		e=e+1
         	else:
         		pass
print(e)

import sys

data=input().split(' ')
k=int(data[0])
data_1sub=k+1
s=int(data[1])
d=0
e=0
for i in range(data_1sub):
    for j in range(data_1sub):
        d=s-i-j
        if (0 <= d) and (d <= k):
            e=e+1
        else:
            pass
print(e)

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

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

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
        ans += ((z>=0) or (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 += ((0<=z<=K))
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
debug = []
for i in range(k+1):
    for l in range(k+1):
        if (s-i-l) >= 0 and (s-i-l) <= k:
            if i+l+(s-i-l) == s:
                ans += 1
                debug.append(str(i)+"+"+str(l)+"+"+str(s-i-l))
                print(debug)
print(ans)

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

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

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

k,s=map(int,input().split())
dp=[0]*(3*k+4)
dp[0]=1
dp[k+1]=-3
dp[2*k+2]=3
dp[-1]=-1
from itertools import accumulate
dp=list(accumulate(list(accumulate(list(accumulate(dp))))))
print(dp[s])

Verdicts: Wrong Answer

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(max(s - 2 * k, 0), k + 1):
    for y in range(s - x - k, min(s - x + 1, k + 1)):
        z = s - x - y
        if 0 <= z <= k:
            cnt += 1
        else:
            continue
print(cnt)


k, s = map(int, input().split())
cnt = 0
for x in range(max(s - 2 * k, 0), k + 1):
    for y in range(max(s - x - k, 0), min(s - x + 1, k + 1)):
        z = s - x - y
        if 0 <= z <= k:
            cnt += 1
        else:
            continue
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())

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

print(counter)

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

counter = 0
for x in range(K+1):
    for y in range(K+1):
        if  0<= S - x - y <= K:
            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())
ans = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            print(x, y, z)
            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):
        ans += 1 if 0 <= S - x - y <= K 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())
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(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):
  if k <=s-i<=2*k:
    ans+= k*2-s+i+1
  elif 0<=s-i<=k:
    ans+= s-i+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())

x =0

for i in range(min(k+1,s+1)):
    x += max(0, min(s-i,k)+1 - max(0,s-i-k) )
    print(x)
print(x)

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

x =0

for i in range(min(k+1,s+1)):
    x += max(0, min(s-i,k)+1 - max(0,s-i-k) )

print(x)

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())
ks = [_ for _ in range(s//3+1, k+1)]

count = 0

for ksk1 in ks:
    for ksk2 in ks:
        z = s - ksk1 - ksk2
        if 0 <= z <= k:
            count += 1
            
print(count)

k, s = map(int, input().split())
ks = [_ for _ in range(s//3-1, k+1)]

count = 0

for ksk1 in ks:
    for ksk2 in ks:
        z = s - ksk1 - ksk2
        if 0 <= z <= k:
            count += 1
            
print(count)

k, s = map(int, input().split())
ks = [_ for _ in range(k+1)]

count = 0

for ksk1 in ks:
    for ksk2 in ks:
        z = s - ksk1 - ksk2
        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):
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
K, S = map(int, input().split())
count = 0
for x in range(K):
    for y in range(K):
        z = S - x - y
        if z <= K & z >= 0:
            count += 1
print(str(count))


#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
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 and z >= 0:
            print(str(x)+str(y)+str(z))
            count += 1
print(str(count))


#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
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 and z >= 0:
            count += 1
print(str(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=[int(i) for i in input().split()]
count=0
#print(k,s)
for y in range(k+1):
 for x in range(k+1):
   if x + y <= s + k and s-x-y>=0 and s-x-y<=k:
      print(x,y,s-x-y)
      count=count+1
print(count)


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


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

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

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


print(count)

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


print(count)

K,S = (int(x) for x in input().split())
count = 0

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


print(count)

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())
count=0
for X in range(K+1):
    for Y in range(X,K+1):
        for Z in range(Y,K+1):
            com=X+Y+Z
            if(com==S):
                count+=1
            else:
                pass
print(count)

K,S=map(int,input().split())
count=0
for X in range(K+1):
    for Y in range(K+1):
        com=S-(X+Y)
        if(com>=0 and com<=K):
            count+=1
        else:
            pass
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 x in range(k+1):
    if s/k==3 :
        cnt=1
        break
    for y in range(k+1):
        z=s-x+y
        sum=x+y+z
        if sum == s:
            cnt+=1
print(cnt)

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


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


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

i=0

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

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

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 x in range(k+1):
    if s-x > 2 * k:
        continue
    for y in range(k+1):
        if s-x-y > k:
            continue
        if s-x-y <= k and s-x-y >=0:
            print(x,y)
            counter += 1
                
print(counter)

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

counter = 0

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

k = int(input())
s = int(input())
counter = 0

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

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

for x in range(k+1):
    if s-x > 2*k:
        continue
    for y in range(k+1):
        if s-x-y > k or s-x-y < 0:
            continue
        else:
            counter += 1
            
print(counter)

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())
count = 0

for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if S == x+y+z:
            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 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):
# -*- coding: utf-8 -*-
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 > 0 and Z <= K:
            cnt += 1

print(cnt)


# -*- coding: utf-8 -*-
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):
ks = input().split()

k = int(ks[0])
s = int(ks[1])

ans = 0

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

ks = input().split()

k = int(ks[0])
s = int(ks[1])

ans = 0

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

Verdicts: Wrong Answer

Accepted