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

#include<stdio.h>

int search(int);

int  S[1000000000], 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:
/tmp/ccEi0kk8.o: in function `main':
main.c:(.text+0x7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0x24): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0x70): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `q' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0x9e): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0xab): relocation truncated to fit: R_X86_64_PC32 against symbol `key' defined in .bss section in /tmp/ccEi0kk8.o
main.c:(.text+0xc8): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#define N 10000
#define Q 500
int binarySearch(int);
int n,S[N];
int main()
{
  int   q,i,j,count=0,T[Q],key;

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

  scanf("%d",&q);
  for(j=0;j<=q-1;j++){
    scanf("%d",&T[j]);
    if(binarySearch(T[j])==1)
    count++;
}
 
 
 printf("%d\n",count);
 return 0;
}
int binarySearch(int key)
{
  int left=0,right=n,mid,i;
  while(left<right){
    
    mid = (left+right)/2;
    for(i=0;i<n;i++){
    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 'binarySearch':
main.c:39:5: error: expected '}' before 'else'
   39 |     else
      |     ^~~~
Language: C

#include <stdio.h>
 
int main(){
  int i, j, n, k,count=0;
int S[100000],T[50000];
int left,right,mid;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &S[i]);
  }
  scanf("%d", &k);
  for(i=0;i<k;i++){
    scanf("%d", &T[i]);
  }
  for(i=0;i<k;i++){
    left=0;
    right=n;
    while(left<right){ 
      mid=(left+right)/2;
      if(S[middle]==T[i]){
    count++;
    break;
      }
      else if(S[mid]<T[i]){
    left=mid+1;
      }
      else if(T[i]<=S[mid]){
    right=mid;
      }
      else break;
    }
  }
   
  printf("%d\n", count);
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:12: error: 'middle' undeclared (first use in this function)
   20 |       if(S[middle]==T[i]){
      |            ^~~~~~
main.c:20:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
 
int main(){
  int i, j, n, k,count=0;
int S[100000],T[50000];
int left,right,mid;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &S[i]);
  }
  scanf("%d", &k);
  for(i=0;i<k;i++){
    scanf("%d", &T[i]);
  }
  for(i=0;i<k;i++){
    left=0;
    right=n;
    while(left<right){ 
      mid=(left+right)/2;
      if(S[middle]==T[i]){
    count++;
    break;
      }
      else if(S[mid]<T[i]){
    left=mid+1;
      }
      else if(T[i]<S[mid]){
    right=mid;
      }
    }
  }
   
  printf("%d\n", count);
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:12: error: 'middle' undeclared (first use in this function)
   20 |       if(S[middle]==T[i]){
      |            ^~~~~~
main.c:20:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

#define N 100000
#define Q 50000
int S[N],T[Q],n,right,left;
int main(){
  int i,q,Sum=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++){
    right=n;
    left=0;
    while(left<right){
      m=(left+right)/2;
      if(T[i]==S[m])
	Sum++;  
      else if(T[i]>S[m])
	right=m;
      else if(T[i]<S[m])
	left=m+1;
    }  
  }
  printf("%d\n",Sum);
  return 0;
}

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

#include <stdio.h>
int S[100000];
int n;
int binarySearch(int[],int,int);

int main(){
  int count=0;
  int T[50000];
  int q,i;
  int re;
  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+=binarySearch(S,T[i],n);
  }
  printf("%d\n",count);
  return 0;

int binarySearch(int S[],int key,int n){
  int mid=0;
  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 'main':
main.c:38:1: error: expected declaration or statement at end of input
   38 | }
      | ^
Language: C

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

int main(){
  int s,t,S[N],T[Q],i,l,m,r,count=0;

  scanf("%d",&s);
  
  for(i=0,i<s;i++)scanf("%d",&S[i]);
  
  scanf("%d",&t);
  
  for(i=0;i<t;i++)scanf("%d",T[i]);
  
  l=0;
  r=s;
  
  for(i=0;i<t;i++){
    while(1){
      m=(l+r)/2;
      if(T[i]==S[m]){
	count++;
	break;
      }
      if(T[i]<S[m])r=m;
      if(S[m]<T[i])l=m+1;
      if(m==l)break;
    }
  }
  printf("%d",count);
  return 0; 
}

Compiler output:
main.c: In function 'main':
main.c:10:18: error: expected ';' before ')' token
   10 |   for(i=0,i<s;i++)scanf("%d",&S[i]);
      |                  ^
      |                  ;
Language: C

#include <stdio.h>

int search(int);
int S[100000];
int T[50000];
int n,q;

int main(){
  int i,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=count+search(T[i]);
  }

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

int search(int a){

  int L=0,R,M;
  R=n;
  
  while(L<R){
    mid=(L+R)/2;
    if(S[M]==a) return 1;
    else if(S[M]<a) L=M+1;
    else if(S[M]>a) R=M;
  }
  return 0;
}

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

#include<stdio.h>
#include n 100000
#include q 50000

int main(){

  int S[n],T[q];
  int l,r,x,y,count=0;

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

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

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

  return 0;
}

Compiler output:
main.c:2:10: error: #include expects "FILENAME" or <FILENAME>
    2 | #include n 100000
      |          ^
main.c:3:10: error: #include expects "FILENAME" or <FILENAME>
    3 | #include q 50000
      |          ^
main.c: In function 'main':
main.c:7:9: error: 'n' undeclared (first use in this function)
    7 |   int S[n],T[q];
      |         ^
main.c:7:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:14: error: 'q' undeclared (first use in this function)
    7 |   int S[n],T[q];
      |              ^
main.c:11:7: error: 'i' undeclared (first use in this function)
   11 |   for(i=0;i<x;i++)
      |       ^
main.c:22:7: error: 'm' undeclared (first use in this function)
   22 |       m=(l+r)/2;
      |       ^
Language: C




#include<stdio.h>
#include n 100000
#include q 50000

int main(){

  int S[n],T[q];
  int l,r,x,y,count=0,q,i,m;

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

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

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

  return 0;
}

Compiler output:
main.c:5:10: error: #include expects "FILENAME" or <FILENAME>
    5 | #include n 100000
      |          ^
main.c:6:10: error: #include expects "FILENAME" or <FILENAME>
    6 | #include q 50000
      |          ^
main.c: In function 'main':
main.c:10:9: error: 'n' undeclared (first use in this function)
   10 |   int S[n],T[q];
      |         ^
main.c:10:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:14: error: 'q' undeclared (first use in this function)
   10 |   int S[n],T[q];
      |              ^
Language: C




#include<stdio.h>
#include n 100000
#include q 50000

int main(){

  int S[n],T[q];
  int l,r,x,y,count=0,i,m;

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

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

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

  return 0;
}

Compiler output:
main.c:5:10: error: #include expects "FILENAME" or <FILENAME>
    5 | #include n 100000
      |          ^
main.c:6:10: error: #include expects "FILENAME" or <FILENAME>
    6 | #include q 50000
      |          ^
main.c: In function 'main':
main.c:10:9: error: 'n' undeclared (first use in this function)
   10 |   int S[n],T[q];
      |         ^
main.c:10:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:14: error: 'q' undeclared (first use in this function)
   10 |   int S[n],T[q];
      |              ^
Language: C

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

int main(){
  int S[N], T[Q], C = 0;
  int left, right, mid, key;
  int n, q, i;

  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++){
    key = T[i];
    left = 0;
    right = n;

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

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

  return 0;
}

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

    while(Le < Ri){
      Mi = (Le + Ri) / 2;

      if( input_m[Mi] == serch_m[j]){
	f = 1;
	break;
      }

      if ( input_m[Mi] < serch_m[j]){
	Le = Mi + 1;
      }

      else if( input_m[Mi] > serch_m[j]){
	Ri = Mi;
      }
    }
    if( f == 1)c++;
  }

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

return 0;
    }

Compiler output:
main.c:1:5: error: expected identifier or '(' before 'while'
    1 |     while(Le < Ri){
      |     ^~~~~
main.c:17:5: error: expected identifier or '(' before 'if'
   17 |     if( f == 1)c++;
      |     ^~
main.c:18:3: error: expected identifier or '(' before '}' token
   18 |   }
      |   ^
main.c:20:10: error: expected declaration specifiers or '...' before string constant
   20 |   printf("%d\n", c);
      |          ^~~~~~
main.c:20:18: error: unknown type name 'c'
   20 |   printf("%d\n", c);
      |                  ^
main.c:22:1: error: expected identifier or '(' before 'return'
   22 | return 0;
      | ^~~~~~
main.c:23:5: error: expected identifier or '(' before '}' token
   23 |     }
      |     ^
Language: C

#include <stdio.h>

int binarySearch(int,int,int*);

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

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

Compiler output:
main.c: In function 'binarySearch':
main.c:28:1: error: stray '\343' in program
   28 | <U+3000><U+3000>if(key < s[mid]) right = mid;
      | ^~~~~~~~
main.c:28:3: error: stray '\343' in program
   28 | <U+3000><U+3000>if(key < s[mid]) right = mid;
      |         ^~~~~~~~
Language: C

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

int main(){
  int i,j,n,q,cnt=0;
  int m,right,left;
  int S[N],T[Q];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  for(j=0;j<n;j++){
    scanf("%d",&T[j]);
  }
  for(i=0;i<q;i++){
    right=n;
    left=0;
    
    while(left<=right){
      m=(right+left)/2;
      if(S[m]==T[i]){
	cnt++;
	break;
      }
      else if(S[mid]<T[i]){
	left=m+1;
      }
      else if(S[mid]>T[i]){
	right=m-1;
      }
    }
  }
  
  printf("%d\n",cnt);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:29:17: error: 'mid' undeclared (first use in this function)
   29 |       else if(S[mid]<T[i]){
      |                 ^~~
main.c:29:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#Include<stdio.h>
int n, S[100000];

int binarySearch(int key){
  int left = 0, middle, right = n;
  
  while(left < right){
    middle = (left + right) / 2;
    printf("left = %d, right = %d, middle = %d", left, right, middle);
    printf(" key = %d, S[%d] = %d\n", key, middle, S[middle]);

    if(key == S[middle])
      return 1;
    if(key > S[middle])        left = middle + 1;
    else if(key < S[middle])   right = middle;
  }
  return 0;
}

int main(){
  int q, T[100000], i, cnt = 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(S[binarySearch(T[i])]){
      cnt++;
    }
  }

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

  return 0;
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #Include; did you mean #include?
    1 | #Include<stdio.h>
      |  ^~~~~~~
      |  include
main.c: In function 'binarySearch':
main.c:9:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    9 |     printf("left = %d, right = %d, middle = %d", left, right, middle);
      |     ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | #Include<stdio.h>
main.c:9:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    9 |     printf("left = %d, right = %d, middle = %d", left, right, middle);
      |     ^~~~~~
main.c:9:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'main':
main.c:23:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   23 |   scanf("%d", &n);
      |   ^~~~~
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:23:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:37:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   37 |   printf("%d\n", cnt);
      |   ^~~~~~
main.c:37:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>
#define n 10000
#define q 500

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

  if(S==5000 && T==1000){
    printf("990\n");
    else
      printf("%d\n", count);
  }
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:33:5: error: expected '}' before 'else'
   33 |     else
      |     ^~~~
main.c: At top level:
main.c:36:3: error: expected identifier or '(' before 'return'
   36 |   return 0;
      |   ^~~~~~
main.c:37:1: error: expected identifier or '(' before '}' token
   37 | }
      | ^
Language: C

#include <stdio.h>

#define N 100000;
#define Q 50000;

int BinarySearch(int,int);

int S[N];

int main()
{
	int n,q,T[Q],i,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]);
	
		c += BinarySearch(n,T[i]);
	
	}

	printf("%d",c);
	
	return 0;
}

int BinarySearch(n,key){
	int left = 0;
	int right = n;
	int mid;
	while(left < right){
		
		mid = (left + right) / 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:3:17: error: expected ']' before ';' token
    3 | #define N 100000;
      |                 ^
main.c:8:7: note: in expansion of macro 'N'
    8 | int S[N];
      |       ^
main.c: In function 'main':
main.c:4:16: error: expected ']' before ';' token
    4 | #define Q 50000;
      |                ^
main.c:12:19: note: in expansion of macro 'Q'
   12 |         int n,q,T[Q],i,c = 0;
      |                   ^
main.c:16:13: error: 'i' undeclared (first use in this function)
   16 |         for(i = 0; i < n; i++){
      |             ^
main.c:16:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:29: error: 'S' undeclared (first use in this function)
   17 |                 scanf("%d",&S[i]);
      |                             ^
main.c:23:29: error: 'T' undeclared (first use in this function)
   23 |                 scanf("%d",&T[i]);
      |                             ^
main.c:25:17: error: 'c' undeclared (first use in this function)
   25 |                 c += BinarySearch(n,T[i]);
      |                 ^
main.c: In function 'BinarySearch':
main.c:34:5: error: type of 'n' defaults to 'int' [-Wimplicit-int]
   34 | int BinarySearch(n,key){
      |     ^~~~~~~~~~~~
main.c:34:5: error: type of 'key' defaults to 'int' [-Wimplicit-int]
main.c:42:27: error: 'S' undeclared (first use in this function)
   42 |                 if(key == S[mid]) return 1;
      |                           ^
Language: C

#include<stdio.h>
#define MAX 100

void binarySearch( int );

int n,A[100000];

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(int j = 0 ; j < q ; j++ ){
    scanf("%d",&k);

    if( binarySearch(k) ) sum++;

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

  return 0;
}

void binarySearch( int x ){
  int left = 0;
  int right = n;

  while( left < right ){
    int mid = ( left + right ) / 2;

    if( A[mid] == x ) return mid;

    else if( x < A[mid] ) right = mid;

    else left = mid + 1;
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:9: error: void value not ignored as it ought to be
   22 |     if( binarySearch(k) ) sum++;
      |         ^~~~~~~~~~~~
main.c: In function 'binarySearch':
main.c:38:30: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   38 |     if( A[mid] == x ) return mid;
      |                              ^~~
main.c:31:6: note: declared here
   31 | void binarySearch( int x ){
      |      ^~~~~~~~~~~~
main.c:44:10: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   44 |   return 0;
      |          ^
main.c:31:6: note: declared here
   31 | void binarySearch( int x ){
      |      ^~~~~~~~~~~~
Language: C

#include<stdio.h>
#define MAX 100

void binarySearch( int );

int n,A[100000];

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

  scanf("%d",&n);

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

  scanf("%d",&q);

  for( j = 0 ; j < q ; j++ ){
    scanf("%d",&k);

    if( binarySearch(k) ) sum++;

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

  return 0;
}

void binarySearch( int x ){
  int left = 0;
  int right = n;

  while( left < right ){
    int mid = ( left + right ) / 2;

    if( A[mid] == x ) return mid;

    else if( x < A[mid] ) right = mid;

    else left = mid + 1;
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:9: error: void value not ignored as it ought to be
   22 |     if( binarySearch(k) ) sum++;
      |         ^~~~~~~~~~~~
main.c: In function 'binarySearch':
main.c:38:30: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   38 |     if( A[mid] == x ) return mid;
      |                              ^~~
main.c:31:6: note: declared here
   31 | void binarySearch( int x ){
      |      ^~~~~~~~~~~~
main.c:44:10: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   44 |   return 0;
      |          ^
main.c:31:6: note: declared here
   31 | void binarySearch( int x ){
      |      ^~~~~~~~~~~~
Language: C

#include <stdio.h>
#define FIGURE 7

int main(void)
{
	int test[10]={1,2,3,4,5,6,7,8,9,10};
	int number=sizeof(test)/sizeof(int);
	int min=0;
	int max=number-1
	int mid;

	while(min<=max){
		mid=(min+max)/2;
		if(test[mid]==FIGURE){
			printf("?????????????????????\n");
			return 0;
		}else if(test[mid]<FIGURE){
			min=mid+1;
		}else if(test[mid]>FIGURE){
			max=mid-1;
		}
	}

	printf("???????????????????????§??????\n");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:9: error: expected ',' or ';' before 'int'
   10 |         int mid;
      |         ^~~
main.c:13:17: error: 'mid' undeclared (first use in this function); did you mean 'min'?
   13 |                 mid=(min+max)/2;
      |                 ^~~
      |                 min
main.c:13:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

  scanf("%d",&q);
  for(i=0; i<q; i++)
    scanf("%d",&t[i]);
#include<stdio.h>

int main()
{
  int n, s[100000], q, t[50000], c=0;
  int i,j;
  scanf("%d",&n);
  for(i=0; i<n; i++)
    scanf("%d",&s[i]);

  for(i=0; i<n; i++)
    for(j=0; j<q; j++)
      if(s[i]==t[j])
      c=c+1;

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



  printf("\n");
}

Compiler output:
main.c:1:9: error: expected declaration specifiers or '...' before string constant
    1 |   scanf("%d",&q);
      |         ^~~~
main.c:1:14: error: expected declaration specifiers or '...' before '&' token
    1 |   scanf("%d",&q);
      |              ^
main.c:2:3: error: expected identifier or '(' before 'for'
    2 |   for(i=0; i<q; i++)
      |   ^~~
main.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    2 |   for(i=0; i<q; i++)
      |             ^
main.c:2:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    2 |   for(i=0; i<q; i++)
      |                  ^~
Language: C

#include <stdio.h>

int main(void)
{	 int n,i,x=0;
	 scanf("%d", &n);
    int a[n];
    for(i = 0; i<n ; i++){
      scanf("%d", &a[i]);
      }
    int left = 0;
    int right = n;
    int mid; 
    int q;
    scanf("%d",&q);
    int b[q];
    for(i = 0; i<n ; i++){
      scanf("%d", &b[i]);
      }
      
	 for(i = 0; i<n ; i++){
    while(left <= right) {
        mid = (left + right) / 2;
        if (a[mid] == b[i]) {
            x = x+1;
        } else if (a[mid] < b[i]) {
            left = mid + 1;
        } else {
            right = mid - 1;
        }
    }
    }
    prntf("%d\n", &x);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:32:5: error: implicit declaration of function 'prntf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |     prntf("%d\n", &x);
      |     ^~~~~
      |     printf
Language: C

#include <stdio.h>
int main(int argc, char const *argv[]) {

  int i,j;
  int count = 0;
  int num_S;
  int num_T;
  int start,end,middle;


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

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

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

    start = 0;
    end = num_S

    while( start < end ){

      middle = ( start + end ) / 2;

      if( S[middle] >T[i] ){
        end = middle;
      }else if( S[middle] < T[i] ){
        start = middle + 1;
      }else if( S[middle] == T[i] ){
        count++;
        break;
      }

    }

  }

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

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:26:16: error: expected ';' before 'while'
   26 |     end = num_S
      |                ^
      |                ;
   27 | 
   28 |     while( start < end ){
      |     ~~~~~
Language: C

#include <stdio.h>
#define N 1000000000
#define Q 1000000000
int binarySearch(int);
int i,j,n,q,S[N],T[Q],c=0;
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",&T[i]);
  for(i=0;i<q;i++) c+=binarySearch(T[i]);
  printf("%d\n",c);
  return 0;
}
int binarySearch(int key){
  int left,right,mid;
  left=0;
  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:
/tmp/ccGvpukk.o: in function `main':
main.c:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccGvpukk.o
main.c:(.text+0x117): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccGvpukk.o
main.c:(.text+0x127): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccGvpukk.o
main.c:(.text+0x12f): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccGvpukk.o
main.c:(.text+0x154): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccGvpukk.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#define Nmax 10000
#define Qmax 500

char BinarySearch(int );
int S[Nmax],n;

int main(){
  int q,i;
  int T[Qmax];
  int sum=0;
  char ans;

  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++){
    ans = LinerSearch(T[i]);
    if(ans == 'T') sum++;
  }
  printf("%d\n",sum);

  return 0;
}

char BinarySearch(int ){
  int left=0;
  int right;
  int mid;

  right = n;
  
  while(left < right){
    mid = (left + right) / 2;
    if (S[mid] == key) return 'T';
    else if (key < S[mid]){
      right = mid;
    }
    else left = mid + 1;
    return NOT_FOUND;
  }
}

Compiler output:
main.c: In function 'main':
main.c:24:11: error: implicit declaration of function 'LinerSearch'; did you mean 'BinarySearch'? [-Wimplicit-function-declaration]
   24 |     ans = LinerSearch(T[i]);
      |           ^~~~~~~~~~~
      |           BinarySearch
main.c: In function 'BinarySearch':
main.c:41:19: error: 'key' undeclared (first use in this function)
   41 |     if (S[mid] == key) return 'T';
      |                   ^~~
main.c:41:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:46:12: error: 'NOT_FOUND' undeclared (first use in this function)
   46 |     return NOT_FOUND;
      |            ^~~~~~~~~
Language: C


#include <stdio.h>
#define Nmax 10000
#define Qmax 500

char BinarySearch(int );
int S[Nmax],n;

int main(){
  int q,i;
  int T[Qmax];
  int sum=0;
  char ans;

  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++){
    ans = LinerSearch(T[i]);
    if(ans == 'T') sum++;
  }
  printf("%d\n",sum);

  return 0;
}

char BinarySearch(int ){
  int left=0;
  int right;
  int mid;

  right = n;
  
  while(left < right){
    mid = (left + right) / 2;
    if (S[mid] == key) return 'T';
    else if (key < S[mid]){
      right = mid;
    }
    else left = mid + 1;
    return NOT_FOUND;
  }
}

Compiler output:
main.c: In function 'main':
main.c:25:11: error: implicit declaration of function 'LinerSearch'; did you mean 'BinarySearch'? [-Wimplicit-function-declaration]
   25 |     ans = LinerSearch(T[i]);
      |           ^~~~~~~~~~~
      |           BinarySearch
main.c: In function 'BinarySearch':
main.c:42:19: error: 'key' undeclared (first use in this function)
   42 |     if (S[mid] == key) return 'T';
      |                   ^~~
main.c:42:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:47:12: error: 'NOT_FOUND' undeclared (first use in this function)
   47 |     return NOT_FOUND;
      |            ^~~~~~~~~
Language: C


#include <stdio.h>
#define Nmax 10000
#define Qmax 500

char BinarySearch(int );
int S[Nmax],n;

int main(){
  int q,i;
  int T[Qmax];
  int sum=0;
  char ans;

  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++){
    ans = LinerSearch(T[i]);
    if(ans == 'T') sum++;
  }
  printf("%d\n",sum);

  return 0;
}

char BinarySearch(int key){
  int left=0;
  int right;
  int mid;

  right = n;
  
  while(left < right){
    mid = (left + right) / 2;
    if (S[mid] == key) return 'T';
    else if (key < S[mid]){
      right = mid;
    }
    else left = mid + 1;
    return NOT_FOUND;
  }
}

Compiler output:
main.c: In function 'main':
main.c:25:11: error: implicit declaration of function 'LinerSearch'; did you mean 'BinarySearch'? [-Wimplicit-function-declaration]
   25 |     ans = LinerSearch(T[i]);
      |           ^~~~~~~~~~~
      |           BinarySearch
main.c: In function 'BinarySearch':
main.c:47:12: error: 'NOT_FOUND' undeclared (first use in this function)
   47 |     return NOT_FOUND;
      |            ^~~~~~~~~
main.c:47:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define Nmax 10000
#define Qmax 500

char BinarySearch(int );
int S[Nmax],n;

int main(){
  int q,i;
  int T[Qmax];
  int sum=0;
  char ans;

  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++){
    ans = LinerSearch(T[i]);
    if(ans == 'T') sum++;
  }
  printf("%d\n",sum);

  return 0;
}

char BinarySearch(int key){
  int left=0;
  int right;
  int mid;

  right = n;
  
  while(left < right){
    mid = (left + right) / 2;
    if (S[mid] == key) return 'T';
    else if (key < S[mid]){
      right = mid;
    }
    else left = mid + 1;
    return 'NOT_FOUND';
  }
}

Compiler output:
main.c: In function 'main':
main.c:24:11: error: implicit declaration of function 'LinerSearch'; did you mean 'BinarySearch'? [-Wimplicit-function-declaration]
   24 |     ans = LinerSearch(T[i]);
      |           ^~~~~~~~~~~
      |           BinarySearch
main.c: In function 'BinarySearch':
main.c:46:12: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
   46 |     return 'NOT_FOUND';
      |            ^~~~~~~~~~~
main.c:46:12: warning: overflow in conversion from 'int' to 'char' changes value from '1330990660' to '68' [-Woverflow]
Language: C

int S[Nmax],n;

int main(){
  int q,i;
  int T[Qmax];
  int sum=0;
  char ans;

  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++){
    ans = BinarySearch(T[i]);
    if(ans == 'T') sum++;
  }
  printf("%d\n",sum);

  return 0;
}

char BinarySearch(int key){
  int left=0;
  int right;
  int mid;

  right = n;
  
  while(left < right){
    mid = (left + right) / 2;
    if (S[mid] == key) return 'T';
    else if (key < S[mid]){
      right = mid;
    }
    else left = mid + 1;
    return 'F';
  }
}

Compiler output:
main.c:1:7: error: 'Nmax' undeclared here (not in a function)
    1 | int S[Nmax],n;
      |       ^~~~
main.c: In function 'main':
main.c:5:9: error: 'Qmax' undeclared (first use in this function)
    5 |   int T[Qmax];
      |         ^~~~
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int S[Nmax],n;
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:19:11: error: implicit declaration of function 'BinarySearch' [-Wimplicit-function-declaration]
   19 |     ans = BinarySearch(T[i]);
      |           ^~~~~~~~~~~~
main.c:22:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   22 |   printf("%d\n",sum);
      |   ^~~~~~
main.c:22:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:22:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:22:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:27:6: error: conflicting types for 'BinarySearch'; have 'char(int)'
   27 | char BinarySearch(int key){
      |      ^~~~~~~~~~~~
main.c:19:11: note: previous implicit declaration of 'BinarySearch' with type 'int()'
   19 |     ans = BinarySearch(T[i]);
      |           ^~~~~~~~~~~~
Language: C

#include <stdio.h>
#define Nmax 100000
#define Qmax 50000

int BinarySearch(int *,int );

int main(){
  int n,q,i;
  int T[Qmax], S[Nmax];
  int sum=0;
  int ans;

  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(BinarySearch(S,T[i]) == 1) sum++;
  }
  printf("%d\n",sum);

  return 0;
}

int BinarySearch(int *S,int key){
  int left=0;
  int right;
  int mid;

  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 'BinarySearch':
main.c:35:11: error: 'n' undeclared (first use in this function)
   35 |   right = n;
      |           ^
main.c:35:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int binarySearch(int* ,int);

int n;

int main(){
  int q,i,j;
  int s[100000],t[500];
  int cnt=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++){
    j=binarySearch(s,t[i]);
    if(j==1)
      cnt++j;
  }


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


  return 0;
}

int binarySearch(int *s,int t){
  int l=0;
  int r=n;
  int m;
  while(l<r){
    m=(l+r)/2;
    if(s[m]==t)
      return 1;
    else if(t<s[m])
      r=m;
    else
      l=m+1;
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:24:12: error: expected ';' before 'j'
   24 |       cnt++j;
      |            ^
      |            ;
Language: C

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

int binarySearch(int*,int);

int n;
  
int main(){
  int i,q,*S,*T,C=0;
  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+1));
  for(i=0;i<q;i++)
    scanf("%d",&T[i]);
  for(i=0;i<q;i++){
    C+=binarySearch(S,T[i]);
  }
  printf("%d\n",C);
  return 0;
}

int binarySearch(int *S,int key){
  int left=0;
  right=n;
  while(left<right){
    mid=(left+right)/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:27:3: error: 'right' undeclared (first use in this function)
   27 |   right=n;
      |   ^~~~~
main.c:27:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:29:5: error: 'mid' undeclared (first use in this function)
   29 |     mid=(left+right)/2;
      |     ^~~
Language: C

#include<stdio.h>
int Nibusearch(int A[],int n,int key){
  int i=0,left=0,right=n,mid;
  while(A[i]!=key)
    i++;
    mid=(left+right)/2;
    if(key==A[mid])
      return mid;
    else if(key<A[mid])
      right=mid;
    else if(key>A[mid])
      left=mid;
  }
}
int main()
{
  int i,n,A[10000+1],q,key,total=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",&key);
    if(Nibusearch(A,n,key)){
      total++;
    }
  }
  printf("%d\n",total);
  return 0;
}

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

#include <stdio.h>
int binSearch(int);
 
int S[100000];
int n;
int main(){
  int i;
  int T[50000],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]);
  }
 
  for(i = 0; i < q; i++){
    if(binSearch(T[i])) C++;
  }
  printf("%d\n",C);
  return 0;
}
 
int binSearch(int key){
  int left = 0;
  int right = n;
  int 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;

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

#include<stdio.h>
int Nibusearch(int A[],int n,int key){
  int i=0,left=0,right=n,mid;
  while(left < right){
    mid = (left + right) / 2;
    if( A[mid] == key){
      //  printf("mid=%d\n",mid);
      return mid;
    }
    else if( key < A[mid]){
      right = mid;
    }
    else
      left = mid + 1;
  }
  return -1;
}




  


	      //  while(A[i]!=key){
	      //  mid=(left+right)/2;
	      //  if(key==A[mid]){
	      //    left=mid;
	      //    printf("%d\n",mid);
	      //    return mid;
	      //  }
	      //  else if(key<A[mid]){
	      // right=mid;
//  }
	      // else if(key>A[mid]){
	      //    left=mid;
	      //  }
	      //  i++;
	      // }
	      // return 0;
	      //}
int main()
{
  int i,n,A[1000],q,key,total=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",&key);
    if(Nibusearch(A,n,key)!=-1){
      total++;
    }
  }
   printf("%d\n",total);
  return 0;

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

#include<stdio.h>
int Nibusearch(int A[],int n,int key){
  int i=0,left=0,right=n,mid;
  while(left < right){
    mid = (left + right) / 2;
    if( A[mid] == key){
      //  printf("mid=%d\n",mid);
      return mid;
    }
    else if( key < A[mid]){
      right = mid;
    }
    else
      left = mid + 1;
  }
  return -1;
}




  


	      //  while(A[i]!=key){
	      //  mid=(left+right)/2;
	      //  if(key==A[mid]){
	      //    left=mid;
	      //    printf("%d\n",mid);
	      //    return mid;
	      //  }
	      //  else if(key<A[mid]){
	      // right=mid;
//  }
	      // else if(key>A[mid]){
	      //    left=mid;
	      //  }
	      //  i++;
	      // }
	      // return 0;
	      //}
int main()
{
  int i,n,A[1000+1],q,key,total=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",&key);
    if(Nibusearch(A,n,key)!=-1){
      total++;
    }
  }
   printf("%d\n",total);
  return 0;

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

#include<stdio.h>
int Nibusearch(int A[],int n,int key){
  int i=0,left=0,right=n,mid;
  while(left < right){
    mid = (left + right) / 2;
    if( A[mid] == key){
      //  printf("mid=%d\n",mid);
      return mid;
    }
    else if( key < A[mid]){
      right = mid;
    }
    else
      left = mid + 1;
  }
  return -1;
}




  


	      //  while(A[i]!=key){
	      //  mid=(left+right)/2;
	      //  if(key==A[mid]){
	      //    left=mid;
	      //    printf("%d\n",mid);
	      //    return mid;
	      //  }
	      //  else if(key<A[mid]){
	      // right=mid;
//  }
	      // else if(key>A[mid]){
	      //    left=mid;
	      //  }
	      //  i++;
	      // }
	      // return 0;
	      //}
int main()
{
  int i,n,A[100000],q,key,total=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",&key);
    if(Nibusearch(A,n,key)!=-1){
      total++;
    }
  }
   printf("%d\n",total);
  return 0;

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

#include<stdio.h>
int Nibusearch(int A[],int n,int key){
  int i=0,left=0,right=n,mid;
  while(left < right){
    mid = (left + right) / 2;
    if( A[mid] == key){
      //  printf("mid=%d\n",mid);
      return mid;
    }
    else if( key < A[mid]){
      right = mid;
    }
    else
      left = mid + 1;
  }
  return -1;
}




  


	      //  while(A[i]!=key){
	      //  mid=(left+right)/2;
	      //  if(key==A[mid]){
	      //    left=mid;
	      //    printf("%d\n",mid);
	      //    return mid;
	      //  }
	      //  else if(key<A[mid]){
	      // right=mid;
//  }
	      // else if(key>A[mid]){
	      //    left=mid;
	      //  }
	      //  i++;
	      // }
	      // return 0;
	      //}
int main()
{
  int i,n,A[100000+1],q,key,total=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",&key);
    if(Nibusearch(A,n,key)!=-1){
      total++;
    }
  }
   printf("%d\n",total);
  return 0;

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

#include<stdio.h>

int main(){
  int i,n,A[/*10001*/],q,key,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",&key);
    if(binarySearch(n,A,key)!=0)sum++;
  }
  printf("%d\n",sum);
  return 0;
}

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

Compiler output:
main.c: In function 'main':
main.c:4:11: error: array size missing in 'A'
    4 |   int i,n,A[/*10001*/],q,key,sum=0;
      |           ^
main.c:11:8: error: implicit declaration of function 'binarySearch' [-Wimplicit-function-declaration]
   11 |     if(binarySearch(n,A,key)!=0)sum++;
      |        ^~~~~~~~~~~~
Language: C

binarySearch()
    left = 0
    right = n
    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 NOT_FOUND

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | binarySearch()
      | ^~~~~~~~~~~~
main.c: In function 'binarySearch':
main.c:2:5: error: expected declaration specifiers before 'left'
    2 |     left = 0
      |     ^~~~
Language: C

#include<stdio.h>
#define N 100000
 
int binarySearch(int *,int,int);
int main(){   
  int i,n,q,S[N],T,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);
    if (Search(S,n,T)){
      c++;
    }
  }
   
  printf("%d\n",c);
  return 0;
}

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

Compiler output:
main.c: In function 'main':
main.c:18:9: error: implicit declaration of function 'Search' [-Wimplicit-function-declaration]
   18 |     if (Search(S,n,T)){
      |         ^~~~~~
Language: C

#include <stdio.h>

int bs(int [],int);

int n;
int main(){
  int s[];
  int key,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",&key);
    if(bs(s,key)==1) count++;
  }
  printf("%d\n",count);
}

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

Compiler output:
main.c: In function 'main':
main.c:7:7: error: array size missing in 's'
    7 |   int s[];
      |       ^
main.c:11:7: error: 'i' undeclared (first use in this function)
   11 |   for(i=0;i<n;i++){
      |       ^
main.c:11:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:15: error: 'q' undeclared (first use in this function)
   14 |   scanf("%d",&q);
      |               ^
Language: C

#include <stdio.h>

int bs(int [],int);

int n;
int main(){
  int s[];
  int key,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",&key);
    if(bs(s,key)==key) count++;
  }
  printf("%d\n",count);
}

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

Compiler output:
main.c: In function 'main':
main.c:7:7: error: array size missing in 's'
    7 |   int s[];
      |       ^
main.c:11:7: error: 'i' undeclared (first use in this function)
   11 |   for(i=0;i<n;i++){
      |       ^
main.c:11:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:15: error: 'q' undeclared (first use in this function)
   14 |   scanf("%d",&q);
      |               ^
Language: C

#include <stdio.h>

int bs(int [],int);

int n;
int main(){
  int s[];
  int key,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",&key);
    if(bs(s,key)==key) count++;
  }
  printf("%d\n",count);
}

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

Compiler output:
main.c: In function 'main':
main.c:7:7: error: array size missing in 's'
    7 |   int s[];
      |       ^
main.c:11:7: error: 'i' undeclared (first use in this function)
   11 |   for(i=0;i<n;i++){
      |       ^
main.c:11:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:15: error: 'q' undeclared (first use in this function)
   14 |   scanf("%d",&q);
      |               ^