criyle/codenet-compile-errors huggingface dataset:
Language: Java

import javax.sound.midi.Soundbank;
import java.util.Scanner;

import static java.lang.System.out;
import static java.lang.System.setOut;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        //探索対象を取得
        int size = (scanner.nextInt());
        int [] S= new int[size];
        for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        }

        //探索する値を取得
        int ansSize = (scanner.nextInt());
        int[] T = new int[ansSize];
        for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        }

        double roopCount = 0;
        int count = 0;
        //探索用のアルゴリズム
        for (int i = 0; i < ansSize; i++) {
            int left = 0;
            int right = size-1;
            int mid = (int)(size-1)/2;
            while (S[left] < S[right]) {
                if (S[mid] > T[i]) {
                    right = mid;
                    mid = (int)(right+left)/2);
                }else if (S[mid]<T[i]){
                    left = mid;
                    mid = (int)(left+right)/2;
                }else if (T[i]==S[mid]) {
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    }
}


Compiler output:
Main.java:36: error: ';' expected
                    mid = (int)(right+left)/2);
                                             ^
1 error
Language: Java

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;

public class _BinarySearch {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int next() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextStr() {
            int c = next();
            while (isSpaceChar(c)) {
                c = next();
            }
            StringBuffer str = new StringBuffer();
            do {
                str.append((char) c);
                c = next();
            } while (!isSpaceChar(c));
            return str.toString();
        }

        public int nextInt() {
            int c = next();
            while (isSpaceChar(c))
                c = next();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = next();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = next();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String[] args) throws IOException {

        InputReader sc = new InputReader(System.in);
        int n1 = sc.nextInt();
        int sp1[] = new int[n1];
        for (int i = 0; i < n1; i++) {
            sp1[i] = sc.nextInt();
        }
        int n2 = sc.nextInt();
        int sp2[] = new int[n1];
        for (int i = 0; i < n2; i++) {
            sp2[i] = sc.nextInt();
        }
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (Arrays.binarySearch(sp1, sp2[j]) > 0) {
                sum++;
            }
        }
        System.out.println(sum);
    }
}


Compiler output:
Main.java:7: error: class _BinarySearch is public, should be declared in a file named _BinarySearch.java
public class _BinarySearch {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BinarySearchApp {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      int c=0;
      for (String s : line)
        seqS[c++] = Integer.parseInt(s);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  }

  static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    }

    return false;
  }
}


Compiler output:
Main.java:5: error: class BinarySearchApp is public, should be declared in a file named BinarySearchApp.java
public class BinarySearchApp {
       ^
1 error
Language: Java

import java.util.*;
class Main{
  public static void main(String args[])throws Exception{
    Scanner sc = new Scanner(System.in);
    int count = 0;
    int number = 0;
    static int n = sc.nextInt();
    static  int [] array_s = new int[n];
    for(int i =0; i<n; i++){
      array_s[i] = sc.nextInt();
    }

    int q = sc.nextInt();
    int t;
    for(int i = 0; i<q; i++){
      t = sc.nextInt();
      //二分探索
      count +=binarysearch(t, array_t);
    }
    System.out.println(count);
  }

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


Compiler output:
Main.java:7: error: illegal start of expression
    static int n = sc.nextInt();
    ^
Main.java:9: error: illegal start of type
    for(int i =0; i<n; i++){
    ^
Main.java:9: error: > or ',' expected
    for(int i =0; i<n; i++){
                     ^
Main.java:9: error: <identifier> expected
    for(int i =0; i<n; i++){
                        ^
Main.java:15: error: illegal start of type
    for(int i = 0; i<q; i++){
    ^
Main.java:15: error: > or ',' expected
    for(int i = 0; i<q; i++){
                      ^
Main.java:15: error: <identifier> expected
    for(int i = 0; i<q; i++){
                         ^
Main.java:20: error: <identifier> expected
    System.out.println(count);
                      ^
Main.java:20: error: <identifier> expected
    System.out.println(count);
                            ^
Main.java:23: error: unnamed classes are a preview feature and are disabled by default.
  static int binarysearch(int i , int a[]){
         ^
  (use --enable-preview to enable unnamed classes)
Main.java:35: error: class, interface, enum, or record expected
}
^
11 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;
public class　Main{
	
	static boolean search(int[] S,int a,int b,int target){
		if(a<=b){
			if(S[(a+b)/2]==target){
				return true;
			}else if(S[(a+b)/2]<target){
				return search(S,((a+b)/2)+1,b,target);
			}else{
				return search(S,a,((a+b)/2)-1,target);
			}
		}else{
			return false;
		}
	}
	
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int S[]=new int[n];
		for(int i=0;i<n;i++){
			S[i]=scan.nextInt();
		}
		Arrays.sort(S);
		int q=scan.nextInt();
		int count=0;
		int x;
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			if(search(S,0,n-1,x)){
				count++;
			}
		}
		System.out.println(count);
		scan.close();
	}

}

Compiler output:
Main.java:3: error: illegal character: '\u3000'
public class?Main{
            ^
1 error
Language: C

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

int main()
{
    int n,q,cnt =0;
    scanf("%d",&n);
    int *S = malloc(sizeof(int)*n);
    for(int i=0;i<n;i++) scanf("%d",&S[i]);
    scanf("%d",&q);
    int *T = malloc(sizeof(int)*q);
    ----
    for(int i=0;i<q;i++) scanf("%d",&T[i]);
    for(int i=0;i<q;i++)
    {
        for(int j=0;j<T[i];j++)
        {
            if(S[j]==T[i])
            {
                cnt ++;
                break;
            }
        }
    }
    printf("%d\n",cnt);
    free(T);
    free(S);
}


Compiler output:
main.c: In function 'main':
main.c:13:5: error: expected expression before 'for'
   13 |     for(int i=0;i<q;i++) scanf("%d",&T[i]);
      |     ^~~
Language: C

#include<stdio.h>

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



 int main(){
       int i,n,q,S[100001],T,cnt=0;
       scanf("%d",&n);
       for(i=0;i<n;i++){
                 scanf("%d",&S[i]);
                 }
       scanf("%d",&q);
       for(i=0;i<q;i++){
                 if(binary(n,S,T))cnt++;
                 }
       printf("%d\n",cnt);
       return 0;
       }



Compiler output:
main.c: In function 'binary':
main.c:5:25: error: expected ';' before 'while'
    5 |           left=0;right=n
      |                         ^
      |                         ;
    6 |           while(left<right){
      |           ~~~~~          
main.c:30:8: error: expected declaration or statement at end of input
   30 |        }
      |        ^
Language: C

#include<stdio.h>

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



 int main(){
       int i,n,q,S[100001],T,cnt=0;
       scanf("%d",&n);
       for(i=0;i<n;i++){
                 scanf("%d",&S[i]);
                 }
       scanf("%d",&q);
       for(i=0;i<q;i++){
                 if(binary(n,S,T))cnt++;
                 }
       printf("%d\n",cnt);
       return 0;
       }



Compiler output:
main.c: In function 'binary':
main.c:30:8: error: expected declaration or statement at end of input
   30 |        }
      |        ^
Language: C

#include<stdio.h>

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


  }
  return 0;


}

int main(){
  int i,n,q,key,sum=0;
  int a[100000];
  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( binarySearch(a,key)) sum++;
  }
  printf("%d\n",sum);

  return 0;
}



Compiler output:
main.c: In function 'binarySearch':
main.c:4:3: error: 'left' undeclared (first use in this function)
    4 |   left = 0;
      |   ^~~~
main.c:4:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:3: error: 'right' undeclared (first use in this function)
    5 |   right = n;
      |   ^~~~~
main.c:5:11: error: 'n' undeclared (first use in this function)
    5 |   right = n;
      |           ^
main.c:7:5: error: 'mid' undeclared (first use in this function)
    7 |     mid =(leht+right)/2;
      |     ^~~
main.c:7:11: error: 'leht' undeclared (first use in this function)
    7 |     mid =(leht+right)/2;
      |           ^~~~
main.c:9:12: error: returning 'int *' from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion]
    9 |     return a;
      |            ^
main.c: In function 'main':
main.c:26:18: error: expected ';' before ')' token
   26 |   for(i=0;i<n,i++){
      |                  ^
      |                  ;
Language: C

#include<stdio.h>

int binarySearch(int,int [],int);

int A[1000000],n;

int main(){
  int i,q,k,sum = 0;

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

  scanf("%d",&q);
  for(i = 0;i < q;i++){
    scanf("%d",&k);
    if(binarySearch(k))
      sum++;
  }
  printf("%d\n",sum);

  return 0;
}

int binarySearch(int n,int A[],int key){
  int left = 0;
  int right = 0;
  int mid;

  while(left < right){
    mid = (left + right) / 2;
    if(key == A[mid])
      return 1;
    else if(key > A[mid])
      left = mid + 1;
    else if(key < A[mid])
      right = mid;
  }
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:18:8: error: too few arguments to function 'binarySearch'
   18 |     if(binarySearch(k))
      |        ^~~~~~~~~~~~
main.c:3:5: note: declared here
    3 | int binarySearch(int,int [],int);
      |     ^~~~~~~~~~~~
Language: C

#include <stdio.h>

#define MAXS 10000
#define MAXT 500

int search(int *A, int n, int key);

int main(){

  int i,j,k,n,q;

  int cnt=0;

  scanf("%d",&n);

  int S[n];

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

  }

  scanf("%d", &q);

  int T[q];

  for(i=0;i<q;i++){

    scanf("%d", &T[i]);

  }

  /* 

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

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

  }

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

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

  }

  printf("\n", n);

  */

  for(i=0; i<q; i++){

    if(search(S, n, T[i])){

      cnt++;

    }

  }
			     
  printf("%d\n",cnt);
  
  return 0;
  
}

int search(int *A, int n, int key){

  int left=0;

  int right=n;

  while(left<right){

    if(A[n/2]==key) return mid;
    else if(key<A[n/2]) right=n/2;
    else left=n/2+1;

  }

}



Compiler output:
main.c: In function 'search':
main.c:83:28: error: 'mid' undeclared (first use in this function)
   83 |     if(A[n/2]==key) return mid;
      |                            ^~~
main.c:83:28: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int s[10000], n;

int binary(int);
int main()
{
    int i, k, q, sum = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &s[i]);
    scanf("%d", &q);
    scanf("%d", &q);
    for (i = 0; i < q; i++)
    {
        scanf("%d", &k);
        if (binary(k))
            sum++;
    }
    printf("%d\n", sum);
    return 0;
}
int binary(int k)
{
    int left = 0, right = n, mid;
    while (left < right)
    {
        mid = (left + right) / 2;
        if (k == s[mid])
            return 1;
        if (k > s[mid])
            left = mid + 1;
        else if (key < s[mid])
            right = mid;
    }
    return 0;
}


Compiler output:
main.c: In function 'binary':
main.c:33:18: error: 'key' undeclared (first use in this function)
   33 |         else if (key < s[mid])
      |                  ^~~
main.c:33:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int numS,S[100000];

int bsearch(int T);

int main(void)
{
  int i;
  int numT,T;
  int count=0;

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

  scanf("%d",&numT;
  
  for(i=0;i<numT;i++)
    {
      scanf("%d",&T);
    
      if(bsearch(T)==1)
	{
	  count++;
	}
    }
  
  printf("%d\n",count);

  return 0;
}

int bsearch(int T)
{
  int L=0,R=numS-1,M;

  while(L<=R)
    {
      M=(L+R)/2;
    
      if(T>S[M])
	{
	  L=M+1;
	}
      else if(T<S[M])
	{
	  R=M-1;
	}
      else
	{
	  return 1;
	}
    }   
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:20:19: error: expected ')' before ';' token
   20 |   scanf("%d",&numT;
      |        ~          ^
      |                   )
main.c:34:12: error: expected ';' before '}' token
   34 |   return 0;
      |            ^
      |            ;
   35 | }
      | ~
Language: C

#include <stdio.h>

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

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

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

  for(i=0;i<q;i++){
    if(binarySearch(n,S,T[i]) != -1){
      count++;
    }
  }

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

  return 0;
    
}



Compiler output:
main.c: In function 'binarySearch':
main.c:5:3: error: 'left' undeclared (first use in this function)
    5 |   left = 0;
      |   ^~~~
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:3: error: 'right' undeclared (first use in this function)
    6 |   right = n;
      |   ^~~~~
main.c:8:5: error: 'mid' undeclared (first use in this function)
    8 |     mid = (left + right)/2;
      |     ^~~
main.c: In function 'main':
main.c:29:7: error: 'i' undeclared (first use in this function)
   29 |   for(i=0;i<n;i++){
      |       ^
main.c:40:23: error: passing argument 2 of 'binarySearch' makes integer from pointer without a cast [-Wint-conversion]
   40 |     if(binarySearch(n,S,T[i]) != -1){
      |                       ^
      |                       |
      |                       int *
main.c:3:28: note: expected 'int' but argument is of type 'int *'
    3 | int binarySearch(int n,int A,int key)
      |                        ~~~~^
Language: C

#include <stdio.h>

int binarySearch(int,int,int);

int main()
{
  
  int count, n, q;

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

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

  for(i=0;i<q;i++){
    if(binarySearch(n,S,T[i]) != -1){
      count++;
    }
  }

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

  return 0;
    
}

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



Compiler output:
main.c: In function 'main':
main.c:14:7: error: 'i' undeclared (first use in this function)
   14 |   for(i=0;i<n;i++){
      |       ^
main.c:14:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:23: error: passing argument 2 of 'binarySearch' makes integer from pointer without a cast [-Wint-conversion]
   25 |     if(binarySearch(n,S,T[i]) != -1){
      |                       ^
      |                       |
      |                       int *
main.c:3:22: note: expected 'int' but argument is of type 'int *'
    3 | int binarySearch(int,int,int);
      |                      ^~~
main.c: In function 'binarySearch':
main.c:38:3: error: 'left' undeclared (first use in this function)
   38 |   left = 0;
      |   ^~~~
main.c:39:3: error: 'right' undeclared (first use in this function)
   39 |   right = n;
      |   ^~~~~
main.c:41:5: error: 'mid' undeclared (first use in this function)
   41 |     mid = (left + right)/2;
      |     ^~~
Language: C

#include <stdio.h>

int binarySearch(int,int,int);

int main()
{
  
  int count, n, q;

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

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

  for(i=0;i<q;i++){
    if(binarySearch(n,S,T[i]) != -1){
      count++;
    }
  }

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

  return 0;
    
}

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



Compiler output:
main.c: In function 'main':
main.c:14:7: error: 'i' undeclared (first use in this function)
   14 |   for(i=0;i<n;i++){
      |       ^
main.c:14:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:23: error: passing argument 2 of 'binarySearch' makes integer from pointer without a cast [-Wint-conversion]
   25 |     if(binarySearch(n,S,T[i]) != -1){
      |                       ^
      |                       |
      |                       int *
main.c:3:22: note: expected 'int' but argument is of type 'int *'
    3 | int binarySearch(int,int,int);
      |                      ^~~
main.c: In function 'binarySearch':
main.c:45:17: error: subscripted value is neither array nor pointer nor vector
   45 |     if( key == A[mid]){
      |                 ^
main.c:48:16: error: subscripted value is neither array nor pointer nor vector
   48 |     if( key > A[mid]){
      |                ^
main.c:51:21: error: subscripted value is neither array nor pointer nor vector
   51 |     else if( key < A[mid]){
      |                     ^
Language: C

#include <stdio.h>

int s[100000];
int t[50000];
int n = 0;
int search(int);

int main(){
    int i, q, count = 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]);
    for(i=0;i<q;i++)
        if(search(t[i]))
            count++;
    printf("%d\n", count);
    return 0;
    }
}

int search(int key){
    int l=0;
    int r=n;
    int m;
    while(l<r){
        m = (l+r)/2;
        if(s[m]==key)
            return 1;
        else if(key > s[m])
            l = m+1;
        else
            r=m;
    }
    return 0;
}



Compiler output:
main.c:22:1: error: expected identifier or '(' before '}' token
   22 | }
      | ^
Language: C

#include <stdio.h>
#include<string.h>
struct uu
{  int a[1000];
   int n;
};
void dele(int a[],int n)
{  int  k,j,i;
   uu t;
   for(k=i=1;i<n;i++)	
   {  for(j=0;j<k;j++)		          
      {  if(a[j]==a[i])  
	     break;			//思路：如果没有重复,a[i]的值递给a[k],如果a[i]与前面相比有重复，则用break，使a[i]的值不给a[k]; 
	  }		
	  if(j==k)   
	  a[k++]=a[i];
   }	
}
int binarysearch(int a[],int key,int n)
{  int left=0,right=n,mid;
   while(left<right)
   {  mid=(left+right)/2;
      if(a[mid]==key)  return mid;
      else if(key<a[mid])  right=mid;
      else left=mid;
   }
   return -2;
}
int main()
{  int a[10000],b[10000];
   int i,n,t,k,m;
   m=0;
   scanf("%d",&n);
   for(i=0;i<n;i++)
     scanf("%d",&a[i]);
   dele(a,n);
   scanf("%d",&t);
   for(i=0;i<t;i++)
     scanf("%d",&b[i]);
   for(i=0;i<t;i++)
     if(binarysearch(a,b[i],n)!=-2)  m++;
   printf("%d\n",m);
}



Compiler output:
main.c: In function 'dele':
main.c:9:4: error: unknown type name 'uu'; use 'struct' keyword to refer to the type
    9 |    uu t;
      |    ^~
      |    struct
Language: C

#include <stdio.h>
#include<string.h>
struct uu
{  int a[1000];
   int n;
};
void dele(int a[],int n)
{  int  k,j,i;
   uu t;
   for(k=i=1;i<n;i++)	
   {  for(j=0;j<k;j++)		          
      {  if(a[j]==a[i])  
	     break;			//思路：如果没有重复,a[i]的值递给a[k],如果a[i]与前面相比有重复，则用break，使a[i]的值不给a[k]; 
	  }		
	  if(j==k)   
	  a[k++]=a[i];
   }	
}
int binarysearch(int a[],int key,int n)
{  int left=0,right=n,mid;
   while(left<right)
   {  mid=(left+right)/2;
      if(a[mid]==key)  return mid;
      else if(key<a[mid])  right=mid;
      else left=mid+1;
   }
   return -2;
}
int main()
{  int a[10000],b[10000];
   int i,n,t,k,m;
   m=0;
   scanf("%d",&n);
   for(i=0;i<n;i++)
     scanf("%d",&a[i]);
   //dele(a,n);
   scanf("%d",&t);
   for(i=0;i<t;i++)
     scanf("%d",&b[i]);
   for(i=0;i<t;i++)
     if(binarysearch(a,b[i],n)!=-2)  m++;
   printf("%d\n",m);
   return 0;
}
/*有3个数字位置是 0 1 2
第一次查找
mid = (0 + 2) / 2 = 1，比较1的位置
第二次比较,如果取mid,而不是mid-1 +1的话
mid = (0 +1 ) / 2 = 0, 比较0的位置
mid = (0+2) / 2 = 1，比较1的位置，1已经比较过了，所以不对
*/ 



Compiler output:
main.c: In function 'dele':
main.c:9:4: error: unknown type name 'uu'; use 'struct' keyword to refer to the type
    9 |    uu t;
      |    ^~
      |    struct
Language: C

#include <stdio.h>

int binary_search(int s[], int n, int key) {
  int left = 0;
  int right = n;
  while(left < right) {
    mid = (left + right) / 2;
    if (s[mid] == key) {
      return 1;
    }
    else if (s[mid] > key) {
      right = mid;
    }
    else if (s[mid] < key) {
      left = mid + 1;
    }
  }
  return 0;
}
  
int main(void) {
  int n ,q;
  int s[10001];
  int t[50000];
  int i;
  int count = 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]);
  
  for (i = 0; i < q; i++) {
    count += binary_search(s, n, t[i]);
  }
  
  printf("%d\n", count);
    
  return 0;
}



Compiler output:
main.c: In function 'binary_search':
main.c:7:5: error: 'mid' undeclared (first use in this function)
    7 |     mid = (left + right) / 2;
      |     ^~~
main.c:7:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

int main(int argc, char *argv[])
{
  int n, q, i, j;
  int *S, *T;
  int found;
  int st, ed;

  scanf("%d", &n);
  S = (int *)malloc(sizeof(int) * n);
  for (i = 0; i < n; i++) scanf("%d", &S[i]);

  scanf("%d", &q);
  T = (int *)malloc(sizeof(int) * q);
  for (i = 0; i < q; i++) scanf("%d", &T[i]);

  found = 0;
  for (i = 0; i < q; i++) {
    st = 0;
    ed = n - 1;
    while (1) {
      center = st + (ed-st)/2;
      if (ed - st < 20) break;
      if (S[center] > T[i]) ed = center;
      else if (S[center] < T[i]) st = center;
      else break;
    }
    for (j = st; j <= ed; j++) {
      if (S[j] == T[i]) {
	found++;
	break;
      }
    }
  }

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

  free(S);
  free(T);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:24:7: error: 'center' undeclared (first use in this function)
   24 |       center = st + (ed-st)/2;
      |       ^~~~~~
main.c:24:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<iostream>
using namespace std;

int main(){
    int n,q;
    cin >> n;
    int S[n];
    for ( int i = 0;i < n;i++)cin >> S[i];
    cin >> q;
    int T[q];
    for ( int i = 0;i < q;i++)cin >> T[i];
    
    int x = 0;
    int mid;
    int left = 0;
    int right = n;
    for ( int j = 0;j<q;j++){
        left = 0;
        right = n;
        while(left<right){
        mid = (left+right) / 2;
            if (S[mid]==T[j]){
                x++;
                break;
            }else if(T[j] < S[mid]){
                right = mid;
            }else if(T[j] > S[mid]){
                left = mid;
            }
        }
    }
    cout << x << endl;
    
    
    return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
   
#define MAXLEN 100000
    
     
int main( void ) 
{
    int n,q;
    int S[MAXLEN+1],T[MAXLEN+1];
    int i;
    int cnt;
    int lo,hi,m;
       
    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] ); 
    }
    
    cnt=0;
    for( i=0; i<q; i++ ) {
		lo=0;
		hi=n;
		while( lo <= hi ) {
			m=(lo+hi)/2; 
            if( T[i] == S[m] ) {
                cnt++;
                break;
            } else if( T[i] < S[m] ) {
            	hi=m-1;d    	
            } else {
            	lo=m+1;        	
            }
        }
    }
 
    if( cnt ) {
        printf( "%d\n", cnt );
    } else {
        printf( "0\n" );
    }
   
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:34:24: error: 'd' undeclared (first use in this function)
   34 |                 hi=m-1;d
      |                        ^
main.c:34:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:34:25: error: expected ';' before '}' token
   34 |                 hi=m-1;d
      |                         ^
      |                         ;
   35 |             } else {
      |             ~
Language: C

#include <stdio.h>

int main(){
  int S[100000], count = 0, s, t, t0, i, j;
  scanf("%d",&s);
  for(i = 0; i < s; i++) scanf("%d",&S[i]);
  scanf("%d",&t);
  for(i = 0; i < t; i++){
    scanf("%d",&t0);
    while(s > 0){
      if(S[s/2] == t0){
	count++;
	break;
      }
      else if(S[s/2] > t0){
	s = s/2;
      }
      else if(S[s/2] < t0){
	s = s*3/4
      }
    }
  }
  printf("%d\n",count);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:18: error: expected ';' before '}' token
   19 |         s = s*3/4
      |                  ^
      |                  ;
   20 |       }
      |       ~
Language: C

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

main()
{

	int n, q;
	int *s, *t;
	int c=0;
	
	int i, j, k;


	scanf("%d", &n);
	s = (int *)malloc( sizeof(int) *n );
	for( i=0; i<n; i++) {
		scanf("%d", &s[i]);
	}
	
	
	scanf("%d", &q);
	t = (int *)malloc( sizeof(int) *q );
		for( i=0; i<q; i++) {
		scanf("%d", &t[i]);
	}
	

Compiler output:
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main()
      | ^~~~
main.c: In function 'main':
main.c:25:9: error: expected declaration or statement at end of input
   25 |         }
      |         ^
Language: C

#include <stdio.h>

int main(){
  int i, j, k, n, q, S[100000], T[100000];
  k = 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]);

  for(i = 0; i < q; i++){
    for(j = 0; j < n; j++){
      if(T[i] == S[j]){
	printf("%d", T[i]);
	else k++;
	break;
      }
    }
  }
  if(k == q) printf("0");
  printf("%d\n", k);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:9: error: expected '}' before 'else'
   17 |         else k++;
      |         ^~~~
main.c: At top level:
main.c:22:3: error: expected identifier or '(' before 'if'
   22 |   if(k == q) printf("0");
      |   ^~
main.c:23:10: error: expected declaration specifiers or '...' before string constant
   23 |   printf("%d\n", k);
      |          ^~~~~~
main.c:23:18: error: unknown type name 'k'
   23 |   printf("%d\n", k);
      |                  ^
main.c:25:3: error: expected identifier or '(' before 'return'
   25 |   return 0;
      |   ^~~~~~
main.c:26:1: error: expected identifier or '(' before '}' token
   26 | }
      | ^
Language: C

#include <stdio.h>

int main(){
  int i, j, k, n, q, S[100000], T[100000];
  k = 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]);

  for(i = 0; i< q; i++){
    l = 0;
    r = n;
    while(l < r){
      m = (l + r)/2;
      if(T[i] == S[m]) k++;
      else if(T[i] < S[m]) r = m;
      else if(T[i] > S[m]) l = m + 1;
    }  
  }
  printf("%d\n", k);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:5: error: 'l' undeclared (first use in this function)
   14 |     l = 0;
      |     ^
main.c:14:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:5: error: 'r' undeclared (first use in this function)
   15 |     r = n;
      |     ^
main.c:17:7: error: 'm' undeclared (first use in this function)
   17 |       m = (l + r)/2;
      |       ^
Language: C

#include<stdio.h>
 
int S[1000000];
int T[1000000];
int Sc;
int Tc;
int c;
int i,j;
 
int binarySearch(int);
int main(){
 
 
  scanf("%d",&Scount);
 
  for(c = 0 ; c < Sc ; c++){
    scanf("%d",&S[c]);
  }
 
  scanf("%d",&Tc);
 
  for(c = 0 ; c < Tc ; c++){
    scanf("%d",&T[c]);
  }
  c = 0;
 
  for(i = 0 ; i < Tc ; i++){
  if(binarySearch(T[i]) == 1)c++;
  }
 
  printf("%d\n",c);
  return 0;
}
 
int binarySearch(int key){
  int left;
  int right;
  int mid;
 
  left = 0;
  right = Sc;
  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;
}

Compiler output:
main.c: In function 'main':
main.c:14:15: error: 'Scount' undeclared (first use in this function)
   14 |   scanf("%d",&Scount);
      |               ^~~~~~
main.c:14:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C

include<stdio.h>
int main(){
  int n1,n2,S[10000],T[100000];
  int i,count=0;
  int left,right,mid;
  scanf("%d",&n1);
  for(i=0;i<n1;i++){
    scanf("%d",&S[i]);

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

  for(i=0;i<n2;i++){
    left = 0;
    right = n1;
  while(left < right){

      mid = (left + right)/2;
      if(S[mid] == T[i]) {count++;break;}
      else if(T[i] < S[mid]){right=mid;}
      else {left = (mid+1);}

    }

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

}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C

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

#define N 100000
#define Q 50000
int n,S[N];
int binarySearch(int)
main(){
  int i,T[Q],s,q;
 
  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[q]);
  right = n;
  for(i=0;i<q;i++){
   s+= binarySearch(T[i]);
}
  printf("%d\n",s);
  return 0;
}
 
int binarySearch(int key){
  int left=0,right=n,mid;

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

Compiler output:
main.c: In function 'binarySearch':
main.c:8:1: error: expected declaration specifiers before 'main'
    8 | main(){
      | ^~~~
main.c:23:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   23 | int binarySearch(int key){
      |                          ^
main.c:34: error: expected '{' at end of input
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 100000
#define Q 50000

int main(){

  int i, n, q, cnt = 0;
  int mid, right, left;
  int s[N], t[Q];
 
  scanf("%d", &n);
  for(i = 0; i < n; i++) scanf("%d", &s[i]);
 
  scanf("%d", &q);
  for(i = 0; i < n; i++) scanf("%d", &t[i]);
  
  for(i = 0; i < q; i++){
    right = n;
    left = 0;
 
    while(left <= right){
      mid = (right + left) / 2;
      if(s[mid] == t[i]) {
	cnt++;
	break;
      }
      else if(s[mid] < t[i]) left = mid + 1;
      else if(s[mid] > t[i]) right = mid - 1;
    }
  }

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

Compiler output:
main.c: In function 'main':
main.c:34:18: error: 'count' undeclared (first use in this function); did you mean 'cnt'?
   34 |   printf("%d\n", count);
      |                  ^~~~~
      |                  cnt
main.c:34:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C


  int i,n,q,a,b,x;
  
  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]);
    }
    
    
    for( i=0 ; i<q ; i++ ){
      a=0;
      b=n;
      while( a < b ){
	x=( a + b )/2;
	if(s[x] == t[i]){
	  c++;
	break;
	}
	else if(t[i] > s[x])
	  a = x + 1;
	else if(t[i] < s[x])
	  a=b;
      }
    }
    
    printf("%d\n",c);
    return 0;
}

Compiler output:
main.c:4:9: error: expected declaration specifiers or '...' before string constant
    4 |   scanf("%d",&n);
      |         ^~~~
main.c:4:14: error: expected declaration specifiers or '...' before '&' token
    4 |   scanf("%d",&n);
      |              ^
main.c:5:3: error: expected identifier or '(' before 'for'
    5 |   for( i=0 ; i<n ; i++){
      |   ^~~
main.c:5:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    5 |   for( i=0 ; i<n ; i++){
      |               ^
main.c:5:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    5 |   for( i=0 ; i<n ; i++){
      |                     ^~
main.c:9:8: error: expected declaration specifiers or '...' before string constant
    9 |  scanf("%d",&q);
      |        ^~~~
main.c:9:13: error: expected declaration specifiers or '...' before '&' token
    9 |  scanf("%d",&q);
      |             ^
main.c:10:3: error: expected identifier or '(' before 'for'
   10 |   for( i=0 ; i<q ; i++){
      |   ^~~
main.c:10:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   10 |   for( i=0 ; i<q ; i++){
      |               ^
main.c:10:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   10 |   for( i=0 ; i<q ; i++){
      |                     ^~
main.c:15:5: error: expected identifier or '(' before 'for'
   15 |     for( i=0 ; i<q ; i++ ){
      |     ^~~
main.c:15:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   15 |     for( i=0 ; i<q ; i++ ){
      |                 ^
main.c:15:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   15 |     for( i=0 ; i<q ; i++ ){
      |                       ^~
main.c:31:12: error: expected declaration specifiers or '...' before string constant
   31 |     printf("%d\n",c);
      |            ^~~~~~
main.c:31:19: error: unknown type name 'c'
   31 |     printf("%d\n",c);
      |                   ^
main.c:32:5: error: expected identifier or '(' before 'return'
   32 |     return 0;
      |     ^~~~~~
main.c:33:1: error: expected identifier or '(' before '}' token
   33 | }
      | ^
Language: C

#include <stdio.h>
#define N 10000000000
#define Q 50000

int a[N], b[N];

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

  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf("%d", &a[i]);
  }
  scanf("%d", &q);
  for(i = 0;i < q;i++){
    scanf("%d", &b[i]);
  }
  for(i = 0;i < q;i++){
    for(j = 0;j < n;j++){
      if(b[i] == a[j]){
	count++;
	break;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}

Compiler output:
/tmp/ccc8bQ3z.o: in function `main':
main.c:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccc8bQ3z.o
main.c:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccc8bQ3z.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
 
int main(){
  int S[1000], count = 0, s, t, x, i, j, left, right, mid;

  scanf("%d",&s);
  　for(i = 0; i < s; i++){
     scanf("%d",&S[i]);
    }
  scanf("%d",&t);
 
  for(i = 0; i < t; i++){
    left = 0;
    right = s;
     
    scanf("%d",&x);
    while(left < right){
      mid = (right + left)/2;
      if(S[mid] == x){
    count++;
    break;
      }
      else if(S[mid] > x){
    right = mid;
      }
      else if(S[mid] < x){
        left = mid + 1;
      }
    }
  }
  printf("%d\n",count);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:3: error: stray '\343' in program
    7 |   <U+3000>for(i = 0; i < s; i++){
      |   ^~~~~~~~
Language: C

#include<stdio.h>
int main(void){
	int n,s[100],q,t[100],c=0,i,j;
	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]);
		for(j=0;j<n;j++){
		
			if(s[j]==t[i]){
				for(z=0;z<n;z++){
					if(s[z]==s[j]){
						s[z]=-1;
					}
				c++;
				s[j]=-1;
				break;
			}
		}
	}
	
	printf("%d\n",c);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:37: error: 'z' undeclared (first use in this function)
   14 |                                 for(z=0;z<n;z++){
      |                                     ^
main.c:14:37: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:1: error: expected declaration or statement at end of input
   27 | }
      | ^
Language: C

#include<stdio.h>
int main(void){
	int n,s[100],q,t[100],c=0,i,j,z;
	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]);
		for(j=0;j<n;j++){
		
			if(s[j]==t[i]){
				for(z=0;z<n;z++){
					if(s[z]==s[j]){
						s[z]=-1;
					}
				c++;
				s[j]=-1;
				break;
			}
		}
	}
	
	printf("%d\n",c);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:27:1: error: expected declaration or statement at end of input
   27 | }
      | ^
Language: C

#include<iostream>
#include<algorithm>
using namespace std;
int C,*S,*T;
int main(void)
{
	int n,q,i,j,right,left,mid;
	cin >> n;
	S = new int[n];
	for(i=0;i<n;i++){
		cin >> S[i];
	}
	cin >> q;
	T = new int[q];
	for(i=0;i<q;i++){
		cin >> T[i];
	}

	for(i=0;i<q;i++){
		left = 0;
		right = n;
		while(left < right){
			mid = (left+right)/2;
			if(T[i] == S[mid]){
				C++;
				break;
			}
			else if(T[i] > S[mid])
				right = mid;
			else
				left = mid + 1;
		}
	}
	cout << C << endl;
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#define N 50000

int a[N],n1,n2,number,count=0;

int searchNumber(int);

int searchNumber(int x){
  int left,right,mid;

  /*for(i=0;i<n1;i++){
    if( a[i] == x ) return a[i];
  }
  return -1;*/

  left =0;
  right =0;
  while(left < right ){
    mid = ( left + right ) / 2;
    if( A[mid] == x ) return a[mid];
    else if ( key< A[mid] ) right =a[mid];
    else left = mid + 1;
  }
  return -1;
}

int main(){

  int i,j;
  int b[500];
  scanf("%d",&n1);
  for(i=0;i<n1;i++){
    scanf("%d",&a[i]);
  }

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

  for(i=0;i<n2;i++){
    number = searchNumber(b[i]);
    if( number != -1 ) count++;
  }
  printf("%d\n",count);
  return 0;
}

Compiler output:
main.c: In function 'searchNumber':
main.c:20:9: error: 'A' undeclared (first use in this function)
   20 |     if( A[mid] == x ) return a[mid];
      |         ^
main.c:20:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:21:15: error: 'key' undeclared (first use in this function)
   21 |     else if ( key< A[mid] ) right =a[mid];
      |               ^~~
Language: C

#include <stdio.h>

int A[10000];
int n;

int binarySearch(int key)
{
  int left = 0;
  int right = n;
  while (left < right){
    int mid = (left + right) / 2;
    if (A[mid] == key)
      {
	return mid;
      }
    ielse f (key < A[mid])
      {
	right = mid;
      }
    else if (key > A[mid])
      {
	left = mid + 1;
      }
  }
  return 0;
}
      
  int main ()
  {

  int i,n2,keyword,judge=0;

  scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d",&A[i]);
    }
  
    scanf("%d",&n2);
      for(i=0;i<n2;i++){
	scanf("%d",&keyword);
      
     
    if(binarySearch(keyword))
      {
	judge++;
      }
      }
    printf("%d\n",judge);
    return 0;
}

Compiler output:
main.c: In function 'binarySearch':
main.c:16:5: error: unknown type name 'ielse'
   16 |     ielse f (key < A[mid])
      |     ^~~~~
main.c:16:17: error: expected ')' before '<' token
   16 |     ielse f (key < A[mid])
      |                 ^~
      |                 )
main.c:20:5: error: 'else' without a previous 'if'
   20 |     else if (key > A[mid])
      |     ^~~~
Language: C

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

#define M /* your task*/
#define L 14

char H[M][L]; /* Hash Table */

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;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return /* your task */; }
int h2(int key){ return /* your task */; }

int find(char str[]){

    /* your task */

}

int insert(char str[]){

    /* your task */

}

int main(){
    int i, n, h;
    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;
}

Compiler output:
main.c: In function 'h1':
main.c:26:18: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   26 | int h1(int key){ return /* your task */; }
      |                  ^~~~~~
main.c:26:5: note: declared here
   26 | int h1(int key){ return /* your task */; }
      |     ^~
main.c: In function 'h2':
main.c:27:18: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   27 | int h2(int key){ return /* your task */; }
      |                  ^~~~~~
main.c:27:5: note: declared here
   27 | int h2(int key){ return /* your task */; }
      |     ^~
main.c: In function 'main':
main.c:44:23: error: expected expression before ';' token
   44 |     for ( i = 0; i < M; i++ ) H[i][0] = '\0';
      |                       ^
main.c: At top level:
main.c:7:6: warning: array 'H' assumed to have one element
    7 | char H[M][L]; /* Hash Table */
      |      ^
Language: C


#include<stdio.h>

int search(int);

int  S[10000], q, key, count=0,i,n,mid;
int main(){

 

  scanf("%d", &n);

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

  scanf("%d", &q);

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


  return 0;
}
int search(int key){
  int left =0;
  int right = n;

  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;

Compiler output:
main.c: In function 'search':
main.c:43:3: error: expected declaration or statement at end of input
   43 |   return 0;
      |   ^~~~~~
Language: C

#include<stdio.h>

int search(int);

int  S[100000000000000000000000000000000], q, key, count=0,i,n,mid;
int main(){

 

  scanf("%d", &n);

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

  scanf("%d", &q);

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


  return 0;
}
int search(int key){
  int left =0;
  int right = n;

  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;
}

Compiler output:
main.c:5:8: warning: integer constant is too large for its type
    5 | int  S[100000000000000000000000000000000], q, key, count=0,i,n,mid;
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:5:6: error: size of array 'S' is too large
    5 | int  S[100000000000000000000000000000000], q, key, count=0,i,n,mid;
      |      ^