Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02676 (python)

Fixed submission:
#K input for the range of S
K = int(input())
#input of lowercase english letters
S = input()
if len(S) > K:
    print(S[:K] + "...")
else:
    print(S)

Buggy submission (verdict: Runtime Error):
string=input()
number=int(input())
characters=len(string)
empty=""
if characters<=number:
    print(string)
else:
    i=0
    while i<number:
        empty+=string[i]
        i=i+1
    print(f"{empty}...")

Buggy submission (verdict: Runtime Error):
a=input() #len input
b=input() #string input
if len(b)>int(a): # if exceed the len given
    print(b[:int(a)],"...",sep = "") #print up to a
else:
    print(c)

Buggy submission (verdict: Runtime Error):

def convert(S): 
    str1 = ""  # initialization of string to "" 
    return(str1.join(S))    # using join function join the list s by  
                            # separating words by str1


K = int(input())    # take K from user
readtext= str(input())  # take the input string 

S = list(readtext)   #split the string into charactrers and put them to list
list1=list()  #list 1 

for i in range (0 , K): # for looop to append the charachters to the new list
    a = S[i]
    list1.append(a) # appending the charachters to the list
if len(list1) > K:  # condition when number of charachters is big than K
    b = "..."
    list1.append(b) # append the 3 dots 

print(convert(list1)) # convert the list of characters back to the string format

Buggy submission (verdict: Runtime Error):
a=input() #len input
b=input() #string input
if len(b)>int(a): # if exceed the len given
    print(b[:int(a)],"...")
else:
    print(c)

Buggy submission (verdict: Runtime Error):
k=int(input())
s=input()
if lens(s)>k:
    print(s[:k]+"..")
else:
    print(s)
s[5:]

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()

str = S

#if same, no change
if lens(S) == k:
                         print(str)

else:
         print (str[0:K] +"...")

Buggy submission (verdict: Runtime Error):
K = int(input())
S= input()

str = S

#if same, no change
if lens(s) == K:
                         print(S)

else:
         print (str[0:K] +"...")
Problem p02711 (python)

Fixed submission:
n=int(input())
a=set()
while n!=0 :
    rem=n%10
    a.add(rem)
    n/=10
if 7 in a :
    print("Yes")
    
else :
    print("No")

Buggy submission (verdict: Runtime Error):
temp=list(map(int,input().rstrip().split()))
n=temp[0]
S=temp[1]
summ=0
count=0
while summ<S :
    if (S-summ)>=n :
        summ+=n

        count+=1
    else :
        count+=1
        break
print(count)
Problem p02729 (python)

Fixed submission:
a = list(map(int, input().rstrip().split()))
out=0
for i in a:
    if i > 1:
        out += i*(i-1)//2
print(out)

Buggy submission (verdict: Runtime Error):
import math
def f(x):
    return math.factorial(x)
arr=list(map(int,input().split()))
n=arr[0]
m=arr[1]
cnt=0
cnt+=int(f(n)/(2*f(n-2)))
if m>1:cnt+=int(f(m)/(2*f(m-2)))
print(int(cnt))
Problem p02766 (python)

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

cnt = 0
while (n) :
    cnt += 1
    n //= k

print (cnt)

Buggy submission (verdict: Runtime Error):
N,K=input().split()
n,k=int(N),int(K)

for i in range(0,1000000):
  
    if n-k**i>1:
        print(i)
        break
    if n=k**i-1:
        print(i-1)
        break
Problem p02771 (python)

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

c1 = n.count(n[0])
c2 = n.count(n[1])
if c1==2 or c2 == 2:
  print('Yes')
else:
  print("No")

Buggy submission (verdict: Runtime Error):
#include<stdio.h>
void main( )
{
int e,f,g;
scanf("%d%d%d", &e, &f, &g);
int count = 0;
if( e==f && f!=g)
count=1;
if( f==g && g!=f)
count=1;
if( g==e && e!=f)
count=1;

if(count==1)
{
 printf("Yes");
}
else
{
printf("No");
}
}

Buggy submission (verdict: Runtime Error):
A,B,C=input().split()
a=int(A)
b=int(B)
c=int(C)
if a==b or b==c or a==c:
    if not(a==b and b==c):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
#include <stdio.h>

int main()
{
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    if((a==b && a != c) || (a==c && a != b) || (c==b && a != c))
    printf("Yes");
    else
    printf("No");

    return 0;
}

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
if a==b or b==c or a==c:
    if not(a==b and b==c):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def poor(a,b,c):
    if (a==b and a!=c) or (b==c and b!=a) or (a==c&&a!=b):
        print("Yes")
    else:
        print("No")
        
A,B,C = input().split()
a = A
b = B
c = C
d = poor(a,b,c)
print(d)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

if a==b or b==c or a==c:
    print("Yes")
else:
    print("No")
Problem p02773 (python)

Fixed submission:
N=input()
n=int(N)

p=[]
for i in range(n):
    p.append(input())

ha = {}

for i in p :
    if (i not in ha.keys()) :
        ha[i] = 1
    else :
        ha[i] += 1

res = ha.items()

res = sorted(ha.items(), key = lambda x : x[1] , reverse = True )

i = 1
k = res[0][1]

while (i < len(res) and res[i][1] == k) :
    i += 1

res = res[ : i]

res.sort()
for i in res :
    print (i[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
ha={}

for i in range (n):
    s.append(input())
    if (s[i] not in ha.keys()):
        ha[s[i]]=1
    else:
        ha[s[i]]=ha[s[i]]+1

ans=sorted(ha.items(),key=lambda x:x[i], reverse=True)

k=ans[0][1]
i=0
while (i< len(ans) and ans[i][1]==k):
    i+=1

ans=ans[:i]
ans.sort()
for ss in ans:
    print(ss[0])

Buggy submission (verdict: Runtime Error):
import math


n = int(input())
candidates = {}


for _ in range(n):
    inp = input()
    if inp in candidates:
        candidates[inp] += 1
    else:
        candidates[inp] = 1


max_votes = -math.inf
for candidate, votes in candidates.items():
    if votes >= max_votes:
        max_votes = votes

winners = []
for candidate, votes in candidates.items():
    if votes == max_votes:
        winners.append(candidate)

winners.sort()

for winner in winners:
    print(winner)
Problem p02785 (python)

Fixed submission:
from sys import stdin

def main():
    n,m = map(int,stdin.readline().split())
    l = list(map(int,stdin.readline().split()))
    l.sort()
    aco = 0
    for i in range(n-m):
        aco+= l[i]
    print(aco)
        
main()

Buggy submission (verdict: Runtime Error):
special_moves = input().split(" ")

_, special_moves = int(inputs[0]), int(inputs[1])

health= input().split(" ")
health= [int(h) for h in health]
health.sort(reverse=True)
print(sum(health[special_moves:]))
Problem p02859 (python)

Fixed submission:
print(int(input())**2)














###################################################################

Buggy submission (verdict: Runtime Error):
r = input()

print int(r*r)

Buggy submission (verdict: Runtime Error):
print(int(r*r))
Problem p02879 (python)

Fixed submission:
import sys
import math
import bisect
 
 
sys.setrecursionlimit(1000000000)
def input():
    return sys.stdin.readline().strip()
 
def iinput():
    return int(input())
 
def finput():
    return float(input())
 
def tinput():
    return input().split()
 
def rinput():
    return map(int, tinput())
 
def rlinput():
    return list(rinput())
 
def modst(a, s):
    res = 1
    while s:
        if s % 2:
            res *= a
        a *= a
        s //= 2
    return res

 
def main():
    a, b = rinput()
    if a >= 10 or b >= 10:
        print(-1)
    else:
        print(a * b)
main()

Buggy submission (verdict: Runtime Error):
a = int(input());
b = int(input());

if (a >= 1 and a <= 9 and b >= 1 and b <= 9):
  print(a*b)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
A=variable
B=variable_2
A=1
B=1
C=A*B
while A and B <= 9;
	print(A*B)
	A=A+1
	B=B+1
print(A*B)

Buggy submission (verdict: Runtime Error):
def main(a, b):
    if a>9:
        return -1
    if b>9:
        return -1
        
    return a*b

inp = input().split();
a = int(inp[0])
b = int(inp[1])
print(main(a,b))
Problem p02880 (python)

Fixed submission:
numeros = [1,2,3,4,5,6,7,8,9]
multiplicaciones = []

for x in numeros:
	for z in numeros:
		multiplicaciones.append(x*z)
		pass
	pass
entrada = int(input())
si = False
for x in multiplicaciones:
	if(x==entrada):
		si=True
		break

if(si):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
s=int(input)
def c(x):
  co=0
  for i in range(1,10):
    if x%i==0 and x//i<=9:
      co+=1
  if co>0:
    return("Yes")
  else:
    return("No")
print(c(s))
Problem p02987 (python)

Fixed submission:
S = input()
c = 0
for i in S:
  if S.count(i) == 2:
    c = c + 1
if (c == 4):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
a = set()
for i in s: a.add(i)
if len(a) == 2 and s.count(a[0]) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
cnt=0;a=0
res = []
for i in s:
    if i not in res:
        res.append(i)
for i in s:
    if res[0]==i:
        cnt+=1
    if res[1]==i:
        a+=1
if a==2 and cnt==2:
    print("Yes")
else:print("No")
Problem p03011 (python)

Fixed submission:
a=[int(n) for n in input().split()]
a.sort()
print(a[0]+a[1])

Buggy submission (verdict: Runtime Error):
k=list(map(int,input().split().strip()))
kk=max(k)
k.remove(kk)
print(sum(k))
Problem p03018 (python)

Fixed submission:
def test(s):

	res = 0
	aAdd = 0
	last = ''
	tmp = ''
	for i in xrange(len(s)):
		if tmp and tmp > i:
			continue
		if s[i] == 'A':
			aAdd += 1
		elif s[i:i+2] == 'BC':
			# print aAdd
			res = res + aAdd
			tmp = i + 2
		else:
			aAdd = 0
			last = s[i]


	return res
s=raw_input()
print test(s)

Buggy submission (verdict: Runtime Error):
s = raw_input()
def test(s):

	res = 0
	aAdd = 0
	last = ''
	s1 = s
	tmp = ''
	for i in xrange(len(s)-2):
		if tmp and tmp > i:
			continue
		if s1[i] == 'A' and (not last or last == 'A'):
			aAdd += 1
		else:
			aAdd = 0
			last = s1[i]

		if s1[i:i+3] == 'ABC':
			print s1
			print aAdd
			res = res + aAdd
			last = 'A'
			aAdd -= 1
			tmp = i + 2
			s1 = s1[:i] + 'BCA' + s1[i+3:]

	return res
print test(s)

Buggy submission (verdict: Runtime Error):
s = raw_input()
# a, b = s.split(' ')
# a, b = int(a), int(b)
n = 0

def mul(s, n):
    if len(s) < 3:
        return 0
    for i in range(len(s) - 2):
        str = s[i:(i+3)]
        if str == "ABC":
            n = n + 1
            print(s[:i] + "BCA"+ s[i+3:])
            return mul(s[:i] + "BCA"+ s[i+3:], n)
            # _str[i:i+3] = "BCA"+ _str[i+3:]
    return n
print(mul(s,n))
Problem p03075 (python)

Fixed submission:
antenas = []
k = 0
for i in range(6):
    if i == 5:
        k = int(input())
    else:
        antenas.append(int(input()))
antenas.sort()
dist = antenas[-1] - antenas[0]
if dist > k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if a < b :
    if b < c :
        if c < d:
            if d < e:
                if e < k:
                    ab = b-a
                    ac = c-a
                    ad = d-a
                    ae = e-a
                    bc = c-b
                    bd = d-b
                    be = e-b
                    cd = d-c
                    ce = e-c
                    de = e-d

                    lista = [ab,ac,ad,ae,bc,bd,be,cd,ce,de]
                    x = max(lista)

if x <= 15:
    print("Yay!")
else:
    print(":(")
Problem p03107 (python)

Fixed submission:
num = input()
predicted_value = 0
finished = False
i = 1
while i < len(num):
    if num[i] != num[i-1]:
        num = num[:i-1] + num[i+1:]
        predicted_value += 2
        if i > 1:
            i -= 2
        elif i == 1:
            i = 0
    i += 1
print(predicted_value)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
e=[]
o=[]
s=0

for i in range(n):
    if(int(a[i])==1):
        s+=1
    else:
        e.append(s)
        if(s==n):
            break
        for j in range(i,n):
            f=0
            if(int(a[j])==0):
                s+=1
            else:
                e.append(s)
                if(s==n):
                    break
                for k in range(j,n):
                    if(int(a[k])==1):
                        s+=1
                    else:
                        e.append(s)
                        if(s==n):
                            break
                        f=1
                        break
                if(f==1):
                    break
        
        e.append(s)
        if(s==n):
            break
        s=0
e.append(s)
if(len(e)==0):
    print("0")
else:
    print(max(e))
#print(o)
Problem p03252 (python)

Fixed submission:
s=raw_input()
t=raw_input()
if [s.find(i) for i in s] == [t.find(j) for j in t]:
 print 'Yes'
else:
 print 'No'

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
s=list(S)
t=list(T)
ss=[]
tt=[]
for i in range('a',chr(ord('z')+1)):
    a=s.count(i)
    ss.append(a)
    b=t.count(i)
    tt.append(b)
ss.sort()
tt.sort()
if ss==tt:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
s=list(S)
t=list(T)
ss=[]
tt=[]
for i in range(‘a’,chr(ord('z')+1)):
    a=s.count(i)
    ss.append(a)
    b=t.count(i)
    tt.append(b)
ss.sort()
tt.sort()
if ss==tt:
    print("Yes")
else:
    print("No")
Problem p03272 (python)

Fixed submission:
k=list(map(int , input().split()))
N=k[0]
i=k[1]
print(N-i+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
i=int(input())
j=o

j=N-i+1

print(j)

Buggy submission (verdict: Runtime Error):
n =int(input("enter number of car_train. "))
i = int(input("enter ith from the front  of train . "))

if n == i:
    print (1)
else :
    print ((n-i)+1)
Problem p03286 (python)

Fixed submission:
n = int(input())
if n == 0:
  print('0')
  exit()
s = ''
while n != 0:
    s = str(n%2)+s
    n //= 2
    n *= -1
print(s)

Buggy submission (verdict: Runtime Error):
n = input()
negBase = -2

if (n == 0): 
    converted = "0"

else:
    converted = "01"
    while (n != 0):           
        remainder = n % (negBase) 
        n = int(n/negBase) 
  
        if (remainder < 0): 
            remainder += ((-1) * negBase) 
            n += 1
  
        converted = str(remainder) + converted 
          
    converted = converted[0:len(converted)-2]

print(converted)
Problem p03307 (python)

Fixed submission:
a = int(input())
i=1
if a%2==0 and a%a==0:
  print(a)
else:
 print(a*2)

Buggy submission (verdict: Runtime Error):
line = input()
X = [int(n) for n in line.split()]

smaller_divisible_number = X
if num%2 != 0:
    smaller_divisible_number *= 2
print(smaller_divisible_number)

Buggy submission (verdict: Runtime Error):
# -*-coding=utf-8-*-
n = int(input))
if n%2:
    n *= 2
print(n)
Problem p02570 (python)

Fixed submission:
d, t, s = map(int, input().split())
a = d / s
if a <= t:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def get_primes(n):
    max_p = int(n ** 0.5)
    p = 0 # 素数
    pl = []  # 素数リスト
    el = [i for i in range(2, n + 1)]  # 探索リスト
    while p <= max_p:
        nxt = []
        p = el[0]
        pl.append(p)
        for e in el:
            if e % p == 0:
                # D[e] = p
                pass
            else:
                nxt.append(e)
        el = nxt
    return pl


N = int(input())
a = list(map(int, input().split()))

is_pc = True
is_sc = True

p_list = get_primes(N)
for p in p_list:
    t = [int(x % p == 0) for x in a]
    s = sum(t)
    if s >= 2:
        is_pc = False
    if s == N:
        is_sc = False
        break
if is_pc:
    print('pairwise coprime')
elif is_sc:
    print('setwise coprime')
else:
    print('not coprime')
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
ls = len(s)
lt = len(t)

a = []
sum_ = 0
for i in range(ls-lt+1):
    ss = s[i:i+lt]
    sum_ = 0
    for i, alb in enumerate(t):
        if alb == ss[i]:
            sum_+= 1
    a.append(sum_)

print(lt - max(a))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ls = len(s)
lt = len(t)

a = []
sum_ = 0
for i in range(ls-lt+1):
    ss = s[i:i+lt]
    sum_ = 0
    for i, alb in enumerate(lt):
        if alb == ss[i]:
            sum_+= 1
    a.append(sum_)

print(lt - max(a))
Problem p02598 (python)

Fixed submission:
import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n, k = ns()
    a = na()
    a.sort(reverse=True)
    upper = 10**9 + 1
    under = 0

    while upper - under > 1:
        middle = (upper + under) // 2

        tk = k
        flg = True
        for ai in a:
            if ai <= middle:
                break

            ta = ai
            tk -= int(ta // middle)
            if tk < 0:
                flg = False
                break

        if flg:
            upper = middle
        else:
            under = middle

    if k == 0:
        print(max(a))
    else:
        print(math.ceil((upper + under) / 2))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n, k = ns()
    a = na()
    a.sort(reverse=True)
    upper = 10 ** 9 + 1
    under = 0

    while upper - under > 0.01:
        middle = (upper + under) // 2

        tk = k
        flg = True
        for ai in a:
            if ai <= middle:
                break

            ta = ai
            tk -= int((ta - middle) / middle)
            if tk < 0:
                flg = False
            break

        if flg:
            upper = middle
        else:
            under = middle

    print(math.ceil(under))


if __name__ == '__main__':
    main()
Problem p02623 (python)

Fixed submission:
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, m, k = ns()
    a = na()
    b = na()

    perm_a = [0 for _ in range(n + 1)]
    perm_b = [0 for _ in range(m + 1)]

    for i, ai in enumerate(a):
        perm_a[i + 1] = perm_a[i] + ai

    for i, bi in enumerate(b):
        perm_b[i + 1] = perm_b[i] + bi

    perm_a.append(INF)
    perm_b.append(INF)

    ans = 0
    for i, pa in enumerate(perm_a):
        bserch = k - pa
        if bserch < 0:
            continue
        if bserch == 0:
            ans = max(ans, i)
            continue

        idx = bisect.bisect_left(perm_b, bserch)
        tmp_ans = i + idx - 1
        if perm_b[idx] == bserch:
            tmp_ans += 1
        ans = max(ans, tmp_ans)

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, m, k = ns()
    a = na()
    b = na()

    a_idx = 0
    b_idx = 0
    ans = 0
    cnt = 0
    while True:
        if a_idx == n and b_idx == m:
            break

        if a_idx != n:
            if a[a_idx] < b[b_idx]:
                if ans + a[a_idx] > k:
                    break
                else:
                    ans += a[a_idx]
                    a_idx += 1
                    cnt += 1
            else:
                if ans + b[b_idx] > k:
                    break
                else:
                    ans += b[b_idx]
                    b_idx += 1
                    cnt += 1
        else:
            if ans + b[b_idx] > k:
                break
            else:
                ans += b[b_idx]
                b_idx += 1
                cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()
Problem p02661 (python)

Fixed submission:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = []
    b = []
    for _ in range(n):
        ai, bi = ns()
        a.append(ai)
        b.append(bi)

    a.sort()
    b.sort()

    if n % 2:
        ans = b[n // 2] - a[n // 2] + 1
    else:
        ans = b[n // 2] + b[n // 2 - 1] - (a[n // 2] + a[n // 2 - 1]) + 1
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = []
    b = []
    d = []
    for _ in range(n):
        ai, bi = ns()
        a.append(ai)
        b.append(bi)
        d.append((ai, bi))

    a.sort()
    b.sort()

    odd = n % 2 == 1
    even = n % 2 == 0
    min_choice = a[n // 2 - even]
    max_choice = b[n // 2]

    kouho = []
    for ai, bi in d:
        tmp = range(max(ai, min_choice), min(bi, max_choice))
        if len(tmp) > 0:
            kouho.append(tmp)

    dic_even = dict()
    dic_odd = dict()

    for k in kouho:
        for t in k:
            dic_even[t] = 0

    for i in range(len(kouho)):
        for t in kouho[i]:
            for j in range(i + 1, len(kouho)):
                for l in kouho[j]:
                    dic_odd[(t + l) / 2] = 0
    
    e = set(dic_even.keys())
    o = set(dic_odd.keys())
    
    ans = e+o
    print(len(ans))


if __name__ == '__main__':
    main()