Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys; readline = sys.stdin.readline
from collections import deque

t1, t2 = map(int, readline().split())
a1, a2 = map(int, readline().split())
b1, b2 = map(int, readline().split())

T = t1 + t2

avgA = t1 * a1 + t2 * a2
avgB = t1 * b1 + t2 * b2
if avgA == avgB :
    print('infinity')
    exit(0)

if avgA < avgB:
    a1, a2, b1, b2 = b1, b2, a1, a2
    avgA, avgB = avgB, avgA

d1 = a1 - b1
d2 = a2 - b2

if d1 > 0:
    print(0)
    exit(1)

y0 =  -d1 * t1
dy = (avgA - avgB)

n = y0 // dy

if y0 % dy == 0:
    print((n + 1) * 2 - 2)
else:
    print((n + 1) * 2 - 1)

Fixed submission:
import sys; readline = sys.stdin.readline
from collections import deque

t1, t2 = map(int, readline().split())
a1, a2 = map(int, readline().split())
b1, b2 = map(int, readline().split())

T = t1 + t2

avgA = t1 * a1 + t2 * a2
avgB = t1 * b1 + t2 * b2
if avgA == avgB:
    print('infinity')
    exit(0)

if avgA < avgB:
    a1, a2, b1, b2 = b1, b2, a1, a2
    avgA, avgB = avgB, avgA

d1 = a1 - b1
d2 = a2 - b2

if d1 > 0:
    print(0)
    exit(0)

y0 =  -d1 * t1
dy = (avgA - avgB)

n = y0 // dy

if y0 % dy == 0:
    print((n + 1) * 2 - 2)
else:
    print((n + 1) * 2 - 1)
Buggy python submission (verdict: Runtime Error):
import sys; readline = sys.stdin.readline
from collections import deque
from collections import Counter

N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))

A, B = zip(*sorted(zip(A, B), key=lambda x:x[1]))

A_s = sorted(A)
B_s = sorted(B)

no = "No"
yes = "Yes"

for i in range(len(A_s)):
    if A_s[i] > B_s[i]:
        print(no)
        exit(0)

for i in range(1, len(A_s)):
    if A_s[i] < B_s[i - 1]:
        print(yes)
        exit(0)

si2i = sorted(range(len(A)), key=lambda x:A[i])

a = 0
count = 0
while True:
    a = si2i[a]
    if a == 0:
        break
    count += 1

if count <= N - 2:
    print(yes)
    assert False
else:
    print(no)

Fixed submission:
import sys; readline = sys.stdin.readline
from collections import deque
from collections import Counter

N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))

A, B = zip(*sorted(zip(A, B), key=lambda x:x[1]))

A_s = sorted(A)
B_s = sorted(B)

no = "No"
yes = "Yes"

for i in range(len(A_s)):
    if A_s[i] > B_s[i]:
        print(no)
        exit(0)

for i in range(1, len(A_s)):
    if A_s[i] < B_s[i - 1]:
        print(yes)
        exit(0)

si2i = sorted(range(len(A)), key=lambda x:A[x])

a = 0
count = 0
while True:
    a = si2i[a]
    if a == 0:
        break
    count += 1

if count <= N - 2:
    print(yes)
else:
    print(no)

Buggy python submission (verdict: Runtime Error):
import sys; readline = sys.stdin.readline
from collections import deque
from collections import Counter

N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))

A, B = zip(*sorted(zip(A, B), key=lambda x:x[1]))

A_s = sorted(A)
B_s = sorted(B)

no = "No"
yes = "Yes"

for i in range(len(A_s)):
    if A_s[i] > B_s[i]:
        print(no)
        exit(0)

for i in range(1, len(A_s)):
    if A_s[i] < B_s[i - 1]:
        print(yes)
        exit(0)

assert False

si2i = sorted(range(len(A)), key=lambda x:A[i])

a = 0
count = 0
while True:
    a = si2i[a]
    if a == 0:
        break
    count += 1

if count <= N - 2:
    print(yes)
else:
    print(no)

Fixed submission:
import sys; readline = sys.stdin.readline
from collections import deque
from collections import Counter

N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))

A, B = zip(*sorted(zip(A, B), key=lambda x:x[1]))

A_s = sorted(A)
B_s = sorted(B)

no = "No"
yes = "Yes"

for i in range(len(A_s)):
    if A_s[i] > B_s[i]:
        print(no)
        exit(0)

for i in range(1, len(A_s)):
    if A_s[i] < B_s[i - 1]:
        print(yes)
        exit(0)

si2i = sorted(range(len(A)), key=lambda x:A[x])

a = 0
count = 0
while True:
    a = si2i[a]
    if a == 0:
        break
    count += 1

if count <= N - 2:
    print(yes)
else:
    print(no)
Buggy python submission (verdict: Runtime Error):
import sys; readline = sys.stdin.readline
from collections import deque


A, B = map(int, readline().split())
print(max(A - 2 * B))

Fixed submission:
import sys; readline = sys.stdin.readline
from collections import deque


A, B = map(int, readline().split())
print(max(0, A - 2 * B))
Buggy python submission (verdict: Runtime Error):
import sys; from collections import deque; readline = sys.stdin.readline

H, W, A, B = map(int, readline().split())

#for s in range(W):
#    a = (H - 2*B) * s + W*B - H*A
#    b = W - 2*A
#    if a % b == 0 and a // b >= 0:
#        t = a // b
#        break
#
#if s == W:
#    print('No')
#else:
#    count = []

for y in range(B):
    print(''.join([1]*A + [0]*(W-A)))

for y in range(B, H):
    print(''.join([0]*A + [1]*(W-A))

Fixed submission:
import sys; from collections import deque; readline = sys.stdin.readline

H, W, A, B = map(int, readline().split())

#for s in range(W):
#    a = (H - 2*B) * s + W*B - H*A
#    b = W - 2*A
#    if a % b == 0 and a // b >= 0:
#        t = a // b
#        break
#
#if s == W:
#    print('No')
#else:
#    count = []

for y in range(B):
    print(''.join(map(str, [1]*A + [0]*(W-A))))

for y in range(B, H):
    print(''.join(map(str, [0]*A + [1]*(W-A))))
Buggy python submission (verdict: Runtime Error):
import sys, math
from collections import deque

readline = sys.stdin.readline

A = int(readline())

n = math.floor(math.log10(A)) + 1

count = 0
for i in range(1, n, 2):
    count += 9 * 10 ** (i - 1)

if n % 2 == 1:
    count += A - 10 ** (i - 1) + 1

print(count)

Fixed submission:
import sys, math
from collections import deque

readline = sys.stdin.readline

A = int(readline())

n = math.floor(math.log10(A)) + 1

count = 0
for i in range(1, n, 2):
    count += 9 * 10 ** (i - 1)

if n % 2 == 1:
    count += A - 10 ** (n - 1) + 1

print(count)
Buggy python submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline

N, A, B = map(int, readline().split())

print(min(N * A), B)

Fixed submission:
import sys

readline = sys.stdin.readline

N, A, B = map(int, readline().split())

print(min(N * A, B))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque

sys.setrecursionlimit(10000000)

readline = sys.stdin.readline

N, M = map(int, readline().split())
uv = [list(map(int, readline().split())) for i in range(M)]
S, T = map(int, readline().split())

S, T = S - 1, T - 1

nodes = [{} for i in range(N)]
for u, v in uv:
    nodes[u - 1][v - 1] = 1

visited = [False] * N

def kenken(u, rem):
    if rem > 0:
        a = []
        for v in nodes[u]:
            a += kenken(v, rem - 1)
        return a
    else:
        return [u]
    

q = deque()

q.append([S, 0])

_count = -1
while len(q) != 0:
    u, count = q.popleft()
    if not visited[u]:
        visited[u] = True

        ret = kenken(u, 3)
        if any(T == r for r in ret):
            _count = count + 1
            break
        q.extend([r, count + 1] for r in ret)


print(_count)

Fixed submission:
import sys
from collections import deque

sys.setrecursionlimit(10000000)

readline = sys.stdin.readline

N, M = map(int, readline().split())
uv = [list(map(int, readline().split())) for i in range(M)]
S, T = map(int, readline().split())

S, T = S - 1, T - 1

nodes = [{} for i in range(N)]
for u, v in uv:
    nodes[u - 1][v - 1] = 1

visited = [[False] * N for i in range(3)]

def kenken(u, rem):
    if rem != 3 and visited[rem][u]:
        return deque()
    
    if rem != 3:
        visited[rem][u] = True
    if rem > 0:
        a = deque()
        for v in nodes[u]:
            a.extend(kenken(v, rem - 1))
        return a
    else:
        return deque([u])
    

q = deque()

q.append([S, 0])

_count = -1
while len(q) != 0:
    u, count = q.popleft()

    ret = kenken(u, 3)
    if any(T == r for r in ret):
        _count = count + 1
        break
    q.extend([r, count + 1] for r in ret)


print(_count)
Buggy python submission (verdict: Runtime Error):
import sys, fractions

readline = sys.stdin.readline

A, B, C, D = map(int, readline().split())

c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
lcm = C * D // fractions.gcd(c, d)
cd = B // lcm - (A - 1) // lcm

ans = B - (A - 1) - (c + d - cd)

print(ans)

Fixed submission:
import sys

readline = sys.stdin.readline

A, B, C, D = map(int, readline().split())

def get_gcd(x, y):
    while True:
        if x > y:
            t = x % y
            a = y
            x = t
        else:
            t = y % x
            a = x
            y = t
        if t == 0:
            return a

c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
lcm = C * D // get_gcd(C, D)
cd = B // lcm - (A - 1) // lcm


ans = B - (A - 1) - (c + d - cd)

print(ans)

Buggy python submission (verdict: Runtime Error):
import sys, fractions

readline = sys.stdin.readline

A, B, C, D = map(int, readline().split())

c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
lcm = C * D // fractions.gcd(c, d)
cd = B // lcm - (A - 1) // lcm

ans = B - (A - 1) - (c + d - cd)

print(ans)

Fixed submission:
import sys

readline = sys.stdin.readline

A, B, C, D = map(int, readline().split())

def get_gcd(x, y):
    while True:
        if x > y:
            t = x % y
            a = y
            x = t
        else:
            t = y % x
            a = x
            y = t
        if t == 0:
            return a

c = B // C - (A - 1) // C
d = B // D - (A - 1) // D
lcm = C * D // get_gcd(C, D)
cd = B // lcm - (A - 1) // lcm


ans = B - (A - 1) - (c + d - cd)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

readline = sys.stdin.readline

N, M = map(int, readline().split())
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))

dp = [[0] * (M + 1) for i in range(N + 1)]

for x in range(1, N + 1):
    for y in range(1, M + 1):
        dp[x][y] = dp[x][y - 1] + dp[x - 1][y] - dp[x - 1][y - 1]
        if S[x - 1] == T[y - 1]:
            dp[x][y] += dp[x - 1][y - 1] + 1
ans = (dp[N][M] + 1) % (10 ** 9 + 7)
print(ans)


Fixed submission:
import sys

readline = sys.stdin.readline

N, M = map(int, readline().split())
S = list(map(int, readline().split()))
T = list(map(int, readline().split()))

P = 10 ** 9 + 7

dp = [[0] * (M + 1) for i in range(N + 1)]

for x in range(1, N + 1):
    for y in range(1, M + 1):
        dp[x][y] = dp[x][y - 1] + dp[x - 1][y] - dp[x - 1][y - 1]
        if S[x - 1] == T[y - 1]:
            dp[x][y] += dp[x - 1][y - 1] + 1

        dp[x][y] = dp[x][y] % P

ans = dp[N][M] + 1
print(ans % P)
Buggy python submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline

N = int(readline())

XY = [list(map(int, readline().split())) for i in range(N)]

diff_list = {}

for x1, y1 in XY:
    for x2, y2 in XY:
        if x1 == x2 and y1 == y2:
            continue
        diffx = x2 - x1
        diffy = y2 - y1
        diff = (diffx, diffy)
        if not (diff in diff_list): diff_list[diff] = 0
        diff_list[diff] += 1

m = max(diff_list.values())

ans = N - m

print(ans)

Fixed submission:
import sys

readline = sys.stdin.readline

N = int(readline())

XY = [list(map(int, readline().split())) for i in range(N)]

diff_list = {}

for x1, y1 in XY:
    for x2, y2 in XY:
        if x1 == x2 and y1 == y2:
            continue
        diffx = x2 - x1
        diffy = y2 - y1
        diff = (diffx, diffy)
        if not (diff in diff_list): diff_list[diff] = 0
        diff_list[diff] += 1

values = diff_list.values()
if len(values) > 0:
    m = max(values)
    ans = N - m
else:
    ans = 1

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys, math

N, K = map(int, sys.stdin.readline().split())

immediate_win = (N - (K - 1)) / N if K <= N else 0

s = 0
for k in range(1, min(K - 1, N) + 1):
    r = K / k
    c = math.ceil(math.log2(r))
    p = 0.5 ** c
    s += p / N
print(s + immediate_win)

Fixed submission:
import sys, math

N, K = map(int, sys.stdin.readline().split())

immediate_win = (N - (K - 1)) / N if K <= N else 0

s = 0
for k in range(1, min(K - 1, N) + 1):
    r = K / k
    c = math.ceil(math.log2(r))
    p = 0.5 ** c
    s += p / N
print(s + immediate_win)
Buggy python submission (verdict: Runtime Error):
import sys

N = int(sys.stdin.readline())
print(N)

i = 1
s = 0

while i ** 2 <= N:
    if N % i == 0:
        k = N // i - 1
        if k > i:
            s += k
    i += 1
print(s)


Fixed submission:
import sys

readline = sys.stdin.readline

N, K = map(int, readline().split())

ret = N - K + 1

print(ret)

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

N = int(sys.stdin.readline())

i = 1
s = 0

while i ** 2 <= N:
  if N // i == N % i:
    s += i
  i += 1
print(s)

Fixed submission:
import sys

readline = sys.stdin.readline

N, K = map(int, readline().split())

ret = N - K + 1

print(ret)
Buggy python submission (verdict: Runtime Error):
import sys

N = int(sys.stdin.readline())

i = 0
count = 0

while i ** 2 <= N:
  if N // i == N % i:
    count += 1

print(count)

Fixed submission:
import sys

N = int(sys.stdin.readline())
i = 1
s = 0

while i ** 2 <= N:
    if N % i == 0:
        k = N // i - 1
        if k > i:
            s += k
    i += 1
print(s)

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

readline = sys.stdin.readline

N = int(readline())

sqrtN = int(N ** 0.5)

i = 1
total = 0
while True:
    if N % i == 0:
        if i < (N // i) - 1:
            total += N // i - 1
        else:
            break
    i += 1

print(total)

Fixed submission:
import sys

N = int(sys.stdin.readline())
i = 1
s = 0

while i ** 2 <= N:
    if N % i == 0:
        k = N // i - 1
        if k > i:
            s += k
    i += 1
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
 
for i in range(n):
    print(max(max(a[0:i], a[i+1:n])))


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)
b_max = b[-1]
b.pop(-1)
b_2max = b[-1]

for i in a:
    if i == b_max:
        print(b_2max)
    else:
        print(b_max)

Buggy python submission (verdict: Time Limit Exceeded):
def loop(n, a):
    for i in range(n):
        temp = a[i]
        a[i] = 0
        print(max(a))
        a[i] = temp
    

n = int(input())
a = [int(input()) for i in range(n)]
 
loop(n, a)


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)
b_max = b[-1]
b.pop(-1)
b_2max = b[-1]

for i in a:
    if i == b_max:
        print(b_2max)
    else:
        print(b_max)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
 
for i in range(n):
  temp = a[i]
  a[i] = 0
  print(max(a))
  a[i] = temp

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)
b_max = b[-1]
b.pop(-1)
b_2max = b[-1]

for i in a:
    if i == b_max:
        print(b_2max)
    else:
        print(b_max)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]

for i in range(n):
  temp = a[i]
  a[i] = 0
  print(max(a))
  a[i] = temp

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)
b_max = b[-1]
b.pop(-1)
b_2max = b[-1]

for i in a:
    if i == b_max:
        print(b_2max)
    else:
        print(b_max)
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(stdin.readline())
    a = list(map(int,stdin.readline().split()))
    f = 1
    flag=0
    a = sorted(a)
    for i in range(n):
        f = f*a[i]
        if f>10**18:
            flag=1
            break
    if flag:
        print("-1")
    else:
        print(f)

main()

Fixed submission:
from sys import stdin, stdout
from collections import defaultdict

def main():
    n = int(stdin.readline())
    a = list(map(int,stdin.readline().split()))
    f = 1
    flag=0
    a = sorted(a)
    for i in range(n):
        f = f*a[i]
        if f>10**18:
            flag=1
            break
    if flag:
        print("-1")
    else:
        print(f)

main()
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
for i in range(len(s)-1):
  if s[i]!=t[i]:
    f =1
if f==1:
  print("No")
else:
  print("yes")

Fixed submission:
s =input()
t =input()
f=0
for i in range(len(s)):
	if s[i]!=t[i]:
		f=1
		break
if f==1:
	print("No")
else:
	print("Yes")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[[]] * n
x=[[]] * n
y=[[]] * n
for i in range(n):
  a[i]=int(input())
  x[i]=[[]] * a[i]
  y[i]=[[]] * a[i]
  for j in range(a[i]):
    x[i][j],y[i][j]=map(int,input().split())
def eva(o,p,q):
  for i in range(a[p]):
    if x[p][i]-1==q:
      return(y[p][i])
  for i in range(a[p]):
    if x[p][i]-1==o:
      return(1)
  for i in range(a[p]):     
    if y[p][i]==1:     
      return(eva(o,x[p][i]-1,q))
  return(1)
def test(p,q):
  return(eva(p,p,q)*eva(q,q,p))

ans=[[[] for i in range(n) ] for j in range(n)]
for i in range(n):
  for j in range(n):
    ans[i][j]=test(i,j)

b=[sum(ans[i])for i in range(n)]

sum=0
for i in range(n):
  if max(b)==0:
    break
  c=b.index(max(b))
  for j in range(n):
    if ans[c][j]==0:
      b[j]=0
  b[c]=0
  sum+=1
print(sum)

Fixed submission:
n=int(input())
a=[[]] * n
x=[[]] * n
y=[[]] * n
for i in range(n):
  a[i]=int(input())
  x[i]=[[]] * a[i]
  y[i]=[[]] * a[i]
  for j in range(a[i]):
    x[i][j],y[i][j]=map(int,input().split())

com=[[0 for i in range(n) ] for j in range(2**n)]

for i in range(2**n):
  for j in range(n):
    if ((i >> j) & 1) == 1:
      com[i][j]=1
  #正直者の証言が全て合っているか。
  for j in range(n):
    if com[i][j]==1:
      for k in range(a[j]):
        if y[j][k]!=com[i][x[j][k]-1]:
          com[i]=[0 for l in range(n) ]
          break
sum=[sum(com[i]) for i in range(2**n) ]
print(max(sum))
Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())
a=list(map(int,input().split()))
m=math.ceil(math.log(max(1,max(a)),2))

ans=0
for i in range(m):
  sum1=sum((a[j]>>i)&1 for j in range(n))
  sum0=n-sum1
  ans+=2**i*sum1*sum0

print(ans%(10**9+7))

Fixed submission:
import math
n=int(input())
al=list(map(int,input().split()))
a=['{:060b}'.format(x) for x in al]
a=''.join(a)

m=math.ceil(math.log(max(1,max(al)),2))

ans=0
for i in range(m):
  sum1=a[59-i::60].count('1')
  sum0=n-sum1
  ans+=2**i*sum1*sum0

print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())
a=list(map(int,input().split()))
m=math.ceil(math.log(max(1,max(a)),2))

ans=0
for i in range(m):
  sum0=0
  sum1=0
  for j in range(n):
    if (a[j]>>i)&1:
      sum1+=1
    else:
      sum0+=1
  ans+=2**i*sum1*sum0
print(ans%(10**9+7))

Fixed submission:
import math
n=int(input())
al=list(map(int,input().split()))
a=['{:060b}'.format(x) for x in al]
a=''.join(a)

m=math.ceil(math.log(max(1,max(al)),2))

ans=0
for i in range(m):
  sum1=a[59-i::60].count('1')
  sum0=n-sum1
  ans+=2**i*sum1*sum0

print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
a=list(map(int,input().split()))
m=math.ceil(math.log(max(a),2))

ans=0
for i in range(m):
  sum0=0
  sum1=0
  for j in range(n):
    if (a[j]>>i)&1:
      sum1+=1
    else:
      sum0+=1
  ans+=2**i*sum1*sum0
print(ans%(10**9+7))

Fixed submission:
import math
n=int(input())
al=list(map(int,input().split()))
a=['{:060b}'.format(x) for x in al]
a=''.join(a)

m=math.ceil(math.log(max(1,max(al)),2))

ans=0
for i in range(m):
  sum1=a[59-i::60].count('1')
  sum0=n-sum1
  ans+=2**i*sum1*sum0

print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=0
for i in range(9):
  for j in range(9):
    if n==(i+1)*(j+1):
      print("Yes")
      a+=1
      break
  if a!=0:
    break
if a==0:
  print("No")

Fixed submission:
a,b=map(int,input().split())
 
if a<10 and b<10:
  print(a*b)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

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


Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
  
x = np.argsort(a)
for i in range(n):
  print(x[i]+1)

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


for i in range(n):
  for j in range(n):
    if a[j]==i+1:
      print(j+1)
      break

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
  
x = np.argsort(a)
for i in range(n):
  print(x[i]+1)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

a,b=map(int,input().split())

def pf(x):
  x2=x
  l=[1]
  if x%2==0:
    l.append(2)
    while x%2==0:
      x=x//2
  for i in range(3,x2,2):
    if x%i==0:
      l.append(i)
    while x%i==0:
      x=x//i
    if x==1:
      break
  if x==x2:
    if x!=1:
      l.append(x)
  return(l)

count=0
n=gcd(a,b)

l=pf(n)

len=len(l)
for i in range(len):
  if  a%l[i]==0:
        count+=1
print(count)


Fixed submission:
import math
from fractions import gcd

a,b=map(int,input().split())

def pf(x):
  x2=x
  y = int(math.sqrt(x))+1
  l=[1]
  if x%2==0:
    l.append(2)
    while x%2==0:
      x=x//2
  for i in range(3,y,2):
    if x%i==0:
      l.append(i)
    while x%i==0:
      x=x//i
    if x==1:
      break
  if x>=y:
    if x!=1:
      l.append(x)
  return(l)

count=0
n=gcd(a,b)

l=pf(n)

len=len(l)
for i in range(len):
  if  a%l[i]==0:
        count+=1
print(count)

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

a,b=map(int,input().split())

def pf(x):
  x2=x
  y=int(x/2)
  l=[1]
  sq_x=math.sqrt(x)
  if x%2==0:
    l.append(2)
    while x%2==0:
      x=x//2
  for i in range(3,y,2):
    if x%i==0:
      l.append(i)
    while x%i==0:
      x=x//i
    if x==1:
      break
  if x==x2:
    if x!=1:
      l.append(x)
  return(l)

count=0
if b>a:
  a,b=b,a

l=pf(b)
len=len(l)
for i in range(len):
  if  a%l[i]==0:
        count+=1
print(count)


Fixed submission:
import math
from fractions import gcd

a,b=map(int,input().split())

def pf(x):
  x2=x
  y = int(math.sqrt(x))+1
  l=[1]
  if x%2==0:
    l.append(2)
    while x%2==0:
      x=x//2
  for i in range(3,y,2):
    if x%i==0:
      l.append(i)
    while x%i==0:
      x=x//i
    if x==1:
      break
  if x>=y:
    if x!=1:
      l.append(x)
  return(l)

count=0
n=gcd(a,b)

l=pf(n)

len=len(l)
for i in range(len):
  if  a%l[i]==0:
        count+=1
print(count)

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

a,b=map(int,input().split())

def pf(x):
  x2=x
  y=int(x/2)
  l=[1]
  sq_x=math.sqrt(x)
  if x%2==0:
    l.append(2)
    while x%2==0:
      x=x//2
  for i in range(3,y,2):
    if x%i==0:
      l.append(i)
    while x%i==0:
      x=x//i
    if x==1:
      break
  if x==x2:
    if x!=1:
      l.append(x)
  return(l)

count=0
if b>a:
  a,b=b,a

l=pf(b)

for i in range(len(l)):
  if l[i]!=0:
    if  a%l[i]==0:
        count+=1
print(count)

Fixed submission:
import math
from fractions import gcd

a,b=map(int,input().split())

def pf(x):
  x2=x
  y = int(math.sqrt(x))+1
  l=[1]
  if x%2==0:
    l.append(2)
    while x%2==0:
      x=x//2
  for i in range(3,y,2):
    if x%i==0:
      l.append(i)
    while x%i==0:
      x=x//i
    if x==1:
      break
  if x>=y:
    if x!=1:
      l.append(x)
  return(l)

count=0
n=gcd(a,b)

l=pf(n)

len=len(l)
for i in range(len):
  if  a%l[i]==0:
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
H, W = list(map(input().split()))

print(H*W//2 + (H * W) % 2)



Fixed submission:
H, W = list(map(int, input().split()))
if H == 1 or W == 1:
    print(1)
else:
    print(H*W//2 + (H*W)%2)
Buggy python submission (verdict: Runtime Error):
list = [int(i) for i in input().split()]

fee = list[0] * list[1]

print(min(fee, list[2])

Fixed submission:
list = [int(i) for i in input().split()]

fee = list[0] * list[1]

print(min(fee, list[2]))