Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())
max_x = y // 10000
max_y = y // 5000
max_z = y // 1000

for i in range(max_x + 1):
    for j in range(max_y + 1):
        remain = y - 10000 * i - 5000 * j
        if remain < 0:
            continue
        if remain // 1000 == n - (i + j):
            print(i, j, (n - i - j))
            exit()
print(-1, -1, -1)


Fixed submission:
N, Y=list(map(int, input().split()))
ans=[-1, -1, -1]
flag=False
for x in range(N, -1, -1):
    for y in range(N-x, -1, -1):
        if 10000*x+5000*y+1000*(N-x-y)==Y:
            ans=[x,y,N-x-y]
            flag=True
            break
        if flag==True:
            break
    if flag==True:
        break
print(ans[0],ans[1],ans[2])
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input())
print(max(a*n,b))

Fixed submission:
n,a,b=map(int,input().split())
print(min(a*n,b))
Buggy python submission (verdict: Runtime Error):
n=int(input())
F= [list(map(int,input().split())) for i in range(N)]
#F[i][j]はi行目、すなわち店i+1の時間帯jに対してやっているかどうか
P= [list(map(int,input().split())) for i in range(N)]
#P[i][j]は店i+1が時間jに1で自分も1の時に得られる効果
ans=[]
for k in range(n):
    for i in range(2**10):
        c=0
        for j in range(10):
            if ((i>>j)&1) and F[k][j]==1:
                c+=1
        ans.append(P[k][c])
print(max(ans))


Fixed submission:
n = int(input())
F = [int("".join(input().split()), 2) for _ in range(n)]
P = [list(map(int, input().split())) for _ in range(n)]
num = 1 << 10
ans = -(10 ** 10)


def popcnt(n):
    c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
    c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)
    c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)
    c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)
    c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)
    return c


# print(F)

for i in range(1, num):
    temp = 0
    for j in range(n):
        temp += P[j][popcnt(i & F[j])]
    ans = max(temp, ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
F= [list(map(int,input().split())) for i in range(N)]
#F[i][j]はi行目、すなわち店i+1の時間帯jに対してやっているかどうか
P= [list(map(int,input().split())) for i in range(N)]
#P[i][j]は店i+1が時間jに1で自分も1の時に得られる効果
ans=[]
for k in range(n):
    for i in range(2**10):
        c=0
        for j in range(10):
            if (i>>j)&1 and F[k][j]==1:
                c+=P[k][j]
        ans.append(c)
print(max(c))

Fixed submission:
n = int(input())
F = [int("".join(input().split()), 2) for _ in range(n)]
P = [list(map(int, input().split())) for _ in range(n)]
num = 1 << 10
ans = -(10 ** 10)


def popcnt(n):
    c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
    c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)
    c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)
    c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)
    c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)
    return c


# print(F)

for i in range(1, num):
    temp = 0
    for j in range(n):
        temp += P[j][popcnt(i & F[j])]
    ans = max(temp, ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(h)]

# C[i][j]はiをjにするのに必要なコスト
# warshal-floyd
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
for i in range(10):
ans = 0
for i in range(h):
    for j in range(w):
        if A[i][j] == -1:
            ans += 0
        else:
            ans += C[A[i][j]][1]
print(ans)


Fixed submission:
h, w = map(int, input().split())
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(h)]

# C[i][j]はiをjにするのに必要なコスト
# warshal-floyd
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for i in range(h):
    for j in range(w):
        if A[i][j] == -1:
            ans += 0
        else:
            ans += C[A[i][j]][1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#warshal-floydの練習だと思ってやる。
n,m=map(int,input().split())
A=[list(map(int,input().split()))for i in range(m)]
d=[[float('inf') for i in range(n)]for i in range(n)]

def wf(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j]=min(d[i][j], d[i][k]+d[j][k])
#warshal floydする関数

# for t in range(n):
#     a,b=A[t]
#     a-=1
#     b-=1
#     d[a][b]=1
#Aにある経路を、おもみ1で計算。
count=0
for i in range(m):
    d=[[float('inf') for _ in range(n)]for _ in range(n)]
    for j in range(m):
        if i==j:
            p,q=A[j]
            p-=1
            q-=1
            #1箇所くっつけないでおく場所を指定し、そこの場所をp,qでmemo
        else:
            a,b=A[j]
            a-=1
            b-=1
            d[a][b]=1
            d[b][a]=1
    wf(d)
    if d[p][q]==float('inf'):
        count+=1
print(count)

Fixed submission:
#union-findの練習だと思ってやる。
n,m=map(int,input().split())
A=[list(map(int,input().split()))for i in range(m)]

#union_find
#find, sunite, same, sizeを実装する。
def find(x):
    #findはrootを返す
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
def unite(x,y):
    #xとyの属する集合を合体
    #まずは根をとってくる
    x=find(x)
    y=find(y)
    if x==y:
        return False
    else:
        if par[x]>par[y]:
            x,y=y,x
        par[x]+=par[y]
        par[y]=x
def same(x,y):
    #xとyが同じ集合かどうか判定
    return find(x)==find(y)
def size(x):
    return -par[x]
#初期化

c=0
for i in range(m):
    par=[-1]*n
    for j in range(m):
        if i==j:
            r,s=A[j]
            r-=1
            s-=1
        else:
            p,q=A[j]
            p-=1
            q-=1
            unite(p,q)
    if same(r,s)==False:
        c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // a + 1):
    for j in range(f // b + 1):
        water = 100 * (a * i + b + j)
        if water > f:
            break
        if water == 0:
            break
        sugar_max = (a * i + b + j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print(kouho[0][1], kouho[0][2])


Fixed submission:
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // (100 * a) + 1):
    for j in range(f // (100 * b) + 1):
        water = 100 * (a * i + b * j)
        if water > f:
            break
        if water == 0:
            continue
        sugar_max = (a * i + b * j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print(kouho[0][1], kouho[0][2])

Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // a + 1):
    for j in range(f // b + 1):
        water = 100 * (a * i + b + j)
        if water > f:
            break
        sugar_max = (a * i + b + j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                if water + sugar == 0:
                    continue
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print(kouho[0][1], kouho[0][2])


Fixed submission:
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // (100 * a) + 1):
    for j in range(f // (100 * b) + 1):
        water = 100 * (a * i + b * j)
        if water > f:
            break
        if water == 0:
            continue
        sugar_max = (a * i + b * j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print(kouho[0][1], kouho[0][2])
Buggy python submission (verdict: Runtime Error):
c=0
N=int(input())
for i in range(N):
  *A=map(int, input().split())
  c+=A[1]-A[0]+1
print(c)

Fixed submission:
c=0
N=int(input())
for i in range(N):
  A=list(map(int, input().split()))
  c+=A[1]-A[0]+1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=set()
for i in range(n):
    ans=ans^set([input()])
print(len(ans))

Fixed submission:
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
ans=set()
for i in range(n):
    ans=ans^set([A[i]])
print(len(ans))

Fixed submission:
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
B=list(set(A))
m=len(B)
counter=0
for i in range(m):
    if A.count(B[i])%2==1:
        counter+=1
print(counter)

Fixed submission:
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
B=list(set(A))
m=len(B)
counter=0
for i in range(m):
    if A.count(B[i])%2==1:
        counter+=1
print(counter)

Fixed submission:
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
ans=[]
for i in range(n):
    if A[i] in ans:
        ans.remove(A[i])
    else:
        ans.append(A[i])
print(len(ans))

Fixed submission:
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(input()) for i in range(n)]
ans=[]
for i in range(n):
    if A[i] in ans:
        ans.remove(A[i])
    else:
        ans.append(A[i])
print(len(ans))

Fixed submission:
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(print 'A' if max(abs(b-a),abs(c-a))==abs(b-a) else 'B')

Fixed submission:
a,b,c=map(int,input().split())
print('A' if min(abs(b-a),abs(c-a))==abs(b-a) else 'B')
Buggy python submission (verdict: Runtime Error):
n=int(input())
T=[int(input()) for i in range(n)]
def gcd(a,b):
    if b==0:
        return(a)
    else:
        return(gcd(b,a%b))
def lgm(a,b):
    return(a*b//(gcd(a,b)))
if n==1:
    print(T[0])
else:
    ans=T[0]
    for i in range(1,n):
        ans=lgm(ans,T[i])
print(ans)

Fixed submission:
n=int(input())
T=[int(input()) for i in range(n)]
def gcd(a,b):
    if b==0:
        return(a)
    else:
        return(gcd(b,a%b))
def lgm(a,b):
    return(a*b//(gcd(a,b)))
if n==1:
    print(T[0])
else:
    ans=T[0]
    for i in range(1,n):
        ans=lgm(ans,T[i])
    print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.appendleft(d[i])
a=list(ans)
if n%2==1:
    c=a[::-1]
print(" ".join(map(str, c)))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.appendleft(d[i])
a=list(ans)
if n%2==1:
    c=a[::-1]
else:
    c=a
print(" ".join(map(str, c)))

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.insert(0,d[i])
ans=list(ans)
if n%2==1:
    ans=ans[::-1]
print(" ".join(map(str, ans)))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.appendleft(d[i])
a=list(ans)
if n%2==1:
    c=a[::-1]
else:
    c=a
print(" ".join(map(str, c)))

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.insert(0,d[i])
ans=list(ans)
if n%2==1:
    ans=ans[::-1]
print(" ".join(map(str, ans)))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.appendleft(d[i])
a=list(ans)
if n%2==1:
    c=a[::-1]
else:
    c=a
print(" ".join(map(str, c)))

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.insert(0,d[i])
if n%2==1:
    ans=list(ans)[::-1]
print(" ".join(map(str, ans)))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.appendleft(d[i])
a=list(ans)
if n%2==1:
    c=a[::-1]
else:
    c=a
print(" ".join(map(str, c)))

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
ans=deque([])
from collections import deque
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.insert(0,d[i])
if n%2==1:
    ans=list(ans)[::-1]
print(" ".join(map(str, ans)))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.appendleft(d[i])
a=list(ans)
if n%2==1:
    c=a[::-1]
else:
    c=a
print(" ".join(map(str, c)))
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b in range(a):
  print('delicious')
elif bin range(a,x+a+1):
  print('safe')
else:
  print('dangerous')

Fixed submission:
x,a,b=map(int,input().split())
if b in range(a+1):
  print('delicious')
elif b in range(a,x+a+1):
  print('safe')
elif b>a+x:
  print('dangerous')
Buggy python submission (verdict: Runtime Error):
###ncrのmodあまりの話
mod=10**9+7
N=100005
kaidan=[1 for i in range(N)]
gyaku=[1 for i in range(N)]
for i in range(1,N):
    kaidan[i] = (i * kaidan[i-1])%mod
    gyaku[i]=pow(bikkuri[i], mod-2, mod)
def comb(a,b):
    return kaidan[a]*gyaku[b]*gyaku[a-b]
n,m=map(int,input().split())
if abs(n-m)>=2:
    print(0)
else:
    if n==m:
        print(kaidan[n]*kaidan[n]*2%mod)
    else:
        a=max(n,m)
        b=min(n,m)
        print(kaidan[a]*kaidan[b]%mod)

Fixed submission:
###ncrのmodあまりの話
mod=10**9+7
N=100005
kaidan=[1 for i in range(N)]
gyaku=[1 for i in range(N)]
for i in range(1,N):
    kaidan[i] = (i * kaidan[i-1])%mod
    gyaku[i]=pow(kaidan[i], mod-2, mod)
def comb(a,b):
    return kaidan[a]*gyaku[b]*gyaku[a-b]
n,m=map(int,input().split())
if abs(n-m)>=2:
    print(0)
else:
    if n==m:
        print(kaidan[n]*kaidan[n]*2%mod)
    else:
        a=max(n,m)
        b=min(n,m)
        print(kaidan[a]*kaidan[b]%mod)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

input = sys.stdin.buffer.readline
n = int(input())
S = []
for _ in range(n):
    S.append(int(input()))
ans = 0
for i in range(1 << n):
    temp = 0
    for j in range(n):
        if (i >> j) & 1:
            temp += S[j]
    if temp % 10 == 0:
        temp = 0
    ans = max(temp, ans)
print(ans)


Fixed submission:
import sys

input = sys.stdin.buffer.readline
n = int(input())
S = []
for _ in range(n):
    S.append(int(input()))
S.sort()
goukei = sum(S)
if goukei %10!=0:
    print(goukei)
    exit()
ans = 0
for i in range(n):
    temp = goukei - S[i]
    if temp % 10 == 0:
        temp = 0
    ans = max(ans, temp)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = []
for _ in range(n):
    S.append(int(input()))
ans = 0
for i in range(1 << n):
    temp = 0
    for j in range(n):
        if (i >> j) & 1:
            temp += S[j]
    if temp % 10 == 0:
        temp = 0
    ans = max(temp, ans)
print(ans)


Fixed submission:
import sys

input = sys.stdin.buffer.readline
n = int(input())
S = []
for _ in range(n):
    S.append(int(input()))
S.sort()
goukei = sum(S)
if goukei %10!=0:
    print(goukei)
    exit()
ans = 0
for i in range(n):
    temp = goukei - S[i]
    if temp % 10 == 0:
        temp = 0
    ans = max(ans, temp)

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b:
  print('GREATER')
elif a==b:
  print('EQUAL')
else:
  print('LESS')

Fixed submission:
a=int(input())
b=int(input())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')

Fixed submission:
a=int(input())
b=int(input())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')

Fixed submission:
a=int(input())
b=int(input())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')
Buggy python submission (verdict: Runtime Error):
N=int(input())
mod=10**9+7
bikkuri=[1 for i in range(N+1)]
for i in range(N+1):
  bikkuri[i+1]=((i+1)*bikkuri[i])%mod
print(bikkuri[N])

Fixed submission:
N=int(input())
mod=10**9+7
bikkuri=[1 for i in range(N+2)]
for i in range(N+1):
  bikkuri[i+1]=((i+1)*bikkuri[i])%mod
print(bikkuri[N])

Buggy python submission (verdict: Runtime Error):
N=int(input())
mod=10**9+7
bikkuri=[1*(N+1)]
for i in range(N+1):
  bikkuri[i+1]=((i+1)*bikkuri[i])%mod
print(bikkuri[N])

Fixed submission:
N=int(input())
mod=10**9+7
bikkuri=[1 for i in range(N+2)]
for i in range(N+1):
  bikkuri[i+1]=((i+1)*bikkuri[i])%mod
print(bikkuri[N])
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
p1=n
p2=m//2
if p1>p2:
 	print(p2)
else:
	delta=p2-p1
    print(delta//2+p1)

Fixed submission:
n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
    print(p2)
else:
    delta=p2-p1
    print(delta//2+p1)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
 	print(p2)
else:
	delta=p2-p1
    print(delta//2+p1)

Fixed submission:
n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
    print(p2)
else:
    delta=p2-p1
    print(delta//2+p1)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
 	print(p2)
else:
	delta=p2-p1
    print(delta//2+p1)


Fixed submission:
n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
    print(p2)
else:
    delta=p2-p1
    print(delta//2+p1)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=list(map(int,input()))
print(max(a*b, c*d))

Fixed submission:
a,b,c,d=list(map(int,input().split()))
print(max(a*b, c*d))
Buggy python submission (verdict: Time Limit Exceeded):
K, S=list(map(int, input().split()))
c=0
for i in range(0, S+1):
    for j in range(0, i+1):
        if j<=K and i-j<=K and S-i<=K:
            c+=1
print(c)

Fixed submission:
K, S=list(map(int, input().split()))
c=0
for i in range(0, min(2*K+1, S+1)):
    for j in range(0, min(K+1,i+1)):
        if j<=K and i-j<=K and S-i<=K:
            c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
K, S=list(map(int, input().split()))
c=0
d=0
e=0
for x in range(K+1):
    for y in range(x+1):
        for z in range(y+1):
            if x+y+z==S:
                if x!=y and y!=z and z!=x:
                    c+=1
                if (x==y and y!=z) or (y==z and z!=x) or (z==x and x!=y):
                    d+=1
                if x==y==z:
                    e+=1
print(6*c+3*d+e)

Fixed submission:
K, S=list(map(int, input().split()))
c=0
for i in range(0, min(2*K+1, S+1)):
    for j in range(0, min(K+1,i+1)):
        if j<=K and i-j<=K and S-i<=K:
            c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
K, S=list(map(int, input().split()))
c=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z==S:
                c+=1
print(c)

Fixed submission:
K, S=list(map(int, input().split()))
c=0
for i in range(0, min(2*K+1, S+1)):
    for j in range(0, min(K+1,i+1)):
        if j<=K and i-j<=K and S-i<=K:
            c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
v='aiueo'
if c in v:print('vowel')
else:print('consonant')

Fixed submission:
if input() in 'aiueo':print('vowel')
else:print('consonant')

Buggy python submission (verdict: Runtime Error):
v='abcde'
if c in v:print('vowel')
else:print('consonant')

Fixed submission:
if input() in 'aiueo':print('vowel')
else:print('consonant')