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: Accepted

Solution code:
import numpy as np
from collections import defaultdict
from functools import reduce

# s = input()
# n = int(input())
# A = list(map(int, input().split()))
p, q, r = map(int, input().split())

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

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p=sorted([int(i) for i in input().split()])
print(p[0]+p[1])

Submission status: Accepted

Solution code:
P, Q, R =map(int,input().split())

print(min(P+Q, Q+R, R+P))

Submission status: Accepted

Solution code:
P = [int(_) for _ in input().split()]
P = sorted(P)
print(P[0]+P[1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
P, Q, R = map(int, input().split())
print(min([P+Q, Q+R, R+P]))

Submission status: Accepted

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

print(P + Q + R - max(P, Q, R))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from operator import itemgetter
# gcd
# from fractions import gcd
# 切り上げ，切り捨て
# from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
# from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
# from collections import Counter
# import math
# from functools import reduce
#
# input関係の定義
# fin = open('in_1.txt', 'r')
# sys.stdin = fin
# 提出時はコメントアウト+上のshebangを有効にする
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


if __name__ == '__main__':

    tokens = iterate_tokens()
    P = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int

    # write code
    print(min(P+Q,Q+R,R+P))

Submission status: Accepted

Solution code:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())
nsl = lambda: list(nsm())

p, q, r = nm()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(P: int, Q: int, R: int):
    ret = min(P + Q, Q + R, P + R)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    P = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(P, Q, R)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


P, Q, R = _li()
print(min(P+Q, Q+R, R+P))

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))

x = l()

x.sort()

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

Submission status: Accepted

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

print(sum(arr) - max(arr))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

P, Q, R = MAP()

print(min(P+Q, P+R, Q+R))

Submission status: Accepted

Solution code:
import bisect
import operator
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

P, Q, R = list(map(int, sys.stdin.readline().split()))

print(P + Q + R - max(P, Q, R))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
L = [a,b,c]
L.sort()
print(L[0]+L[1])

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    p,q,r = LI()
    print(p+q+r-max(p,q,r))
    return

#B
def B():
    n = I()

    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    A()

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')

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

Submission status: Accepted

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

print(a+b+c-max(a,b,c))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
ri = lambda: int(input())
#rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

P,Q,R=rl()
print(P+Q+R-max([P,Q,R]))

Submission status: Accepted

Solution code:
import math
import fractions
import copy
#以下てんぷら
def j(q):
    if q==1: print("YES")
    elif q == 0:print("NO")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


#n = ip()                                     #入力整数1つ
p,q,r= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!
#これを消すとなぜかWAになる呪い
print(min(p+q,q+r,r+p))

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A, B, C = MI()
    print(A + B + C - max((A, B, C)))
    
    
if __name__ == '__main__':
    main()

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:

n, m = list(map(int, input().split()))
aaa = list(int(input()) for i in range(m))

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
MOD = 10 ** 9 + 7

for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i - 2] + dp[i - 1])
print(dp[n] % MOD)

Submission status: Runtime Error

Solution code:
import sys

n, m = list(map(int, input().split()))
aaa = list(map(int, sys.stdin.readlines()))

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
MOD = 10 ** 9 + 7

for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i - 2] + dp[i - 1])
print(dp[n] % MOD)

Submission status: Runtime Error

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

print(min(a+b,a+c,b+c))

Submission status: Runtime Error

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

# O(N^2)で解いても間に合う
m = 10**10
for i in range(1, N):
  a, b = 0, 0
  for j in range(i):
    a += W[j]
  for j in range(i, N):
    b += W[j]
  m = min(m, abs(a-b))
print(m)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
a = [int(input()) for i in range(m)]
a.append(n)
a.insert(0, 0)

def nCr(n, r):
  num = 1
  for i in range(r+1, n+1):
    num *= i
  return num


P = 1
for i in range(m):
  if a[i] + 1 == a[i+1]:
    print(0)
    exit()

for i in range(1, m+2):
  step = a[i] - a[i-1] - 1
  pattern = 1
  for j in range(1, int(step/2+1)):
    pattern += nCr(step-j, j)
  P *= pattern 

print(P%1000000007)

Submission status: Runtime Error

Solution code:
times = [map(int, input().split())].sort()
min = sum(times[:1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

MOD = pow(10, 9) + 7

dp = [0] * (n+1)

dp[0] = 1

broken = [False] * (n+1)
for i in range(m):
    broken[int(input())] = True

c = 1

for i in range(1, n+1):
    if broken[i]:
        dp[i] = 0
    else:
        if i == 1:
            dp[i] = dp[i-1] % MOD
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % MOD

print(dp[-1] % MOD)

Submission status: Runtime Error

Solution code:
d12=int(input())
d13=int(input())
d23=int(input())
dt1=d12+d23
dt2=d23+d13
dt3=d13+d12
if (dt1<dt2 and dt1<dt3):
    print(dt1)
elif (dt2<dt1 and dt2<dt3):
    print(dt2)
else:
    print(dt3)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
b=a.sorted()
print(int(b[0])+int(b[1]))

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
b=a.sorted()
print(b[0]+b[1])

Submission status: Runtime Error

Solution code:
is=list(map(int,input().split()))
print(sorted(lis)[0]+sorted(lis)[1])

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
print(min(min(a+b,b+c),a+c)

Submission status: Runtime Error

Solution code:
ary = list(map(lambda n: int(n), input().split(" "))).sort(reverse=True)

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

Submission status: Runtime Error

Solution code:
n=list(map(int,input().split()));print(min([i+j for i in n for j in n if i!=j]))

Submission status: Runtime Error

Solution code:
A = list(map(int,input().split(),sorted = True)
         
print(A[0]+A[1])

Submission status: Runtime Error

Solution code:
p=int(input())
q=int(input())
r=int(input())
if p+q<q+r and p+q<p+r:
    print(p+q)
if p+r<p+q and p+r<q+r:
    print(p+r)
if q+r<p+r and q+r<p+q:
    print(q+r)

Submission status: Runtime Error

Solution code:
p=int(input())
q=int(input())
r=int(input())
if p+q<q+r and p+q<p+r:
    print(p+q)
if p+r<p+q and p+r<q+r:
    print(p+r)
else:
    print(q+r)

Submission status: Runtime Error

Solution code:
p=int(input())
q=int(input())
r=int(input())
if p+q<q+r and p+q<p+r:
    print(p+q)
if q+r<p+q and p+r<q+r:
    print(p+r)
else:
    print(q+r)

Submission status: Runtime Error

Solution code:
p=int(input())
q=int(input())
r=int(input())
if p+q<q+r and p+q<p+r:
    print(p+q)
else:
    print(q+r)

Submission status: Runtime Error

Solution code:
p=int(input())
q=int(input())
r=int(input())
if p+q<q+r and p+q<p+r:
    print(p+q)

else:
    print(q+r)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=[0]*(n+1)
if m>0:
  for _ in range(m):
    a[int(input())]+=1
dp=[0]*(n+1)
dp[0]=1
if a[1]!=1:
  dp[1]=1
if n==1:
  if a[1]==0:
    print(1)
    exit()
  else:
    print(0)
    exit()
for i in range(2,n+1):
  if a[i-2]==0 and a[i-1]==0:
    dp[i]=dp[i-2]+dp[i-1]
  elif a[i-1]!=0 and a[i-2]==0:
    dp[i]=dp[i-2]
  elif a[i-2]!=0 and a[i-1]==0:
    dp[i]=dp[i-1]
  else:
    dp[i]=0
print(dp[n]%(10**9+7))

Submission status: Runtime Error

Solution code:
a, b, c = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
print(min(min(a + b, b + c), c + a)

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7

n, m = map(int, readline().split())
a = list(map(int, read().split()))

dp = [0] * (n + 1)
ng = [0] * (n + 1)

for i in a:
    ng[i] = 1

dp[0] = 1
if ng[1] != 1:
    dp[1] = 1

for i in range(2, n + 1):
    if ng[i - 1] == 1 and ng[i - 2] == 1:
        print(0)
        exit()
    elif ng[i - 1] == 1:
        dp[i] = dp[i - 2]
    elif ng[i - 2] == 1:
        dp[i] = dp[i - 1]
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
    if dp[i] > MOD:
        dp[i] %= MOD

print(dp[-1])

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
a = [ int(input()) for _ in range(m)]
M=10**9+7
lis = [1] + [0]*n

for i in a:
  lis[i]=-1
lis[1] += 1
for i in range(n-1):
  if lis[i+2]<0:
    lis[i+2]= 0
  else:
    lis[i+2] = (lis[i+1] + lis[i])%M
print(lis[n])

Submission status: Runtime Error

Solution code:
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use std::cmp::min;

#[fastout]
fn main() {
    input! {
    p: usize,
    q: usize,
    r: usize
    }
    let ans = min(p + q, min(q + r, r + p));
    println!("{}", ans);
}

Submission status: Runtime Error

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

for j in range(N-1):
    W1 = W[:j+1]
    W2 = W[j+1:N]
    s = abs(sum(W1) - sum(W2))
    m = min(m, s)

print(m)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
a = []

for i in range(m):
    a.append(int(input()))

dp = [0] * (n+1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i not in a:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
        
print(dp[n])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
    a,b,c=map(int,input().split(' '))
    print(sum([a,b,c])-,max(a,b,c))

main()

Submission status: Runtime Error

Solution code:
import math
 
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
def count_combinations(min_val, max_val):
    path_len = max_val - min_val - 2
    if path_len < 2:
        return 1
    twos = path_len // 2
    min_amount = twos + (path_len % 2)
    count = 0
    for i in range(min_amount, path_len + 1):
        count += comb(i, twos)
        twos -= 1
    return count
 
def conut_paths(a):
    paths = 1
    for i in range(len(a) - 1):
        paths *= count_combinations(a[i], a[i + 1])
    return paths % 1000000007
 
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]
A.sort()
 
for i in range(1, M):
    if A[i - 1] + 1 == A[i]:
        print(0)
        exit()
 
A.insert(0, -1)
A.append(N + 1)
print(conut_paths(A))

Submission status: Runtime Error

Solution code:
p, q, r = map(int, input().split())
ans = min(a+b, b+c, c+a)
print(ans)

Submission status: Runtime Error

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

if __name__ == '__main__':
	main()

Submission status: Runtime Error

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

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=(int(n[a])+int(n[i]))
            lis1.append(str(z))

minscore='9999999999'
for i in range(0,len(n)):
    if float(minscore)>float(lis1[i]):
        minscore=lis1[i]

print(minscore)

Submission status: Runtime Error

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

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=(int(n[a])+int(n[i]))
            lis1.append(str(z))
minscore='9999999999'
for i in range(0,len(n)):
    if float(minscore)>float(lis1[i]):
        minscore=lis1[i]

print(minscore)

Submission status: Runtime Error

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

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=(int(n[a])+int(n[i]))
            lis1.append(str(z))
             
print(int(min(lis1)))

Submission status: Runtime Error

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

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=int(n[a]+n[i])
            lis1.append(str(z))
           
print(min(lis1))

Submission status: Runtime Error

Solution code:
P = int(input())
Q = int(input())
R = int(input())
 
list1 = [P+Q, P+R, Q+P, Q+R, R+P, R+Q]
print(min(list1))

Submission status: Runtime Error

Solution code:
s=int(input("enter no. of hours of A:"))
t=int(input("enter no. of hours of B:"))
r=int(input("enter no. of hours of C:"))
p=str(input("route="))
if p=="A-B":
  print("total hours=",s+t)
elif p=="B-C":
  print("total hours=",t+r)
elif p=="A-C":
  print("total hours=",s+r)
else:
  print("total hours=",s+r+t)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
NG = []
a = 10**9+7
for i in range(M):
  NG.append(int(input()))
ans = [0 for _ in range(N + 2)]
ans[0] = 1
for i in range(N):
  if not i + 1 in NG:
    ans[i + 1] = (ans[i + 1] + ans[i])%a
  if not i + 2 in NG:
    ans[i + 2] = (ans[i + 2] + ans[i])%a
print(ans[N])

Submission status: Runtime Error

Solution code:
def main():
    from collections import defaultdict
    h, w = map(int, input().split())
    m = []
    o = []
    for _ in range(h):
        s = input()
        m.append(s)
        o.append(list(s))

    t = []
    for u in zip(*o):
        t.append(''.join(u))

    mr = [[0] * w for _ in range(h)]
    ml = [[0] * h for _ in range(w)]
    ans = 0
    for i in range(h):
        row = m[i]
        for j in range(w):
            col = t[j]
            if col[i] == '#':
                continue

            if mr[i][j]:
                c_row = mr[i][j]
            else:
                a, b = row[:j].rfind('#'), row[j + 1:].find('#')
                crl = j if a == -1 else j - 1 - a
                crr = w - j - 1 if b == -1 else b
                c_row = crl + crr
                # [j - crl, j + crr + 1)
                for k in range(j - crl, j + crr + 1):
                    mr[i][k] = c_row

            if ml[j][i]:
                c_col = ml[j][i]
            else:
                a, b = col[:i].rfind('#'), col[i + 1:].find('#')
                cll = i if a == -1 else i - 1 - a
                clr = h - i - 1 if b == -1 else b
                c_col = cll + clr
                # [i - cll, i + clr + 1)
                for k in range(i - cll, i + clr + 1):
                    ml[j][k] = c_col

            cnt = c_row + c_col + 1
            ans = max(ans, cnt)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    import sys
    from bisect import bisect_left as bl
    h, w = map(int, input().split())
    m = []
    row = []

    col = [[] for _ in range(w + 1)]
    for i in range(h):
        r = sys.stdin.readline()
        s = [-1] + [j for j, l in enumerate(r) if l == '#'] + [w]
        m.append(r)
        row.append(s)
        for k in s:
            col[k].append(i)

    ans = 0
    for i in range(h):
        r = row[i]
        for j in range(w):
            if m[i][j] == '#':
                continue
            l = [-1] + col[j] + [h]
            x, y = bl(r, j), bl(l, i)
            ans = max(ans, r[x] - r[x - 1] + l[y] - l[y - 1] - 3)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
P,Q,R=map(int,input().split())
min=P+Q
if min>Q+R:
  min=Q+R
if min>R+P:
  min=R+P:
print(min)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
mod = 1000000007

dp = [0]*(N+1)
dp[0] = 1
A = []

for _ in range(M):
    k = int(input())
    A.append(k)

if 1 in A:
   dp[1] = 0
   if 2 in A:
       dp[2] = 0
else:
    dp[1] = 1
    
for i in range(2,N+1):
    if i not in A:
        dp[i] = (dp[i-1] + dp[i-2])%mod

print(dp[-1])

Submission status: Runtime Error

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

s = sum(a,b,c)

print(s-max(a,b,c))

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(list(input()))
    
d = [[[0,0,0,0] for x in range(W)] for y in range(H)]
answer = 0
for i in range(H):
    for j in range(W):
        tmp = [0, 0, 0, 0]

        if S[i][j] == '#':
            continue
            
        # 上
        org_i = i
        
        while(org_i - 1>= 0):
            org_i -= 1
            if S[org_i ][j] == '#':
                break
            else:
                tmp[0] += 1
                c = d[org_i][j][0] 
                if c > 0:
                    tmp[0] += c
                    break
                
        d[i][j][0] = tmp[0]
        
        # 下
        org_i = i
        
        while(org_i + 1 < H):
            org_i += 1
            if S[org_i ][j] == '#':
                break
            else:
                tmp[1] += 1
                c = d[org_i][j][1] 
                if c > 0:
                    tmp[1] += c
                    break
                
        d[i][j][1] = tmp[1]
        
        # 右
        org_j = j
        
        while(org_j -1 >= 0):
            org_j -= 1
            if S[i ][org_j] == '#':
                break
            else:
                tmp[2] += 1
                c = d[i][org_j][2] 
                if c > 0:
                    tmp[2] += c
                    break
        
        d[i][j][2] = tmp[2]
        
        # 左
        org_j = j
        
        while(org_j + 1 < W):
            org_j += 1
            if S[i][org_j] == '#':
                break
            else:
                tmp[3] += 1
                c = d[i][org_j][3] 
                if c > 0:
                    tmp[3] += c
                    break
            
        d[i][j][3] = tmp[3]
        
        m = sum(d[i][j]) + 1
        if m > answer:
            answer = m
                
print(answer)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
a = []
mod = 10**9+7
d = [0 for i in range(n+1)]
    d[0] = 1
    d[1] = 1
    d[2] = 2
    for i in range(3,n+1):
        d[i] = d[i-1] + d[i-2]
    d.append(0)
if m != 0:
    for i in range(m):
        b = int(input())
        a.append(b)
    ans = 1
    if a[0] == 1:
        ans = 1
    else:
        ans = ans*d[a[0]-1]%mod
    for i in range(m-1):
        ans = ans*d[a[i+1]-a[i]-2]%mod
    ans = ans*d[n-a[m-1]-1]%mod
else:
    ans = d[n]
print(ans)

Submission status: Runtime Error

Solution code:
p, q, r = map(int, input().split())
p + q = a
q + r = b
r + p = c
print(min(a,min(b,c)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
distances = list(map(int, input().split()))
distances.sort()
ans = 0
for i in range(2):
  ans += distances
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input(),.split())
n=[a,b,c]
d=[]
for i in range(1,len(n)):
  d.append(n[i]+n[i])
print(min(d))

Submission status: Runtime Error

Solution code:
import sys
 
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
 
 
def input():
    return sys.stdin.readline().strip()
 
 
def main():
    N, M = map(int, input().split())
    dp = [0] * (N + 1)
    safe = [True] * (N + 1)
    for _ in range(M):
        a = int(input())
        safe[a] = False
 
    dp[0] = 1
    for i in range(1, N + 1):
        if i == 1 and safe[i]:
            dp[i] = dp[i - 1]
        else:
            if safe[i]:
                dp[i] = dp[i - 1] + dp[i - 2]
                dp[i] %= MOD
 
    print(dp[-1])
 
 
if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import copy
h,w = map(int, input().split())
s = [list(input()) for _ in range(h)]
t = copy.deepcopy(s)
for i in range(h):
    count = 0
    for j in range(w):
        if (s[i][j]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                s[i][k]=count
            count = 0
    for k in range(w-1,w-count-1,-1):
        s[i][k]=count
    count = 0

for i in range(w):
    count = 0
    for j in range(h):
        if (t[j][i]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                t[k][i]=count
            count = 0
    for k in range(h-1,h-count-1,-1):
        t[k][i]=count
    count = 0

ans = 0
for i in range(h):
    for j in range(w):
        if (s[i][j]!="#"):
            if (s[i][j]+t[i][j]-1 > ans):
                ans = s[i][j]+t[i][j]-1
print(ans)

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
dp=[-1]*N
dp[-1]=1
dp+=[1]
mod=10**9+7
for i in range(M):
  a=int(input())
  dp[a]=0
i=N-2
while i>=0:
  if dp[i]==-1:
    dp[i]=(dp[i+1]+dp[i+2])%mod
  i-=1
print(dp[0])

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
dp=[-1]*N
dp[-1]=1
dp+=[1]
mod=10**9+7
for i in range(M):
  a=int(input())
  dp[a]=0
i=N-2
while i>=0:
  if dp[i]==-1:
    dp[i]=dp[i+1]+dp[i+2]
  i-=1
print(dp[0])