iidai/codenet huggingface dataset:
Language: C

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

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

typedef struct node *NodePointer;

NodePointer nil;

NodePointer listSearch(int key) {
    NodePointer cur = nil->next;
    while (cur != nil) {
        if (cur->key == key) break;
        cur = cur->next;
    }
    return cur;
}

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

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

void deleteNode(NodePointer t) {
    if (t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    NodePointer t = nil->next;
    if (t == nil) return;
    deleteNode(t);
}

void deleteLast() {
    NodePointer t = nil->prev;
    if (t == nil) return;
    deleteNode(t);
}

void deleteKey(int key) {
    NodePointer t = listSearch(key);
    if (t != nil) deleteNode(t);
}

void insert(int key) {
    NodePointer x;
    x = (NodePointer)malloc(sizeof(struct node));
    x->key = key;
    x->prev = nil;
    x->next = nil->next;
    x->next->prev = x;
    nil->next = x;
}

int main() {
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for (i = 0; i < n; i++) {
        scanf("%s%d", com, &key);
        if (com[0] == 'i') {
            insert(key);
            np++;
            size++;
        } else if (com[0] == 'd') {
            if (strlen(com) > 6) {
                if (com[6] == 'F')
                    deleteFirst();
                else if (com[6] == 'L')
                    deleteLast();
            } else {
                deleteKey(key);
                nd++;
            }
            size--;
        }
    }

    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>
#include <stdlib.h>

int *flag;

void prime(int num) {
    int i, j;

    flag = (int *)calloc(sizeof(int), num + 1);

    for (i = 2; i * i <= num; i++) {
        if (flag[i] == 0) {
            for (j = 2; i * j <= num; j++) {
                flag[i * j] = 1;
            }
        }
    }
}

int main() {
    int n, i, cnt;

    prime(50000);

    while (1) {
        scanf("%d", &n);
        if (n == 0) {
            break;
        }
        i = 2;
        cnt = 0;
        while (i * 2 <= n) {
            if (!flag[i] && !flag[n - i]) {
                cnt++;
            }
            i++;
        }
        printf("%d\n", cnt);
    }

    return 0;
}

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

output: 2
0
Language: C

#include <stdio.h>

int main() {
    int m1, d1, m2, d2;
    scanf("%d%d%d%d", &m1, &d1, &m2, &d2);
    if (m1 != m2)
        printf("1\n");
    else
        printf("0\n");
}

Example test case(s):
input: 11 16
11 17

output: 0
Language: C

#include <stdio.h>
#define LEN 300
#define TRUE 1
#define FALSE -1

int solve(int, int);
int n, A[LEN];
int flag;

int main() {
    int q, M;
    int i, j, k;

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

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &M);
        flag = FALSE;

        solve(-1, M);
        if (flag == TRUE)
            printf("yes\n");
        else
            printf("no\n");
    }

    return 0;
}

int solve(int i, int m) {
    if (i > n)
        return FALSE;
    else if (m < 0)
        return FALSE;
    else if (m == 0 || m - A[i + 1] == 0) {
        flag = TRUE;
        return TRUE;
    } else {
        solve(i + 1, m);

        solve(i + 1, m - A[i]);
    }
}

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>

int n, r, i, j, p, c;
int a[100], b[100];

int main() {
    while (1) {
        scanf("%d %d", &n, &r);
        if (n == 0 && r == 0) break;

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

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

            for (j = 0; j < c; j++) {
                a[j] = b[p - 1 + j];
            }

            for (j = c; j < c + p - 1; j++) {
                a[j] = b[j - c];
            }
        }
        printf("%d\n", a[0]);
    }
    return 0;
}

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

output: 4
4
Language: C

#include <stdio.h>

int main(void) {
    long int n;

    scanf("%ld", &n);
    long int a[n];
    long int count[n];

    for (long int i = 1; i < n; i++) scanf("%ld", &a[i]);

    for (long int i = 0; i < n; i++) count[i] = 0;

    for (long int i = 1; i < n; i++) count[a[i] - 1]++;

    for (long int i = 0; i < n; i++) printf("%ld\n", count[i]);

    return 0;
}

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

output: 2
2
0
0
0
Language: C

#include <stdio.h>

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

    int A[N + 1];
    int B[N];
    int i;

    for (i = 0; i < N + 1; i++) {
        scanf("%d", &A[i]);
    }

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

    long ans = 0;

    for (i = 0; i < N; i++) {
        if (A[i] >= B[i]) {
            ans = ans + B[i];
            A[i] = A[i] - B[i];
            B[i] = 0;
        } else {
            ans = ans + A[i];
            B[i] = B[i] - A[i];
            A[i] = 0;
        }

        if (A[i + 1] >= B[i]) {
            ans = ans + B[i];
            A[i + 1] = A[i + 1] - B[i];
            B[i] = 0;
        } else {
            ans = ans + A[i + 1];
            B[i] = B[i] - A[i + 1];
            A[i + 1] = 0;
        }
    }

    printf("%ld\n", ans);

    return 0;
}

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

output: 9
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>

int main() {
    int i, j, N, A[100], tmp, count = 0;

    scanf("%d", &N);

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

    for (i = 0; i < N - 1; i++) {
        for (j = N - 1; j > i; j--) {
            if (A[j] < A[j - 1]) {
                tmp = A[j];
                A[j] = A[j - 1];
                A[j - 1] = tmp;

                count++;
            }
        }
    }

    for (i = 0; i < N; i++) {
        printf("%d", A[i]);

        if (i < N - 1) printf(" ");
    }

    printf("\n");

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

    return 0;
}

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

output: 1 2 3 4 5
8
Language: C

#include <stdio.h>
int search(int A[], int n, int key) {
    int i = 0;
    A[n] = key;
    while (A[i] != key) i++;
    return i != n;
}

int main(void) {
    int n, A[10000 + 1], q, key, sum = 0;
    int i;

    scanf("%d", &n);
    for (i = 0; i < n; i++) scanf("%d", &A[i]);
    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &key);
        if (search(A, n, key)) sum++;
    }
    printf("%d\n", sum);

    return 0;
}

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

output: 3
Language: C

#include <stdio.h>
#include <string.h>
int main() {
    char c[11], ans[11] = {'\0'};
    scanf("%s", c);
    for (int i = 0; c[i] != '\0'; i++) {
        if (c[i] != 'B')
            ans[strlen(ans)] = c[i];
        else
            ans[strlen(ans) - 1] = '\0';
    }
    printf("%s\n", ans);
}

Example test case(s):
input: 01B0

output: 00
Language: C

#include <stdio.h>

int main() {
    int S;

    scanf("%d", &S);

    printf("%d:%d:%d\n", (int)(S / 3600), (int)((S % 3600) / 60), S % 60);

    return 0;
}

Example test case(s):
input: 46979

output: 13:2:59
Language: C

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

void run(void) {
    int n, k;
    scanf("%d%d", &n, &k);
    int a[100];
    int i, j;
    for (i = 0; i < n; i++) scanf("%d", a + i);
    int *dp = (int *)calloc(k + 1, sizeof(int));
    for (i = 1; i <= k; i++) {
        int win = 0;
        for (j = 0; j < n && a[j] <= i; j++) {
            if (dp[i - a[j]] == 0) {
                win = 1;
            }
        }
        dp[i] = win;
    }
    printf("%s\n", dp[k] ? "First" : "Second");
}

int main(void) {
    run();
    return 0;
}

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

output: First