AtCoder Beginner Contest 129 - Airplane

There are three airports A, B and C, and flights between each pair of airports in both directions.
A one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a one-way flight between airports C and A takes R hours.
Consider a route where we start at one of the airports, fly to another airport and then fly to the other airport.
What is the minimum possible sum of the flight times?

-----Constraints-----
 - 1 \leq P,Q,R \leq 100
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
P Q R

-----Output-----
Print the minimum possible sum of the flight times.

-----Sample Input-----
1 3 4

-----Sample Output-----
4

 - The sum of the flight times in the route A \rightarrow B \rightarrow C: 1 + 3 = 4 hours
 - The sum of the flight times in the route A \rightarrow C \rightarrow C: 4 + 3 = 7 hours
 - The sum of the flight times in the route B \rightarrow A \rightarrow C: 1 + 4 = 5 hours
 - The sum of the flight times in the route B \rightarrow C \rightarrow A: 3 + 4 = 7 hours
 - The sum of the flight times in the route C \rightarrow A \rightarrow B: 4 + 1 = 5 hours
 - The sum of the flight times in the route C \rightarrow B \rightarrow A: 3 + 1 = 4 hours
The minimum of these is 4 hours.

Difficulty: EASY

Starter code:

Solutions:
(P, Q, R) = map(int, input().split())
print(min(P + Q, Q + R, R + P))


A = list(map(int, input().split()))
B = sorted(A)
print(B[0] + B[1])


p = list(map(int, input().split()))
p.sort()
print(p[0] + p[1])


import itertools
pqr = list(map(int, input().split()))
print(min([a + b for (a, b) in itertools.combinations(pqr, 2)]))


(a, b, c) = map(int, input().split())
print(min({a + b, a + c, b + c}))


A = [int(a) for a in input().split()]
print(sum(A) - max(A))


(p, q, r) = map(int, input().split())
A = min(p + q, q + r, p + r)
print(A)


(a, b, c) = map(int, input().split())
print(a + b + c - max(a, max(b, c)))


(A, B, C) = map(int, input().split())
print(min(B + C, A + C, A + B))


(P, Q, R) = map(int, input().split())
max_d = max(P, max(Q, R))
total = P + Q + R - max_d
print(total)


V = list(map(int, input().split()))
print(sum(V) - max(V))


A = tuple(map(int, input().split()))
print(sum(A) - max(A))


pqr = list(map(int, input().split()))
pqr.sort()
print(pqr[0] + pqr[1])


a = sorted(list(map(int, input().split())))
print(sum(a[:2]))


route = list(map(int, input().split()))
route.sort()
print(sum(route[:2]))


(P, Q, R) = list(map(int, input().split()))
list_m = [P + Q, R + Q, P + R, Q + R, R + P, Q + P]
min = 200
for i in range(0, len(list_m)):
	if min > int(list_m[i]):
		min = list_m[i]
print(min)


(P, Q, R) = map(int, input().split())
print(P + Q + R - max([P, Q, R]))


(*a, b) = sorted(map(int, input().split()))
print(sum(a))


t = list(map(int, input().split()))
t.sort()
print(t[0] + t[1])


a = list(map(int, input().split()))
a.sort()
print(sum(a[0:2]))


time_list = list(map(int, input().split()))
time_list.sort()
print(time_list[0] + time_list[1])


F = list(map(int, input().split()))
print(sum(F) - max(F))


M = [int(s) for s in input().split()]
print(sum(M) - max(M))


(r, d, x) = map(int, input().split())
print(r + d + x - max(r, d, x))


(P, Q, R) = map(int, input().split())
if P < Q:
	(P, Q) = (Q, P)
if P < R:
	(P, R) = (R, P)
print(Q + R)


n = list(map(int, input().split()))
print(sum(n) - max(n))


d = list(map(int, input().split()))
print(sum(d) - max(d))


A = map(int, input().split())
K = sorted(A)
print(K[0] + K[1])


(x, y, z) = map(int, input().split())
print(min(x + y, y + z, z + x))


(p, q, r) = map(int, input().split())
sum = [10 ** 4] * 3
sum[0] = p + q
sum[1] = p + r
sum[2] = q + r
print(min(sum))


(a, s, d) = map(int, input().split())
print(min(a + s, s + d, d + a))


p = sorted(list(map(int, input().split())))
print(p[0] + p[1])


l = list(map(int, input().split()))
l.sort()
print(sum(l[0:2]))


(p, q, r) = list(map(int, input().split()))
print(min(p + q, q + r, p + r))


(p, q, r) = map(int, input().split())
print(p + q + r - max(p, q, r))


(A, B, C) = sorted(map(int, input().split()))
print(A + B)


print(sum(sorted([int(x) for x in input().split()])[:2]))


(P, Q, R) = map(int, input().split())
time = [P + Q, P + R, R + Q]
time.sort()
print(time[0])


url = 'https://atcoder.jp//contests/abc129/tasks/abc129_a'

def main():
	(p, q, r) = list(map(int, input().split()))
	print(sum([p, q, r]) - max(p, q, r))

def __starting_point():
	main()
__starting_point()


X = list(map(int, input().split()))
X.sort()
print(X[0] + X[1])


L = [int(i) for i in input().split()]
print(sum(L) - max(L))


L = sorted(list(map(int, input().split())))
print(L[0] + L[1])


lis = list(map(int, input().split()))
print(sum(lis) - max(lis))


a = sorted(list(input().split()))
print(int(a[0]) + int(a[1]))


l = list(map(int, input().split()))
print(sum(l) - max(l))


byte = list(map(int, input().split()))
byte.sort()
print(byte[0] + byte[1])


abc = list(map(int, input().split()))
print(sum(abc) - max(abc))


l = sorted(map(int, input().split()))
print(sum(l) - max(l))


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


print(sum(sorted(map(int, input().split()))[:-1]))


(p, q, r) = sorted(map(int, input().split()))
print(p + q)


l = list(map(int, input().split(' ')))
l = sorted(l)
print(l[0] + l[1])


l = list(map(int, input().split()))
l.sort()
print(l[0] + l[1])


t = sorted(map(int, input().split()))
print(t[0] + t[1])


(s, t, u) = sorted(map(int, input().split()))
print(s + t)


a = [int(i) for i in input().split()]
print(sum(a) - max(a))


(P, Q, R) = map(int, input().split())
A = [P, Q, R]
A.sort()
print(A[1] + A[0])


(A, B, C) = map(int, input().split())
list = [A + B, B + C, A + C]
new_list = sorted(list)
print(new_list[0])


d = [int(c) for c in input().split()]
print(sum(d) - max(d))


(P, Q, R) = map(int, input().split())
if P + Q <= Q + R and P + Q <= P + R:
	print(P + Q)
elif Q + R <= P + Q and Q + R <= P + R:
	print(Q + R)
else:
	print(P + R)


s = list(map(int, input().split()))
print(sum(s) - max(s))


ABC = list(map(int, input().split()))
ABC.sort()
print(ABC[0] + ABC[1])


def atc_129a(input_value: str) -> int:
	PQR = input_value.split(' ')
	P = int(PQR[0])
	Q = int(PQR[1])
	R = int(PQR[2])
	return min(P + Q, P + R, Q + R)
input_value = input()
print(atc_129a(input_value))


print(sum(sorted(map(int, input().split()))[:2]))


s = list(map(int, input().split()))
print(sum(sorted(s)[0:2]))


import itertools
(P, Q, R) = map(int, input().split())
lst = [P, Q, R]
c = list(itertools.combinations(lst, 2))
lst2 = []
for i in c:
	s = sum(i)
	lst2.append(s)
print(min(lst2))


h = list(map(int, input().split()))
print(sum(h) - max(h))


x = list(map(int, input().split()))
print(sum(x) - max(x))


n = [int(i) for i in input().split()]
print(sum(n) - max(n))


li = list(map(int, input().split()))
print(sum(li) - max(li))


x = list(map(int, input().split()))
y = sorted(x)
print(y[0] + y[1])


a = list(map(int, input().split()))
print(sum(a) - max(a))


ans = [int(n) for n in input().split()]
print(sum(ans) - max(ans))


print(sum(sorted([int(s) for s in input().split()])[:2]))


(*t,) = map(int, input().split())
print(sum(t) - max(t))


T = sorted(list(map(int, input().split())))
print(T[0] + T[1])


l = input().split()
l.sort()
print(int(l[0]) + int(l[1]))


(a, b, c) = map(int, input().split())
A = [a, b, c]
print(sum(A) - max(A))


n = sorted(list(map(int, input().split())))
print(n[0] + n[1])


print(eval('+'.join(sorted(input().split())[:-1])))


l = sorted(list(map(int, input().split())))[:2]
print(sum(l))


A = [int(i) for i in input().split()]
print(sum(A) - max(A))


(*T,) = map(int, input().split())
T.sort()
print(T[0] + T[1])


(P, Q, R) = sorted(list(map(int, input().split())))
print(P + Q)


pqr = list(map(int, input().split()))
from itertools import permutations
ans = 100 * 3
for (i, j) in permutations(pqr, 2):
	ans = min(ans, i + j)
print(ans)


h = list(map(int, input().split()))
print(sum(sorted(h)[:2]))


p = sorted(map(int, input().split()))
p.pop()
print(sum(p))


N = list(map(int, input().split()))
print(sum(N) - max(N))


(a, b, c) = sorted(map(int, input().split()))
print(a + b)


A = list(map(int, input().split()))
print(sum(A) - max(A))


(p, q, r) = map(int, input().split())
s = [p + q, p + r, q + r]
print(min(s))


N = list(map(int, input().split()))
N.sort()
print(N[0] + N[1])


d = [int(i) for i in input().split()]
print(sum(d) - max(d))


ans = list(map(int, input().split()))
print(sum(ans) - max(ans))


l = [int(i) for i in input().split()]
print(sum(l) - max(l))


T = list(map(int, input().split()))
print(sum(T) - max(T))


L = list(map(int, input().split()))
print(sum(L) - max(L))


d = list(map(int, input().split()))
d.sort()
print(d[0] + d[1])


dist = list(map(int, input().split()))
dist.sort()
print(dist[0] + dist[1])


D = list(map(int, input().split()))
print(sum(D) - max(D))


(a, b, c) = map(int, input().split())
ans = a + b
if a + c < ans:
	ans = a + c
if b + c < ans:
	ans = b + c
print(ans)


m = list(map(int, input().split()))
print(sum(m) - max(m))


d = sorted(list(map(int, input().split())))
print(d[0] + d[1])


t = input().split()
t.sort()
print(int(t[0]) + int(t[1]))


n = [int(i) for i in input().split()]
n.sort()
print(n[0] + n[1])


(p, q, r) = map(int, input().split())
l = [p + q, q + r, p + r]
print(min(l))


(t1, t2, t3) = sorted(map(int, input().split()))
print(t1 + t2)


list_plane = list(map(int, input().split()))
list_plane.sort()
print(list_plane[0] + list_plane[1])


a = sorted([int(i) for i in input().split()])
print(a[0] + a[1])


B = list(map(int, input().split()))
print(sum(B) - max(B))


s = list(map(int, input().split()))
s.sort()
print(s[0] + s[1])


pqr = list(map(int, input().split()))
ans = float('inf')
for i in range(2):
	for j in range(i + 1, 3):
		t = pqr[i] + pqr[j]
		if t < ans:
			ans = t
print(ans)


W = [int(i) for i in input().split()]
print(sum(W) - max(W))


(a, b, _) = sorted(list(map(int, input().split())))
print(a + b)


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
import functools

def v():
	return input()

def k():
	return int(input())

def S():
	return input().split()

def I():
	return list(map(int, input().split()))

def X():
	return list(input())

def L():
	return list(input().split())

def l():
	return list(map(int, input().split()))

def lcm(a, b):
	return a * b // math.gcd(a, b)
sys.setrecursionlimit(10 ** 6)
mod = 10 ** 9 + 7
cnt = 0
ans = 0
inf = float('inf')
al = 'abcdefghijklmnopqrstuvwxyz'
AL = al.upper()
(a, b, c) = I()
ans = min(a + b, b + c)
print(min(ans, a + c))


fly_times = [int(v) for v in input().split(' ')]
min_t = 10 ** 9
for i in range(3):
	result = 0
	for j in range(3):
		if i == j:
			continue
		result += fly_times[j]
	if result < min_t:
		min_t = result
print(min_t)


print(sum(sorted([int(i) for i in input().split(' ')])[:2]))


n = [int(x) for x in input().split()]
print(sum(n) - max(n))


(A, B, C) = map(int, input().split())
print(A + B + C - max(A, B, C))


i = list(map(int, input().split()))
print(sum(i) - max(i))


L = list(map(int, input().split()))
print(sum(sorted(L)[:2]))


P = list(map(int, input().split()))
print(sum(P) - max(P))


t = [int(x) for x in input().split()]
print(sum(t) - max(t))


a = list(map(int, input().split()))
a.sort()
print(a[0] + a[1])


f = list(map(int, input().split()))
f.sort()
print(f[0] + f[1])


p = list(map(int, input().split()))
print(sum(p) - max(p))


(x, y, z) = map(int, input().split())
print(x + y + z - max(x, y, z))


(p, q, r) = list(map(int, input().split()))
time = [p, q, r]
print(sum(time) - max(time))


a = sorted(map(int, input().split()))
print(a[0] + a[1])


l = sorted(map(int, input().split()), key=int)
print(l[1] + l[0])


s = sorted(list(map(int, input().split())))
print(s[0] + s[1])


A = sorted(list(map(int, input().split())))
print(sum(A[:2]))


X = sorted(map(int, input().split()))
print(X[0] + X[1])


a = list(map(int, input().split()))
print(min(a[0] + a[1], a[1] + a[2], a[2] + a[0]))


r = sorted(list(map(int, input().split())))
print(r[0] + r[1])


x = sorted(input().split())
print(int(x[0]) + int(x[1]))


q = list(map(int, input().split()))
q = sorted(q)
print(q[0] + q[1])


(e1, e2, e3) = map(int, input().split())
A = e1 + e2
B = e2 + e3
C = e1 + e3
print(min(A, B, C))


(a, b, c) = map(int, input().split())
x = []
x.append(a + b)
x.append(a + c)
x.append(b + c)
print(sorted(x)[0])


S_list = list(map(int, input().split()))
sum_1 = sum(S_list)
S_list_1 = [sum_1 - i for i in S_list]
print(min(S_list_1))


p = [int(i) for i in input().split()]
print(sum(p) - max(p))


(P, Q, R) = list(map(int, input().split()))
abc = P + Q
acb = Q + R
bca = P + R
print(min(abc, acb, bca))


(P, Q, R) = [int(i) for i in input().split()]
print(sum([P, Q, R]) - max(P, Q, R))


3
import sys
input = lambda : sys.stdin.readline().strip()
(p, q, r) = [int(x) for x in input().split()]
print(min(p + q, q + r, r + p))


n = input().split()
n.sort()
print(int(n[0]) + int(n[1]))


(p, q, r) = list(map(int, input().split()))
a_c = p + q
a_b = r + q
b_c = p + r
minimum_time = min(a_c, a_b, b_c)
print(minimum_time)


a = tuple(map(int, input().split()))
print(sum(a) - max(a))


X = list(map(int, input().split()))
print(sum(X) - max(X))


i = sorted(input().split())
print(int(i[0]) + int(i[1]))


a = input().split()
a.sort()
print(int(a[0]) + int(a[1]))


(*A,) = map(int, input().split())
A.sort()
print(A[0] + A[1])


(x, y, z) = sorted(map(int, input().split()))
print(x + y)


l_d = list(map(int, input().split()))
l_d.sort()
min_d = l_d[0] + l_d[1]
print(min_d)


(P, Q, R) = list(map(int, input().split()))
flight = [P + Q, P + R, Q + R]
print(min(flight))