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:
import sys
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
H, W = read_int()

range_W = range(W)
range_H = range(H)
# nomal
L = [[0 for _ in range_W] for _ in range_H]
R = [[0 for _ in range_W] for _ in range_H]
U = [[0 for _ in range_W] for _ in range_H]
D = [[0 for _ in range_W] for _ in range_H]
res = [[0 for _ in range_W] for _ in range_H]
grid = []

append = grid.append
for i in range_H:
    row = list(" ".join(input()).split())
    append(row)

def solve():
    ans = 0
    for i in range_H:
        for j in range_W:
            if grid[i][j] == ".":
                L[i][j] = 1 if j == 0 else L[i][j - 1] + 1
                U[i][j] = 1 if i == 0 else U[i - 1][j] + 1
                res[i][j] += L[i][j] + U[i][j]
                ans = max(res[i][j], ans)

            if grid[H - i - 1][W - j - 1] == ".":
                R[H - i - 1][W - j - 1] = 1 if j == 0 else R[H - i - 1][W - j] + 1
                D[H - i - 1][W - j - 1] = 1 if i == 0 else D[H - i][W - j - 1] + 1
                res[H - i - 1][W - j - 1] += R[H - i - 1][W - j - 1] + D[H - i - 1][W - j - 1]
                ans = max(res[H - i - 1][W - j - 1], ans)
    return ans - 3

if __name__ == "__main__":
    print(solve())

Submission status: Runtime Error

Solution code:
import sys, math, heapq
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
H, W = read_int()


# nomal
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
res = [[0 for _ in range(W)] for _ in range(H)]
grid = []

append = grid.append
for i in range(H):
    row = list(" ".join(input()).split())
    append(row)

def solve():
    ans = 0
    for i in range(H):
        for j in range(W):
            if grid[i][j] == ".":
                L[i][j] = 1 if j == 0 else L[i][j - 1] + 1
                U[i][j] = 1 if i == 0 else U[i - 1][j] + 1
                res[i][j] += L[i][j] + U[i][j]
                ans = max(res[i][j], ans)
 
            if grid[H - i - 1][W - j - 1] == ".":
                R[H - i - 1][W - j - 1] = 1 if j == 0 else R[H - i - 1][W - j] + 1
                D[H - i - 1][W - j - 1] = 1 if i == 0 else D[H - i][W - j - 1] + 1
                res[H - i - 1][W - j - 1] += R[H - i - 1][W - j - 1] + D[H - i - 1][W - j - 1]
                ans = max(res[H - i - 1][W - j - 1], ans)
    return ans - 3

if __name__ == "__main__":
    print(solve())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
pqr = list(map(int, input().split()))
kumi = [(pqr[0], pqr[1]), (pqr[1], pqr[2]), (pqr[0], pqr[2])
seki = []
for c in kumi:
	seki.append(c[0]*c[1])
print(min(seki))

Submission status: Runtime Error

Solution code:

N,M = map(int,input().split())
step  = [-1] * (N + 1)

for _ in range(M):
    a = int(input())
    step[a-1] = 0

if step[0] == -1:
    step[0] = 1

if step[1] == -1:
    step[1] = step[0]+1

for i in range(2,N):
    if step[i] == -1:
        step[i] = step[i-1]+step[i-2]

print(step[N-1] % 1000000007)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

l=list(p,q,r)
l=sorted(l)

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

Submission status: Runtime Error

Solution code:
times=list(map(int, input().split()))
time=[]
for i in range(len(times)):
    for j in range(len(times)):
        if times.index(times[i]) == times.index(times[j]):
            continue
        
        time.append(times[i]+times[j])

print (min(time))

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:
p, q, r = map(int, input().split())
sorted_list = sorted(list[p, q, r])
ans = sorted_list[0] + sorted_list[1]
print(ans)

Submission status: Runtime Error

Solution code:
MOD=10**9+7
n,m=map(int,input().split())
A=[1 for i in range(n)]
if n!=1:
  A[1]=2
  for i in range(m):
    A[int(input())-1]=0
  
  if A[0]==0 and A[1]!=0:
    A[1]=1


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

    
  print(A[n-1])
  
else:print(1)

Submission status: Runtime Error

Solution code:
#nn
N,M=map(int,input().split())
a = [int(input()) for _ in range(M)]
dp = [0]*(N+1)
j = 0
dp[0] = 1
mod = 10**9+7
for i in range(1, N+1):
    if j < M and i == a[j]:
        j += 1
    elif i == 1:
        dp[i] = 1
    else:
        dp[i] = (dp[i-1]+dp[i-2]) % mod
print(dp[N])

Submission status: Runtime Error

Solution code:
# ABC129C - Typical Stairs
import sys
input = sys.stdin.readline
 
def main():
    N, M = tuple(map(int, input().split()))
    A = set(map(int, [input() for _ in range(M)]))
    MOD = 10 ** 9 + 7
    dp = [0] * (N + 1)
    dp[:2] = 1, 1 if 1 not in A else 0
    for i in range(2, N + 1):
        if i in A:
            continue
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
    print(dp[-1])
 
 
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import statistics
lis = []
for i in range(3):
  a = int(input())
  a = [a]
  lis += a
x = min(lis)
y = statistics.median(lis)
print(x+y)

Submission status: Runtime Error

Solution code:
import statistics
lis = []
for i in range(3):
    a = int(input())
    a = [a]
    lis += a
x = min(lis)
y = statistics.median(lis)
print(x+y)

Submission status: Runtime Error

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

broken = []
for i in range(M):
    broken.append(int(input()))

dp = [0] * (N + 2)
dp[N] = 1
for i in reversed(range(N)):
    if i in broken:
        dp[i] = 0
        if len(broken) != 0:
            broken.pop(-1)
        continue
    dp[i] = (dp[i+1] + dp[i+2]) % MOD

print(dp[0])

Submission status: Runtime Error

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

    s1, s2 = 0,sum(L)
    ans = sum(L)

    for i in range(N):
        s1 += L[i]
        s2 -= L[i]
        ans = min(ans, abs(s1-s2))

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import numpy as np
lst = list(input().split())

num = len(lst)

A = lst[0] + lst[1]
B = lst[1] + lst[2]
C = lst[0] + lst[2]

print(np.min([A,B,C]))

Submission status: Runtime Error

Solution code:
import numpy as np
lst = list(input().split())

num = len(lst)

A = lst[0] + lst[1]
B = lst[1] + lst[2]
C = lst[0] + lst[2]

print(np.min(np.array(A,B,C)))

Submission status: Runtime Error

Solution code:
import numpy as np
lst = list(input().split())

num = len(lst)

A = lst[0] + lst[1]
B = lst[1] + lst[2]
C = lst[0] + lst[2]

print(min(np.array(A,B,C)))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

def solve(H: int, W: int, S: "List[str]"):
    L = [[0 for _ in range(W)] for _ in range(H)]
    R = [[0 for _ in range(W)] for _ in range(H)]
    D = [[0 for _ in range(W)] for _ in range(H)]
    U = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if S[i][j] != '#':
                if j == 0:
                    L[i][j] = 1
                else:
                    L[i][j] = L[i][j-1] + 1
            jj = W - 1 - j
            if S[i][jj] != '#':
                if jj == W-1:
                    R[i][jj] = 1
                else:
                    R[i][jj] = R[i][jj+1] + 1
            if S[i][j] != '#':
                if i == 0:
                    D[i][j] = 1
                else:
                    D[i][j] = D[i-1][j] + 1
            ii = H - 1 - i
            if S[ii][j] != '#':
                if ii == H-1:
                    U[ii][j] = 1
                else:
                    U[ii][j] = U[ii+1][j] + 1
    mx = 0 
    for i in range(H):
        for j in range(W):
            m = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
            if mx < m:
                mx = m
    print(int(mx))

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [ next(tokens) for _ in range(H) ]  # type: "List[str]"
    solve(H, W, S)

if __name__ == '__main__':
    main()

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

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
mod = 10**9+7
dp1=0;dp2=1
for i in range(n):
	dp1,dp2=dp2,(dp1+dp2)*(not i+1 in a)
	if dp1==dp2==0:
		print(0);exit()
print(dp2%mod)

Submission status: Runtime Error

Solution code:
P,Q,R = map(int,input().split(' '))
List = [P,Q,R].sort()
print(List[0]+List[1])

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(min(p+q,q+r),r+p)))

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 = list(map(int,input().split()))
print(SUM(A) - MAX(A))

Submission status: Runtime Error

Solution code:
ini=input().split()
ini=[int(i) for i in ini]
N=ini[0]
M=ini[1]

a=[0]
for i in range(M):
    a.append(int(input()))
a.append(N)

#print(a)
ans=1
def fib(n):
    
    atai = 1
    atai2 = 2
   # global atai,atai2
    if n==1:
        atai2=1
        return atai2
    if n==2:
        atai2=2
        return atai2
    else:
        for i in range(1,n):
            temp=atai2
            atai2=atai+temp
            atai=temp
        return atai2
#print(N,M)
for i in range(M+1):
    b=a[i+1]-a[i]-1
    # if i==M:
    #     ans=ans*fib(N-a[i]-1)
    #     print("iff",ans,fib(N-a[i]-1))
    if b==0 and a[1]!=1:
        ans=0
        break
    if b>0:
        ans=ans*fib(b)
#        if ans>1000000007:
        ans=ans % 1000000007
#        print("if",ans,fib(b))
#        print(ans,fib(b),c[i])

ans=ans % 1000000007
print(ans)

Submission status: Runtime Error

Solution code:
time = list(int(input()) for i in range(3))
time.remove(max(time))
print(sum(time))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
broken = []
for i in range(m):
    broken.append(int(input()))
    
num = [-1] * (n + 1)
num[0] = 1
num[1] = 1


for i in broken:
    num[i] = 0

for i in range(2, n):
    if num[i] == -1:
        num[i] = (num[i-1] + num[i-2])%1000000007
        
if n <= 1:
    print(num[n])
else:
    print((num[n-1]+num[n-2])%1000000007)

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:
P = input()
Q = input()
R = input()

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
W = list(map(int, input().split()))
 
sum_W = sum(W)
add_W = 0
 
for i in range(N):
   add_W += W[i]
   if add_W >= sum_W - add_W:
       print(min(abs(add_W - sum_W + add_W), abs(add_W - W[i] - sum_W + add_W - W[i])))
       break

Submission status: Runtime Error

Solution code:
P, Q, R = list(map (int, input().split(' ') ) )
if P+Q > P+R. Q+R ;
    print(P+Q)
elif P+R>P+Q,Q+R:
    print(P+R)
else:
    print(Q+R)

Submission status: Runtime Error

Solution code:
H, W = list(map(int, input().split()))
M = [['.' for w in range(W)] for h in range(H)]
for h in range(0, H):
    M[h] = list(input())

Yoko = [[0 for w in range(W)] for h in range(H)]
Tate = [[0 for w in range(W)] for h in range(H)]
for h in range(0, H):
    for w in range(0, W):
        if M[h][w] != '#':
            if w >= 0 and M[h][w - 1] != '#':
                Yoko[h][w] = Yoko[h][w - 1]
            else:
                c = 0
                for d in range(w, W):
                    if M[h][d] == '#':
                        break
                    c += 1
                Yoko[h][w] = c
for w in range(0, W):
    for h in range(0, H):
        if M[h][w] != '#':
            if h >= 0 and Tate[h - 1][w] > 0:
                Tate[h][w] = Tate[h - 1][w]
            else:
                c = 0
                for d in range(h, H):
                    if M[d][w] == '#':
                        break
                    c += 1
                Tate[h][w] = c
mx = 0
for w in range(0, W):
    for h in range(0, H):
        if M[h][w] != '#':
            c = Yoko[h][w] + Tate[h][w] - 1
            if c > mx:
                mx = c
print(mx)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

# In[64]:


import numpy as np
H, W = map(int, input().split())
S = np.array([list(input()) for i in range(H)])
"""
4 6
#..#..
.....#
....#.
#.#...
"""


# In[72]:


field = np.ones((H, W))
field[S=='#'] = 0
lm, rm, um, dm = (field.copy() for _ in [0]*4)
#print(field)


# In[73]:


#np.where()
for i in range(1, H):
    um[i] = (um[i-1]+1) * field[i]
    dm[-1-i] = (dm[-i]+1) * field[i]
    
for i in range(1, W):
    lm[:, i] = (lm[:, i-1]+1) * field[:, i]
    rm[:, -1-i] = (rm[:, -i]+1) * field[:, i]


# In[75]:


#print(um)
#print(dm)
#print(lm)
#print(rm)
print(int(np.max(um+dm+lm+rm)-3))


# In[ ]:

Submission status: Runtime Error

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

# In[27]:


import numpy as np
H, W = map(int, input().split())
S = np.array([list(input()) for i in range(H)])
"""
4 6
#..#..
.....#
....#.
#.#...
"""


# In[51]:


row_beam = np.zeros((H, W))
col_beam = np.zeros((H, W))
sh, sw = np.where(S=='#')


# In[52]:


#np.where()
for i in range(H):
    #print(i)
    #print(row_beam)
    row = S[i]
    #sharp_pos = np.where(row=='#')[0]
    sharp_pos = sw[sh==i]
    #print(sharp_pos)
    if len(sharp_pos) == 0:
        row_beam[i] = W
    else:
        s = 0
        for sp in sharp_pos:
            contin = sp-s
            row_beam[i, s:sp] = contin
            s = sp+1
        if s != W:
            row_beam[i, s:W] = W-s
            
for i in range(W):
    #print(i)
    #print(col_beam)
    col = S[:,i]
    #sharp_pos = np.where(col=='#')[0]
    sharp_pos = sh[sw==i]
    #print(sharp_pos)
    if len(sharp_pos) == 0:
        col_beam[:, i] = H
    else:
        s = 0
        for sp in sharp_pos:
            contin = sp-s
            col_beam[s:sp, i] = contin
            s = sp+1
        if s != W:
            col_beam[s:H, i] = H-s


# In[53]:


print(int(np.max(row_beam+col_beam-1)))


# In[54]:


#print(row_beam)
#print(col_beam)


# In[ ]:

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if (a>=b)&&(b>=c):
  ans=a+b
  print("",ans)
elif (b>=a)&&(c>=a):
  ans=b+c
  print("",ans)
else (a>=c)&&(c>=b):
  ans=a+c
  print("",ans)

Submission status: Runtime Error

Solution code:
n=int(input())
w=list(map(int,input().split()))
ans=100000000;
s1=0
s2=0
 
for i in range(n):
    s1 += sum(w[:i+1])
    s2 += sum(w[i+1:])
            
    if abs(s1-s2) < ans:
        ans = abs(s1-s2)
    
print(ans)

Submission status: Runtime Error

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

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:
p,q,r = map(int, input().split())
print(min(p+q,q+r,r+s))

Submission status: Runtime Error

Solution code:
using namespace std;
#include<iostream>
#include<algorithm>
#include<vector>

int main(){
    int p,q,r;
    cin >> p >> q >> r;
    vector<int> arr{p, q, r};
    sort(arr.begin(), arr.end());
    cout << arr[0] + arr[1];
}

Submission status: Runtime Error

Solution code:
AB, BC, AC = [int(_) for _ in raw_input().split(" ")]

M = [[0, AB, AC],
     [AB, 0, BC],
     [AC, BC, 0]]

def A(l):
    t = [0] * l
    def Sub(targetList, n):
        if 1:
            if len(targetList) == 1:
                t[n] = targetList[0]
                yield t
                t[n] = 0
            for i in range(len(targetList)):
                p = targetList[:i] + targetList[i+1:]
                t[n] = targetList[i]
                for j in Sub(p, n+1):
                    yield j
        else:
            pass
    
    for i in (Sub(tuple(range(l)), 0)):
        yield i

_min = 10**100
for i in A(3):
    _sum = 0
    for j in range(1, len(i)):
        _from = i[j-1]
        _to = i[j]        
        _sum += M[_from][_to]
    #print (_sum)
    if _min > _sum:
        _min = _sum
print (_sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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:
import sys
n,m = map(int,input().split())

if m > 0:
    broken = set(map(int,sys.stdin))
else:
    broken = set()
    
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 1 if 1 not in broken else 0

MOD = 10**9 + 7

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

Submission status: Runtime Error

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

if m > 0:
    broken = set(map(int,sys.stdin))
else:
    broken = set()
    
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 1 if 1 not in broken else 0

MOD = 10**9 + 7

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

Submission status: Runtime Error

Solution code:
H,W = [int(i) for i in input().split()]
F = [list(input()) for i in range(H)]

lights_arr = []
for h in range(H):
  for w in range(W):
    if F[h][w] == ".":
      h_cnt = 0
      w_cnt = 0
      
      i = h
      while i < H:
        if F[i][w] == "#":
          break
        h_cnt += 1
        i += 1
        
      i = h
      while i >= 0:
        if F[i][w] == "#":
          break
        h_cnt += 1
        i -= 1
        
      j = w
      while j < W:
        if F[h][j] == "#":
          break
        w_cnt += 1
        j += 1
        
      j = w
      while j < W:
        if F[h][j] == "#":
          break
        w_cnt += 1
        j -= 1
       
      
      lights = h_cnt + w_cnt -3
      
      lights_arr.append(lights)
      
print(max(lights_arr))

Submission status: Runtime Error

Solution code:
from operator import mul
from functools import reduce

n, m = [int(i) for i in input().split()]
arr = [int(input()) for i in range(m)]
arr.append(n+1)
arr.insert(0, -1)
div_arr = [arr[i+1]-arr[i]-1 for i in range(len(arr)-1)]


def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

if 0 in div_arr:
  print(0)
else:
  print(reduce(mul, [Fib(i+1) for i in div_arr])%1000000007)

Submission status: Runtime Error

Solution code:
time = list(map(int, input(),split()))
sum = time[0] + time[1]
if sum > time[1] + time[2]:
  sum = time[1] + time[2]
if sum > time[0] + time[2]:
  sum = time[0] + time[2]
print(sum)

Submission status: Runtime Error

Solution code:
time = list(map(int, input(),split()))
sum = time[0] + time[1]
if sum > time[1] + time[2]:
  sum = time[1] + time[2]
if sum > time[0] + time[2]:
  sum = time[0] + time[2]
print(sum)

Submission status: Runtime Error

Solution code:
time = list(map(int, input(),sprit()))
sum = time[0] + time[1]
if sum > time[1] + time[2]:
  sum = time[1] + time[2]
if sum > time[0] + time[2]:
  sum = time[0] + time[2]
print(sum)

Submission status: Runtime Error

Solution code:
L = input()
 
intL = int(L)
L10 = int(L, 2)
sum_ = 0
for a in range(L10+1):
  for b in range(L10+1):
    if ((a + b) <= L10) and ((a + b) == (a ^ b)):
      sum_+=1
 
print(sum_ % (10**9 + 7))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())
s = [[c for c in input()] for i in range(H)]
s_vrt = [[s[i][j] for i in range(H)] for j in range(W)]

dp_l = [[0 for j in range(W)] for i in range(H)]
dp_r = [[0 for j in range(W)] for i in range(H)]
dp_u = [[0 for i in range(H)] for j in range(W)]
dp_d = [[0 for i in range(H)] for j in range(W)]


def mark_table_for_dp():
    for i in range(H):
        mark_line_for_dp(s[i], dp_l[i], False)
        mark_line_for_dp(s[i], dp_r[i], True)
    for j in range(W):
        mark_line_for_dp(s_vrt[j], dp_u[j], True)
        mark_line_for_dp(s_vrt[j], dp_d[j], False)



def mark_line_for_dp(line, dp, is_reverse):
    cnt = 0
    r = list(range(len(line)))
    if is_reverse:
        r.reverse()
    for i in r:
        if line[i] == '#':
            cnt = 0
            continue
        dp[i] = cnt
        cnt += 1


mark_table_for_dp()


def count_light_cross(i, j):
    return dp_l[i][j] + dp_r[i][j] + dp_u[j][i] + dp_d[j][i] + 1


count_max = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            continue
        count = count_light_cross(i, j)
        if count_max < count:
            count_max = count

print(count_max)

Submission status: Runtime Error

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

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:
# スペース区切りの整数の入力
p,q,r = map(int, input().split(' '))

# 出力
Print(p+q+r-max(p, q, r))

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:

p,q,r = map(int, raw_input().split())


Print(p+q+r-max(p, q, r))

Submission status: Runtime Error

Solution code:
# スペース区切りの整数の入力
p,q,r = map(int, raw_input().split())

# 出力
Print(p+q+r-max(p, q, r))

Submission status: Runtime Error

Solution code:
# スペース区切りの整数の入力
p, q, r = map(int, raw_input().split())

# 出力
Print(p+q+r-max(p, q, r))

Submission status: Runtime Error

Solution code:
# スペース区切りの整数の入力
p, q, r = map(int, raw_input().split())

n=max(p, q, r)

# 出力
Print(p+q+r-n)

Submission status: Runtime Error

Solution code:
# スペース区切りの整数の入力
p, q, r = map(int, raw_input().split())

n=max(p, q, r)

# 出力
Print str(p+q+r-n)

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:
P, Q, R = int(input()), int(input()), int(input())
print(min(P+Q, Q+R, R+P))

Submission status: Runtime Error

Solution code:
P, Q, R = int(input('P:')), int(input('Q:')), int(input('R:'))
print(P, Q, R)
print(min(P+Q, Q+R, R+P))

Submission status: Runtime Error

Solution code:
print(hello)

Submission status: Runtime Error

Solution code:
lists = [P+Q,Q+R,R+P]
print(min(lists))

Submission status: Runtime Error

Solution code:
n=int(input())
arr=[int(x) for x in input().split(' ')]
total=sum(arr)
temp=0
ans=1000
for item in arr:
  temp+=item
  a=total-temp
  ans=min(ans,abs(a-temp))
print(ans)

Submission status: Runtime Error

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

a = P + Q
b = Q + R
c = R + P

if a > b and a > c:
  print('a')
elif b > c:
  print('b')
else
  print('c')

Submission status: Runtime Error

Solution code:
input_data=input()

P=int(input_data[0])

Q=int(input_data[2])

R=int(input_data[4])

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

print(P+Q+R-X)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
result=[]
N = int(input())
W = list(map(int,input().split()))
for i in range(1:N+1):
  a = W[:i]
  b = W[i+1:N]
  c = sum(a)
  d = sum(b)
  e = abs(c-d)
  result.append(e)
 
print(min(result))

Submission status: Runtime Error

Solution code:
i = list(map(int,input().split()))
a = i[0]+i[1]
b = i[0]+i[2]
c = i[1]+i[2]
d = list(a,b,c)
print(min(d))

Submission status: Runtime Error

Solution code:
i = list(map(int,input().split()))
a = i[0]+i[1]
b = i[0]+i[2]
c = i[1]+i[2]
d = list(a,b,c)
print(d.min())

Submission status: Runtime Error

Solution code:
def inpl(): return list(map(int, input().split()))
X, A = inpl()
if X < A:
    print(0)
else:
    print(10)

Submission status: Runtime Error

Solution code:
def fib(n):
    a, b = 1, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

n,m = map(int,input().split())
if m != 0:
  a = [int(input()) for i in range(m)]
  ans = fib(a[0])
  for j in range(1,m):
    if m == 1:
        continue
    elif a[j] == a[j-1]+1:
        ans = 0
    else:
        ans *= fib(a[j]-a[j-1]-1)
  ans *= fib(n-a[m-1])
else:
  ans = fib(n+1)
print(ans%1000000007)

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:
n = int(input())
w = list(map(int,input().split()))
ans = float('inf')
for j in range(n):
  ans = min(ans,abs(sum(w[0:j])-sum(w[j:n])))
print(ans)

Submission status: Runtime Error

Solution code:
import sys

N,M = list(map(int, input().split()))
a = [int(input()) - 1 for i in range(M)]
memo = [-1 for i in range(N)]

def process(n): #n段目まで何通りでいけるか？
    if memo[n] != -1:
        return memo[n]
    if n == -1: # nが-1
        return 1
    if n < -1:
        return 0
    if n in a:
        memo[n] = 0
        return 0
    if n == 0:
        memo[0] = 1
        return 1
    cnt = process(n-1) + process(n-2)
    memo[n] = cnt
    return cnt

print(process(N-1) % 1000000007)

Submission status: Runtime Error

Solution code:
x = list[map(int,input().split())]
b = sum(x)-max(x)
print(b)

Submission status: Runtime Error

Solution code:
p = list(map(int, input()))
print(sum(p)-max(p))

Submission status: Runtime Error

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

from itertools import combinations

print(min([sum(i) for i in combinations([p,q,r], 2)]))

Submission status: Runtime Error

Solution code:
import math
import numpy as np
from decimal import *
L,A,B,M=map(int, input().split())

def matpow(X,n,mod):
  E = np.eye(N=X.shape[0],dtype=int)
  Y = X%mod
  if n == 1:
    return Y
  else:
    return np.dot(matpow(np.dot(Y,Y)%mod,n//2,mod), (Y if n % 2 else E))%mod
  
a = 0
for d in range(1,19):
  left = math.ceil(Decimal(10**(d-1)-A)/Decimal(B))
  right = math.ceil(Decimal(10**d-A)/Decimal(B))-1
  if right < 0:
    continue
  if left > L-1:
    break
  if left > right:
    continue
  if left < 0:
    left = 0
  if right > L-1:
    right = L-1
  mat = np.matrix([[10**d,0,0],[1,1,0],[0,1,1]])
  result = np.dot(np.array([a,A+B*left,B])%M, matpow(mat,right-left+1,M))
  a = result[0,0]%M
  
print(a)

Submission status: Runtime Error

Solution code:
def main():
    h, w = map(int, input().split())
    ss = [input() for _ in range(h)]

    matl = [[0 for _ in range(w)] for _ in range(h)]
    matr = [[0 for _ in range(w)] for _ in range(h)]
    matu = [[0 for _ in range(w)] for _ in range(h)]
    matd = [[0 for _ in range(w)] for _ in range(h)]

    for j in range(h):
        for i in range(w):
            if ss[j][i] == '#':
                matd[j][i] = 0
            elif j == 0:
                matd[j][i] = 1
            else:
                matd[j][i] = matd[j - 1][i] + 1

            if ss[h - j - 1][i] == '#':
                matu[h - j - 1][i] = 0
            elif h - j == h:
                matu[h - j - 1][i] = 1
            else:
                matu[h - j - 1][i] = matu[h - j][i] + 1

            if ss[j][i] == '#':
                matr[j][i] = 0
            elif i == 0:
                matr[j][i] = 1
            else:
                matr[j][i] = matr[j][i - 1] + 1

            if ss[j][w - i - 1] == '#':
                matl[j][w - i - 1] = 0
            elif w - i == w:
                matl[j][w - i - 1] = 1
            else:
                matl[j][w - i - 1] = matl[j][w - i] + 1

    maxv = 0
    for j in range(h):
        for i in range(w):
            tmp = matu[j][i] + matd[j][i] + matr[j][i] + matl[j][i]
            if tmp > maxv:
                maxv = tmp
    print(maxv - 3)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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