Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M = [int(s) for s in input().split(' ')]
As = [int(s) for s in input().split(' ')]
CBs = []
for m in range(M):
    B, C = [int(s) for s in input().split(' ')]
    CBs.append((C, B))
As.sort(reverse=True)
CBs.sort(reverse=True)
ret = 0
a = 0
bc = 0
n = 0
while n < N:
    C, B = CBs[bc]
    if As[a] < C:
        bc += 1
        pick = min(N - n, B)
        ret += pick * C
        n += pick
    else:
        ret += As[a]
        a += 1
        n += 1
print(ret)




Fixed submission:
N, M = [int(s) for s in input().split(' ')]
As = [int(s) for s in input().split(' ')]
CBs = []
for m in range(M):
    B, C = [int(s) for s in input().split(' ')]
    CBs.append((C, B))
As.sort(reverse=True)
CBs.sort(reverse=True)
CBs.append((0, 0))
ret = 0
a = 0
bc = 0
n = 0
while n < N:
    C, B = CBs[bc]
    if As[a] < C:
        bc += 1
        pick = min(N - n, B)
        ret += pick * C
        n += pick
    else:
        ret += As[a]
        a += 1
        n += 1
print(ret)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(s) for s in input().split(' ')]
As = [int(s) for s in input().split(' ')]
for m in range(M):
    B, C = [int(s) for s in input().split(' ')]
    As += [C] * B
As.sort()
print(sum(As[-N:]))



Fixed submission:
N, M = [int(s) for s in input().split(' ')]
As = [int(s) for s in input().split(' ')]
CBs = []
for m in range(M):
    B, C = [int(s) for s in input().split(' ')]
    CBs.append((C, B))
As.sort(reverse=True)
CBs.sort(reverse=True)
CBs.append((0, 0))
ret = 0
a = 0
bc = 0
n = 0
while n < N:
    C, B = CBs[bc]
    if As[a] < C:
        bc += 1
        pick = min(N - n, B)
        ret += pick * C
        n += pick
    else:
        ret += As[a]
        a += 1
        n += 1
print(ret)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(s) for s in input().split(' ')]
As = [int(s) for s in input().split(' ')]
As.sort()
for m in range(M):
    B, C = [int(s) for s in input().split(' ')]
    for b in range(B):
        As[b] = max(As[b], C)
    As.sort()
print(sum(As))



Fixed submission:
N, M = [int(s) for s in input().split(' ')]
As = [int(s) for s in input().split(' ')]
CBs = []
for m in range(M):
    B, C = [int(s) for s in input().split(' ')]
    CBs.append((C, B))
As.sort(reverse=True)
CBs.sort(reverse=True)
CBs.append((0, 0))
ret = 0
a = 0
bc = 0
n = 0
while n < N:
    C, B = CBs[bc]
    if As[a] < C:
        bc += 1
        pick = min(N - n, B)
        ret += pick * C
        n += pick
    else:
        ret += As[a]
        a += 1
        n += 1
print(ret)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
s = input()
l = [0] * (k * 2 + 1)
c = '1'
p = 0
ret = 0
for i in range(len(s)):
    if s[i] != c:
        ret = max(ret, i - l[p])
        l.append(i)
        if c == '1':
            l = l[2:]
        c = s[i]
ret = max(ret, n - l[p])
print(ret)


Fixed submission:
N, K = [int(s) for s in input().split(' ')]
S = input()
ss = []
ssc = []
subs = S[0]
for s in S[1:]:
    if subs[-1] != s:
        ss.append(subs)
        ssc.append(len(subs))
        subs = s
        continue
    subs += s
ss.append(subs)
ssc.append(len(subs))
suma = [0]
for sc in ssc:
    suma.append(suma[-1] + sc)

#print(ss)
max_c = 0
for i in range(len(ss)):
    k = (K * 2 + 1) if ss[i][0] == '1' else (K * 2)
    l = i
    r = min(i + k, len(ss))
    c = suma[r] - suma[l]
    max_c = max(max_c, c)

print(max_c)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import groupby
N, K = [int(s) for s in input().split(' ')]
S = input()
ss = []
subs = S[0]
for s in S[1:]:
    if subs[-1] != s:
        ss.append(subs)
        subs = s
        continue
    subs += s
ss.append(subs)
ssc = [len(s) for s in ss]
#print(ss)
max_c = 0
for i in range(len(ss)):
    k = (K * 2 + 1) if ss[i][0] == '1' else (K * 2)
    l = i
    r = min(i + k, len(ss))
    c = sum(ssc[l:r])
    max_c = max(max_c, c)

print(max_c)


Fixed submission:
N, K = [int(s) for s in input().split(' ')]
S = input()
ss = []
ssc = []
subs = S[0]
for s in S[1:]:
    if subs[-1] != s:
        ss.append(subs)
        ssc.append(len(subs))
        subs = s
        continue
    subs += s
ss.append(subs)
ssc.append(len(subs))
suma = [0]
for sc in ssc:
    suma.append(suma[-1] + sc)

#print(ss)
max_c = 0
for i in range(len(ss)):
    k = (K * 2 + 1) if ss[i][0] == '1' else (K * 2)
    l = i
    r = min(i + k, len(ss))
    c = suma[r] - suma[l]
    max_c = max(max_c, c)

print(max_c)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import groupby
N, K = [int(s) for s in input().split(' ')]
S = input()
ss = []
subs = S[0]
for s in S[1:]:
    if subs[-1] != s:
        ss.append(subs)
        subs = s
        continue
    subs += s
ss.append(subs)
#print(ss)
max_c = 0
for i in range(len(ss)):
    k = (K * 2 + 1) if ss[i][0] == '1' else (K * 2)
    l = i
    r = min(i + k, len(ss))
    c = sum([len(s) for s in ss[l:r]])
    max_c = max(max_c, c)

print(max_c)


Fixed submission:
N, K = [int(s) for s in input().split(' ')]
S = input()
ss = []
ssc = []
subs = S[0]
for s in S[1:]:
    if subs[-1] != s:
        ss.append(subs)
        ssc.append(len(subs))
        subs = s
        continue
    subs += s
ss.append(subs)
ssc.append(len(subs))
suma = [0]
for sc in ssc:
    suma.append(suma[-1] + sc)

#print(ss)
max_c = 0
for i in range(len(ss)):
    k = (K * 2 + 1) if ss[i][0] == '1' else (K * 2)
    l = i
    r = min(i + k, len(ss))
    c = suma[r] - suma[l]
    max_c = max(max_c, c)

print(max_c)
Buggy python submission (verdict: Runtime Error):
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = min(m % 10 for m in [a,b,c,d,e] if m % 10 != 0)
time = 10 * (math.ceil(a / 10) + math.ceil(b / 10)+ math.ceil(c / 10)+ math.ceil(d / 10)+ math.ceil(e / 10)) - (10 - sub)
print(int(time))



Fixed submission:
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = min([m % 10 for m in [a,b,c,d,e] if m % 10 != 0] + [10])
time = 10 * (math.ceil(a / 10) + math.ceil(b / 10)+ math.ceil(c / 10)+ math.ceil(d / 10)+ math.ceil(e / 10)) - (10 - sub)
print(int(time))

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

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = miin(m % 10 for m in [a,b,c,d,e] if m % 10 != 0)
time = 10 * (ceil(a / 10) + ceil(b / 10)+ ceil(c / 10)+ ceil(d / 10)+ ceil(e / 10)) - (10 - sub)
print(int(time))



Fixed submission:
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = min([m % 10 for m in [a,b,c,d,e] if m % 10 != 0] + [10])
time = 10 * (math.ceil(a / 10) + math.ceil(b / 10)+ math.ceil(c / 10)+ math.ceil(d / 10)+ math.ceil(e / 10)) - (10 - sub)
print(int(time))

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

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = miin(m % 10 for m in [a,b,c,d,e] if m % 10 != 0)
time = 10 * (ciel(a / 10) + ciel(b / 10)+ ciel(c / 10)+ ciel(d / 10)+ ciel(e / 10)) - (10 - sub)
print(time)



Fixed submission:
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = min([m % 10 for m in [a,b,c,d,e] if m % 10 != 0] + [10])
time = 10 * (math.ceil(a / 10) + math.ceil(b / 10)+ math.ceil(c / 10)+ math.ceil(d / 10)+ math.ceil(e / 10)) - (10 - sub)
print(int(time))

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = miin(m % 10 for m in [a,b,c,d,e] if m % 10 != 0)
time = 10 * (ciel(a / 10) + ciel(b / 10)+ ciel(b / 10)+ ciel(b / 10)+ ciel(b / 10)) - (10 - sub)
print(time)



Fixed submission:
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
sub = min([m % 10 for m in [a,b,c,d,e] if m % 10 != 0] + [10])
time = 10 * (math.ceil(a / 10) + math.ceil(b / 10)+ math.ceil(c / 10)+ math.ceil(d / 10)+ math.ceil(e / 10)) - (10 - sub)
print(int(time))
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = [int(s) for s in input().split(' ')]

S = input()
d = [0] * (len(S) + 1)
for i in range(1, len(S) + 1):
    l, r = 1, i
    s = S[l - 1:r]
    d[r] = len(('x' + s + 'x').split('AC')) - 1

for q in range(Q):
    l, r = [int(s) for s in input().split(' ')]
    dl = d[l]
    dr = d[r]
    print(dr - dl)


Fixed submission:
N, Q = [int(s) for s in input().split(' ')]

S = input()
a = [0] * (len(S) + 1)
c = [0] * (len(S) + 1)
ac = [0] * (len(S) + 1)
for i in range(1, len(S) + 1):
    ac[i] = ac[i - 1]
    s = S[i - 1]
    if s == 'A':
        a[i] = 1
    if s == 'C':
        c[i] = 1
        if i > 1 and a[i - 1] == 1:
            ac[i] += 1
    
for q in range(Q):
    l, r = [int(s) for s in input().split(' ')]
    dl = ac[l]
    dr = ac[r]
    print(dr - dl)
Buggy python submission (verdict: Runtime Error):
Ns = input()
N = int(Ns)
Nl = len(Ns)
ret = 0
def doit(t, f , s, now):
    if t + f + s == 0:
        if int(now) <= N:
            ret += 1
        return
    if t > 0:
        doit(t - 1, f, s, now + str(3)) 
    if f > 0:
        doit(t, f - 1, s, now + str(5)) 
    if s > 0:
        doit(t, f, s - 1, now + str(7)) 
    
for seven in range(1, Nl - 1):
    for five in range(1, Nl - seven):
        least = Nl - seven - five
        for three in range(1, least + 1):
            doit(three, five, seven, '')

print(ret)


Fixed submission:
Ns = input()
N = int(Ns)
Nl = len(Ns)
ret = set()
def doit(t, f , s, now):
    if t + f + s == 0:
        if int(now) <= N:
            ret.add(now)
        return
    if t > 0:
        doit(t - 1, f, s, now + str(3)) 
    if f > 0:
        doit(t, f - 1, s, now + str(5)) 
    if s > 0:
        doit(t, f, s - 1, now + str(7)) 
    
for seven in range(1, Nl - 1):
    for five in range(1, Nl - seven):
        least = Nl - seven - five
        for three in range(1, least + 1):
            doit(three, five, seven, '')

print(len(ret))
Buggy python submission (verdict: Runtime Error):
line = raw_input()
N, X = [int(s) for s in line.split(' ')]
line = raw_input()
xs = [int(s) for s in line.split(' ')]

xs = [x - X for x in xs]
X = 0
if len(xs) == 1:
    print abs(xs[0])
else:
    sub = [a - b for a, b in zip(xs[1:], xs)]
    abs_sub = [abs(s) for s in sub]
    max_s = max(abs_sub)
    min_s = min(abs_sub)
    ret = 1
    for i in range(2, min_s + 1):
        if max_s % i == 0 and min_s % i == 0: 
            ret = i
    print ret


Fixed submission:
line = raw_input()
N, X = [int(s) for s in line.split(' ')]
line = raw_input()
xs = [int(s) for s in line.split(' ')]
xs.append(X)
#xs = [x - X for x in xs]
xs.sort()
X = 0
if len(xs) == 1:
    print abs(xs[0])
else:
    sub = [abs(a - b) for a, b in zip(xs[1:], xs)]
    sub.sort()
    ret = sub[0]
    for s in sub[1:]:
        mod = 1
        ss = ret
        while mod > 0:
            mod = s % ss
            s = ss
            ss = mod
        ret = s
    print ret
Buggy python submission (verdict: Runtime Error):
line = raw_input()
N, K = [int(s) for s in line.split(' ')]
line = raw_input()
Xs = [int(s) for s in line.split(' ')]
pXs = [x for x in Xs if x > 0]
mXs = [x * -1 for x in Xs if x < 0 ]
mXs.reverse()
count = 0
time = 0
ret = []
if 0 in Xs:
    time = 0
    count = 1
    if K == 1:
        ret.append(0)
if len(pXs) > K - count:
    ret.append(pXs[K-count - 1])
if len(mXs) > K - count:
    ret.append(mXs[K-count - 1])
for n in range(0, len(pXs)):
    m = (K - count) - (n + 1) - 1
    print n, m
    if m >= len(mXs) or m < 0:
        continue
    ret.append(pXs[n] * 2 + mXs[m])
    ret.append(pXs[n] + mXs[m] * 2)
# print pXs
# print mXs
# print ret
print min(ret)


Fixed submission:
line = raw_input()
N, K = [int(s) for s in line.split(' ')]
line = raw_input()
Xs = [int(s) for s in line.split(' ')]

ret = []
for i in range(0, len(Xs) - K + 1):
    p = Xs[i + K - 1]
    m = Xs[i]
    if p * m == 0:
        ret.append(abs(p) * abs(m))
        continue
    if p * m > 0:
        ret.append(max(abs(p), abs(m)))
        continue
    ret.append(abs(p) * 2 + abs(m))
    ret.append(abs(p) + abs(m) * 2)

print min(ret)
Buggy python submission (verdict: Runtime Error):
from math import gcd

line = input()
n = int(line)
ret = 2 * n // gcd(2, n)
print(ret)

Fixed submission:
import fractions

line = raw_input()
n = int(line)
ret = 2 * n / fractions.gcd(2, n)
print ret
Buggy python submission (verdict: Runtime Error):
input()
ms=[int(i) for i in input().split()]
c=0
for m in ms:
 if m<=c:
  c=m
  d+=1
print(d)

Fixed submission:
input()
ms=[int(i) for i in input().split()]
c=d=0
for m in ms:
 if c<=m:
  c=m
  d+=1
print(d)

Buggy python submission (verdict: Runtime Error):
input()
ms=[int(i) for i in input().split()]
c=0
=0
for m in ms:
 if m<=c:
  c=m
  d+=1
print(d)

Fixed submission:
input()
ms=[int(i) for i in input().split()]
c=d=0
for m in ms:
 if c<=m:
  c=m
  d+=1
print(d)

Buggy python submission (verdict: Runtime Error):
    input()
    ms=[int(i) for i in input().split()]
    c=0
    d=0
    for m in ms:
      if m<=c:
        c=m
        d+=1
    print(d)

Fixed submission:
input()
ms=[int(i) for i in input().split()]
c=d=0
for m in ms:
 if c<=m:
  c=m
  d+=1
print(d)

Buggy python submission (verdict: Runtime Error):
input()
ms=input().split()
c=0
d=0
for m in ms:
  if m<=c:
    c=m
    d+=1
print(d)

Fixed submission:
input()
ms=[int(i) for i in input().split()]
c=d=0
for m in ms:
 if c<=m:
  c=m
  d+=1
print(d)
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = [int(x) for x in input().split()]

def countTwoInFactor(n):
   def countTwoInFactori(n, acc):
      return countTwoInFactori(n / 2, acc + 1) if n % 2 == 0 else acc
   return countTwoInFactori(n, 0)

arr2 = [countTwoInFactor(x) for x in arr]
arr2.sort()
print(arr2[0])


Fixed submission:
def count(lst, x):
   ctr = 0
   for i in lst:
      if i == x:
         ctr += 1
   return ctr

s = [x for x in input()]
print(count(s, "1"))

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

n = int(input())
arr = [int(x) for x in input().split()]

isAllEven = len([x for x in arr if x % 2 == 0]) == n

if not isAllEven:
   print(0)
   exit()

arr.sort()
print(math.log2(arr[0]))


Fixed submission:
def count(lst, x):
   ctr = 0
   for i in lst:
      if i == x:
         ctr += 1
   return ctr

s = [x for x in input()]
print(count(s, "1"))

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

n = int(input())
arr = [int(x) for x in input().split()]

count = 0
max_even = 0
for x in arr:
   if x % == 2 and x > max_even:
      max_even = x 

print(math.log2(max_even))


Fixed submission:
def count(lst, x):
   ctr = 0
   for i in lst:
      if i == x:
         ctr += 1
   return ctr

s = [x for x in input()]
print(count(s, "1"))
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
arr = [int(x) for x in input().split()]

count = 0
max_even = 0
for x in arr:
   if x % == 2 and x > max_even:
      max_even = x 

print(math.log2(max_even))


Fixed submission:
n = int(input())
arr = [int(x) for x in input().split()]

def countTwoInFactor(n):
   def countTwoInFactori(n, acc):
      return countTwoInFactori(n / 2, acc + 1) if n % 2 == 0 else acc
   return countTwoInFactori(n, 0)

arr2 = [countTwoInFactor(x) for x in arr]
arr2.sort()
print(arr2[0])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = list(map(int, input().split()))

duplicate_list = [x for x in set(An) if An.count(x) > 1]

if duplicate_list:
    print('NO')
else:
    print('YES')

Fixed submission:
N = int(input())
An = list(map(int, input().split()))
Bn = sorted(An)

y = -1
count = 0
for x in Bn:
    if x == y:
        count += 1
    y = x

if count == 0:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
N = int(input())
An = list(map(int, input().split()))

duplicate_list = [x for x in set(An) if An.count(x) > 1]

if duplicate_list:
    print('NO')
else:
    print('YES'

Fixed submission:
N = int(input())
An = list(map(int, input().split()))
Bn = sorted(An)

y = -1
count = 0
for x in Bn:
    if x == y:
        count += 1
    y = x

if count == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
NK = list(map(int, input().split()))
Hi = list(map(int, input().split()))

N = NK[0]
K = NK[1]
Hi.sort()
reversed_Hi = list(reversed(Hi))

for i in range(K):
    if not reversed_Hi:
        break

    if K == 0:
        break
    else:
        K -= 1
        reversed_Hi.pop(0)

count = 0
for i in reversed_Hi:
    count += i

print(count)

Fixed submission:
NK = list(map(int, input().split()))
Hi = list(map(int, input().split()))

N = NK[0]
K = NK[1]
Hi.sort()
reversed_Hi = list(reversed(Hi))

for i in range(len(reversed_Hi)):
    if not reversed_Hi:
        break

    if K == 0:
        break
    else:
        K -= 1
        reversed_Hi[i] = 0

count = 0
for i in reversed_Hi:
    count += i

print(count)
Buggy python submission (verdict: Runtime Error):
def m_d(n):
  return int(len(str(n)))
def m_N(A,B,n):
  return int((A * n) + (B * m_d(n)))
A,B,X = map(int,input().split())
l = 0
m = 10**9+1
while m-l>1:
  n=(l+m)//2
  if m_N(A,B,n)<=X:
    l=n
  else:
    m=n
print(l)

Fixed submission:
days = ['SUN','MON','TUE','WED','THU','FRI','SAT']

S = input()

print(7 - days.index(S))
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())

l = []

greatest = a

if(b > a):
  greatest = b
  
for i in range(1, greatest):
  if(a % i == 0 and b % i == 0):
    l.append(i)

if(len(l) == 0):
  if(a == b):
    l.append(1)
    
print(str(l[len(l) - int(k)]))

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

if( (b / a) >= c):
  print(c)
else:
  print(str(int(b/a)))
Buggy python submission (verdict: Runtime Error):
import re

date_s = input()

date_l = date_s.replace("/", "")

if(date_l <= 20190430):
  print "Heisei"
else:
  print "TBD"
    


Fixed submission:
import re

date_s = input()

date_l = int(date_s.replace("/", ""))

if(date_l <= 20190430):
  print("Heisei")
else:
  print("TBD")

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

date_s = input()

date_l = re.replace("/", "")

if(date_l <= 20190430):
  print "Heisei"
else:
  print "TBD"
    

Fixed submission:
import re

date_s = input()

date_l = int(date_s.replace("/", ""))

if(date_l <= 20190430):
  print("Heisei")
else:
  print("TBD")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
b=[]
c=[]
d=0

for i in range(1,n):
    if n%i==0:
        a.append(int(n//i))
        b.append(i)
        d += 1

for i in range(d):
    c.append(a[i]+b[i])


print(min(c)-2)

Fixed submission:
n=int(input())
a=[]

for i in range(1,int(n//(n**0.5))+1):
    if n%i==0:
        a.append(int(n//i)+i)
        
print(min(a)-2)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
ans=0

def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

for i in cf(a,b):
    for j in range(2,i):
        if i%j == 0:
            break
    else:
        ans+=1

print(ans)

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2,int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a_list=factorization(a)
b_list=factorization(b)

a_new=[a[0] for a in a_list]
b_new=[b[0] for b in b_list]

if a_new[0]==b_new[0]==1:
    ans=0

for i in a_new:
    if i in b_new:
        ans += 1

print(ans)

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

list_a=make_divisors(a)
list_b=make_divisors(b)

for i in list_a:
    if i in list_b:
        c.append(i)

for i in c:
    for j in range(2,i):
        if i%j == 0:
            break
    else:
        ans+=1

print(ans)


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

def factorization(n):
    arr = []
    temp = n
    for i in range(2,int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a_list=factorization(a)
b_list=factorization(b)

a_new=[a[0] for a in a_list]
b_new=[b[0] for b in b_list]

if a_new[0]==b_new[0]==1:
    ans=0

for i in a_new:
    if i in b_new:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
a=[int(input()) for i in range(q)]
b=[k]*n
c=[0]*n

for i in range(q):
    b[a[i]-1] +=1
    for i in range(n):
        b[i] -= 1

for i in range(n):
    if b[i]<=0:
        c[i]='No'
    else:
        c[i]='Yes'

for i in range(n):
    print(c[i])


Fixed submission:
n,k,q = map(int,input().split())
a=[int(input()) for i in range(q)]
b=[k-q]*n
c=[0]*n

for i in range(q):
    b[a[i]-1] +=1
    
for i in range(n):
    if b[i]<=0:
        c[i]='No'
    else:
        c[i]='Yes'

for i in range(n):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
a=[]

if r-l > 3000:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            a.append((i*j)%2019)

print(min(a))

Fixed submission:
l,r=map(int,input().split())
a=[]

if r-l > 3000:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            a.append((i*j)%2019)
    print(min(a))

Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())
a=[]

if r-l > 2019:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            a.append((i*j)%2019)

print(min(a))

Fixed submission:
l,r=map(int,input().split())
a=[]

if r-l > 3000:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            a.append((i*j)%2019)
    print(min(a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dic = {}
for _ in range(n):
  k = input()
  dic[k] = 1 if k not in dic else dic[k] + 1
result = []
for i,j in dic.items():
  result.append((j,i))
  result.sort()
  maxi = result[-1][0]
  reresult=[]
  for i in result:
    if maxi == i[0]:
      reresult.append(i[1])
for i in sorted(reresult):
  print(i)

Fixed submission:
n = int(input())
dic = {}
maxi = 0
for _ in range(n):
  k = input()
  dic[k] = 1 if k not in dic else dic[k] + 1
  if dic[k] > maxi: maxi = dic[k]
result = []
for i,j in dic.items():
  if j == maxi:
    result.append(i)
result.sort()
for r in result:
  print(r)
Buggy python submission (verdict: Runtime Error):
a,b,c=sorted(map(int,input()))
print(10*c+b+a)
 

Fixed submission:
a,b,c=sorted(map(int,input().split()))
print(10*c+b+a)
Buggy python submission (verdict: Runtime Error):
a,*b,c=input()
print(a+len(b)+c)

Fixed submission:
a,*b,c=input()
print(a+str(len(b))+c)
Buggy python submission (verdict: Runtime Error):
o=list(input())
e=list(input())+[""]
for x,y in zip(x,y):print(x,y,end="") 

Fixed submission:
o=list(input())
e=list(input())+[""]
for x,y in zip(o,e):print(x+y,end="")

Buggy python submission (verdict: Runtime Error):
o=list(input())
e=list(input())
for x,y in zip(x,y):print(x,y,end="") 

Fixed submission:
o=list(input())
e=list(input())+[""]
for x,y in zip(o,e):print(x+y,end="")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

p, q, r = [int(x) for x in input().rstrip().split(" ")]

s = []
s[0] = p + q
s[1] = q + r
s[2] = r + p

print(min(s))


Fixed submission:
# coding: utf-8

p, q, r = [int(x) for x in input().rstrip().split(" ")]

s = [0, 0, 0]
s[0] = p + q
s[1] = q + r
s[2] = r + p

print(min(s))