iidai/codenet huggingface dataset:
Language: C

#include <stdio.h>
#include <stdlib.h>
#define I 10000
void CountingSort(int *, int *, int);
int main() {
    int *a, *b, i, max = 0, n;
    scanf("%d", &n);
    a = (int *)malloc((n + 1) * sizeof(int));
    b = (int *)malloc((n + 1) * sizeof(int));
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i + 1]);
    }
    CountingSort(a, b, n);
    printf("%d", b[1]);
    for (i = 2; i < n + 1; i++) printf(" %d", b[i]);
    printf("\n");
    free(a);
    free(b);
    return 0;
}
void CountingSort(int a[], int b[], int k) {
    int c[I], i, j;
    for (i = 0; i <= I; i++) c[i] = 0;
    for (j = 0; j < k; j++) c[a[j + 1]]++;
    for (i = 1; i < I + 1; i++) c[i] += c[i - 1];
    for (j = k; 0 < j; j--) {
        b[c[a[j]]] = a[j];
        c[a[j]]--;
    }
}

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

output: 0 1 2 2 3 3 5
Language: C

#include <stdio.h>

#define ABS(x) (((x) < (0)) ? (-(x)) : (x))

int main(void) {
    int N, t, x, y, nx = 0, ny = 0, nt = 0;
    int i, j, k, tmp;
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d%d%d", &t, &x, &y);
        tmp = t - nt - (ABS(x - nx) + ABS(y - ny));
        if (tmp < 0 || tmp % 2) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

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

output: Yes
Language: C

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

    return 0;
}

Example test case(s):
input: 5

output: 3
Language: C

#include <stdio.h>

int main(void)

{
    int x, kotae;

    scanf("%d", &x);

    kotae = x * x * x;

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

    return 0;
}

Example test case(s):
input: 2

output: 8
Language: C

#include <stdio.h>
#include <string.h>
int main() {
    int n;
    char s[10010], *c;
    scanf("%d%*c", &n);
    while (n--) {
        fgets(s, 1010, stdin);
        while (c = strstr(s, "Hoshino")) *(c + 6) = 'a';
        printf("%s", s);
    }
    return 0;
}

Example test case(s):
input: 3
Hoshino
Hashino
Masayuki Hoshino was the grandson of Ieyasu Tokugawa.

output: Hoshina
Hashino
Masayuki Hoshina was the grandson of Ieyasu Tokugawa.
Language: C

#include <stdio.h>
#define MAX 100
#define INF 999999
#define NIL -1
#define WHITE 0
#define BLACK 2

int prim();

int n, G[MAX][MAX];

int main() {
    int i, j;

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

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

    return 0;
}

int prim() {
    int u, i, v, mincost, d[n], pi[n], color[n], sum = 0;

    for (u = 0; u < n; u++) {
        d[u] = INF;
        pi[u] = NIL;
        color[u] = WHITE;
    }

    d[0] = 0;
    while (1) {
        mincost = INF;

        for (i = 0; i < n; i++) {
            if (color[i] != BLACK && d[i] < mincost) {
                mincost = d[i];
                u = i;
            }
        }

        if (mincost == INF) break;

        color[u] = BLACK;

        for (v = 0; v < n; v++) {
            if (color[v] != BLACK && G[u][v] < d[v] && G[u][v] != -1) {
                pi[v] = u;
                d[v] = G[u][v];
            }
        }
    }

    for (i = 0; i < n; i++) {
        if (d[i] != INF) sum += d[i];
    }

    return sum;
}

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

output: 5
Language: C

#include <stdio.h>

int main(void) {
    int N, D;
    int ans, rem;

    scanf("%d%d", &N, &D);

    ans = N / (D * 2 + 1);
    rem = N % (D * 2 + 1);

    if (rem != 0) {
        ans = ans + 1;
    }

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

    return 0;
}

Example test case(s):
input: 6 2

output: 2
Language: C

#include <stdio.h>

int main(void) {
    int A, B, flag = 0;
    scanf("%d %d", &A, &B);

    for (int i = 1; i <= 3; ++i) {
        if ((A * B * i) % 2 == 1) {
            flag = 1;
            break;
        }
    }

    if (flag)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

Example test case(s):
input: 3 1

output: Yes
Language: C

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

int main() {
    double r;
    scanf("%lf", &r);
    printf("%lf %lf\n", r * r * M_PI, 2 * M_PI * r);
    return 0;
}

Example test case(s):
input: 2

output: 12.566371 12.566371
Language: C

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

int main(void) {
    char str[201], tmp[101];
    char p[101];
    int slen, plen;
    int i, j, flag;

    scanf("%s %s", str, p);

    strcpy(tmp, str);
    strcat(str, tmp);

    slen = strlen(str);
    plen = strlen(p);

    flag = 0;
    for (i = 0; i < slen - plen; i++) {
        if (strncmp(&str[i], p, plen) == 0) flag = 1;
    }

    if (flag)
        puts("Yes");
    else
        puts("No");

    return 0;
}

Example test case(s):
input: vanceknowledgetoad
advance

output: Yes
Language: C

#include <stdio.h>
#define N 1000000
#define Q 50000
int n, S[N], T[Q];

int binarySearch(int key) {
    int left = 0, right = n, mid;
    while (left < right) {
        mid = (left + right) / 2;
        if (S[mid] == key)
            return 1;
        else if (key < S[mid])
            right = mid;
        else
            left = mid + 1;
    }
    return 0;
}

int main() {
    int i, j, q, c = 0;

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

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &T[i]);
        if (binarySearch(T[i]) == 1) c++;
    }

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

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

void push(int);
int pop();

int top, kinbo[1000];

int main() {
    int chonda, yamagami;
    top = 0;
    char null[100];

    while (scanf("%s", null) != EOF) {
        if (null[0] == '+') {
            chonda = pop();
            yamagami = pop();
            push(chonda + yamagami);
        } else if (null[0] == '-') {
            yamagami = pop();
            chonda = pop();
            push(chonda - yamagami);
        } else if (null[0] == '*') {
            chonda = pop();
            yamagami = pop();
            push(chonda * yamagami);
        } else
            push(atoi(null));
    }

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

    return 0;
}

void push(int chonda) { kinbo[++top] = chonda; }

int pop() {
    top--;
    return kinbo[top + 1];
}

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

output: 3
Language: C

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

int main(int argc, char *argv[]) {
    char s[26];

    scanf("%s", s);

    for (int j = 0; j < strlen(s); j++) {
        for (int i = 0; i < strlen(s); i++) {
            if ((i != j) && (s[i] == s[j])) {
                puts("no");
                return 0;
            }
        }
    }

    puts("yes");

    return 0;
}

Example test case(s):
input: uncopyrightable

output: yes
Language: C

#include <stdio.h>

int main() {
    int x, a;
    scanf("%d %d", &x, &a);
    printf("%d\n", (x >= a) * 10);
    return 0;
}

Example test case(s):
input: 3 5

output: 0
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 100000

int Partition(char[], int[], int, int);
void Quicksort(char[], int[], int, int);

void Merge(char[], int[], int, int, int);
void Merge_Sort(char[], int[], int, int);

int q;

int main(void) {
    int A[MAX + 1];
    char C[MAX + 1];
    char MC[MAX + 1];
    int MN[MAX + 1];

    int i, p, n;
    int count = 0;

    scanf("%d", &n);

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

    for (i = 1; i <= n; i++) {
        MC[i] = C[i];
        MN[i] = A[i];
    }

    Merge_Sort(MC, MN, 1, n);

    p = 1;
    Quicksort(C, A, p, n);

    for (i = 1; i <= n; i++) {
        if (MN[i] == A[i] && MC[i] == C[i]) count++;
    }

    if (count == n)
        printf("Stable\n");

    else
        printf("Not stable\n");

    for (i = 1; i <= n; i++) printf("%c %d\n", C[i], A[i]);

    return 0;
}

int Partition(char C[], int A[], int p, int r) {
    int i, j;
    char tmpC, x;
    int tmpN, y;

    x = C[r];
    y = A[r];
    i = p - 1;

    for (j = p; j < r; j++) {
        if (A[j] <= y) {
            i = i + 1;
            tmpN = A[j];
            tmpC = C[j];
            A[j] = A[i];
            C[j] = C[i];
            A[i] = tmpN;
            C[i] = tmpC;
        }
    }

    tmpN = A[i + 1];
    tmpC = C[i + 1];
    A[i + 1] = A[r];
    C[i + 1] = C[r];
    A[r] = tmpN;
    C[r] = tmpC;

    return i + 1;
}

void Quicksort(char C[], int A[], int p, int r) {
    if (p < r) {
        q = Partition(C, A, p, r);
        Quicksort(C, A, p, q - 1);
        Quicksort(C, A, q + 1, r);
    }
}

void Merge(char MC[], int MN[], int left, int mid, int right) {
    int n1 = mid - left + 1;
    int n2 = right - mid;
    int LN[n1 + 1];
    int RN[n2 + 1];
    int LC[n1 + 1];
    int RC[n2 + 1];

    int i, j, k;

    for (i = 1; i <= n1; i++) {
        LN[i] = MN[left + i - 1];
        LC[i] = MC[left + i - 1];
    }

    for (i = 1; i <= n2; i++) {
        RN[i] = MN[mid + i];
        RC[i] = MC[mid + i];
    }

    LN[n1 + 1] = 1000000000;
    RN[n2 + 1] = 1000000000;

    i = 1;
    j = 1;

    for (k = left; k <= right; k++) {
        if (LN[i] <= RN[j]) {
            MN[k] = LN[i];
            MC[k] = LC[i++];
        } else {
            MN[k] = RN[j];
            MC[k] = RC[j++];
        }
    }
}

void Merge_Sort(char MC[], int MN[], int left, int right) {
    int mid;

    if (left < right) {
        mid = (left + right) / 2;
        Merge_Sort(MC, MN, left, mid);
        Merge_Sort(MC, MN, mid + 1, right);
        Merge(MC, MN, left, mid, right);
    }
}

Example test case(s):
input: 6
D 3
H 2
D 1
S 3
D 2
C 1

output: Not stable
D 1
C 1
D 2
H 2
D 3
S 3
Language: C

#include <stdio.h>

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

    int cnt4 = 0, cnt2 = 0;

    for (int i = 0; i < n; i++) {
        int wk;
        scanf("%d", &wk);
        if (wk % 4 == 0)
            cnt4++;
        else if (wk % 2 == 0)
            cnt2++;
    }

    if (cnt4 + cnt2 / 2 >= n / 2)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

Example test case(s):
input: 3
1 10 100

output: Yes
Language: C

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

#define N 100000
#define INF 1000000

typedef struct {
    int go, back, cost;
} Date;

int n, d[N];
Date a[500000];
void root(int);

int main() {
    int i, j, k, u, count = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d%d", &u, &k);
        for (j = 0; j < k; j++) {
            a[count].back = u;
            scanf("%d%d", &a[count].go, &a[count].cost);
            count++;
        }
    }
    root(count);
    for (i = 0; i < n; i++) printf("%d %d\n", i, d[i]);
    return 0;
}

void root(int b) {
    int i, flag = 1;

    for (i = 0; i < n; i++) d[i] = INF;
    d[0] = 0;

    while (flag != 0) {
        flag = 0;
        for (i = 0; i < b; i++) {
            if (a[i].cost + d[a[i].back] < d[a[i].go]) {
                d[a[i].go] = a[i].cost + d[a[i].back];
                flag = 1;
            }
        }
    }
}

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

output: 0 0
1 2
2 2
3 1
4 3
Language: C

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

#define INF 0x5fffffff
int a[100002];
int b[100002];

char buf[700002], *p;
int getint() {
    int n = 0;
    if (*p == '-') {
        p++;
        while (*p >= '0') n = (n << 3) + (n << 1) + (*p++ & 0xf);
        return -n;
    }
    while (*p >= '0') n = (n << 3) + (n << 1) + (*p++ & 0xf);
    return n;
}

int main() {
    int w, i, k, f, close, ans;

    fgets(p = buf, 10, stdin), w = getint();
    fgets(p = buf, sizeof(buf), stdin);
    for (ans = 0, f = 0, i = 1; i <= w; i++) {
        a[i] = k = getint(), p++;
        if (!k)
            f |= 1;
        else if (k < 0)
            f |= 2;
        else
            ans += k;
    }
    if (!ans || !(f & 1)) {
        puts("0");
        return 0;
    }
    if (!(f & 2)) {
        printf("%d\n", ans);
        return 0;
    }

    for (close = 0, f = 0, i = 1; i <= w; i++) {
        if (!a[i])
            close = INF, f = -1;
        else if (a[i] < 0) {
            if (f < 0 || close - (i - f) > -a[i]) close = -a[i], f = i;
        } else {
            if (f < 0)
                b[i] = INF;
            else {
                k = close - (i - f);
                if (k < 0) k = 0;
                b[i] = k;
            }
        }
    }

    for (close = 0, f = w, i = w; i >= 1; i--) {
        if (!a[i])
            close = INF, f = -1;
        else if (a[i] < 0) {
            if (f < 0 || close - (f - i) > -a[i]) close = -a[i], f = i;
        } else {
            if (f < 0)
                b[i] = INF;
            else {
                k = close - (f - i);
                if (k < 0) k = 0;
                if (k > b[i]) b[i] = k;
            }
        }
    }

    for (ans = 0, i = 1; i <= w; i++) {
        if (a[i] > 0) {
            if (b[i] > a[i])
                ans += a[i];
            else
                ans += b[i];
        }
    }
    printf("%d\n", ans);
    return 0;
}

Example test case(s):
input: 7
2 0 -2 3 2 -2 0

output: 4
Language: C

#include <stdio.h>
int main(void) {
    int A, B, C, D, E, max;
    scanf("%d %d", &A, &B);
    C = A + B;
    D = A - B;
    E = A * B;
    max = C;
    if (max < D) {
        max = D;
    }
    if (max < E) {
        max = E;
    }
    printf("%d\n", max);
    return 0;
}

Example test case(s):
input: -13 3

output: -10
Language: C

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

int main() {
    int i, j, k, n;

    scanf("%d", &n);

    printf("%d\n", 24 + (24 - n));

    return 0;
}

Example test case(s):
input: 21

output: 27
Language: C

#include <stdio.h>
int main() {
    char str[30];
    gets(str);
    str[5] = ' ';
    str[13] = ' ';
    printf("%s\n", str);
    return 0;
}

Example test case(s):
input: happy,newyear,enjoy

output: happy newyear enjoy
Language: C

#include <stdio.h>
int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    if (a == 1) a = 14;
    if (b == 1) b = 14;
    if (a < b)
        printf("Bob\n");
    else if (a > b)
        printf("Alice\n");
    else
        printf("Draw\n");
    return 0;
}

Example test case(s):
input: 8 6

output: Alice
Language: C

#include <stdio.h>
#define INF 100000
#define MAX 101
#define NIL -6
#define WHITE 0
#define GRAY 1
#define BLACK 2

int G[MAX][MAX];
int n;

void prim() {
    int i, j;
    int d[MAX];
    int pi[MAX];
    int color[MAX];
    int min, u, v, sum = 0;

    for (i = 0; i < n; i++) {
        d[i] = INF;
        pi[i] = NIL;
        color[i] = WHITE;
    }

    d[0] = 0;

    while (1) {
        min = INF;
        u = NIL;
        for (i = 0; i < n; i++) {
            if (color[i] != BLACK && d[i] < min) {
                min = d[i];
                u = i;
            }
        }
        if (u == NIL) {
            break;
        }
        color[u] = BLACK;
        for (v = 0; v < n; v++) {
            if (color[v] != BLACK && G[u][v] != INF) {
                if (d[v] > G[u][v]) {
                    d[v] = G[u][v];
                    pi[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }
    for (i = 0; i < n; i++) {
        if (pi[i] != NIL) sum += G[i][pi[i]];
    }
    printf("%d\n", sum);
}

int main() {
    int e;
    int i, j;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            scanf("%d", &e);
            if (e == -1) {
                G[i][j] = INF;
            } else {
                G[i][j] = e;
            }
        }
    }

    prim();
    return 0;
}

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

output: 5
Language: C

#include <stdio.h>

int main() {
    int a[10000], min, max, n, i;
    long long sum = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    max = min = a[0];
    for (i = 1; i < n; i++) {
        if (a[i] > max) max = a[i];
        if (a[i] < min) min = a[i];
    }
    printf("%d %d %lld\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>

long long heap[100000], sz = 0;
void push(int x) {
    int i = sz++;
    while (i > 0) {
        int p = (i - 1) / 2;
        if (heap[p] >= x) break;
        heap[i] = heap[p];
        i = p;
    }
    heap[i] = x;
}
int pop() {
    int ret = heap[0];
    int x = heap[--sz];
    int i = 0;
    while (i * 2 + 1 < sz) {
        int a = i * 2 + 1, b = i * 2 + 2;
        if (b < sz && heap[b] > heap[a]) a = b;
        if (heap[a] <= x) break;
        heap[i] = heap[a];
        i = a;
    }
    heap[i] = x;
    return ret;
}

int main() {
    int n, m, i, j;
    long long a[100000];
    scanf("%d%d", &n, &m);
    for (i = 0; i < n; i++) scanf("%lld", &a[i]);
    for (i = 0; i < n; i++) push(a[i]);
    for (i = 0; i < m; i++) {
        long long tm = pop();
        tm /= 2;
        push(tm);
    }
    long long ans = 0;
    for (i = 0; i < n; i++) ans += heap[i];
    printf("%lld\n", ans);
    return 0;
}

Example test case(s):
input: 3 3
2 13 8

output: 9
Language: C

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

int main(void) {
    int N, D, i, j, k = 0, n = 0;
    double l;
    int** matrix;
    scanf("%d%d", &N, &D);
    matrix = (int**)malloc(sizeof(int*) * N);
    for (i = 0; i < N; i++) {
        matrix[i] = (int*)malloc(sizeof(int) * D);
    }
    for (i = 0; i < N; i++) {
        for (j = 0; j < D; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }
    for (i = 0; i < N - 1; i++) {
        for (j = i + 1; j < N; j++) {
            int m = 0;
            for (n = 0; n < D; n++) {
                m = (matrix[i][n] - matrix[j][n]) *
                        (matrix[i][n] - matrix[j][n]) +
                    m;
            }
            l = sqrt(m);
            if (ceil(l) == floor(l)) k++;
        }
    }
    printf("%d\n", k);
    free(matrix);
    return 0;
}

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

output: 1
Language: C

#include <stdio.h>

int main(void) {
    int h, r;
    scanf("%d%d", &h, &r);
    if (r > -h) {
        printf("1\n");
    } else if (r == -h) {
        printf("0\n");
    } else {
        printf("-1\n");
    }
    return 0;
}

Example test case(s):
input: -3 3

output: 0
Language: C

#include <stdio.h>

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

    int i;
    long long sum = 0;
    long long wa = 0;
    int A[N];
    int sa[N];
    int ans;
    int shou;
    long long min = 1123456789;

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

    if (sum % wa)
        ans = 0;
    else {
        shou = sum / wa;
        for (i = 0; i < N; i++) {
            sa[i] = A[(i + 1) % N] - A[i] - shou;
        }

        for (i = 0; i < N - 1; i++) {
            if (sa[i] <= 0 && !(sa[i] % N))
                ans = 1;
            else {
                ans = 0;
                break;
            }
        }
    }

    if (ans)
        puts("YES");
    else {
        puts("NO");
    }

    return 0;
}

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

output: YES
Language: C

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

int main() {
    char **t, **h;
    int n, taro = 0, hanako = 0, i;
    scanf("%d", &n);
    t = malloc(n * sizeof(char *));
    h = malloc(n * sizeof(char *));
    for (i = 0; i < n; i++) {
        t[i] = malloc(100 * sizeof(char));
        h[i] = malloc(100 * sizeof(char));
        scanf("%s", t[i]);
        scanf("%s", h[i]);
        if (strcmp(t[i], h[i]) < 0) hanako += 3;
        if (strcmp(t[i], h[i]) > 0) taro += 3;
        if (strcmp(t[i], h[i]) == 0) {
            taro += 1;
            hanako += 1;
        }
        free(t[i]);
        free(h[i]);
    }
    printf("%d %d\n", taro, hanako);
    return 0;
}

Example test case(s):
input: 3
cat dog
fish fish
lion tiger

output: 1 7
Language: C

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

#define M 1046527
#define L 14

char H[M][L];

int getChar(char ch) {
    if (ch == 'A')
        return 1;
    else if (ch == 'C')
        return 2;
    else if (ch == 'G')
        return 3;
    else if (ch == 'T')
        return 4;
    return 0;
}

long long getKey(char str[]) {
    long long sum = 0, p = 1;
    int i;
    for (i = 0; i < (int)strlen(str); i++) {
        sum += p * (getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key) { return key % M; }
int h2(int key) { return 1 + (key % (M - 1)); }

int find(char str[]) {
    int i, hash, key;
    key = getKey(str);
    i = 0;
    while (1) {
        hash = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[hash], str) == 0)
            return 1;
        else if (strlen(H[hash]) == 0)
            return 0;
        i++;
    }
    return 0;
}

int insert(char str[]) {
    int i, hash, key;
    key = getKey(str);
    i = 0;
    while (1) {
        hash = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[hash], str) == 0)
            return 1;
        else if (strlen(H[hash]) == 0) {
            strcpy(H[hash], str);
            return 0;
        }
        i++;
    }
    return 0;
}

int main() {
    int i, n;
    char str[L], com[9];
    for (i = 0; i < M; i++) H[i][0] = '\0';

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%s %s", com, str);

        if (com[0] == 'i') {
            insert(str);
        } else {
            if (find(str)) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }

    return 0;
}

Example test case(s):
input: 5
insert A
insert T
insert C
find G
find A

output: no
yes
Language: C

#include <stdio.h>

int main()

{
    int a, b, s;

    scanf("%d %d", &a, &b);

    s = (a * b) - (a + b) + 1;

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

Example test case(s):
input: 2 2

output: 1
Language: C

#include <stdio.h>

int main(void) {
    int a, b, c, d;

    scanf("%d%d%d%d", &a, &b, &c, &d);

    if (a + b > c + d)
        printf("Left\n");
    else if (a + b < c + d)
        printf("Right\n");
    else
        printf("Balanced\n");

    return 0;
}

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

output: Left
Language: C

#include <stdio.h>

int main(void) {
    int a, b, n;
    scanf("%d %d", &a, &b);
    n = (a + b) / 2;
    printf("%d\n", n);
    return 0;
}

Example test case(s):
input: 1000 3000

output: 2000
Language: C

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

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

output: 7
Language: C

#include <stdio.h>
int main() {
    long long int a, b, c;
    scanf("%lld %lld %lld", &a, &b, &c);

    long long int d = c - a - b;
    if ((d > 0) && ((4 * a * b) < d * d))
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

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

output: No
Language: C

#include <stdio.h>

int main() {
    int a, b, c, d, e, f;
    double x, y;
    while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != -1) {
        y = (double)(c * d - f * a) / (b * d - e * a);
        x = (double)(c * e - f * b) / (a * e - d * b);
        if (y <= 0 && y > -0.0005) y = 0;
        if (x <= 0 && x > -0.0005) x = 0;
        printf("%.3f %.3f\n", x, y);
    }
    return 0;
}

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

output: -1.000 2.000
1.000 4.000