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:
# solution
import io

nim,mike = map(int,input().split())

sets={int(input()) for _ in range(mike)}

modulous=10**9+7

array=[0]*(nim+1)
array[0]=1
array[1]=1
if 1 in sets:
  array[1]=0

for i in range(2,nim+1):
  if i in sets:
    continue
  array[i]=(array[i-1]+array[i-2])%modulous
print(array[nim])

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:
p.q,r = map(int,input().split())
a = int(p+q)
b = int(q+r)
c = int(r+p)
l = []
l.append(a)
l.append(b)
l.append(c)
print(min(l))

Submission status: Runtime Error

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

print(min(a[0]+ a[1], a[1] + a[2], a[2]+ a[0])

Submission status: Runtime Error

Solution code:
valores = [int(input()), int(input()), int(input())]
valores[valores.index(max(valores))]=0
print(valores[0]+valores[1]+valores[2])

Submission status: Runtime Error

Solution code:
valores = [int(input()), int(input()), int(input())]
del(valores[valores.index(max(valores))])
print(valores[0]+valores[1])

Submission status: Runtime Error

Solution code:
lista=[]
soma=[]
for x in input().split():
    lista.append(int(x))
for var1 in lista:
    for var2 in lista:
        if var1!=var2:
            soma.append(var1+var2)

min=min(soma)
print(min)

Submission status: Runtime Error

Solution code:
valores = [int(input()), int(input()), int(input())]
valores.remove(max(valores))
print(valores[0]+valores[1])

Submission status: Runtime Error

Solution code:
div = 1000000007

n, m = map(int, input().split())
a = [int(input()) for i in range(m)]

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

if 1 not in a:
    f[1] = 1

for i in range(2, n + 1):
    if i in a:
        continue
    f[i] = (f[i - 1] + f[i - 2]) % div

print(f[-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:
a = map(int, input().split())
a.sort
print(a[0]+a[1])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

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


def search(start, end, i, W):
    S1 = sum(W[0:i + 1])
    S2 = sum(W[i + 1:len(W)])

    next_i = math.floor(i / 2) if S1 >= S2 else math.floor((i + end) / 2)

    if S1 == S2: return i
    if S1 > S2:
        next_start = start
        next_end = i
    else:
        next_start = i + 1
        next_end = end
    
    # print(start, next_start, end, next_end, i, next_i, S1, S2)
    if next_start == end: return next_start
    if next_end == start: return next_end
    
    return search(next_start, next_end, next_i, W)


i = search(0, len(W) - 1, math.floor((len(W) - 1) / 2), W)

S1 = sum(W[0:i + 1])
S2 = sum(W[i + 1:len(W)])
diff = abs(S2 - S1)

print(diff)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
h, w = map(int, input().split())
s = []
a = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
	ss = input()
	s.append(ss)
	b = 0
	for j,k in enumerate(ss):
		if k == "#":
			b = 0
			a[i][j] == 0
		else:
			b += 1
			a[i][j] = b
	mx = 0
	for j in range(w-1,-1,-1):
		if a[i][j] == 0:
			mx = 0
			continue
		else:
			mx = max(a[i][j],mx)
			a[i][j] = mx

c = [[0 for i in range(h)] for j in range(w)]
for i in range(w):
	v = ""
	b = 0
	for j in range(h):
		v += s[j][i]
	for j,k in enumerate(v):
		if k == "#":
			b = 0
			c[i][j] == 0
		else:
			b += 1
			c[i][j] = b
	mx = 0
	for j in range(h-1,-1,-1):
		if c[i][j] == 0:
			mx = 0
			continue
		else:
			mx = max(c[i][j],mx)
			c[i][j] = mx

wk = 0
ans = 0
for i in range(h):
	for j in range(w):
		wk = a[i][j] + c[j][i] -1
		ans = max(ans,wk)
print (ans)

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())
S = [int(input()) for _ in range(W)]
    
floor = list(range(0,H+1))

if S.count(1) >0:
	floor[1]=0
	floor[2]=1
if S.count(2) >0:
    floor[2]=0

for i in range (3, H+1):
		floor[i]=floor[i-2]*(1-S.count(i-2))+floor[i-1]*(1-S.count(i-1))
print(floor[H]%(10**9+7))

Submission status: Runtime Error

Solution code:
#コピーです
print(sum(sorted(map(int,input().split())))[:2])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
H,W = map(int,input().split())
s = [[] for i in range(H)]
for i in range(H): s[i] = list(input())
l = [[0]*W for i in range(H)]
r = [[0]*W for i in range(H)]
d = [[0]*W for i in range(H)]
u = [[0]*W for i in range(H)]

for h in range(H):
    for w in range(W):
        if s[h][w] == ".":
            l[h][w], d[h][w] = 1,1
            if w != 0: l[h][w] = l[h][w-1] + 1
            if h != 0: d[h][w] = d[h-1][w] + 1
    for w in range(W):
        if s[H-1-h][W-1-w] == ".":
            r[H-1-h][W-1-w] = 1
            if w != 0: r[H-1-h][W-1-w] = r[H-1-h][W-w] + 1

for h in range(H):
    for w in range(W):
        if s[H-1-h][W-1-w] == ".":
            u[H-1-h][W-1-w] = 1
            if h != 0: u[H-1-h][W-1-w] = u[H-h][W-1-w] + 1
ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans, l[h][w]+r[h][w]+u[h][w]+d[h][w]-3)

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#import numpy as np
H, W = map(int, input().split())
S = [0]*H
counth = [[0]*W for _ in range(H)]  
countw = [[0]*W for _ in range(H)]

for i in range(H):
  S[i] = input()
  
for i in range(H):
  for j in range(W):
    if S[i][j]=='.':
      if counth[i][j]==0:
        b=False
        for k,s in enumerate(S[i][j:]):
          if s=='#':
            b = True
            break
        if b==False:
          k+=1
        #print(S[i][j:],l)
        counth[i][j:j+k]=[k]*k
      if countw[i][j]==0:
        b=False
        for k in range(i,H):
          if S[k][j]=='#':
            b=True
            break
        if b==False:
          k+=1
        #print(S[i:][j],m)
        for l in range(i,k):
          #print(i,j,l)
          countw[l][j]=k
      #print(i,j,count)
#print(count)
maxim = 0
for i in range(H):
  for j in range(W):
    maxim = int(max(maxim,counth[i][j]+countw[i][j]-1))
print(maxim)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A = [map(int,input().split()) for i in range(1)]

A.sort()

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

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
dp=[0]*(n+1)
dp[0]=1
dp[1]=1
for i in range(1,n+1):
    dp[i]=dp[i-2]+dp[i-1]
    if i in a:
        dp[i]=0
print(dp[n]%1000000007)

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
broken=[0]*N
for _ in range(M):
  a=int(input())
  broken[a]=1
dp=[0]*(N+2)
dp[N]=1
for i in range(N-1,-1,-1):
  if broken[i]==1:
    dp[i]=0
  else:
    dp[i]=(dp[i+1]+dp[i+2])%1000000007
print(dp[0])

Submission status: Runtime Error

Solution code:
h,w = map(int,input().split())
l = [list(input()) for i in range(h)]

c = [[[-1]*2 for i in range(w)] for i in range(h)]

def count(x,y):

    if c[x][y][0] == -1:
        n = 0
        while x+n < h and l[x+n][y] == ".":
            n += 1
        for i in range(n):
            c[x+i][y][0] = n
        
    if c[x][y][1] == -1:
        n = 0
        while y+n < w and l[x][y+n] == ".":
            n += 1
        for i in range(n):
            c[x][y+i][1] = n

    return c[x][y][0]+c[x][y][1]
ans = 0
for i in range(h):
    for j in range(w):
        if l[i][j] == ".":
            ans = max(ans,count(i,j))
print(ans-1)

Submission status: Runtime Error

Solution code:
MOD=10**9+7

N,_,*a = map(int, open(0).read().split())
A=set(a)
dp = [0 for _ in range(N+1)]
for i in range(1,3):
    if i not in A:
        dp[i]=dp[i-1]+1
for i in range(3,N+1):
    if i not in A:
        dp[i]=(dp[i-1]+dp[i-2])%MOD
    
print(dp[N])

Submission status: Runtime Error

Solution code:
from sys import stdin

P,Q,R = int(stdin.readline().rstrip().split())
print(min(P+Q,Q+R,P+R))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
P,Q,R=list(map(int,input().split()))
A=P+Q
B=Q+R
C=R+P
list=[a,b,c]
print(list[min])

Submission status: Runtime Error

Solution code:
n = int(input())
w = list(list(map(int, input().split())))
ans = []
for t in range(n):
  absolute = abs(sum(w[:t])-sum(w[t:]))
  ans.append(absolute)
print(min(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M = map(int, input().split())
a = [0]*M
for i in range(M): a[i] = int(input())

mod = [1]*N
inv = [1]*N
inf = 10**9+7
for i in range(N-1): mod[i+1] = mod[i]*(i+2)%inf
inv[N-1] = pow(mod[N-1], inf-2, inf)
for i in range(2,N+1): inv[N-i] = inv[N-i+1]*(N-i+2)%inf

def comb(cur,ai):
    if ai - cur == 1:
        return 1
    elif ai <= cur:
        return 0
    return(comb(cur, ai-1)+comb(cur,ai-2))

cur = 1
if a[0] == 1: cur += 1
cnt = 0
for i in range(M):
    if cur == a[i]:
        cnt = 0
        break
    cnt += comb(cur,a[i])
    cur = a[i]+1

print(cnt)

Submission status: Runtime Error

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

mn = 200
for i in p[:-2]:
    for j in p[i+1:]
    if (i+j < mn):
        mn = i+j

print(mn)

Submission status: Runtime Error

Solution code:
P, Q, R = map(int,input().split())
 
PQ = P + Q
QR = Q + R
RP = R + Q

temp1 = min(PQ, QR)
temp2 = min(temp2, RP)

print(temp2)

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
a = list(map(int,input().split()))
p = 10**9 + 7
a.insert(0, -1)
a.append(N+1)

def mod(n,p):
    return n % p

nk = [1]
for i in range(1,N+1):
    nk.append(mod((nk[-1] * i), p))

#ある数をAで割ったとき，その数をpで割ったときの余りを求めるのにかけるべき数を返す
def bunbo(A, p): 
    # p-2を2進数にする
    pp = p-2
    pb = list(str(format(pp, 'b')))
    # ひっくりかえす
    pb.reverse()
    # pbの要素の数lとして，A^1, A^2, A^4, A^8, ..., A^(2^l)をpで割った余りを求める
    lpp = [mod(A,p)]
    for _ in range(len(pb)-1):
        lpp.append(mod((lpp[-1] ** 2), p))
    # 必要なやつだけ足して，x=(A^(p-2)をpで割った余り)を求める
    x = 1
    for i in range(len(pb)):
        if pb[i] == '1':
            x *= lpp[i]
    return mod(x, p)
    
def nckp(a, b, c, p):
    # 0!, 1!, 2!, 3!, ..., n!をリストに入れる
    return mod((a * bunbo(b, p) * bunbo(c, p)),p)



for i in range(M-2):
    if a[i+1] - a[i] == 1:
        print(0)
        break
else:
    ans = 1
    for j in range(len(a)-1):
        if a[j] != N:
            up = a[j+1] - a[j] - 2
            step = 0
            for l in range(up//2 + 1):
                way = nckp(nk[up-l], nk[l], nk[up-2*l], p)
                step += way
            ans *= step
    print(mod(ans, p))

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:
P, Q, R = list(map(int, input().split()))
x = [P, Q, R]
maxvalue = 0
for i in x:
    if x[i] > maxvalue:
        maxvalue = x[i]
print(P + Q + R - maxvalue)

Submission status: Runtime Error

Solution code:
from math import factorial
from operator import mul
from functools import reduce
from math import sqrt

def c(n,r):
  r = min(n-r,r)
  if r == 0 or r == n:
    return 1
  else:
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
def num(k): # k段昇る場合の数
  return int((((1+sqrt(5))/2) ** k - ((1-sqrt(5))/2) ** k) / sqrt(5))
  """
  l,r = k // 2, 0
  for i in range(l+1):
    r += c(k-i,i)
    r %= mod
  return r
  """

n,m=map(int,input().split())
mod = 10 ** 9 + 7

if m == 0:
  print(num(n) % mod)
  exit()

a=[int(input()) for i in range(m)] # 壊れてる段

# ここから先 m > 0
a = [-1] + a + [n+1] # len(a)=m+2
sa = [a[i+1]-a[i]-2 for i in range(len(a)-1)]
ans = 1
#print(sa)
for i in sa:
  ans *= num(i)
  ans %= mod
print(ans)

Submission status: Runtime Error

Solution code:
o_list = o.split(" ")
o_list_i = [int(s) for s in o_list]
o_list_i.sort()

o0 = int(o_list_i[0])
o1 = int(o_list_i[1])
print( o0 + o1 )

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=set([int(input()) for i in range(m)])#setにしないとTLEになる
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in a:
        dp[i]=0
print(dp[n])
# 入力
# 6 1
# 3

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=0
if m!=0:
    a=int(input())
b=1
s=[1]*(n+1)
for i in range(1,n+1):
    if i!=a:
        if i-2>=0:
            s[i]=(s[i-1]+s[i-2])%1000000007
        else:
            s[i]=s[i-1]%1000000007
    elif b!=m:
        s[i]=0
        a=int(input())
        b+=1
    else:
        s[i]=0
print(s[n])

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
 
print((a+b+c)-max(a,b,c))

Submission status: Runtime Error

Solution code:
a = input()
b = input()
c = input()
 
print( (a + b + c) - max(a, b, c))

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())

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

Submission status: Runtime Error

Solution code:
mod = 10**9+7
n, m = map(int, input().split())
stairs = [0]*(n+1)
broken = []
stairs[0] = 1

def binSearch(broken, e):
    l, r = 0, m-1

    while l <= r:
        mid = (l+r)//2

        if broken[mid] > e:
            r = mid - 1
        elif broken[mid] < e:
            l = mid + 1
        else:
            return True
    return False


for i in range(m):
    b = int(input())
    if broken and b-1 == broken[-1]:
        print(0)
        exit(0)
    broken.append(b)

for i in range(n+1):
    if binSearch(broken, i):
        continue
    if i >= 2:
        stairs[i] = stairs[i-1] + stairs[i-2]
    elif i == 1:
        stairs[i] = stairs[i-1]

print(stairs[-1]%mod)

Submission status: Runtime Error

Solution code:
A = int(input())
W = list(map(int,input().split()))
tmp = 0
ans = 0
wa = 0

for i in range (A):
    wa += W[i]
for i in range (A):
    tmp += W[i]
    tmp_r = wa-tmp
    if i == 0:
        ans = tmp
    if ans > abs(tmp-tmp_r):
        ans = abs(tmp-tmp_r)
print(ans)

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
dp = [0 for i in range(N+1)]
dp[0] = 1
dp[1] = 1
for i in range(2,N+1):
  if (i-2 in a) and (i-1 in a):
    dp[-1] = 0
    break
  elif i-2 in a:
    dp[i] = dp[i-1]
  elif i-1 in a:
    dp[i] = dp[i-2]
  else:
    dp[i] = dp[i-1] + dp[i-2]

print(dp[-1]%(7+10**9))

Submission status: Runtime Error

Solution code:
N=int(input())
W = list(map(int,input().split()))
tmp = 10000000
for i in range(N):
  if tmp >= abs(sum(W[:i+1]) - sum(W[i:])):
    tmp = abs(sum(W[:i+1]) - sum(W[i:]))
    ans = i-1
print(ans)

Submission status: Runtime Error

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

t = soated(time)

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

Submission status: Runtime Error

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

total = soated(p, q, r)

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

Submission status: Runtime Error

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

if p+q >= p+r or p+q >= q+r:
    print(p+q)

elif q+r >= p+q and q+r >= p+r:
    print(q+r)

elif p+r >= p+q and p+e >= q+r:
    print(p+r)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

a.sort()
return(a[0]+a[1])

Submission status: Runtime Error

Solution code:
k=list(map(int,input().split().strip()))
kk=max(k)
k.remove(kk)
print(sum(k))

Submission status: Runtime Error

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

half = sum(w) / 2

wk = 0
for i in range(n):
    
    if( wk + w[i] >= half):
        wk += w[i]      
        break
    wk += w[i]  

zenhan = 0
for j in range(0,i + 1):

    zenhan += w[j]  

kouhan = 0
for j in range(i + 1, n):
    kouhan += w[j]  

print(abs(zenhan - kouhan))

Submission status: Runtime Error

Solution code:
N = int(input())
W = map(int, input().split())
s1, s2 = 0, sum(W)
ans = sum(W)
for i in range(N):
	s1 += W[i]
	s2 -= W[i]
	ans = min(ans, abs(s1 - s2))
print(ans)

Submission status: Runtime Error

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

list = []

list = P,Q,R
newlist = sorted(list)

a = newlist[0] + newlist[1]
print(a)

Submission status: Runtime Error

Solution code:
l = list(input().split())
s_l = l.sort()

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

Submission status: Runtime Error

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

time = time.sort()

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

Submission status: Runtime Error

Solution code:
p, q, r = map(int, raw_input().split())
mx = p
if mx < q:
    mx = q
if mx < r:
    mx = r
    
print p +  q + r - max

Submission status: Runtime Error

Solution code:
s = input()
l = s.split(' ')
m = list (map(int, l))
p, q, r = m

def shortest_round(p, q, r):
  list_of_times = [p + q, p + r, q + r]
  return min(list_of_times)

print(shortest_round(s))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
p = int(input())
q = int(input())
r = int(input())
a = p + q
b = q + r
c = p + r
print(max(a,b,c))

Submission status: Runtime Error

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

def recur(step):
  if step == N:
    return 1　
  
  elif step in A or step > N:
    return 0
  
  else:
    ret1 = recur(step + 1) 
    ret2 = recur(step + 2) 
    return (ret1 + ret2) % (10 ** 9 + 7) 
    
print(recur(0))

Submission status: Runtime Error

Solution code:
T=list(map(int,input().split(' '))).sort()
print(sum(T[-1]))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=[]
b=[0]*(n+1)
b[0]=1
MOD=(10**9)+7

a.append(int(input()) for i in range(m))
  
if 1 not in a:
  b[1]=1
else:
  b[1]=0
  
for j in range(2,n+1):
  if j in a:
    continue
  else:
    b[j]=(b[j-1]+b[j-2])%MOD
    
print(b[n]%MOD)

Submission status: Runtime Error

Solution code:
A = [int(input()) for i in range(3)]

ans = sum(A) - max(A)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
print(sum(sorted(input().split())[:2]))

Submission status: Runtime Error

Solution code:
p,q,r = [int(x) for x in input().split()]
p,q,r.sort()
answer = p,q,r[0] + p,q,r[1]
print(answer)

Submission status: Runtime Error

Solution code:
p,q,r = [int(i) for i in input().split(' ')]

l = list(p,q,r)
l.sort()

ans=l[0]+l[1]

print(ans)

Submission status: Runtime Error

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

x = p+q
y = q+r
z = r+p

print(min([x,y,z]))

Submission status: Runtime Error

Solution code:
p,q,r = [int(i) for i in input().split(' ')]

x= p+q
y= q+r
z= r+z

print(min([x,y,z]))

Submission status: Runtime Error

Solution code:
p,q,r = [int(i) for i in input().split(' ')]

x= p+q
y= q+r
z= r+z

print(min([x,x,z]))

Submission status: Runtime Error

Solution code:
N,M = map(int, input().split())
A = [int(input()) for a in range(M)]
	
DP = [0] * (N + 1)	
DP[0] = 1

mod = (10 ** 9) + 7

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

print(DP[N] % (mod))
提出情報

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:
'''A - Airplane
https://atcoder.jp/contests/abc129/tasks/abc129_a

>>> main(1, 3, 4)
4
>>> main(3, 2, 3)
5
'''

from itertools import permutations


def main(p, q, r):
    _max = 100

    for p in permutations([p, q, r], 2):
        if _max > sum(p):
            _max = sum(p)

    print(_max)


if __name__ == '__main__':
    p, q, r = map(int, input().split(' '))
    main()

Submission status: Runtime Error

Solution code:
import sys
n,m = map(int,input().split())
a = []
for i in range(m):
    a.append(int(input()))
fib = [1,1]
for i in range(n):
    fib.append((fib[i]+fib[i+1])%1000000007)
if m == 0:
	print(fib[n])
    sys.exit()
answer = fib[a[0]-1]
for i in range(m-1):
    if a[i] + 1 == a[i+1]:
        answer = 0
    else:
        answer = answer * fib[a[i+1]-a[i]-2] % 1000000007
answer = answer * fib[n-a[m-1]-1] % 1000000007
print(answer)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

list = [P, Q, R]
min1 = min(list)
list.pop(min1)
min2 = min(list)
print(min1 + min2)

Submission status: Runtime Error

Solution code:
p = int(input('P'))
q = int(input('Q'))
r = int(input('R'))
n = p + q
if n > q + r:
    n = q + r
if n > r + p:
    n = r + p
print(n)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from math import *

def fib(n):
    return ((1+sqrt(5))**(n+1)  -  (1-sqrt(5))**(n+1)) // (2**(n+1)*sqrt(5))


def how_many_ways(lst_of_broken_steps,goal):

    for i in range(len(lst_of_broken_steps)-1):#連続しているbrokenステップがあった時
        if lst_of_broken_steps[i]+1==lst_of_broken_steps[i+1]:
            return 0
    
    #1回目のbrokenステップの処理
    ans = fib(lst_of_broken_steps[0]-1)
    ans = ans % 1000000007

    for i in range(1,len(lst_of_broken_steps)):#2回目以降のbrokenステップの処理
        ans *= fib((lst_of_broken_steps[i]-1)-(lst_of_broken_steps[i-1]+1))
        ans = ans%1000000007
    

    #最後のbrokenステップの処理の後からゴールまで
    ans *= fib(goal-(lst_of_broken_steps[-1]+1))

    return ans % 1000000007



goal,n = map(int,input().split())
lst_of_broken_steps = []
for i in range(n):
    lst_of_broken_steps.append(int(input()))

print(int(how_many_ways(lst_of_broken_steps,goal)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)] # a_0...a_(M-1)

def fib(x): # フィボナッチ数列
    a, b = 1, 1
    if x == 0:
        return a
    elif x == 1:
        return b
    else:
        for i in range(x-1):
            a, b = b, a + b
        return b
"""
# 再帰だとTLEとかREとかになるよ
def fib(x): # フィボナッチ数列
    if x == 0:
        return(1)
    elif x == 1:
        return(1)
    else:
        return(f(x-1) + f(x-2))
"""

ans = 0
MOD = 10**9 + 7

if M == 0:
    ans += fib(N) % MOD
    print(ans)
else:
    ans += fib((a[0]-1) - 0) % MOD # 0段目からa_0-1段目に上る(その後a_0段目を飛ばしてa_0+1段目に上る)
    for i in range(1, M): # iは1からM-1
        stair = (a[i] - 1) - (a[i-1] + 1) # 登る段数
        if stair >= 0:
            ans *= fib(stair) % MOD # a_(i-1)+1段目からa_i-1段目に上る(その後a_i段目を飛ばしてa_i+1段目に上る)
        else:
            ans = 0
            break
    ans *= fib(N - (a[M-1] + 1)) % MOD # a_M-1段目からN段目に上る
    print(ans % MOD)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
        ans = max(ans, max(x[i]))
print(ans)

Submission status: Runtime Error

Solution code:
p, q, r = (int(i) for i in input().split())
if p >= q & p >= r :
  max = p
if q >= p & q >= r :
  max = q
if r >= p & r >= q :
  max = r
print(p + q + r - max)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def dp(n):
    d=[0]*(n+1)
    if n==1:
        return 1
    else:
         d[0]=1
         if a[1]==0:
            d[1]=1
         else:
            d[1]=0
         for i in range(2,n+1):
            if a[i]==0:
                d[i]=(d[i-1]+d[i-2])%1000000007
            else:
                d[i]=0
         return d[n]

n,m=map(int, input().split())
a=[0]*(n+1)
for i in range(0,m):
    k=int(input())
    a[k]=1
print(dp(n))

Submission status: Runtime Error

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

a = []
#通過できない階段をaに格納
for _ in range(m):
    a.append(int(input()))
    
count = [0]*(n+1)
count[0] = 1
for i in range(1,n+1):
    if i in a:
        continue
    else:
        count[i] = count[i-1]+count[i-2]

print(count[-1]%(10**9+7))

Submission status: Runtime Error

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

if m > 0:
  As = set(map(int, sys.stdin))
else:
  As = set()

nums = [0] * (n + 1)
nums[0] = 1
if 1 in As:
  pass
else:
  nums[1] = 1
  
for i in range(2, n + 1):
  if i in As:
    continue
  else:
    nums[i] = (nums[i-1] + nums[i-2]) % 1000000007
    
print(nums[-1])

Submission status: Runtime Error

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

print(p + q + r - map(p, q, r))

Submission status: Runtime Error

Solution code:
d = {}


def calc_step_combination(num):
    if num <= 0:
        return 0
    if num == 1 or num == 2:
        return 1
    if num in d:
        return d[num]
    res = calc_step_combination(num - 1) + calc_step_combination(num - 2)
    d[num] = res
    return res


def sol(n, a_list):
    if len(a_list) == 0:
        print(0)
        return
    step_batch = []
    batch_start = 0
    for a in a_list:
        step_batch.append(a - batch_start)
        batch_start = a + 1
    step_batch.append(n - batch_start + 1)

    result = 1
    for i, steps in enumerate(step_batch):
        result *= calc_step_combination(steps)
    print(result % 1000000007)


def main():
    n, m = map(int, input().split())
    a_list = []
    for i in range(0, m):
        a_list.append(int(input()))
    sol(n, a_list)


main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

#フィボナッチ数列の初期値を調節
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 dp[i-2] == 0 and dp[i-1] == 0:
    ans = 0
    flag = 1
    break
  elif i in a:
    continue
  else:
    dp[i] = dp[i-1] + dp[i-2]
if flag == 0:
  ans = dp[n]
print(ans%(10**9+7))