Problem:
Score : 100 points

Problem Statement

Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.

At least how many sheets of paper does he need?

Constraints

N is an integer.

1 \leq N \leq 100

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer.

Sample Input 1

5

Sample Output 1

3

By printing the 1-st, 2-nd pages on the 1-st sheet, 3-rd and 4-th pages on the 2-nd sheet, and 5-th page on the 3-rd sheet, we can print all the data on 3 sheets of paper.

Sample Input 2

2

Sample Output 2

1

Sample Input 3

100

Sample Output 3

50

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections;
using System.Linq;

class prog
{
    public static void Main(string[] args)
    {	bool Out = false;
        int output = 0;
     
        string[] in1 = Console.ReadLine().Split(' ');
        int N = int.Parse(in1[0]);
        int M = int.Parse(in1[1]);
		
     	if(M > N)Out = true;
     
        int[] Ss = new int[M];
        int[] Cs = new int[M];

        
        int[] changed = new int[N];
        for (int i = 0; i < N; i++) { changed[i] = -100; }

        for (int i = 0; i < M; i++)
        {
            string[] input = Console.ReadLine().Split(' ');
            Ss[i] = int.Parse(input[0]);
            Cs[i] = int.Parse(input[1]);

           	if (Ss[i] == 1 && Cs[i] == 0 && N != 1)
            {
                Out = true;
            }
        }

        for (int i = 0; i < M; i++)
        {
            if (changed[Ss[i] - 1] > 0 && changed[Ss[i] - 1] != Cs[i]) { Out = true; break; }
            else if (changed[Ss[i] - 1] > 0) break;
            else if (Ss[i] == 1)
            {
                output = (int)(Cs[i] * Math.Pow(10, N - 1) + output);
                changed[Ss[i] - 1] = Cs[i];
            }
            else if (Ss[i] == 2)
            {
                output = (int)(Cs[i] * Math.Pow(10, N - 2) + output);
                changed[Ss[i] - 1] = Cs[i];
            }
            else if (Ss[i] == 3)
            {
                output = (int)(Cs[i] * Math.Pow(10, N - 3) + output);
                changed[Ss[i] - 1] = Cs[i];
            }
        }

        for(int i = 0;i < N;i++)
        {
            if(changed[i] < 0 && N != 1)
            {
                if (i == 0) output = output + (int)(1 * Math.Pow(10, N - 1));
            }
        }

        if (!Out) Console.WriteLine(output);
        else Console.WriteLine("-1");
    }
}