Harryxun/stf_run huggingface dataset:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i - 1)
            if i != n // i:
                divisors.append(n//i - 1)
    return divisors

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np

N = int(input())
# 1-indexed
a = [int(i) for i in input().split()]

now = [0] * N
for i in range(N-1,-1,-1):
    if now[i] != a[i]:
        div = make_divisors(i+1)
        for j in div:
            now[j] += 1
            now[j] %= 2

print(M)

answer = [i+1 for i,x in enumerate(now) if x == 1]
if answer:
    print(" ".join(list(map(str,answer))))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

box = [0] * N

for i in range(N-1, -1, -1):
    # (i+1)の倍数が書かれた箱を探索
    count = 0
    n = i+1
    while n <= N:
        count += box[n-1]
        n += i + 1

    if count % 2 != a[i]:
        box[i] = 1

M = box.count(1)
print(M)

answer = [i+1 for i,x in enumerate(box) if x == 1]
if M > 0:
    print(' '.join(list(map(str,answer))))
N = input().split()
A = input().split()
print(N*N-A)

### FIXED CODE ###

N=int(input())
A=int(input())
print(N**2-A)
N=int(input())

seq=[]

for i in range(N):

    a= int(input())
    
    seq.append(a)

numbers=set(seq)
numbers=sorted(numbers,reverse=True)

A_max=numbers[0]

if len(numbers)>=2:
    A_second = numbers[1]

for k in range(N):
    if seq[k]==A_max:
        print(A_second)
    else:
        print(A_max)

# 2.両端から
# left=[0]
# for i in range(N-1):
#     left_i=max(left[i],seq[i])

#     left.append(left_i)

# right=[0]

# for j in range(N-1):
#     right_j = max(right[j],list(reversed(seq))[j])

#     right.append(right_j)

# right = list(reversed(right))

# for k in range(N):
#     print(max(left[k],right[k]))

### FIXED CODE ###

N=int(input())

seq=[]

for i in range(N):
    a= int(input())
    seq.append(a)

import heapq

tmp=list(map(lambda x: x*(-1),seq))
heapq.heapify(tmp)

a=heapq.heappop(tmp)*(-1)
b=heapq.heappop(tmp)*(-1)

for j in range(N):
    if seq[j]==a:
        print(b)
    else:
        print(a)
S = map(int, input().split())
if S == "ABC"
	print("ARC")
else:
  	print("ABC")

### FIXED CODE ###

S = input()
if S == "ABC":
	print("ARC")
else:
  	print("ABC")
x, y = map(int, input().split())
if (y-x) > =x:
  print "Yes"
else:
  print "No"

### FIXED CODE ###

x, y = map(int, input().split())
if y%2 == 1:
  print("No")
  exit()
b = y//2 -x
a = x - b
if (a >= 0) & (b >= 0):
  print("Yes")
else:
  print("No")
from fractions import gcd
from functools import reduce
# from collections import deque
# from math import factorial
import collections
import math
import sys
sys.setrecursionlimit(2000000)
n, m, x = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
#n = int(input())
# n, m = list(map(int, input().split()))
a = []
for i in range(n):
    b = list(map(int, input().split()))
    t = sum(b)-b[0]
    #print(t)
    b.append(b[0]/t)
    a.append(b)

a_sorted = sorted(a, key=lambda x: x[-1])

money = 0
point = [0]*m
for i in range(n):
    fin = True
    money += a_sorted[i][0]
    for j in range(m):
        #print(money)
        point[j] += a_sorted[i][j+1]
        # print(a_sorted[i][0])
    #print(point, end=" ")
    #print(money)
    for j in range(m):
        if point[j] < x:
            fin = False
    if fin:
        print(money)
        exit()

    # print(check)
print(-1)



### FIXED CODE ###

n, m, x = list(map(int, input().split()))

a = []
for i in range(n):
    b = list(map(int, input().split()))
    a.append(b)


def calcPoint(point, n):
    for i in range(m):
        point[i] += a[n][i+1]
    return point


def judgePoint(point):
    for i in range(m):
        if point[i] < x:
            return False
    return True


ans = []
for i in range(2**n):  # patarn数
    buy = []
    for j in range(n):  # n bit
        if((i >> j) & 1):  # iをj bit 右にずらして1ならば
            buy.append(1)
        else:
            buy.append(0)
    price = 0
    point = [0]*m
    for i in range(n):
        if buy[i] == 1:
            calcPoint(point, i)
            price += a[i][0]
    if judgePoint(point):
        ans.append(price)
if len(ans) == 0:
    print(-1)
else:
    print(min(ans))
C - GCD on Blackboard。
累積和を使ういい問題だが、難しい。

```python

from fractions import gcd

n = int(input())
A = list(map(int, input().split()))

left = [0]*n
right = [0]*n

# 取り除く点を除いたGCDの累積
# 引き算できないので、両端から求めてそれぞれのgcdを取る
for i in range(n-1):
    left[i+1] = gcd(left[i], A[i])
    right[n-i-2] = gcd(right[n-i-1], A[n-i-1])

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i]))
print(ans)


```

N**2分の計算量がかかる解法は比較的すぐに思いつく。

### FIXED CODE ###

from fractions import gcd

n = int(input())
A = list(map(int, input().split()))

left = [0]*n
right = [0]*n

for i in range(n-1):
    left[i+1] = gcd(left[i], A[i])
    right[n-i-2] = gcd(right[n-i-1], A[n-i-1])

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i]))
print(ans)
x = int(input())
 
if　x>29:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
 
if N < 30:
    print("No")
else:
    print("Yes")
x = 2
sum = x ** 3
print(sum + \n)

### FIXED CODE ###

x = raw_input()
print(str(int(x) ** 3))
N=int(input())
A=list(map(int,input().split())
if 0 in A:
  print(0)
  exit(0)

ans=1
for i in A:
  ans*=i
  if ans>10**18:
    print(-1)
    exit(0)

print(ans)


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b)
n,m = map(int,input().split())
p = list(map(int,input().split()))
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
uf = UnionFind(n)
for i in range(m):
    x,y = map(int,input().split())
    uf.union(x-1,y-1)
ans = 0
for i in range(n):
    if uf.find(i) == uf.find(p[i]-1):
        ans += 1
print(ans)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
if abs(a-c) <= d or (abs(b-a)<=d and abs(b-c)<=d):
  print("Yes")
else:
  print("No")
import time
import collections
import scipy.misc

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   

N, M = map(int, input().split())
t_strt = time.time() 

factors = collections.Counter(prime_decomposition(M))
t_elps = time.time()
#print(f"{t_elps - t_strt} [sec]")
num_pattern = 1;

for exponent in factors.values():
    tmp_num_pattern = scipy.misc.comb(exponent + N -1, N-1, exact = True) 
    num_pattern = num_pattern * int(tmp_num_pattern)
    
#print(num_pattern%(10**9+7))

t_elps = time.time()
print(f"{t_elps - t_strt} [sec]")

### FIXED CODE ###

# 整数の入力
A, B, C = map(int, input().split())

tmp_max = 10*A + B + C 

if tmp_max < 10*B + C +A:
    tmp_max = 10*B + C +A

if tmp_max < 10*C + A +B:
    tmp_max = 10*C + A +B

# 出力
print("{}".format(tmp_max))
from collections import deque

def cndP(l,n,p1,p2):
    d = set()
    length = len(l)
    for i in range(length-n+1):
        s = sum(l[i:i+n])
        #print("s:",s)
        if p2 == None:
            if p1 < s:
                d.add(s)
        else:
            if p1 < c < p2:
                d.add(s)
    return sorted(d)

def pIsAccptbl(w,k,p):
    tr = 0
    c = 0
    d = deque(w)
    while(d):
        tmp = d.popleft()
        if(tmp > p):
            return False
        
        if( tr + tmp > p):
            tr = tmp
            c += 1
        else:
            tr += tmp
        if c+1>k:
            return False
    return True

n,k = [int(x) for x in input().split()]
w = []
for i in range(n):
    e = int(input())
    w.append(e)

n=2
p = max(w)
p1 = p
p2 = None

if(pIsAccptbl(w,k,p)):
    print(p)
else:
    while(1):
        #print("p1,p2:",p1,p2)
        s = cndP(w,n,p1,p2)
        #print("s:",s)
        if s==[]:
            #print(p2)
            break;
        for i in s:
            if(pIsAccptbl(w,k,i)):
                p2 = i
                break
            p1 = i
        n+=1

### FIXED CODE ###

from collections import deque

def isPa(w,k,p):
    tr = 0
    c = 0
    d = deque(w)
    while(d):
        tmp = d.popleft()
        if(tmp > p):
            return False
        
        if( tr + tmp > p):
            tr = tmp
            c += 1
        else:
            tr += tmp
        if c+1>k:
            return False
    return True

def MaxInP(w,k,p):
    maxinp = 0
    tmp = 0
    d = deque(w)
    while(d):
        tmp += d.popleft();
        if(tmp > p):
            if(tmp > maxinp):
                maxinp = tmp
            tmp = 0
    return maxinp

n,k = [int(x) for x in input().split()]
w = deque()
for i in range(n):
    w.append(int(input()))
    
mean = int(sum(w)/k)
maxinp = MaxInP(w,k,mean)

if k == 1:
    print(mean)
else:
    minP = mean
    maxP = maxinp
    while(True):
        m = int ((minP + maxP)/2)
        if ( isPa(w,k,m) ):
            maxP = m
        else:
            minP = m
        if (minP+1 == maxP or minP == maxP):
            print(maxP)
            break
L,R=map(input().split())
if int(R/2019)-int(L/2019)>=1 or (R/2019.is_integer)==True or (L/2019.is_integer)==True:
	print(0)
elif R-L>=3:
	if int((R+1346)/2019)-int(L/2019)>=1 or int(R/2019)-int((L-674)/2019)>=1:
		print(0)
	elif int((R+673)/2019)-int(L/2019)>=1 or int(R/2019)-int((L-1347)/2019)>=1:
		print(0)
	else:
		print(min((i*j)/2019 for i<j in range(L,R+1)))
else:
	print(min((i*j)/2019 for i<j in range(L,R+1)))

### FIXED CODE ###

L,R=map(int,input().split())
a=[]
if R-L>=2019:
	print(0)
else:
	for i in range(L,R+1):
		for j in range(i+1,R+1):
			a.append(((i%2019)*(j%2019))%2019)

	print(min(a))
import math
a,b,c,d = map(int,input().split())
print('Yes') if (math.abs(a-b)<=d and math.abs(b-c) <= d) or math.abs(a-c) <= d else print('No')

### FIXED CODE ###

a,b,c,d = map(int,input().split())
print('Yes') if (abs(a-b)<=d and abs(b-c) <= d) or abs(a-c) <= d else print('No')
from collections import deque

graph=[[] for _ in range(N+1)]

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

for _ in range(M):
    a,b,c=map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)
    
#seen[i]は、頂点iを訪問済みの場合はTrue、未訪問の場合はFalse
seen=[False]*(N+1)


count=0

for i in range(1,N+1):
    if seen[i]==False:
        seen[i]=True
        S=deque([i])
        
        while S:
            v=S.popleft()
            #訪問済みの頂点をTrueにする
            for i in graph[v]:
                if seen[i]==False:
                    seen[i]=True
                    S.append(i)
        count+=1

print(count)

### FIXED CODE ###

from collections import deque


N,M=list(map(int,input().split()))
graph=[[] for _ in range(N+1)]
for _ in range(M):
    a,b,c=map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)
    
#seen[i]は、頂点iを訪問済みの場合はTrue、未訪問の場合はFalse
seen=[False]*(N+1)


count=0

for i in range(1,N+1):
    if seen[i]==False:
        seen[i]=True
        S=deque([i])
        
        while S:
            v=S.popleft()
            #訪問済みの頂点をTrueにする
            for i in graph[v]:
                if seen[i]==False:
                    seen[i]=True
                    S.append(i)
        count+=1

print(count)
S = input()
T = input()
N = len(S)

dict_S = {}
dict_T = {}

for i in range(N):
    if S[i] in dict_S:
        if dict_S[S[i]] != T[i]:
            print("No")
            eixt()
    if T[i] in dict_T:
        if dict_T[T[i]] != S[i]:
            print("No")
            exit()
    dict_S[S[i]] = T[i]
    dict_T[T[i]] = S[i]
print("Yes")


### FIXED CODE ###

S = input()
T = input()
N = len(S)

dict_S = {}
dict_T = {}

for i in range(N):
    # print("dict_S: {}".format(dict_S))
    # print("dict_T: {}".format(dict_T))
    if S[i] in dict_S:
        if dict_S[S[i]] != T[i]:
            print("No")
            exit()
    if T[i] in dict_T:
        if dict_T[T[i]] != S[i]:
            print("No")
            exit()
    dict_S[S[i]] = T[i]
    dict_T[T[i]] = S[i]
print("Yes")
tmp = list(input().split())
print(tmp[K-1])

### FIXED CODE ###

str_K = input()
k = int(str_K)
tmp_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(tmp_list[k-1])
a,b,k = map(int,input().split())
minnum = min(a,b)
maxnum = max(a,b)
lis = []
for mi in range(1,(minnum//2)+1):
  if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi)
num = k-1
print(lis[-1 * num])

### FIXED CODE ###

a,b,k = map(int,input().split())
minnum = min(a,b)
maxnum = max(a,b)
lis = []
for mi in reversed(range(1,minnum+1)):
  if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi)

print(lis[k-1])
# coding: utf-8
# Your code here!
from operator import mul
from functools import reduce

def comb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
    
    
r1, c1, r2, c2 = [int(i) for i in input().split()]
 
def calc(r, c):
    a = comb(r + c + 2, r + 1, mod) - r - c - 2
    b = r * (r + 3) / 2
 
    if c == 1:
        return b
    else:
        return a
 
result = calc(r2, c2) - calc(r2, c1 - 1) - calc(r1 - 1, c2) + calc(r1 - 1, c1 - 1)
 
print(result %  (10**9+7))

### FIXED CODE ###

from operator import mul
from functools import reduce

def comb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 3 * 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
    
    
r1, c1, r2, c2 = [int(i) for i in input().split()]
 
def calc(r, c):
    a = comb(r + c + 2, r + 1, mod) - r - c - 2
    b = r * (r + 3) / 2
 
    if c == 1:
        return b
    else:
        return a
 
result = calc(r2, c2) - calc(r2, c1 - 1) - calc(r1 - 1, c2) + calc(r1 - 1, c1 - 1)
result %= mod
if result < 0:
  result += mod
print(result)
r = int(input())
g = int(input())
print(2 * g - r

### FIXED CODE ###

r = int(input())
g = int(input())
print(2 * g - r)
N = int(input())
a_list = list(map(int, input().split()))

a_sum = sum(a_list)
min_num = float("inf")
r = []

for i in range(1, N):
    if len(r) == 0:
        r.append(a_list[0])
    else:
        r.append(r[i-1] + a_list[i])

    x = r[i-1]
    y = a_sum - x
    if min_num >= abs(x-y):
        min_num = abs(x-y)
print(min_num)

### FIXED CODE ###

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

a_sum = sum(a_list)
min_num = float("inf")
r = []

for i in range(1, N):
    if len(r) == 0:
        r.append(a_list[0])
    else:
        r.append(r[i-2] + a_list[i-1])

    x = r[i-1]
    y = a_sum - x
    if min_num >= abs(x-y):
        min_num = abs(x-y)
print(min_num)
anum,bnum,acc = map(int,input().split())
alist = list(map(int,input().split()))
blist = list(map(int,input().split()))

asum = 0;bsum = 0
ans = 0;a = 0;b = 0
while asum + alist[a] <= acc:
    asum += alist[a];a+=1
    if a == anum:
        break

while asum + blist[b] <= acc:
    bsum += blist[b];b += 1
    if b == bnum:
        break

if a == 0 and b == 0:
    pass
elif (a == anum and b == bnum) or a == 0:
    ans = a + b
else:
    ans = a + b
    for i in range(a):
        while asum - alist[a-(i+1)] + bsum + blist[b] <= acc:
            if b == bnum:
                break
            bsum += blist[b];b += 1
            if a + b > ans:
                ans = a + b

print(ans)


### FIXED CODE ###

anum,bnum,acc = map(int,input().split())
alist = list(map(int,input().split()))
blist = list(map(int,input().split()))

asum = [0]
bsum = [0]
ans = 0
for i in range(anum):
    asum.append(asum[i]+alist[i])
for i in range(bnum):
    bsum.append(bsum[i]+blist[i])

b = bnum
for a in range(anum+1):
    if asum[a] > acc:
        break
    while asum[a] + bsum[b] > acc:
        b -=1
    ans = max(ans,a+b)

print(ans)
N = int(input())
if N == 1:
    print(1)
    exit()
A = [0 for _ in range(N+1)]
l = [0,1]
H = []
for i in range(2**N):
    S = str(bin(i)).zfill(N)
    H.append(S[2:].zfill(N))
IXY = []
for i in range(1,N+1):
    A[i] = int(input())
    for j in range(A[i]):
        x,y = map(int,input().split())
        IXY.append([i,x,y])
ANS = []
for h in H:
    for ixy in IXY:
        flg = True
        i,x,y = ixy[0]-1,ixy[1]-1,ixy[2]
        if h[i] == "1":
            if h[x] != str(y):
                flg = False
                break
    if flg:l.append(ANS.append(h))
ans = 0
for a in ANS:
    ans = max(a.count("1"),ans)
print(ans)


### FIXED CODE ###

N = int(input())

#人が一人しかいないとき
if N == 1:
    print(1)
    exit()

#人が2人以上いるとき
#N人それぞれが正直か不誠実かの全パターンを生成
H = []
for i in range(2**N):
    S = str(bin(i))
    H.append(S[2:].zfill(N))
#入力を受け取る
IXY = []
for i in range(N):
    t = int(input())
    for j in range(t):
        x,y = map(int,input().split())
        #i番目の人が「x番目の人はyである」と証言
        IXY.append([i,x,y])

ans = 0
for h in H:
    cnt = h.count("1")
    for ixy in IXY:
        i,x,y = ixy[0],ixy[1]-1,ixy[2]
        if h[i] == "1" and h[x] != str(y):
            cnt = 0
            break
    ans = max(ans,cnt)
print(ans)
def main():
    N, C, K = map(int, input().split())
    T = [int(input()) for _ in range(N)]
    ans = 0
    i = 0
    j = 0
    T.sort()
    if len(T) == 1:
        ans = 1
        return(ans)

    if C == 1:
        return(N)

    if C == 2:
        while True:
            if T[j] + K >= T[i+1]:
                i = i + 2
                j = i
                ans += 1
                if j == N:
                    return ans
                elif j == N - 1:
                    ans += 1
                    return ans
            elif T[j] + K < T[i+1]:
                i += 1
                j = i
                ans += 1
                if j == N-1:
                    ans += 1
                    return ans

    while True:
        if T[j] + K >= T[i+1]:
            i = i + 1
            if i == N-1:
                ans += 1
                return (ans)
            for h in range(C-2):
                if T[j] + K >= T[i+1]:
                    if h == C-3:
                        ans += 1
                        i += 2
                        j = i
                        if j == N-1:
                            ans += 1
                            return(ans)
                        elif j == N:
                            return(ans)
                        break
                    else:
                        i += 1
                        if (i+1) == N-1:
                            ans += 1
                            return(ans)
                        continue
                elif T[j] + K < T[i + 1]:
                    j = i + 1
                    i = i + 1
                    ans += 1
                    if j == N-1:
                        ans += 1
                        return(ans)
                    break

        elif T[j] + K < T[i+1]:
            ans += 1
            i += 1
            j = i
            if j == N-1:
                ans += 1
                return(ans)

print(main())


### FIXED CODE ###

def main():
    N, C, K = map(int, input().split())
    T = list(int(input()) for _ in range(N))

    T.sort()

    ans = 0
    temp = T[0]
    cnt = 1

    for i in range(1,N):
        if temp + K < T[i] or C == cnt:
            ans += 1
            temp = T[i]
            cnt = 1
        else:
            cnt += 1

    ans += 1
    return (ans)

print(main())
import numpy as np
import sys
input2 = sys.stdin.read

# A: Anti-clockwise, B: Clockwise, V: Values
n, c = map(int, input().split())
AV = np.array(list(map(int, input2().rsplit())), dtype=np.int64)
A, V = AV[::2], AV[1::2]
B = (c - A)[::-1]

XA = np.cumsum(V) - A
XB = np.cumsum(V[::-1]) - B
RXA, RXB = XA - A, XB - B    # Cumulative Values returning to Start
NMA, NMB = XA.max(), XB.max()


def ind(lis, maxi):
    for i, x in enumerate(lis):
        if x == maxi:
            return i


MRA2, MRB2 = max(RXA[:-1], default=0), max(RXB[:-1], default=0)
mrai = ind(RXA, MRA2)
mrbi = ind(RXB, MRB2)

if not mrai:
    mrai = 0
if not mrbi:
    mrbi = 0

MA2 = max(0, max(XA[:n - 1 - mrbi], default=0))
MB2 = max(0, max(XB[:n - 1 - mrai], default=0))
res = max(NMA, NMB, MA2 + MRB2, MB2 + MRA2)


for k in range(-1, -10 if n > 10 else -2, -1):
    MA3, MB3 = max(XA[:k], default=0), max(XB[:k], default=0)
    mai3 = ind(XA, MA3)
    mbi3 = ind(XB, MB3)

    MRA3 = max(0, max(RXA[:n - 1 - mbi3], default=0))
    MRB3 = max(0, max(RXB[:n - 1 - mai3], default=0))

    res = max(res, MA3 + MRB3, MB3 + MRA3)
print(res)


### FIXED CODE ###

import numpy as np
import sys
input2 = sys.stdin.read

# A: Anti-clockwise, B: Clockwise, V: Values
n, c = map(int, input().split())
AV = np.array(list(map(int, input2().rsplit())), dtype=np.int64)
A, V = AV[::2], AV[1::2]
B = (c - A)[::-1]

XA = np.cumsum(V) - A
XB = np.cumsum(V[::-1]) - B
RXA, RXB = XA - A, XB - B    # Cumulative Values returning to Start
NMA, NMB = XA.max(), XB.max()


def ind(lis, maxi):
    for i, x in enumerate(lis):
        if x == maxi:
            return i


MRA2, MRB2 = max(RXA[:-1], default=0), max(RXB[:-1], default=0)
mrai = ind(RXA, MRA2)
mrbi = ind(RXB, MRB2)

if not mrai and not mrbi:
    mrai, mrbi = 0, 0

MA2 = max(0, max(XA[:n - 1 - mrbi], default=0))
MB2 = max(0, max(XB[:n - 1 - mrai], default=0))
res = max(NMA, NMB, MA2 + MRB2, MB2 + MRA2)


for k in range(-1, -10 if n > 10 else -2, -1):
    MA3, MB3 = max(XA[:k], default=0), max(XB[:k], default=0)
    mai3 = ind(XA, MA3)
    mbi3 = ind(XB, MB3)

    if not mai3 and not mbi3:
        mai3, mbi3 = 0, 0

    MRA3 = max(0, max(RXA[:n - 1 - mbi3], default=0))
    MRB3 = max(0, max(RXB[:n - 1 - mai3], default=0))

    res = max(res, MA3 + MRB3, MB3 + MRA3)
print(res)
n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)

b = 0
for i in a:
  if a[i]==n:
    print("Yes")
    break
  else:
    b = 1
  
if b==1:
  print("No")

### FIXED CODE ###

n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)
c=0
b = 0
for i in range(81):
  if a[i]==n:
    c=1
    print("Yes")
    break
  else:
    b = 1

if b==1 and c!=1:
  print("No")
p,q,r = [int(x) for x in input().split()]
p,q,r.sort()
answer = p,q,r[0] + p,q,r[1]
print(answer)

### FIXED CODE ###

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

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

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