TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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?

Submission attempts (in order):
P, Q, R = map(int, input().split())

if (P + Q) >= (R + Q) and (P + Q) >= (R + P):
  print(P + Q)
elif (R + Q) >= (P + Q) and (R + Q) >= (R + P):
  print(R + Q)
elif (R + P) >= (P + Q) and (R + P) >= (P + Q):
  print(R + P)

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
a = input().split()
a = [int(i) for i in a]
a = sort(a)
print(a[0]+a[1])

a = input().split()
a = [int(i) for i in a]
a = sorted(a)
print(a[0]+a[1])

Verdicts: Runtime Error

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

Submission attempts (in order):
p,q,r = map(int, input().split())

print(r-q + q-p)

line = list(map(int, input().split()))
line.sort()
print(line[0]+line[1])

Verdicts: Wrong Answer

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
P,Q,R = map(int, input().split())
A = [P+Q, P+R, Q+R]
print(A)


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


Verdicts: Wrong Answer

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

Submission attempts (in order):
time = list(int(input()) for i in range(3))
time.remove(max(time))
print(sum(time))

time = list(map(int, input().split()))
time.remove(max(time))
print(sum(time))

Verdicts: Runtime Error

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

Submission attempts (in order):
l = sorted([int(x) for x in input().split()])
print(sum(l[1:]))

l = sorted([int(x) for x in input().split()],reverse=True)
print(sum(l[1:]))

Verdicts: Wrong Answer

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

Submission attempts (in order):
a, b, c = list(map(int, input().split()))

d = max(a, b, c)
e = min(a, b, c)

print(d+e)


lista = input().split(" ")
a, b, c = lista
a = int(a)
b = int(b)
c = int(c)
lista1 = [a, b, c]
lista1.sort()
t = lista1[0]+lista1[1]
print(t)

Verdicts: Wrong Answer

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

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

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

P, Q, R = list(map(int, input().split()))
print(min(P+Q, Q+R, R+P))

Verdicts: Runtime Error

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

Submission attempts (in order):
l = list(input().split())
s_l = l.sort()

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

l = list(map(int, input().split()))
s_l = sorted(l)

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


Verdicts: Runtime Error

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

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



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

Verdicts: Runtime Error

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

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

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


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

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

print(P%1000000007)


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

print(sum(h)-max(h))

Verdicts: Runtime Error

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

Submission attempts (in order):
p,q,r = map(int, input().split())
print(min(p+q, q+r, r+s))

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

Verdicts: Runtime Error

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

Submission attempts (in order):
#!/home/ryo/.pyenv/versions/anaconda3-2019.03/envs/hoge/bin/python
import time
time.sleep(2)
P,Q,R = map(int,input().split())
print(min(P+Q,min(Q+R,R+P)))

#!/home/ryo/.pyenv/versions/anaconda3-2019.03/envs/hoge/bin/python

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

Verdicts: Time Limit Exceeded

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

Submission attempts (in order):
s = input().split()

if s[0] >= s[1] and s[0] >= s[2]:
    print(s[1] + s[2])
elif s[1] >= s[0] and s[1] >= s[2]:
    print(s[0] + s[2])
else:
    print(s[0] + s[1])

a, b, c= (int(i) for i in input().split()) 

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
a = list(map(int,input().split()))

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

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


linha = input()
linha = linha.split()
menor = 101
segundoMenor = 101
for x in linha:
    if int(x) < menor:
        menor = int(x)
for x in linha:
    if int(x) <= segundoMenor and int(x) != menor:
        segundoMenor = int(x)
if linha[0] == linha[1] and linha[0] == linha[2]:
    print(int(linha[0]) + int(linha[1]))
else:
    print(menor + segundoMenor)


Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
T=[map(int,input().split())]
T.sort()
print(T[0]+T[1])


P,Q,R=map(int,input().split())
T=list(P,Q,R)
T.sort()
print(T[0]+T[1])

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
pqr = input().split()
for i in range(3):
     pqr[i] = int(pqr[i])
a = min(pqr[0]*pqr[1], pqr[1]*pqr[2], pqr[2]*pqr[0])
print(a)


pqr = input().split()
for i in range(3):
     pqr[i] = int(pqr[i])
a = min(pqr[0]+pqr[1], pqr[1]+pqr[2], pqr[2]+pqr[0])
print(a)


Verdicts: Wrong Answer

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

Submission attempts (in order):
a  = list(map(int.input().split()))
a.sort();
print(a[0]+a[1])

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

Verdicts: Runtime Error

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

Submission attempts (in order):
n,m=map(int,input().split())
a = set(int(input()) for _ 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))

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

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

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
p,q,r = map(int, input().split())

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
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):
        if lst_of_broken_steps[i]+1==lst_of_broken_steps[i+1]:
            return 0
    
    
    ans = fib(lst_of_broken_steps[0]-1)
    ans = ans % 1000000007

    for i in range(1,len(lst_of_broken_steps)):
        ans *= fib((lst_of_broken_steps[i]-1)-(lst_of_broken_steps[i-1]+1))
        ans = ans%1000000007
    

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

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


Verdicts: Runtime Error

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

Submission attempts (in order):
num_list = [int(i) for i in input().split()]

LEN = 3
abc_sum = 0
for i in range(len(num_list) - 1):
  abc_sum += num_list[i]

bca_sum = 0
reversed_list = list(reversed(num_list))
for i, num in enumerate(reversed_list, 1):
  if i == LEN:
    break
  bca_sum += num

cab_sum = 0
cab_sum += num_list[-1]
cab_sum += num_list[0]

min = abc_sum
if abc_sum > bca_sum:
  min = bca_sum
elif bca_sum > cab_sum:
  min = cab_sum
print(min)

num_list = [int(i) for i in input().split()]

LEN = 3
abc_sum = 0
for i in range(len(num_list) - 1):
  abc_sum += num_list[i]

bca_sum = 0
reversed_list = list(reversed(num_list))
for i, num in enumerate(reversed_list, 1):
  if i == LEN:
    break
  bca_sum += num

cab_sum = 0
cab_sum += num_list[-1]
cab_sum += num_list[0]

l = [abc_sum, bca_sum, cab_sum]

print(min(l))

Verdicts: Wrong Answer

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

Submission attempts (in order):
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)
    

P, Q, R =map(int, input().split())
if P+Q <= P+R and P+Q <= Q+R:
    print(P+Q)
elif P+R <= P+Q and P+R <= Q+R:
    print(P+R)
else:
    print(Q+R)

Verdicts: Runtime Error

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

Submission attempts (in order):

time_list = input().split()
time_list = [int(i) for i in time_list]
time_list.sort(reverse = True)
print(time_list[0]+time_list[1])



time_list = input().split()
time_list = [int(i) for i in time_list]
time_list.sort()
print(time_list[0]+time_list[1])


Verdicts: Wrong Answer

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

Submission attempts (in order):
l = list(map(int,input().split()))
p = list[0]
q = list[1]
r = list[2]
print(min(p+q,q+r,r+p))

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


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


Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):

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)


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

Verdicts: Runtime Error

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

Submission attempts (in order):
count = 0
total = 0
for i in sorted(a_i):
    total = total + i
    count = count + 1
    if count == 2:
        break
print(total)

a_i = list(map(int, input().split()))
count = 0
total = 0
for i in sorted(a_i):
    total = total + i
    count = count + 1
    if count == 2:
        break
print(total)

Verdicts: Runtime Error

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

Submission attempts (in order):
list=list(map(int,input().split()))
print(sorted(list)[1]+sorted(list)[2])

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
PQR = list(map(int, input().split()))
PQR.sort
print(PQR[0]+PQR[1]

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

PQR = list(map(int, input().split()))
PQR.sort(reverse=False)
print(PQR[0]+PQR[1])

Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
A, B, C = map(int,input().split())
print(sum(A,B,C)-max(A,B,C))

A, B, C = map(int,input().split())
print(sum([A,B,C])-max(A,B,C))



Verdicts: Runtime Error

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

Submission attempts (in order):
p,q,r=map(int,input().split())
print(min(p,q,r)+min(p,q,r)[1])

k=list(map(int,input().split()))
k.sort
print(k[2]+k[1])

k=list(map(int,input().split()))
k.sort()
print(int(k[0])+int(k[1]))

Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
sum(sorted(list(map(int, input().split())))[:2])

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
p = list(map(int,input().split()))
l=[p[i]*p[j] for i in range(3) for j in range(i+1,3)]
print(min(l))

p = list(map(int,input().split()))
l=[p[i]+p[j] for i in range(3) for j in range(i+1,3)]
print(min(l))


Verdicts: Wrong Answer

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

Submission attempts (in order):
s = list(map(int, input().split()))
n,m = s[0],s[1]
a = [int(input()) for i in range(m)]



if n == 1:
    print(1)

elif n == 2:
    if m == 0:
        print(2)
    elif m == 1:
        if a[0] == 2:
            print(0)
        else:
            print(1)
        
    
elif n == a[-1]:
    print(0)
    
else:
    if m == 0:
        t = -1
    else:
        c = 0
        t = a[c]-1
    x, y = 0, 1
    for i in range(n):
        if x == 0 and y == 0:
            break
        elif i == t:
            x, y = y, 0
            if a[c]-1 == a[-1]-1:
                continue
            else:
                c += 1
                t = a[c]-1
        else:
            x, y = y, x + y
    print(y%1000000007)

x = list(map(int, input().split()))
x.sort()
print(x[0]+x[1])

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
g = input().split()
a = [int(i) for i in g]
b = list()
for i in reversed(g):
  b.append(int(i))
x = list()
y = list()
z = list()
p = 0
q = 0
r = 0
s = 0
c = n-1
for i in range(n):
  for i in a:
    x.append(i)
    r += 1
    if r == c:
      break
    p = sum(x)-p
  for i in b:
    y.append(i)
    s += 1
    if s == n-c:
      break
    q = sum(y)-q
  c -= 1
  z.append(abs(p-q))
print(min(z))
  
   

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

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

n = int(input())
g = input().split()
a = [int(i) for i in g]
b = list()
for i in reversed(g):
  b.append(int(i))
x = list()
y = list()
z = list()
p = 0
q = 0
r = 0
s = 0
c = n-1
for i in range(n):
  for i in a:
    x.append(i)
    r += 1
    if r == c:
      break
    p = sum(a)-p
  for i in b:
    y.append(i)
    s += 1
    if s == n-c:
      break
  c -= 1
  z.append(p-q)
print(min(z))
  

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
a=list(map(int,input().split()))
a=sorted(a)
con=0
for i in range(1):
  con+=a[i]
  
print(con)

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
P,Q,R=map(int,input().split())

import sys
def compare(i,j,k):
    if i>=j:
        if j>=k:
            print(j+k)
        elif j<k:
            if i<=k:
                print(i+j)
            else:
                print(k+j)
    elif i<j:
        if k>=j:
            print(i+j)
        elif k<j:
            print(k+i)
            sys.exit()
            
print(compare(P,Q,R))

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

Verdicts: Wrong Answer

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

Submission attempts (in order):

Copy
Copy
from functools import lru_cache
 
 
N, M = map(int, input().split())

a = []
for _ in range(M):
    a.append(int(input()))

root = 0

now = 0
 
 
def isSafe(now):
    
    now_1 = not (now-1) in a
    now_2 = not (now-2) in a
    if now<=1:
        return 0
    elif now==2:
        return int(now_1)
    else:
        return int(now_1 + now_2*2)
 
 
@lru_cache(maxsize=100000)
def step(N):
    
    if N <= 1:
        if not (1 in a):
            return 1   
        else:
            return 0
    elif N==2:
        if not (2 in a):
            return step(1) + 1
        else:
            return step(1)
    elif isSafe(N)==1:
        return step(N-1)
    elif isSafe(N)==2:
        return step(N-2)
    elif isSafe(N)==3:
        return step(N-1)+step(N-2)
    else:
        return 0
 
print(step(N)%1000000007)

def main():
  p, q, r = map(int, input().split())
  return min(p+q, p+r, q+r)

if __name__=='__main__':
  main()

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

Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
L=list(map(int,input().split))
L.sort()
print(L[0]+L[1])

L=list(input())
L.sort()

ans= L[0]+L[1]

print(ans)

L=list(input())
L.sort()
print(L[0]+L[1])

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
# coding: utf-8

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

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

print(min(s))


# coding: utf-8

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

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

print(min(s))


Verdicts: Runtime Error

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

Submission attempts (in order):
mod = 10**9+7

def fac(n):
    fac = [1]*(n+1)
    fac[0] = 1
    fac[1] = 1
    for i in range(1,n+1):
        fac[i] = fac[i-1]*i%mod
    return fac

def main():
    n,m=map(int,input().split(' '))
    fact = fac(n)
    check = 0
    pattern = 1
    a = [0]
    a_list = []
    tmp = -1
    for i in range(m):
        an = int(input())
        a.append(an)
    for i in range(m):
        a_list.append(a[i+1]-a[i]-1)
    a_list.append(n-a[-1]-1)
    if a_list[0] ==0:
        a_list.pop(0)
    for i in a_list:
        tmp = 0
        for j in range(i):
            if i - 2*j >=0:
                tmp +=(fact[(i-j)]/fact[j]/fact[i-2*j])%mod
        pattern *= tmp
        pattern %= mod

    print(int(pattern))

if __name__=='__main__':
    main()

def main():
    n=list(map(int,input().split(' ')))
    n_sorted = sorted(n)
    print(n_sorted[0]+n_sorted[1])

if __name__=='__main__':
    main()

Verdicts: Runtime Error

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

Submission attempts (in order):
#-*- coding: utf-8
#  -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""
from collections import defaultdict
import sys
import math
from datetime import datetime

def sol(p, q, r):
    # 3 -> 3 * 60 = 180
    # 4 -> 4 * 90 = 360
    # 5 -> 5 *
    # 360 / 5 = 180 - 72 = 108 = 54 * 2 * 5
    # (180 - (360 / 5)) * 5
    
    e = min(p, q, r)
    if e == p: return q + r
    elif e == q: return p + r
    elif e == r: return p + q
    else:
        assert(True)



do_submit = True


def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    
    # S = parsed_lines[1][0]
    # return n, k, S
    return n


if not do_submit:
    n = input_parse("""
    3
    """)
    print(sol(n))

    n = input_parse("""
    100
    """)
    print(sol(n))

else:
    p, q, r= list(map(int, input().split()))
    # S = input().split()
    # print(sol(n, k, S))
    #n = int(input().strip())
    # S = input().strip()
    print(sol(p, q, r))



#-*- coding: utf-8
#  -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""
from collections import defaultdict
import sys
import math
from datetime import datetime

def sol(p, q, r):
    # 3 -> 3 * 60 = 180
    # 4 -> 4 * 90 = 360
    # 5 -> 5 *
    # 360 / 5 = 180 - 72 = 108 = 54 * 2 * 5
    # (180 - (360 / 5)) * 5
    
    e = max(p, q, r)
    if e == p: return q + r
    elif e == q: return p + r
    elif e == r: return p + q
    else:
        assert(True)



do_submit = True


def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    
    # S = parsed_lines[1][0]
    # return n, k, S
    return n


if not do_submit:
    n = input_parse("""
    3
    """)
    print(sol(n))

    n = input_parse("""
    100
    """)
    print(sol(n))

else:
    p, q, r= list(map(int, input().split()))
    # S = input().split()
    # print(sol(n, k, S))
    #n = int(input().strip())
    # S = input().strip()
    print(sol(p, q, r))



Verdicts: Wrong Answer

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

Submission attempts (in order):
a=sorted(list(input()))
print(int(a[0])+int(a[1]))

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

a=sorted(list(input().split()))
print(int(a[0])+int(a[1]))

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
#!/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[ ]:






#!/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[ ]:






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

# In[2]:


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


# In[3]:


t = [P, Q, R]
print(sum(t)-max(t))


# In[ ]:






Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
P, Q, R = map(int, input().split())
print(max(P + Q, Q + R, P + R))

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
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())

from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

P = read_int()
P.sort()
def solve():
    return P[0] + P[1]

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

Verdicts: Runtime Error

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

Submission attempts (in order):
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)

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

Verdicts: Runtime Error

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

Submission attempts (in order):
p,q,r=map(int,input().split())
ans=min(p*2,q*2,r*2,p+q,q+r,r+p)

p,q,r=map(int,input().split())
ans=min(p*2,q*2,r*2,p+q,q+r,r+p)
print(ans)

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


Verdicts: Wrong Answer

Wrong Answer

Accepted