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 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>
#include <stdlib.h>

int main(void) {

	/* 値の入力 */
	int N, M;
	scanf("%d %d", &N, &M);
	int* s;
	int* c;
	char* a;
	s = (int*)calloc(sizeof(int), M);
	c = (int*)calloc(sizeof(int), M);
	a = (char*)calloc(sizeof(char), N);
	for (int i = 0; i < M; ++i) {
		scanf("%d %d", &s[i], &c[i]);
	}

	/* 最小の値を求める */
	for (int i = 0; i < M; ++i) {
		/* '\0'だったらcharに変換して代入 */
		if (a[s[i] - 1] == '\0') {
			a[s[i] - 1] = '0' + c[i];
			continue;
		}
		/* もともと入っていた値より小さければ代入 */
		if (a[s[i] - 1] > '0' + c[i]) {
			a[s[i] - 1] = '0' + c[i];
		}
	}
	/* 間の'\0'を0に変換 */
	for (int i = 1; i < 3; ++i) {
		if (a[i - 1] != '\0' && a[i] == '\0') {
			a[i] = '0';
		}
	}

	/* 結果の出力 */
	switch (N) {
	case 3 : {
		if (a[0] == '\0') {
			puts("-1");
		}
		else if (a[0] == '0') {
			puts("-1");
		}
		else {
			printf("%s\n", a);
		}
		break;
	}
	case 2 : {
		if (a[1] == '\0' || a[0] != '\0') {
			puts("-1");
		}
		else if (a[1] == '0') {
			puts("-1");
		}
		else {
			printf("%s\n", a);
		}
		break;
	}
	case 1 : {
		if (a[2] == '\0' || a[1] != '\0' || a[0] != '\0') {
			puts("-1");
		}
		else if (a[2] == '0') {
			puts("-1");
		}
		else {
			printf("%s\n", a);
		}
	}
	}

	free(s);
	free(c);
	free(a);

	return 0;
}