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

#include <stdio.h>
#include <algorithm>

int main(){
    int i,k,n,q,count = 0,low, high, mid=0,target;
    scanf("%d", &n);
    int S[n];
    for(i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    int T[q];
    for(k = 0; k < q; k++){
        scanf("%d", &T[k]);
    }
    std::sort(S,n+1);
    for (i = 0; i < q; ++i){
        low = 0; 
        high = n-1;
        target=T[i];
        while(1){
            mid = (low + high) / 2;
            if(S[mid] == target) {
                count++;
                break;
            }
            else if(S[mid] < target) low = mid + 1;
            else high = mid - 1;
            if(high<low)  break;
        }
    }
    printf("%d\n", count);
    return  0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: no matching function for call to 'sort(int [n], int)'
   16 |     std::sort(S,n+1);
      |     ~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:16:14: note:   deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
   16 |     std::sort(S,n+1);
      |     ~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <stdio.h>

int main() {
  int i, k, n, q, finger, c = 0, low, high, mid;
  scanf( "%d", &n );
  int data_s[n];
  for( i = 0; i < n; i++ ) {
    scanf( "%d", &data_s[i] );
  }
  scanf( "%d", &q );
  int data_t[q];
  for( i = 0; i < n; i++ ) {
    scanf( "%d", &data_s[i] );
  }
  for( i = 0; i < n; i++ ) {
    for( k = i + 1; k < n; k++ ) {
      if( data_s[i] > data_s[k] ) {
        finger = data_s[i];
        data_s[i] = data_s[k];
        data_s[k] = finger;
      }
  }
  for( i = 0; i < q; i++ ) {
    high = n - 1;
    low = 0;
    while( 1 ) {
      mid = ( low + high ) / 2;
      if( data_ s[mid] == data_ t[i] ) {
        c++;
        break;
      } else if( data_s[mid] < data_ t[i] ) {
        low = mid + 1;
      } else {
        high = mid - 1;
      }
      if(high < low) break;
    }
  }
  printf( "%d\n", c );
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: 'data_' was not declared in this scope; did you mean 'data_t'?
   28 |       if( data_ s[mid] == data_ t[i] ) {
      |           ^~~~~
      |           data_t
a.cc:28:16: error: expected ')' before 's'
   28 |       if( data_ s[mid] == data_ t[i] ) {
      |         ~      ^~
      |                )
a.cc:31:37: error: expected ')' before 't'
   31 |       } else if( data_s[mid] < data_ t[i] ) {
      |                ~                    ^~
      |                                     )
a.cc:41:2: error: expected '}' at end of input
   41 | }
      |  ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

#include <stdio.h>

void shift( int data_s[], int n ) {
  for( i = 0; i < n; i++ ) {
    for( k = i + 1; k < n; k++ ) {
      if( data_s[i] > data_s[k] ) {
        finger = data_s[i];
        data_s[i] = data_s[k];
        data_s[k] = finger;
      }
    }
  }
}

int main() {
  int i, k, n, q, finger, c = 0, low, high, mid = 0;
  scanf( "%d", &n );
  int data_s[n];
  for( i = 0; i < n; i++ ) {
    scanf( "%d", &data_s[i] );
  }
  scanf( "%d", &q );
  int data_t[q];
  for( i = 0; i < q; i++ ) {
    scanf( "%d", &data_t[i] );
  }
  shift( data_s, n );
  for( i = 0; i < q; i++ ) {
    high = n - 1;
    low = 0;
    if( high < low ) break;
    while( 1 ) {
      mid = ( low + high ) / 2;
      if( data_s[mid] == data_t[i] ) {
        c++;
        break;
      } else if( data_s[mid] < data_t[i] ) {
        low = mid + 1;
      } else {
        high = mid - 1;
      }
    }
  }
  printf( "%d\n", c );
  return 0;
}

Compiler output:
a.cc: In function 'void shift(int*, int)':
a.cc:4:8: error: 'i' was not declared in this scope
    4 |   for( i = 0; i < n; i++ ) {
      |        ^
a.cc:5:10: error: 'k' was not declared in this scope
    5 |     for( k = i + 1; k < n; k++ ) {
      |          ^
a.cc:7:9: error: 'finger' was not declared in this scope
    7 |         finger = data_s[i];
      |         ^~~~~~
Language: C++

#include<iostream>

using namespace std;

int n, q, S[100000], T[50000], result;
bool being[10000000];

int main()
{
	scanf_s("%d", &n);
	for (int a = 0; a < n; a++)
	{
		scanf_s("%d", &S[a]);
		being[S[a]] = true;
	}

	scanf_s("%d", &q);
	for (int a = 0; a < q; a++)
	{
		scanf_s("%d", &T[a]);
		if (being[T[a]])
		{
			result++;
		}
	}

	printf_s("%d", result);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
a.cc:27:9: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   27 |         printf_s("%d", result);
      |         ^~~~~~~~
      |         printf
Language: C++

#include<iostream>
#include<stdio.h>

using namespace std;

int n, q, S[100000], T[50000], result;
bool being[10000000];

int main()
{
	scanf_s("%d", &n);
	for (int a = 0; a < n; a++)
	{
		scanf_s("%d", &S[a]);
		being[S[a]] = true;
	}

	scanf_s("%d", &q);
	for (int a = 0; a < q; a++)
	{
		scanf_s("%d", &T[a]);
		if (being[T[a]])
		{
			result++;
		}
	}

	printf_s("%d", result);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   11 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
a.cc:28:9: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   28 |         printf_s("%d", result);
      |         ^~~~~~~~
      |         printf
Language: C++

#include<map>
#include<cstdio>
using namespace std;
int main(){
	int n;
	cin>>n;
	map<int,bool>m;
	while(n--){
		int a;scanf("%d",&a);
		m[a]=true;
	}
	cin>>n;
	int out=0;
	while(n--){
		int a;scanf("%d",&a);
		out+=m[a];
	}
	cout<<out<<endl;
	printf("%d\n",out);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin>>n;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<cstdio>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout<<out<<endl;
      |         ^~~~
a.cc:18:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:20: error: 'endl' was not declared in this scope
   18 |         cout<<out<<endl;
      |                    ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<cstdio>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<map>
#include<cstdio>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	map<int,bool>m;
	while(n--){
		int a;scanf("%d",&a);
		m[a]=true;
	}
	cin>>n;
	int out=0;
	while(n--){
		int a;scanf("%d",&a);
		out+=m[a];
	}
	printf("%d\n",out);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin>>n;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<cstdio>
  +++ |+#include <iostream>
    3 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
int data[100000];
int query;
int cnt = 0;
for(int i = 0;i < n;i++)cin >> data[i];
sort(data,data + n);
for(int i = 0;i < m;i++){
cin >> query;
if(query == lower_bound(query))cnt++;
}
cout << cnt << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: no matching function for call to 'lower_bound(int&)'
   13 | if(query == lower_bound(query))cnt++;
      |             ~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
int data[100000];
int query;
int cnt = 0;
for(int i = 0;i < n;i++)cin >> data[i];
sort(data,data + n);
for(int i = 0;i < m;i++){
cin >> query;
if(query == lower_bound(query))cnt++;
}
}
cout << cnt << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: no matching function for call to 'lower_bound(int&)'
   13 | if(query == lower_bound(query))cnt++;
      |             ~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 1 provided
a.cc: At global scope:
a.cc:16:1: error: 'cout' does not name a type
   16 | cout << cnt << endl;
      | ^~~~
a.cc:17:1: error: expected unqualified-id before 'return'
   17 | return 0;
      | ^~~~~~
a.cc:18:1: error: expected declaration before '}' token
   18 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
int data[100000];
int query;
int cnt = 0;
for(int i = 0;i < n;i++)cin >> data[i];
sort(data,data + n);
for(int i = 0;i < m;i++){
cin >> query;
if(query == *lower_bound(query))cnt++;
}
cout << cnt << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: no matching function for call to 'lower_bound(int&)'
   13 | if(query == *lower_bound(query))cnt++;
      |              ~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 1 provided
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int s[100010], t[50010];
int n, q, ans = 0;

//s[0], s[1], s[2]. ... , s[n - 1]?????????x?????????????????????????????????
bool binary_search(int x){
	int l = 0, r = n;
	//[l, r)???????????????????????????????????§??°?????????
	while(r - l >= 1){
		int m = (l + r) / 2;
		if(s[m] == x) return true; //x??????????????£?????´???
		else if(s[m] > x) r = m;
		else if(s[m] < k) l = m + 1;
	}
	//x???????????????????????£?????´???
	return false;
}

int main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> s[i];
	}
	cin >> q;
	for(int i = 0; i < q; i++){
		cin >> t[i];
	}
	sort(s, s + n);
	for(int i = 0; i < q; i++){
		if(binary_search(t[i])) ans++;		
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'bool binary_search(int)':
a.cc:16:32: error: 'k' was not declared in this scope
   16 |                 else if(s[m] < k) l = m + 1;
      |                                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int s[100010], t[50010];
int n, q, ans = 0;

//s[0], s[1], s[2]. ... , s[n - 1]?????????x?????????????????????????????????
bool binary_search(int x){
	int l = 0, r = n;
	//[l, r)???????????????????????????????????§??°?????????
	while(r - l >= 1){
		int m = (l + r) / 2;
		if(s[m] == x) return true; //x??????????????£?????´???
		else if(s[m] > x) r = m;
		else if(s[m] < k) l = m + 1;
	}
	//x???????????????????????£?????´???
	return false;
}

int main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> s[i];
	}
	cin >> q;
	for(int i = 0; i < q; i++){
		cin >> t[i];
	}
	sort(s, s + n);
	for(int i = 0; i < q; i++){
		if(binary_search(t[i])) ans++;		
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'bool binary_search(int)':
a.cc:17:32: error: 'k' was not declared in this scope
   17 |                 else if(s[m] < k) l = m + 1;
      |                                ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int i, sIdx, tIdx;
	int nS, qT;
	int low, high, mid, target;
	int count = 0,
		cTabele[10000000] = { 0 };

	cin >> nS;
	//cout << "???????????°???n " << n << endl;
	int S[nS] = { 0 };
	for (i = 0; i < nS; ++i)
	{
		cin >> S[i];
	}

	//cout << "???????????°???sizeof(S)/sizeof(int) " << sizeof(S)/sizeof(int) << endl;

	cin >> qT;
	//cout << "???????????°???q " << q << endl;
	int T[qT] = { 0 };
	for (i = 0; i < qT; ++i)
	{
		cin >> T[i];
	}

	//cout << "???????????°???sizeof(T)/sizeof(int) " << sizeof(T)/sizeof(int) << endl;

	//?????????
	sort(S, S + nS);

	//????????¢?´¢
	for (tIdx = 0; tIdx < qT; ++tIdx)
	{
		low = 0, high = nS - 1, mid, target = T[tIdx];
		//cout << "???????????°???tIdx= " << tIdx << endl;
		while (1)
		{
			mid = (low + high) / 2;
			//cout << "???????????°??? " << low << " " << mid << " " << high << endl;

			if (S[mid] == target)
			{
				//cout << "???????????°??? " << target <<" is found at " << mid << endl;
				++cTabele[target-1];
				break;
			}
			else if (S[mid] < target)
			{
				low = mid + 1;
			}
			else
			{
				high = mid - 1;
			}

			if (high < low)
			{
				//cout << ???????????°??? "" << target <<" is not found "<< endl;
				break;
			}
		}
	}

	/*
	for (tIdx = 0; tIdx < qT; ++tIdx)
	{
	//cout << "???????????°???tIdx= " << tIdx << endl;
	for (sIdx = 0; sIdx < nS; ++sIdx)
	{
	if (T[tIdx]==S[sIdx])
	{
	//cout << "???????????°??? " << T[tIdx] << " " << S[sIdx] << endl;
	++count;
	break;
	}
	}

	}
	*/
	for (int i = 0; i < 10000000; ++i)
	{
		if (cTable[i]!=0)
		{
			++count;
		}
	}

	cout << count << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:21: error: 'cTable' was not declared in this scope; did you mean 'cTabele'?
   87 |                 if (cTable[i]!=0)
      |                     ^~~~~~
      |                     cTabele
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n, q, res = 0;
	cin >> n;
	vector<int> S(n);
	for (int i = 0; i < n; i++) {
		cin >> S[i];
	}
	sort(S.begin(), S.end());
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> T[i];
		if (binary_search(S.begin(), S.end(), T[i])) {
			res++;
		}
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'T' was not declared in this scope
   15 |                 cin >> T[i];
      |                        ^
Language: C++

#include<iostream>

using namespace std;

int main(){
int n[10000]={0};
int q[50000]={0};
int c=0;
int a=0;
int b=0;

cin>>a;
for(int i=0;i<a;i++){
cin>>n[i];
}

cin>>b;
for(int i=0;i<b;i++){
cin>>q[i];
}


for(int i=0;i<a;i++){
  for(int j=0;j<b;j++){
if(c[i]==q[j]){
   cout<<c[i]<<endl;
}
  }
}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: invalid types 'int[int]' for array subscript
   25 | if(c[i]==q[j]){
      |     ^
a.cc:26:11: error: invalid types 'int[int]' for array subscript
   26 |    cout<<c[i]<<endl;
      |           ^
Language: C++

?????????
 #include <stdio.h>
int hairetu[10000001]={};
    
int main(void){
    int cnt=0,i,n,q,s,t;
    scanf("%d",&n);
    for(i = 0;i < n;i++){
        scanf("%d",&s);
        if(hairetu[s]==0){
            hairetu[s]+=1;
        }
    }
    scanf("%d",&q);
    for(i = 0;i < q;i++){
        scanf("%d",&t);
        if(hairetu[t]==1){
            hairetu[t]+=1;
        }
    }
    for(i = 0;i < 10000001;i++){
        if(hairetu[i]>=2) cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

Compiler output:
a.cc:1:1: error: expected unqualified-id before '?' token
    1 | ?????????
      | ^
a.cc: In function 'int main()':
a.cc:7:5: error: 'scanf' was not declared in this scope
    7 |     scanf("%d",&n);
      |     ^~~~~
a.cc:24:5: error: 'printf' was not declared in this scope
   24 |     printf("%d\n",cnt);
      |     ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 |  #include <stdio.h>
  +++ |+#include <cstdio>
    3 | int hairetu[10000001]={};
Language: C++

#include <stdio.h>
#include <algorithm>
int main(){
  int S[100000];
  int T[50000];
  int n ,q ,i ,k ,t ,c=0 ,low=0 ,mid ,high;
  scanf("%d" ,&n);
  for(i=0 ;i<n ;i++){
    scanf("%d" ,&S[i]);
  }
  std::sort(&S[0] ,&S[n-1]);
  scanf("%d" ,&q);
  for(k=0 ;k<q ;k++){
    scanf("%d" ,&T[k]);
  }
  for(i=0 ;i<q ;i++){
    while(1){
      high=n-1;
      mid=(low+high)/2;
      if(S(mid) == T[i]){
        c++;
        break
      }
      else if(S(mid)<T)low=mid+1;
      else high=mid-1;
      if(high<low)break;
    }
  }
  printf("%d\n" ,c);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: 'S' cannot be used as a function
   20 |       if(S(mid) == T[i]){
      |          ~^~~~~
a.cc:22:14: error: expected ';' before '}' token
   22 |         break
      |              ^
      |              ;
   23 |       }
      |       ~       
a.cc:24:16: error: 'S' cannot be used as a function
   24 |       else if(S(mid)<T)low=mid+1;
      |               ~^~~~~
Language: C++

#include <stdio.h>
#include <algorithm>
int main(){
  int S[100000];
  int T[50000];
  int n ,q ,i ,k ,t ,c=0 ,low=0 ,mid ,high;
  scanf("%d" ,&n);
  for(i=0 ;i<n ;i++){
    scanf("%d" ,&S[i]);
  }
  std::sort(&S[0] ,&S[n-1]);
  scanf("%d" ,&q);
  for(k=0 ;k<q ;k++){
    scanf("%d" ,&T[k]);
  }
  for(i=0 ;i<q ;i++){
    while(1){
      high=n-1;
      mid=(low+high)/2;
      if(S[mid] == T[i]){
        c++;
        break
      }
      else if(S[mid]<T)low=mid+1;
      else high=mid-1;
      if(high<low)break;
    }
  }
  printf("%d\n" ,c);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: expected ';' before '}' token
   22 |         break
      |              ^
      |              ;
   23 |       }
      |       ~       
a.cc:24:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |       else if(S[mid]<T)low=mid+1;
      |               ~~~~~~^~
Language: C++

#include<cstdio>
#include<iostream>

using namespace std;

bool jud[10000000];
int main(void){
  int n1,n2,count=0,input;
  int i;

  scanf("%d",&n1);

  for(i=0;i<n1;i++){
    scanf("%d",&input);
    jud[input] = true;
  }

  scanf("%d",&n2);

  for(i=0;i<n2;i++){
    scanf("%d",&input);
    if(jud[input]==ture){
      count++;
    }
  }

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

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: 'ture' was not declared in this scope
   22 |     if(jud[input]==ture){
      |                    ^~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
int n,q,s[110000],t[110000];
cin >> n;
for(int i=0;i<n;i++)cin >> s[i]
sort(s,s+n);
cin >> q;
for(int i=0;i<q;i++)cin >> t[i];

int ans = 0;
for(int i=0;i<q;i++)
if(lower_bound(s,s+n,t[i])-s <n)ans++;
cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:32: error: expected ';' before 'sort'
    8 | for(int i=0;i<n;i++)cin >> s[i]
      |                                ^
      |                                ;
    9 | sort(s,s+n);
      | ~~~~
Language: C++

#include<iostream>
using namespace std;
void QSort(int x[ ], int left, int right);
void Swap(int x[ ], int i, int j);

int main(){
  int n,q,s[100000],t[50000];
  cin >> n;
  for(int i=0;i<n;i++)
        cin>>s[i];

  cin >> q;
  for(int i=0;i<q;i++)
        cin>>t[i];

  QSort(s,0,n-1);
//  QSort(t,0,q-1);

  int counter=0;
  for(int i=q-1;i>=0;i--){
    for(int j=0;j<n;j++){
       if(s[j]>t[i])  {j=n; } 
       if(s[j]==t[i]) { counter++; j=n; }       
    }
   }
   cout << counter << endl;
   return 0;
}

Compiler output:
/usr/bin/ld: /tmp/cc9SxnQI.o: in function `main':
a.cc:(.text+0xc3): undefined reference to `QSort(int*, int, int)'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;


bool serch(int* list,int min,int max,int x){
	//cout<<min<<" "<<max<<" "<<x<<endl;
	int med;
	while(min<max){
		med=(min+max)/2;
		if(list[mid]==x)return 1;
		else if(list[mid]<x)min=mid+1;
		else max=mid-1;
	}
	return 0;
}

int main(){
	int list[100010];
	int n;
	int q,in;
	int ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>list[i];
	}
	sort(list,list+n);
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>in;
		if(serch(list,0,n-1,in)){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'bool serch(int*, int, int, int)':
a.cc:11:25: error: 'mid' was not declared in this scope; did you mean 'med'?
   11 |                 if(list[mid]==x)return 1;
      |                         ^~~
      |                         med
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;


bool serch(int* list,int min,int max,int x){
	//cout<<min<<" "<<max<<" "<<x<<endl;
	int med;
	while(min<max){
		med=(min+max)/2;
		if(list[mid]==x){
			return 1;
		}else if(list[mid]<x){
			min=mid+1;
		}else{
			max=mid-1;
		}
	}
	return 0;
}

int main(){
	int list[100010];
	int n;
	int q,in;
	int ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>list[i];
	}
	sort(list,list+n);
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>in;
		if(serch(list,0,n-1,in)){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'bool serch(int*, int, int, int)':
a.cc:11:25: error: 'mid' was not declared in this scope; did you mean 'med'?
   11 |                 if(list[mid]==x){
      |                         ^~~
      |                         med
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double n,q;
  bool s[1000000]={0};
  double b;
  int a=0;
  cin>>n;
  for(double i=0;i<n;i++){
    cin>>b;
    s[b]=true;
  }
  cin>>q;
  for(double i=0;i<q;i++){
    cin>>b;
    if(s[b]==true){a++;}
  }
  cout<<a<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:6: error: invalid types 'bool [1000000][double]' for array subscript
   12 |     s[b]=true;
      |      ^
a.cc:17:9: error: invalid types 'bool [1000000][double]' for array subscript
   17 |     if(s[b]==true){a++;}
      |         ^
Language: C++

#include<iostream>
#include<bitset>
int n,tmp,ans=0;
int main(){
	std::bitset<32000000> list;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>tmp;
		list[tmp]=1;
	}
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>tmp;
		ans+=list[tmp];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin>>n;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:16:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   16 |         cout<<ans;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include <algorithm>
#include <set>
using namespace std;

int n,q,C;
set<int> ns;
main(){
  int t;
  scanf("%d",&n);
  while(n--){
    scanf("%d",&t);
    ns.insert(t);
  }
  scanf("%d",&q);
  while(q--){
    scanf("%d",&t);
    if(ns.find(t)!=ns.end())
      ++C;
  }
  printf("%d\n",C);
}

Compiler output:
a.cc:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:3: error: 'scanf' was not declared in this scope
    9 |   scanf("%d",&n);
      |   ^~~~~
a.cc:20:3: error: 'printf' was not declared in this scope
   20 |   printf("%d\n",C);
      |   ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <set>
  +++ |+#include <cstdio>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<stdio.h>

#define     MAX_COUNT_N     100000
#define     MAX_COUNT_Q     50000

using namespace std;

int main(){
	int n,q,cnt = 0;
	vector<int> S;
	int i,buf;
	int a,b,m;

	// 集合 S の個数を入力
	cin >> n;

	// 入力のチェック
	if((n < 1) || (n > ((int)(MAX_COUNT_N)))){
		cerr << "Error : The input number is out of range." << endl;
		return -1;
	}

	// 集合 S の中身を入力
	for(i=0;i<n;i++){
		cin >> buf;
		S.push_back(buf);
	}

	// 集合 T の個数を入力
	cin >> q;

	// 入力のチェック
	if((q < 1) || (q > ((int)(MAX_COUNT_Q)))){
		cerr << "Error : The input number is out of range." << endl;
		return -1;
	}

	// ソート
	sort(S.begin(),S.end());

	// 検索
	for(i=0;i<q;i++){
		// データの入力
		scanf_s("%d",&buf);
		// 二分検索
		a = 0;
		b = S.size() - 1;
		while (a <= b){
			m = (a + b) / 2;
			if(S[m] == buf){
				cnt++;
				break;
			}else if(S[m] > buf){
				b = m - 1;
			}else if(S[m] < buf){
				a = m + 1;
			}else{
				cerr << "BinarySearchError!!" << endl << endl;
				cerr << "S[" << m << "] = " << S[m] << endl;
				cerr << "buf = " << buf << endl;
				cerr << i << " / " << q << endl << endl;
				return -1;
			}
		}
	}

	// 出力
	cout << cnt << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   47 |                 scanf_s("%d",&buf);
      |                 ^~~~~~~
      |                 scanf
Language: C++




#include <stdio.h> int quick_sort(int left, int right, int * n)//{    int pivot, i, j, buf;         if (left >= right) return 0;     pivot = n[(left + right) / 2];    for (i = left, j = right; i < j; ) {    while (n[i] < pivot) i++;    while (n[j] > pivot) j--;    if (i <= j) {        buf = n[i];        n[i] = n[j];        n[j] = buf;        i++;        j--;    }    }    quick_sort(left, j, n);    quick_sort(i, right, n);} main(){    int i, j, n, S[100000], q, T[50000], count = 0, buf = 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]);    }     quick_sort(0, n - 1, S);     for (i = 0; i < q; i++) {    for (j = 0; j < n/*S[j] <= T[i]*/; j++) {        if (S[j] > T[i]) break;        else if (buf == S[j]) continue;        else if (S[j] == T[i]) {        count++;        buf = S[j];        }    }    }    printf("%d\n", count);         return 0;} 

Compiler output:
a.cc:4:20: warning: extra tokens at end of #include directive
    4 | #include <stdio.h> int quick_sort(int left, int right, int * n)//{    int pivot, i, j, buf;         if (left >= right) return 0;     pivot = n[(left + right) / 2];    for (i = left, j = right; i < j; ) {    while (n[i] < pivot) i++;    while (n[j] > pivot) j--;    if (i <= j) {        buf = n[i];        n[i] = n[j];        n[j] = buf;        i++;        j--;    }    }    quick_sort(left, j, n);    quick_sort(i, right, n);} main(){    int i, j, n, S[100000], q, T[50000], count = 0, buf = 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]);    }     quick_sort(0, n - 1, S);     for (i = 0; i < q; i++) {    for (j = 0; j < n/*S[j] <= T[i]*/; j++) {        if (S[j] > T[i]) break;        else if (buf == S[j]) continue;        else if (S[j] == T[i]) {        count++;        buf = S[j];        }    }    }    printf("%d\n", count);         return 0;}
      |                    ^~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h> 
int quick_sort(int left, int right, int * n)//{    int pivot, i, j, buf;         if (left >= right) return 0;     pivot = n[(left + right) / 2];    for (i = left, j = right; i < j; ) {    while (n[i] < pivot) i++;    while (n[j] > pivot) j--;    if (i <= j) {        buf = n[i];        n[i] = n[j];        n[j] = buf;        i++;        j--;    }    }    quick_sort(left, j, n);    quick_sort(i, right, n);} main(){    int i, j, n, S[100000], q, T[50000], count = 0, buf = 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]);    }     quick_sort(0, n - 1, S);     for (i = 0; i < q; i++) {    for (j = 0; j < n/*S[j] <= T[i]*/; j++) {        if (S[j] > T[i]) break;        else if (buf == S[j]) continue;        else if (S[j] == T[i]) {        count++;        buf = S[j];        }    }    }    printf("%d\n", count);         return 0;}

Compiler output:
a.cc:2:45: error: expected initializer at end of input
    2 | int quick_sort(int left, int right, int * n)//{    int pivot, i, j, buf;         if (left >= right) return 0;     pivot = n[(left + right) / 2];    for (i = left, j = right; i < j; ) {    while (n[i] < pivot) i++;    while (n[j] > pivot) j--;    if (i <= j) {        buf = n[i];        n[i] = n[j];        n[j] = buf;        i++;        j--;    }    }    quick_sort(left, j, n);    quick_sort(i, right, n);} main(){    int i, j, n, S[100000], q, T[50000], count = 0, buf = 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]);    }     quick_sort(0, n - 1, S);     for (i = 0; i < q; i++) {    for (j = 0; j < n/*S[j] <= T[i]*/; j++) {        if (S[j] > T[i]) break;        else if (buf == S[j]) continue;        else if (S[j] == T[i]) {        count++;        buf = S[j];        }    }    }    printf("%d\n", count);         return 0;}
      |                                             ^
Language: C++

#include <stdio.h>#include <stdlib.h>#define MAX 100000int intcmp( const void * a , const void * b ) {  /* 引数はvoid*型と規定されているのでint型にcastする */  if(*(int *)a < *(int *)b){    return -1;  }else if(*(int *)a == *(int *)b){    return 0;  }  return 1;}int main(){    int n, q;    int s[MAX], t[MAX];    int i, j=0, 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]);    }    qsort((void *)s, n, sizeof(s[0]), intcmp);    qsort((void *)t, q, sizeof(t[0]), intcmp);    // sの入力は重複ありだが、カウントの重複は認められない。    for(i=0;i<q;i++){        for(;j<n;j++){            if(t[i]==s[j]){                count++;                j++;                break;            }else if(t[i]<s[j]){                break;            }        }    }    printf("%d\n", count);    return 0;}

Compiler output:
a.cc:1:19: warning: extra tokens at end of #include directive
    1 | #include <stdio.h>#include <stdlib.h>#define MAX 100000int intcmp( const void * a , const void * b ) {  /* 引数はvoid*型と規定されているのでint型にcastする */  if(*(int *)a < *(int *)b){    return -1;  }else if(*(int *)a == *(int *)b){    return 0;  }  return 1;}int main(){    int n, q;    int s[MAX], t[MAX];    int i, j=0, 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]);    }    qsort((void *)s, n, sizeof(s[0]), intcmp);    qsort((void *)t, q, sizeof(t[0]), intcmp);    // sの入力は重複ありだが、カウントの重複は認められない。    for(i=0;i<q;i++){        for(;j<n;j++){            if(t[i]==s[j]){                count++;                j++;                break;            }else if(t[i]<s[j]){                break;            }        }    }    printf("%d\n", count);    return 0;}
      |                   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;
int main(){
	int n, m, S[100000], T[50000], i, j, r = 0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> S[i];
	}
	cin >> m;
	for(i=0;i<m;i++){
		cin >> T[i];
	}
	sort(S, S+n);
	sort(T, T+m);
	i = 0;
            j = 0;
	while(i < n && j < q){
		if(S[i] == T[j]){
			i++, j++, r++;
		}else if(S[i] < T[j]){
			i++;
		}else{
			j++;
		}
	}
	cout << r << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: 'q' was not declared in this scope
   19 |         while(i < n && j < q){
      |                            ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n, m, S[100000], T[50000], i, j, res = 0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> S[i];
	}
	cin >> q;
	for(i=0;i<q;i++){
		cin >> T[i];
	}
	sort(S, S+n);
	sort(T, T+q);
	i = j = 0;
	while(i < n && j < q){
		if(S[i] == T[j]){
			i++, j++, res++;
		}else if(S[i] < T[j]){
			i++;
		}else{
			j++;
		}
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'q' was not declared in this scope
   10 |         cin >> q;
      |                ^
Language: C++

#include <iostream>#include <vector>#include <algorithm>using namespace std; int main(){    int i, n, q, counter, num = 0;    vector<int> s, t;    cin >> n;    for(i = 0; i < n; i++){        cin >> num;        s.push_back(num);    }    sort(s.begin(), s.end());    cin >> q;    for(i = 0; i < q; i++){        cin >> num;        t.push_back(num);    }    sort(t.begin(), t.end());    counter = 0;    for(i = 0; i < q; i++){        if(binary_search(s.begin(), s.end(), t[i])){            counter++;        }    }    cout << counter << endl;    return(0);}

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>#include <vector>#include <algorithm>using namespace std; int main(){    int i, n, q, counter, num = 0;    vector<int> s, t;    cin >> n;    for(i = 0; i < n; i++){        cin >> num;        s.push_back(num);    }    sort(s.begin(), s.end());    cin >> q;    for(i = 0; i < q; i++){        cin >> num;        t.push_back(num);    }    sort(t.begin(), t.end());    counter = 0;    for(i = 0; i < q; i++){        if(binary_search(s.begin(), s.end(), t[i])){            counter++;        }    }    cout << counter << endl;    return(0);}
      |                    ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>#include<algorithm>#include<vector> using namespace std; int main(void){  int n,s,q,t,count;  vector<int>num;   cin >> n;   for(int i=0;i<n;i++){    cin >> s;    num.push_back(s);  }   sort(num.begin(),num.end());   cin >> q;  count=0;  for(int i=0;i<q;i++){    cin >> t;    count+=binary_search(num.begin(),num.end(),t);    //count+=lower_bound(num.begin(),num.end(),t)-lower_bound(num.begin(),num.end(),t-1);  }  cout << count << endl;  return 0;}

Compiler output:
a.cc:1:19: warning: extra tokens at end of #include directive
    1 | #include<iostream>#include<algorithm>#include<vector> using namespace std; int main(void){  int n,s,q,t,count;  vector<int>num;   cin >> n;   for(int i=0;i<n;i++){    cin >> s;    num.push_back(s);  }   sort(num.begin(),num.end());   cin >> q;  count=0;  for(int i=0;i<q;i++){    cin >> t;    count+=binary_search(num.begin(),num.end(),t);    //count+=lower_bound(num.begin(),num.end(),t)-lower_bound(num.begin(),num.end(),t-1);  }  cout << count << endl;  return 0;}
      |                   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
using namespace std;

bool search( i , q ){
  
  int r = q;
  int l = 0;
  
  while( r - 1 >= l ){
    
    x = ( S[r] + S[l] ) / 2;
    
    if( C[i] == x ){
      return true;
    }
    else if( C[i] < x ) r = x;
    else l = x;  
  }
  return false;
}


int main(void){
  
  int S[100000];
  int C[50000];
  int n,q,k = 0;

  cin >> n;
  for( int i = 0 ; i < n ; i++ ){
    cin >> S[i];
  }

  cin >> q;
  for( int i = 0 ; i < q ; i++ ){
    cin >> C[i];
  } 

  sort( S , S + n);
  sort( C , C + q);


  for( int i = 0 ; i < q ; i++ ){
    if( seatch ( i , q ) ){
      k++;
    }
  }

  cout << k << endl;

Compiler output:
a.cc:4:14: error: 'i' was not declared in this scope
    4 | bool search( i , q ){
      |              ^
a.cc:4:18: error: 'q' was not declared in this scope
    4 | bool search( i , q ){
      |                  ^
a.cc:4:20: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | bool search( i , q ){
      |                    ^
a.cc: In function 'int main()':
a.cc:39:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   39 |   sort( S , S + n);
      |   ^~~~
      |   short
a.cc:44:9: error: 'seatch' was not declared in this scope; did you mean 'search'?
   44 |     if( seatch ( i , q ) ){
      |         ^~~~~~
      |         search
a.cc:49:21: error: expected '}' at end of input
   49 |   cout << k << endl;
      |                     ^
a.cc:23:15: note: to match this '{'
   23 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

bool search( i , q ){
  
  int r = q;
  int l = 0;
  
  while( r - 1 >= l ){
    
    x = ( S[r] + S[l] ) / 2;
    
    if( C[i] == x ){
      return true;
    }
    else if( C[i] < x ) r = x;
    else l = x;  
  }
  return false;
}


int main(void){
  
  int S[100000];
  int C[50000];
  int n,q,k = 0;

  cin >> n;
  for( int i = 0 ; i < n ; i++ ){
    cin >> S[i];
  }

  cin >> q;
  for( int i = 0 ; i < q ; i++ ){
    cin >> C[i];
  } 

  sort( S , S + n);
  sort( C , C + q);


  for( int i = 0 ; i < q ; i++ ){
    if( seatch ( i , q ) ){
      k++;
    }
  }

  cout << k << endl;

  return 0;
}

Compiler output:
a.cc:5:14: error: 'i' was not declared in this scope
    5 | bool search( i , q ){
      |              ^
a.cc:5:18: error: 'q' was not declared in this scope
    5 | bool search( i , q ){
      |                  ^
a.cc:5:20: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | bool search( i , q ){
      |                    ^
a.cc: In function 'int main()':
a.cc:45:9: error: 'seatch' was not declared in this scope; did you mean 'search'?
   45 |     if( seatch ( i , q ) ){
      |         ^~~~~~
      |         search
Language: C++

using System;
using System.Collections;

class main
{
    static void Main(string[] args)
    {
        Console.ReadLine();
        string[] s = Console.ReadLine().Split(' ');
        bool[] a = new bool[10000001];
        for(int j = 0; j < s.Length; ++j)
        {
            a[int.Parse(s[j])] = true;
        }
        Console.ReadLine();
        //string[] n = Console.ReadLine().Split(' ');
        int d = 0;
        /*for (int i = 0; i < n.Length; ++i )
        {
            if (a[int.Parse(n[i])])
            {
                ++d;
            }
        }*/
        Console.WriteLine(d);
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections;
      |       ^~~~~~
a.cc:6:22: error: 'string' has not been declared
    6 |     static void Main(string[] args)
      |                      ^~~~~~
a.cc:6:31: error: expected ',' or '...' before 'args'
    6 |     static void Main(string[] args)
      |                               ^~~~
a.cc:27:2: error: expected ';' after class definition
   27 | }
      |  ^
      |  ;
a.cc: In static member function 'static void main::Main(int*)':
a.cc:8:9: error: 'Console' was not declared in this scope
    8 |         Console.ReadLine();
      |         ^~~~~~~
a.cc:9:9: error: 'string' was not declared in this scope
    9 |         string[] s = Console.ReadLine().Split(' ');
      |         ^~~~~~
a.cc:9:16: error: expected primary-expression before ']' token
    9 |         string[] s = Console.ReadLine().Split(' ');
      |                ^
a.cc:10:13: error: structured binding declaration cannot have type 'bool'
   10 |         bool[] a = new bool[10000001];
      |             ^~
a.cc:10:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:10:13: error: empty structured binding declaration
a.cc:10:16: error: expected initializer before 'a'
   10 |         bool[] a = new bool[10000001];
      |                ^
a.cc:11:28: error: 's' was not declared in this scope
   11 |         for(int j = 0; j < s.Length; ++j)
      |                            ^
a.cc:13:13: error: 'a' was not declared in this scope
   13 |             a[int.Parse(s[j])] = true;
      |             ^
a.cc:13:15: error: expected primary-expression before 'int'
   13 |             a[int.Parse(s[j])] = true;
      |               ^~~
a.cc:13:15: error: expected ']' before 'int'
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(void){
	
	int n,cnt=0;
	string str,inp;

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>inp;
		str+=inp+",";
	}
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>inp;
		if(str.find(inp)!=string::npos) cnt++;
	}
	cout<<cnt<<endl;
	cin>>inp;
	return 0;
}#include<iostream>
#include<string>
using namespace std;
int main(void){
	
	int n,cnt=0;
	string str,inp;

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>inp;
		str+=inp+",";
	}
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>inp;
		if(str.find(inp)!=string::npos) cnt++;
	}
	cout<<cnt<<endl;
	cin>>inp;
	return 0;
}

Compiler output:
a.cc:22:2: error: stray '#' in program
   22 | }#include<iostream>
      |  ^
a.cc:22:3: error: 'include' does not name a type
   22 | }#include<iostream>
      |   ^~~~~~~
a.cc:25:5: error: redefinition of 'int main()'
   25 | int main(void){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(void){
      |     ^~~~
Language: C++

#include <algolithm>
#include <iostream>
#include <cstdio>
using namespace std;

int main(void){
	int S[10010], T[50010];
	int n, q;
	int C = 0;
	
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> S[i];
	
	cin >> q;
	for(int i = 0; i < q; i++)
		cin >> T[i];
	
	sort(S, S + n);
	sort(T, T + q);
	
	for(int i = 0, j = 0; i < q; i++){
		while(S[j] < T[i] && j < n)
		if(S[j] == T[i])
			C++;
	}
	
	cout << C << endl;
}

Compiler output:
a.cc:1:10: fatal error: algolithm: No such file or directory
    1 | #include <algolithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <algolithm>
#include <iostream>
#include <cstdio>
using namespace std;

int main(void){
	int S[10010], T[50010];
	int n, q;
	int C = 0;
	
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> S[i];
	
	cin >> q;
	for(int i = 0; i < q; i++)
		cin >> T[i];
	
	sort(S, S + n);
	sort(T, T + q);
	
	for(int i = 0, j = 0; i < q; i++){
		while(S[j] < T[i] && j < n)
		if(S[j] == T[i])
			C++;
	}
	
	cout << C << endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: algolithm: No such file or directory
    1 | #include <algolithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>
#include <string.h>

using namespace std;

int comp(const void *a, const void *b){
	const int *a_ = a, *b_ = b;
	return a-b;
}

int main(){
	int s[100000],t;
	int i,j,sn,tn,n=0;
	cin>>sn;
	for(i=0;i<sn;i++){
		cin>>s[i];
	}
	sort(s,s+sn);
	cin>>tn;
	for(i=0;i<tn;i++){
		cin>>t;
		if(bsearch(&t,s,sn,sizeof(int), comp)!= NULL){
			n++;
		}
	}
	cout<<n<<endl;
	while(1);
	return 0;
}

Compiler output:
a.cc: In function 'int comp(const void*, const void*)':
a.cc:8:25: error: invalid conversion from 'const void*' to 'const int*' [-fpermissive]
    8 |         const int *a_ = a, *b_ = b;
      |                         ^
      |                         |
      |                         const void*
a.cc:8:34: error: invalid conversion from 'const void*' to 'const int*' [-fpermissive]
    8 |         const int *a_ = a, *b_ = b;
      |                                  ^
      |                                  |
      |                                  const void*
a.cc:9:18: error: invalid use of 'const void'
    9 |         return a-b;
      |                  ^