Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
ans=[]
if n == 1:
    ans="Hello World"
else:
    ans=a+b
print(ans)

Fixed submission:
n=int(input())
s = [int(input()) for i in range((n-1)*2)]
ans=[]
if n == 1:
    ans="Hello World"
else:
    ans=s[0]+s[1]
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
ans=[]
if n == 1:
    ans="Hello World"
else:
    ans=a+b
print(ans)

Fixed submission:
n=int(input())
s = [int(input()) for i in range((n-1)*2)]
ans=[]
if n == 1:
    ans="Hello World"
else:
    ans=s[0]+s[1]
print(ans)
Buggy python submission (verdict: Runtime Error):
 tmp = 10 ** 9 + 7
def div(n,T):
    _ = 1
    for t in range(T):
        _ *= n
        _ %= tmp
    return _
    
N = int(input())
a = div(10,N)
b = div(9,N)
c = div(8,N)

print((a + c - 2 * b) % tmp)


Fixed submission:
n = int(input())
print(1 if not n else 0)
Buggy python submission (verdict: Runtime Error):
 tmp = 10 ** 9 + 7
def div(n,T):
    _ = 1
    for t in range(T):
        _ *= n
        _ %= tmp
    return _
    
N = int(input())
a = div(10,N)
b = div(9,N)
c = div(8,N)

print((a + c - 2 * b) % tmp


Fixed submission:
def div(n,T):
    tmp = 10 ** 9 + 7
    _ = 1
    for t in range( T- 1):
        _ *= n
        _ %= tmp
    return _ * n
    
N = int(input())
a = div(10,N)
b = div(9,N)
c = div(8,N)
print((a + c - b * 2) % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT):
        d = 0
        for lt in range(LT):
            if S[ls + lt] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))

Fixed submission:
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT + 1):
        d = 0
        for lt in range(LT):
            if S[ls + lt] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT):
        d = 0
        for lt in range(LT):
            if S[ls + lt:ls + LT] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))

Fixed submission:
S = input()
T = input()
LS = len(S)
LT = len(T)
L = []

if T in S:
  print(0)
else:
    for ls in range(LS - LT + 1):
        d = 0
        for lt in range(LT):
            if S[ls + lt] != T[lt]:
                d += 1
        L.append(d)
    print(min(L))
Buggy python submission (verdict: Time Limit Exceeded):
D = 10 ** 9 + 7
N = int(input())
L= list(map(int, input().split()))

ans = L[0] * L[1] % D
for n in range(2,N):
  for l in range(n):
    ans += L[n] * L[l] % D

print(ans % D)


Fixed submission:
D = 10 ** 9 + 7
N = int(input())
L= list(map(int, input().split()))

ans = L[0] * L[1] % D
sub = L[0] + L[1]
for n in range(2,N):
    ans += L[n] * sub
    sub += L[n]
    
print(ans % D)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
D = 10 ** 9 + 7
N = int(input())
L= list(map(int, input().split()))
  
ans = 0
C = combinations(L,2)
for c in C:
    ans += c[0] * c[1] % D
print(ans % D)

Fixed submission:
D = 10 ** 9 + 7
N = int(input())
L= list(map(int, input().split()))

ans = L[0] * L[1] % D
sub = L[0] + L[1]
for n in range(2,N):
    ans += L[n] * sub
    sub += L[n]
    
print(ans % D)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
K = int(input())

n = 0
while B <= A:
  B * 2
  i += 1
  
while C <= B:
  C * 2
  i += 1

print('Yes' if i <= K else 'No)

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

i = 0
while B <= A:
  B *= 2
  i += 1
  
while C <= B:
  C *= 2
  i += 1

print('Yes' if i <= K else 'No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(N):
  if (i + 1) % 2 == 1 and L[n] % 2 == 0:
    cnt += 1
    
print(cnt)


Fixed submission:
N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(N):
  if (n + 1) % 2 == 1 and L[n] % 2 == 1:
    cnt += 1
    
print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(n):
  if (i + 1) % 2 == 1 and L[n] % 2 == 0:
    cnt += 1
    
print(cnt)

Fixed submission:
N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(N):
  if (n + 1) % 2 == 1 and L[n] % 2 == 1:
    cnt += 1
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [0] * N
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      n = ((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2)/ 2 
      if n <= N:
        L[n - 1] += 1
print(*L, sep='\n')

Fixed submission:
N = int(input())
L = [0] * N
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      n = int(((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2)/ 2 )
      if n <= N:
        L[n - 1] += 1
print(*L, sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
def triples(N):
  _ = 0
  if N < 2:
    pass
  else:
    limit = (N - 2) ** (1 / 2)
    for x in range(1,int(limit) + 1):
      for y in range(1,int(limit) + 1):
        for z in range(1,int(limit) + 1):
          if (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2 == 2 * N:
            _ += 1
  return _

N = int(input())
for n in range(1,N + 1):
  print(triples(n))

Fixed submission:
N = int(input())
L = [0] * N
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      n = int(((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2)/ 2 )
      if n <= N:
        L[n - 1] += 1
print(*L, sep='\n')
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input())
prices = list(map(int,input().split()))
prices.sort()
print(sum(sumprices[0:M - 1]))

Fixed submission:
N,M = map(int, input().split())
prices = list(map(int,input().split()))
prices.sort()
print(sum(prices[0:M]))
Buggy python submission (verdict: Runtime Error):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
num_2_alpha = {i:alphabet[i - 1] for i in range(1,27)}

def named(N):
  _ = ''
  while N > 0:
    a = N % 26
    N //= 26
    _ += num_2_alpha[a]
  
  return _[-1::-1]

N = int(input())
print(named(N))

Fixed submission:
alpha = [chr(i + 97) for i in range(26)] 
N = int(input())
name = ''
while N >= 1:
  N -= 1
  _ = N % 26
  name += alpha[_]
  N //= 26
  
print(name[-1::-1])

Buggy python submission (verdict: Runtime Error):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
num_2_alpha = {i:alphabet[i - 1] for i in range(1,27)}

def named(N):
  _ = ''
  while N > 0:
    a = N % 26
    N = N // 26
    _ = num_2_alpha[a] + _
  
  return _

N = int(input())
print(named(N))

Fixed submission:
alpha = [chr(i + 97) for i in range(26)] 
N = int(input())
name = ''
while N >= 1:
  N -= 1
  _ = N % 26
  name += alpha[_]
  N //= 26
  
print(name[-1::-1])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
A = input()
C_A = Counter(A.split())
S = 0
for ca in C_A:
  S += int(ca) * C_A[ca]

Q = int(input())
for q in range(Q):
  b, c = input().split()
  A = A.replace(b,c)
  S += (int(c) - int(b)) * C_A[b]
  C_A = Counter(A.split())
  
  print(S)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C_A = Counter(A)
S = 0
for ca in C_A:
  S += ca * C_A[ca]

Q = int(input())
for q in range(Q):
  b, c = map(int,input().split())
  S += (c - b) * C_A[b]
  C_A[c] += C_A[b]
  C_A[b] = 0
  
  print(S)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input()
Q = int(input())
for q in range(Q):
  b, c = input().split()
  A = A.replace(b,c)
  An = list(map(int,A.split()))
  print(sum(An))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C_A = Counter(A)
S = 0
for ca in C_A:
  S += ca * C_A[ca]

Q = int(input())
for q in range(Q):
  b, c = map(int,input().split())
  S += (c - b) * C_A[b]
  C_A[c] += C_A[b]
  C_A[b] = 0
  
  print(S)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()
Q = int(input())
for q in range(Q):
  b, c = input().split()
  A = A.replace(b,c)
  An = list(map(int,A)
  print(sum(An))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C_A = Counter(A)
S = 0
for ca in C_A:
  S += ca * C_A[ca]

Q = int(input())
for q in range(Q):
  b, c = map(int,input().split())
  S += (c - b) * C_A[b]
  C_A[c] += C_A[b]
  C_A[b] = 0
  
  print(S)
Buggy python submission (verdict: Runtime Error):
import math
price = int(input())
tax = 8
price_1 = math.ceil(price / (1 + tax / 100))
price_2 = math.floor(price * tax / 100)
print(price_1 if price == price_1 + price2 else ':(')

Fixed submission:
import math
price = int(input())
tax = 8
price_1 = math.ceil(price / (1 + tax / 100))
price_2 = math.floor(price_1 * tax / 100)
print(price_1 if price == price_1 + price_2 else ':(')
Buggy python submission (verdict: Runtime Error):
kuku = [i * j for i　in range(1,10) for j in range(1,10)]
N = int(input())

print('Yes' if N in kuku else 'No')

Fixed submission:
kuku = [i * j for i in range(1,10) for j in range(1,10)]
N = int(input())
 
print('Yes' if N in kuku else 'No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
cnt = 0
for n in range(1,N　+ 1):
    l = len(str(n))
    if l % 2 == 1:
        cnt += 1

print(cnt)

Fixed submission:
N = int(input())
cnt = 0
for n in range(1,N + 1):
    l = len(str(n))
    if l % 2 == 1:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
contests = [i for i in range(100,1000) if i % 111 == 0]
N = int(input())
for contest in contests:
  if contests >= N:
    print(contest)
    break
  else:
    continue

Fixed submission:
contests = [i for i in range(100,1000) if i % 111 == 0]
N = int(input())
for contest in contests:
  if contest >= N:
    print(contest)
    break
  else:
    continue
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
op =['+','-']
ops = []
for a in op:
  for b in op:
    for c in op:
        ops.append(a + b + c)
        
for op in ops:
  S = "{1}{2}{3}{4}{5}{6}{7}".format(A,op[0],B,op[1],C,op[2],D)
  if eval(S) == 7:
    print("{}=7".format(S))
    break

Fixed submission:
N = input()
N = [int(n) for n in N]
A,B,C,D = N
op =['+','-']
ops = []
for a in op:
  for b in op:
    for c in op:
        ops.append(a + b + c)
        
for op in ops:
  S = "{}{}{}{}{}{}{}".format(A,op[0],B,op[1],C,op[2],D)
  if eval(S) == 7:
    print("{}=7".format(S))
    break
Buggy python submission (verdict: Runtime Error):
N = int(input())
r_N = int(N ** (1 / 2))
 
li = []
for n in range(1,r_N + 1):
  if N % n == 0:
    a = N // n
    l = max(len(str(a)),len(str(n)))
  	li.append(l)
    
print(min(li))

Fixed submission:
N = int(input())
r_N = int(N ** (1 / 2))
 
li = []
for n in range(1,r_N + 1):
  if N % n == 0:
    a = N // n
    l = max(len(str(a)),len(str(n)))
    li.append(l)
    
print(min(li))

Buggy python submission (verdict: Runtime Error):
N = int(input())
r_N = int(N ** (1 / 2))

li = []
for n in range(1,r_N + 1):
  if N % n == 0:
    a = N // n
    l = max(len(str(a)),len(str(n))))
  	li.append(l)
    
print(min(li))

Fixed submission:
N = int(input())
r_N = int(N ** (1 / 2))
 
li = []
for n in range(1,r_N + 1):
  if N % n == 0:
    a = N // n
    l = max(len(str(a)),len(str(n)))
    li.append(l)
    
print(min(li))
Buggy python submission (verdict: Runtime Error):
def solve():
    H,W,M = map(int,input().split())
    h_counter = [0] * H
    w_counter = [0] * W

    opponents = []
    for _ in range(M):
        h, w = map(lambda x:int(x)-1, input().split())
        h_counter[h] += 1
        w_counter[w] += 1
        opponents.append((h,w))
    
    h_max = max(h_counter)
    w_max = max(w_counter)

    h_max_area_cnt = 0
    h_max_area_nums = set()
    for h in range(H):
        if h_counter[h] == h_max:
            h_max_area_nums.add(h)
            h_max_area_cnt += 1

    w_max_area_cnt = 0
    w_max_area_nums = set()
    for w in range(H):
        if w_counter[w] == w_max:
            w_max_area_nums.add(w)
            w_max_area_cnt += 1

    max_area_cnt = h_max_area_cnt * w_max_area_cnt

    opponent_in_max_area = 0
    for h,w in opponents:
        if h in h_max_area_nums and w in w_max_area_nums:
            opponent_in_max_area += 1

    if max_area_cnt > opponent_in_max_area:
        print(h_max + w_max)
    else:
        print(h_max + w_max - 1)

if __name__ == '__main__':
    solve()


Fixed submission:
def solve():
    H,W,M = map(int,input().split())
    h_counter = [0] * H
    w_counter = [0] * W

    opponents = []
    for _ in range(M):
        h, w = map(lambda x:int(x)-1, input().split())
        h_counter[h] += 1
        w_counter[w] += 1
        opponents.append((h,w))
    
    h_max = max(h_counter)
    w_max = max(w_counter)

    h_max_area_cnt = 0
    h_max_area_nums = set()
    for h in range(H):
        if h_counter[h] == h_max:
            h_max_area_nums.add(h)
            h_max_area_cnt += 1

    w_max_area_cnt = 0
    w_max_area_nums = set()
    for w in range(W):
        if w_counter[w] == w_max:
            w_max_area_nums.add(w)
            w_max_area_cnt += 1

    max_area_cnt = h_max_area_cnt * w_max_area_cnt

    opponent_in_max_area = 0
    for h,w in opponents:
        if h in h_max_area_nums and w in w_max_area_nums:
            opponent_in_max_area += 1

    if max_area_cnt > opponent_in_max_area:
        print(h_max + w_max)
    else:
        print(h_max + w_max - 1)

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    K = int(input())
    K_one = K % 10
    cnt = 0

    carry = 0
    carry_one = carry % 10

    while True:
        is_ok = False
        for i in range(0,9+1):
            if (i * K_one + carry_one) % 10 == 7:
                is_ok = True
                cnt += 1
                carry = (K * i + carry) // 10
                carry_one = carry % 10
                break
        
        if not is_ok:
            print(-1)
            return
        
        carry_str = str(carry)
        if carry_str.count('7') == len(carry_str):
            print(len(carry_str) + cnt)
            return
    
if __name__ == '__main__':
    solve()

Fixed submission:
def solve(K):
    K_one = K % 10
    cnt = 0

    carry = 0
    carry_one = carry % 10

    while True:
        is_ok = False
        for i in range(0,9+1):
            if (i * K_one + carry_one) % 10 == 7:
                is_ok = True
                cnt += 1
                carry = (K * i + carry) // 10
                carry_one = carry % 10
                break
        
        if not is_ok:
            print(-1)
            return
        
        if carry == 0:
            print(cnt)
            return

        carry_str = str(carry)
        if carry_str.count('7') == len(carry_str):
            print(len(carry_str) + cnt)
            return
    
if __name__ == '__main__':
    K = int(input())
    solve(K)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    K = int(input())
    K_one = K % 10
    cnt = 0

    carry = 0
    carry_one = carry % 10

    while True:
        is_ok = False
        for i in range(0,9+1):
            if (i * K_one + carry_one) % 10 == 7:
                is_ok = True
                cnt += 1
                carry = (K * i + carry) // 10
                carry_one = carry % 10
                break
        
        if not is_ok:
            print(-1)
            return
        
        carry_str = str(carry)
        if carry_str.count('7') == len(carry_str):
            print(len(carry_str) + cnt)
            return
    
if __name__ == '__main__':
    solve()

Fixed submission:
def solve(K):
    K_one = K % 10
    cnt = 0

    carry = 0
    carry_one = carry % 10

    while True:
        is_ok = False
        for i in range(0,9+1):
            if (i * K_one + carry_one) % 10 == 7:
                is_ok = True
                cnt += 1
                carry = (K * i + carry) // 10
                carry_one = carry % 10
                break
        
        if not is_ok:
            print(-1)
            return
        
        if carry == 0:
            print(cnt)
            return

        carry_str = str(carry)
        if carry_str.count('7') == len(carry_str):
            print(len(carry_str) + cnt)
            return
    
if __name__ == '__main__':
    K = int(input())
    solve(K)
Buggy python submission (verdict: Runtime Error):
from itertools import product
def solve():
    card_org = list(map(int,input().split()))
    K = int(input())
    comb = list(product(range(3), repeat=K))

    for c in comb:
        card = card_org[:]
        for i in range(3):
            card[c[i]] *= 2
        
        if card[1] > card[0] and card[2] > card[1]:
            print('Yes')
            return
    
    print('No')

if __name__ == '__main__':
    solve()

Fixed submission:
from itertools import product
def solve():
    card_org = list(map(int,input().split()))
    K = int(input())
    comb = list(product(range(3), repeat=K))

    for c in comb:
        card = card_org[:]
        if card[1] > card[0] and card[2] > card[1]:
            print('Yes')
            return

        for i in range(K):
            card[c[i]] *= 2
        
            if card[1] > card[0] and card[2] > card[1]:
                print('Yes')
                return
    
    print('No')

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))

    now = 1
    for i in range(K):
        now *= A[i]
    prev = now
    
    for i in range(K,N):
        now //= A[i-K]
        now *= A[i]
        if now > prev:
            print('Yes')
        else:
            print('No')
        prev = now

if __name__ == '__main__':
    solve()

Fixed submission:
def solve():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))
    
    for i in range(K,N):
        if A[i-K] < A[i]:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))

    for k in range(K):
        imos = [0] * (N+1)
        for i in range(N):
            imos[min(N,i+A[i]+1)] -= 1
            imos[max(0,i-A[i])] += 1
        
        A[0] = imos[0]
        for i in range(1,N):
            A[i] = A[i-1] + imos[i]
    
    print(*A)

if __name__ == '__main__':
    solve()

Fixed submission:
def solve():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))

    for k in range(K):
        imos = [0] * (N+1)
        for i in range(N):
            imos[min(N,i+A[i]+1)] -= 1
            imos[max(0,i-A[i])] += 1
        
        A[0] = imos[0]
        all_N = True
        for i in range(1,N):
            A[i] = A[i-1] + imos[i]
            if A[i] != N:
                all_N = False
        
        if all_N:
            break

    print(*A)

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    T = input()
    ans = ""
    for i in range(len(T)):
        if i < len(T) -1 and T[i] + T[i+1] == "?D":
            ans += "P"
        elif T[i] == "?":
            ans += "D"
        else:
            ans += T[i]
    
    print(ans)
            
if __name__ == '__main__':
    solve()

Fixed submission:
def solve():
    T = input()
    ans = ""
    for i in range(len(T)):
        if T[i] == "?":
            ans += "D"
        else:
            ans += T[i]
    
    print(ans)
            
if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
def solve():
    N,M,K = map(int,input().split())
    MOD = 998244353

    fac, finv, inv = COMinit(N,MOD)

    ans = 0
    for i in range(K+1):
        ans += M % MOD * pow(M-1,N-1-i,MOD) % MOD * COM(N-1,i,MOD,fac,finv,inv) % MOD
    
    print(ans%MOD)

# COMの前処理
# テーブルを作る
# O(n)
def COMinit(N, mod):
    fac = [0] * N
    finv = [0] * N
    inv = [0] * N

    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1

    for i in range(2, N):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    
    return fac, finv, inv

# nCrを計算 前処理としてCOMinitの実行が必要
# O(1)
def COM(n, r, mod, fac, finv, inv):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod
if __name__ == '__main__':
    solve()

Fixed submission:
def solve():
    N,M,K = map(int,input().split())
    MOD = 998244353

    fac, finv, inv = COMinit(N+1,MOD)

    ans = 0
    for i in range(K+1):
        ans += M % MOD * pow(M-1,N-1-i,MOD) % MOD * COM(N-1,i,MOD,fac,finv,inv) % MOD
    
    print(ans%MOD)

# COMの前処理
# テーブルを作る
# O(n)
def COMinit(N, mod):
    fac = [0] * N
    finv = [0] * N
    inv = [0] * N

    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1

    for i in range(2, N):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    
    return fac, finv, inv

# nCrを計算 前処理としてCOMinitの実行が必要
# O(1)
def COM(n, r, mod, fac, finv, inv):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod
if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def solve():
    K = int(input())

    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)

if __name__ == '__main__':
    solve()


Fixed submission:
from math import gcd
def solve():
    K = int(input())

    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)

if __name__ == '__main__':
    solve()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
 
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
      ans+=gcd(i,gcd(j,k))
print(ans)

Fixed submission:
from math import gcd
def solve():
    K = int(input())

    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)

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
def solve():
    a,b,c = map(int, input().split())
    if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt()
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    solve()

Fixed submission:
import math
def solve():
    a,b,c = map(int, input().split())
    if 4 * a * b < (c-a-b)**2 and c-a-b>0:
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    solve()