Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
import decimal
import sys
input = sys.stdin.readline


def prime_list(limit, until_limit=True):
    lst = [2]
    for num in range(3, limit, 2):
        if num ** 2 > limit and not until_limit:
            break

        for p_num in lst:
            if num % p_num == 0:
                break
            elif p_num * p_num > num:
                lst.append(num)
                break
    return lst


def prime_factor_count():
    pass


def main():
    n = int(input())
    p_list = prime_list(n)

    d = defaultdict(int)
    tmp = n
    for i in p_list:
        while 1:
            if tmp % i != 0:
                break
            else:
                tmp //= i
                d[i] += 1
        if tmp == 0:
            break

    cnt = 0
    tmp_n = 0
    for k, v in d.items():
        exp_cnt = 1
        while 1:
            if exp_cnt > v:
                break
            else:
                if tmp_n % (tmp_exp := k ** exp_cnt) == 0:
                    tmp_n //= tmp_exp
                    cnt += 1
                    v -= exp_cnt
                    exp_cnt += 1
    else:
        if n == tmp_n:
            cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()

Fixed submission:
from collections import defaultdict
import decimal
import sys
input = sys.stdin.readline


def prime_factor_count(n):
    def count(n, i):
        cnt = 0
        while n % i == 0:
            cnt += 1
            n //= i
        return n, cnt

    d = {}
    if n == 1:
        return d

    n, cnt = count(n, 2)
    d[2] = cnt

    lst = [2]
    for num in range(3, int(n ** 0.5) + 1, 2):
        if n == 1:
            break
        for p_num in lst:
            if num % p_num == 0:
                break
            elif p_num * p_num > num:
                lst.append(num)
                n, cnt = count(n, num)
                d[num] = cnt
                break
    else:
        if n != 1:
            d[n] = 1
    return d



def main():
    n = int(input())
    d = prime_factor_count(n)

    cnt = 0
    tmp_n = 0
    for k, v in d.items():
        exp_cnt = 1
        while 1:
            if exp_cnt > v:
                break
            else:
                if tmp_n % (tmp_exp := k ** exp_cnt) == 0:
                    tmp_n //= tmp_exp
                    cnt += 1
                    v -= exp_cnt
                    exp_cnt += 1
    else:
        if n == tmp_n:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import itertools
    k = int(input())
    s = input()
    if len(s) > k:
        s = s[:k] + '...'
    print(s)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    k = int(input())
    s = input()
    if len(s) > k:
        s = s[:k] + '...'

    print(s)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from collections import deque as dq
# import itertools
# import math
import networkx as nx
import sys
input = sys.stdin.readline


def main():
    n, m = map(int, input().split())
    limit = 10 ** 5
    # lst = [[] for _ in range(n + 1)]
    # ans = [0] * (n + 1)
    que = dq()
    # for _ in range(m):
    #     a, b = map(int, input().split())
    #     lst[a].append(b)
    #     lst[b].append(a)

    g = nx.Graph()
    g.add_edges_from([[i for i in input().split()] for _ in range(m)])
    # [[g.nodes[i][length] = limit ] for i in range(2, n + 1)]
    g.nodes[1]['length'] = 0
    for i in range(2, n + 1):
        g.nodes[i]['length'] = limit
        g.nodes[i]['next'] = 'Non'

    # d = {i: limit + 1 for i in range(1, n + 1)}
    # d[1] = 0
    que.append(1)
    # cnt = 1
    while que:
        visit = que.popleft()
        for next_v in g.succ[visit]:
            if g[next_v]['length'] > g[visit]['length'] + 1:
                g[next_v]['length'] = g[visit]['length'] + 1
                que.append(next_v)
                g[next_v]['next'] = visit

    if all(g.nodes[i]['next'] != 'Non' for i in range(2, n + 1)):
        print('Yes')
        for i in range(2, n + 1):
            print(g.nodes[i]['next'])
    else:
        print('No')


if __name__ == '__main__':
    main()


Fixed submission:
from collections import deque as dq
import sys
input = sys.stdin.readline


def main():
    n, m = map(int, input().split())
    lst = [[] for _ in range(n + 1)]
    ans = [0] * (n + 1)
    que = dq()
    for _ in range(m):
        a, b = map(int, input().split())
        lst[a].append(b)
        lst[b].append(a)

    limit = 10 ** 5
    d = {i: limit + 1 for i in range(1, n + 1)}
    d[1] = 0
    que.append(1)
    while que:
        visit = que.popleft()
        for next_v in lst[visit]:
            if d[next_v] > d[visit] + 1:
                d[next_v] = d[visit] + 1
                que.append(next_v)
                ans[next_v] = visit

    if all([i != 0 for i in ans[2:]]):
        print('Yes')
        print(*ans[2:], sep='\n')
    else:
        print('No')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
MOD = 998244353

ans = 0
for i in range(k + 1):
    ans += (ans + m * pow(m - 1, m - i - 1, MOD)) % MOD
    c = (c * (n - 1 - i) * pow(i + 1, MOD - 2, MOD)) % MOD

print(ans)


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

ans = 0
c = 1
for i in range(k + 1):
    ans = (ans + m * pow(m - 1, n - i - 1, MOD) * c) % MOD
    c = (c * (n - 1 - i) * pow(i + 1, MOD - 2, MOD)) % MOD
    # print(f"{ans = }, {c = }")

print(ans)
Buggy python submission (verdict: Runtime Error):

up_list = []
down_list = []

for _ in range(n):
    txt = input()
    min_comp = 10 ** 6
    compare = 0
    cnt = 0
    for s in txt:
        cnt += 1
        if s == '(':
            compare += 1
        else:
            compare -= 1
            min_comp = min(min_comp, compare)
    if compare > 0:
        up_list.append([compare, min(min_comp, 0)])
    else:
        down_list.append([compare, min(min_comp, 0) - compare])


up_list.sort(key=lambda x: x[1], reverse=True)
down_list.sort(key=lambda x: x[1], reverse=False)
txt = 'No'
c = 0

for t in up_list + down_list:
    if t[1] + c < 0:
        break
    else:
        c += t[0]
else:
    if c == 0:
        txt = 'Yes'

print(txt)

Fixed submission:
def count_scan(s):
    max_min = 0
    compare = 0
    for c in s:
        if c == '(':
            compare += 1
        elif c == ')':
            compare -= 1
            max_min = min(max_min, compare)
    return min(max_min, compare), compare
 
 
def key(lst):
    m, c = lst
    if c > 0:
        return 1, m
    else:
        return -1, c - m
 
 
def main():
    n = int(input())
    lst = [input() for _ in range(n)]
 
    txt = 'No'
    ans = 0
    for max_min, c in sorted([count_scan(s) for s in lst],
                             reverse=True,
                             key=key):
        if max_min + ans < 0:
            break
        ans += c
    else:
        if ans == 0:
            txt = 'Yes'
 
    print(txt)
  
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

a = 1
b = 0

while a ** 5 <= x:
    a += 1
if x >= a ** 5 - (a - 1) ** 5:
    is_pos = True
else:
    is_pos = False
    a -= 1

tmp = 1 if is_pos else -1

while a ** 5 - b ** 5 != x:
    b += tmp


print(a, b)


Fixed submission:
x = int(input())
LIMIT = 10 ** 9
lmt = 0

while lmt ** 5 - (lmt - 1) ** 5 <= LIMIT:
    lmt += 1


for a in range(-lmt, lmt + 1):
    for b in range(-lmt, a + 1):
        # print(a, b)
        if a ** 5 - b ** 5 == x:
            print(a, b)
            exit()
Buggy python submission (verdict: Runtime Error):
def abc(d, down_text, up_text):
    d[down_text] -= 1
    d[up_text] += 1


def main():
    n, a, b, c = map(int, input().split())
    ans_list = []
    dct = {"A": a, "B": b, "C": c}

    b_txt = input()
    if dct[b_txt[0]] == dct[b_txt[1]]:
        print('No')
        exit()

    for _ in range(n - 1):
        a_txt = input()
        l_txt = b_txt[0]
        r_txt = b_txt[1]

        if dct[l_txt] < dct[r_txt]:
            abc(dct, r_txt, l_txt)
            ans_list.append(l_txt)

        elif dct[l_txt] > dct[r_txt]:
            abc(dct, l_txt, r_txt)
            ans_list.append(r_txt)

        else:
            if dct[l_txt] == dct[r_txt] == 0:
                print('No')
                break
            else:
                if l_txt in a_txt:
                    abc(dct, r_txt, l_txt)
                    ans_list.append(l_txt)
                else:
                    abc(dct, l_txt, r_txt)
                    ans_list.append(r_txt)
        b_txt = a_txt
    else:
        if dct[a_txt[0]] == dct[a_txt[1]] == 0:
            print('No')
            exit()
        elif dct[a_txt[0]] < dct[a_txt[1]]:
            ans_list.append(a_txt[0])
        else:
            ans_list.append(a_txt[1])
        print('Yes')
        print(*ans_list, sep='\n')


if __name__ == "__main__":
    main()


Fixed submission:
def abc(d, down_text, up_text):
    d[down_text] -= 1
    d[up_text] += 1


def main():
    n, a, b, c = map(int, input().split())
    ans_list = []
    dct = {"A": a, "B": b, "C": c}

    abc_list = [input() for _ in range(n)]
    abc_list.append('AB')

    for i in range(n):
        # a_txt = input()
        l_txt = abc_list[i][0]
        r_txt = abc_list[i][1]

        if dct[l_txt] < dct[r_txt]:
            abc(dct, r_txt, l_txt)
            ans_list.append(l_txt)

        elif dct[l_txt] > dct[r_txt]:
            abc(dct, l_txt, r_txt)
            ans_list.append(r_txt)

        else:
            if dct[l_txt] == dct[r_txt] == 0:
                print('No')
                break
            else:
                if l_txt in abc_list[i + 1]:
                    abc(dct, r_txt, l_txt)
                    ans_list.append(l_txt)
                elif r_txt in abc_list[i + 1]:
                    abc(dct, l_txt, r_txt)
                    ans_list.append(r_txt)
    else:
        print('Yes')
        print(*ans_list, sep='\n')


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    left = 1
    right = n
    is_shift = False
    ans = []
    while left < right:
        if right - left <= n // 2 and not is_shift:
            left += 1
        ans.append([left, right])
        left += 1
        right -= 1

    for l in range(m):
        print(*ans[l])


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, m = map(int, input().split())
    left = 1
    right = n
    is_shift = False
    ans = []
    while left < right:
        if right - left <= n // 2 and not is_shift and n % 2 == 0:
            left += 1
            is_shift = True
        ans.append([left, right])
        left += 1
        right -= 1

    for l in range(m):
        print(*ans[l])


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    left = 1
    right = n
    is_shift = False
    ans = []
    while left < right:
        if right - left <= n // 2 and not is_shift:
            left += 1
        ans.append([left, right])
        left += 1
        right -= 1

    print(f"{ans = }")
    for l in range(m):
        print(*ans[l])


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, m = map(int, input().split())
    left = 1
    right = n
    is_shift = False
    ans = []
    while left < right:
        if right - left <= n // 2 and not is_shift and n % 2 == 0:
            left += 1
            is_shift = True
        ans.append([left, right])
        left += 1
        right -= 1

    for l in range(m):
        print(*ans[l])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
s_len = len(s)
ref = [0] * s_len

for i in range(1, s_len + 1):
    ref[-i] = int(s[-i]) * pow(10, i, MOD) % MOD

for i in range(1, s_len):
    ref[-i - 1] += ref[-i]
    ref[-i - 1] %= MOD

ref_cnt = Counter(ref)
ans = sum(ref_cnt.values()) - len(ref_cnt)


for i in ref_cnt.values():
    ans += (i - 1) * (i - 2) // 2

if 0 in ref:
    ans += ref_cnt[0]

print(ans)

Fixed submission:
from collections import Counter
s = input()
MOD = 2019

s_len = len(s)
ref = [0] * s_len

for i in range(1, s_len + 1):
    ref[-i] = int(s[-i]) * pow(10, i, MOD) % MOD

for i in range(1, s_len):
    ref[-i - 1] += ref[-i]
    ref[-i - 1] %= MOD

ref_cnt = Counter(ref)
ans = sum(ref_cnt.values()) - len(ref_cnt)


for i in ref_cnt.values():
    ans += (i - 1) * (i - 2) // 2

if 0 in ref:
    ans += ref_cnt[0]

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(i for i in input().suplt)

all_homework_day = sum(a)

if all_homework_day <= n:
    play_day = all_homework_day
else:
    play_day = -1

print(play_day)

Fixed submission:
n, m = map(int, input().split())
a = list(int(i) for i in input().split())

all_homework_day = sum(a)

if all_homework_day <= n:
    play_day = n - all_homework_day
else:
    play_day = -1

print(play_day)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(int(i) for i in input().split())

for i in range(1, n + 1):
    print(a.count(i))


Fixed submission:

n = int(input())
a = list(int(i) for i in input().split())
lst = [0] * (n + 1)

for i in a:
    lst[i] += 1

for i in range(1, n + 1):
    print(lst[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

result = 0

for fst_index in range(n):
    for scd_index in range(fst_index + 1, n):
        if s[fst_index] == s[scd_index]:
            continue
        for trd_index in range(scd_index + 1, n):
            if s[trd_index] == s[fst_index] or s[trd_index] == s[scd_index] or \
               fst_index + trd_index == scd_index * 2:
                continue
            result += 1

print(result)


Fixed submission:
n = int(input())
s = input()

result = s.count('R') * s.count('G') * s.count('B')

for fst_idx in range(n):
    for scd_idx in range(fst_idx + 1, n):
        trd_idx = scd_idx * 2 - fst_idx
        if trd_idx >= n:
            break
        elif s[fst_idx] != s[scd_idx] and s[scd_idx] != s[trd_idx] and \
                s[trd_idx] != s[fst_idx]:
            result -= 1

print(result)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

a_set = sorted(set(a))

count = [0] * n


def f(n):
    return (n * (n - 1) // 2)


sum = 0
for i in a_set:
    count[i] = a.count(i)
    sum += f(count[i])

for i in a:
    print(sum - (count[i] - 1))
    

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

# a_set = sorted(set(a))

count = [0] * (n + 1)


def f(n):
    return (n * (n - 1) // 2)


sum = 0
for i in a:
    count[i] += 1
for i in count:
    sum += f(i)

for i in a:
    print(sum - (count[i] - 1))

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

a_set = sorted(set(a))
cnt_dict = {}


def f(n):
    return (n * (n - 1) // 2)


sum = 0
for i in a_set:
    cnt_dict[i] = a.count(i)
    sum += f(cnt_dict[i])


for i in a:
    print(sum - (cnt_dict[i] - 1))

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

# a_set = sorted(set(a))

count = [0] * (n + 1)


def f(n):
    return (n * (n - 1) // 2)


sum = 0
for i in a:
    count[i] += 1
for i in count:
    sum += f(i)

for i in a:
    print(sum - (count[i] - 1))

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

a_set = sorted(set(a))
a_dict = {}
cnt_dict = {}


def f(n):
    sum = 0
    for i in range(n):
        sum += i
    return sum


sum = 0
for i in a_set:
    cnt_dict[i] = a.count(i)
    sum += f(cnt_dict[i])


for i in a_set:
    a_dict[i] = sum - (cnt_dict[i] - 1)


for i in a:
    print(a_dict[i])

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

# a_set = sorted(set(a))

count = [0] * (n + 1)


def f(n):
    return (n * (n - 1) // 2)


sum = 0
for i in a:
    count[i] += 1
for i in count:
    sum += f(i)

for i in a:
    print(sum - (count[i] - 1))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, m = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
sum_list = []
list1 = []

for i in a_list:
    for j in b_list:
        list1.append(i + j)

for i in range(m):
    x, y, c = list(map(int, input().split()))
    sum = a_list[x - 1] + b_list[y - 1] - c
    sum_list.append(sum)

# print(list1)
# print(sum_list)
print(min(min(sum_list), min(list1)))

Fixed submission:
a, b, m = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
sum_list = []

min_sum = min(a_list) + min(b_list)


for i in range(m):
    x, y, c = list(map(int, input().split()))
    sum = a_list[x - 1] + b_list[y - 1] - c
    sum_list.append(sum)

print(min(min(sum_list), min_sum))
Buggy python submission (verdict: Time Limit Exceeded):
n, p = map(int, input().split())
s = list(map(int, list(input())))


def is_prime(p, s):
    tmp = 0
    sum = 0
    for i in s:
        tmp = (tmp * 10 + i) % p
        if tmp == 0:
            sum += 1
    return sum


n = len(s)
cnt = 0

for i in range(n):
    cnt += is_prime(p, s[i:])

print(cnt)

Fixed submission:

n, p = map(int, input().split())
s = list(map(int, list(input())))


cnt = [0] * p
cnt[0] = 1
rem = 0
sum = 0

if p == 2 or p == 5:
    for i in range(n):
        if s[i] % p == 0:
            sum += i + 1

else:
    for i in range(n):
        rem = (int(s[-i - 1]) * pow(10, i, p) + rem) % p
        sum += cnt[rem]
        cnt[rem] += 1

print(sum)

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

n, p = map(int, input().split())
s = deque(list(input()))

def is_prime(p, s):
    if s % p == 0:
        return 1
    else:
        return 0

def str_num(s):
    return int(''.join(s))
  
  
cnt = 0
tmp = deque()
while len(s) >= 2:
    tmp.appendleft(s.pop())

    for i in range(len(s)):
        cnt += is_prime(p, str_num(s))
        cnt += is_prime(p, str_num(tmp))
        tmp.appendleft(s.pop())
    cnt += is_prime(p, str_num(tmp))
    tmp.pop()
    tmp.popleft()
    s, tmp = tmp, s


if n == 1:
    cnt += is_prime(str_num(s))

print(cnt)


Fixed submission:

n, p = map(int, input().split())
s = list(map(int, list(input())))


cnt = [0] * p
cnt[0] = 1
rem = 0
sum = 0

if p == 2 or p == 5:
    for i in range(n):
        if s[i] % p == 0:
            sum += i + 1

else:
    for i in range(n):
        rem = (int(s[-i - 1]) * pow(10, i, p) + rem) % p
        sum += cnt[rem]
        cnt[rem] += 1

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n, p = map(int, input().split())
s = list(input())

def is_prime(p, s):
    if(s % p == 0):
        return 1
    else:
        return 0


def str_num(s):
    return int(''.join(s))


tmp = deque()

n = len(s)
cnt = 0
for i in range(n):
    for j in range(i + 1, n + 1):
        cnt += is_prime(p, str_num(s[i:j]))
print(cnt)

Fixed submission:

n, p = map(int, input().split())
s = list(map(int, list(input())))


cnt = [0] * p
cnt[0] = 1
rem = 0
sum = 0

if p == 2 or p == 5:
    for i in range(n):
        if s[i] % p == 0:
            sum += i + 1

else:
    for i in range(n):
        rem = (int(s[-i - 1]) * pow(10, i, p) + rem) % p
        sum += cnt[rem]
        cnt[rem] += 1

print(sum)
Buggy python submission (verdict: Runtime Error):
if(int(N) >= 10):
    print(R)
else:
    print(int(R) + 100 * (10 - int(N)))

Fixed submission:
N, R = input().split()

if(int(N) >= 10):
    print(R)
else:
    print(int(R) + 100 * (10 - int(N)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(int(x) for x in input().split())
N_sum_HP = []

for p in range(min(X), max(X)):
    sum_HP = 0
    for i in range(N):
        sum_HP += (X[i] - p) ** 2
    N_sum_HP.append(sum_HP)

print(min(N_sum_HP))

Fixed submission:
N = int(input())
X = list(int(x) for x in input().split())
N_sum_HP = []


for p in range(min(X), max(X) + 1):
    sum_HP = 0
    for x in X:
        sum_HP += (x - p) ** 2
    N_sum_HP.append(sum_HP)
print(min(N_sum_HP))
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, k = (int(x) for x in input().split())
p = np.array(int(x) for x in input().split())
sump = []

for i in range(n - k + 1):
    sump.append(sum(p[i: k + i], k))
    sump.extend(np.sum(p[i: k + i]))

print((max(sump) + k) / 2)


Fixed submission:
import numpy as np

n, k = (int(x) for x in input().split())
p = np.array(list(int(x) for x in input().split()))

p = (p + 1) / 2

sump = []
e = []
s = 0

for i in range(len(p)):
    s += p[i]
    sump.append(s)

sump.insert(0, 0)
sump = np.array(sump)

for i in range(n - k + 1):
    e.append(sump[i + k] - sump[i])


print(max(e))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = (int(x) for x in input().split())
p = list(int(x) for x in input().split())
sump = []

for i in range(n - k + 1):
    sump.append(sum(p[i: k + i], k))
print(max(sump) / 2)


Fixed submission:
import numpy as np

n, k = (int(x) for x in input().split())
p = np.array(list(int(x) for x in input().split()))

p = (p + 1) / 2

sump = []
e = []
s = 0

for i in range(len(p)):
    s += p[i]
    sump.append(s)

sump.insert(0, 0)
sump = np.array(sump)

for i in range(n - k + 1):
    e.append(sump[i + k] - sump[i])


print(max(e))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
p = np.array(list(int(x) for x in input().split()))
sum = 1

for i in range(1, n):
    if(np.all(p[:i] > p[i])):
        sum += 1

print(sum)


Fixed submission:
import numpy as np

n = int(input())
p = np.array(list(int(x) for x in input().split()))
sum = 0
low = p[0] + 1

for i in p:
    if(i < low):
        sum += 1
        low = i

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(int(x) for x in input().split())
sum = 1

for i in range(1, n):
    if(all(p[i] < j for j in p[:i])):
        sum += 1

print(sum)

Fixed submission:
import numpy as np

n = int(input())
p = np.array(list(int(x) for x in input().split()))
sum = 0
low = p[0] + 1

for i in p:
    if(i < low):
        sum += 1
        low = i

print(sum)
Buggy python submission (verdict: Runtime Error):
N, K, M = list(map(int, input().split()))
A = list(map(int, input().split()))

a_sum = sum(A)
x = N * M - a_sum

if K < x:
    x = -1
elif x < 0:
    x = 0
print(x)


Fixed submission:
c = input()

txt = 'abcdefghijklmnopqrstuvwxyz'
for i in range(26):
    if txt[i] == c:
        print(txt[i + 1])

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

txt = 'abcdefghijklmnopqrstuvwxyz'

for i in range(27):
    if txt[i] == c:
        print(txt[i + 1])


Fixed submission:
c = input()

txt = 'abcdefghijklmnopqrstuvwxyz'
for i in range(26):
    if txt[i] == c:
        print(txt[i + 1])
Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
for i in range(1,N+1):
    ans = 0
    cnt = 0
    for x in range(1,int(math.sqrt(i))+1):
        for y in range(1,x+1):
            for z in range(1,y+1):
                if((x**2 + y**2 + z**2 + x*y + y*z + z*x) == i):
                    if(x*y*z == 1):
                        ans += 1
                    else:
                        cnt += 1
                    break
    ans += cnt*3
    print(ans)


Fixed submission:
import math
N = int(input())
ans_list = [0 for i in range(N+1)]
for x in range(1,int(math.sqrt(N))+1):
    for y in range(1,int(math.sqrt(N))+1):
        for z in range(1,int(math.sqrt(N))+1):
            f = x**2 +y**2 +z**2 +x*y +y*z + z*x
            if(f<=N):
                ans_list[f] += 1

for i in range(1,N+1):
    print(ans_list[i])