Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
input_list = [int(i) for i in input().split()]

def func(input_list):
    if n > m:
        return 0

    input_list.sort()

    input_diff = []
    for i in range(m-1):
        diff = input_list[i+1] - input_list[i]
        input_diff.append(abs(diff))

    choice_pivot = [0]
    for i in range(n-1):
        pivot = max(input_diff)
        index = input_diff.index(pivot)
        input_diff[index] = 0
        choice_pivot.append(index+1)

    ans = 0
    choice_pivot.append(m)
    for i in range(len(choice_pivot)-1):
        start = choice_pivot[i]
        end = choice_pivot[i+1] - 1
        ans += input_list[end] - input_list[start]

    return ans

print(func(input_list))

Fixed submission:
def func2(input_list):
    if n >= m:
        return 0

    input_list.sort()

    input_diff = []
    for i in range(m-1):
        diff = input_list[i+1] - input_list[i]
        input_diff.append(abs(diff))

    input_diff.sort(reverse=True)
    ans = input_list[-1] - input_list[0]
    for i in range(0, n-1):
        ans -= input_diff[i]

    return ans

n, m = map(int, input().split())
input_list = [int(i) for i in input().split()]

print(func2(input_list))

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

cnt = 0
while c > 0:
    c -= 1
    cnt += 1
    if b > 0:
        b -= 1
        cnt += 1
        continue
    elif a > 0:
        a -= 1
        continue
    else:
        break

print(cnt)



Fixed submission:
def func2(input_list):
    if n >= m:
        return 0

    input_list.sort()

    input_diff = []
    for i in range(m-1):
        diff = input_list[i+1] - input_list[i]
        input_diff.append(abs(diff))

    input_diff.sort(reverse=True)
    ans = input_list[-1] - input_list[0]
    for i in range(0, n-1):
        ans -= input_diff[i]

    return ans

n, m = map(int, input().split())
input_list = [int(i) for i in input().split()]

print(func2(input_list))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')] * n
dp[0] = 0

for i in range(n):
    for j in range(k+1):
        num = i+j
        if num >= n: break
        else: 
            dp[num] = min(dp[num], dp[i]+abs(h[num]-h[i]))

print(dp[-1])


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

dp = [float('inf')] * n
dp[0] = 0

for i in range(n):
    for j in range(k+1):
        num = i+j
        if num >= n: break
        else: 
            dp[num] = min(dp[num], dp[i]+abs(h[num]-h[i]))

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
graph = [[] for _ in range(n)]
dp = [-1 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)


def dfs(s):
    #print(s, dp)
    if dp[s] != -1:
        return dp[s]
    
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs(g)+1)
    dp[s] = rep
    return rep

def dfs2(s):
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs2(g)+1)
    #print(rep)
    return rep

#print(graph)
ans = 0
for i in range(n):
    #print('i:', i)
    ans = max(ans, dfs2(i))

print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
graph = [[] for _ in range(n)]
dp = [-1 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)


def dfs(s):
    #print(s, dp)
    if dp[s] != -1:
        return dp[s]
    
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs(g)+1)
    dp[s] = rep
    return rep

#print(graph)
ans = 0
for i in range(n):
    #print('i:', i)
    ans = max(ans, dfs(i))

print(ans)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
dp = [-1 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)


def dfs(s):
    #print(s, dp)
    if dp[s] != -1:
        return dp[s]
    
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs(g)+1)
    dp[s] = rep
    return rep

#print(graph)
ans = 0
for i in range(n):
    #print('i:', i)
    ans = max(ans, dfs(i))

print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
graph = [[] for _ in range(n)]
dp = [-1 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)


def dfs(s):
    #print(s, dp)
    if dp[s] != -1:
        return dp[s]
    
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs(g)+1)
    dp[s] = rep
    return rep

#print(graph)
ans = 0
for i in range(n):
    #print('i:', i)
    ans = max(ans, dfs(i))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c = map(int, input().split())

cnt = 0
while c > 0 or b > 0:
    if c > 0:
        c -= 1
        cnt += 1
    elif b > 0:
        b -= 1
        cnt += 1
        continue

    if b > 0:
        b -= 1
        cnt += 1
        continue
    elif a > 0:
        a -= 1
        continue
    else:
        break

print(cnt)

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

cnt = 0
if a + b + 1>= c:
    ans = b + c
else:
    ans = b + a + b + 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
sentences = [[] for i in range(n)]

for i in range(n):
    nn = int(input())

    for j in range(nn):
        p, t = map(int, input().split())
        sentences[i].append([p - 1, t])

ans = 0
count = 0
for i in range(2 ** n):
    check = {}
    success = True
    for j in range(n):
        # print('i, j:', i, j, bin(i))
        if ((i >> j) & 1):
            sentence = sentences[j]

            for pp, tt in sentence:
                if pp in check:
                    if check[pp] == tt:
                        pass                         
                    else:
                        success = False
                        break
                else:
                    check[pp] = tt
            #print(check)
        else:
            sentence = sentences[j]

            for pp, tt in sentence:
                if pp in check:
                    if check[pp] != tt:
                        pass                         
                    else:
                        success = False
                        break
                else:
                    if tt == 1:
                        check[pp] = 0
                    else:
                        check[pp] = 1

        if success == False:
            # print('break')
            break

    if success:
        # print(check)
        count = bin(i).count('1')    
        ans = max(ans, count)

    # print('c, a:', count, ans)

print(ans)


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

input_list = []
for i in range(n):
    input_list.append(int(input()))

input_list.sort()

ans = float('inf')
ans_index = 0
for i in range(n-k+1):
    h = input_list[i+k-1] - input_list[i]
    ans = min(ans, h)

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
queue = []
for i in range(m):
    c, y= map(int, input().split())
    queue.append([c, y, i])

queue = sorted(queue)

index = 0
keep = 1
for i in range(m):
    if keep != queue[1][0]:
        index = 0
    index += 1
    queue[i][0] = str(queue[i][0]).zfill(6)
    queue[i][1] = str(index).zfill(6)

queue.sort(key=lambda x: x[2])

for data in queue:
    cn, yn, i = data
    print(cn + yn)

Fixed submission:
n, m = map(int, input().split())
queue = []
for i in range(m):
    c, y= map(int, input().split())
    queue.append([c, y, i])

queue = sorted(queue)

index = 0
keep = queue[0][0]
for i in range(m):
    if keep != queue[i][0]:
        index = 0
        keep = queue[i][0]
    index += 1
    queue[i][0] = str(queue[i][0]).zfill(6)
    queue[i][1] = str(index).zfill(6)

queue.sort(key=lambda x: x[2])

for data in queue:
    cn, yn, i = data
    print(cn + yn)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
queue = []
sort_list = [[10**10] for i in range(n)]
for i in range(m):
    a, b = input().split()
    queue.append([int(a), int(b)])
    sort_list[int(a) - 1].append(int(b))

for i in range(n):
    sort_list[i].sort()

for data in queue:
    k, v = map(int, data)   

    num_index = sort_list[k -1].index(v)

    print(str(k).zfill(6) + str(num_index + 1).zfill(6))


Fixed submission:
n, m = map(int, input().split())
queue = []
for i in range(m):
    c, y= map(int, input().split())
    queue.append([c, y, i])

queue = sorted(queue)

index = 0
keep = queue[0][0]
for i in range(m):
    if keep != queue[i][0]:
        index = 0
        keep = queue[i][0]
    index += 1
    queue[i][0] = str(queue[i][0]).zfill(6)
    queue[i][1] = str(index).zfill(6)

queue.sort(key=lambda x: x[2])

for data in queue:
    cn, yn, i = data
    print(cn + yn)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
queue = []
for i in range(m):
    a, b = input().split()
    queue.append([a, b])

sort_list = [[10**10] for i in range(n)]
for data in queue:
    k, v = map(int, data)
    sort_list[k - 1].append(v)

for i in range(n):
    sort_list[i].sort()

for data in queue:
    k, v = map(int, data)   

    num_index = sort_list[k -1].index(v)

    print(str(k).zfill(6) + str(num_index + 1).zfill(6))


Fixed submission:
n, m = map(int, input().split())
queue = []
for i in range(m):
    c, y= map(int, input().split())
    queue.append([c, y, i])

queue = sorted(queue)

index = 0
keep = queue[0][0]
for i in range(m):
    if keep != queue[i][0]:
        index = 0
        keep = queue[i][0]
    index += 1
    queue[i][0] = str(queue[i][0]).zfill(6)
    queue[i][1] = str(index).zfill(6)

queue.sort(key=lambda x: x[2])

for data in queue:
    cn, yn, i = data
    print(cn + yn)
Buggy python submission (verdict: Runtime Error):
number = int(input())

def to_bin(n):
    if n == 0:
        return 0
    
    digits = []
    i = 0
    base = 1
    while n != 0:
        if n % (base * 2) == 0:
            digits.append('0')
        else:
            digits.append('1')
            n -= base
        i+= 1
        base *= -2
    return digits[::-1]

ans_list = to_bin(number)

for ans in ans_list:
    print(ans, end='')

Fixed submission:
number = int(input())

def to_bin(n):
    if n == 0:
        return [0]
    
    digits = []
    i = 0
    base = 1
    while n != 0:
        if n % (base * 2) == 0:
            digits.append('0')
        else:
            digits.append('1')
            n -= base
        i+= 1
        base *= -2
    return digits[::-1]

ans_list = to_bin(number)

for ans in ans_list:
    print(ans, end='')

Buggy python submission (verdict: Runtime Error):
number = int(input())

def to_bin(n):
    if n == 0:
        return 0
    
    digits = []
    i = 0
    base = 1
    while n != 0:
        if n % (base * 2) == 0:
            digits.append('0')
        else:
            digits.append('1')
            n -= base
        i+= 1
        base *= 2
    return digits[::-1]

ans_list = to_bin(number)

for ans in ans_list:
    print(ans, end='')


Fixed submission:
number = int(input())

def to_bin(n):
    if n == 0:
        return [0]
    
    digits = []
    i = 0
    base = 1
    while n != 0:
        if n % (base * 2) == 0:
            digits.append('0')
        else:
            digits.append('1')
            n -= base
        i+= 1
        base *= -2
    return digits[::-1]

ans_list = to_bin(number)

for ans in ans_list:
    print(ans, end='')
Buggy python submission (verdict: Runtime Error):
n = input()
sn = sum(map(int, n))

print('Yes' if n % sn == 0 else 'No')

Fixed submission:
n = input()
sn = sum(map(int, n))

print('Yes' if int(n) % sn == 0 else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
flag_list = [int(i) for i in input().split()]


ans = 0
cont_game = True

while cont_game:
    no_change = 0
    for i in range(num):
        if flag_list[i] % 2 == 0:
            flag_list[i] //= 2
            break
        else:
            no_change += 1
            pass

    if no_change == num:
        break
    ans += 1

print(ans)

Fixed submission:
num = int(input())
flag_list = [int(i) for i in input().split()]


ans = 0
cont_game = True

for val in flag_list:
    while val % 2 == 0:
        val //= 2
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
flag_list = [int(i) for i in input().split()]


ans = 0
check_divide = False
cont_game = True

while cont_game:
    for i in range(num):
        if check_divide == False:
            if flag_list[i] % 2 == 0:
                flag_list[i] //= 2
                check_divide = True
            else:
                flag_list[i] *= 3
        else:
            flag_list[i] *= 3

    if check_divide == True:
        check_divide = False
    else:
        break
    ans += 1

print(ans)

Fixed submission:
num = int(input())
flag_list = [int(i) for i in input().split()]


ans = 0
cont_game = True

for val in flag_list:
    while val % 2 == 0:
        val //= 2
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
ans = 0
for b in range(1, x):
    for p in range(2, x):
        if b ** p <= x:
            ans = max(ansm, b**p)

print(ans)

Fixed submission:
x = int(input())
ans = 1
for b in range(1, x):
    for p in range(2, x):
        if b ** p <= x:
            ans = max(ans, b**p)
        else: break

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
S = list(range(A, B + 1))

ans = sorted(set(S[:K] + S[-K:]))
for a in ans:
    print(a)


Fixed submission:
A, B, K = map(int, input().split())
SA = list(range(A, min(B, A + K)))
SB = list(range(max(A, B - K + 1), B + 1))

ans = sorted(set(SA + SB))
for a in ans:
    print(a)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
S = list(range(A, B + 1))

ans = set(S[:K] + S[-K:])
for a in ans:
    print(a)


Fixed submission:
A, B, K = map(int, input().split())
SA = list(range(A, min(B, A + K)))
SB = list(range(max(A, B - K + 1), B + 1))

ans = sorted(set(SA + SB))
for a in ans:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] + list(map(int, input().split())) + [0]

cost_list = []
for i in range(1, n+2):
    cost_list.append(abs(a[i] - a[i-1]))

for i in range(n):
    print(sum(cost_list[:i]) + sum(cost_list[i+2:]) + abs(a[i+2] - a[i]))



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

cost = 0
for i in range(n+2):
    cost += (abs(a[i] - a[i-1]))

for i in range(1, n+1):
    print(cost + abs(a[i-1]-a[i+1]) - (abs(a[i-1]-a[i]) + abs(a[i]-a[i+1])))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    p = 0
    cnt = 0
    for j in a[:i] + a[i+1:]:
        cnt += abs(j-p)
        p = j
    
    cnt += abs(j-0)
    
    print(cnt)

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

cost = 0
for i in range(n+2):
    cost += (abs(a[i] - a[i-1]))

for i in range(1, n+1):
    print(cost + abs(a[i-1]-a[i+1]) - (abs(a[i-1]-a[i]) + abs(a[i]-a[i+1])))
Buggy python submission (verdict: Runtime Error):
import collections

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
print(answer_collection[0][1])

Fixed submission:
import collections

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
if answer_collection == []:
    print(0)
else:
    print(answer_collection[0][1])

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

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
print(answer_collection[0][0])

Fixed submission:
import collections

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
if answer_collection == []:
    print(0)
else:
    print(answer_collection[0][1])
Buggy python submission (verdict: Runtime Error):
x, a, b = [int(input() for i in range(3))]
print((x-a) % b)


Fixed submission:
x, a, b = [int(input()) for i in range(3)]
print((x-a) % b)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
start_list = []
end_list = []

for _ in range(m):
    s, e = map(int, input().split())

    if s == 1:
        start_list.append(e)
    if e == n:
        end_list.append(s)

possible = False
for i in end_list:
    if i in start_list:
        possible = True
        break        

print('POSSIBLE' if possible else 'IMPOSSIBLE')

Fixed submission:

n, m = map(int, input().split())
memo = [False] * n

possible = False
for _ in range(m):
    s, e = map(int, input().split())

    if s == 1:
        if memo[e]:
            possible = True
            break

        memo[e] = True

    elif e == n:
        if memo[s]:
            possible = True
            break

        memo[s] = True

print('POSSIBLE' if possible else 'IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
def operation(i, ans_list) -> list:
    ans_list.append(i)
    ans_list.reverse()

    return ans_list

n = int(input())
input_list = list(map(str, input().split()))
ans_list = []

for i in input_list:
    operation(i, ans_list)

print(' '.join(ans_list))

Fixed submission:
n = int(input())
input_list = list(map(int, input().split()))
ans_list = input_list[::-2] + input_list[n%2::2]
print(*ans_list)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

def CheckColor(a):
    global free_count
    if 1 <= 0 a and a <= 399:
        return 'gray'
    elif 400 <= a and a <= 799:
        return 'blown'
    elif 800 <= a and a <= 1199:
        return 'green'
    elif 1200 <= a and a <= 1599:
        return 'water'
    elif 1600 <= a and a <= 1999:
        return 'blue'
    elif 2000 <= a and a <= 2399:
        return 'yellow'
    elif 2400 <= a and a <= 2799:
        return 'orange'
    elif 2800 <= a and a <= 3199:
        return 'red'
    else:
        free_count += 1
        return 'free'

def Max(L):
    global gree_count
    max_num = min_num + free_count
    if max_num > 7:
        return 7        
    else:
        return max_num

def Min(L):
    global min_num
    if 'free' in ans_set:
        min_num = len(L) - 1
    else:
        min_num = len(L)
    return min_num


ans_list = []
count = 0
min_num = 0
free_count = 0

for a in A:
    ans_list.append(CheckColor(a))

ans_set = set(ans_list)

print(Min(ans_set), Max(ans_set))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

def CheckColor(a, count):
    if 1 <= a and a <= 399:
        count[0] += 1
    elif 400 <= a and a <= 799:
        count[1] += 1
    elif 800 <= a and a <= 1199:
        count[2] += 1
    elif 1200 <= a and a <= 1599:
        count[3] += 1
    elif 1600 <= a and a <= 1999:
        count[4] += 1
    elif 2000 <= a and a <= 2399:
        count[5] += 1
    elif 2400 <= a and a <= 2799:
        count[6] += 1
    elif 2800 <= a and a <= 3199:
        count[7] += 1
    else:
        count[8] += 1

ans = 0
count = [0 for _ in range(9)]

for a in A:
    CheckColor(a, count)

for c in count[:8]:
    if c != 0:
        ans += 1

print(max(ans, 1), ans + count[8])
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

if A > B:
    print('GREATER')
elif A < B:
    print('LESS')
else:
    print('EQUAL')

Fixed submission:
A = int(input())
B = int(input())

if A > B:
    print('GREATER')
elif A < B:
    print('LESS')
else:
    print('EQUAL')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

students = []
for i in range(N):
    students.append(input().split())

checkpoints = []
for i in range(M):
    checkpoints.append(input().split())

for x1, y1 in students:
    result = 10**8
    index = 1
    for x2, y2 in checkpoints:
        val = abs(int(x1) - int(x2)) + abs(int(y1) - int(y2))
        if result > val:
            ans = index
            result = val
        index += 1
    print(ans)

Fixed submission:
N, M = map(int, input().split())

students = []
for i in range(N):
    students.append(input().split())

checkpoints = []
for i in range(M):
    checkpoints.append(input().split())

for x1, y1 in students:
    result = 99999999999
    index = 1
    for x2, y2 in checkpoints:
        val = abs(int(x1) - int(x2)) + abs(int(y1) - int(y2))
        if result > val:
            ans = index
            result = val
        index += 1
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

devide = 10 ** 9 + 7

power = 1
for i in range(1, N + 1):
    power *= i

ans = power % devide
print(ans)

Fixed submission:
N = int(input())

devide = 10 ** 9 + 7

power = 1
for i in range(1, N + 1):
    power = power * i % devide

#power %= devide
print(power)

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

devide = 10 ** 9 + 7

power = 1
for i in range(1, N + 1):
    power *= i

print(power % devide)

Fixed submission:
N = int(input())

devide = 10 ** 9 + 7

power = 1
for i in range(1, N + 1):
    power = power * i % devide

#power %= devide
print(power)
Buggy python submission (verdict: Time Limit Exceeded):
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):
            if S == x + y + z:
                cnt += 1

print(cnt)

Fixed submission:
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)
Buggy python submission (verdict: Runtime Error):
A, op, B = map(str, input().split())

if op == '+':
    print(int(A) + int(B))
if op == '-':
    print(int(A)) - int(B)

Fixed submission:
A, op, B = map(str, input().split())

if op == '+':
    print(int(A) + int(B))
if op == '-':
    print(int(A) - int(B))