Problem:


Score : 100 points

Problem Statement

We conducted a survey on newspaper subscriptions.
More specifically, we asked each of the N respondents the following two questions:

Question 1: Are you subscribing to Newspaper X?

Question 2: Are you subscribing to Newspaper Y?

As the result, A respondents answered "yes" to Question 1, and B respondents answered "yes" to Question 2.

What are the maximum possible number and the minimum possible number of respondents subscribing to both newspapers X and Y?

Write a program to answer this question.

Constraints

1 \leq N \leq 100

0 \leq A \leq N

0 \leq B \leq N

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N A B

Output

Print the maximum possible number and the minimum possible number of respondents subscribing to both newspapers, in this order, with a space in between.

Sample Input 1

10 3 5

Sample Output 1

3 0

In this sample, out of the 10 respondents, 3 answered they are subscribing to Newspaper X, and 5 answered they are subscribing to Newspaper Y.

Here, the number of respondents subscribing to both newspapers is at most 3 and at least 0.

Sample Input 2

10 7 5

Sample Output 2

5 2

In this sample, out of the 10 respondents, 7 answered they are subscribing to Newspaper X, and 5 answered they are subscribing to Newspaper Y.

Here, the number of respondents subscribing to both newspapers is at most 5 and at least 2.

Sample Input 3

100 100 100

Sample Output 3

100 100



Sample input:
10 3 5


Sample output:
3 0

Submission status: Accepted

Solution code:
N,X,Y = map(int, input().split())

if(Y > X):
	b_max = X
	b_min = X + Y - N
else:
	b_max = Y
	b_min = X + Y - N
if(b_min < 0):
	b_min = 0

print(b_max, b_min)

Submission status: Accepted

Solution code:
n,x,y=list(map(int,input().split()))
if x+y<=n:
    Min=0
    if x<=y:
        Max=x
    else:
        Max=y
else:
    Min=(x+y)-n
    if x<=y:
        Max=x
    else:
        Max=y
print("{} {}".format(Max,Min))

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
print(min(a,b),0 if n>a+b else a+b-n)

Submission status: Accepted

Solution code:
import sys
n, a, b = map(int ,sys.stdin.readline().strip().split())
mi = max(0, a+b-n)
ma = min(n, min(a, b))
print("{} {}".format(ma, mi))

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())

if a+b-n > 0:
  result = a +b-n
else:
  result = 0

print(min(a,b),result)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())

max_read=min(a,b)

if(a+b-n>0):
	min_read=a+b-n
else:
    min_read=0
    
print(str(max_read)+" "+str(min_read))

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
#the max
print(min(A,B),max(0,A+B-N))

Submission status: Accepted

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,A,B = list(map(int, input().split()))


# max
print( min(N, min(A,B))  , end = " ")
# min 
print( max(0, (A+B-N) ) )

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())

mini = A + B - N
if mini < 0:
    mini = 0
maxi = min(A,B)
print(maxi,mini)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
if (a+b)-n>0:
  c=(a+b)-n
else:
  c=0
print(min(a,b),c)

Submission status: Accepted

Solution code:
N , A, B = list(map( int ,input().split() ))

# print(str(N) + ", " + str(A) + ", " + str(B))


maxab = min([A , B])

minab = max([A + B - N , 0] )

print(str(maxab) + " " + str(minab))

Submission status: Accepted

Solution code:
n,x,y = map(int,input().split())
r = x+y-n
if r < 0:
  r = 0
print(min(x,y),r)

Submission status: Accepted

Solution code:
import numpy as np

N,A,B=[int(i) for i in input().split()]
x=min(A,B)
if((A+B)>N):
    z=N
    y=abs(A+B-z)
else:
    y=0
print("{} {}".format(x,y))

Submission status: Accepted

Solution code:
#岩田くんのアドバイスからmapを使って作り直したもの

rec = input().split()
n, a, b = map(int, rec)
nin = [a, b]

nmax = min(nin)
nmin = n - min(n, (n - nin[0]) + (n - nin[1]))
print(str(nmax) + " " + str(nmin))

Submission status: Accepted

Solution code:
n,a,b = [int(i) for i in input().split(' ')]
ab = a+b
c = n < ab
r = ab - n if c else 0
print(' '.join([str(i) for i in [min(a,b), r]]))

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
total=a+b
if n==a==b:
    print(n,n)
    exit()
if n<total:
    print(min(a,b),total-n)
else:
    print(min(a,b),0)

Submission status: Accepted

Solution code:
N,A,B = [int(i) for i in input().split(' ')]
mx = min(A,B)
mn = max(A+B-N,0)
print(mx,mn)

Submission status: Accepted

Solution code:
n1, n2, n3 = list(map(int, input().split()))
x = min(n2,n3)
if n2+n3<=10:
    y=0
else:
    y = max(n2+n3-n1,0)
print(x,y)

Submission status: Accepted

Solution code:
def main():
    n, a, b = map(int, input().split())
    ans_max = min(a, b)
    if n >= a + b:
        ans_min = 0
    else:
        ans_min = (a + b) - n
    print(str(ans_max) + " " + str(ans_min))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,a,b = (int(i) for i in input().split())
print(min(a,b),max(0,a+b-n))

Submission status: Accepted

Solution code:
N,A,B =[int(i)for i in input().split()]
if A+B > N:
    mi = A+B -N
else:
    mi = 0
ma =min([A,B])
print(ma,mi)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

ma = min(a,b)
mi = max(0, a+b-n)
print(str(ma) + ' ' + str(mi))

Submission status: Accepted

Solution code:
B,A,N=sorted(int(_) for _ in input().split())
print(B,max(A+B-N,0))

Submission status: Accepted

Solution code:
Sample, NumOfPaperA, NumOfPaperB = map(int, input().split())
MaximumNumberOfBothReader = min(NumOfPaperA, NumOfPaperB)
MinimumNumberOfBothReader = max(NumOfPaperA + NumOfPaperB - Sample, 0)
print(str(MaximumNumberOfBothReader) + ' ' + str(MinimumNumberOfBothReader))

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())

min_num = min(a,b)
max_num = max(a+b-n,0)

print(min_num, max_num)

Submission status: Accepted

Solution code:
import sys


def main():
    raw = input().split(' ')
    n = int(raw[0])
    a = int(raw[1])
    b = int(raw[2])

    def get_max():
        return min(a, b)

    def get_min():
        return max(a + b - n, 0)

    print("{} {}".format(get_max(), get_min()))


if __name__ == "__main__":
    argv = sys.argv[1:]
    main()

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
ans1 = min([a, b])
ans2 = max([0, a+b-n])
print('{} {}'.format(ans1, ans2))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

max_r = min([a,b])
min_r = max([0, (a+b)-n])

print("{} {}".format(max_r, min_r))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
print(min(a, b), 0 if a+b <= n else a+b-n )

Submission status: Accepted

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

X = A if A < B else B
Y = 0 if N > A+B else A+B-N

print("{0} {1}".format(X, Y))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())

if A > B:
  max = B
else:
  max = A

if A + B > N:
  min = A + B - N
else:
  min = 0
  
print(max, min)

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
if a+b > n:
  q = a+b-n
else :
  q = 0
print( str(min(a,b)) +" "+ str(q))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
check = [0 for _ in range(N)]

for i in range(A):
    check[i] += 1

for i in range(B):
    check[-(i + 1)] += 1

cnt = 0
for c in check:
    if c == 2:
        cnt += 1

print(min(A, B), cnt)

Submission status: Accepted

Solution code:
N, A, B =list(map(int, input().split()))

MAX = min(A, B)

MIN = max(0,A+B-N)

print(MAX,MIN)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split(' '))
print("{0} {1}".format(min(a,b),max(a + b - n,0)))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
a = min(A, B)
b = max(0, A+B-N)
print(a, b)

Submission status: Accepted

Solution code:
n, a, b = [int(i) for i in input().split()]
print(min(a,b), max(a+b-n,0))

Submission status: Accepted

Solution code:
import sys

def r(n, a, b):
    both_max = min(a, b)
    if 0 < a + b - n:
        both_min = a + b - n
    else:
        both_min = 0

    print(both_max, both_min)


def main():
    input = sys.stdin.readline
    n, a, b = list(map(int, input().split()))
    r(n, a, b)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
C = A + B - N
if C < 0:
    C = 0
print(min(A, B), C)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
ma=min(a,b)
mi=max(0,a+b-n)
print(ma,mi)

Submission status: Accepted

Solution code:
num = list(map(int, input().split()))
a = min(num[1],num[2])
b = max(0,(num[1]+num[2]) - num[0])
print(a,b)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
 
ab = [A, B]
max_katu = min(ab)
 
if A+B >= N:
    min_katu = A+B-N
else:
    min_katu = 0
 
 
ans = [str(max_katu), str(min_katu)]
print(' '.join(ans))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

print(min(a, b),end=' ')
if n-(a+b)>0:
    print(0)
else:
    print(a+b-n)

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, a, b = LI()

print(min(a, b), max(0, a + b - n))

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
max_s = min(A,B)
if (A + B) <= N:
    min_s = 0
else:
    min_s = (A+B) - N
print(max_s, min_s)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
print(min(A, B), max(0, (A + B) - N))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    n, a, b = map(int, input().split())
    print(min(a, b), max(0, a + b - n))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,a,b=map(int, input().split())
p = min(a,b)
q = max(a+b-n,0)
print(str(p) + " " + str(q))

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split());print(min(a,b,n),max(0,a+b-n))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())

print(min(A, B), (A + B - N if A + B > N else 0))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
mx = min(a, b)
mn = max(0, a + b - n)

print(mx, mn)

Submission status: Accepted

Solution code:
n, a, b= (int(i) for i in input().split())


print("{} {}".format((min(a,b)),(max(0,(a+b)-n))))

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
maxint = 0
minInt = 0
if a <= b:
  maxInt = a
  minInt = a - (n-b)
else:
  maxInt = b
  minInt = b - (n-a)

if a +b < n :
    minInt = 0
print(maxInt, minInt)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
print(min(a,b),max(0,-(n-a-b)))

Submission status: Accepted

Solution code:
N, A, B = map(int, raw_input().split())
m=A+B
print min(A, B), max(0,m-N)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split());t=min(a,b);print(t,max(max(a,b)-n+t,0))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n, a, b = input().split()
    N, A, B = int(n), int(a), int(b)

    ans_max = min(A, B)

    if (A + B) <= N:
        ans_min = 0
    else:
        ans_min = max((A + B - N), 0)

    print('{0} {1}'.format(ans_max, ans_min))

Submission status: Accepted

Solution code:
n, a, b=map(int, input().split())
 
print(min(a,b),max(0,a+b-n))

Submission status: Accepted

Solution code:
from sys import stdin

A, B, C = [int(x) for x in stdin.readline().rstrip().split()]




if B+C <= A:
    print(str(min(B,C)) + ' ' + str(0))
else:
    print(str(min(B,C)) + ' ' +str(B+C-A))

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
min_num = 0
max_num = 0

if a == n or b == n:
    min_num = min(a,b)
    max_num = min(a,b)
elif a == b and a == n:
    min_num = n
    max_num = n
elif a == 0 or b == 0:
    pass
elif n >= a + b:
    max_num = min(a,b)
elif n < a + b:
    min_num = abs(n-a-b)
    max_num = min(a,b)

print(max_num, min_num)

Submission status: Accepted

Solution code:
data_list = list(map(int, input().split()))

n = data_list[0]
x = data_list[1]
y = data_list[2]

if n == x == y:
    print(n, n)
    exit(0)

if n - (x + y) >= 0:
    print(min(x, y), 0)
else:
    print(min(x, y), x + y - n)

Submission status: Accepted

Solution code:
line = input().split()
N = int(line[0])
A = int(line[1])
B = int(line[2])
print(min(A, B), max(A + B - N, 0))

Submission status: Accepted

Solution code:
n = input().split()
N = int(n[0])
A = int(n[1])
B = int(n[2])

if A > B:
    a = A
    b = B
elif A < B:
    a = B
    b = A
elif A == B:
    a = A
    b = B

if a != b:
    if a+b <= N:
        print(str(b) + ' ' + str(0))
    elif a+b > N:
        print(str(b) + ' ' + str(a - (N-b)))
elif a+b <= N:
    print(str(a) + ' ' + str(0))
elif a+b > N:
    print(str(a) + ' ' + str(a-(N-b)))

Submission status: Accepted

Solution code:
N,A,B = input().split()

N = int(N)
A = int(A)
B = int(B)

max_num = min(A,B)
min_num = 0

if A+B > N:
    min_num = A+B - N

print(max_num,min_num)

Submission status: Accepted

Solution code:
inputstr = input().strip()
inputarray= inputstr.split(" ")
n = int(inputarray[0])
a = int(inputarray[1])
b = int(inputarray[2])
d1 = min(a,b)
if a+b > n:
  d2 = abs(a+b-n)
else:
  d2 = 0
print (str(max(d1,d2)) + " " + str(min(d1,d2)))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    data = input().split()
    data = [int(s) for s in data]
    outputmax = min(data)
    if data[0] == data[1] == data[2]:
        outputmin = data[1]
    else:
        outputmin = data[1] + data[2] - data[0]
        if (outputmin < 0):
            outputmin = 0
    print(str(outputmax) + " " + str(outputmin))

Submission status: Accepted

Solution code:
i = input().split()
all = int(i[0])
x = int(i[1])
y = int(i[2])
t = 0
max = 0
if x > y:
    max = x - abs(x - y)
    t = x
elif y > x:
    max = y - abs(x - y)
    t = y 
else:
    t = x
    max = x

min = 0
nx = all - x
ny = all - y

if nx > ny:
    nt = nx
elif ny > nx:
    nt = ny
else:
    nt = nx
if t >= nt: 
    min = t - nt
else:
    min = 0
print("{0} {1}".format(max,min))

Submission status: Accepted

Solution code:
instr = input().split()

n = int(instr[0])
a = int(instr[1])
b = int(instr[2])

bigger = a
smaller = b
if a < b:
    bigger = b
    smaller = a

max = smaller
min = 0
if (n - bigger) < smaller:
    min = smaller - (n - bigger)

print(str(max)+' '+str(min))

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math

args = input().split()

n = int(args[0])
a = int(args[1])
b = int(args[2])

reta = a
retb = (n - a) - b

if retb > 0:
  retb = 0
else:
  retb = abs(retb)

print('{reta} {retb}'.format(reta=min(a,b),retb=retb))

sys.exit(0)

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_nikkei2019_qual_Contest-A
#  TODO https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_a

def solveProblem(allPerson,subNewsA,subNewsB):
	subNewsA+subNewsB-allPerson

	answer = min(subNewsA,subNewsB),max(0,subNewsA+subNewsB-allPerson)
	return answer


if __name__ == '__main__':
	N,A,B = map(int,input().strip().split(' '))
	solMax,solMin = solveProblem(N,A,B)
	print("{} {}".format(solMax,solMin))

Submission status: Accepted

Solution code:
n,a,b = input().split()

n = int(n)
a = int(a)
b = int(b)

ans_max = min(a,b)

if (a + b) > n:
    ans_min = a + b - n 
else:
    ans_min = 0


print(ans_max, end=" ")
print(ans_min)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
if N >= A + B:
    print(min(A,B),0)
else:
    print(min(A,B),A+B-N)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
if n >= a+b:
    print(min(a, b), 0)
else:
    print(min(a, b), a+b-n)

Submission status: Accepted

Solution code:

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

if n <= a + b:
    print('{0} {1}'.format(min(a, b), (a + b) - n))
else:
    print('{0} 0'.format(min(a, b)))

Submission status: Accepted

Solution code:
a = input().split()

if(a[1]  >= a[2]):
  b = a[2]
else:
  b = a[1]

if(int(a[0]) >= int(a[1]) + int(a[2])):
  c=0
else:
  c = int(a[1]) + int(a[2]) - int(a[0])
print(b," ",c)

Submission status: Accepted

Solution code:
def main(N, A, B):
    '''
    >>> main(10, 7, 5)
    5 2

    >>> main(10, 3, 5)
    3 0

    >>> main(100, 100, 100)
    100 100
    '''
    print(min(A, B), max(A+B-N, 0))

if __name__ == "__main__":
    N, A, B = (int(i) for i in input().split())
    main(N, A, B)

Submission status: Accepted

Solution code:
N, A, B = list(map(int, input().split()))

Max = A if A < B else B
Min = (A + B) - N 
Min = max(Min, 0)

print(Max, Min)

Submission status: Accepted

Solution code:
N, X, Y = map(int, input().split())

M = min(X, Y)

if N >= X + Y :
    m = 0
else :
    m = X + Y - N

print(M, ' ', m)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
x=a+b-n
if x < 0: x=0
print(min(a,b),x)

Submission status: Accepted

Solution code:
def upto0(i):
    return 0 if(i < 0) else i
input = list(map(int, input().split()))
print(min(input[1], input[2]))
print(upto0(input[1] + input[2] - input[0]))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())

minimum = A + B - N
if minimum < 0:
    minimum = 0

print(min(A,B), minimum)

Submission status: Accepted

Solution code:
N, A, B = (int(i) for i in input().split())  

if A >= B:
  max = B
else:
  max = A

min = A + B - N
if min < 0:
  min = 0

print(max,min)

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
print( min(A, B), max(0, A + B - N))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
if a + b <= n:
    if a <= b:
        print(a, 0)
    else:
        print(b, 0)
elif a + b > n:
    if a <= b:
        print(str(a) + " " + str(a + b - n))
    else:
        print(str(b) + " " + str(a + b - n))

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
print(min(a,b),end=' ')
print(max(0,a+b-n))

Submission status: Accepted

Solution code:
s = list(map(int,input().split()))
a=min(s[1],s[2])
b=max(s[1]+s[2]-s[0],0)
print(a,b)

Submission status: Accepted

Solution code:
from sys import stdin


def x_plus_y(x, y):
    return x+y


def max_x_y(x, y):
    return x if(x < y) else y


N, A, B = [int(x) for x in stdin.readline().rstrip().split()]
sumAB = x_plus_y(A, B)
res = N - sumAB
Max = max_x_y(A, B)
Min = 0

resMin = None
resMax = None

for i in range(Min, Max+1):
    bar = res + i
    if(bar >= 0 and resMin is None):
        resMin = i
    if (bar >= 0):
        resMax = i

print(resMax, resMin)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
m = min(A,B)
if N >= A + B:
  mi = 0
else:
  mi = abs(N -  A - B)
print(str(m) + " " + str(mi))

Submission status: Accepted

Solution code:
N, X, Y = map(int, input().split())
Prov = []
Prov.append(N)
Prov.append(X)
Prov.append(Y)
if X + Y > N:
    C = (X + Y) - N

else:
    C = 0

if 1 <= X and 1 <= Y:
    print(min(Prov), C)

else:
    print(0, 0)

Submission status: Accepted

Solution code:
inp = input().split()

N = int(inp[0])
x = int(inp[1])
y = int(inp[2])

ans = []
ans.append(min(x,y))

if x+y > N:
  ans.append(x+y-N)
else:
  ans.append(0)

print("{} {}".format(ans[0], ans[1]))

Submission status: Accepted

Solution code:

N,A,B=[int(_) for _ in input().split() ]
if A>=B:
    BIG=A
    SMALL=B
if B>A:
    BIG=B
    SMALL=A

MAX=SMALL

if BIG+SMALL<=N:
    MIN=SMALL
    print(str(MAX)+' 0')
    exit(0)


MIN=BIG+SMALL-N
print(str(MAX)+' '+str(MIN))

Submission status: Accepted

Solution code:
a, b, c = map(int,input().split())
if a > b + c:
    if b >= c:
        print(str(c) +" "+ str(0))
    else:
        print(str(b) +" "+ str(0))
elif a == b and a == c:
    print(str(a)+" "+str(a))
elif a< b+c:
    if b >= c:
        print(str(c) +" "+ str(-a + (b+c)))
    else:
        print(str(b) +" "+ str(-a+(c+b)))
elif a == b+c:
    if b >= c:
        print(str(c) +" "+ str(-a + (b+c)))
    else:
        print(str(b) +" "+ str(-a+(c+b)))
elif a == b or a==c:
    if b >= c:
        print(str(c) +" "+ str(0))
    else:
        print(str(b) +" "+ str(0))
elif a ==b ==c:
    print(str(b)+" "+str(0))

Submission status: Accepted

Solution code:
input_list = raw_input().split(" ")
N = int(input_list[0])
A = int(input_list[1])
B = int(input_list[2])
MAX=0
MIN=0
if A == 0 or B == 0:
	MAX = 0	
else:
	_max = max(A, B)
	_min = min(A, B)
	MAX = _min
	if A+B < N:
		MIN = 0
	else:
		buf = N - _max
		MIN = _min - buf
		
print("{0} {1}".format(MAX, MIN))

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
print(min(A, B), max(A + B - N, 0))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

m = 0
x = 0

if n >= a+b:
    x = min(a,b)
    m = 0
elif n < a+b:
    x = min(a,b)
    m = (a+b)-n

print(x,m)

Submission status: Accepted

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

if A+B-N<=0:
	print(str(min([A,B]))+' '+str(0))
else:
	print(str(min([A,B]))+' '+str(A+B-N))
exit()

Submission status: Accepted

Solution code:
N, A, B = (int(i) for i in input().split()) 

def q1(N,A,B):
    maximum = min(A,B)
    if A + B <= N:
        minimum = 0
    else:
        minimum = A+B-N
    L = [maximum, minimum]
    return ' '.join(map(str, L))
    

print(q1(N,A,B))

Submission status: Accepted

Solution code:
n , x , y = map(int , input().split())

min = x + y - n
if min < 0 : min = 0

if x < y : print (str(x) + " " + str(min))
else : print(str(y) + " " + str(min))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def solve():
    N, A,B = map(int,input().split())
    res = ' '.join(map(str,[min(A,B), max(A+B-N,0)]))
    return str(res)
if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
max = a
if max > b:
  max = b
min = a+b-n
if min < 0:
  min = 0
  
print("{} {}".format(max, min))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys

def io_generator():
	while True:
		yield raw_input()

#+++++++++++++++++++

def main(io):
	n,a,b= map(int, io.next().split())
	max_num= min(a,b)
	min_num= max(a+b-n, 0)
	ret= str(max_num)+' '+str(min_num)
	return ret


#++++++++++++++++++++

if __name__ == "__main__":
	io=io_generator()
	print main(io)

Submission status: Accepted

Solution code:

line = input().split()

N = int(line[0])
A = int(line[1])
B = int(line[2])

total = A + B

print(min(A,B), max(-(N-total), 0))

Submission status: Accepted

Solution code:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,A,B = IL()

print(min(A,B),max(A+B-N,0))

Submission status: Accepted

Solution code:
from sys import stdin
N,A,B=[int(x) for x in stdin.readline().rstrip().split()]
if N==A and A==B and B==N:
    print(N,N)
else:
    if A > B:
        if (A+B) > N:
            print(B,(A+B)-N)
        else:
            print(B,0)
    else:
        if (A+B) > N:
            print(A,(A+B)-N)
        else:
            print(A,0)

Submission status: Accepted

Solution code:
ALL, A, B = (int(i) for i in input().split(" "))

ma = max([A, B])
mi = min([A, B])

total_ma = mi
total_mi = ma + mi - ALL if (ma + mi - ALL) > 0 else 0

print(str(total_ma) + " " + str(total_mi))

Submission status: Accepted

Solution code:
# 新聞Xを購読しているか？ A
# 「はい」A人

# 新聞Yを購読しているか？ B
# 「はい」B人

# 1 <= N < 100
# 0 <= A <= N
# 0 <= B <= N

# 標準入力
inputstr = input()
inputary = inputstr.split(" ")

N = int(inputary[0])
A = int(inputary[1])
B = int(inputary[2])

suball = N - A - B
if suball > 0:
    suball = 0
else:
    suball = abs(suball)

if A >= B:
    print(str(B) + " " + str(suball))
elif A < B:
    print(str(A) + " " + str(suball))

Submission status: Accepted

Solution code:
N,A,B=[int(i) for i in input().split(" ")]
maximum=min(A,B)
minimum=max(A+B-N,0)
print(maximum,minimum)

Submission status: Accepted

Solution code:
n,a,b = (int(i) for i in input().split())
x=min(a,b)
y=a+b-n
if y < 0:
    y=0
print(x,y)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
if A == 0 or B == 0:
    print("0 0")
elif N >= A + B:
    a = min(A,B)
    print("{} {}".format(a,0))
else:
    a = min(A,B)
    b = A + B - N
    print("{} {}".format(a,b))

Submission status: Accepted

Solution code:
#! usr/bin/env python
# -*- coding: utf-8 -*-

from collections import deque
import heapq
import math
import bisect


def main():
    n, a, b = map(int, input().split())

    print(min(a, b), max(a+b-n, 0))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

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

if A == B and A == N:
	print(A, A)
else:
	n = 0
	if A + B > N:
		n = A+B-N
	else:
		n = 0


	print(min(A, B), n)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())

m = max(A+B-N,0)
M = min(A,B)
print(M,m)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
if a+b-n >= n:
    s = n
elif a+b-n < 0:
    s = 0
else:
    s = a+b-n
print(min(a,b),s)

Submission status: Accepted

Solution code:
l = list(map(int, input().split()))

N = l[0]
x = l[1]
y = l[2]

if N > x + y:
    b_min = 0
else:
    b_min = (x + y) - N

if x > y:
    b_max = y
else:
    b_max = x

if N == x and N == y:
    b_min = N
    b_max = N

print(b_max, b_min)

Submission status: Accepted

Solution code:
N, A, B = (int(x) for x in input().split())
c=0
if(A <= B):
    c = A
else:
    c = B
if(A+B > N):
    print("{} {}".format(c, A+B-N))
else:
    print("{} {}".format(c, 0))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
mi = 1000000
ma = -5
for x in range(0, n + 1):
    if not 0 <= x <= a:continue
    if not 0 <= x <= b:continue
    if not 0 <= n - a - b + x <= n - a: continue
    if not 0 <= n - a - b + x <= n - b: continue
    mi = min(mi, x)
    ma = max(ma, x)
print(ma, mi)

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
print('{} {}'.format(min(a[1],a[2]), max(a[1]+a[2]-a[0],0)))

Submission status: Accepted

Solution code:
moto=input()
henkan=moto.split()
if int(henkan[1]) <= int(henkan[2]):
    ooi=int(henkan[2])
    sukunai=int(henkan[1])
else:
    ooi=int(henkan[1])
    sukunai=int(henkan[2])
if ooi+sukunai-int(henkan[0])>0:
    sai=ooi+sukunai-int(henkan[0])
else:
    sai=0
print(str(sukunai)+" "+str(sai))

Submission status: Accepted

Solution code:
tmp = input().split(' ')

N = int(tmp[0])
A = int(tmp[1])
B = int(tmp[2])

maxReaders = 0
minReaders = 0

# 最大購読者数
if A > B :
  maxReaders = B
else :
  maxReaders = A

# 最小購読者数
if A + B > N :
  minReaders = (A + B) - N
else :
  minReaders = 0

print(str(maxReaders) + ' ' + str(minReaders))

Submission status: Accepted

Solution code:
data = input().split()

n = int(data[0])
a = int(data[1])
b = int(data[2])

ab=n
total=n

# ab
if(n > (a+b)):
    if(a > b):
        ab = b
        total = 0
    else:
        ab = a
        total = 0
else:
    if(a > b):
        ab = b
        total = a+b-n
    else:
        ab = a
        total = a+b-n

print(ab, " ", total)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
if A <= B:
    tp = A
    A = B
    B = tp
if A+B < N:
    print(B, 0)
else:
    print(B, A+B-N)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())

def max(a,b):
    if a >= b:
        return b
    else:
        return a
def min(n,a,b):
    if n-a-b > 0:
        return 0
    else:
        return abs(n-a-b)
print(max(a,b),min(n,a,b))

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
max = min([A,B])
if A + B > N:
    min = (A + B) - N
else:
    min = 0
print(str(max) + ' ' + str(min))

Submission status: Accepted

Solution code:
a = input().split()
b,c,d = int(a[0]),int(a[1]),int(a[2])
if c >= d :
    aa = d
else :
    aa = c
if b >= c + d :
    ab = 0
else :
    ab = abs(b - (c + d))
print(aa, ab)

Submission status: Accepted

Solution code:
n, a, b = input().split()

n = int(n)
x = int(a)
y = int(b)

maxim = 0
mini = 0

if x > y:
    maxim = y
else:
    maxim = x

if x + y > n:
    mini = x + y - n

print(str(maxim) + ' ' + str(mini))

Submission status: Accepted

Solution code:
from sys import stdin

A, B, C = [int(x) for x in stdin.readline().rstrip().split()]




if B+C <= A:
    print(str(min(B,C)) + ' ' + str(0))
else:
    print(str(min(B,C)) + ' ' +str(B+C-A))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())


print(min(a, b), max(a + b - n, 0))

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
maximam=0
minimam=0
if a+b-n>=0:
    minimam=a+b-n
else:
    minimam=0
s=[a,b]
maximam=min(s)
print(maximam,minimam)

Submission status: Accepted

Solution code:
line = input()
N = line.split()[0]
A = line.split()[1]
B = line.split()[2]

max = min(int(A),int(B))
min = int(A)+int(B)-int(N)
if min < 0:
    min =0
  
print ("{0} {1}".format(max,min))

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
max_ans = 0
min_ans = 0
bigger_num = max([a, b])
smaller_num = min([a, b])

if n - bigger_num >= smaller_num:
    min_ans  = 0
else:
    min_ans = abs(smaller_num - (n - bigger_num))

max_ans = smaller_num

print(max_ans, min_ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
print(min(a, b), max((a+b-n), 0))

Submission status: Accepted

Solution code:
n, a, b = [int(_) for _ in input().split()]
m = a + b - n
if m < 0:
    m = 0
print(min(a, b), m)

Submission status: Accepted

Solution code:
N,X,Y = map(int,input().split())

print(min(X,Y),' ',max(X+Y-N,0))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
small = min(A, B)
s = A + B
if s > N:
  print(small, s - N)
else:
  print(small, 0)

Submission status: Accepted

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

max_num = min(A, B)
min_num = max(A + B - N, 0)

print(str(max_num) + " " + str(min_num))

Submission status: Accepted

Solution code:
s=input()
n,a,b=int(s.split()[0]),int(s.split()[1]),int(s.split()[2])
print(min(a,b),max(0,a+b-n))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())

print(min(A, B), max(0, A+B-N))

Submission status: Accepted

Solution code:
input = list(map(int,input().split()))

result_max = min(input[1], input[2])
result_min = input[0] - (input[0] - input[1]) - (input[0] - input[2]) 

if result_min < 0:
  result_min = 0

print(result_max, result_min)

Submission status: Accepted

Solution code:
N,X,Y = map(int,input().split())
tmp_X = X
if X>Y:
    tmp_X = Y
tmp_Y = N-X

if tmp_Y > Y:
    min_Y = 0
else:
    min_Y = Y - tmp_Y
print(tmp_X,' ',min_Y)

Submission status: Accepted

Solution code:
L = list(map(int, input().split()))
N = L[0]
A = L[1]
B = L[2]

if A + B <= N:
    print(min(A, B), 0)
else:
    print(min(A, B), (A + B) - N)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
max = min(a,b)
min = a + b - n
if min<0: min = 0

print(max,min)

Submission status: Accepted

Solution code:
n,A,B = map(int,input().split())
if n - A - B > 0:
    print(min(A,B),0)
else:
    print(min(A,B),abs(n - A - B))