ZhenlongDai/ACPR huggingface dataset:
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

def divisors(n):
    s = set()
    for x in range(2, math.ceil(n ** 0.5) + 1):
        while n % x == 0:
            s.add(x)
            n /= x
            if n == 1:
                break
    return s
 
a, b = map(int, input().split())
d = divisors(a) & divisors(b)
print(len(d) + 1)

Failing test case input:
442 17

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math

def divisors(n):
    s = set()
    for x in range(2, math.ceil(n ** 0.5) + 1):
        while n % x == 0:
            s.add(x)
            n /= x
            if n == 1:
                break
    if n > 1:
        s.add(n)
    return s
 
a, b = map(int, input().split())
d = divisors(a) & divisors(b)
print(len(d) + 1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

A,B=map(int,input().split())

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +2):
        if n%i==0 and n!=2:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
for i in range(1, int(math.sqrt(p) + 1e-9) +2):
    if p%i==0 and q%i==0:
        ans+=func(i)

if func(p)==1 and q%p==0:
    ans+=1
    
print(ans)

Failing test case input:
2 1692

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import math

A,B=map(int,input().split())

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +3):
        if n%i==0 and n!=i:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
check=[]
for i in range(1, int(math.sqrt(p)+ 1e-9)+3):
    if p%i==0:
        if i not in check:
            check.append(i)
        if p
            check.append(p

for i in check:
    if q%i==0:
        ans+=func(i)

print(ans)

Problem: p02900
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

A, B = map(int, input().split())

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

hoge = gcd(A, B)

ans = 1
i = 2
while i * i <= min(A, B):
    if hoge % i == 0:
        ans += 1
        while hoge % i == 0:
            hoge /= i
    i += 1

print(ans)


Failing test case input:
3 4371

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

A, B = map(int, input().split())

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

hoge = gcd(A, B)

ans = 1
i = 2
while i * i <= min(A, B):
    if hoge % i == 0:
        ans += 1
        while hoge % i == 0:
            hoge /= i
    i += 1
if hoge != 1:
    ans += 1
    
print(ans)
Problem: p02900
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import gcd

A, B = map(int, input().split())

m = gcd(A, B)


num = int(m**0.5 + 1) 
ans = 1

for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m = m/i

print(ans)

Failing test case input:
6 2019

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from math import gcd

A, B = map(int, input().split())

m = gcd(A, B)


num = int(m**0.5) 
ans = 1

for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m /= i

if m>1:
    ans+=1 

print(ans)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B = map(int, input().split())

N = int((max(A, B))**1/2)+1

ans = 0
for i in range(1, N):
    if A%i == 0 and B%i == 0:
        Flag = True
        for j in range(2, i):
            if i%j == 0:
                Flag = False
                break
        if Flag == True:
            ans += 1
    else:
        break
    
            
print(ans)

Failing test case input:
27 4794

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import fractions

A, B = map(int, input().split())

x = fractions.gcd(A, B)

C = []

def cal(i):
    for j in range(2, int(-(-i**0.5
        while True:
            if i%j == 0:
                i 
                C.append(j)
            else:
                break
    if i != 1:
        C.append(i)
        
    return set(C)

print(1+len(cal(x)))

Problem: p02900
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
while a!=0:
  c=a
  a=b%a
  b=c
ans=0
for i in range(2,int(math.sqrt(b)+2)):
  if b%i==0:
    ans+=1
    while b%i==0:
      b=int(b/i)
print(ans+1)

Failing test case input:
33 4794

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
while a!=0:
  c=a
  a=b%a
  b=c
ans=1
for i in range(2,int(math.sqrt(b)+2)):
  if b%i==0:
    ans+=1
    while b%i==0:
      b=int(b/i)
if b!=1:
    ans+=1
print(ans)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b = map(int, input().split())
def getPrime(a):
  prime=[]
  for i in range(2,int(min(a,b)**0.5)+1):
    if a%i == 0:
      for j in prime:
        if i%j == 0:
          break
      else:
        prime+=[i]
  return prime
a_prime=getPrime(a)
b_prime=getPrime(b)
print(len(set(a_prime) & set(b_prime))+1)

Failing test case input:
3 2019

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import string
import collections
a_prime=[]
b_prime=[]
a,b = map(int, input().split())
def getPrime(a):
  prime=[]
  for i in range(2,int(a**0.5
    if a%i==0:
      while a%i == 0:
        a=a
      prime+=[i]
  if a!=1:
    prime.append(a)

  return prime
a_prime=getPrime(a)
b_prime=getPrime(b)
print(len(set(a_prime) & set(b_prime))+1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=A,A%B
count=2
i=2
while i**2<B:
    if B%i==0:
        count+=1
        while B%i==0:
            B/=i
    i+=1
print(count)

Failing test case input:
83 4

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
if B==1:
    print(1)
else:
    count=1
    i=2
    while i**2<=B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    if B!=1:
        count+=1
    print(count)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b = map(int, input().split())

def prime_factorization(x):
    table = []
    i = 2
    while i * i <= x :
        if x % i == 0 :
            table.append(i)
        i += 1

    if x > 1 :
        table.append(x)
    return table

v = set(prime_factorization(a))
w = set(prime_factorization(b))

print(len(v&w) + 1)


Failing test case input:
16 11968

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
 
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:   
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
  
s = set(prime_decomposition(a))
t = set(prime_decomposition(b))
 
print(len(s&t) + 1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def divisors(n):
    s = set()
    for x in range(2, int(n ** 0.5) + 1):
        if n % x == 0:
            s.add(x)
            n /= x
            if n == 1:
                break
    return s

a, b = map(int, input().split())
d = divisors(a) & divisors(b)
print(len(d) + 1)


Failing test case input:
3 4794

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math

def divisors(n):
    s = set()
    for x in range(2, math.ceil(n ** 0.5) + 1):
        while n % x == 0:
            s.add(x)
            n /= x
            if n == 1:
                break
    if n > 1:
        s.add(n)
    return s
 
a, b = map(int, input().split())
d = divisors(a) & divisors(b)
print(len(d) + 1)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b=map(int,input().split())
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(x,x%y)
  
  
  
z=gcd(a,b)
j=0
ans=[]
for i in range(1,z+1):
  if z%i==0:
    z/=i
    ans.append(i)
  else:
    j+=1
    
    
print(len(set(ans)))    
    


Failing test case input:
178 17

Expected output:
1


Actual output:
2


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

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)
  
  
n=gcd(a,b)  
i=2
ans=[1]

while i * i <= n:
  if n % i == 0:
    n /= i
    ans.append(i)
  else:
    i += 1

ans.append(n)    
  
print(len(set(ans)))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):






















def euc(a, b):
    return b if a % b == 0 else euc(b, a % b)


def div(n):
    
    divisors = [1]
    for i in range(2, int(n**0.5)):
        while(n % i == 0):
            divisors.append(i)
            while n % i == 0:
                n /= i
    return set(divisors)

    
    
    
    
    
    
    











a, b = map(int, input().split())
c = div(euc(a, b))
print(len(c))


Failing test case input:
16 6430

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):






















def euc(a, b):
    return b if a % b == 0 else euc(b, a % b)


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


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

c = div(euc(a, b))

print(len(c))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def gcd(x, y):
    if y == 0 :
        return x
    else:
        return gcd(y,x%y)
def prime(x):
    if x == 1 :
        return False
    else:
        for i in range(2,int(x**(0.5))+1):
            if x % i == 0 :
                return False
        return True

A,B = map(int,input().split())
t = gcd(A,B)
ans = 1
print(t)
for i in range(2,t+1):
    if prime(i) and t % i == 0 :
        ans += 1
    else:
        pass

print(ans)

Failing test case input:
2 1692

Expected output:
2


Actual output:
2
2


Fixed submission (verdict: Accepted):
def gcd(x, y):
    if y == 0 :
        return x
    else:
        return gcd(y,x%y)
def prime(x):
    global  ans
    m = x ** (0.5)
    for i in range(2,int(m+1)):
        if x % i == 0 :
            while True:
                if x % i != 0 :
                    break
                else:
                    x = (x
            ans +=1
    if x != 1 :
        ans += 1
    return ans
A,B = map(int,input().split())
t = gcd(A,B)
ans = 1
print(prime(t))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
    print(A,B)
if B==1:
    print(1)
else:
    count=2
    i=2
    while i**2<B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    print(count)

Failing test case input:
19 36

Expected output:
1


Actual output:
19 17
17 2
2 1
1


Fixed submission (verdict: Accepted):
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
if B==1:
    print(1)
else:
    count=1
    i=2
    while i**2<=B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    if B!=1:
        count+=1
    print(count)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B = map(int, input().split())

N = int((max(A, B))**1/2)+1

ans = 0
for i in range(1, N):
    if A%i == 0 and B%i == 0:
        Flag = True
        for j in range(2, int(i**0.5)+1):
            if i%j == 0:
                Flag = False
                break
        if Flag == True:
            ans += 1
    else:
        break
            
print(ans)

Failing test case input:
3 4794

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import fractions

A, B = map(int, input().split())

x = fractions.gcd(A, B)

C = []

def cal(i):
    for j in range(2, int(-(-i**0.5
        while True:
            if i%j == 0:
                i 
                C.append(j)
            else:
                break
    if i != 1:
        C.append(i)
        
    return set(C)

print(1+len(cal(x)))

Problem: p02900
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import gcd

A, B = map(int, input().split())

m = gcd(A, B)


num = int(m**0.5) + 1 
ans = 1

for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m = m/i

print(ans)


Failing test case input:
33 4794

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from math import gcd

A, B = map(int, input().split())

m = gcd(A, B)


num = int(m**0.5) 
ans = 1

for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m /= i

if m>1:
    ans+=1 

print(ans)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
import sys
A, B = map(int, input().split())

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

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


  return divisors

N = gcd(A, B)
if N == 1:
  print (1)
  sys.exit()

L = [2]
D = sorted(make_divisors(N))
for i in D[1:]:
  for j in L:
    if i % j == 0:
      break
  else:
    L.append(i)
print (len(L)+1)

Failing test case input:
12 18

Expected output:
3

Actual output:
2


Fixed submission (verdict: Accepted):
import math
import sys
A, B = map(int, input().split())

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

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

N = gcd(A, B)
if N == 1:
  print (1)
  sys.exit()

D = make_divisors(N)
L = []
for i in D[1:]:
  for j in L:
    if i % j == 0:
      break
  else:
    L.append(i)
print (len(L)+1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def common_divisor(a, b):
    
    res = []
    for i in range(2, int(a**0.5)+1):
        if a % i == 0 and b % i == 0:
            res.append(i)
            t = a 
            if i != t and b % t == 0:
                res.append(t)
    return sorted(res)

def primes_num(arr):
    res = 0
    for i in arr:
        flg = True
        rt_i = i**0.5
        for j in arr:
            if rt_i < j:
                break
            elif i % j == 0:
                flg = False
                break
        if flg: res += 1
    return res

A, B = sorted([int(i) for i in input().split()])


cds = common_divisor(A, B)
res = primes_num(cds)
print(res+1)


Failing test case input:
11 11968

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
A, B = sorted([int(i) for i in input().split()])

res = 1
for i in range(2, int(B**0.5)+1):
    if B % i == 0:
        if A % i == 0:
            for j in range(2, int(i**0.5)+1):
                if i % j == 0:
                    break
            else:
                res += 1
        t = B 
        if t != i and A % t == 0:
            for j in range(2, int(t**0.5)+1):
                if t % j == 0:
                    break
            else:
                res += 1

print(res if res > 1 else (1 if (A == B == 1) or A != B else 2))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B = map(int, input().split())
ls = []
ans = 0
for i in range(1, min(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    for n in range(2,int(i**0.5)+1):
      if i%n==0:
        break
    else:
      ans += 1
    j = A
    if (i!=1 and j%i==0) or j<=i:
      continue
    for n in range(2,int(j**0.5)+1):
      if j%n==0:
        break
    else:
      ans += 1
print(ans)

Failing test case input:
313 19

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import defaultdict
A, B = map(int, input().split())
ls = defaultdict(int)
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    if ls[i]==0:
      ls[i]=1
      for n in range(2,int(i**0.5)+1):
        if i%n==0:
          break
      else:
        ans += 1
  if A%i==0:
    j = A
    if B%j!=0:
      continue
  elif B%i==0:
    j = B
    if A%j!=0:
      continue
  else:
    continue
  if ls[j]==0:
    ls[j] = 1
  else:
    continue
  for n in range(2,int(j**0.5)+1):
    if j%n==0:
      break
  else:
    ans += 1
print(ans)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def isPrime(n):
    for i in range(2, int(n**(1/2))+2):
        if n % i == 0:
            return False
    return True

if __name__ == "__main__":    
    a, b = map(int, input().split())
    d_list = []
    for i in range(1, int(max(a, b)**(1/2))+2):
        if a%i == 0 and b%i == 0:
            d_list.append(i)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)


Failing test case input:
6 2844

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
def calcDiv(n):
    d_list = []
    for i in range(1, int(n**(1/2))+1):
        if n%i == 0:
            d_list.append(i)
            d_list.append(int(n/i))
    return d_list


def isPrime(n):
    for i in range(2, int(n**(1/2))+1):
        if n % i == 0:
            return False
    return True


if __name__ == "__main__":    
    a, b = map(int, input().split())
    a_list = calcDiv(a)
    b_list = calcDiv(b)
    d_list = set(a_list) & set(b_list)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
A,B = map(int, input().split())


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
for n in range(2,int(math.sqrt(x))+1):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p = list(set(p))
print(len(p))
  
  


Failing test case input:
420 1226

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math
A,B = map(int, input().split())


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p.append(1)
p = list(set(p))
print(len(p))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



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


def ff(x):
    if x == 1 or x == 2:
        return True
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0:
            return False
    return True


def f(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0 and ff(i):
            
            ret.append(i)
    return set(ret)


a_lis, b_lis = f(a), f(b)
common_lis = a_lis & b_lis
print(len(common_lis))

Failing test case input:
3 4371

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):




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


def ff(x):
    if x == 1 or x == 2:
        return True
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0:
            return False
    return True


def f(x):
    ret = []
    i = 1
    while i * i <= x:
        if x % i == 0:
            if ff(i):
                ret.append(i)
            
            if i != 1 and i * i != x:
                if ff(x 
                    ret.append(x 
        i += 1
    if ff(x):
        ret.append(x)
    return set(ret)


a_lis, b_lis = f(a), f(b)
common_lis = a_lis & b_lis
print(len(common_lis))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B = map(int, input().split())
ls = []
ans = 0
for i in range(1, min(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    for n in range(2,int(i**0.5)+1):
      if i%n==0:
        break
    else:
      ans += 1
    j = A
    if (i!=1 and j%i==0) or B%j!=0:
      continue
    for n in range(2,int(j**0.5)+1):
      if j%n==0:
        break
    else:
      ans += 1
print(ans)

Failing test case input:
1 2019

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
from collections import defaultdict
A, B = map(int, input().split())
ls = defaultdict(int)
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    if ls[i]==0:
      ls[i]=1
      for n in range(2,int(i**0.5)+1):
        if i%n==0:
          break
      else:
        ans += 1
  if A%i==0:
    j = A
    if B%j!=0:
      continue
  elif B%i==0:
    j = B
    if A%j!=0:
      continue
  else:
    continue
  if ls[j]==0:
    ls[j] = 1
  else:
    continue
  for n in range(2,int(j**0.5)+1):
    if j%n==0:
      break
  else:
    ans += 1
print(ans)

Problem: p02900
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import gcd

A, B = map(int, input().split())

m = gcd(A, B)


num = int(m**0.5) + 1 
print(num)
ans = 1

for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m = m/i

print(ans)


Failing test case input:
10 16

Expected output:
2


Actual output:
2
2


Fixed submission (verdict: Accepted):
from math import gcd

A, B = map(int, input().split())

m = gcd(A, B)


num = int(m**0.5) 
ans = 1

for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m /= i

if m>1:
    ans+=1 

print(ans)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import copy
import math
A,B = map(int, input().split())

num = min(A,B)
tmps = {}
p = 2
for p in range(2, math.ceil(num**0.5)+1):
    if A % p == 0 and B % p == 0:
        tmps[p] = True
    p += 1

if num != 1 and  A % num == 0 and B % num == 0:
    tmps[num] = True


d = copy.deepcopy(tmps)
for k in tmps.keys():
    
    if d.get(k, False):
        aaa = copy.deepcopy(d)
        for n in d.keys():
            if k == n:
                continue
            if n > k and n % k == 0:
                aaa.pop(n)
        d = aaa

print(len(d.keys())+1)



Failing test case input:
10 6430

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):

import copy
import math
A,B = map(int, input().split())

num = min(A,B)
tmps = {}
p = 2
for p in range(2, math.ceil(num**0.5)+1):

    if A % p == 0 and B % p == 0:
        tmps[p] = True

    if A % (num
        tmps[num

    p += 1

if num != 1 and  A % num == 0 and B % num == 0:
    tmps[num] = True


d = copy.deepcopy(tmps)
for k in tmps.keys():

    if d.get(k, False):
        aaa = copy.deepcopy(d)
        for n in d.keys():
            if k == n:
                continue
            if n > k and n % k == 0:
                aaa.pop(n)
        d = aaa

print(len(d.keys())+1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
if B==1:
    print(1)
else:
    count=2
    i=2
    while i**2<B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    print(count)

Failing test case input:
16 7064

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
if B==1:
    print(1)
else:
    count=1
    i=2
    while i**2<=B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    if B!=1:
        count+=1
    print(count)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt


def solve(n):
    res = set()
    for i in range(2, int(sqrt(n))+1):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))


Failing test case input:
11 11968

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from math import sqrt


def solve(n):
    res = set()
    for i in range(2, int(sqrt(n))+1):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    if n>1:
        res.add(n)
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import fractions

A, B = map(int, input().split())

lst = []
for i in range(1,int(min(A, B)**0.5+1)):
    if A % i == 0 and B % i == 0:
        lst.append(i)

if len(lst) == 1:
    print(1)
else:
    check = [lst[1]]
    for i in range(1, len(lst)):
        for c in check:
            if lst[i] % c == 0:
                break
        else:
            check.append(lst[i])
    print(len(check)+1)


Failing test case input:
3 4371

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
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 
                divisors.append(n 

    return divisors

A, B = map(int, input().split())

listA = make_divisors(A)
listB = make_divisors(B)
lst = list(set(listA) & set(listB))

lst.sort()

if len(lst) == 1:
    print(1)
else:
    check = [lst[1]]
    for i in range(1, len(lst)):
        for c in check:
            if lst[i] % c == 0:
                break
        else:
            check.append(lst[i])
    print(len(check)+1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def divisors(n):
    s = set()
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            s.add(x)
            n /= x
            if n == 1:
                break
    return s

a, b = map(int, input().split())
d = divisors(a) & divisors(b)
print(len(d) + 1)


Failing test case input:
10 6430

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import math

def divisors(n):
    s = set()
    for x in range(2, math.ceil(n ** 0.5) + 1):
        while n % x == 0:
            s.add(x)
            n /= x
            if n == 1:
                break
    if n > 1:
        s.add(n)
    return s
 
a, b = map(int, input().split())
d = divisors(a) & divisors(b)
print(len(d) + 1)

Problem: p02900
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
A, B = map(int, input().split())

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

x = gcd(A, B)
res = 1
if x != 1:
    i = 2
    while i <= int(x/2)+1:
        if x % i == 0:
            res += 1
            x /= i
            while x % i == 0:
                x /= i
        i += 1

print(res)

Failing test case input:
42 9

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
A, B = map(int, input().split())

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

x = gcd(A, B)

res = 1
temp = x
for i in range(2, int(-(-x**0.5
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp 
        res += 1

if temp!=1:
    res += 1

print(res)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        k /=2
        a.append(2)
    k =int(k)

    for x in range(3,k+1,1):
        if(k % x == 0):
            while k %x == 0:
                k/=x
                a.append(x)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
print(kouyaku)
soinsu =prime_F(kouyaku)
print(soinsu)
print(len(soinsu))

Failing test case input:
8 1324

Expected output:
2


Actual output:
4
[1, 2]
2


Fixed submission (verdict: Accepted):
def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        while k %2 == 0:
            k /=2
        a.append(2)
    k =int(k)

    for x in range(3,end,1):
        if k % x == 0:
            while k %x == 0:
                k/=x
            a.append(x)
            if k == 1:
                break
    if k != 1:
        a.append(k)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))
Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import statistics

n = int(input())
la = []
lb = []
for i in range(n):
  a, b = map(int, input().split())
  la.append(a)
  lb.append(b)
a = statistics.median(la)
b = statistics.median(lb)
if n % 2 == 1:
  print(b - a + 1)
else:
  print((b - a) * 2 + 1)


Failing test case input:
2
0 1
0 8

Expected output:
10


Actual output:
10.0


Fixed submission (verdict: Accepted):
import statistics

n = int(input())
la = []
lb = []
for i in range(n):
  a, b = map(int, input().split())
  la.append(a)
  lb.append(b)
a = statistics.median(la)
b = statistics.median(lb)
if n % 2 == 1:
  print(b - a + 1)
else:
  print(int((b - a) * 2 + 1))

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import statistics
import math
from decimal import *
N = int(input())

n =[]
m =[]

for i in range(N):
    a,b = list(map(int,input().split()))
    n.append(a)
    m.append(b)

nmean = Decimal(statistics.median(n))
mmean =Decimal(statistics.median(m))

if N%2 == 1:
    print(mmean - nmean + 1)
else:
    print(int(mmean - nmean)*2 +1 )

Failing test case input:
2
-31 -1
2 1

Expected output:
30


Actual output:
29


Fixed submission (verdict: Accepted):
import statistics
import math
from decimal import *
N = int(input())

n =[]
m =[]

for i in range(N):
    a,b = list(map(int,input().split()))
    n.append(a)
    m.append(b)

nmean = Decimal(statistics.median(n))
mmean =Decimal(statistics.median(m))

if N%2 == 1:
    print(mmean - nmean + 1)
else:
    print(int((mmean - nmean)*2) +1 )

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import statistics

N = int(input())
A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
Am = statistics.median(A)
Bm = statistics.median(B)

if N % 2 == 0:
    print(2 * round(Bm - Am) + 1)
else:
    print(Bm - Am + 1)

Failing test case input:
2
0 1
0 8

Expected output:
10


Actual output:
9


Fixed submission (verdict: Accepted):
import statistics

N = int(input())
A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
Am = statistics.median(A)
Bm = statistics.median(B)

if N % 2 == 0:
    print(round(2 * (Bm - Am) + 1))
else:
    print(Bm - Am + 1)

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


N = int(input())

ab = []

for i in range(N):
  ab.append(tuple(map(int,input().split())))

ab.sort()
  
import statistics
import math

am = statistics.median([i[0] for i in ab])
bm = statistics.median([i[1] for i in ab])

print(am,bm)
if am%0.5 != 0:
  print(bm-am+1)
else:
  print(int(bm-am+2))


Failing test case input:
3
000 010
8 01000
2 1001000000

Expected output:
999


Actual output:
2 1000
1000


Fixed submission (verdict: Accepted):


N = int(input())

ab = []

for i in range(N):
  ab.append(tuple(map(int,input().split())))

ab.sort()
  
import statistics
import math

am = statistics.median([i[0] for i in ab])
bm = statistics.median([i[1] for i in ab])

if N%2 != 0:
  print(bm-am+1)
else:
  print(int((bm-am)*2+1))
Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
aa = []
bb = []
for _ in range(n):
    a, b = map(int, readline().split())
    aa.append(a)
    bb.append(b)
aa.sort()
bb.sort(reverse=True)
if n % 2 == 0:
    print(bb[0] - aa[0] + 1)
else:
    print(bb[1] - aa[1] + 1)


Failing test case input:
2
1 1
2 4

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
aa = []
bb = []
for _ in range(n):
    a, b = map(int, readline().split())
    aa.append(a)
    bb.append(b)
aa.sort()
bb.sort()
if n % 2 == 1:
    print(bb[n 
else:
    print(bb[n

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import statistics

N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
Am = statistics.median(A)
Bm = statistics.median(B)

if N % 2 == 0:
    print(round(2 * Bm - Am) + 1)
else:
    print(Bm - Am + 1)

Failing test case input:
2
-46 -1
2 0

Expected output:
44


Actual output:
22


Fixed submission (verdict: Accepted):
import statistics

N = int(input())
A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
Am = statistics.median(A)
Bm = statistics.median(B)

if N % 2 == 0:
    print(round(2 * (Bm - Am) + 1))
else:
    print(Bm - Am + 1)

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = []
B = []
for i in range (0,N):
	a, b = map(int, input().split())
	A.append(a)
	B.append(b)
    
A = sorted(A)
B = sorted(B)

if N%2 ==1:
	print(B[int((N+1)/2)-1]-A[int((N+1)/2)-1]+1)
else:
	print(B[int(N/2)]+A[int(N/2)]-B[int(N/2)-1]-A[int(N/2)-1]+1)

Failing test case input:
2
2 0
9 2

Expected output:
-8


Actual output:
10


Fixed submission (verdict: Accepted):
N = int(input())
A = []
B = []
for i in range (0,N):
	a, b = map(int, input().split())
	A.append(a)
	B.append(b)
    
A = sorted(A)
B = sorted(B)

from statistics import median

if N%2 ==1:
	print(median(B)-median(A)+1)
else:
	print(int((median(B)-median(A))*2+1))
Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import median

n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]

a = [ab[i][0] for i in range(n)]
b = [ab[i][1] for i in range(n)]

if n % 2 == 0:
    ma, mb = median(a), median(b)
    print(int(mb - ma) * 2 + 1)
if n % 2 == 1:
    ma, mb = median(a), median(b)
    print(int(mb - ma + 1))




Failing test case input:
2
0 6
10 -1

Expected output:
-4


Actual output:
-3


Fixed submission (verdict: Accepted):
from statistics import median

n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]

a = [ab[i][0] for i in range(n)]
b = [ab[i][1] for i in range(n)]

if n % 2 == 0:
    ma, mb = median(a), median(b)
    print(int(2 * mb - 2 * ma + 1))
if n % 2 == 1:
    ma, mb = median(a), median(b)
    print(int(mb - ma + 1))

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
aa = []
bb = []
for _ in range(n):
    a, b = map(int, readline().split())
    aa.append(a)
    bb.append(b)
aa.sort()
bb.sort(reverse=True)
if n == 2:
    print(bb[0] - aa[0] + 1)
else:
    print(bb[1] - aa[1] + 1)


Failing test case input:
2
0 2
-2 1

Expected output:
6


Actual output:
5


Fixed submission (verdict: Accepted):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
aa = []
bb = []
for _ in range(n):
    a, b = map(int, readline().split())
    aa.append(a)
    bb.append(b)
aa.sort()
bb.sort()
if n % 2 == 1:
    print(bb[n 
else:
    print(bb[n

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import median

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

mn = median(A)
mx = median(B)

if N % 2 == 1:
    print(int(mx - mn + 1))        
else:
    print(int(mx - mn * 2 + 1))    

Failing test case input:
2
0 2
-1 23

Expected output:
27


Actual output:
14


Fixed submission (verdict: Accepted):
from statistics import median

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

mn = median(A)
mx = median(B)

if N % 2 == 1:
    print(int(mx - mn + 1))        
else:
    print(int((mx - mn) * 2 + 1))
Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import median

n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
m_a = median(A)
m_b = median(B)
m = m_b - m_a
if m == 0:
    print(1)
    exit()
if n%2 == 0:
    m += 2
else:
    m += 1

print(int(m))


Failing test case input:
2
1 0
16 1

Expected output:
-15


Actual output:
-6


Fixed submission (verdict: Accepted):
from statistics import median

n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
m_a = median(A)
m_b = median(B)

if n%2 == 0:
    ans = (m_b - m_a)*2 + 1
else:
    ans = m_b - m_a + 1
print(int(ans))

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import median
N=int(input())
a,b=[],[]

for i in range(N):
  i,j=map(int,input().split())
  a.append(i)
  b.append(j)
amed,bmed=median(a),median(b)
  
if N%2==1:
  print(bmed-amed+1)
else:
  print(2*(bmed-amed)+1)

Failing test case input:
2
0 1
1 7

Expected output:
8


Actual output:
8.0


Fixed submission (verdict: Accepted):
from statistics import median
N=int(input())
a,b=[],[]

for i in range(N):
  i,j=map(int,input().split())
  a.append(i)
  b.append(j)
amed,bmed=median(a),median(b)
  
if N%2==1:
  print(int(bmed-amed+1))
else:
  print(int(2*(bmed-amed)+1))

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import median

n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
m_a = median(A)
m_b = median(B)
m = m_b - m_a
if n%2 == 0:
    m += 2
else:
    m += 1

print(int(m))


Failing test case input:
2
0 1
0 7

Expected output:
9


Actual output:
6


Fixed submission (verdict: Accepted):
from statistics import median

n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
m_a = median(A)
m_b = median(B)

if n%2 == 0:
    ans = (m_b - m_a)*2 + 1
else:
    ans = m_b - m_a + 1
print(int(ans))

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import*
(n,),*t=[map(int,t.split())for t in open(0)]
a,b=map(median,zip(*t))
print(int(b-a)*(2-n%2)+1)

Failing test case input:
2
5 -1
9 0

Expected output:
-14


Actual output:
-13


Fixed submission (verdict: Accepted):
from statistics import*
(n,),*t=[map(int,t.split())for t in open(0)]
a,b=map(median,zip(*t))
print(int((b-a)*(2-n%2))+1)
Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
AB = [tuple(map(int, input().split())) for i in range(n)]
A = [AB[i][0] for i in range(n)]
B = [AB[i][1] for i in range(n)]



A.sort()
B.sort()

if n % 2 == 1:
    print(B[n % 2] - A[n % 2] + 1)

if n % 2 == 0:
    print(B[n % 2 + 1] - A[n % 2] + 1)


Failing test case input:
2
0 2
-2 1

Expected output:
6


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
AB = [tuple(map(int, input().split())) for i in range(n)]
A = [AB[i][0] for i in range(n)]
B = [AB[i][1] for i in range(n)]



A.sort()
B.sort()

if n % 2 == 1:
    print(B[n 


if n % 2 == 0:
    
    
    
    

    
    a = A[n 
    b = B[n 
    print(b - a + 1)

Problem: p02661
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import statistics

N = int(input())
P = [[int(i) for i in input().split()] for _ in range(N)]


left = []
right = []

for i in range(N):
    left.append(P[i][0])
    right.append(P[i][1])

lmed = statistics.median(left)
rmed = statistics.median(right)

if N % 2 == 0:
    print(int(rmed - lmed) * 2 + 1)
else:
    print(rmed - lmed+1)


Failing test case input:
2
-31 -1
2 1

Expected output:
30


Actual output:
29


Fixed submission (verdict: Accepted):
import statistics

N = int(input())
P = [[int(i) for i in input().split()] for _ in range(N)]


left = []
right = []

for i in range(N):
    left.append(P[i][0])
    right.append(P[i][1])

lmed = statistics.median(left)
rmed = statistics.median(right)

if N % 2 == 0:
    print(int((rmed - lmed) * 2 + 1))
else:
    print(rmed - lmed + 1)

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import median

N = int(input())
A = [0] * N
B = [0] * N
for c in range(N):
    A[c], B[c] = map(int, input().split())

A_med = median(A)
B_med = median(B)

if N % 2 == 0:
    print(2 * (B_med - A_med) + 1)
else:
    print(B_med - A_med + 1)


Failing test case input:
2
0 0
-1 14

Expected output:
16


Actual output:
16.0


Fixed submission (verdict: Accepted):
from statistics import median

N = int(input())
A = [0] * N
B = [0] * N
for c in range(N):
    A[c], B[c] = map(int, input().split())

A_med = median(A)
B_med = median(B)

if N % 2 == 0:
    print(round(2 * (B_med - A_med) + 1))
else:
    print(B_med - A_med + 1)

Problem: p02661
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N % 2 == 1:
    print(B[-2]-A[1]+1)
else:
    print(B[-2]-A[1]+3)


Failing test case input:
2
5 0
9 0

Expected output:
-13


Actual output:
-6


Fixed submission (verdict: Accepted):
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N % 2 == 1:
    ans = B[N
    print(ans)
else:
    vmin = A[N
    vmax = B[N
    ans = vmax-vmin+1
    print(ans)
Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import median

n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
m_a = median(A)
m_b = median(B)
m = int(m_b - m_a)
for tmp in [m_a, m_b]:
    if type(tmp) is float:
        m += 1

if n%2 == 1:
    print(m + 1)
else:
    print(m)

Failing test case input:
2
0 0
-1 14

Expected output:
16


Actual output:
9


Fixed submission (verdict: Accepted):
from statistics import median

n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
m_a = median(A)
m_b = median(B)

if n%2 == 0:
    ans = (m_b - m_a)*2 + 1
else:
    ans = m_b - m_a + 1
print(int(ans))

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


N = int(input())

ab = []

for i in range(N):
  ab.append(tuple(map(int,input().split())))
  
import statistics
import math

am = statistics.median([i[0] for i in ab])
bm = statistics.median([i[1] for i in ab])

if N%2==1:
  print(bm-am+1)
else:
  print(int(bm-am+2))


Failing test case input:
2
-19 -2
-2 2

Expected output:
22


Actual output:
12


Fixed submission (verdict: Accepted):


N = int(input())

ab = []

for i in range(N):
  ab.append(tuple(map(int,input().split())))

ab.sort()
  
import statistics
import math

am = statistics.median([i[0] for i in ab])
bm = statistics.median([i[1] for i in ab])

if N%2 != 0:
  print(bm-am+1)
else:
  print(int((bm-am)*2+1))

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from statistics import median


def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        a[i], b[i] = map(int, input().split())
    ans = int(median(b) - median(a))
    if n % 2 == 0:
        ans *= 2
    ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
2
0 0
-1 14

Expected output:
16


Actual output:
15


Fixed submission (verdict: Accepted):
from statistics import median


def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        a[i], b[i] = map(int, input().split())
    ans = median(b) - median(a)
    if n % 2 == 0:
        ans *= 2
    ans = int(ans)
    ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import statistics
import math
N = int(input())

n =[]
m =[]

for i in range(N):
    a,b = list(map(int,input().split()))
    n.append(a)
    m.append(b)

nmean = statistics.median(n)
mmean =statistics.median(m)

if N%2 == 1:
    print(mmean - nmean + 1)
else:
    print(int(mmean - nmean)*2 +1 )

Failing test case input:
2
1 -1
11 0

Expected output:
-12


Actual output:
-11


Fixed submission (verdict: Accepted):
import statistics
import math
from decimal import *
N = int(input())

n =[]
m =[]

for i in range(N):
    a,b = list(map(int,input().split()))
    n.append(a)
    m.append(b)

nmean = Decimal(statistics.median(n))
mmean =Decimal(statistics.median(m))

if N%2 == 1:
    print(mmean - nmean + 1)
else:
    print(int((mmean - nmean)*2) +1 )
Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
ab=[list(map(int, input().split())) for _ in range(n)]
a=[]
b=[]
for a_i, b_i in ab:
    a.append(a_i)
    b.append(b_i)
a.sort()
b.sort()

import statistics
a_med=statistics.median(a)
b_med=statistics.median(b)

if n%2==0:
    print(int(int(b_med-a_med)/0.5+1))
else:
    print(int(b_med-a_med+1))


Failing test case input:
2
5 -1
9 0

Expected output:
-14


Actual output:
-13


Fixed submission (verdict: Accepted):
n=int(input())
ab=[list(map(int, input().split())) for _ in range(n)]
a=[]
b=[]
for a_i, b_i in ab:
    a.append(a_i)
    b.append(b_i)
a.sort()
b.sort()

import statistics
a_med=statistics.median(a)
b_med=statistics.median(b)

if n%2==0:
    ans=2*b_med-2*a_med+1
else:
    ans=b_med-a_med+1
print(int(ans))

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import statistics
n=int(input())
r=set([])
x=[[]]*n
for i in range(n):
  a,b=list(map(int,input().split()))
  x[i]=[a,b]
r0=statistics.median([x[z][0] for z in range(n)])
r1=statistics.median([x[z][1] for z in range(n)])
if ((r0*2) % 2)>0 or ((r1*2) % 2)>0:
  mult=2
else:
  mult=1
mult=int((r1-r0)*mult+1)
print(mult)

Failing test case input:
2
0 0
10 0

Expected output:
-9


Actual output:
-4


Fixed submission (verdict: Accepted):
import statistics
n=int(input())
r=set([])
x=[[]]*n
for i in range(n):
  a,b=list(map(int,input().split()))
  x[i]=[a,b]
r0=statistics.median([x[z][0] for z in range(n)])
r1=statistics.median([x[z][1] for z in range(n)])
addnum = 1
if ((r0*2) % 2)>0 and ((r1*2) % 2)>0:
  mult=2
  addnum = 1
elif ((r0*2) % 2)>0:
  mult=2
  addnum = 0  
elif ((r1*2) % 2)>0:
  mult=2
  addnum = 0  
else:
  mult=1
  addnum = 1


if n%2 ==0:
  mult=2
else:
  mult=1
addnum=1
mult=int((r1-r0)*mult+addnum)
print(mult)

Problem: p02661
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import statistics
import math

n = int(input())
 
a = []
for _ in range(n):
    a.append(list(map(int,input().split())))

b = [[],[]]
for i in range(n):
    b[0].append(a[i][0])
    b[1].append(a[i][1])

x = statistics.median(b[0])
y = statistics.median(b[1])

if n % 2 != 0:
    ans = y - x + 1

else:
    ans = round(y - x) * 2 + 1

print(ans)

Failing test case input:
2
2 0
9 2

Expected output:
-8


Actual output:
-7


Fixed submission (verdict: Accepted):
import statistics
import math

n = int(input())
 
a = []
for _ in range(n):
    a.append(list(map(int,input().split())))

b = [[],[]]
for i in range(n):
    b[0].append(a[i][0])
    b[1].append(a[i][1])

x = statistics.median(b[0])
y = statistics.median(b[1])

if n % 2 != 0:
    ans = y - x + 1

else:
    ans = round((y - x) * 2) + 1

print(ans)