Problem:


Score : 100 points

Problem Statement

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

1 3 4

Sample Output 1

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.

Sample Input 2

3 2 3

Sample Output 2

5



Sample input:
1 3 4


Sample output:
4

Submission status: Runtime Error

Solution code:

P=int(input())
Q=int(input())
R=int(input())

if P+Q<=Q+R:
    if P+Q<=R+P:
        print(P+Q)
    else:
        print(R+P)
elif Q+R<P+Q:
    if Q+R<=R+P:
        print(Q+R)
    else:
        print(R+P)

Submission status: Runtime Error

Solution code:
a,b,c = map(int raw_input().split())
if a >=b and a>=c:
  print b+c
elif b>=a and b>=c:
  print a+c
else:
  print a+b

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
S = []
for _ in range(M):
  S.append(int(input()))
S.append(-1)
S.append(N+1)
S.sort()  
P = 1

def Fib(n):    
    if n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        return Fib(n-1)+Fib(n-2)
      
for i in range(M+1):
  P *= Fib(S[i+1]-S[i]) 

print(P%1000000007)

Submission status: Runtime Error

Solution code:
num = int(input())
A = list(map(int, input().split()))
H = sum(A) / 2
S = 0
for i in range(num):
  S += A[i]
  if abs(H - (S + A[i+1])) >= abs(H - S):
    print(abs(2 * S - 2 * H))
    break

Submission status: Runtime Error

Solution code:
print(min([input[0]+input[1],input[2]+input[1], input[0]+input[2]) )

Submission status: Runtime Error

Solution code:
return min([input[0]+input[1],input[2]+input[1], input[0]+input[2])

Submission status: Runtime Error

Solution code:
PQ = int(input())
QR = int(input())
RP = int(input())

routes = [PQ + QR, QR + RP, RP + PQ]

print(min(routes))

Submission status: Runtime Error

Solution code:
from sys import stdin
from functools import reduce
from operator import add, mul

from functools import lru_cache
@lru_cache(maxsize=None)  # メモ化したい関数の前につける
def fib(n):  # n 番目のフィボナッチ数を求める関数
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n - 2) + fib(n - 1)


nm = [int(i) for i in stdin.readline().rstrip().split(" ")]
a = []
for i in range(nm[1]):
    a.append(int(stdin.readline().rstrip()))
result =[]
result.append(fib(a[0]))
for i in range(nm[1]-1):
    result.append(fib(a[i+1] - a[i] - 1))
result.append(fib(nm[0] - a[nm[1]-1]))
print(reduce(mul, result) % 1000000007)

Submission status: Runtime Error

Solution code:
P=int(input())
Q=int(input())
R=int(input())
a=P+Q
b=Q+R
c=R+P

if a<=b:
    if a<=c:
        print(a)
    else:
        print(c)
elif b<a:
    if b<=c:
        print(b)
    else:
        print(c)

Submission status: Runtime Error

Solution code:
MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
x = 0
y = 1
for i in range(N):
  if i+1 in a:
    z = 0
  else:
    z = x + y
  x,y = y,z  
print(z%MOD)

Submission status: Runtime Error

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

case = [0] * (N + 1)
case[0] = 1
if not 1 in A:
    case[1] = 1
for x in range(2, N + 1):
    if x in A:
        case[x] = 0
    elif x - 1 in A:
        case[x] = case[x - 2]
    else:
        case[x] = case[x - 1] + case[x - 2]

print(case[N] % 1000000007)

Submission status: Runtime Error

Solution code:
p = input()
q = input()
r = input()

s = int(p)
t = int(q)
u = int(r)

total_time = s + t + u

times = [s, t, u]
max_time = max(times)

min_time = total_time - max_time

print(min_time)

Submission status: Runtime Error

Solution code:
mod=1000000007
n,m=map(int,input().split())
a=[]
af=0
for i in range(m):
    a.append(int(input()))
if len(a)>0:
    a.sort()
    af=1
f=0
for i in range(len(a)):
    if a[i]+1 in a:
        f=1
        break
if f==1:
    print(0)
else:
    dp=[0]*(n+1)
    dp[0]=1
    if 1 in a:
        dp[1]=0
        a.pop(0)
    else:
        dp[1]=1
    
    for i in range(2,n+1):
        if af==1 and i==a[0]:
            dp[i]=0
            a.pop(0)
        else:
            dp[i]=(dp[i-1]+dp[i-2])%mod
    print(dp[n]%mod)

Submission status: Runtime Error

Solution code:
P=input()
Q=input()
R=input()
p=int(P)
q=int(Q)
r=int(R)
a=p+q
b=q+r
c=r+p

if a<=b:
    if a<=c:
        print(a)
    else:
        print(c)
elif b<a:
    if b<=c:
        print(b)
    else:
        print(c)

Submission status: Runtime Error

Solution code:
P=input()
Q=input()
R=input()
p=int(P)
q=int(Q)
r=int(R)
a=p+q
b=q+r
c=r+p

if a<=b:
    if a<=c:
        print(a)
    else:
        print(c)
elif b<=a:
    if b<=c:
        print(b)
    else:
        print(c)

Submission status: Runtime Error

Solution code:
N_M = list(map(int, input().split()))
N = N_M[0]
M = N_M[1]
dis = []
for _ in range(M):
    dis.append(input())

dp = [0 for i in range(N+2)]
dp[0] = 1
if 1 in dis:
    dp[1] = 0
else :
    dp[1] = 1

for i in range(N):
    if i+2 in dis:
        dp[i+2]=0
    else:
        if i in dis :
            dp[i+2]=dp[i+1]
        if i+1 in dis :
            dp[i+2]=dp[i]
        else :
            dp[i+2]=dp[i]+dp[i+1]

print(dp[N])

Submission status: Runtime Error

Solution code:
print(min([sum(l) - l[i] for i in range(len(list(map(int, input().split()))))]))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
m = 0
if M > 0:
  broken = int(input())
else:
  broken = 0
a1, a2, a3 = 1, 0, 0
for i in range(1, N+1):
  a3, a2 = a2, a1
  if i == broken:
    a1 = 0
    m += 1
    if m < M:
      broken = int(input())
  else:
    a1 = (a2 + a3) % 1000000007
print(a1)

Submission status: Runtime Error

Solution code:
aaaa = input()
A = [int(x) for x in input().split()]


for i in range(len(A)-1):
  s1 = sum(A[:i+1])
  s2 = sum(A[i+1:])
  if s1 >= s2:
    print(abs(s1-s2))
    break

Submission status: Runtime Error

Solution code:
aaaa = input()
A = [int(x) for x in input().split()]


for i in range(len(A)):
  s1 = sum(A[:i+1])
  s2 = sum(A[i+1:])
  if s1 >= s2:
    print(s1-s2)
    break

Submission status: Runtime Error

Solution code:
p = input()
q = input()
r = input()

s = int(p)
t = int(q)
u = int(r)


x = max([s, t, u])

print(s + t + u - x)

Submission status: Runtime Error

Solution code:
p,q,r = map(int,input().split())
print(sum(p,q,r)-max(p,q,r))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
A = []
for _ in range(M):
    A.append(int(input()))

num_goup = [1]
for s in range(1, N + 1):
    if s in A:
        num_goup.append(0)
        continue
    
    if s == 1:
        num_goup.append(1)
        continue
    
    if num_goup[-1] == 0:
        if num_goup[-2] == 0:
            num_goup.append(0)
            break
        else:
            num_goup.append(num_goup[-2])
    else:
        if num_goup[-2] == 0:
            num_goup.append(num_goup[-1])
        else:
            num_goup.append(num_goup[-1] + num_goup[-2])
    
print(num_goup[-1])

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
a_list = [int(input()) for _ in range(M)]

mod = 10 ** 9 + 7

dp = [0] * (N + 100)
dp[0] = 1
a_set = set(a_list)

for i in range(N):
    if i in a_set:
        continue
    else:
        dp[i + 1] += dp[i]
        dp[i + 1] %= mod
        dp[i + 2] += dp[i]
        dp[i + 2] %= mod

print(dp[N] % mod)

Submission status: Runtime Error

Solution code:
xyz = input().split()
x,y,z = int(xyz=[0]), int(xyz[1]),int(xyz[2])

a = x + y
b = y + z
c = z + x
print(min([a, b, c]))

Submission status: Runtime Error

Solution code:
mod=1000000007
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
f=0
for i in range(len(a)):
    if a[i]+1 in a:
        f=1
        break
        
dp=[0]*(n+1)
dp[0]=1
if 1 in a:
    dp[1]=0
else:
    dp[1]=1
    
for i in range(2,n+1):
    if i in a:
        dp[i]=0
    else:
        dp[i]=(dp[i-1]+dp[i-2])%mod

if f==1:
    print(0)
else:
    print(dp[n]%mod)

Submission status: Runtime Error

Solution code:
import itertools
a= list(map(int, input().split()))
result = []
test = list(itertools.permutations(a, 2))
for i in range(test):
    result.append(test[i][0] + test[i][1])
print(min(result))

Submission status: Runtime Error

Solution code:
import sys

argv = sys.argv
a = []

P = int(argv[0])
Q = int(argv[1])
R = int(argv[2])

a.append(P)
a.append(Q)
a.append(R)
max = 0
for i in a:
    if max < i:
        max = i

print(sum(a)-max)

Submission status: Runtime Error

Solution code:
P = int(input())
Q = int(input())
R = int(input())

X = max([P, Q, R])

print(P + Q + R - X)

Submission status: Runtime Error

Solution code:
import sys

argv = sys.argv
a = []

P = int(argv[1])
Q = int(argv[2])
R = int(argv[3])

a.append(P)
a.append(Q)
a.append(R)
max = 0
for i in a:
    if max < i:
        max = i

print(sum(a)-max)

Submission status: Runtime Error

Solution code:
xyz = input().split()
x,y,z = int(xyz=[0]), int(xyz[1]),int(xyz[2])
print(x)

a = x + y
b = y + z
c = z + x
ptint(min([x,y,z])

Submission status: Runtime Error

Solution code:
xyz = input().split()
x,y,z = int(xyz=[0]), int(xyz[1]),int(xyz[2])

a = x + y
b = y + z
c = z + x
ptint(min([a,b,c])

Submission status: Runtime Error

Solution code:
l = [map(int, input())]

l.sort()

print(l[0] + l[1])

Submission status: Runtime Error

Solution code:
P,Q,R=map(int,input().split())
result=0
min1=100
min2=100

if min1>P:
    min1=P
    flag="P"
if min1>Q:
    min1=Q
    flag="Q"
if min1>R:
    min1=R
    flag="R"
if(flag!="P"):
    if min2>P:
        min2=P
if(flag!="Q"):
    if min2>Q:
        min2=Q
if(flag!="R"):
    if min1>R:
        min2=R
print(min1+min2)

Submission status: Runtime Error

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

diff=[]
for i in range(N-1):
    diff.append(abs(sum(W[:i+1])-sum(W[i+1:])))
print(min(diff))

Submission status: Runtime Error

Solution code:
#coding: utf-8

line = input()
for i in range(3):
	arr.append(int(line.split()[i]))
ans = sum(arr) - max(arr)
print(ans)

Submission status: Runtime Error

Solution code:
P = int(input())
Q = int(input())
R = int(input())

X = min([P, Q, R])

print(P + Q + R - X)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
int min(int a, int b){
    return a<b ? a : b;
}

int main(void){
    int p, q, r;
    scanf("%d%d%d", &p, &q, &r);
    int ans = min(r+q, min(p + q, p + r));
    printf("%d\n", ans);
    return 0; 
}

Submission status: Runtime Error

Solution code:
P = int(input())
Q = int(input())
R = int(input())

X = min[P, Q, R]

print(P + Q + R - X)

Submission status: Runtime Error

Solution code:
n = int(input())

w = list(map(int, input().split()))

subs = []
s = 0
for i in range(n):
    s += w[i]
    subs.append(s)

ans = 1000
for i in range(n-1):
    a = abs(subs[-1] - 2*subs[i])
    ans = min(ans, a)

print(ans)

Submission status: Runtime Error

Solution code:
num1, num2, num3 = [int(i) for i in input().split()]
a=list[num1+num2,num2+num3,num1+num3]
print(max(a))

Submission status: Runtime Error

Solution code:
l = []
for i in range(3):
    l.append(int(input()))
l.sort()
print(l[0]+l[1])

Submission status: Runtime Error

Solution code:
p, q, r = map(int, input().split())
# 文字列の入力
# s = input()
# 出力


print("{} {}".format(min(p+q, q+r, r+p), s))

Submission status: Runtime Error

Solution code:
P, Q, R = map(int, input().split())
abc = P+Q
acb = P+R
cab = R+Q

ans = 10000
ans = min(ans, abc)
ans = min(ans, acb)
ans = min(ans, dca)
print(ans)

Submission status: Runtime Error

Solution code:
L = [int(i) for i in input().split()]

min_root = []
for i in L:
    for j in L:
        if i != j:
            min_root.append(i+j)
        else:
            continue

print(min(min_root))

Submission status: Runtime Error

Solution code:
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
print(min[p+q,p+r,q+r])

Submission status: Runtime Error

Solution code:
p,q,r = map(int,input().split())


mintime = p + q
if(mintime > q + r):
    mintime = q + r
elif(mintime > p + r):
    mintime = P + r
print(mintime)

Submission status: Runtime Error

Solution code:
1. A,B,C =map(int,input().split())
2. print(max(A+B,A+C,B+C))

Submission status: Runtime Error

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

l = []
for fst in inp:
    for sec in inp:
        if fst == sec:
            pass
        else:
            l.append(fst + sec)

print(min(l))

Submission status: Runtime Error

Solution code:
a,b,c =input().split(",")
mylist = [int(a),int(b),int(c)]
mylist.sort()
print(sum(mylist[0:2]))

Submission status: Runtime Error

Solution code:
A, B, C = stdin.readline().rstrip().split()
A = int(A)
B = int(B)
C = int(C)
answer_1 = A + B
answer_2 = A + C
answer_3 = B + C

print(max(answer_1,answer_2,answer_3))

Submission status: Runtime Error

Solution code:
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
x = p + q
y = q + r
z = p + r
print(min[x,y,z])

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.setf(ios::fixed);
	cout.precision(4);
	
	int p, q, r;

	cin >> p >> q >> r;

	int ans1 = p + q;
	int ans2 = q + r;
	int ans3 = p + r;

	cout << min(ans1, min(ans2, ans3)) << '\n';

	return 0;
}

Submission status: Runtime Error

Solution code:
p,q,r = map(int,input().split())

min = p + q
if(min > q + r):
    min = q + r
elif(min > p + r):
    min = P + r
print(min)

Submission status: Runtime Error

Solution code:
count = 0
total = 0
for i in sorted(a_i):
    total = total + i
    count = count + 1
    if count == 2:
        break
print(total)

Submission status: Runtime Error

Solution code:
A, B, C = stdin.readline().rstrip().split()
answer_1 = A + B
answer_2 = A + C
answer_3 = B + C

print(max(answer_1,answer_2,answer_3))

Submission status: Runtime Error

Solution code:
P,Q,R = map(int,input().split())
a= P+Q
b = Q+R
c = R+P
ptint(min([a,b,c])

Submission status: Runtime Error

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

min_root = []
for i in L:
    for j in L:
        if i != j:
            min_root.append(i+j)
        else:
            continue

print(min(min_root))

Submission status: Runtime Error

Solution code:
# coding: utf-8

p, q, r = [int(x) for x in input().rstrip().split(" ")]

s = []
s[0] = p + q
s[1] = q + r
s[2] = r + p

print(min(s))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#https://atcoder.jp/contests/abcXXX
import __input
#-------------------------以下を提出-------------------------

p,q,r = map(int,input().split())
ans = 999
ans = min(p+q,ans)
ans = min(p+r,ans)
ans = min(q+r,ans)

print(ans)

Submission status: Runtime Error

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

bb = sorted(aa)

print(bb[0]+bb[1])

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
a, b, c, d = (int(i) for i in input().split())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
3 2 3

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
x=max(a,max(b,c))
input(a+b+c-x)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
 
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    A, B, C = list(map(int,input().split()))
    OUT=max(A,B,C)
    print(A+B+C-OUT)
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
a = map(int,input().split())
print(sum(a) - max(a))

Submission status: Runtime Error

Solution code:
p,q,r=map(int,input().split())

print(min([p+q,q+r,r+p])