Problem:
Score : 100 points

Problem Statement

Snuke is buying a bicycle.
The bicycle of his choice does not come with a bell, so he has to buy one separately.

He has very high awareness of safety, and decides to buy two bells, one for each hand.

The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively.
Find the minimum total price of two different bells.

Constraints

1 \leq a,b,c \leq 10000

a, b and c are integers.

Input

Input is given from Standard Input in the following format:

a b c

Output

Print the minimum total price of two different bells.

Sample Input 1

700 600 780

Sample Output 1

1300

Buying a 700-yen bell and a 600-yen bell costs 1300 yen.

Buying a 700-yen bell and a 780-yen bell costs 1480 yen.

Buying a 600-yen bell and a 780-yen bell costs 1380 yen.

The minimum among these is 1300 yen.

Sample Input 2

10000 10000 10000

Sample Output 2

20000

Buying any two bells costs 20000 yen.

Solution in C (GCC 5.4.1) (judge verdict: Runtime Error)

#include <stdio.h>

int main(void)
{
    int n,r,l;
    scanf("%d", &n);
    
    int data[100000];
    for(int i=1; i<=n+1; ++i){
        scanf("%d", &data[i]);
    }
    
    for(int x=1; x<=n+1; ++x){
        for(int y=x+1; y<=n+1; ++y){
            if(data[x]==data[y]){
                l = x;
                r = y;
            }
        }
    }
    
    int m = 1;
    int mult[100000];
    for(int i=1; i<=n+1; ++i){
        m *= i;
        mult[i] = m;
    }
    
    int a,b,c,d,e,f;
    for(int k=1; k<=n+1; ++k){
        a = mult[n+1];
        b = mult[k];
        if(n+1-k == 0){
            c = 0;
        }else{
            c = mult[n+1-k];
        }
        if(l+n-1 == 0){
            d = 0;
        }else{
            d = mult[l+n-r];
        }
        if(k-1 == 0){
            e = 0;
        }else{
            e = mult[k-1];
        }
        if(l+n-r-k+1 == 0){
            f = 0;
        }else if(l+n-r-k+1 < 0){
            f = -1;
        }else{
            f = mult[l+n-r-k+1];
        }
        
        int answer,g,h;
        if(c==0){
            g = 1;
        }else{
            g = a/(b*c);
        }
        if(e==0 || f==0){
            h = 1;
        }else if(d==0 || f==-1){
            h = 0;
        }else{
            h = d/(e*f);
        }
        answer = g - h;
        answer = answer%7000000000;
        printf("%d ",answer);
    }
    
    return 0;
}