Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

import sys, io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *

a, b, c = inputi()
print(c, a, b)





Fixed submission:

import sys, io, os
input = sys.stdin.readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *

a, b, c = inputi()
print(c, a, b)

Buggy python submission (verdict: Runtime Error):

import sys, io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *

a, b, c = inputi()
print(c, a, b)





Fixed submission:

import sys, io, os
input = sys.stdin.readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *

a, b, c = inputi()
print(c, a, b)
Buggy python submission (verdict: Runtime Error):
import math
from sys import stdin,stdout
#% 998244353
from heapq import heapify,heappop,heappush

import collections
# T = int(stdin.readline())
# for i in range(T):
    #N=int(stdin.readline())
N,M=list(map(int,stdin.readline().split()))
hill=list(map(int,stdin.readline().split()))

dc=collections.defaultdict(list)
#vis=set()
for m in range(M):
    A,B=list(map(int,stdin.readline().split()))
    dc[A].append(B)
    dc[B].append(A)

ans=0
for k,ls in dc.items():

    f=0
    z=0
    for h in ls:

        if hill[k-1]<=hill[h-1]:
            f=1
            break

    if not f:
      #  print(k)
        ans+=1  
#print(ans)
#ans+=(N-len(dc.keys()))
print(ans)            

Fixed submission:
import math
from sys import stdin,stdout
#% 998244353
T = stdin.readline()
T=T[:-1]
if T=="ABC":
    print("ARC")
elif T=="ARC":
    print("ABC")

Buggy python submission (verdict: Runtime Error):
import math
from sys import stdin,stdout
#% 998244353
from heapq import heapify,heappop,heappush

import collections
# T = int(stdin.readline())
# for i in range(T):
    #N=int(stdin.readline())
N,M=list(map(int,stdin.readline().split()))
hill=list(map(int,stdin.readline().split()))

dc=collections.defaultdict(list)
#vis=set()
for m in range(M):
    A,B=list(map(int,stdin.readline().split()))
    dc[A].append(B)
    dc[B].append(A)

ans=0
for k,ls in dc.items():

    f=0
    for h in ls:
        if ls.count(h)>1:
            continue
        if hill[k-1]<hill[h-1]:
            f=1
            break
    if not f:
        ans+=1  

ans+=N-len(dc.keys())
print(ans)            

Fixed submission:
import math
from sys import stdin,stdout
#% 998244353
T = stdin.readline()
T=T[:-1]
if T=="ABC":
    print("ARC")
elif T=="ARC":
    print("ABC")
Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())

i = B - A

for i in range(A, B + 1):
    if i % K == 0:
        c = 1

if c == 1:
    print('OK')
else:
    print('NG')

Fixed submission:
K = int(input())
A, B = map(int, input().split())

i = B - A
c = 0

for i in range(A, B + 1):
    if i % K == 0:
        c = 1

if c == 1:
    print('OK')
else:
    print('NG')

Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())

i = B - A

for i in range(A, B + 1):
    if i % K == 0:
        c = 1

if c == 1:
    orint('OK')
else:
    print('NG')

Fixed submission:
K = int(input())
A, B = map(int, input().split())

i = B - A
c = 0

for i in range(A, B + 1):
    if i % K == 0:
        c = 1

if c == 1:
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Runtime Error):
line = input().split(" ")
a = int(line[0])
b = int(line[1])
c = int(line[2])
x = int(input())
count = 0

for ia in range(a+1):
    for jb in range(b+1):
        for kc in range(c+1):
            if(0 == (x - (ia*500 + jb*100 + kc*50))):
                count += 1

print(count)


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for ia in range(a+1):
    for jb in range(b+1):
        for kc in range(c+1):
            if(0 == (x - (ia*500 + jb*100 + kc*50))):
                count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split(" ")

for i in range(100):
    for j in range(len(a)):
        if(int(a[j]) % 2 != 0):
            break
        else:
            a[j] = int(a[j]) / 2
            count += 1
    else:
        continue
    break

print(count // len(a))


Fixed submission:
n = int(input())
a = input().split(" ")
count = 0

for i in range(100):
    for j in range(len(a)):
        if(int(a[j]) % 2 != 0):
            break
        else:
            a[j] = int(a[j]) / 2
            count += 1
    else:
        continue
    break

print(count // len(a))
Buggy python submission (verdict: Time Limit Exceeded):
line = input().split(" ")
a = int(line[0])
b = int(line[1])
x = int(line[2])
c = 0

for i in range(a, b+1, 1):
    if i % x == 0:
        c += 1

print(c)

Fixed submission:
line = input().split(" ")
a = int(line[0])
b = int(line[1])
x = int(line[2])

print((b // x) - ((a - 1) // x))
Buggy python submission (verdict: Runtime Error):
line = input()
str = list(line)
ans = []
c = 0

for i in str:
    if (i == "1") or (i == "0"):
        ans.append(i)
    elif i == "B":
        if c != 0:
            c -= 1
            del ans[c]
            c -= 1
    c += 1

for i in ans:
    print("".join(i), end = '')

Fixed submission:
line = input()
str = list(line)
ans = []
c = 0

for i in str:
    if (i == "1") or (i == "0"):
        ans.append(i)
    elif i == "B":
        if c != 0:
            c -= 1
            del ans[c]
        c -= 1
    c += 1

for i in ans:
    print("".join(i), end = '')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#from fractions import gcd
from math import gcd

N = int(input())
A = list(map(int, input().split()))

if N == 2:
    print(max(A))
else:
    ans = gcd(A[0], A[1])
    ans2 = max(gcd(A[0], A[2]), gcd(A[1], A[2]))
    for a in A[2:]:
        ans2 = max(gcd(a, ans2), ans)
        ans = gcd(a, ans)
    
    print(ans2)
    

Fixed submission:
# -*- coding: utf-8 -*-
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

if N == 2:
    print(max(A))
else:
    ans = gcd(A[0], A[1])
    ans2 = max(gcd(A[0], A[2]), gcd(A[1], A[2]))
    for a in A[2:]:
        ans2 = max(gcd(a, ans2), ans)
        ans = gcd(a, ans)
    
    print(ans2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans=99999999
for i in range(len(S)+1):
    temp = S[:i].count('#') + S[i:].count('.')
    ans = min(temp, ans)
        
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-

N = int(input())
S = input()

wc = S.count('.')
bc = 0
ans = wc + bc
for s in S:
    if s == '.':
        wc -= 1
    else:
        bc += 1
    temp = wc + bc
    ans = min(temp, ans)
        
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a = input().split("/")

201if int(a[1])<5:
    print("Heisei")
else:
    print("TBD")
    

Fixed submission:
# -*- coding: utf-8 -*-

a = input().split("/")

if int(a[1])<5:
    print("Heisei")
else:
    print("TBD")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from functools import reduce

def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    z = y
    while x%y != 0:
        z = x%y
        x = y
        y = z
    else:
        return z

def gcd_list(numbers):
    return reduce(math.gcd, numbers)


N = int(input())

A = list(map(int, input().split()))

print(gcd_list(A))

Fixed submission:
# -*- coding: utf-8 -*-
from functools import reduce

def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    z = y
    while x%y != 0:
        z = x%y
        x = y
        y = z
    else:
        return z
            

def gcd_list(numbers):
    return reduce(gcd, numbers)


N = int(input())

A = list(map(int, input().split()))

print(gcd_list(A))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N = int(input())

A = list(map(int, input().split()))

print(gcd_list(A))

Fixed submission:
# -*- coding: utf-8 -*-
from functools import reduce

def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    z = y
    while x%y != 0:
        z = x%y
        x = y
        y = z
    else:
        return z
            

def gcd_list(numbers):
    return reduce(gcd, numbers)


N = int(input())

A = list(map(int, input().split()))

print(gcd_list(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ans=0
for i in range(N+1):
    c=len(str(i))
    c3=str(i).count("3")
    c5=str(i).count("5")
    c7=str(i).count("7")
    if (c3>0) & (c5>0) & (c7>0) & (c==c3+c5+c7):
        ans+=1
    
print(ans)
        
        


Fixed submission:
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in "753") else 0
    for c in "753":
        ret += dfs(s+c)
    return ret

print(dfs("0"))
Buggy python submission (verdict: Runtime Error):
import numpy as np 
import math

S = str(input())
T = str(input())

n = len(S)
if T[0:n] == S:
    print("Yes")
else:
    print("No")

Fixed submission:
import numpy as np 
import math

S = str(input())
T = str(input())

n = len(S)
m = len(T)
if (T[0:n] == S) and (m==n+1):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np 
N,K = map(int,input().split())
A = list(map(int,input().split()))

t = 1
tpass = [1]
k = 0
for i in range(K):
    temp = A[t-1] 
    if temp in tpass:
        idx = tpass.index(temp)
        l = len(tpass)
        break
    else:
        t = temp
        tpass.append(temp)
        k += 1

a = K - k
loop = l - idx
b = a % loop 


temp2 = tpass[idx:]

ans = temp2[b-1]

print(ans)

Fixed submission:
import numpy as np 
from sys import stdin, setrecursionlimit
 
setrecursionlimit(10 ** 9)

N,K = map(int,input().split())
A = list(map(int,input().split()))

t = 1
tpass = [1]
k = 0
j = 1
temp3 = [0]*N
for i in range(N):
    temp = A[t-1] 
    if i == K-1:
        print(temp)
        exit()
    if temp3[temp-1] != 0 :
        idx = tpass.index(temp)
        l = len(tpass)
        j = -1
        break
    else:
        
        t = temp
        temp3[t-1] = 1
        tpass.append(temp)
        k += 1

try:
    a = K - k
    loop = l - idx
    b = a % loop 
    temp2 = tpass[idx:]
    ans = temp2[b-1]
    print(ans)
except:
    pass
Buggy python submission (verdict: Runtime Error):
S = str(input())
N = len(S)

counter = 0
for i in range(N-3):
    for j in  range(i+3,N):
        s = int(S[i:j+1])
        m = s % 2019
        if m == 0:
            counter += 1

print(counter)







Fixed submission:
inputs = str(input())
S = int(inputs.split()[0])
W = int(inputs.split()[1])
if S <= W:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
r = input()

s = 2.0*3.14159265*r

print(s)

Fixed submission:
import math

r = int(input())
s = 2.0 * r * math.pi

print(s)

Buggy python submission (verdict: Runtime Error):
import math


R = input()
s = 2.0*math.pi*R

print(s)

Fixed submission:
import math

r = int(input())
s = 2.0 * r * math.pi

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

for i in range(N):
    s = A.count(i+1)
    print(s)
    

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
S = [0 for i in range(N)]

for i in range(N-1):
    S[A[i]-1] += 1

for i in range(N):
    print(S[i])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

d = 0
for k in range(2,N):
    sk = S[k]
    for j in range(k):
        sj = S[j]
        if sk != sj:
            for i in range(j):
                si = S[i]
                if (si != sj) & (si != sk):
                    if j-i != k-j:
                   
                        d += 1

print(d)




Fixed submission:
a = str(input())

if "7" in a:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = input()

fizz = []
buzz = []
fizzbuzz = []
other = []
for i in range(n):
    if (i % 3 != 0) & (i % 5 != 0):
        other.append(i)

b = 0
for i in range(len(other)):
    b += other[i]

print(b)

Fixed submission:
a = str(input())

if "7" in a:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a = str(input())

if "&7" in a:
  print("Yes")
 else:
  print("No")

Fixed submission:
a = str(input())

if "7" in a:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math


n = int(input())


c = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            temp = math.gcd(i+1,j+1)
            c += math.gcd(temp,k+1)

print(c)

Fixed submission:
import math
# from functools import reduce
# from fractions import gcd
def main():
    n = int(input())
    # def gcd(*numbers):
    #     return reduce(math.gcd, numbers)

    c = 0
    for i in range(n):
        for j in range(n):
            for k in range(n):
                temp = math.gcd(i+1,j+1)
                c += math.gcd(temp,k+1)

    print(c)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

n = int(input())
def gcd(*numbers):
    return reduce(math.gcd, numbers)

c = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            c += gcd(i+1,j+1,k+1)

print(c)

Fixed submission:
import math
# from functools import reduce
# from fractions import gcd
def main():
    n = int(input())
    # def gcd(*numbers):
    #     return reduce(math.gcd, numbers)

    c = 0
    for i in range(n):
        for j in range(n):
            for k in range(n):
                temp = math.gcd(i+1,j+1)
                c += math.gcd(temp,k+1)

    print(c)

main()
Buggy python submission (verdict: Runtime Error):
# coding:utf8

N = int(input())
A = list(map(int, input().strip().split()))
s = 0
for i in range(N):
    s += 1.0/(A[i])
s = 1.0/s

print(s)

Fixed submission:
# coding:utf-8
 
num = int(input())
chr = input()
 
if num>=3200:
  print(chr)
else:
  print("red")

Buggy python submission (verdict: Runtime Error):
# coding:utf8

N = input()
A = list(map(int, input().strip().split()))
s = 0
for i in range(N):
    s += 1.0/(A[i])
s = 1.0/s

print(s)

Fixed submission:
# coding:utf-8
 
num = int(input())
chr = input()
 
if num>=3200:
  print(chr)
else:
  print("red")

Buggy python submission (verdict: Runtime Error):
# coding:utf8

N = input()
A = input().split()

s = 0
for i in range(N):
    s += 1.0/int(A[i])
s = 1.0/s

print(s)

Fixed submission:
# coding:utf-8
 
num = int(input())
chr = input()
 
if num>=3200:
  print(chr)
else:
  print("red")

Buggy python submission (verdict: Runtime Error):
# coding:utf-8

num = int(input())
chr = input()

if num=<3200:
  print(chr)
else:
  print("red")

Fixed submission:
# coding:utf-8
 
num = int(input())
chr = input()
 
if num>=3200:
  print(chr)
else:
  print("red")
Buggy python submission (verdict: Time Limit Exceeded):

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




for i in range(0,k):
    if not(a==0) :
        a = a-1
        ans +=1
        k=k-1
    elif not(b==0) :
        b=b-1
        k=k-1
    else:
        k -=1
        ans -=1
print(ans)

Fixed submission:
a,b,c,k = map(int,input().split())
ans = 0

kk=k-a
for i in range(1):
    if kk<0:
        ans=k
        k=-1
        break
    else:
        ans = a
        k=k-a
    kk = k-b
    if kk<0:
        k=-1
        break
    else:
        k=k-b

    kk = k-c

    if kk<0:
        ans=ans-k
    elif kk>=0:
        ans=ans-c
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k =map(int, input().split())
d = int(input())

sunuke_list = []

count=0


for a in range(0,d):
    point = input()
    if not point in sunuke_list:
        sunuke_list.append(int(point))

for j in range(0,d):

    if j in sunuke_list:
        count +=1



if count<d:
    print(n-d)

else:
    print(n-count)

Fixed submission:
n, k =map(int, input().split())

sunuke = []

for i in range(0,k):
    d = int(input())
    a = list(map(int,input().split()))
    sunuke +=a

print(n-len(set(sunuke)))

Buggy python submission (verdict: Runtime Error):

import sys
sys.setrecursionlimit(12)
n, k =map(int, input().split())
d = int(input())

n_meajor = [0 for i in range(0,n)]

sunuke=[]
count=0

# for i in sys.stdin:
#     sunuke.append(int(input()))

for a in range(0,100):
    sunuke.append(int(input()))

for j in range(0,n):
    if j in sunuke:
        n_meajor[j]=1


sunuke_people = sum(n_meajor)

if sunuke_people<d:
    print(n-d)

else:
    print(n-sunuke_people)





Fixed submission:
n, k =map(int, input().split())

sunuke = []

for i in range(0,k):
    d = int(input())
    a = list(map(int,input().split()))
    sunuke +=a

print(n-len(set(sunuke)))

Buggy python submission (verdict: Runtime Error):
import sys
n, k =map(int,input().split())
d = int(input())

n_meajor = [0 for i in range(0,n)]

sunuke=[]
count=0

for i in sys.stdin:
    sunuke.append(int(input()))

for j in range(0,n):
    if j in sunuke:
        n_meajor[j]=1


sunuke_people = sum(n_meajor)

if sunuke_people<d:
    print(n-d)

else:
    print(n-sunuke_people)


Fixed submission:
n, k =map(int, input().split())

sunuke = []

for i in range(0,k):
    d = int(input())
    a = list(map(int,input().split()))
    sunuke +=a

print(n-len(set(sunuke)))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
ave = (a + b) / 2

if ave - int(ave) > 0:
    ave = int(ave) + 1
else
    ave = int(ave)

print(ave)


Fixed submission:
a, b = map(int, input().split())
ave = (a + b) / 2

if ave - int(ave) > 0:
    ave = int(ave) + 1
else:
    ave = int(ave)

print(ave)
Buggy python submission (verdict: Runtime Error):
x = long(input())

quotient = x // 11
remainder = x % 11

Answer = quotient * 2
if remainder > 6:
    Answer += 2
else:
    Answer += 1

print(Answer)

Fixed submission:
x = int(input())

quotient = x // 11
remainder = x % 11

Answer = quotient * 2
if remainder > 6:
    Answer += 2
elif remainder > 0:
    Answer += 1
else:
    Answer += 0

print(Answer)
Buggy python submission (verdict: Runtime Error):
def fib(n):
    f = ((1 + 5**0.5) / 2)**n / 5**0.5 + 0.5
    return f


# def fib(n):
#     x = sym.symbols('x',nonnegative=True,integer=True) #変数xの宣言(非負の整数)
#     Fib=1/sym.sqrt(5)*(((1+sym.sqrt(5))/2)**(n-1)-((1-sym.sqrt(5))/2)**(n-1)) #一般項の式
#     result=Fib.subs(x,n) #xにnを代入
#     result=result.evalf() #式を浮動小数点数として評価
#     return int(result)

n,m = map(int,input().split())
a =  [int(input()) for i in range(m)]
a.append(n+1)

time_f=[]

for i,v in enumerate(a):
    if i == 0:
        # print (fib(a[i]))
        time_f = fib(a[i])
    else:
        # print((a[i]-a[i-1]-1))
        # print (fib(a[i]-a[i-1]-1))
        time_f *=fib(a[i]-a[i-1]-1)


print(time_f%1000000007)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(a[0]+a[1])

Buggy python submission (verdict: Runtime Error):
import numpy as sym

def fib(n):
    x = sym.symbols('x',nonnegative=True,integer=True) #変数xの宣言(非負の整数)
    Fib=1/sym.sqrt(5)*(((1+sym.sqrt(5))/2)**(n-1)-((1-sym.sqrt(5))/2)**(n-1)) #一般項の式
    result=Fib.subs(x,n) #xにnを代入
    result=result.evalf() #式を浮動小数点数として評価
    return int(result)

n,m = map(int,input().split())
a =  [int(input()) for i in range(m)]
a.append(n+1)

time_f=[]

for i,v in enumerate(a):
    if i == 0:
        # print (fib(a[i]))
        time_f = fib(a[i])
    else:
        # print((a[i]-a[i-1]-1))
        # print (fib(a[i]-a[i-1]-1))
        time_f *=fib(a[i]-a[i-1]-1)


print(time_f%1000000007)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(a[0]+a[1])
Buggy python submission (verdict: Runtime Error):
s = str(input())

if s[2] == s[3]:
    if s[4] == s[5]:
        print("Yes")

else:
    print("No")


Fixed submission:
s = str(input())

if s[2] == s[3]:
    if s[4] == s[5]:
        print("Yes")
        quit()

print("No")
Buggy python submission (verdict: Runtime Error):
import math
import sys
input = sys.stdin.readline


N,Y = map(int, input().split())
flag=0
for i in range(0,N+1):
    for j in range(0,N-i):
        if(Y-10000*i-5000*j)/1000 == N-i-j :
            a = i
            b = j
            c = N-i-j
            flag =1
            break
        if flag==1:
            break
print(a,b,c)

if flag!=1:
    print("-1 -1 -1")


Fixed submission:
import math
import sys
input = sys.stdin.readline


N,Y = map(int, input().split())
flag=0
for i in range(0,N+1):
    for j in range(0,N+1-i):
        if(Y-10000*i-5000*j)/1000 == N-i-j :
            a = i
            b = j
            c = N-i-j
            flag =1
            break
        if flag==1:
            break

if flag==1:
    print(a,b,c)

if flag!=1:
    print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
import math
K,S = map(int, input().split())
n = 0
up = math.floor(K)
for i in range(up+1):
    for j in range(i,up+1):
        for k in range(j,up+1):
            if i==j and j==k:
                same=1
            elif (i==j and j!=k)or(j==k and i!=j) or(k ==i and i!=j):
                same =3
            else:
                same =6
            if i+j+k ==S:
                n=n+same
            else:
                n =n

print(n)


Fixed submission:
import math
import sys
input = sys.stdin.readline


K,S = map(int, input().split())
n = 0
up = math.floor(K)
for i in range(0,K+1):
    for j in range(0, K+1):
        if(0<= S-i-j <=K):
            n +=1
        else:
                n =n

print(n)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int, input().split())
n = 0

for i in range(K+1):
    for j in range(i,K+1):
        for k in range(j,K+1):
            if i==j and j==k:
                same=1
            elif (i==j and j!=k)or(j==k and i!=j) or(k ==i and i!=j):
                same =3
            else:
                same =6
            if i+j+k ==S:
                n=n+same
            else:
                n =n

print(n)


Fixed submission:
import math
import sys
input = sys.stdin.readline


K,S = map(int, input().split())
n = 0
up = math.floor(K)
for i in range(0,K+1):
    for j in range(0, K+1):
        if(0<= S-i-j <=K):
            n +=1
        else:
                n =n

print(n)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int, input().split())
n = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k ==S:
                n=n+1
            else:
                n =n

print(n)


Fixed submission:
import math
import sys
input = sys.stdin.readline


K,S = map(int, input().split())
n = 0
up = math.floor(K)
for i in range(0,K+1):
    for j in range(0, K+1):
        if(0<= S-i-j <=K):
            n +=1
        else:
                n =n

print(n)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int, input().split())


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

print(n)


Fixed submission:
import math
import sys
input = sys.stdin.readline


K,S = map(int, input().split())
n = 0
up = math.floor(K)
for i in range(0,K+1):
    for j in range(0, K+1):
        if(0<= S-i-j <=K):
            n +=1
        else:
                n =n

print(n)