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

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


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

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
k,s=map(int,input().split());k+=1;print(sum(k>=s-x//k-y%k>=0for I in range(k**2)))

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

Verdicts: Runtime Error

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

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

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

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


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


Verdicts: Wrong Answer

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

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
K, S = map(int, input().split())
print([x+y+z == S for x in range(K+1) for y in range(K+1) for z in range(K+1)])


K, S = map(int, input().split())
print([S - x - y <= K for x in range(K+1) for y in range(K+1)].count(True))


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


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())
b=sum(0<=S-x-y<=K  for x in range(K+1)for y in range(K+1))
print(sum

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

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

cnt = 0
for x in range(K):
    for y in range(min(S-x+1, K+1)): # 0, S-x
        if 0 <= (S - (x + y)) <= K:
            cnt+=1
print(cnt)
            


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

cnt = 0
for x in range(K+1):
    for y in range(min(S-x+1, K+1)): # 0, S-x
        if 0 <= (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())
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K
        count += 1
print(count)


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


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


k, s = map(int, input().split())
x <= k
y <= k
z <= k
count = 0
for e in range(s+1):
  for f in range(s+1):
    for g in range(s+1):
      if e + f + g == s:
        count =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 and Z <= K:
        count += 1
print(count)


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

k,s = map(int,input().split())
x = 0
for d in range(0,k+1):
    for y in range(0,k+1):
        z = s - d - y
        if z<k+1 and z>=0:
            x = x+1
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 = int(input().split())
ret = 0
for i in range(k+1):
    bmax = min(k,bpc)+1
    bmin = max(0,s-i-k)
    if bmin < bmax : ret += bmax - bmin
print(ret)

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

Verdicts: Runtime Error

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

Submission attempts (in order):
a = list(map(int,input().split()))
k = a[0]
s = a[1]
num=0
for l in range(k+1):
    for m in range(l,k+1):
        n = s-l-m
        if(n <= k & n >= 0):
            if(l!=m and l!= n and m!=n):
                num+=3
            else if (l==m and m==n):
                num+=1
            else:
                num+=2
                
print(num)


k,s = input().split()
for l in range(k):
    for m in range(k):
        if(s-l-m <= k):
            print(l,m,s-l-m)


a = list(map(int,input().split()))
k = a[0]
s = a[1]
num=0
for l in range(k+1):
    for m in range(k+1):
        n = s-l-m
        if(n <= k & n >= 0):
            num+=1

print(num)


a = list(map(int,input().split()))
for l in range(a[0]+1):
    for m in range(a[0]+1):
        if(a[1]-l-m <= a[0]):
            print(l,m,a[1]-l-m)



a = list(map(int,input().split()))
num=0
for l in range(a[0]+1):
    for m in range(a[0]+1):
        if(a[1]-l-m <= k):
            num+=1


a = list(map(int,input().split()))
num=0
for l in range(a[0]+1):
    for m in range(a[0]+1):
        if(a[1]-l-m <= a[0]):
            num+=1
print(num)


a = list(map(int,input().split()))
num=0
for l in range(a[0]+1):
    for m in range(a[0]+1):
        if(a[1]-l-m <= k):
            num++

a = list(map(int,input().split()))
num=0
for l in range(a[0]+1):
    for m in range(a[0]+1):
        if(a[1]-l-m <= a[0]):
            num+=1

a = list(map(int,input().split()))
k = a[0]
s = a[1]
num=0
for l in range(k+1):
    for m in range(k+1):
        n = s-l-m
        if(n <= k and n >= 0):
            num+=1

print(num)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

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

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

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

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

print(count)

Verdicts: Wrong Answer

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

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

for x in range(K+1):
  if S<=K:
    a+=S-x+1-2*K
  elif K<S-x<=2*K:
    a+=S-x+1
  else:
    a+=0

print(a)




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

count= 0

for i in range(K+1):# X
  for j in range(K+1):#Y
    Z = S - i - j
    if Z <= K & Z >=0:
      count += 1

print(count)

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
k,s=map(int,input().split())
c=0
for x in range(k+1):
    for y in range(k+1):
            if s-x-y<=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 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):
# -*- coding: utf-8 -*-
K,S=map(int,input().split())
count=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      if i+j+k==S:
        count=count+1
print(count)

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

# -*- coding: utf-8 -*-
K,S=map(int,input().split())
count=0
for i in range(K+1):
  for j in range(K+1):
    k=S-i-j
    if 0<=k<=K:
      count=count+1
print(count)

Verdicts: Wrong Answer

Runtime Error

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

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

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

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

l = 0

if s <= k:
  l = int((k+2)(k+1)/2)
else:
  for x in range(0,k+1):
    if s-x > 2*k:
      l += 0
    elif k < s-x <= 2*k:
      l += 2*k - s + x + 1
    elif s-x <= k:
      l += s-x+1      
print(l)


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

l = 0

if s <= k:
  l = int((k+2)(k+1)/2)
else:
  for x in range(0,k+1):
    if s-x > 2k:
      l += 0
    elif k < s-x <= 2k:
      l += 2*k - s + x + 1
    elif s-x <= k:
      l += s-x+1      
print(l)

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

l = 0

if s <= k:
  l = int((s+2)*(s+1)/2)
else:
  for x in range(0,k+1):
    if s-x > 2*k:
      l += 0
    elif k < s-x <= 2*k:
      l += 2*k - s + x + 1
    elif s-x <= k:
      l += s-x+1      
print(l)


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
#import math
#import numpy as np
#= int(input())
#= input()
K, S = map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]


r = 1

s3 = min(K, max(0, S - 2 * K))
s2 = min(K, max(0, S - K))
s1 = min(K, S)

while True:
    if s3 != K:
        if s2 != 0:
            s3 += 1
            s2 -= 1
            r += 1
        elif s1 != 0:
            s1 -= 1
            s2 += 1
            r += 1
        else:
            break
    elif s2 != K:
        if s1 != 0:
            s2 += 1
            s1 -= 1
            r += 1
        else:
            break
    else:
        break

print(r)

#import
#import math
#import numpy as np
#= int(input())
#= input()
K, S = map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]


r = 0

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

print(r)

#import
#import math
#import numpy as np
#= int(input())
#= input()
K, S = map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]


r = 0

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

print(r)

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

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

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

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

res = 0

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

print(res)

import math

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

res = 0

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

print(res)

import math

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

res = 0

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

print(res)

import math

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 0 <= z <= k:
            res += 1

print(res)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

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

Submission attempts (in order):
K, S = 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):
    for Y in range(X, K):
        for Z in range(Y, K):
            if X + Y + Z == S:
                counter += 1
print(counter)


K, S = map(int, input().split())
ans = 0
for x in range(K+1):
    for y in range(min(K, S-x)+1):
        z = S - x - y
        if K >= z >= 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):
#include <bits/stdc++.h>
using namespace std;

int main() {
    int K, S; cin >> K >> S;
    long long ans = 0;
    for (int x = 0; x <= K; ++x) {
        for (int y = 0; y <= K; ++y) {
            for (int z = 0; z <= K; ++z) {
                if (x + y + z == S) ans++;
            }
        }
    }
    cout << ans << endl;
}

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

ans = 0
for x in range(K + 1):
    for y in range(x, K + 1):
        z = S - (x + y)
        if y <= z and z <= K:
            if x == y and y == z:
                ans += 1
            elif x == y or y == z or z == x:
                ans += 3
            else:
                ans += 6

print(ans)

Verdicts: Runtime Error

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

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

for X in range(K+1):
	for Y in range(K+1):
		Z = S - X - Y
		print(Z)
		if Z >= 0 and Z <= K:
			ans += 1

print(ans)


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

Verdicts: Wrong Answer

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

Submission attempts (in order):
k, s = map(int, input().split())
ans = 0

s3 = s // 3
m = max(k, s3)
for x in range(0, m + 1):
    print(x)
    for y in range(0, m + 1):
        ad = s - x - y
        if ad <= k and ad >= 0:
            ans += 1

print(ans)

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

s3 = s // 3
m = min(k, s3)
for x in range(m, 0, -1):
    print(x)
    for y in range(m, 0, -1):
        for z in range(s - x - y, 0, -1):
            xyz = x + y + z
            if x + y + z == s:
                ans += 1
            elif xyz < s:
                break

print(ans)

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

s3 = s // 3
m = max(k, s3)
for x in range(0, m + 1):
    # print(x)
    for y in range(0, m + 1):
        ad = s - x - y
        if ad <= k and ad >= 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())

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 ((s-x-y) <= k) and ((s-x-y) >= 0) :
            # print("{0} {1} {2}".format(x, y, s-x-y))
            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):
counter = 0
for x in range(K + 1):
  for y in range(K + 1):
    if S - (x + y) <= K:
      z = S - (x + y)
      if z >= 0 and z <= K:
        counter += 1

print(counter)

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

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

print(counter)

Verdicts: Runtime Error

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

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

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

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

Verdicts: Wrong Answer

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
k,s=map(int,input().split())
ans=0
for i in range(k):
  x=i+1
  for j in range(k):
    y=j+1
    for l in range(k):
      z=l+1
      if(s==x+y+z):
        ans+=1

print(ans)

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

ans = 0

for x in range(k+1):
  if x > s:
    break
  for y in range(k+1):
    if sum(x, y) > s:
      break
    for z in range(k+1):
      if sum(x, y, z) > s:
        break
      if sum(x, y, z) == s:
        ans += 1

print(ans)

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

ans = 0

for x in range(k+1):
  if x > s:
    break
  for y in range(k+1):
    if x + y > s:
      break
    z = s - x - y
    if 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(input, input().split(' '))
r = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        for z in range(0, k + 1):
            if x + y + z == s:
                r += 1
print(r)

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

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

ar = itertools.product(range(K+1), repeat=2)

ans = 0
for a,b in ar:
  if S - a-b <= K and S-a-b >= K: ans += 1

print(ans)


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

ar = itertools.product(range(K+1), repeat=2)

ans = 0
for a,b in ar:
  if S - a-b <= K and S-a-b >=: ans += 1

print(ans)


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

ar = itertools.product(range(K+1), repeat=2)

ans = 0
for a,b in ar:
  if S - a-b <= K and a+b <= S: 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):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ts=LIST()
    m=INT()
    xs=[0]*m
    for i in range(m):
        p,x=INTM()
        xs[i]=ts[p-1]-x
    tst=sum(ts)
    for i in range(m):
        #print(xs[i])
        print(tst-xs[i])
    #print(ts)
if __name__ == '__main__':
    do()

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    k,s=INTM()
    ct=0
    for x in range(k+1):
        for y in range(k+1):
            z=s-x-y
            if 0<=z and z<=k:
                ct+=1
    print(ct)
if __name__ == '__main__':
    do()

Verdicts: Runtime Error

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

Submission attempts (in order):
k,s = [int(i) for i in input().split()]
def a(n):
return int(n * (n + 1) / 2)
  
if s <= k:
  print(a(s + 1))
elif s >= 2 * k and s <= 3 * k:
  print(a(3 * k - s + 1))
elif s > k and s < 2 * k:
  print(a(s + 1) - 3 * a(s - k))
else:
  print(0)

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


def a(n):
  if n == 1:
    return n
  else:
    return n + a(n-1)
  
if k >= s:
  print(a(s+1))
elif s >= 2 * k and s <= 3 * k:
  print(a(3 * k - s + 1))
elif s > k and s < 2 * k:
  print(a(s + 1) - 3 * a(s - k))
else:

k,s = [int(i) for i in input().split()]
def a(n):
  return int(n * (n + 1) / 2)
  
if s <= k:
  print(a(s + 1))
elif s >= 2 * k and s <= 3 * k:
  print(a(3 * k - s + 1))
elif s > k and s < 2 * k:
  print(a(s + 1) - 3 * a(s - k))
else:
  print(0)

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

print(cnt)
  

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

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

k,s=map(int,input().split())
 
c=0
m=min(s,k)
for x in range(m+1):
  for y in range(m+1):
    if s<x+y:
      break
    elif s>x+y+k:
      continue
    else:
      c+=1
print(c)

Verdicts: Runtime Error

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

Submission attempts (in order):
K,S=map(int,input().split());print(sum(X+Y+Z==S for X in range(K)for Y in range(K)for Z in range(K)))

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

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

if S // K == 3:
    count = 1
else:
    for z in range(K, -1, -1):
        for y in range(K, -1, -1):
            if z >= y and y >= S - z - y and S - z - y >= 0:
                print(S - z - y, y, z)
                count += 1
    count *= 3

print(count)

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

count = 0

for z in range(K, -1, -1):
    for y in range(K, -1, -1):
        x = S - z - y
        if z >= y and y >= x and x >= 0:
            if x == y == z:
                count += 1
            elif (x == y and y != z) or (y == z and z != x):
                count += 3
            else:
                count += 6

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

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

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

Verdicts: Wrong Answer

Wrong Answer

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

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

K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    if 0 <= S - x - y <= 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 and 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 and 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: 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):
x = y = S//3 + 1
z = S - x - y
if z < y:
    x = z
    z = y
while 0 <= x <= y and 0 <= y <= K and y <= z <= K:
    while 0 <= x and z <= K:
        if x == y == z:
            ans += 1
        elif x == y or y == z:
            ans += 3
        else:
            ans += 6
        x -= 1
        z += 1
    y += 1
    x = y
    z = S - x - y
    if z < y:
        x = z
        z = y
print(ans)

K,S = map(int,input().split())
x = y = S//3
z = S - x - y
ans = 0
while 0 <= y and z <= K:
    while 0 <= x and z <= K:
        if x == y == z:
            ans += 1
        elif x == y or y == z:
            ans += 3
        else:
            ans += 6
        x -= 1
        z += 1
    y -= 1
    x = y
    z = S - x - y
    print(x,y,z,ans,"-")
x = y = S//3 + 1
z = S - x - y
if z < y:
    z = y
    x = S - y - z
while 0 <= x and y <= K and y <= z <= K:
    while 0 <= x and z <= K:
        if x == y == z:
            ans += 1
        elif x == y or y == z:
            ans += 3
        else:
            ans += 6
        x -= 1
        z += 1
    y += 1
    x = y
    z = S - x - y
    print(x,y,z,ans,"+")
print(ans)

K,S = map(int,input().split())
x = y = S//3
z = S - x - y
if z < y:
    x = z
    z = y
ans = 0
while 0 <= x <= y and 0<= y <=K and z <= K:
    while 0 <= x and z <= K:
        if x == y == z:
            ans += 1
        elif x == y or y == z:
            ans += 3
        else:
            ans += 6
        x -= 1
        z += 1
    y -= 1
    x = y
    z = S - x - y
    if z < y:
        x = z
        z = y
x = y = S//3 + 1
z = S - x - y
if z < y:
    x = z
    z = y
while 0 <= x <= y and 0 <= y <= K and y <= z <= K:
    while 0 <= x and z <= K:
        if x == y == z:
            ans += 1
        elif x == y or y == z:
            ans += 3
        else:
            ans += 6
        x -= 1
        z += 1
    y += 1
    x = y
    z = S - x - y
    if z < y:
        x = z
        z = y
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 = [int(n) for n in input().split(" ")]
 
cnt = 0
 
for x in range(K+1):
  for y in range(K+1):
    for z in range(S-x-y):
      if x+y+z == S:
        cnt +=1
 
print(cnt)

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

cnt = 0

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

print(cnt)

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

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())
print(sum(len(range(s-y-z,k+1)) for y in range(k+1) for z in range(k+1)))

k,s=map(int,input().split())
print(sum(0<=s-y-z<=k for y in range(k+1) for z in range(k+1)))

Verdicts: Wrong Answer

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

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

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

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

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

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

ans = 0
for x in range(0, K+1):
    for y in range(0, K+1):
        if s - (x + y) <= K and s - (x + y) >= 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):
import numpy as np
K,S = map(int, input().split())
count = 0
for x in range(K):
    for y in range(K):
        z = S - x - y
        if (z>=0)&(z<=K):
            count += 1
print(count)

import numpy as np
K,S = map(int, input().split())
count = 0
for x in range(0,K+1):
    for y in range(0,K+1):
        z = S - x - y
        if (z>=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):
from sys import stdin

k = int(stdin.readline().rstrip())
s = int(stdin.readline().rstrip())
count = 0

x = 0
y = 0
z = 0

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

print(count,flush=True)



from sys import stdin

k = int(stdin.readline().rstrip())
s = int(stdin.readline().rstrip())
count = 0

x = 0
y = 0
z = 0

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

print(count,flush=True)

from sys import stdin

k = int(stdin.readline().rstrip())
s = int(stdin.readline().rstrip())
count = 0

x = 0
y = 0
z = 0

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

print(count,flush=True)



from sys import stdin
lis =[]
#k = int(stdin.readline().rstrip())
lis= stdin.readline().rstrip().split()
k = int(lis[0])
s = int(lis[1])
#s =int(stdin.readline().rstrip())
count = 0

x = 0
y = 0
z = 0

for x in range(s+1):
    y = 0
    for y in range(s+1):
        z = 0
        z = s - x - y
        if s >= 3*k:
            break;
        if x <= k and y <= k and z<= k and 0 <= z:
            count +=1
            print(x,y,z)

print(count,flush=True)

from sys import stdin

k = int(stdin.readline().rstrip())
s = int(stdin.readline().rstrip())
count = 0

x = 0
y = 0
z = 0

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

print(count,flush=True)



from sys import stdin
lis =[]
#k = int(stdin.readline().rstrip())
lis= stdin.readline().rstrip().split()
k = int(lis[0])
s = int(lis[1])
count = 0
x = 0
y = 0
z = 0
for x in range(k+1):
    y = 0
    for y in range(k+1):
        z = 0
        z = s - x - y
        if z <= k and z >= 0:
                count +=1

from sys import stdin
lis =[]
#k = int(stdin.readline().rstrip())
lis= stdin.readline().rstrip().split()
k = int(lis[0])
s = int(lis[1])
count = 0
x = 0
y = 0
z = 0
for x in range(k+1):
    y = 0
    for y in range(k+1):
        z = 0
        z = s - x - y
        if z <= k and z >= 0:
                count +=1



print(count)

Verdicts: Runtime Error

Runtime Error

Runtime Error

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

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

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

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

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

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


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


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

data = list(map(int,input().split()))
cou = 0
for i in range(data[0] + 1):
  for j in range(data[0] + 1):
    k = data[1] - i - j
    if 0 <= k and k <= data[0]:
      cou += 1
print(cou)

Verdicts: Wrong Answer

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

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

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

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

print(ans)


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

ans = []
for x in range(k + 1):
    for y in range(x, k + 1):
        if 0 <= s - x - y <= k:
            ans.append((x, y, s - x - y))

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