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:
from sys import setrecursionlimit
setrecursionlimit(10 ** 8)

A = input()
B = input()

class Source():
  def __init__(self, S):
    self.S = S
    self.pos = 0
   
  
def peek(S):
  return S.S[S.pos] if S.pos < len(S.S) else -1

def next(S):
  print(S.S[S.pos], end='')
  S.pos += 1
  
def tree(S):
  next(S)
  if peek(S) == ')':
    next(S)
    return -1
  left = tree(S)
  center = root(S)
  right = tree(S)
  next(S)
  
def root(S):
  res = 0
  next(S)
  while peek(S) != ']':
    res += res * 10 + int(peek(S))
    next(S)
  next(S)
  
  return res
  
tree(Source('(' + A + ')'))

Submission status: Runtime Error

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


 
ab = a+b
bc = b+c
ac = a+c
 
minimum = min(ab,bc,ac)
 
print(minimum)

Submission status: Runtime Error

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


 
ab = a+b
bc = b+c
ac = a+c
 
minimum = min(ab,bc,ac)
 
print(minimum)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;

#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=a:i<n;i--)

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << min({ a + b,b + c,c + a }) << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

minAbs = 0
isFirst = True

for i in range(count):
    leftSum = 0
    rightSum = 0
    for leftIndex in range(i + 1):
        leftSum += nums[leftIndex]

    for rightIndex in range(i + 1, count):
        rightSum += nums[rightIndex]

    if isFirst:
        minAbs = abs(leftSum - rightSum)
        isFirst = False
    else:
        minAbs = min(abs(leftSum - rightSum),minAbs)
        

print(minAbs)

Submission status: Runtime Error

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

minAbs = 0
isFirst = True

for i in range(count):
    leftSum = 0
    rightSum = 0
    for leftIndex in range(i + 1):
        leftSum += nums[leftIndex]

    for rightIndex in range(i + 1, count):
        rightSum += nums[rightIndex]

    if isFirst:
        minAbs = abs(leftSum - rightSum)
    else:
        minAbs = min(abs(leftSum - rightSum),minAbs)
        isFirst = False

print(minAbs)

Submission status: Runtime Error

Solution code:
import numpy as np
from pprint import pprint


def solve(MM, H, W):

    L, R, U, D = np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int)

    for i in range(H):
        i_r = H - 1 - i

        # L, U
        for j in range(W):
            j_r = W - 1 - j

            # L
            if MM[i][j]:
                if j == 0:
                    L[i][j] = 1
                else:
                    L[i][j] = L[i][j - 1] + 1

            # R
            if MM[i][j_r]:
                if j_r == W - 1:
                    R[i][j_r] = 1
                else:
                    R[i][j_r] = R[i][j_r + 1] + 1

            # U
            if MM[i][j]:
                if i == 0:
                    U[i][j] = 1
                else:
                    U[i][j] = U[i - 1][j] + 1

            # D
            if MM[i_r][j]:
                if i_r == H - 1:
                    D[i_r][j] = 1
                else:
                    D[i_r][j] = D[i_r + 1][j] + 1

    print((L + R + U + D - 3).max())


def solve2(MM, H, W):
    L, R, U, D = [MM.copy() for _ in range(4)]

    # U, D
    for i in range(1, H):
        U[i] = (U[i - 1] + 1) * MM[i]
        i_r = H - 1 - i
        D[i_r] = (D[i_r + 1] + 1) * MM[i_r]

    MM_T = MM.T
    L_T, R_T = L.T, R.T

    # L, R
    for i in range(1, W):
        L_T[i] = (L_T[i - 1] + 1) * MM_T[i]
        i_r = W - 1 - i
        R_T[i_r] = (R_T[i_r + 1] + 1) * MM_T[i_r]

    L, R = L_T.T, R_T.T
    print((L + R + U + D).max() - 3)


def stdin():
    H, W = [int(x) for x in input().split()]
    MM = np.zeros((H, W), dtype=int)

    for i in range(H):
        line = str(input())

        for j in range(W):
            if line[j] != '#':
                MM[i][j] = 1

    solve2(MM, H, W)


if __name__ == '__main__':
    stdin()

Submission status: Runtime Error

Solution code:
list = [int(i) for i in input().split()] 
s = min(list)
list.strip(s)
t = min(list)
Time = s+t
print(Time)

Submission status: Runtime Error

Solution code:
def Fib(n):
    s, t = 0, 1
    if n == 1:
        return s
    elif n == 2:
        return t
    else:
        for i in range(n-2):
            s, t = t, s + t
        return t
def FIB(q):
    return Fib(q+1)

n,m = map(int,input().split())
A =[]
add = 1
ex = 0
y = 0
for _ in range(m):
    a = int(input())
    A.append(a)
for i in range(1,n+1):
    if A.count(i) == 1 and A.count(i+1) == 1 :
        ex += 1
    else:
        ex += 0
if ex >= 1:
    print(0)
else:
    if A[0] == 1:
        if m ==1:
            add *= FIB(n - 1)
        else:
            for j in range(0,m-1):
                y = A[j+1]-A[j] -1
                add *= FIB(y)
            add *= FIB(n-A[m-1])
    else:
        if m == 1:
            z =0
            for l in range(1,A[0]):
                z += FIB(l)
            add *= z*(FIB(n - A[0]))
        else:
            c = 0
            for u in range(1,A[0]):
                c += FIB(u)
                add *=c
            for k in range(0,m-1):
                y = A[k+1]-A[k] -1
                add *= FIB(y)
            add *= FIB(n - A[m-1])

    print(add % 1000000007)

Submission status: Runtime Error

Solution code:
import numpy as np
L,A,B,M=(int(i) for i in input().split())
array=np.arange(A,A+B*L-1,B)
result=""
for i in range(L):
    result+=str(array[i])
print(int(result)%M)

Submission status: Runtime Error

Solution code:
L = set([int(x) for x in stdin.readline().rstrip().split()])
print(sum(L)-max(L))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
function Main(input){
  A = input.split(' ').map(n => parseInt(n)).sort((a, b) => a - b);
  min = 100;
  for (let i = 0; i < A.length; i++) {
    for (let j = i + 1; j < A.length; j++) {
      console.log("i : " + i + "/ j : " + j);
      sum = A[i] + A[j];
      if (sum < min) {
        min = sum;
      }
    }
  }
  console.log(min)
}

Main(require("fs").readFileSync("/dev/stdin","utf-8"));

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
p, q, r = map(int, input().split())
lst = []
lst.extend(p, q, r)
lst.sort()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
nums = [int(x) for x in stdin.readline().rstrip().split()]

print(nums)

Submission status: Runtime Error

Solution code:
import numpy as np
NM = input()
N, M = NM.split(" ")
del NM
N, M = int(N), int(M)
broken_steps = [int(input()) for num in range(M)]
#all_steps = [num for num in range(N+1)]
all_steps = np.ones(N+1, dtype=np.int64)  ##np.int32だと足りない
all_steps[broken_steps] = 0
ok_steps = list(all_steps)
#ok_steps = [0 if num in broken_steps else 1 for num in range(len(all_steps))]
#for num in range(len(all_steps)):
#  if num in broken_steps:
#    ok_steps.append(0)
#  else:
#  	ok_steps.append(1)
#del all_steps, broken_steps
#print(ok_steps)
for num in range(0, len(ok_steps)):
  i = - (num + 1)
  
  if (i==-1 or i==-2):
    pass
  else:
    if ok_steps[i]==0:
      pass
    else:
      ok_steps[i] = ok_steps[i+1] + ok_steps[i+2]
      

#for num in range(0, len(ok_steps)):
#  i = - (num + 1)
#  
#  if (i==-1 or i==-2):
#    pass
#  else:
#    if ok_steps[i]==0:
#      pass
#    else:
#      print(i)
#      ok_steps[i] = ok_steps[i+1] + ok_steps[i+2]
#print(ok_steps[-3])        
print(ok_steps[0]%1000000007)

Submission status: Runtime Error

Solution code:
text

Submission status: Runtime Error

Solution code:
test

Submission status: Runtime Error

Solution code:
N=int(input())
inp=list(map(int,input().split(' ')))
su=sum(inp)
ab=su
for i in range(N):
  s1=0
  for j in range(i):
    s1+=inp[j]
  if (ab>abs(2*s1-su)):
    ab=abs(2*s1-su)
print(ab)

Submission status: Runtime Error

Solution code:
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
dp = [0]*(N+1)
dp[0]=1
a = [ni() for i in range(M)]
isbro = [1]*(N+1)
for i in range(M):
    isbro[a[i]]=0
#print(isbro)
for i in range(N):
    if(i-1>=0):
        dp[i+1] = dp[i]*isbro[i] + dp[i-1]*isbro[i-1]
    else:
        dp[i+1] = dp[i]*isbro[i]
    dp[i+1]%=MOD
#print(dp)
print(dp[N])

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())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(raw_input())
A = map(int, raw_input().split())
ans = 10**18
for i in xrange(1, N):
  ans = min(ans, abs(sum(A[:i]) - sum(A[i:])))
print ans

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
mod=10**9+7
def f(a,r):
    s=[[0,0],[0,0]]
    s[0][0]=(a[0][0]*r[0][0]+a[0][1]*r[1][0])%mod
    s[0][1]=(a[0][0]*r[0][1]+a[0][1]*r[1][1])%mod
    s[1][0]=(a[1][0]*r[0][0]+a[1][1]*r[1][0])%mod
    s[1][1]=(a[1][0]*r[0][1]+a[1][1]*r[1][1])%mod
    return s
b=[[1,1],[1,0]]
k=[b]
for i in range(20):
    k.append(f(k[-1],k[-1]))
n,m=map(int,input().split())
t=0
ans=1
for i in range(m):
    a=int(input())
    if t==a:
        print(0)
        break
    else:
        s=bin(a-1-t)[2:]
        s="0"*(21-len(s))+s
        s=s[::-1]
        p=[[1,0],[0,1]]
        for j in range(21):
            if s[j]=="1":
                p=f(p,k[j])
        ans=(ans*p[0][0])%mod
        t=a+1
        if i==m-1:
            s=bin(n-t)[2:]
            s="0"*(21-len(s))+s
            s=s[::-1]
            p=[[1,0],[0,1]]
            for j in range(21):
                if s[j]=="1":
                    p=f(p,k[j])
            ans=(ans*p[0][0])%mod
else:
    print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

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

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

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

print(dp[n])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
 
H, W = list(map(int, input().split()))

# H, W = 4, 6
board = []
L = [[0 for i in range(W)] for i in range(H)]
R = [[0 for i in range(W)] for i in range(H)]
U = [[0 for i in range(W)] for i in range(H)]
D = [[0 for i in range(W)] for i in range(H)]

# board = [['#', '.', '.', '#', '.', '.'], ['.', '.', '.', '.', '.', '#'], ['.', '.', '.', '.', '#', '.'], ['#', '.', '#', '.', '.', '.']]

# insert elements to the board
for i in range(H):
	a = list(input())
	board.append(a)


# high_score is output values
high_score = 0
	
# round robin
for h in range(H):
	for w in range(W):
		# print(h, w)
		# board put light is envolved
		score = 1
		# if not obstacle in board[h][w]
		if board[h][w] != "#":
			# DOWN
			for i in range(1, H):
				if h - i == -1:
					break
				elif board[h - i][w] == "#":
					break
			score += i - 1
			D[h][w] = i - 1
			
			# UP
			if h == 0 or board[h - 1][w] == "#":
				U[h][w] = 0
			else:
				U[h][w] = U[h - 1][w] + 1
			score += U[h][w]
			
			# RIGHT
			for i in range(1, W):
				if w + i == W:
					break
				elif board[h][w + i] == "#":
					break
			score += i - 1
			R[h][w] = i - 1
			
			# LEFT
			if w == 0 or board[h][w - 1] == "#":
				L[h][w] = 0
			else:
				L[h][w] = L[h][w - 1] + 1
			score += L[h][w]
			
			# print(score)
			if score > high_score:
				high_score = score
				
print(high_score)

Submission status: Runtime Error

Solution code:
import math
 
H, W = list(map(int, input().split()))
board = []
L = [[0 for i in range(W)] for i in range(H)]
R = [[0 for i in range(W)] for i in range(H)]
U = [[0 for i in range(W)] for i in range(H)]
D = [[0 for i in range(W)] for i in range(H)]

# H, W = 4, 6
# board = [['#', '.', '.', '#', '.', '.'], ['.', '.', '.', '.', '.', '#'], ['.', '.', '.', '.', '#', '.'], ['#', '.', '#', '.', '.', '.']]

# insert elements to the board
for i in range(H):
	a = list(input())
	board.append(a)


# high_score is output values
high_score = 0
	
# round robin
for h in range(H):
	for w in range(W):
		# print(h, w)
		# board put light is envolved
		score = 1
		# if not obstacle in board[h][w]
		if board[h][w] != "#":
			# DOWN
			for i in range(1, H):
				if h - i == -1:
					break
				elif board[h - i][w] == "#":
					break
			score += i - 1
			D[h][w] = i - 1
			
			# UP
			if h == 0 or board[h - 1][w] == "#":
				U[h][w] = 0
			else:
				U[h][w] = U[h - 1][w] + 1
			score += U[h][w]
			
			# RIGHT
			for i in range(1, W):
				if w + i == W:
					break
				elif board[h][w + i] == "#":
					break
			score += i - 1
			R[h][w] = i - 1
			
			# LEFT
			if w == 0 or board[h][w - 1] == "#":
				L[h][w] = 0
			else:
				L[h][w] = L[h][w - 1] + 1
			score += L[h][w]
			
			# print(score)
			if score > high_score:
				high_score = score
				
print(high_score)

Submission status: Runtime Error

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

if P < Q < R:
    t1 = P
    t2 = Q
elif P < R < Q:
    t1 = P
    t2 = R
else:
    t1 = Q
    t2 = R

print(t1+t2)

Submission status: Runtime Error

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

if P < Q < R:
    t1 = P
    t2 = Q
elif P < R < Q:
    t1 = P
    t2 = R
else:
    t1 = Q
    t2 = R

print(t1+t2)

Submission status: Runtime Error

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

if P < Q < R:
	t1 = P
    t2 = Q
elif P < R < Q:
    t1 = P
    t2 = R
else:
    t1 = Q
    t2 = R

print(t1+t2)

Submission status: Runtime Error

Solution code:

import sys


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



a1 = P + Q.
a2 = P + R
a3 = Q + R

value = 300
if a1 < value:
    value = a1
if value > a2:
    value = a2
if value > a3:
    value = a3
print(value)

Submission status: Runtime Error

Solution code:

import sys


P = int(sys.argv[1]) 
Q = int(sys.argv[2]) 
R = int(sys.argv[3]) 
 
a1 = P + Q.
a2 = P + R
a3 = Q + R

value = 300

if __name__ == '__main__':
    if a1 < value:
        value = a1
    if value > a2:
        value = a2
    if value > a3:
        value = a3
    print(value)

Submission status: Runtime Error

Solution code:

import sys


P = sys.argv[1]
Q = sys.argv[2]
R = sys.argv[3]




numbers = [P,Q,R]

combinations = ['_','_','_']

numbers = []

a1 = P + Q.
a2 = P + R
a3 = Q + R

value = 300 


 
if __name__ == '__main__': 
    if a1 < value:
        value = a1 
    if value < a2:
        value = a2
    if value < a3:
        value = a3 
    return value

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
   
s = [0 if n-i in a else -1 for i in range(n+1)] 
s[0] = s[1] = 1

for i in range(2, n+1):
    if s[i] == 0:
        continue
    s[i] = (s[i-1] + s[i-2]) % 1000000007

if s[n] < 0:
    print(0)
else:
    print(s[n])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(2, n+1):
    if s[i] == 0:
        continue
    s[i] = (s[i-1] + s[i-2]) % 1000000007

print(s[n])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <stdio.h>
int main(void)
{
    int p, q, r, a, b, c;

    scanf("%d%d%d", &p, &q, &r);

    a = p + q;
    b = q + r;
    c = r + p;

    if(a <= b && a <= c) printf("%d\n", a);
    else if(b <= a && b <= c) printf("%d\n", b);
    else if(c <= a && c <= b) printf("%d\n", c);

    return 0;
    
}

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
p,q,r=map(int,input().split())
ptint(min(p+q,q+r,r+p))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
p,q,r=map(int,input().split())
ptint(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:
a,b,c = map(int,input().split)
print(min(a+b,a+c,b+c)

Submission status: Runtime Error

Solution code:
import numpypy as np
words = lambda t : list(map(t, input().split()))



h,w = words(int)
wq = [0] * w

grid = []
for i in range(h):
    grid.append(list(input()))

ans = 0
for i in range(h):
    j = 0
    while j < w:
        #print(i,j, grid[i][j])
        if grid[i][j] == '#':
            wq[j] = 0
            j+=1
            continue
        k = 0
        while j+k < w:
            if grid[i][j+k] == '.':
                k += 1
            else:
                break
        #print(i,j,k)
        if k + h > ans:
            for x in range(j,j+k):
                vplus = 0
                if not wq[x] == 0:
                    vplus = wq[x]
                else:
                    for vi in range(i-1,-1,-1):
                        if grid[vi][x] == '#':
                            break
                        else:
                            vplus += 1
                    for vi in range(i+1,h):
                        if grid[vi][x] == '#':
                            break
                        else:
                            vplus += 1
                ans = max(ans, vplus+k)
                wq[x] = vplus
        j += k
print(ans)

Submission status: Runtime Error

Solution code:
from functools import lru_cache
import sys
sys.setrecursionlimit(10**6)

def main(N, M, a_list):
    div = 10**9 + 7
    @lru_cache(maxsize=None)
    def fib(n):
        if n in a_list:
            return 0
        else:
            if n == -1:
                return 0
            elif n == 0 or n == 1:
                return 1
            else:
                return fib(n-2) % div + fib(n-1) % div
    
    
    print(fib(N) % div )


if __name__ == "__main__":
    N, M = [int(x) for x in input().split()]
    a_list = []
    for _ in range(M):
        a_list.append(int(input()))

    main(N, M, a_list)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
status = [True]*(N+2)
for _ in range(M):
    status[int(input())] = False

dp = [0]*(N+2)
dp[0] = 1
for i in range(N):
    if status[i+1]:
        dp[i+1] += dp[i]
    if status[i+2]:
        dp[i+2] += dp[i]
print(dp[N])

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
ls = [[x for x in input() + '#'] for i in range(n)] + [['#']*(m+1)]
yokodp = [[0 for x in range(m+1)] for i in range(n+1)]
for i in range(n+1):
    yoko = 0
    for j in range(m+1):
        if ls[i][j] == '#':
            yokodp[i][j] = yoko
            yoko = 0
        else:
            yoko += 1
for i in range(n,-1,-1):
    check = 0
    for j in range(m,-1,-1):
        if yokodp[i][j] != 0:
            check = yokodp[i][j]
        if ls[i][j] == '.':
            yokodp[i][j] = check
tatedp = [[0 for x in range(m+1)] for i in range(n+1)]            
for j in range(m+1):
    tate = 0
    for i in range(n+1):
        if ls[i][j] == '#':
            tatedp[i][j] = tate
            tate = 0
        else:
            tate += 1
for j in range(m,-1,-1):
    for i in range(n,-1,-1):
        if tatedp[i][j] != 0:
            check = tatedp[i][j]
        if ls[i][j] == '.':
            tatedp[i][j] = check
ans = 0
for i in range(n):
    for j in range(m):
        if ls[i][j] == '.':
            ans = max(ans,tatedp[i][j] + yokodp[i][j] - 1)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
w = list(map(int,input(),split()))
ans = 1000000000
for t in range(1, n):
    left = sum(w[:t])
    right = sum(w[t:])
    ans = min(ans , abs(left - right))
print(ans)

Submission status: Runtime Error

Solution code:
P, Q, R = map(int, input().split())
times = [P, Q, R]
from itertools import combinations
 
min_ = 200
for i in combinations(times, r=2):
  j = sum(i)
  if j < max_:
    min_ = j

print(min_)

Submission status: Runtime Error

Solution code:
p = input('P:')
q = input('Q:')
r = input('R:')

ABC = p + q
BCA = q + r
CAB = r + p

min = ABC
if min > BCA:
  min = BCA
  
if min > CAB:
  min = CAB

print(min)

Submission status: Runtime Error

Solution code:
# C
# Typical Stairs

N_M = input()

N = int(N_M.split(" ")[0])
M = int(N_M.split(" ")[1])

a = []

for i in range(M):

    a.append(int(input()))

#print(a)

import numpy as np

stairs = list(np.zeros(N + 1))

if 1 in a:

    stairs[1] = 0
    stairs[2] = 1

elif 2 in a:

    stairs[1] = 1
    stairs[2] = 0

elif 1 in a and 2 in a:

    stairs[1] = 0
    stairs[2] = 0

else:

    stairs[1] = 1
    stairs[2] = 2

for i in range(N + 1):
    
    if i in a:

        stairs[i] = 0
    
    elif i > 2:

        stairs[i] = int(stairs[i - 1] + stairs[i - 2])

    #print(stairs)

print(stairs[-1] % 1000000007)

Submission status: Runtime Error

Solution code:
N=int(input())
M=input().split()
for i in range(N):
    M[i]=int(M[i])
S1=0
S2=sum(M)
t=100000
for i in range(N):
    S1+=M[i]
    S2=S2-M[i]
    if t>abs(S2-S1):
        t=abs(S2-S1)
print(t)

Submission status: Runtime Error

Solution code:
from bisect import bisect_right
from collections import defaultdict
h, w = map(int, input().split())
c = []
bf, bl = defaultdict(list), defaultdict(list)
ans = 0

for i in range(h):
    s = input()
    c.append(s)
    for j in range(w):
        if s[j] == '#':
            bl[i].append(j)
            bf[j].append(i)

for i in range(h):
    for j in range(w):
        tmp = 0
        if c[i][j] == '.':
            vert = bisect_right(bf[j], i)
            horz = bisect_right(bl[i], j)
            #print(bf[j], bl[i], i, j, vert, horz)
            if bf[j] == []:
                tmp += h-1
            elif i < bf[j][0] or bf[j][-1] < i:
                if i < bf[j][0]:
                    tmp += bf[j][0]-1
                else:
                    tmp += h-bf[j][-1]-2
            else:
                tmp += bf[j][vert]-bf[j][vert-1]-2
            if bl[i] == []:
                tmp += w-1
            elif j < bl[i][0] or bl[i][-1] < j:
                if j < bl[i][0]:
                    tmp += bl[i][0]-1
                else:
                    tmp += w-bl[i][-1]-2
            else:
                tmp += bl[i][horz]-bl[i][horz-1]-2
        ans = max(ans, tmp+1)
print(ans)

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:
h,w=map(int,input().split())
sl=[input() for i in range(h)]
ll=[[0]*w for i in range(h)]
for i in range(h):
    for j in range(w):
        if sl[i][j]=='.':
            if j==0:
                ll[i][j]=1
            else:
                ll[i][j]=ll[i][j-1]+1
        else:
            ll[i][j]=0
rl=[[0]*w for i in range(h)]
for i in range(h):
    for j in range(w-1,-1,-1):
        if sl[i][j]=='.':
            if j==w-1:
                rl[i][j]=1
            else:
                rl[i][j]=rl[i][j+1]+1
        else:
            rl[i][j]=0
ul=[[0]*w for i in range(h)]
for j in range(w):
    for i in range(h):
        if sl[i][j]=='.':
            if i==0:
                ul[i][j]=1
            else:
                ul[i][j]=ul[i-1][j]+1
        else:
            ul[i][j]=0
dl=[[0]*w for i in range(h)]
for j in range(w):
    for i in range(h-1,-1,-1):
        if sl[i][j]=='.':
            if i==h-1:
                dl[i][j]=1
            else:
                dl[i][j]=dl[i+1][j]+1
        else:
            dl[i][j]=0
ans=0
for i in range(h):
    for j in range(w):
            ans=max(ans,ll[i][j]+rl[i][j]+ul[i][j]+dl[i][j]-3)
print(ans)

Submission status: Runtime Error

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

l = W[0]
r = sum(W[1:])
diff = abs(l - r)
for i in range(1, N):
    l += W[i]
    r -= W[i]
    new_diff = abs(l-r)
    if new_diff < diff:
        diff = new_diff
print(diff)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
H,W = map(int,input().split())
List=[input() for i in range(H)]
A =[[1]*(W) for i in range(H)]
B =[[1]*(H) for i in range(W)]
for i in range(H):
    k = 0
    a = 0
    while k < W:
        if List[i][k]==".":
            a += 1
            k = k+1
        else:
            for j in range(a):
                A[i][k-j-1]=a
            A[i][k]=a
            a = 0
            k = k+1
    for j in range(a):
                A[i][k-j-1]=a
for i in range(W):
    k = 0
    a = 0
    while k < H:
        if List[k][i]==".":
            a += 1
            k = k+1
        else:
            for j in range(a):
                B[i][k-j-1]=a
            B[i][k] = 0
            a = 0
            k = k+1
    for j in range(a):
                B[i][k-j-1]= a
max = 0
for i in range(H):
    for j in range(W):
        if max < A[i][j] + B[j][i]:
            max = A[i][j] + B[j][i]
print(max-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:
N, M = map(int, input().split())
A = [0 for i in range(N + 2)]
A[0] = 0
A[1] = 1
for i in range(M):
    a = int(input()) + 1
    A[a] = -1
for i in range(2, N+2):
    if A[i] ==  -1:
        A[i] = 0
    else:
        A[i] = A[i-1]+ A[i-2]
        A[i] = A[i] % 1000000007
    #print(A)
print(A[N + 1])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from collections import deque

def solve():
    H, W = [int(_) for _ in raw_input().split()]
    S = []
    for i in range(H):
        Si = [_ for _ in raw_input()]
        S.append(Si)
    rowm = [None] * H
    for i in range(H):
        start = -1
        end = 0
        save = (start, end, i)
        for j in range(W):
            if S[i][j] == '.':
                end = j
            else:
                start = j
                end = j
            if end - start > save[1] - save[0]:
                save = (start, end, i)
        rowm[i] = save
    colm = [None] * W
    for j in range(W):
        start = -1
        end = 0
        save = (start, end, j)
        for i in range(H):
            if S[i][j] == '.':
                end = i
            else:
                start = i
                end = i
            if end - start > save[1] - save[0]:
                save = (start, end, j)
        colm[j] = save
    rowm.sort(key = lambda x: x[1] - x[0], reverse = True)
    colm.sort(key = lambda x: x[1] - x[0], reverse = True)
    def max_ans(i,j):
        s1, e1, row = rowm[i]
        s2, e2, col = colm[j]
        return e1 - s1 + e2 - s2 - 1
    # priority queue
    ij_set = set()
    ij_set.add((0, 0))
    queue = deque()
    queue.append((max_ans(0, 0), 0,0))
    def AddToQueue(_ele):
        if len(queue) == 0:
            queue.append(_ele)
        else:
            cnt = 0
            while cnt < len(queue) and queue[cnt][0] >= _ele[0]:
                cnt += 1
            ij = (_ele[1], _ele[2])
            if not (ij in ij_set):
                queue.insert(cnt, _ele)
                ij_set.add(ij)
    ret = 1
    while len(queue) > 0:
        ans, i, j = queue.popleft()
        s1, e1, row = rowm[i]
        s2, e2, col = colm[j]
        if ans == 1:
            ret = ans
            break
        if row >= s2 and row <=e2 and col >= s1 and col <= e1:
            ret = ans
            break
        if i + 1 < H:
            AddToQueue((max_ans(i+1,j), i+1, j))
        if j + 1 < W:
            AddToQueue((max_ans(i,j+1), i, j+1))
    print ret

if __name__ == '__main__':
    solve()