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

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>

int main (){
    int H, W;
    int i, j;
    int max =0;
    scanf("%d %d\n", &H, &W);
    char field [H*W]; 
    
    for(i=0; i<H; ++i){
        for(j=0; j<W; ++j){
            scanf(" %c", &field[W*i+j]);
        }
    }

    int L[H][W], R[H][W], D[H][W], U[H][W];

    for(i=0; i< H ; ++i){
        L[i][j]=0;
        for(j=0; j< W; ++j){
            if(field[W*i+j] == '#'){
                L[i][j]=0;
            }else if(j==0){
                L[i][j]=1;
            }else{
                L[i][j]= L[i][j-1]+1;
            }
            
        }
       
    }

    for(i=0; i< H ; ++i){
        R[i][j]=0;
        for(j=W-1; j >= 0 ; --j){
            if(field[W*i+j] == '#'){
                R[i][j]=0;
            }else if(j==W-1){
                R[i][j]=1;
            }else{
                R[i][j]= R[i][j+1]+1;
            }

        }
    }

    for(i=H-1; i >= 0 ; --i){
        U[i][j]=0;
        for(j=0; j< W; ++j){
            if(field[W*i+j] == '#'){
                U[i][j]=0;
            }else if(i==H-1){
                U[i][j]=1;
            }else{
                U[i][j]= U[i+1][j]+1;
            }

        }
    }

    for(i=0; i < H ; ++i){
        D[i][j]=0;
        for(j=0; j< W; ++j){
            if(field[W*i+j] == '#'){
                D[i][j]=0;
            }else if(i==0){
                D[i][j]=1;
            }else{
                D[i][j]= D[i-1][j]+1;
            }

        }
    }
    for(i=0; i<H; ++i){
        for(j=0; j<W; ++j){
            if(max < L[i][j]+R[i][j]+U[i][j]+D[i][j]-3){
                max = L[i][j]+R[i][j]+U[i][j]+D[i][j]-3;
            }
        }

    }
    
    printf("%d\n", max);

    return 0;
}