iidai/codenet huggingface dataset:
Language: C

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

int miyukiti(const void* asumisu, const void* mizuhasu) {
    int isihasu = *(const int*)asumisu, matukisu = *(const int*)mizuhasu;
    return isihasu < matukisu ? -1 : isihasu > matukisu;
}

int N;
int A[114514];

int yukinnko;
int tomatu[114514];

int mikakosi[114514];

int sumipe(int hayaminn) {
    int satorina = 0, zaasan = yukinnko - 1;
    while (satorina <= zaasan) {
        int yukati = satorina + (zaasan - satorina) / 2;
        if (tomatu[yukati] == hayaminn)
            return yukati;
        else if (tomatu[yukati] < hayaminn)
            satorina = yukati + 1;
        else
            zaasan = yukati - 1;
    }
    return 114513;
}

int main(void) {
    int inorinn;
    int emirinn = 0;
    if (scanf("%d", &N) != 1) return 1;
    for (inorinn = 0; inorinn < N; inorinn++) {
        if (scanf("%d", &A[inorinn]) != 1) return 1;
        tomatu[inorinn] = A[inorinn];
    }
    qsort(tomatu, N, sizeof(*tomatu), miyukiti);
    yukinnko = 1;
    for (inorinn = 1; inorinn < N; inorinn++) {
        if (tomatu[inorinn] != tomatu[yukinnko - 1]) {
            tomatu[yukinnko++] = tomatu[inorinn];
        }
    }
    for (inorinn = 0; inorinn < N; inorinn++) {
        int kugyu = sumipe(A[inorinn]);
        mikakosi[kugyu] = !mikakosi[kugyu];
    }
    for (inorinn = 0; inorinn < yukinnko; inorinn++) {
        if (mikakosi[inorinn]) emirinn++;
    }
    printf("%d\n", emirinn);
    return 0;
}

Example test case(s):
input: 3
6
2
6

output: 1
Language: C

#include <stdio.h>

int main(void) {
    int i, j, x[10000];

    for (i = 0; i < 10000; i++) {
        x[i] = 0;
    }
    i = 0;
    scanf("%d", &x[i]);

    while (x[i] != 0) {
        i++;
        scanf("%d", &x[i]);
    }

    for (j = 0; j < i; j++) {
        printf("Case %d: %d\n", j + 1, x[j]);
    }

    return 0;
}

Example test case(s):
input: 3
5
11
7
8
19
0

output: Case 1: 3
Case 2: 5
Case 3: 11
Case 4: 7
Case 5: 8
Case 6: 19
Language: C

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

struct node {
    int key;
    struct node *next;
    struct node *prev;
};

typedef struct node *NodePointer;
NodePointer N;

void init() {
    N = malloc(sizeof(struct node));
    N->next = N;
    N->prev = N;
}

void printList() {
    NodePointer cur = N->next;
    int snl = 1;
    while (cur != N) {
        if (snl == 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
        snl = 0;
    }
    printf("\n");
}

void deleteFirst() {
    NodePointer t = N->next;
    N->next = t->next;
    t->next->prev = N;
}

void deleteLast() {
    NodePointer delnode = N->prev;

    N->prev = delnode->prev;
    delnode->prev->next = N;
    free(delnode);
}

void delete(int skey) {
    int judge = 0;
    NodePointer t;
    NodePointer n;

    for (n = N->next; n != N; n = n->next) {
        if (n->key == skey) {
            judge = 1;
        }
    }

    if (judge == 1) {
        n = N->next;
        while (n != N) {
            if (n->key == skey) break;
            n = n->next;
        }
        t = n->prev;
        t->next = n->next;
        t->next->prev = t;
        free(n);
    }
}

void insert(int skey) {
    NodePointer new;
    static int count = 0;
    new = malloc(sizeof(struct node));
    new->key = skey;

    if (count == 0) {
        new->next = N;
        N->next = new;
        new->prev = N;
        N->prev = new;
        count++;
    }

    else {
        new->next = N->next;
        N->next->prev = new;
        N->next = new;
        new->prev = N;
        count++;
    }
}

int main() {
    int key, n, i;
    char com[12];

    scanf("%d", &n);
    init();
    for (i = 0; i < n; i++) {
        scanf("%s", com);
        if (strcmp(com, "insert") == 0) {
            scanf("%d", &key);
            insert(key);
        } else if (strcmp(com, "deleteFirst") == 0)
            deleteFirst();
        else if (strcmp(com, "deleteLast") == 0)
            deleteLast();
        else {
            scanf("%d", &key);
            delete (key);
        }
    }
    printList();
    return 0;
}

Example test case(s):
input: 7
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5

output: 6 1 2
Language: C

#include <stdio.h>
int main() {
    int a, b, c, d;
    scanf("%d %d", &a, &b);
    c = a * b;
    d = 2 * a + 2 * b;
    printf("%d %d\n", c, d);
    return 0;
}

Example test case(s):
input: 3 5

output: 15 16
Language: C

#include <stdio.h>

void kansu(int, int);

int main(void) {
    int a, b;

    scanf("%d %d", &a, &b);
    while (a != 0 && b != 0) {
        kansu(a, b);
        scanf("%d %d", &a, &b);
    }
    return 0;
}
void kansu(int a, int b) {
    int i, j, x, y, n;
    int suu[17][17];
    int kouji[17][17];

    scanf("%d", &n);
    for (i = 1; i <= a; i++) {
        for (j = 1; j <= b; j++) {
            kouji[i][j] = 0;
        }
    }
    for (i = 0; i < n; i++) {
        scanf("%d %d", &x, &y);
        kouji[x][y] = 1;
    }
    for (i = 1; i <= a; i++) {
        for (j = 1; j <= b; j++) {
            if (kouji[i][j] == 1) {
                suu[i][j] = 0;
            } else {
                if (i == 1 && j == 1) {
                    suu[i][j] = 1;
                } else {
                    if (i == 1) {
                        suu[i][j] = suu[i][j - 1];
                    } else if (j == 1) {
                        suu[i][j] = suu[i - 1][j];
                    } else {
                        suu[i][j] = suu[i][j - 1] + suu[i - 1][j];
                    }
                }
            }
        }
    }
    printf("%d\n", suu[a][b]);
}

Example test case(s):
input: 5 4
3
2 2
2 3
4 2
5 4
3
2 2
2 3
4 2
0 0

output: 5
5
Language: C

#include <stdio.h>

int main(void) {
    double a;
    double ave = 0;
    int i;

    for (i = 0; i < 5; i++) {
        scanf("%lf", &a);
        if (a <= 40) {
            ave += 40;
        } else {
            ave += a;
        }
    }

    ave /= 5.0;

    printf("%.0f\n", ave);

    return (0);
}

Example test case(s):
input: 10
65
100
30
95

output: 68
Language: C

#include <stdio.h>
int main() {
    int n, i, j, m, s, t;
    scanf("%d", &n);
    int a[n];
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    t = 0;
    for (i = 0; i < n; i++) {
        s = 0;
        for (j = 1; j < n; j++) {
            if (j <= i) {
                continue;
            }
            m = a[i] * a[j];
            s = s + m;
        }
        t = t + s;
    }
    printf("%d\n", t);
    return 0;
}

Example test case(s):
input: 3
3 1 2

output: 11
Language: C

#include <stdio.h>

int W, N;
int input[1024][2];

int main() {
    int i, j;
    int ans[1024][2];
    int t;

    for (t = 0;; t++) {
        for (i = 0; i < 1024; i++) {
            ans[i][0] = 0;
            ans[i][1] = 0;
            input[i][0] = 0;
            input[i][1] = 0;
        }

        scanf("%d%d", &W, &N);
        if (W == 0) break;
        for (i = 0; i < N; i++) scanf("%d,%d", &input[i][0], &input[i][1]);

        for (i = 0; i < N; i++) {
            for (j = 1023; j >= input[i][1]; j--) {
                if (ans[j][0] < input[i][0] + ans[j - input[i][1]][0]) {
                    ans[j][0] = input[i][0] + ans[j - input[i][1]][0];
                    ans[j][1] = input[i][1] + ans[j - input[i][1]][1];
                }
            }
        }

        for (j = 0; ans[W][0] == ans[W - j - 1][0]; j++)
            ;

        printf("Case %d:\n%d\n%d\n", t + 1, ans[W - j][0], ans[W - j][1]);
    }

    return 0;
}

Example test case(s):
input: 50
5
60,10
100,20
120,30
210,45
10,4
50
5
60,10
100,20
120,30
210,45
10,4
0

output: Case 1:
220
49
Case 2:
220
49
Language: C

#include <stdio.h>

int main() {
    long long n, a, m, M, c, b, i;
    c = 0;
    m = 100000000;
    M = -100000000;
    scanf("%lld", &n);

    for (i = 1; i <= n; i++) {
        scanf("%lld", &a);
        if (a > M) {
            M = a;
        }
        if (a < m) {
            m = a;
        }
        c = c + a;
    }
    printf("%lld %lld %lld\n", m, M, c);

    return 0;
}

Example test case(s):
input: 5
10 1 5 4 17

output: 1 17 37
Language: C

#include <stdio.h>
void swap(int *a, int *b) {
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}
int main() {
    int a, b;
    while (1) {
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0) break;
        if (b < a) swap(&a, &b);
        printf("%d %d\n", a, b);
    }
    return 0;
}

Example test case(s):
input: 3 2
2 2
5 3
0 0

output: 2 3
2 2
3 5
Language: C

#include <stdio.h>

int main() {
    double r;
    double s, l;
    double p = 3.141592653589;
    scanf("%lf", &r);

    s = r * r * p;
    l = 2 * p * r;

    printf("%f %f\n", s, l);

    return 0;
}

Example test case(s):
input: 2

output: 12.566371 12.566371
Language: C

#include <stdio.h>
#define MAX 101
#define WHITE 0
#define BLACK 2
#define GRAY 1
int time, n, g[MAX][MAX] = {0};
int d[MAX], f[MAX], color[MAX] = {WHITE};

void visit(int u) {
    int i;

    color[u] = GRAY;
    d[u] = ++time;

    for (i = 0; i < n; i++) {
        if (g[u][i] == 0) continue;
        if (color[i] == WHITE) visit(i);
    }

    color[u] = BLACK;
    f[u] = ++time;
}

void dfs(void) {
    int i;
    time = 0;

    for (i = 0; i < n; i++)
        if (color[i] == WHITE) visit(i);

    for (i = 0; i < n; i++) printf("%d %d %d\n", i + 1, d[i], f[i]);
}

int main() {
    int i, j, x, y, z;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d %d", &x, &y);
        for (j = 0; j < y; j++) {
            scanf("%d", &z);
            g[x - 1][z - 1] = 1;
        }
    }

    dfs();
    return 0;
}

Example test case(s):
input: 4
1 1 2
2 1 4
3 0
4 1 3

output: 1 1 8
2 2 7
3 4 5
4 3 6
Language: C

#include <stdio.h>

int main() {
    int x;
    scanf("%d", &x);
    x = x * x * x;
    printf("%d\n", x);

    return 0;
}

Example test case(s):
input: 2

output: 8
Language: C

#include <stdio.h>
int main() {
    int hcell, wcell, hpaint, wpaint, nblack, nwhite;

    scanf("%d %d", &hcell, &wcell);
    scanf("%d %d", &hpaint, &wpaint);
    nblack = (wcell * hpaint) + (hcell * wpaint) - (hpaint * wpaint);
    nwhite = (hcell * wcell) - nblack;
    printf("%d\n", nwhite);
    return 0;
}

Example test case(s):
input: 3 2
2 1

output: 1
Language: C

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

int main() {
    int n, i;
    int h[100001];
    int max = -1;
    int flag = 0;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d", &h[i]);
        if (max < h[i]) max = h[i];

        if (max - h[i] >= 2) flag = 1;
    }

    if (flag == 1)
        printf("No\n");

    else
        printf("Yes\n");

    return 0;
}

Example test case(s):
input: 5
1 2 1 1 3

output: Yes
Language: C

#include <stdio.h>
int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d\n", ((b - 1) + (a - 2)) / (a - 1));
    return 0;
}

Example test case(s):
input: 4 10

output: 3
Language: C

#include <stdio.h>

int main(void) {
    int A, B, C;

    scanf("%d %d %d", &A, &B, &C);

    if (A < C && C < B) {
        printf("Yes\n");
    } else if (A > C && C > B) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}

Example test case(s):
input: 3 8 5

output: Yes
Language: C

#include <stdio.h>

int main() {
    const int MAX_V = 999999;
    int prime[MAX_V + 1];
    int i, k, n;
    for (i = 2; i <= MAX_V; i++) {
        prime[i] = 1;
    }
    for (i = 2; i * i <= MAX_V; i++) {
        if (prime[i]) {
            for (k = 2 * i; k <= MAX_V; k += i) {
                prime[k] = 0;
            }
        }
    }
    prime[0] = 0;
    prime[1] = 0;
    int count = 0;
    while (scanf("%d", &n) != EOF) {
        count++;
        int cnt = 0;
        for (i = n; i > 0; i--) {
            if (prime[i] == 1) {
                cnt++;
            }
        }
        printf("%d\n", cnt);
        if (count == 30) break;
    }
    return 0;
}

Example test case(s):
input: 10
3
11

output: 4
2
5
Language: C

#include <stdio.h>
int main(void) {
    int v[10];
    int sum = 0;
    int i;

    for (i = 0; i < 10; i++) scanf("%d", &v[i]);

    for (i = 0; i < 10; i++) sum += v[i];

    printf("%d\n", sum);

    return 0;
}

Example test case(s):
input: 1
2
3
4
5
6
7
8
9
10

output: 55
Language: C

#include <stdio.h>
#include <stdlib.h>
#define unko 1e12
long int sort(long int *a, int left, int middle, int right) {
    long int l_arr[middle - left + 1], r_arr[right - middle + 1];
    long int cnt = 0;
    for (int i = 0; i < middle - left; i++) l_arr[i] = a[i + left];
    for (int i = 0; i < right - middle; i++) r_arr[i] = a[i + middle];
    l_arr[middle - left] = unko;
    r_arr[right - middle] = unko;
    int l = 0, r = 0;
    for (int i = 0; i < right - left; i++) {
        if (l_arr[l] <= r_arr[r]) {
            a[left + i] = l_arr[l++];
        } else {
            a[left + i] = r_arr[r++];
            cnt += middle - left - l;
        }
    }
    return cnt;
}
long int merge(long int *a, int left, int right) {
    if (left + 1 < right) {
        int middle = (left + right) / 2;
        long int x1 = merge(a, left, middle);
        long int x2 = merge(a, middle, right);
        long int x3 = sort(a, left, middle, right);
        return x1 + x2 + x3;
    } else {
        return 0;
    }
}

int main(void) {
    int n;
    scanf("%d", &n);
    long int *a = malloc(n * sizeof(long int));
    for (int i = 0; i < n; i++) scanf("%ld", a + i);
    printf("%ld\n", merge(a, 0, n));
    free(a);
    return 0;
}

Example test case(s):
input: 5
3 5 2 1 4

output: 6
Language: C

#include <stdio.h>

int main(void) {
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    if ((a * b) % 2 == 0) {
        printf("Even\n");
    } else {
        printf("Odd\n");
    }
    return 0;
}

Example test case(s):
input: 3 4

output: Even
Language: C

#include <stdio.h>

void white(int n, int A[]) {
    int i;
    for (i = 0; i < n - 1; i++) {
        printf("%d ", A[i]);
    }
    printf("%d\n", A[i]);
}

void insertionsort(int n, int A[]) {
    int i, j, a;
    for (i = 0; i < n; i++) {
        for (j = 0; j < i; j++) {
            if (A[i] < A[j]) {
                a = A[i];
                A[i] = A[j];
                A[j] = a;
            }
        }
        white(n, A);
    }
}

int main() {
    int i, n, A[100];
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    insertionsort(n, A);

    return 0;
}

Example test case(s):
input: 6
5 2 4 6 1 3

output: 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
Language: C

#include <stdio.h>
int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a < b && b < c) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Example test case(s):
input: 1 3 8

output: Yes
Language: C

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[]) {
    char buf[512];
    int len;
    fgets(buf, sizeof(buf), stdin);
    len = strlen(buf);
    printf("%c%d%c\n", buf[0], len - 3, buf[len - 2]);
    return 0;
}

Example test case(s):
input: internationalization

output: i18n
Language: C

#include <stdio.h>

int main() {
    int i = 1, Input;
    while (1) {
        scanf("%d", &Input);
        if (Input == 0) {
            break;
        }
        printf("Case %d: %d\n", i, Input);
        i++;
    }
    return 0;
}

Example test case(s):
input: 3
5
11
7
8
19
0

output: Case 1: 3
Case 2: 5
Case 3: 11
Case 4: 7
Case 5: 8
Case 6: 19
Language: C

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

int main() {
    int i_min, min;
    int i, j, k;
    int X, N;
    scanf("%d %d", &X, &N);
    if (N == 0) {
        printf("%d\n", X);
        exit(0);
    }

    int plus[256];
    int minus[256];
    for (i = 0; i < 256; i++) {
        plus[i] = i;
        minus[i] = (-1 * i);
    }
    for (i = 0; i < N; i++) {
        scanf("%d", &j);
        plus[j] = 0;
    }

    i_min = 0;
    min = 1000;
    for (i = 255; i >= 0; i--) {
        if (plus[i] == 0 && i > 0) {
            continue;
        }
        k = X - plus[i];
        if (k < 0) {
            k *= -1;
        }
        if (k <= min) {
            min = k;
            i_min = i;
        }
    }

    printf("%d\n", i_min);

    return 0;
}

Example test case(s):
input: 6 5
4 7 10 6 5

output: 8
Language: C

#include <stdio.h>
#include <string.h>

int calc_score() {
    int out = 0;
    char str[100];
    int score = 0;
    int base = 0;

    while (out < 3) {
        scanf("%s", str);
        if (strcmp(str, "OUT") == 0) {
            out++;
        } else if (strcmp(str, "HIT") == 0) {
            if (base == 3) {
                score++;
            } else {
                base++;
            }
        } else if (strcmp(str, "HOMERUN") == 0) {
            score += (base + 1);
            base = 0;
        }
    }

    return score;
}

int main(void) {
    int n;
    int inning = 0;

    scanf("%d", &n);

    while (inning < n) {
        printf("%d\n", calc_score());
        inning++;
    }

    return 0;
}

Example test case(s):
input: 2
HIT
OUT
HOMERUN
HIT
HIT
HOMERUN
HIT
OUT
HIT
HIT
HIT
HIT
OUT
HIT
HIT
OUT
HIT
OUT
OUT

output: 7
0
Language: C

#include <stdio.h>
int main() {
    char m;
    int a, b, c[256], i, j;
    for (i = 0; i > -1; i++) {
        scanf("%d %c %d", &a, &m, &b);
        if (m == '?') {
            break;
        }
        if (m == '+') {
            c[i] = a + b;
        }
        if (m == '-') {
            c[i] = a - b;
        }
        if (m == '*') {
            c[i] = a * b;
        }
        if (m == '/') {
            c[i] = a / b;
        }
    }
    for (j = 0; j < i; j++) {
        printf("%d\n", c[j]);
    }
    return (0);
}

Example test case(s):
input: 1 + 2
56 - 18
13 * 2
100 / 10
27 + 81
0 ? 0

output: 3
38
26
10
108
Language: C

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

#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))

int get_int4(int *a1, int *a2, int *a3, int *a4) {
    scanf("%d %d %d %d", a1, a2, a3, a4);
    return 0;
}

int fget_array(int64_t *arr, int size) {
    int i;
    for (i = 0; i < size; i++) {
        scanf("%lld", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 1000
#define NUM2_MAX (NUM_MAX * NUM_MAX)
#define RANK_MAX 3000

int asc(const void *a1, const void *a2) {
    int64_t aa1 = *(int64_t *)a1;
    int64_t aa2 = *(int64_t *)a2;
    if (aa1 > aa2) return 1;
    if (aa1 == aa2) return 0;
    return -1;
}

int desc(const void *a1, const void *a2) {
    int64_t aa1 = *(int64_t *)a1;
    int64_t aa2 = *(int64_t *)a2;
    if (aa1 > aa2) return -1;
    if (aa1 == aa2) return 0;
    return 1;
}

#define VAL_MAX (int64_t)(1e+10)
#define SUM_MAX (VAL_MAX * 3)

struct range {
    int start;
    int end;
};
int lower_bound(int64_t *arr, struct range r, int64_t key) {
    int low = r.start;
    ;
    int high = r.end;
    while (low + 1 < high) {
        int mid = (low + high) / 2;
        if (arr[mid] < key) {
            low = mid;
        } else {
            high = mid;
        }
    }
    return low + 1;
}

int main(void) {
    int x, y, z, rank;
    get_int4(&x, &y, &z, &rank);
    static int64_t xrr[NUM_MAX];
    static int64_t yrr[NUM_MAX];
    static int64_t zrr[NUM_MAX];
    fget_array(xrr, x);
    fget_array(yrr, y);
    fget_array(zrr, z);
    int64_t min_sum = VAL_MAX + 1;
    int64_t max_sum = 0;
    int i, j;
    for (i = 0; i < z; i++) min_sum = min(min_sum, zrr[i]);
    for (i = 0; i < z; i++) max_sum = max(max_sum, zrr[i]);

    static int64_t pair[NUM2_MAX];
    int idx = 0;
    for (i = 0; i < x; i++) {
        for (j = 0; j < y; j++) {
            pair[idx++] = xrr[i] + yrr[j];
        }
    }
    qsort(pair, idx, sizeof(int64_t), asc);
    min_sum += pair[0];
    max_sum += pair[idx - 1];

    static int cache[NUM_MAX];
    static int cnt_map[NUM_MAX];
    static int64_t ans[RANK_MAX];
    int size = x * y * z;
    int64_t prev = min_sum;
    int r;
    for (r = rank; r >= 1; r--) {
        int64_t low = prev - 1;
        int64_t high = max_sum + 1;
        while (low + 1 < high) {
            int64_t mid = (low + high) / 2;
            int cnt = 0;
            for (i = 0; i < z; i++) {
                int64_t pivot = zrr[i];
                struct range r = {cache[i] - 1, idx};
                int tmp = lower_bound(pair, r, mid - pivot);
                cnt_map[i] = tmp;
                cnt += tmp;
            }
            if (cnt <= size - r) {
                memcpy(cache, cnt_map, sizeof(int) * z);
                low = mid;
            } else {
                high = mid;
            }
        }
        ans[r - 1] = low;
        if (low == max_sum) break;
        prev = low;
    }
    for (i = 0; i < rank; i++) {
        printf("%lld\n", (ans[i] == 0) ? max_sum : ans[i]);
    }

    return 0;
}

Example test case(s):
input: 2 2 2 8
4 6
1 5
3 8

output: 19
17
15
14
13
12
10
8
Language: C

#include <stdio.h>
int main() {
    int a, b, c;
    char op;
    scanf("%d %c %d", &a, &op, &b);
    while (1) {
        if (op == '+') {
            c = a + b;
            printf("%d\n", c);
        } else if (op == '-') {
            c = a - b;
            printf("%d\n", c);
        } else if (op == '*') {
            c = a * b;
            printf("%d\n", c);
        } else if (op == '/') {
            c = a / b;
            printf("%d\n", c);
        } else {
            break;
        }
        scanf("%d %c %d", &a, &op, &b);
    }
    return 0;
}

Example test case(s):
input: 1 + 2
56 - 18
13 * 2
100 / 10
27 + 81
0 ? 0

output: 3
38
26
10
108
Language: C

#include <stdio.h>
#define N 4

typedef struct {
    int P[N][N];
} Pazz;

Pazz Q;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int Heu(Pazz Q) {
    int i, j;
    int hx, hy, sum = 0;
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            if (Q.P[i][j] == 0) continue;

            hx = (Q.P[i][j] - 1) % N - j;
            hy = (Q.P[i][j] - 1) / N - i;

            if (hx < 0)
                sum -= hx;
            else
                sum += hx;

            if (hy < 0)
                sum -= hy;
            else
                sum += hy;
        }
    }
    return sum;
}
int dfs(int x, int y, int max, int count, int n) {
    int i, temp;
    int x0, y0, ans = -1, h;

    h = Heu(Q);

    if (h == 0) return count;
    if ((count + h) > max) return -1;

    for (i = 0; i < 4; i++) {
        x0 = x + dx[i];
        y0 = y + dy[i];

        if (((i == (n + 2) % 4) && (n != -1)) ||
            !((0 <= x0) && (x0 < N) && (0 <= y0) && (y0 < N)))
            continue;
        temp = Q.P[y][x];
        Q.P[y][x] = Q.P[y0][x0];
        Q.P[y0][x0] = temp;

        ans = dfs(x0, y0, max, count + 1, i);

        if (ans != -1) return ans;
        temp = Q.P[y][x];
        Q.P[y][x] = Q.P[y0][x0];
        Q.P[y0][x0] = temp;
    }

    return -1;
}

int main() {
    int i, j;
    int kx, ky, ans, a;
    Pazz tP;

    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            scanf("%d", &a);
            Q.P[i][j] = a;
            if (a == 0) {
                kx = j;
                ky = i;
            }
        }
    }

    tP = Q;
    for (i = 1; i < 46; i++) {
        Q = tP;
        ans = dfs(kx, ky, i, 0, -1);
        if (ans != -1) {
            printf("%d\n", ans);
            break;
        }
    }

    return 0;
}

Example test case(s):
input: 1 2 3 4
6 7 8 0
5 10 11 12
9 13 14 15

output: 8
Language: C

#include <stdio.h>

int main() {
    int n, fd[6] = {}, i, j;
    double height;

    scanf("%d", &n);
    while (n--) {
        scanf("%lf", &height);
        if (height >= 185.0)
            fd[5]++;
        else if (height >= 180.0)
            fd[4]++;
        else if (height >= 175.0)
            fd[3]++;
        else if (height >= 170.0)
            fd[2]++;
        else if (height >= 165.0)
            fd[1]++;
        else
            fd[0]++;
    }

    for (i = 0; i < 6; i++) {
        printf("%d:", i + 1);
        for (j = 0; j < fd[i]; j++) putchar('*');
        puts("");
    }
    return 0;
}

Example test case(s):
input: 4
180.3
168.2
165.5
175.3

output: 1:
2:**
3:
4:*
5:*
6: