iidai/codenet huggingface dataset:
Language: C

#include <stdio.h>

int main(void) {
    int A, B;
    scanf("%d %d", &A, &B);
    if (A < 10 && B < 10)
        printf("%d\n", A * B);
    else
        printf("-1\n");
    return 0;
}

Example test case(s):
input: 2 5

output: 10
Language: C

#include <stdio.h>
#define N 2000
int num1, math[N + 1];
int main() {
    int a, num2, ans, sum = 0, math[N + 1];
    int i, j;

    math[0] = 1;

    scanf("%d", &num1);
    for (i = 0; i < num1; i++) {
        scanf("%d", &a);
        sum += a;
        for (j = sum - a; j >= 0; j--) {
            if (math[j] == 1) math[j + a] = 1;
        }
    }

    scanf("%d", &num2);
    for (i = 0; i < num2; i++) {
        scanf("%d", &ans);
        math[ans] == 1 ? printf("yes\n") : printf("no\n");
    }

    return 0;
}

Example test case(s):
input: 5
1 5 7 10 21
8
2 4 17 8 22 21 100 35

output: no
no
yes
yes
yes
yes
no
no
Language: C

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

#define LEN 100005

typedef struct pp {
    char name[100];
    int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue() {
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main() {
    int elaps = 0, c;
    int i, q;
    P u;

    scanf("%d %d", &n, &q);

    for (i = 1; i <= n; i++) {
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head = 1;
    tail = n + 1;

    while (head != tail) {
        u = dequeue();
        c = min(q, u.t);
        u.t -= c;
        elaps += c;
        if (u.t > 0)
            enqueue(u);
        else {
            printf("%s %d\n", u.name, elaps);
        }
    }

    return 0;
}

Example test case(s):
input: 5 100
p1 150
p2 80
p3 200
p4 350
p5 20

output: p2 180
p5 400
p1 450
p3 550
p4 800
Language: C

#include <stdio.h>
#define N 1000

int main(void) {
    char su[N] = {'0'};
    int susum = 0;
    int j = 0;

    while (1) {
        for (j = 0; j <= N; j++) {
            scanf("%c", &su[j]);
            if (su[j] == '\n') break;
            susum = susum + (su[j] - '0');
        }
        if (su[0] == '0') break;
        printf("%d\n", susum);
        susum = 0;
    }
    return 0;
}

Example test case(s):
input: 123
55
1000
0

output: 6
10
1
Language: C

#include <stdio.h>

int main(void) {
    int a, b, n;
    int sum;
    int i, j;
    while (1) {
        if (scanf("%d %d %d", &a, &b, &n) == -1) break;
        a -= a / b * b;
        sum = 0;
        for (i = 1; i <= n; i++) {
            a *= 10;
            for (j = 9; j >= 0; j--) {
                if (b * j <= a) break;
            }
            a -= b * j;
            sum += j;
        }
        printf("%d\n", sum);
    }
    return 0;
}

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

output: 5
24
7
6
Language: C

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

int main() {
    int i;
    char S[6];
    scanf("%s", S);
    for (i = 0; S[i] != '\0'; i++) {
        if (S[i] == 'A' && S[i + 1] == 'C') {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

Example test case(s):
input: BACD

output: Yes
Language: C

#include <stdio.h>
int main() {
    int a, b, c, d, e, i;
    scanf("%d%d%d", &a, &b, &c);
    if (b <= c) {
        printf("NO\n");
        return 0;
    } else {
        d = a;
        e = d % b;
        for (i = 0; i < b; i++) {
            d = d % b;
            if (d == c) {
                printf("YES\n");
                return 0;
            } else if (i != 0 && d == c) {
                printf("NO\n");
                return 0;
            }
            d += a;
        }
    }
    printf("NO\n");
    return 0;
}

Example test case(s):
input: 7 5 1

output: YES
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i, l, r) for (ll i = (l); i < (r); i++)
#define repp(i, l, r, k) for (ll i = (l); i < (r); i += (k))
#define INF ((1LL << 62) - (1LL << 31))
#define max(p, q) ((p) > (q) ? (p) : (q))
#define min(p, q) ((p) < (q) ? (p) : (q))
#define bit(n, m) (((n) >> (m)) & 1)
int upll(const void* a, const void* b) {
    return *(ll*)a < *(ll*)b ? -1 : *(ll*)a > *(ll*)b ? 1 : 0;
}
int downll(const void* a, const void* b) {
    return *(ll*)a < *(ll*)b ? 1 : *(ll*)a > *(ll*)b ? -1 : 0;
}
void sortup(ll* a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll* a, int n) { qsort(a, n, sizeof(ll), downll); }
ll pom(ll a, ll n, int m) {
    ll x = 1;
    for (a %= m; n; n /= 2) n& 1 ? x = x * a % m : 0, a = a * a % m;
    return x;
}

#define MOD 1000000007
#define invp(a, p) pom(a, p - 2, p)

typedef struct edge {
    ll p, i;
    char s[20];
} E;
int esort(const void* a, const void* b) {
    E *p = (E*)a, *q = (E*)b;
    if (strcmp((*p).s, (*q).s)) return strcmp((*p).s, (*q).s);
    if ((*p).p < (*q).p) return 1;
    return -1;
}

E data[100];
ll n, m;
int main() {
    scanf("%lld", &n);
    rep(i, 0, n) {
        scanf(" %s%lld", data[i].s, &data[i].p);
        data[i].i = i;
    }
    qsort(data, n, sizeof(E), esort);
    rep(i, 0, n) printf("%lld\n", data[i].i + 1);
}

Example test case(s):
input: 6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40

output: 3
4
6
1
5
2
Language: C

#include <stdio.h>
int main() {
    int input[4][4], tc;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            scanf("%d", &input[i][j]);
        }
    }
    scanf("%d", &tc);
    int testcase;
    for (int i = 0; i < tc; i++) {
        scanf("%d", &testcase);
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (input[i][j] == testcase) {
                    input[i][j] = 0;
                }
            }
        }
    }
    if (input[0][0] == 0 && input[1][1] == 0 && input[2][2] == 0) {
        puts("Yes");
    } else if (input[0][2] == 0 && input[1][1] == 0 && input[2][0] == 0) {
        puts("Yes");
    } else if (input[0][0] == 0 && input[0][1] == 0 && input[0][2] == 0) {
        puts("Yes");
    } else if (input[1][0] == 0 && input[1][1] == 0 && input[1][2] == 0) {
        puts("Yes");
    } else if (input[2][0] == 0 && input[2][1] == 0 && input[2][2] == 0) {
        puts("Yes");
    } else if (input[0][0] == 0 && input[1][0] == 0 && input[2][0] == 0) {
        puts("Yes");
    } else if (input[0][1] == 0 && input[1][1] == 0 && input[2][1] == 0) {
        puts("Yes");
    } else if (input[0][2] == 0 && input[1][2] == 0 && input[2][2] == 0) {
        puts("Yes");
    } else {
        puts("No");
    }
    return 0;
}

Example test case(s):
input: 84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30

output: Yes
Language: C

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

int main() {
    int X, A, B, C;
    int i = 0;
    int j = 0;
    int k = 0;
    int kosu = 0;

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

    X = X / 50;

    for (i = 0; i <= A; i++) {
        for (j = 0; j <= B; j++) {
            for (k = 0; k <= C; k++) {
                if (X == (10 * i) + (2 * j) + k) kosu++;
            }
        }
    }

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

    return 0;
}

Example test case(s):
input: 2
2
2
100

output: 2
Language: C

#include <stdio.h>
#include <string.h>
int main(void) {
    int i, sum = 0;
    int flag = 0;
    char x[1002];
    scanf("%s", x);
    do {
        for (i = 0; i < 1002; i++) {
            if (x[i] == 0) {
                printf("%d\n", sum);
                break;
            } else {
                sum += x[i] - 0x30;
            }
        }
        sum = 0;
        scanf("%s", x);
    } while (x[0] != 0x30);

    return 0;
}

Example test case(s):
input: 123
55
1000
0

output: 6
10
1
Language: C

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

int main() {
    char inputNumbers[5];
    char temp[2];
    int a, b, c, d;
    int sum;
    char symbols[3];

    scanf("%s", &inputNumbers);

    temp[1] = '\0';

    temp[0] = inputNumbers[0];
    a = atoi(temp);
    temp[0] = inputNumbers[1];
    b = atoi(temp);
    temp[0] = inputNumbers[2];
    c = atoi(temp);
    temp[0] = inputNumbers[3];
    d = atoi(temp);

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                if (i == 0) {
                    sum = a + b;
                    symbols[0] = '+';
                } else {
                    sum = a - b;
                    symbols[0] = '-';
                }

                if (j == 0) {
                    sum = sum + c;
                    symbols[1] = '+';
                } else {
                    sum = sum - c;
                    symbols[1] = '-';
                }

                if (k == 0) {
                    sum = sum + d;
                    symbols[2] = '+';
                } else {
                    sum = sum - d;
                    symbols[2] = '-';
                }

                if (sum == 7) {
                    printf("%d%c%d%c%d%c%d=7\n", a, symbols[0], b, symbols[1],
                           c, symbols[2], d);

                    return 0;
                }
            }
        }
    }

    return 0;
}

Example test case(s):
input: 1222

output: 1+2+2+2=7
Language: C

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

void main() {
    int n, d;
    scanf("%d%d", &n, &d);
    int point[n + 1][d + 1];

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= d; j++) {
            scanf("%d", &point[i][j]);
        }
    }

    int count = 0;
    for (int i = 1; i <= n - 1; i++) {
        for (int j = i + 1; j <= n; j++) {
            int sum = 0;
            for (int k = 1; k <= d; k++) {
                sum = sum +
                      (point[i][k] - point[j][k]) * (point[i][k] - point[j][k]);
            }
            double kyori = sqrt(sum);
            if (ceil(kyori) == floor(kyori)) {
                count++;
            }
        }
    }

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

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

output: 1
Language: C

#include <stdio.h>

int main(void) {
    char n[10];
    scanf("%s", n);
    if (((n[0] == n[1]) && (n[1] == n[2])) ||
        ((n[1] == n[2]) && (n[2] == n[3]))) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Example test case(s):
input: 1118

output: Yes
Language: C

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

int main() {
    char str[21];
    int i, len;

    scanf("%s", str);

    len = strlen(str);

    for (i = len - 1; i >= 0; i--) {
        putchar(str[i]);
    }
    printf("\n");

    return 0;
}

Example test case(s):
input: w32nimda

output: admin23w
Language: C

#include <stdio.h>
int main(void) {
    int n, i, a;
    scanf("%d", &n);
    for (i = 1; i <= n; i++) {
        a = i;
        if ((a % 3) == 0) {
            printf(" %d", i);
        } else {
            for (; a;) {
                if ((a % 10) == 3) {
                    printf(" %d", i);
                    a = 0;
                }
                a = a / 10;
            }
        }
    }
    putchar('\n');
    return 0;
}

Example test case(s):
input: 30

output:  3 6 9 12 13 15 18 21 23 24 27 30
Language: C

#include <stdio.h>
#define DAYS 365

int main(void) {
    int n, i;
    int nyuyoku_ticket[DAYS], pool_ticket[DAYS];
    int nyuyoku_member[DAYS], pool_member[DAYS];
    int seiki_ryoukin[DAYS], waribiki_ryoukin[DAYS], saiyasune[DAYS];

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d %d %d %d", &nyuyoku_ticket[i], &pool_ticket[i],
              &nyuyoku_member[i], &pool_member[i]);
        if (nyuyoku_member[i] >= 5 && pool_member[i] >= 2) {
            seiki_ryoukin[i] = (((nyuyoku_ticket[i] * nyuyoku_member[i]) +
                                 (pool_ticket[i] * pool_member[i])) *
                                8) /
                               10;
            saiyasune[i] = seiki_ryoukin[i];
        } else if (nyuyoku_member[i] >= 5) {
            seiki_ryoukin[i] = (nyuyoku_ticket[i] * nyuyoku_member[i]) +
                               (pool_ticket[i] * pool_member[i]);
            waribiki_ryoukin[i] = (((nyuyoku_ticket[i] * nyuyoku_member[i]) +
                                    (pool_ticket[i] * 2)) *
                                   8) /
                                  10;
            if (seiki_ryoukin[i] >= waribiki_ryoukin[i]) {
                saiyasune[i] = waribiki_ryoukin[i];
            } else {
                saiyasune[i] = seiki_ryoukin[i];
            }
        } else if (pool_member[i] >= 2) {
            seiki_ryoukin[i] = (nyuyoku_ticket[i] * nyuyoku_member[i]) +
                               (pool_ticket[i] * pool_member[i]);
            waribiki_ryoukin[i] =
                (((nyuyoku_ticket[i] * 5) + (pool_ticket[i] * pool_member[i])) *
                 8) /
                10;
            if (seiki_ryoukin[i] >= waribiki_ryoukin[i]) {
                saiyasune[i] = waribiki_ryoukin[i];
            } else {
                saiyasune[i] = seiki_ryoukin[i];
            }
        } else {
            seiki_ryoukin[i] = (nyuyoku_ticket[i] * nyuyoku_member[i]) +
                               (pool_ticket[i] * pool_member[i]);
            waribiki_ryoukin[i] =
                (((nyuyoku_ticket[i] * 5) + (pool_ticket[i] * 2)) * 8) / 10;
            if (seiki_ryoukin[i] >= waribiki_ryoukin[i]) {
                saiyasune[i] = waribiki_ryoukin[i];
            } else {
                saiyasune[i] = seiki_ryoukin[i];
            }
        }
    }
    for (i = 0; i < n; i++) {
        printf("%d\n", saiyasune[i]);
    }
    return 0;
}

Example test case(s):
input: 2
100 100 1 1
1000 500 5 2

output: 200
4800
Language: C

#include <stdio.h>

int main(void) {
    int i, n, tmp;
    long long int min = 1000000, max = -1000000, sum = 0;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%d", &tmp);
        if (min > tmp) min = tmp;
        if (max < tmp) max = tmp;
        sum += tmp;
    }

    printf("%ld %ld %ld\n", min, max, sum);

    return 0;
}

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

output: 1 17 37
Language: C

#include <stdio.h>

int min(int a, int b) {
    if (a <= b) {
        return (a);
    }
    return (b);
}

int Chain(int b[10000], int n) {
    int i, j;
    int count;
    int color;
    int a[10000];

    for (i = 0; i < n; i++) {
        a[i] = b[i];
    }

    for (i = 0; i < n - 4; i++) {
        if (a[i] != 0 && a[i] == a[i + 1] && a[i] == a[i + 2] &&
            a[i] == a[i + 3]) {
#if 0
			printf("-----\n");
			for (j = 0; j < n; j++){
				printf("%d\n", a[j]);
			}
			printf("-----\n");
#endif

            count = 0;
            color = a[i];

            for (j = i; a[j] == color; j++) {
                a[j] = 0;
                count++;
            }

            for (j = 0; i + j + count < 10000; j++) {
                a[i + j] = a[i + j + count];
                a[i + j + count] = 0;
            }

#if 0
			printf("-----\n");
			for (j = 0; j < n; j++){
				printf("%d\n", a[j]);
			}
			printf("-----\n");
			getch();
#endif

            i = 0;
        }
    }

    count = 0;
    while (a[count] != 0) {
        count++;
    }

    if (count == 4 && a[0] == a[1] && a[0] == a[2] && a[0] == a[3]) {
        return (0);
    }

    return (count);
}

int main(void) {
    int n;
    int i, j;
    int a[10000];
    int ans;
    int color;

    while (1) {
        for (i = 0; i < 10000; i++) {
            a[i] = 0;
        }

        scanf("%d", &n);
        if (n == 0) {
            break;
        }
        ans = n;

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

        for (i = 0; i < n - 4; i++) {
            int count[3] = {0, 0, 0};
            for (j = i; j < i + 4; j++) {
                if (a[j] - 1 >= 0) {
                    count[a[j] - 1]++;
                }
            }

            color = 0;
            for (j = 0; j < 3; j++) {
                if (count[j] >= 3) {
                    color = j + 1;
                    break;
                }
            }

            if (color != 0) {
                for (j = i; j < i + 4; j++) {
                    int buf;
                    buf = a[j];
                    a[j] = color;
                    ans = min(ans, Chain(a, n));
                    a[j] = buf;
                }
            }
        }

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

    return (0);
}

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

output: 3
12
Language: C

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

int main(void) {
    int x;
    scanf("%d", &x);

    if (x == 1)
        printf("0\n");
    else
        printf("1\n");

    return 0;
}

Example test case(s):
input: 1

output: 0
Language: C

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

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

node *head;

node *makenode(int);
void insert(int);
void delete(int);
void deleteFirst();
void deleteLast();

int main() {
    int i, n, a;
    char op[16];
    node *x;

    head = makenode(0);
    head->next = head;
    head->prev = head;

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s", op);
        if (strcmp(op, "insert") == 0) {
            scanf("%d", &a);
            insert(a);
        } else if (strcmp(op, "delete") == 0) {
            scanf("%d", &a);
            delete (a);
        } else if (strcmp(op, "deleteFirst") == 0) {
            deleteFirst();
        } else if (strcmp(op, "deleteLast") == 0) {
            deleteLast();
        }
    }

    x = head;
    while (x->next != head) {
        printf("%d", x->next->key);
        x = x->next;
        if (x->next != head) {
            printf(" ");
        }
    }
    printf("\n");

    return 0;
}

node *makenode(int a) {
    node *x;
    x = malloc(sizeof(node));
    x->key = a;
    return x;
}
void insert(int a) {
    node *x;
    x = makenode(a);
    x->next = head->next;
    head->next->prev = x;
    head->next = x;
    x->prev = head;
}
void delete(int a) {
    node *x;
    x = head;

    while (x->next != head) {
        x = x->next;
        if (x->key == a) {
            x->prev->next = x->next;
            x->next->prev = x->prev;
            free(x);
            break;
        }
    }
}
void deleteFirst() {
    node *x;
    x = head->next;
    head->next = x->next;
    x->next->prev = head;
    free(x);
}
void deleteLast() {
    node *x;
    x = head->prev;
    head->prev = x->prev;
    x->prev->next = head;
    free(x);
}

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(void) {
    int a, b, c, i, j, k;
    int max;

    scanf("%d", &j);

    for (i = 0; i < j; i++) {
        scanf("%d", &a);
        scanf("%d", &b);
        scanf("%d", &c);

        max = a;
        k = 0;
        if (max <= b) {
            max = b;
            k = 1;
        }
        if (max <= c) {
            max = c;
            k = 2;
        }

        max = max * max;
        a = a * a;
        b = b * b;
        c = c * c;
        if (k == 0 && max == b + c) {
            printf("YES\n");
        } else if (k == 1 && max == a + c) {
            printf("YES\n");
        } else if (k == 2 && max == a + b) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return (0);
}

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

output: YES
NO
NO
Language: C

#include <stdio.h>
int main(void) {
    int x, y;

    scanf("%d", &x);

    y = x * x * x;

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

    return 0;
}

Example test case(s):
input: 2

output: 8
Language: C

#include <stdio.h>

int main(void) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    if (a < b && b < c)
        puts("Yes");
    else
        puts("No");

    return 0;
}

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

output: Yes
Language: C

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

int low[200000];
int high[200000];
int a[200000];

int part(int a[], int b[], int l, int r) {
    int i, j, x, t;

    i = l - 1;
    j = r;

    x = b[r];

    while (1) {
        while (b[++i] < x)
            ;
        while (i < --j && x < b[j])
            ;

        if (i >= j) break;

        t = a[i];
        a[i] = a[j];
        a[j] = t;
        t = b[i];
        b[i] = b[j];
        b[j] = t;
    }

    t = a[i];
    a[i] = a[r];
    a[r] = t;
    t = b[i];
    b[i] = b[r];
    b[r] = t;
    return i;
}

void quicksort(int a[], int b[], int n) {
    int l, r, v;
    int sp;

    low[0] = 0;
    high[0] = n - 1;
    sp = 1;

    while (sp > 0) {
        sp--;
        l = low[sp];
        r = high[sp];

        if (l >= r)
            ;

        else {
            v = part(a, b, l, r);

            if (v - l < r - v) {
                low[sp] = v + 1;
                high[sp++] = r;
                low[sp] = l;
                high[sp++] = v - 1;
            }

            else {
                low[sp] = l;
                high[sp++] = v - 1;
                low[sp] = v + 1;
                high[sp++] = r;
            }
        }
    }
}

int main() {
    int n, m;
    int i;
    int a[100006];
    int b[100006];
    int cnt = 0;
    int t;

    scanf("%d %d", &n, &m);

    for (i = 0; i < m; i++) scanf("%d %d", &a[i], &b[i]);

    quicksort(a, b, m);

    t = 0;
    for (i = 0; i < m; i++) {
        if (t <= a[i]) {
            t = b[i];
            cnt++;
        }
    }

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

    return 0;
}

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

output: 1
Language: C

#include <stdio.h>

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    printf("%d\n", (n - 1) * (m - 1));
    fflush(stdout);
    return 0;
}

Example test case(s):
input: 3 4

output: 6
Language: C

#include <stdio.h>

#define MAX 25

typedef struct {
    int l, r, par;
} node;

node N[MAX];

void init(int);
void Preorder(int);
void Inorder(int);
void Postorder(int);

int main() {
    int n, i, id, l, r;
    int p;

    scanf("%d", &n);
    init(n);

    for (i = 0; i < n; i++) {
        scanf("%d%d%d", &id, &l, &r);

        if (l != -1) {
            N[id].l = l;
            N[l].par = id;
        }
        if (r != -1) {
            N[id].r = r;
            N[r].par = id;
        }
    }

    for (i = 0; i < n; i++) {
        if (N[i].par == -1) {
            p = i;
            break;
        }
    }

    puts("Preorder");
    Preorder(p);
    puts("");

    puts("Inorder");
    Inorder(p);
    puts("");

    puts("Postorder");
    Postorder(p);
    puts("");

    return 0;
}

void init(int n) {
    int i;

    for (i = 0; i < n; i++) {
        N[i].par = N[i].l = N[i].r = -1;
    }
}

void Preorder(int p) {
    if (p != -1) {
        printf(" %d", p);
        Preorder(N[p].l);
        Preorder(N[p].r);
    }
}

void Inorder(int p) {
    if (p != -1) {
        Inorder(N[p].l);
        printf(" %d", p);
        Inorder(N[p].r);
    }
}

void Postorder(int p) {
    if (p != -1) {
        Postorder(N[p].l);
        Postorder(N[p].r);
        printf(" %d", p);
    }
}

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

output: Preorder
 0 1 2 3 4 5 6 7 8
Inorder
 2 1 3 0 6 5 7 4 8
Postorder
 2 3 1 6 7 5 8 4 0
Language: C

#include <stdio.h>

int main(void) {
    int x, y;
    x = 0;
    y = 0;

    scanf("%d", &x);
    scanf("%d", &y);

    printf("%d %d\n", x * y, (2 * x) + (2 * y));

    return 0;
}

Example test case(s):
input: 3 5

output: 15 16
Language: C

#include <stdio.h>

int main(void) {
    int n, x, min, m, i;
    scanf("%d %d %d", &n, &x, &min);
    x -= min;
    for (i = 1; i < n; i++) {
        scanf("%d", &m);
        x -= m;
        if (min > m) {
            min = m;
        }
    }
    printf("%d\n", n + x / min);
    return 0;
}

Example test case(s):
input: 3 1000
120
100
140

output: 9
Language: C

#include <stdio.h>
int main() {
    int a, b, x, w;
    while (scanf("%d %d", &a, &b) != EOF) {
        x = a + b;
        w = 0;
        while (x) {
            w++;
            x /= 10;
        }
        printf("%d\n", w);
    }
    return 0;
}

Example test case(s):
input: 5 7
1 99
1000 999

output: 2
3
4