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

for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+j+k==s:
                ans+=1

print(ans)


import sys
import itertools
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 andz<=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 z>=0 and 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):
import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

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

import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

k, s = na()
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
                                break
print(ans)




import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

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




from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


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


Verdicts: Wrong Answer

Time Limit Exceeded

Time Limit Exceeded

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()
k, s = int(k), int(s)
ans = 0
for x in range(0, k+1):
  for y in range(x, k+1):
    for z in range(y, k+1):
      if x+y+z==s:
        if x==y and y==z:
          ans += 1
        elif x==y and y!=z:
          ans += 2
        elif x!=y:
          ans += 3
      break
print(ans)

k, s = input().split()
k, s = int(k), int(s)
ans = 0
for x in range(0, k+1):
  for y in range(x, k+1):
    for z in range(y, k+1):
      if x+y+z==s:
        if x==y and y==z:
          ans += 1
        elif x==y and y!=z:
          ans += 3
        elif x!=y:
          ans += 3
      break
print(ans)

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

if 3*a < b:
  print(ans)
elif 3*a == b:
  print(1)
elif 3*a > b:
  for i in range(a+1):
    if i > b:
      break
    elif i == b:
      ans += 1
      break
    elif i < b:
      if i+2*a < b:
        break
      elif i+2*a == b:
        ans += 1
        break
      elif i+2*a > b:
        for j in range(a+1):
          if i+j > b:
            break
          elif i+j == b:
            ans += 1
            break
          elif i+j < b:
            if i+j+a < b:
              break
            elif i+j+a == b:
              ans += 1
              break
            elif i+j+a > b:
              for k in range(a+1):
                if i+j+k > b:
                  break
                elif i+j+k == b:
                  ans += 1
              
  print(ans)

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

if 3*a < b:
  print(ans)
elif 3*a == b:
  print(1)
elif 3*a > b:
  for i in range(a+1):
    if i > b:
      break
    elif i == b:
      ans += 1
      break
    elif i < b:
      if i+2*a < b:
        break
      elif i+2*a == b:
        ans += 1
        break
      elif i+2*a > b:
        for j in range(a+1):
          if i+j > b:
            break
          elif i+j == b:
            ans += 1
            break
          elif i+j < b:
            if i+j+a < b:
              break
            elif i+j+a == b:
              ans += 1
              break
            elif i+j+a > b:
              for k in range(a+1):
                if i+j+k > b:
                  break
                elif i+j+k == b:
                  ans += 1
              
  print(ans)

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

if 3*a < b:
  print(ans)
else:
  for i in range(a+1):
    if i+2*a > b and i < b:
      for j in range(a+1):
        if i+j+a > b:
          for k in range(a+1):
            if i+j+k == b:
              ans += 1
              
  print(ans)


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

for i in range(a):
  for j in range(a):
    for k in range(a):
      if i+j+k==b:
        ans += 1
        
print(ans)

k,s = list(map(int, input().split()))
ans = 0
for x in range(k+1):
  mx = min(k, s-x)
  mn = max(0, s-x-k)
  ans += max(0, mx-mn+1)
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
K, S = map(int, input().split())
m=0
for i in range(K):
  for j in range(K):
    if 0<=S-i-j<=K:
      m+=1
print(m)

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

Verdicts: Wrong Answer

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

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

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

K, S = map(int, input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    if 0 <= S - x - y <= K:
      count += 1
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):
import time
a, b = map(int, input().split())
c = 0
for i in range(b // 3, a + 1):
    for j in range((b - i) // 2, a + 1):
        if b - i - j <= a:
            c += 1
        elif b - i - j > a:
            break
print(c)


a, b = map(int, input().split())
c = 0
for i in range(a + 1):
    for j in range(a + 1):
        if i + j > b:
            break
        else:
            if b - i - j <= a:
                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())
one = 0
three = 0
six = 0
if S%3==0:
    one = 1
else:
    one = 0
for l in range(K+1):
    if (S-l)%2==0 and (S-l)//2 =< K:
        three += 1
for m in range(K-1):
    for n in range(m+1,K):
        rest = S-(m+n)
        if rest>n and rest<=K:
          six += 1
print(one+3*(three-one)+6*six)

K,S = map(int,input().split())
div = (K+1)//3
one = 0
three = 0
six = 0
for l in range(div):
  for m in range(l+1,div):
    for n in range(m+1,div):
      if l+m+n == S:
        six +=1
if S%3 == 0:
  one = 1
for i in range(K+1):
  if (S-i)%2 ==0 and S%3!=0:
    two +=1

print(one+3*three+6*six)

K,S = map(int,input().split())
one = 0
three = 0
six = 0
if S%3==0:
    one = 1
else:
    one = 0
for l in range(K+1):
    if (S-l)%2==0 and (S-l)//2 <= K and (S-l)>=0:
        three += 1
for m in range(K-1):
    for n in range(m+1,K):
        rest = S-(m+n)
        if rest>n and rest<=K:
          six += 1
print(one+3*(three-one)+6*six)

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())
x=0
m=min(s+1,k+1)
for a in range(m):
  for b in range(m):
    if a+b>s or a+b<s-k:
      continue
    x+=1
    break
print(x)

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

k,s=map(int,input().split())
x=0
m=min(s+1,k+1)
for a in range(m):
  for b in range(m):
    if a+b>s or a+b<s-k:
      continue
    x+=1
print(x)

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

ANS = 0

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

print(ANS)

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

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

print(count)

Verdicts: Wrong Answer

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

Submission attempts (in order):
K, S = map(int,input().split())
count = 0
start = S - 2*K
for X in range(start,K+1):
    for Y in range(X,K+1):
        for Z in range(Y,K+1):
            if X+Y+Z == S:
                if X == Y and X == Z:
                    count += 1
                elif X == Y and Y != Z:
                    count += 3
                elif Y == Z  and Z != X:
                    count += 3
                else:
                    count += 6

print(count)

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
def solve(K: int, S: int):
    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)
    return
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    solve(K, S)
 
if __name__ == '__main__':
    main()
#!/usr/bin/env python3
import sys


def solve(K: int, S: int):
    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)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    solve(K, S)

if __name__ == '__main__':
    main()
提出情報

a,b,c = input().split(',')
print(a,b,c)

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

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):
ks = list(map(int, input().split()))
k = min(ks)
ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if s == x + y + z:
                ans += 1
            else:
                pass

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 >=0 and z <= k:
            ans += 1
        else:
            pass
        

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())
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(K):
  for j in range(K-i):
    for k in range(K-i-j):
      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

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

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

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


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

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


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
k,s=int(input())
count = 0
for x in range(k+1):
  for y in range(k+1):
    if 0 <= (s - x - y) and (s - x - y) <= k:
      count += 1
print(count)

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

Verdicts: Runtime Error

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

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


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


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


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

print(counter)

k, s = list(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 i in range(K):
    for j in range(K):
        for k in range(K):
            V = i + j + k
            if V == S:
                ans += 1
                break
            elif V > S:
                break
    
    
print(ans)


K,S = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            V = i + j + k
            if V == S:
                ans += 1
                break
            elif V > S:
                break
    
    
print(ans)


K,S = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            V = i + j + k
            if V = S:
                ans += 1
                break
            elif V > S:
                break
    
    
print(ans)

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

Verdicts: Wrong Answer

Runtime Error

Runtime Error

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

Submission attempts (in order):
import collections
 

def inputStrOnebyOne():
    s = list(input())
    return s
 

def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a
 
def main():
    ret=0
    k,s = map(int,input().split())
    for x in range(k+1):
        for y in range(k+1):
            if s-x-y <= k:
                ret+=1
    print(ret)
 
if __name__=='__main__':
    main()

import collections
 

def inputStrOnebyOne():
    s = list(input())
    return s
 

def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a
 
def main():
    ret=0
    k,s = map(int,input().split())
    for x in range(k+1):
        for y in range(k+1):
            if 0 <= s-x-y <= k:
                ret+=1
    print(ret)
 
if __name__=='__main__':
    main()

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(" "))
l = [i for i in range(K + 1)]
cnt = 0
for x, y in itertools.combinations_with_replacement(l, 2):
    z = S - (x + y)
    if 0 <= z <= K:
        cnt += 1
print(cnt)

import itertools
K, S = map(int, input().split(" "))
l = [i for i in range(K+1)]
cnt = 0
for x, y, z in itertools.combinations_with_replacement(l, 3):
    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 <= 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):
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)

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

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

print(ans)

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

for x in range(K+1):
    for y in range(K+1):
        if K >= S-x-y:
            ans += 1
            break

print(ans)

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

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

print(ans)

Verdicts: 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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    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:
                c += 1
    print(c)


main()


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

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


main()


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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
# -*- coding: utf-8 -*-


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

ans = 0

for i in range(k+1):
    forj in range(k+1):
        z = s-i-j
        if 0 <= z and z <=k:
            ans = ans+1

print(ans)

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


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

ans = 0

for i in range(k+1):
    for j in range(k+1):
        z = s-i-j
        if 0 <= z and z <=k:
            ans = 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())
print(len([for X in range(K+1) for Y in range(K+1) if 0<=S-X-Y<=K]))


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

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
# coding: utf-8
# Your code here!


ans = 0


print(ans)











# coding: utf-8
# Your code here!

import pandas as pd

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

lst = [i for i in range(k+1)]



ans = 0
ans = s_bool.sum()

print(ans)











# coding: utf-8
# Your code here!

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

cnt = 0

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

print(cnt)

# coding: utf-8
# Your code here!




ans = 0
ans = s_bool.sum()

print(ans)











# coding: utf-8
# Your code here!
import itertools
import pandas as pd


# coding: utf-8
# Your code here!


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

lst = [i for i in range(k+1)]


ans = 0
ans = s_bool.sum()

print(ans)












import itertools
import pandas as pd

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













# coding: utf-8
# Your code here!
import itertools
import pandas as pd

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

lst = [i for i in range(k+1)]




ans = 0
ans = s_bool.sum()

print(ans)











# coding: utf-8
# Your code here!

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

cnt = 0

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

print(cnt)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

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

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

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

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

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

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

print(cnt)

Verdicts: Runtime Error

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

Submission attempts (in order):
K,S = map(int, input().split())

ans = 0
for x in range(K+1):
    max_y = S - x if S - x < K else K
    for y in range(max_y + 1): 
        max_z = S - x - y if S - x -y < K else K
        for z in range(max_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): 
        z = S - x - y 
        if 0 <= z 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())

count = 0
num = range(k+1)
for x in num:
  for y in num:
    if x + Y > s:
      break
    for z in num:
      if x + y + z == s:
        count += 1
      elif x + y + z > s:
        break

print(count)

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

count = 0
for x in range(k+1):
  a = s-k-x
  a = 0 if a < 0 else a
  for y in range(a,k+1):
    if x + y > s:
      break
    for z in num:
      if x + y + z == s:
        count += 1
      elif x + y + z > s:
        break

print(count)

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

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

print(count)

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

count = 0
num = range(k+1)
for x in num:
  for y in num:
    if x + Y > s:
      break:
    for z in num:
      if x + y + z == s:
        count += 1
      elif x + y + z > s:
        break:

print(count)

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

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

print(count)

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

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

print(count)

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

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

print(count)

Verdicts: Runtime Error

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(i) for i in input().split()]
cnt = 0

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

K, S = [int(item) for item in input().split()]

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

        if 0 <= 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):
import sys
sys.setrecursionlimit(10 ** 5)


# sys.stdout = open('output.txt', 'w') 

# readline =sys.stdin.readline

# time - O(n2)
def process():
    k,s = map(int,readline().rstrip().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
    
    return cnt



# for _ in range(int(readline().rstrip())):
print(process())


import sys
sys.setrecursionlimit(10 ** 5)


# sys.stdout = open('output.txt', 'w') 

readline =sys.stdin.readline

# time - O(n2)
def process():
    k,s = map(int,readline().rstrip().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
    
    return cnt



# for _ in range(int(readline().rstrip())):
print(process())


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

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

def main():
  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)

if __name__ == "__main__":
  main()

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(input().split())
ans = 0
for o in range(2, K):
    for p in range(2, K):
        for q in range(2, K):
            if o + p + q == S:
                ans += 1
print(ans)

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

K, S = map(int,input().split())
ans = 0
for o in range(0, K):
    for p in range(0, K-o):
        for q in range(0, K-o-p):
            if o + p + q == S:
                ans += 1
print(ans)

K, S = int(input().split())
ans = 0
for o in range(2, K):
    for p in range(2, K-o):
        for q in range(2, K-o-p):
            if o + p + q == S:
                ans += 1
print(ans)


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


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

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

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

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

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

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

print(count)


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

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

print(count)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

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

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

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

Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
k,s = map(int, input().split())
a = []
for i in range(s):
    for j in range(s):
        for l in range(s):
            a.append(i+j+l)
b = a.count(s)
print(b)

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

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

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

ans = 0
for x in range(k+1):
    if x > s:
        break
    if x+k+k < s:
        continue
    for y in range(x, k+1):
        xy = x+y
        if xy > s:
            break
        if xy+k < s:
            continue
        for z in range(y, k+1):
            xyz = x+y+z
            if xyz > s:
                break
            if x==y==z:
                ans += 1
            elif x!=y!=z!=x:
                ans += 6
            else:
                ans += 3
print(ans)

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

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

Verdicts: 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):
# 2017-01-07
import itertools

K,S = map(int, input().split())
X = list(range(K+1))
Y = list(range(K+1))
Z = list(range(K+1))
count=0

for x,y,z in list(itertools.product(X, Y, Z)):
    if x+y+z == S:
        print(x,y,z)
        count+=1

print(count)


import itertools

K,S = map(int, input().split())
X = list(range(K+1))
count=0

for x,y in list(itertools.product(X, X)):
    if x+y >= S-K:
        count+=1

print(count)


import itertools

K,S = map(int, input().split())
X = list(range(K+1))
count=0

for x,y in list(itertools.product(X, X)):
    if x+y <= S and x+y+K>=S:
        count+=1
        print(x,y)

print(count)

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

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




print(cnt)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
K, S = map(int, input().split())
print((S+1)*(S/2 + 1) - max(0, S-K)*(max(0,S-K)+1)/2)

K, S = map(int, input().split())
res = 0
for X in range(0, K+1):
    for Y in range(0, K+1):
            total = X + Y
            if S - total >=0 and S - total <= 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
if s>3*k:
    print(0)
elif s-k<=0:
    for i in range(s+1,0,-1):
        print(i)
        ans += i
else:
    for i in range(s-k+1):
        for j in range(s+1):
            if i<=k and j<=k and s-k<=i+j<=s: 
                ans += 1
print(ans)

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

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

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

Verdicts: Wrong Answer

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

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


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

asn=o

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

print(ans)

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

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

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

print(ans)

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

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

print(ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
# -*- coding: utf-8 -*-

def solve(K, S):
    count = 0
    
    for i in range(K+1):
        for j in range(K+1):
            if(0<= S-i-j <= K):
                print(i, j)
                count += 1
    print(count)

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

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 or S - i - j > K:
            continue
        else:
            cnt += 1
print(cnt)

Verdicts: Wrong Answer

Accepted