Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce


def factorial(end, start=1):
    return reduce(lambda f, i: f * i, list(range(start, end + 1)), 1)


def combination(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r))


N = int(input())


dp = {}
result = 0

for _ in range(N):
    s = ''.join(sorted(input()))
    if s in dp:
        dp[s] += 1
    else:
        dp[s] = 1

print(reduce(lambda r, key: r + combination(dp[key], 2), dp, 0))


Fixed submission:
from functools import reduce

N = int(input())
dp = {}
result = 0

for _ in range(N):
    s = ''.join(sorted(input()))
    if s in dp:
        dp[s] += 1
    else:
        dp[s] = 1

print(reduce(lambda r, key: r + dp[key] * (dp[key] - 1) // 2, dp, 0))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce


def factorial(end, start=1):
    return reduce(lambda f, i: f * i, list(range(start, end + 1)), 1)


def combination(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r))


N = int(input())
ss = [''.join(sorted(input())) for _ in range(N)]

dp = {}
result = 0

for s in ss:
    if s in dp:
        dp[s] += 1
    else:
        dp[s] = 1

print(reduce(lambda r, key: r + combination(dp[key], 2), dp, 0))


Fixed submission:
from functools import reduce

N = int(input())
dp = {}
result = 0

for _ in range(N):
    s = ''.join(sorted(input()))
    if s in dp:
        dp[s] += 1
    else:
        dp[s] = 1

print(reduce(lambda r, key: r + dp[key] * (dp[key] - 1) // 2, dp, 0))
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

N, M = [int(_) for _ in input().split()]
ABs = [[] for _ in range(M + 1)]
r = 0

for i in range(N):
    A, B = [int(x) for x in input().split()]
    if A <= M:
        ABs[A].append(-B)

for m in range(1, M + 1):
    B_max = -1
    A_max = -1

    heapq.heapify(ABs[m])

    # print("{0}".format(m))

    for a in range(1, m + 1):
        # print("\t{0}".format(a))
        if len(ABs[a]) == 0:
            continue

        b = - ABs[a][0]
        if B_max < b:
            A_max = a
            B_max = b

    if A_max != -1:
        r -= heapq.heappop(ABs[A_max])

print(r)


Fixed submission:
import heapq

N, M = [int(_) for _ in input().split()]
ABs = [[] for _ in range(M + 1)]
r = 0

for i in range(N):
    A, B = [int(x) for x in input().split()]
    if A <= M:
        ABs[A].append(-B)

q = []

for m in range(1, M + 1):
    if ABs[m] != 0:
        for b in ABs[m]:
            heapq.heappush(q, b)

    if len(q) != 0:
        r -= heapq.heappop(q)

print(r)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq

N, M = [int(_) for _ in input().split(' ')]
ABs = {}
r = 0

for i in range(N):
    A, B = [int(x) for x in input().split()]

    if A in ABs:
        heapq.heappush(ABs[A], -B)
    else:
        ABs[A] = [-B]
        heapq.heapify(ABs[A])

for m in range(M, 0, -1):
    B_max = -1
    A_max = -1

    for a in range(m, 0, -1):
        if not (a in ABs) or len(ABs[a]) == 0:
            continue

        b = - ABs[a][0]
        if B_max < b:
            A_max = a
            B_max = b

    if A_max != -1:
        r -= heapq.heappop(ABs[A_max])

print(r)


Fixed submission:
import heapq

N, M = [int(_) for _ in input().split()]
ABs = [[] for _ in range(M + 1)]
r = 0

for i in range(N):
    A, B = [int(x) for x in input().split()]
    if A <= M:
        ABs[A].append(-B)

q = []

for m in range(1, M + 1):
    if ABs[m] != 0:
        for b in ABs[m]:
            heapq.heappush(q, b)

    if len(q) != 0:
        r -= heapq.heappop(q)

print(r)
Buggy python submission (verdict: Time Limit Exceeded):
import math

K = int (input())
sum = 0

for i in range (1, K+1):
    for j in range (1, K+1):
        for k in range (1, K+1):
            sum += math.gcd(i, math.gcd(j,k))

print (sum)

Fixed submission:
import math

t = int (input())
sum = 0

for i in range (1, t+1):
    for j in range (1, t+1):
        aux = math.gcd(i,j)
        for k in range (1, t+1):
            sum += math.gcd(aux, k)

print (sum)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
import math

K = int (input())
sum = 0
for a, b, c in product(range(1,K+1), repeat=3):
    sum += math.gcd(math.gcd(b,c),a)
print (sum)

Fixed submission:
import math

t = int (input())
sum = 0

for i in range (1, t+1):
    for j in range (1, t+1):
        aux = math.gcd(i,j)
        for k in range (1, t+1):
            sum += math.gcd(aux, k)

print (sum)

Buggy python submission (verdict: Time Limit Exceeded):
def find_gcd(x, y): 
    while(y): 
        x, y = y, x % y 
  
    return x 
K = int (input())
sum = 0

for i in range (1, K+1):
    for j in range (1, K+1):
        for k in range (1, K+1):
            sum += find_gcd(i, find_gcd(j,k))

print (sum)

Fixed submission:
import math

t = int (input())
sum = 0

for i in range (1, t+1):
    for j in range (1, t+1):
        aux = math.gcd(i,j)
        for k in range (1, t+1):
            sum += math.gcd(aux, k)

print (sum)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = list(map(int, input().split()))
l = []
for i in range(1,101):
  l.append(i)
L = []
for i in l:
  if i not in p:
    L.append(i)
l = []
for i in L:
  l.append([i, abs(x-i)])
a = min(l, key = lambda t: t[1])
print(list(a)[0])

Fixed submission:
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()

p = list(map(int, input().split()))
l = []
for i in range(-100,102):
  l.append(i)

L = []
for i in l:
  if i not in p:
    L.append(i)

l = []
for i in L:
  l.append([i, abs(x-i)])
a = min(l, key = lambda t: t[1])
print(list(a)[0])
Buggy python submission (verdict: Runtime Error):
s, w = map(int, input().split())
if w > s:
  print('unsafe')
else:
  print('safe;)

Fixed submission:
s, w = map(int, input().split())
if w >= s:
  print('unsafe')
else:
  print('safe')
Buggy python submission (verdict: Runtime Error):
import math
s = int(input())
print(s * 2 * math.pie)

Fixed submission:
import math
s = int(input())
print(s * 2 * math.pi)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
k = int(input())
s = 0
l = []
for i in range(k):
  for j in range(k):
    l.append(gcd(i+1,j+1))
for h in range(k):
  for n in l:
    s += gcd(h+1, n)
print(s)


Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
k = int(input())
s = 0
l = []
for i in range(k):
  for j in range(k):
    l.append(math.gcd(i+1,j+1))
for h in range(k):
  for n in l:
    s += math.gcd(h+1, n)
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
k = int(input())
s = 0
for i in range(k):
  for j in range(k):
    for h in range(k):
      s += gcd(i+1,j+1,h+1)
print(s)


Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
k = int(input())
s = 0
l = []
for i in range(k):
  for j in range(k):
    l.append(math.gcd(i+1,j+1))
for h in range(k):
  for n in l:
    s += math.gcd(h+1, n)
print(s)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
n,k = map(int, input().split())
s = 0
for i in range(k):
  for j in range(k):
    for h in range(k):
      s += gcd(i+1,j+1,h+1)
print(s)


Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
k = int(input())
s = 0
l = []
for i in range(k):
  for j in range(k):
    l.append(math.gcd(i+1,j+1))
for h in range(k):
  for n in l:
    s += math.gcd(h+1, n)
print(s)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
if A ==0:
  print(0)
  exit()
s = ''
while len(s) < N:
  s = s + (A * 'b')
  s = s + (B * 'r')
print(s[:N].count('b'))

Fixed submission:
n, a, b = map(int, input().split())
c = n // (a + b) * a
d = n % (a + b)
if d > a:
  print(c+a)
else:
  print(c+d)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a = list(map(int, input().split()))
for i in a:
  if a % 2=0:
    if a%3=0 or a%5=0:
      print('APPROVED')
      exit()
print('DENIED')

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
for i in a:
  if i % 2==0:
    if i % 3 == 0 or i % 5 ==0:
      continue
    else:
      print('DENIED')
      exit()
      
print('APPROVED')
Buggy python submission (verdict: Runtime Error):
H = input()
A = input()
c = 0
while true:
  H = H - A
  c = c+1
  if H < 0:
    print(c)
    

Fixed submission:
H,A = map(int, input().split())
c = 0
while True:
  H = H - A
  c = c+1
  if H <= 0:
    print(c)
    break
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
if int(a)==int(b):
  print('Yes')
  else:
    print('No')

Fixed submission:
a=input().split()
if int(a[0]) == int(a[1]):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
a==b?print('Yes'):print('No')

Fixed submission:
a=input().split()
if int(a[0]) == int(a[1]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
print(input(), type(input()))

Fixed submission:
b,c = map(int, input().split())
if 500 * b >= c:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
b, c = map(str, input().split())
print(c.count('ABC'))

Fixed submission:
a = input()
b = input()
print(b.count('ABC'))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int , input().split())

#もし高橋君がクッキーを 1 枚以上持っているなら、高橋君のクッキーを 1 枚食べる。
#そうでなく、もし青木君がクッキーを 1 枚以上持っているなら、青木君のクッキーを 1 枚食べる。
#高橋君も青木君もクッキーを持っていないなら、何もしない。

for _ in range(k):
  if a >= 1:
  	a = a - 1
  elif a == 0 and b >= 1:
    b = b - 1

print(a, b)

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

#もし高橋君がクッキーを 1 枚以上持っているなら、高橋君のクッキーを 1 枚食べる。
#そうでなく、もし青木君がクッキーを 1 枚以上持っているなら、青木君のクッキーを 1 枚食べる。
#高橋君も青木君もクッキーを持っていないなら、何もしない。

if k <= a:
  print(a-k, b)
elif a < k and k <= (a + b):
  print(0, a+b-k)
elif (a + b) < k:
  print(0, 0)
Buggy python submission (verdict: Runtime Error):
l = ['Sunny', 'Cloudy', 'Rainy', 'Sunny']
s = input()
flg = Flase
for i in l:
  if flg == True:
    print(i)
    exit()
  if s == i:
    flg = True


Fixed submission:
l = ['Sunny', 'Cloudy', 'Rainy', 'Sunny']
s = input()
flg = False
for i in l:
  if flg == True:
    print(i)
    exit()
  if s == i:
    flg = True
Buggy python submission (verdict: Runtime Error):
t = 'LRUD'
s = input()
for i in range(len(s)):
  if i % 2 == 1 and s[i] == 'L':
    print('No')
    exit()
  if i % 2 == 0 and s[i] == 'R':
    print('No')
	exit()
print('Yes')

Fixed submission:
t = 'LRUD'
s = input()
for i in range(len(s)):
  if (i+1) % 2 == 1 and s[i] == 'L':
    print('No')
    exit()
  if (i+1) % 2 == 0 and s[i] == 'R':
    print('No')
    exit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
x = 0
outlet = 1
while outlet < b:
  --outlet
  outlet += a
  x+=1
print(x)

Fixed submission:
a, b = map(int, input().split())
x = 0
outlet = 1
while outlet < b:
  outlet -= 1
  outlet += a
  x+=1
print(x)
Buggy python submission (verdict: Runtime Error):
a, b =map(int, input())
l=[
  a+b,
  a-b,
  a*b
]
print(max(l))

Fixed submission:
a, b =map(int, input().split())
l=[
  a+b,
  a-b,
  a*b
]
print(max(l))
Buggy python submission (verdict: Runtime Error):
X, N= map(int,input().split())
P = map(int, input().split())

P_sub_abs = [abs(i - X) for i in P]
if(P_sub_abs.count(0) == 0):
    print(X)
    exit()
for i in range(1, 100):
    if(P_sub_abs.count(i) == 1):
        list = [X - i, X + i]
        list.remove(P[P_sub_abs.index(i)])
        print(list[0])
        exit()
    elif(P_sub_abs.count(i) == 0):
        print(X - i)
        exit()


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

P_sub_abs = [abs(i - X) for i in P]
if(P_sub_abs.count(0) == 0):
    print(X)
    exit()
for i in range(1, 100):
    if(P_sub_abs.count(i) == 1):
        list = [X - i, X + i]
        list.remove(P[P_sub_abs.index(i)])
        print(list[0])
        exit()
    elif(P_sub_abs.count(i) == 0):
        print(X - i)
        exit()
Buggy python submission (verdict: Runtime Error):
a, b, h, m = [int(x) for x in input().split()]

#a, b, h, m = 3, 4, 11, 0

h_dig = 360 * (float(h) / 12) + 30 * (float(m) / 60)
m_dig = 360 * (float(m) / 60)

#print(str(h_dig) + " " +  str(m_dig))

abs_dig = abs(h_dig - m_dig)
if(abs_dig > 180):
    abs_dig = 360 - abs_dig

#print(abs_dig)

c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(abs_dig / 360 * 2 * math.pi))

print('{:.09f}'.format(c))

Fixed submission:
import math

a, b, h, m = [int(x) for x in input().split()]

#a, b, h, m = 3, 4, 11, 0

h_dig = 360 * (float(h) / 12) + 30 * (float(m) / 60)
m_dig = 360 * (float(m) / 60)

#print(str(h_dig) + " " +  str(m_dig))

abs_dig = abs(h_dig - m_dig)
if(abs_dig > 180):
    abs_dig = 360 - abs_dig

#print(abs_dig)

c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(abs_dig / 360 * 2 * math.pi))

print('{:.09f}'.format(c))
Buggy python submission (verdict: Runtime Error):
N = str(input())
enc = 0

for char in list(N):
  if char == "7":
    enc +=1
    
if enc >= 1:
  return "Yes"
else:
  return "No"

Fixed submission:
N = str(input())
enc = 0

for char in list(N):
  if char == "7":
    enc += 1
    
if enc >= 1:
  print("Yes") 
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = str(input())
enc = 0

for char in list(N):
  	if char == 7:
    	enc +=1

if enc >= 1:
  return Yes
else:
   return No

Fixed submission:
N = str(input())
enc = 0

for char in list(N):
  if char == "7":
    enc += 1
    
if enc >= 1:
  print("Yes") 
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
int a,b,c
if a+b+c >= 22:
  print bust
else:
  print win

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

if (a+b+c >= 22):
    print("bust")
else:
    print("win")

Buggy python submission (verdict: Runtime Error):
if(a+b+c >=22):
    print bust
else:
    print win

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

if (a+b+c >= 22):
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
s = int(input())
f = input()
a = "ABCDEFGHIJKLNMOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)


Fixed submission:
s = input()
dic = {'SUN':7,
       'MON':6,
       'TUE':5,
       'WED':4,
       'THU':3,
       'FRI':2,
       'SAT':1}

print(dic[s])

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

print(s**2)

Fixed submission:
s = input()
dic = {'SUN':7,
       'MON':6,
       'TUE':5,
       'WED':4,
       'THU':3,
       'FRI':2,
       'SAT':1}

print(dic[s])

Buggy python submission (verdict: Runtime Error):
s = input()
dic = {SUN : 7,
       MON :6,
       TUE:5,
       WED:4,
       THU:3,
       FRI:2,
       SAT:1}

print(dic[s])

Fixed submission:
s = input()
dic = {'SUN':7,
       'MON':6,
       'TUE':5,
       'WED':4,
       'THU':3,
       'FRI':2,
       'SAT':1}

print(dic[s])

Buggy python submission (verdict: Runtime Error):
s = input()
dic = {'SUN':7,
       'MON':6,
       'TUE':5,
       'WED':4,
       'THU':3,
       'FRI':2,
       'SAT':1
      }

print(s[dic])

Fixed submission:
s = input()
dic = {'SUN':7,
       'MON':6,
       'TUE':5,
       'WED':4,
       'THU':3,
       'FRI':2,
       'SAT':1}

print(dic[s])
Buggy python submission (verdict: Runtime Error):
s = int(input())
f = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)

Fixed submission:
s = int(input())
f = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)

Buggy python submission (verdict: Runtime Error):
s = int(input())
f = input()
a = "ABCDEFGHIJKLNMOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)


Fixed submission:
s = int(input())
f = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

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

sum = 0

for i in range(n):
    for j in range(n):
        if i != j:
            sum += d[i] * d[J]

sum = sum // 2

print(sum)

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

sum = 0

for i in range(n):
    for j in range(n):
        if i != j:
            sum += d[i] * d[j]

sum = sum // 2

print(sum)
Buggy python submission (verdict: Runtime Error):
a =int(input())
b = int(input())


if a+b >=  a-b and a+b >= a*b:
    print(a+b)

elif a-b >= a+b and a-b >= a*b:
    print(a-b)

elif a*b >= a+b and a*b >= a-b:
    print(a*b)

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

if a+b >=  a-b and a+b >= a*b:
    print(a+b)

elif a-b >= a+b and a-b >= a*b:
    print(a-b)

elif a*b >= a+b and a*b >= a-b:
    print(a*b)
Buggy python submission (verdict: Runtime Error):
a = list(input())
a.sort()

if n[0] == n[1] and a[2]==a[3] and a[0]!=a[2]:
    print("Yes")

else:
    print("No")



Fixed submission:
a = list(input())
a.sort()

if a[0] == a[1] and a[2]==a[3] and a[0]!=a[2]:
    print("Yes")

else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a = list(input())
a.sort()

if n[0] == n[1] and a[2]==a[3] and a[0]!==a[2]:
    print("Yes")

else:
    print("No")

Fixed submission:
a = list(input())
a.sort()

if a[0] == a[1] and a[2]==a[3] and a[0]!=a[2]:
    print("Yes")

else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b = map(int input().split())

if a < b:
    print(0)

else:
    print(10)

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

if a < b:
    print(0)

else:
    print(10)
Buggy python submission (verdict: Runtime Error):
p,q,r = map(int,input().split())

if p+q >= p+r or p+q >= q+r:
    print(p+q)

elif q+r >= p+q and q+r >= p+r:
    print(q+r)

elif p+r >= p+q and p+e >= q+r:
    print(p+r)

Fixed submission:
p,q,r = map(int,input().split())

if p+q <= p+r and p+q <= q+r:
    print(p+q)

elif q+r <= p+q and q+r <= p+r:
    print(q+r)

elif p+r <= p+q and p+r <= q+r:
    print(p+r)
Buggy python submission (verdict: Runtime Error):
D = int(input())
if D == 22:
    print("Christmas Eve Eve Eve")
if D == 23:
    print("Christmas Eve Eve")
if D == 24:
    prtin("Christmas Eve")
if D == 25:
    print("Christmas")

Fixed submission:
D = int(input())
if D == 22:
    print("Christmas Eve Eve Eve")
if D == 23:
    print("Christmas Eve Eve")
if D == 24:
    print("Christmas Eve")
if D == 25:
    print("Christmas")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())

if N == 1:
    print("Hello World")
else:
    print(A+B)

Fixed submission:
N = int(input())

if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
light_power = list(map(int,input().split()))

max_power = [n for i in range(n)]
init_light = [0 for i in range(n)]
if k>50:
  k=42
for i in range(k):
  number_light = init_light
  for j,_power in enumerate(light_power):
    if _power == 0:
      number_light[j] += 1
    else:
      number_light = list(map(sum, zip(number_light, [1 if i>=(j+1-_power-0.5) and (j+1+_power+0.5)>=i else 0 for i in range(1,n+1)])))
  light_power = number_light
  if light_power == max_power:
    break
print(*light_power)

Fixed submission:
s = input()
print(s[:3])
Buggy python submission (verdict: Runtime Error):
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
first_distance = abs(b-a)
speed = v-w
t_position = first_distance - speed*t
if t_position <= 0:
  print("YES")
else:a
  print("NO")

Fixed submission:
a,v = map(float,input().split())
b,w = map(float,input().split())
t = float(input())
first_distance = abs(b-a)
speed = v-w
t_position = first_distance - speed*t
if t_position <= 0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
from collections import Counter

def prime_factor(num):
  factor_list = []
  while num % 2 == 0:
    factor_list.append(2)
    num /= 2
  f = 3
  while f * f <= num:
    if num % f == 0:
      factor_list.append(f)
      num /= f
    else:
      f += 2
  if num!=1:
    factor_list.append(num)
  return factor_list

def get_count(c):
  ans = 0
  _max = c
  for i in range(1,c+1):
    if i <= _max:
      ans += 1
      _max -= i
    else:
      break
  return ans
a = int(input())
counter = Counter(prime_factor(a))
ans = 0
for i in counter:
  ans += get_count(counter[i])
print(ans)

Fixed submission:
a,b = map(int,input().split())
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
from functools import reduce

def gcd3(*numbers):
    return reduce(gcd, numbers)

def main():
  K = int(input())

  ans = 0

  for i in range(K):
    for j in range(K):
      for k in range(K):
        ans += gcd3(i+1,j+1,k+1)

  print(ans)



if __name__ == "__main__":
  main()

Fixed submission:
def gcd(a, b):
  if a%b == 0:
    return(b)
  else:
    return(gcd(b, a%b))

def gcd3(a,b,c):
  d = gcd(a,b)
  ans = gcd(d,c)
  return ans

def main():
  K = int(input())

  ans = 0

  for i in range(K):
    for j in range(K):
      for k in range(K):
        ans += gcd3(i+1,j+1,k+1)

  print(ans)

if __name__ == "__main__":
  main()
Buggy python submission (verdict: Runtime Error):
from math import sqrt
from decimal import *

def main():
  A,B,C =   map(int, input().split())

  getcontext().prec = 20
  
  a = int(Decimal(A).sqrt())
  b = int(Decimal(B).sqrt())
  c = int(Decimal(C).sqrt())

  if a + b < c:
    print('Yes')
  else:
    print('No')

if __name__ == "__main__":
  main()

Fixed submission:
def main():
  l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
  K = int(input())

  print(l[K-1])

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


def main():
    K = int(input())

    print(l[K])

if __name__ == "__main__":
    main()

Fixed submission:
def main():
  l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
  K = int(input())

  print(l[K-1])

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K = int(input())

print(l[K])

Fixed submission:
def main():
  l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
  K = int(input())

  print(l[K-1])

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N, B, R = map(int, input().split())

Line = ''

Appended_line = ''
for i in range(B):
  Appended_line += 'b'
for i in range(R):
  Appended_line += 'r'

while(N > len(Line)):
  Line += Appended_line

ans = Line[:N].count('b')

print(ans)

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

ans = (N // (B+R)) * B
rest = N % (B+R)

if rest <= B:
  print(ans+rest)
else:
  print(ans+B)

Buggy python submission (verdict: Time Limit Exceeded):
N, B, R = map(int, input().split())

Line = ''

while(N > len(Line)):
  for i in range(B):
    Line += 'b'
  for i in range(R):
    Line += 'r'

ans = Line[:N].count('b')

print(ans)

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

ans = (N // (B+R)) * B
rest = N % (B+R)

if rest <= B:
  print(ans+rest)
else:
  print(ans+B)