Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = map(int, input().split())
a_list = list(x)
# n = 5
# a_list = [1,1,2,2]

# r_list = []
# for i in range(n+1):
#     r_list.append(a_list.count(i))


r_list = map(a_list.count, range(n+1))
r_list = list(r_list)
r_list2 = map(str, r_list[1:])
r_list2 = list(r_list2)

ans = "\n".join(r_list2)

print(ans)

Fixed submission:
import collections
n = int(input())
x = map(int, input().split())
a_list = list(x)

# n = 5
# a_list = [1,1,3,3]

r_list = collections.Counter(a_list)
y = []
for i in range(1,(n+1)):
    if (i in r_list):
        y.append(r_list[i])
    else:
        y.append(0)

r_list2 = map(str, y)
r_list2 = list(r_list2)
ans = "\n".join(r_list2)
print(ans)

# r_list = map(a_list.count, range(n+1))
#r_list = list(r_list_v)

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

r_list = []
for i in range(n+1):
    r_list.append(a_list.count(i))

r_list2 = map(str, r_list[1:])
r_list2 = list(r_list2)

ans = "\n".join(r_list2)

print(ans)

Fixed submission:
import collections
n = int(input())
x = map(int, input().split())
a_list = list(x)

# n = 5
# a_list = [1,1,3,3]

r_list = collections.Counter(a_list)
y = []
for i in range(1,(n+1)):
    if (i in r_list):
        y.append(r_list[i])
    else:
        y.append(0)

r_list2 = map(str, y)
r_list2 = list(r_list2)
ans = "\n".join(r_list2)
print(ans)

# r_list = map(a_list.count, range(n+1))
#r_list = list(r_list_v)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = []
x = map(int, input().split())
a_list = list(x) 

r_list = []
for i in range(n+1):
    r_list.append(a_list.count(i))

r_list2 = map(str, r_list[1:])
r_list3 = list(r_list2)

ans = "\n".join(r_list3)

print(ans)

Fixed submission:
import collections
n = int(input())
x = map(int, input().split())
a_list = list(x)

# n = 5
# a_list = [1,1,3,3]

r_list = collections.Counter(a_list)
y = []
for i in range(1,(n+1)):
    if (i in r_list):
        y.append(r_list[i])
    else:
        y.append(0)

r_list2 = map(str, y)
r_list2 = list(r_list2)
ans = "\n".join(r_list2)
print(ans)

# r_list = map(a_list.count, range(n+1))
#r_list = list(r_list_v)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import math

k=200
klis = list(range(1,k+1))
lis = list(itertools.product(klis, klis, klis))
temp = []
for i in range(len(lis)):
    temp.append(math.gcd(math.gcd(lis[i][0],lis[i][1]),lis[i][2]))

print(sum(temp))

Fixed submission:
n = int(input())

all = int((n+1)*(n/2))
fizz = int(3*((n//3 + 1)*((n//3)/2)))
buzz = int(5*((n//5 + 1)*((n//5)/2)))
fizzbuzz = int(15*((n//15 + 1)*((n//15)/2)))

result =  all - fizz - buzz + fizzbuzz
print(result)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = list(input())
M = [0]
S = 0
K = 1
ans = 0

for i in range(len(N)):
    S += int(N[-i-1])*K
    S %= 2019

    K *= 10
    K %= 2019
    M.append(S)

P = Counter(M)
for i in range(2020):ans+=P[i]*(P[i]-1)//2
print(ans)


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

if b-a>=0:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
if Base_10_to_n(int(input()), 9)[-1] == '0':
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
if N % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
def Base_10_to_9(X):
    if (int(X/9)):
        return Base_10_to_9(int(X/9))+str(X%9)
    return str(X%9)
if Base_10_to_9(int(input()))[-1] == '0':
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
if N % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
def Base_10_to_9(X):
    if (int(X/9)):
        return Base_10_to_9(int(X/9))+str(X%9)
    return str(X%9)
if Base_10_to_9(int(input()))[-1] == '0':
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
if N % 9 == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S = input()
count = 0
for i in range(len(S)):
    for j in range(i + 5, i + 6):
        if int(S[i:j]) % 2019 == 0:
            count += 1
print(count)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
#3
N = int(input())
L = list(map(int, imput().split()))
A = [0] * N
for x in L:
    A[x - 1] += 1

print(*A, sep = '¥n)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
A = [0] * N
for x in L:
    A[x - 1] += 1

print(*A, sep = '\n')
Buggy python submission (verdict: Runtime Error):
N = input()
ans = 'No'
for i in range(len(N)):
    if N[i] == 7:
        global ans
        ans = 'Yes'
        break
    else:
        continue
print(ans)


Fixed submission:
N = int(input())
a1 = N % 10
a2 = ((N % 100) - a1) / 10
a3 = N // 100
if a1 == 7 or a2 == 7 or a3 ==7:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

K = int(input())

def GCD(x):
    return reduce(math.gcd, x)

s = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for h in range(1,K + 1):
            s += GCD((i, j, h))

print(s)

Fixed submission:
import math
from functools import reduce
from itertools import combinations_with_replacement

K = int(input())

def GCD(x):
    return reduce(math.gcd, x)

s = 0

for x in combinations_with_replacement(range(1, K + 1), 3):
    if x[0] == x[1] == x[2]:
        s += GCD(x)
    elif x[0] == x[1] or x[1] == x[2] or x[0] == x[2]:
        s += GCD(x) * 3
    else:
        s += GCD(x) * 6

print(s)
Buggy python submission (verdict: Runtime Error):
N, M = input().split(' ')
lis1 = input().split(' ')
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[M - 1] < thresh:
  print 'No'
else:
  print 'Yes'

Fixed submission:
X, Y, Z = map(int, input().split(' '))
print(Z, X, Y)

Buggy python submission (verdict: Runtime Error):
X, Y, Z = input()
print(Z, X, Y)

Fixed submission:
X, Y, Z = map(int, input().split(' '))
print(Z, X, Y)

Buggy python submission (verdict: Runtime Error):
X Y Z = input()
print Z, X, Y

Fixed submission:
X, Y, Z = map(int, input().split(' '))
print(Z, X, Y)

Buggy python submission (verdict: Runtime Error):
X Y Z = input()
she = 0
she = X
X = Y
Y = she
she = Z
Z = X
X = she
print X, Y, Z

Fixed submission:
X, Y, Z = map(int, input().split(' '))
print(Z, X, Y)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split(' '))
lis1 = map(int, input().split(' '))
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[-M] < thresh:
  print('No')
else:
  print('Yes')

Fixed submission:
N, M = map(int, input().split(' '))
lis1 = list(map(int, input().split(' ')))
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[-M] < thresh:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
N, M = input().split(' ')
lis1 = map(int, input().split(' '))
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[M - 1] < thresh:
  print 'No'
else:
  print 'Yes'

Fixed submission:
N, M = map(int, input().split(' '))
lis1 = list(map(int, input().split(' ')))
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[-M] < thresh:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
N, M = input()
lis1 = input().split(' ')
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[M - 1] < thresh:
  print 'No'
else:
  print 'Yes'

Fixed submission:
N, M = map(int, input().split(' '))
lis1 = list(map(int, input().split(' ')))
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[-M] < thresh:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split(' '))
if 2 * N < K:
    return N
else:
    a = N // K
    mm = min(abs(N - a * K), abs(N - (a + 1) * K))
    return mm

Fixed submission:
N, K = map(int, input().split(' '))
if 2 * N < K:
    print(N)
else:
    a = N // K
    mm = min(abs(N - a * K), abs(N - (a + 1) * K))
    print(mm)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split(' '))
if 2N < K:
    print(N)
else:
    a = N // K
    print(min(abs(N - a * K), abs(N - a * (K + 1))))

Fixed submission:
N, K = map(int, input().split(' '))
if 2 * N < K:
    print(N)
else:
    a = N // K
    mm = min(abs(N - a * K), abs(N - (a + 1) * K))
    print(mm)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split(' '))
if 2N < K:
    return N
else:
    a = N // K
    return min(abs(N - a * K), abs(N - a * (K + 1)))

Fixed submission:
N, K = map(int, input().split(' '))
if 2 * N < K:
    print(N)
else:
    a = N // K
    mm = min(abs(N - a * K), abs(N - (a + 1) * K))
    print(mm)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
items = list(input().split())

def main():
  for i in range(k+1, n+1):
    sum_prev, sum_next = (1, 1)

    for j in range(i-k-1, i-1):
      sum_prev *= int(items[j])
      sum_next *= int(items[j+1])

    if (sum_prev < sum_next):
      print("Yes")
    else:
      print("No")

main()


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

for i in range(k, n):
  if (int(items[i]) > int(items[i-k])):
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def dfs(g, start):
    visited[start] = True
    cc.append(0)
    for nbr in g[start]:
        if not visited[nbr]:
            dfs(g, nbr)



from collections import defaultdict
n, m = map(int, input().split())
g = defaultdict(set)

for _ in range(m):
    a, b = map(int, input().split())
    g[a - 1].add(b - 1)
    g[b - 1].add(a - 1)


visited = [False]*n
ans = 0
for i in range(n):
    if not visited[i]:
        cc = []
        dfs(g, i)
        ans = max(ans, len(cc))

print(ans)

Fixed submission:
d, t, s = map(int, input().split())

ans = 'Yes' if d/s <= t else 'No'
print(ans)

Buggy python submission (verdict: Runtime Error):
def dfs(g, start):
    visited[start] = True
    cc.append(0)
    for nbr in g[start]:
        if not visited[nbr]:
            dfs(g, nbr)



import sys
from collections import defaultdict
input = sys.stdin.readline
n, m = map(int, input().split())
g = defaultdict(set)

for _ in range(m):
    a, b = map(int, input().split())
    g[a - 1].add(b - 1)
    g[b - 1].add(a - 1)


visited = [False]*n
ans = 0
for i in range(n):
    if not visited[i]:
        cc = []
        dfs(g, i)
        ans = max(ans, len(cc))

print(ans)

Fixed submission:
d, t, s = map(int, input().split())

ans = 'Yes' if d/s <= t else 'No'
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
nums = list(map(int, input().split()))

print(sum(sorted(nums))[:k])

Fixed submission:
from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction

n, k = map(int, input().split())
nums = list(map(int, stdin.readline().split()))
nums.sort()
print(sum(nums[:k]))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, stdin.readline().strip().split())
print(n*m)

Fixed submission:
from sys import stdin, stdout
n, m = map(int, stdin.readline().strip().split())
print(n*m)
Buggy python submission (verdict: Runtime Error):
a, b = map(float, input().split())
print(((a*(100*b))//100)

Fixed submission:
from fractions import Fraction
a, b = map(Fraction, input().split())

print(int(a*b))

Buggy python submission (verdict: Runtime Error):
a, b = map(float, input().split())
print(((a*(100*b))/100)

Fixed submission:
from fractions import Fraction
a, b = map(Fraction, input().split())

print(int(a*b))
Buggy python submission (verdict: Runtime Error):
from sys import stdin, stdout
n = int(stdin.readline())
nmleaves = list(map(int, stdin.readline().strip().split()))

# pref[i]: sum of all elements in nmleaves after i, i.e. sum(nmleaves[i+1:])
full = sum(nmleaves)
tot = 0
pref = [0]*(n+1)
for i, l in enumerate(nmleaves):
    tot += l
    pref[i] = full - tot

if n==0:
    print(0)

else:
    if nmleaves[0]!=0:
        print(-1)
        exit()
    
    ## it exists
    ans = 0
    for level, leaves in enumerate(nmleaves):
        if leaves > 2**(level):
            print(-1)
            exit()

        if level == 0:
            ans += 1
            validnom = 1
        else:
            maxup = 2*validnom
            maxnom = maxup - leaves

            if level+1<len(nmleaves):
                validnom = min(maxnom, pref[level])
                ans += (leaves + validnom)
            else:
                ans += leaves
    print(ans)





Fixed submission:
from sys import stdin, stdout
# t = int(input())
# for _ in range(t):
    # n = int(stdin.readline())
h1, m1, h2, m2, k = map(int, stdin.readline().strip().split())
    # nums = list(map(int, stdin.readline().strip().split()))

t = (h2*60 + m2 - (h1*60 + m1) -  k)
print(t if t>0 else 0)
Buggy python submission (verdict: Runtime Error):
from sys import stdin, stdout
n = int(stdin.readline())
nmleaves = list(map(int, stdin.readline().strip().split()))

if n == 0:
    print(0)
else:
    if nmleaves[0]!= 0:
        print(-1)
        exit()
    
    # pref[i]: sum(nmleaves[i:]), i.e., the number of leaves at or below level i.
    pref = [0]*(n+1)
    totsum = sum(nmleaves)
    pref[0] = totsum
    t = 0
    for i in range(1, n+1):
        t += nmleaves[i-1]
        pref[i]  = totsum - t

    prev_nl = 1
    ans = 1
    for lev in range(1, n+1):
        nodes = min(prev_nl*2, pref[lev])
        ans += nodes
        prev_nl = nodes - nmleaves[lev]
        if prev_nl < 0:
            print(-1)
            exit()
        elif prev_nl == 0 and pref[lev + 1]>0:
            print(-1)
            exit()
    print(ans)

Fixed submission:
from sys import stdin, stdout
n = int(stdin.readline())
nmleaves = list(map(int, stdin.readline().strip().split()))

if nmleaves[0]:
   if n == 0 and nmleaves[0] == 1:
      print(1)
   else:
      print(-1)
   exit()

# pref[i]: sum(nmleaves[i:]), i.e., the number of leaves at or below level i.
pref = [0]*(n+1)
totsum = sum(nmleaves)
pref[0] = totsum
t = 0
for i in range(1, n+1):
    t += nmleaves[i-1]
    pref[i]  = totsum - t

prev_nl = 1
ans = 1
for lev in range(1, n+1):
    nodes = min(prev_nl*2, pref[lev])
    ans += nodes
    prev_nl = nodes - nmleaves[lev]
    if prev_nl < 0:
        print(-1)
        exit()
    elif prev_nl == 0 and lev+1<n+1 and pref[lev + 1]>0:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())

root = int(x**(0.2))

flag = 0
for i in range(root - 400, root + 400):
    for j in range(-100, root + 400):
        if i!=j:
            if x%(i-j) == 0:
                if i**5-j**5 == x:
                    print(i, j)
                    flag = 1
                    break
    if flag:
        break

Fixed submission:
s = input()
if s =='ABC':
  print('ARC')
if s == 'ARC':
  print('ABC')

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

root = int(x**(0.2))

flag = 0
for i in range(root - 100, root + 100):
    for j in range(-40, root):
        if i!=j:
            if x%(i-j) == 0:
                if i**5-j**5 == x:
                    print(i, j)
                    flag = 1
                    break
    if flag:
        break

Fixed submission:
s = input()
if s =='ABC':
  print('ARC')
if s == 'ARC':
  print('ABC')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
hlist = list(map(int, input().split()))
alist = list(range(1, n+1))

ans = 0
# The absolute difference of their attendee numbers is equal to the sum of their heights.
for i, h1 in enumerate(hlist):
    for j, h2 in enumerate(hlist):
        if h2>n or h1>n or h1+h2>n:
            continue
        if abs(i-j) == h1+h2:
            ans += 1

print(ans//2)

        



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

cnt_ind_minus_height = {}
cnt_height_plus_ind = {}
cnt_height_minus_ind = {}
cnt_minus_height_minus_ind = {}

for ind in range(n):
    height = hlist[ind]
    if ind - height not in cnt_ind_minus_height:
        cnt_ind_minus_height[ind - height] = 0
    cnt_ind_minus_height[ind - height] += 1

    if ind + height not in cnt_height_plus_ind:
        cnt_height_plus_ind[ind + height] = 0
    cnt_height_plus_ind[ind + height] += 1

    if height-ind not in cnt_height_minus_ind:
        cnt_height_minus_ind[height-ind] = 0
    cnt_height_minus_ind[height-ind] += 1

    if -ind - height not in cnt_minus_height_minus_ind:
        cnt_minus_height_minus_ind[-height-ind] = 0
    cnt_minus_height_minus_ind[-height-ind] += 1

ans = 0
# Hi - i = - (Hj + j)
for val in cnt_height_minus_ind:
    if val in cnt_minus_height_minus_ind:
        ans += cnt_height_minus_ind[val]*cnt_minus_height_minus_ind[val]

# Hi + i = j - Hj
for val in cnt_height_plus_ind:
    if val in cnt_ind_minus_height:
        ans += cnt_height_plus_ind[val]*cnt_ind_minus_height[val]

# as we double count the pair
print(ans//2)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout
s = input()
n = len(s)
d = dict()

if len(s) <= 3:
    print(0)
    exit()


suffix_rems = [-1]*n
suffix_rems[-1] = int(s[-1])
suffix_rems[-2] = int(s[-2:])
suffix_rems[-3] = int(s[-3:])

rems_d = dict()
# rems_d[0] = [n]
# rems_d[int(s[-1])] = [n-1]
# rems_d[int(s[-2:])] = [n-2]
# rems_d[int(s[-3:])] = [n-3]
rems_d[0] = 1
rems_d[int(s[-1])] = 1
rems_d[int(s[-2:])] = 1
rems_d[int(s[-3:])] = 1


special_keys = set()
for i in range(n-3)[::-1]:
    rem = (10**(n-i-1) * int(s[i]) + suffix_rems[i + 1])%2019

    if rem in rems_d:
        rems_d[rem] += 1
        special_keys.add(rem)

    else:
        rems_d[rem] = 1

    suffix_rems[i] = rem

ans = 0
for key in special_keys:
    t = rems_d[key]
    ans += (t*(t-1))//2


print(ans)

Fixed submission:
from sys import stdin, stdout
s = input()
n = len(s)


if len(s) <= 3:
    print(0)
    exit()

suffix_rems = [-1]*n
suffix_rems[-1] = int(s[-1])
suffix_rems[-2] = int(s[-2:])
suffix_rems[-3] = int(s[-3:])

rems_d = dict()
rems_d[0] = 1
rems_d[int(s[-1])] = 1
rems_d[int(s[-2:])] = 1
rems_d[int(s[-3:])] = 1

special_keys = set()
for i in range(n-3)[::-1]:
    rem = (pow(10, n-i-1, 2019) * int(s[i]) + suffix_rems[i + 1])%2019

    if rem in rems_d:
        rems_d[rem] += 1
        special_keys.add(rem)
    else:
        rems_d[rem] = 1

    suffix_rems[i] = rem

ans = 0
for key in special_keys:
    t = rems_d[key]
    ans += (t*(t-1))//2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
def gcd(a, b, c):
    z = min(a, b, c)
    for i in range(z, 0, -1):
        if a%i==0 and b%i==0 and c%i==0:
            return i

k = int(input())

d = {}

totsum = 0
for i in range(1, k+1):
    for j in range(i, k+1):
        for k in range(j, k+1):
            if i ==j ==k:
                totsum += i
                continue

            elif i==j or i==k or j==k: factor = 3
            else: factor = 6

            if i ==1 or j==1 or k==1: 
                totsum += 1*factor
                continue

            totsum += gcd(i, j, k)*factor

print(totsum)




Fixed submission:
k = int(input())
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += gcd(gcd(a, b), c)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
def gcd(a, b, c):
    z = min(a, b, c)
    for i in range(z, 0, -1):
        if a%i==0 and b%i==0 and c%i==0:
            return i

k = int(input())

d = {}

totsum = 0
for config in list(product(range(1, k+1), range(1, k+1), range(1, k+1))):
    a, b, c = config
    if a==1 or b==1 or c==1: 
        totsum+=1
    elif a==b==c:
        totsum+=a
    else:
        try :
            ans = d[tuple(sorted((a, b, c)))]
        except: 
            ans = gcd(a, b, c)
            d[tuple(sorted((a, b, c)))] = ans

        totsum += ans
# print(d)
print(totsum)

Fixed submission:
k = int(input())
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += gcd(gcd(a, b), c)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
def gcd(a, b, c):
    z = min(a, b, c)
    for i in range(z, 0, -1):
        if a%i==0 and b%i==0 and c%i==0:
            return i

k = int(input())

d = {}

totsum = 0
for config in list(product(range(1, k+1), range(1, k+1), range(1, k+1))):
    a, b, c = config

    if tuple(sorted((a, b, c))) in d:
        ans = d[tuple(sorted((a, b, c)))]
    else: 
        ans = gcd(a, b, c)
        d[tuple(sorted((a, b, c)))] = ans

    totsum += ans

print(totsum)

Fixed submission:
k = int(input())
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += gcd(gcd(a, b), c)
print(ans)
Buggy python submission (verdict: Runtime Error):
d = dict(zip( ['MON', 'TUE', 'WED', 'THUR', 'FRI', 'SAT', 'SUN'], '6543217'))
s = input()
print(d[s])

Fixed submission:
d = dict(zip( ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'], '6543217'))
s = input()
print(d[s])