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

#include<stdio.h>

int main(void) {
	int s[10000], t[500], n, q, i, c = 0, j;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &s[i]);
	}
	
	scanf("%d", &q);
	for (i = 0; i < q; i++)
	{
		scanf("%d", &t[i]);
	}
	
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			if (s[i] == t[j])
			{
				count++;
			}
		}
	}
	
	printf("%d\n", c);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:33: error: 'count' was not declared in this scope
   24 |                                 count++;
      |                                 ^~~~~
Language: C++

#include<stdio.h>

int main(void) {
	int s[10000], t[500], n, q, i, c = 0, j;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &s[i]);
	}
	
	scanf("%d", &q);
	for (i = 0; i < q; i++)
	{
		scanf("%d", &t[i]);
	}
	
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < q; j++)
		{
			if (s[i] == t[j])
			{
				c++;
			}
		}
	}
	
	printf("%d\n", c);
}#include<stdio.h>

Compiler output:
a.cc:30:2: error: stray '#' in program
   30 | }#include<stdio.h>
      |  ^
a.cc:30:3: error: 'include' does not name a type
   30 | }#include<stdio.h>
      |   ^~~~~~~
Language: C++

#define REP(i,n) for (int i=0;i<(n);i++)
#define pb push_back
#define all(a) (a).begin(),(a).end()
using namespace std;

int main(){
	int n,q,s,temp,i,j;
	int count=0;
	vector<int> S;
	cin>>n;
	REP(i,n){
		cin>>s;
		//S.push_back(s);
		S.pb(s);
	}
	
	//sort(S.begin(),S.end());
	sort(all(S));

	REP(i,n){
		FOR(j,i+1,n){
			if(S[i]==S[j])S[i]=-1;
			else if(S[i]<S[j])break;
		}
	}

	cin>>q;
	REP(i,q){
		cin>>temp;
		REP(j,n){
			if(temp==S[j])count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<int> S;
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define REP(i,n) for (int i=0;i<(n);i++)
a.cc:9:16: error: expected primary-expression before 'int'
    9 |         vector<int> S;
      |                ^~~
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         cin>>n;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define REP(i,n) for (int i=0;i<(n);i++)
a.cc:14:17: error: 'S' was not declared in this scope
   14 |                 S.pb(s);
      |                 ^
a.cc:18:18: error: 'S' was not declared in this scope
   18 |         sort(all(S));
      |                  ^
a.cc:3:17: note: in definition of macro 'all'
    3 | #define all(a) (a).begin(),(a).end()
      |                 ^
a.cc:18:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |         sort(all(S));
      |         ^~~~
      |         short
a.cc:21:17: error: 'FOR' was not declared in this scope
   21 |                 FOR(j,i+1,n){
      |                 ^~~
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout<<count<<endl;
      |         ^~~~
a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:22: error: 'endl' was not declared in this scope
   34 |         cout<<count<<endl;
      |                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define REP(i,n) for (int i=0;i<(n);i++)
Language: C++

#include<iostream>
#include<vector>
#define FOR(i,k,n) for((i)=(k);(i)<(n);(i)++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define pb push_back
#define all(a) (a).begin(),(a).end()
using namespace std;

int main(){
	int n,q,s,temp,i,j;
	int count=0;
	vector<int> S;
	cin>>n;
	REP(i,n){
		cin>>s;
		//S.push_back(s);
		S.pb(s);
	}
	
	//sort(S.begin(),S.end());
	sort(all(S));

	REP(i,n){
		FOR(j,i+1,n){
			if(S[i]==S[j])S[i]=-1;
			else if(S[i]<S[j])break;
		}
	}

	cin>>q;
	REP(i,q){
		cin>>temp;
		REP(j,n){
			if(temp==S[j])count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |         sort(all(S));
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<vector>
#include<stdio.h>
#define FOR(i,k,n) for((i)=(k);(i)<(n);(i)++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define pb push_back
#define all(a) (a).begin(),(a).end()
using namespace std;

int main(){
	int n,q,s,temp,i,j;
	int count=0;
	vector<int> S;
	cin>>n;
	REP(i,n){
		cin>>s;
		//S.push_back(s);
		S.pb(s);
	}
	
	//sort(S.begin(),S.end());
	sort(all(S));

	REP(i,n){
		FOR(j,i+1,n){
			if(S[i]==S[j])S[i]=-1;
			else if(S[i]<S[j])break;
		}
	}

	cin>>q;
	REP(i,q){
		cin>>temp;
		REP(j,n){
			if(temp==S[j])count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(all(S));
      |         ^~~~
      |         short
Language: C++

#include<iostream>

using namespace std;

int main(void){
    int i,j,n,q,S,T,ans=0;
    cin >> n;
    for(i=0;i<n;i++) cin >> S[i];
    cin >> q;
    for(i=0;i<q;i++) cin >> T[i];
    for(i=0;i<q;i++){
        for(j=0;j<n;j++){
            if(T[i]==S[j]){
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:30: error: invalid types 'int[int]' for array subscript
    8 |     for(i=0;i<n;i++) cin >> S[i];
      |                              ^
a.cc:10:30: error: invalid types 'int[int]' for array subscript
   10 |     for(i=0;i<q;i++) cin >> T[i];
      |                              ^
a.cc:13:17: error: invalid types 'int[int]' for array subscript
   13 |             if(T[i]==S[j]){
      |                 ^
a.cc:13:23: error: invalid types 'int[int]' for array subscript
   13 |             if(T[i]==S[j]){
      |                       ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
int S[MAX_N];
int T[MAX_N];
int SN, SQ;

int main() {

	cin >> SN;
	rep(i, SN){ cin >> S[i]; }
	cin >> SQ;
	rep(i, SQ){ cin >> Q[i]; }

	int ct = 0;
	rep(i, SQ){
		int flag = 0;
		rep(j, SN){ (if S[j] == S[i)) flag++; break; }
		ct += flag;
	}
	cout << ct << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:28: error: 'Q' was not declared in this scope
   33 |         rep(i, SQ){ cin >> Q[i]; }
      |                            ^
a.cc:38:30: error: expected primary-expression before 'if'
   38 |                 rep(j, SN){ (if S[j] == S[i)) flag++; break; }
      |                              ^~
a.cc:38:30: error: expected ')' before 'if'
   38 |                 rep(j, SN){ (if S[j] == S[i)) flag++; break; }
      |                             ~^~
      |                              )
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
	vector<int>s, t;
	int n, q;
	cin >> n;
	for (int i = 0; i < n; i++){
		int a; cin >> a;
		s.push_back(a);
	}
	cin >> q;
	for (int i = 0; i < q; i++){
		int a; cin >> a;
		t.push_back(a);
	}
	int num = 0;
	for (int i = 0; i < q; i++){
		if (find(s.begin(), s.end(), t[i]) != s.end()) {
			num++;
		}
	}
	cout << num << endl;
	char c; cin >> c;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   19 |                 if (find(s.begin(), s.end(), t[i]) != s.end()) {
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:19:25: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   19 |                 if (find(s.begin(), s.end(), t[i]) != s.end()) {
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
int main(){
    int i, j;
    int n, q;
    int s[10000];
    int t[500];
    int count = 0;
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &s[i]);
    }
    scanf("%d", &q);
    for(i=0; i<q; i++){
        scanf("%d", &t[i]);
    for(i=0; i<n; i++){
        for(j=0; j<q; j++){
            if(s[i]==t[j]){
                count += 1;
            }
        }
    }
    printf("%d\n", &count);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: C++

#include<stdio.h>
int main(){
    int i, j;
    int n, q;
    int s[10000];
    int t[500];
    int count = 0;
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &s[i]);
    }
    scanf("%d", &q);
    for(i=0; i<q; i++){
        scanf("%d", &t[i]);
    for(i=0; i<n; i++){
        for(j=0; j<q; j++){
            if(s[i]==t[j]){
                count += 1;
            }
        }
    }
    printf("%d\n", count);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: C++

#include<stdio.h>

LinearSearch(int S[],int T[],int n,int q){
	int k = 0;
	for (int i = 0; i < q; i++){
		for (int j = 0; j < n; j++){
			if (T[i] == S[j]){
				k++;
				break;
			}
		}
	}
	return k;
}

int main(){
	int n, q;
	int S[10000], T[500];
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", S);
	}
	scanf("%d", &q);
	for (int i = 0; i < q; i++){
		scanf("%d", T);
	}
	printf("%d", LinearSearch(S, T, n, q));
	return 0;
}

Compiler output:
a.cc:3:1: error: ISO C++ forbids declaration of 'LinearSearch' with no type [-fpermissive]
    3 | LinearSearch(int S[],int T[],int n,int q){
      | ^~~~~~~~~~~~
Language: C++

#include<stdio.h>

linearSearch(int S[],int T[],int n,int q){
	int k = 0;
	for (int i = 0; i < q; i++){
		for (int j = 0; j < n; j++){
			if (T[i] == S[j]){
				k++;
				break;
			}
		}
	}
	return k;
}

int main(){
	int n, q;
	int S[10000], T[500];
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", S);
	}
	scanf("%d", &q);
	for (int i = 0; i < q; i++){
		scanf("%d", T);
	}
	printf("%d", LinearSearch(S, T, n, q));
	return 0;
}

Compiler output:
a.cc:3:1: error: ISO C++ forbids declaration of 'linearSearch' with no type [-fpermissive]
    3 | linearSearch(int S[],int T[],int n,int q){
      | ^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:27:22: error: 'LinearSearch' was not declared in this scope; did you mean 'linearSearch'?
   27 |         printf("%d", LinearSearch(S, T, n, q));
      |                      ^~~~~~~~~~~~
      |                      linearSearch
Language: C++

#include<stdio.h>

int linearSearch(int S[],int T[],int n,int q){
	int k = 0;
	for (int i = 0; i < q; i++){
		for (int j = 0; j < n; j++){
			if (T[i] == S[j]){
				k++;
				break;
			}
		}
	}
	return k;
}

int main(){
	int n, q;
	int S[10000], T[500];
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", S[i]);
	}
	scanf("%d", &q);
	for (int i = 0; i < q; i++){
		scanf("%d", T[j]);
	}
	printf("%d\n", linearSearch(S, T, n, q));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:31: error: 'j' was not declared in this scope
   25 |                 scanf("%d", T[j]);
      |                               ^
Language: C++

#include<iostream>
using namespace std;

bool LinearSerach(int x,int s[],int n){
	s[n] = x;
	for(int i=0;;i++){
		if(s[i]==x){
			return i;
		}else{
			return -1;
	}
}

int main(){
	int data1;
	cin >> data1;
	int* list1 = new int[data1];
	for(int i=0;i<data1;i++){
		cin >> list1[i];
	}

	int data2;
	cin >> data2;
	int* list2 = new int[data2];
	for(int i=0;i<data2;i++){
		cin >> list2[i];
	}

	int count=0;
	for(int i=0;i<data2;i++){
		if(LinearSearch(list2[i],list1,data1)!=-1)
			count++
	}
	
	cout << count << endl;
	return 0; 
}

Compiler output:
a.cc: In function 'bool LinearSerach(int, int*, int)':
a.cc:14:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   14 | int main(){
      |         ^~
a.cc:14:9: note: remove parentheses to default-initialize a variable
   14 | int main(){
      |         ^~
      |         --
a.cc:14:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:14:11: error: a function-definition is not allowed here before '{' token
   14 | int main(){
      |           ^
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:4:39: note: to match this '{'
    4 | bool LinearSerach(int x,int s[],int n){
      |                                       ^
Language: C++

#include<iostream>
using namespace std;

int LinearSerach(int x,int s[],int n){
	s[n] = x;
	for(int i=0;;i++){
		if(s[i]==x){
			return i;
		}else{
			return -1;
	}
}

int main(){
	int data1;
	cin >> data1;
	int* list1 = new int[data1];
	for(int i=0;i<data1;i++){
		cin >> list1[i];
	}

	int data2;
	cin >> data2;
	int* list2 = new int[data2];
	for(int i=0;i<data2;i++){
		cin >> list2[i];
	}

	int count=0;
	for(int i=0;i<data2;i++){
		if(LinearSearch(list2[i],list1,data1)!=-1)
			count++
	}
	
	cout << count << endl;
	return 0; 
}

Compiler output:
a.cc: In function 'int LinearSerach(int, int*, int)':
a.cc:14:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   14 | int main(){
      |         ^~
a.cc:14:9: note: remove parentheses to default-initialize a variable
   14 | int main(){
      |         ^~
      |         --
a.cc:14:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:14:11: error: a function-definition is not allowed here before '{' token
   14 | int main(){
      |           ^
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:4:38: note: to match this '{'
    4 | int LinearSerach(int x,int s[],int n){
      |                                      ^
Language: C++

#include<iostream>
using namespace std;

int LinearSerach(int x,int s[],int n){
	s[n] = x;
	for(int i=0;;i++){
		if(s[i]==x){
			return i;
		}else{
			return -1;
		}
	}
}

int main(){
	int data1;
	cin >> data1;
	int* list1 = new int[data1];
	for(int i=0;i<data1;i++){
		cin >> list1[i];
	}

	int data2;
	cin >> data2;
	int* list2 = new int[data2];
	for(int i=0;i<data2;i++){
		cin >> list2[i];
	}

	int count=0;
	for(int i=0;i<data2;i++){
		if(LinearSearch(list2[i],list1,data1)!=-1)
			count++
	}
	
	cout << count << endl;
	delete[] list1,list2;
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:20: error: 'LinearSearch' was not declared in this scope; did you mean 'LinearSerach'?
   32 |                 if(LinearSearch(list2[i],list1,data1)!=-1)
      |                    ^~~~~~~~~~~~
      |                    LinearSerach
a.cc:33:32: error: expected ';' before '}' token
   33 |                         count++
      |                                ^
      |                                ;
   34 |         }
      |         ~
Language: C++

#include <iostream>
using namespace std;

int linearSearch(int x,int S[],int n){
  int i=0;
  S[n]=x;
  while(S[i]!=x){
    i++;
  }
	if(i==n)
    return -1;
  return i; 
}           
 
int main(){
    int i,n,S[10000],q,T[10000],sum=0;
    cin>>n;
    for(i=0; i<n; i++){
        cin>>S[i];
    }
    cin>>q;
    for(i=0; i<q; i++){
        cin>>T[10000];
    for (int i=0;i<q;i++){
        for (int j=0;j<n;j++){
            if (T[i]==S[j]){
                sum++;
                break;
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:15:11: note: to match this '{'
   15 | int main(){
      |           ^
Language: C++

#include <stdio.h>
#define n 10000;
#define p 500;

int main(){
  int count=0,i,j,key,num1,num2;
  int row[define];


  scanf("%d",&num1);
  for(i=0;i<num1;i++)scanf("%d",&row[i]);
  scanf("%d",&num2);
  for(i=0;i<num2;i++){
    scanf("%d",&key);
  for(j=0;j<num1;j++){
    if(row[j]==key)count++;
  }
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: 'define' was not declared in this scope
    7 |   int row[define];
      |           ^~~~~~
a.cc:11:34: error: 'row' was not declared in this scope
   11 |   for(i=0;i<num1;i++)scanf("%d",&row[i]);
      |                                  ^~~
a.cc:16:8: error: 'row' was not declared in this scope
   16 |     if(row[j]==key)count++;
      |        ^~~
Language: C++

#include <stdio.h>
#define n 10000;
#define p 500;

int main(){
  int count=0,i,j,key,num1,num2;
  int row[n];


  scanf("%d",&num1);
  for(i=0;i<num1;i++)scanf("%d",&row[i]);
  scanf("%d",&num2);
  for(i=0;i<num2;i++){
    scanf("%d",&key);
  for(j=0;j<num1;j++){
    if(row[j]==key)count++;
  }
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:2:16: error: expected ']' before ';' token
    2 | #define n 10000;
      |                ^
a.cc:7:11: note: in expansion of macro 'n'
    7 |   int row[n];
      |           ^
a.cc:7:12: error: expected primary-expression before ']' token
    7 |   int row[n];
      |            ^
a.cc:11:34: error: 'row' was not declared in this scope
   11 |   for(i=0;i<num1;i++)scanf("%d",&row[i]);
      |                                  ^~~
a.cc:16:8: error: 'row' was not declared in this scope
   16 |     if(row[j]==key)count++;
      |        ^~~
Language: C++

#include <stdio.h>
#define N 1000
#define Q 500
int linearSearch(int*, int);
int n;
int main()
{
  int q;
  int s[N],t[Q];
  int i;
  int c=0,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]);
    c = linearSearch(s,t[i]);
    if(c==1) cnt++;
  }

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

  return 0;

}

int linearSearch(int *x,int key)
{
  int i;
  for(i=0; i<n; i++){
    if(x[i]==key) return 1;
  }
  
  return 0;

Compiler output:
a.cc: In function 'int linearSearch(int*, int)':
a.cc:38:12: error: expected '}' at end of input
   38 |   return 0;
      |            ^
a.cc:32:1: note: to match this '{'
   32 | {
      | ^
Language: C++

#include <iostream>

#define MAX 10000
#define NOT_FOUND -1

using namespace std;

//int linearSearch(int[], int, int[]);
int linearSearch(int[], int, int);

int main(){
  int i,n,q,key;
  int sum = 0;
  int S[MAX+1],T[MAX+1];
  
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> S[i];
  }
  cin >> q;
  for(i = 0; i < q; i++){
    //cin >> key;
    cin >> T[i];
    key = T[i];
    if(linearSearch(S,n,key) >= 0){
    //linearSearch(S,n,key);
      sum++;
    }
  }
  cout << sum << endl;
  
  return 0;
}

int linearSearch(int S[], int n, int key){
  int i = 0;
  S[n] = key;
  while(S[i] != key){
    i++;
    if(i == n){
      return NOT_FOUND;
      //return 0;
    }
  }
  return i;

Compiler output:
a.cc: In function 'int linearSearch(int*, int, int)':
a.cc:45:12: error: expected '}' at end of input
   45 |   return i;
      |            ^
a.cc:35:42: note: to match this '{'
   35 | int linearSearch(int S[], int n, int key){
      |                                          ^
Language: C++

#include <iostream>
using namespace std;

const int NOT_FOUND = -1; //???????????????????????£?????¨????????????????????°

int linearSearch(int target; int S[]; int n)  //target:?????????????????´??° S:??°??? n:??´??°????????°
{
  int i = 0;  //???????????°????????????????????´??°????????°
  S[n] = target;

  if(S[n] != target){
    i++
  }

  if(i == n){
    return NOT_FOUND;
  }

  return i; //???????????°????????????????????´??°????????°?????????
}

int main(){
  int n;
  cin >> n;

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

  int q;
  cin >> q;

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

  int C = 0;

  for(int i = 0; i<q; i++){
    if((linearSearch(T[i]), S, n)!=NOT_FOUND){
      C++;
    }
  }

  cout << C << endl;

  return 0;

}

Compiler output:
a.cc:6:28: error: expected ')' before ';' token
    6 | int linearSearch(int target; int S[]; int n)  //target:?????????????????´??° S:??°??? n:??´??°????????°
      |                 ~          ^
      |                            )
a.cc:6:34: error: storage size of 'S' isn't known
    6 | int linearSearch(int target; int S[]; int n)  //target:?????????????????´??° S:??°??? n:??´??°????????°
      |                                  ^
a.cc:6:44: error: expected initializer before ')' token
    6 | int linearSearch(int target; int S[]; int n)  //target:?????????????????´??° S:??°??? n:??´??°????????°
      |                                            ^
Language: C++

#include<iosream>
using namespace std;

count int NOT_FOUND =-1;

int linersearch(int key,int A[],int n)
{
 int i=0;
 A[n]=key;
 while(A[i]!=key){
	i++;
 }
 if(i==n){
	return NOT_FOUND;
 }
 return i;
}

int main(){
 int n;
 cin>>n;

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

 int q;
 cin>>q;

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

 int C=0;
 for(int i=0;i<q;i++){
	if(linerseach(T[i],S,n)!=NOT_FOUND){
		C++;
	}
 }

 cout<< C<<endl;
return 0;
}

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

#include <iostream>
using namespace std;

const int NOT_FOUND = -1; //???????????????????????£?????¨????????????????????°

int linearSearch(int target, int S[], int n)  //target:?????????????????´??° S:??°??? n:??´??°????????°
{
  int i = 0;  //???????????°????????????????????´??°????????°
  S[n] = target;

  if(S[n] != target){
    i++
  }

  if(i == n){
    return NOT_FOUND;
  }

  return i; //???????????°????????????????????´??°????????°?????????
}

int main(){
  int n;
  cin >> n;

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

  int q;
  cin >> q;

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

  int C = 0;

  for(int i = 0; i<q; i++){
    if((linearSearch(T[i]), S, n)!=NOT_FOUND){
      C++;
    }
  }

  cout << C << endl;

  return 0;

}

Compiler output:
a.cc: In function 'int linearSearch(int, int*, int)':
a.cc:12:8: error: expected ';' before '}' token
   12 |     i++
      |        ^
      |        ;
   13 |   }
      |   ~     
a.cc: In function 'int main()':
a.cc:42:21: error: too few arguments to function 'int linearSearch(int, int*, int)'
   42 |     if((linearSearch(T[i]), S, n)!=NOT_FOUND){
      |         ~~~~~~~~~~~~^~~~~~
a.cc:6:5: note: declared here
    6 | int linearSearch(int target, int S[], int n)  //target:?????????????????´??° S:??°??? n:??´??°????????°
      |     ^~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

const int NOT_FOUND = -1; //???????????????????????£?????¨????????????????????°

int linearSearch(int target, int S[], int n)  //target:?????????????????´??° S:??°??? n:??´??°????????°
{
  int i = 0;  //???????????°????????????????????´??°????????°
  S[n] = target;

  if(S[n] != target){
    i++
  };

  if(i == n){
    return NOT_FOUND;
  }

  return i; //???????????°????????????????????´??°????????°?????????
}

int main(){
  int n;
  cin >> n;

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

  int q;
  cin >> q;

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

  int C = 0;

  for(int i = 0; i<q; i++){
    if(linearSearch(T[i], S, n)!=NOT_FOUND){
      C++;
    }
  }

  cout << C << endl;

  return 0;

}

Compiler output:
a.cc: In function 'int linearSearch(int, int*, int)':
a.cc:12:8: error: expected ';' before '}' token
   12 |     i++
      |        ^
      |        ;
   13 |   };
      |   ~
Language: C++

#include<iostream>
using namespace std;

const int NOT_FOUND=-1;

int linearSearch(int key,int A[],int n)
{
	int i=0;
	A[n]=key;

	while(A[i]!=key){
		i++;
	}

	if(i==n){
		return NOT_FOUND;
	}
	return i;
}

int main()
{
	int n;
	cin>>n;

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

	int q;
	cin>>q;

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

	int C=0;
	for(int i=0;i<q;i++){
		if(linearSearch(T[i],S,n)!=NOT_FOUND){
			C++;
		}
	}

	cout<<C<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:29: error: expected ')' before ';' token
   27 |         for(int i=0; i<n;i++;){
      |            ~                ^
      |                             )
a.cc:27:30: error: expected primary-expression before ')' token
   27 |         for(int i=0; i<n;i++;){
      |                              ^
a.cc:41:38: error: 'S' was not declared in this scope
   41 |                 if(linearSearch(T[i],S,n)!=NOT_FOUND){
      |                                      ^
Language: C++

#include <iostream>
using namespace std;

const int NOT_FOUND = -1; //???????????????????????£?????¨????????????????????°

int linearSearch(int target, int S[], int n)  //target:?????????????????´??° S:??°??? n:??´??°????????°
{
  int i = 0;  //???????????°????????????????????´??°????????°
  S[n] = target;

  if(S[n] != target){
    i++
  }

  if(i == n){
    return NOT_FOUND;
  }

  return i; //???????????°????????????????????´??°????????°?????????
}

int main(){
  int n;
  cin >> n;

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

  int q;
  cin >> q;

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

  int C = 0;

  for(int i = 0; i<q; i++){
    if(linearSearch(T[i], S, n)!=NOT_FOUND){
      C++;
    }
  }

  cout << C << endl;

  return 0;

}

Compiler output:
a.cc: In function 'int linearSearch(int, int*, int)':
a.cc:12:8: error: expected ';' before '}' token
   12 |     i++
      |        ^
      |        ;
   13 |   }
      |   ~
Language: C++

#include<stdio.h>

int search(int A[], int n, int key) {
	int i = 0;
	A[n] = key;
	while( A[i] != key ) i++;
	return (i != n);
}

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

	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);
		while( search(A, n, key) ) sum++;
	}

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


}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: 'q' was not declared in this scope
   16 |         scanf("%d", q);
      |                     ^
Language: C++

//ALDS1_4_A

#include <iostream>
using namespace std;

const int N_FOUND = -1;

int linear(int target, int A[], int n){
	int i = 0;
	A[n] = target;

	while(A[i] != target){
		i++;
	}

	if(i == n){
		return N_FOUND;
	}

	return i;
}

int main(){
	int n;
	cin >> n;

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

	int q;
	cin >> q;

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

	int count = 0;

	for(int i = 0; i<q; i++){
		if(linear(T[i], S, n) != N_FOUND){
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: expected initializer before 'for'
   28 |         for(int i = 0; i<n; i++){
      |         ^~~
a.cc:28:24: error: 'i' was not declared in this scope
   28 |         for(int i = 0; i<n; i++){
      |                        ^
a.cc:43:33: error: 'S' was not declared in this scope
   43 |                 if(linear(T[i], S, n) != N_FOUND){
      |                                 ^
Language: C++

#include<iostream>
using namespace std;

bool linearSearch(int A[], int key, int size) {
	int i = 0;
	A[size] = key;
	while (A[i] != key) i++;
	return i != size;
}

int main() {
	int size, query, queryNum, count = 0;

	cin >> size;
	int* A = new int[size + 1];
	for (int i = 0; i < size; i++) scanf("%d", &A[i]); 
	
	cin >> queryNum;
	for (int i = 0; i < queryNum; i++) {
		scanf("%d", &query);
		if (linearSearch(A, query, size)) count++;
	}

	cout << count << endl;

	delete[] A;

Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: expected '}' at end of input
   26 |         delete[] A;
      |                    ^
a.cc:11:12: note: to match this '{'
   11 | int main() {
      |            ^
Language: C++

#include <cstdint>
#include <stdexcept>

using namespace std;

static void linear_search_argument_check(uint32_t s[], size_t s_size, uint32_t t[], size_t t_size)
{
  if (s == nullptr) throw runtime_error("s is null");
  if (t == nullptr) throw runtime_error("t is null");
}

size_t linear_search(uint32_t s[], size_t s_size, uint32_t t[], size_t t_size)
{
  linear_search_argument_check(s, s_size, t, t_size);

  size_t cnt = 0;

  for (uint32_t i = 0; i < t_size; i++) {
    for (uint32_t j = 0; i < s_size; j++) {
      if (t[i] == s[j]) {
        cnt++;
        break;
      }
    }
  }

  return cnt;
}

#if !defined(TEST)
#include <iostream>
int32_t main()
{
  vector<uint32_t> s, t;

  uint32_t n, m;
  cin >> n;
  for (uint32_t i = 0; i < n; i++) {
    uint32_t val;
    cin >> val;
    s.push_back(val);
  }

  cin >> m;
  for (uint32_t i = 0; i < m; i++) {
    uint32_t val;
    cin >> val;
    t.push_back(val);
  }

  cout << linear_search(&s[0], s.size(), &t[0], t.size()) << endl;

  return 0;
}
#endif

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:34:3: error: 'vector' was not declared in this scope
   34 |   vector<uint32_t> s, t;
      |   ^~~~~~
a.cc:32:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
   31 | #include <iostream>
  +++ |+#include <vector>
   32 | int32_t main()
a.cc:34:18: error: expected primary-expression before '>' token
   34 |   vector<uint32_t> s, t;
      |                  ^
a.cc:34:20: error: 's' was not declared in this scope
   34 |   vector<uint32_t> s, t;
      |                    ^
a.cc:34:23: error: 't' was not declared in this scope; did you mean 'tm'?
   34 |   vector<uint32_t> s, t;
      |                       ^
      |                       tm
Language: C++

#include <cstdint>
#include <stdexcept>
#include <vector>

#include "problems.hpp"

using namespace std;

size_t linear_search(uint32_t s[], size_t s_size, uint32_t t[], size_t t_size)
{
  if (s == nullptr) throw runtime_error("s is null");
  if (t == nullptr) throw runtime_error("t is null");

  size_t cnt = 0;

  for (uint32_t i = 0; i < t_size; i++) {
    for (uint32_t j = 0; j < s_size; j++) {
      if (t[i] == s[j]) {
        cnt++;
        break;
      }
    }
  }

  return cnt;
}

#if !defined(TEST)
#include <iostream>
static vector<uint32_t> s, t;

int32_t main()
{
  uint32_t n, m;
  cin >> n;
  for (uint32_t i = 0; i < n; i++) {
    uint32_t val;
    cin >> val;
    s.push_back(val);
  }

  cin >> m;
  for (uint32_t i = 0; i < m; i++) {
    uint32_t val;
    cin >> val;
    t.push_back(val);
  }

  cout << linear_search(&s[0], s.size(), &t[0], t.size()) << endl;

  return 0;
}
#endif

Compiler output:
a.cc:5:10: fatal error: problems.hpp: No such file or directory
    5 | #include "problems.hpp"
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
map<long long ,int > d;
int main()
{
    int n,m;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        d[x]=1;
    }
    cin>>n;
    int sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(d[x]) sum++;
    }
    cout<<sum<<endl;
 
}

Compiler output:
a.cc:8:1: error: 'map' does not name a type
    8 | map<long long ,int > d;
      | ^~~
a.cc: In function 'int main()':
a.cc:15:14: error: 'x' was not declared in this scope
   15 |         cin>>x;
      |              ^
a.cc:16:9: error: 'd' was not declared in this scope
   16 |         d[x]=1;
      |         ^
a.cc:22:14: error: 'x' was not declared in this scope
   22 |         cin>>x;
      |              ^
a.cc:23:12: error: 'd' was not declared in this scope
   23 |         if(d[x]) sum++;
      |            ^
Language: C++

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

int main(void){
int i,n,A[1000+1],j,key,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&A[i]);

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

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:1: error: 'scanf' was not declared in this scope
   11 | scanf("%d",&n);
      | ^~~~~
a.cc:17:4: error: 'search' was not declared in this scope
   17 | if(search(A,n,key))sum++;
      |    ^~~~~~
a.cc:19:1: error: 'printf' was not declared in this scope
   19 | printf("%d\n",sum);
      | ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<stdio.h>
Language: C++

#include<iostream>
using namespace std;

int search(int A[], int n, int key){
    int i = 0
    A[n] = key;
    while(A[i]!=key){
        i++;
    }
    return i!=n;
}

int main(){
    int i,n,A[10000+1],q,key,sum=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>A[i];
    }
    cin>>q;
    for (i=0;i<q;i++){
        cin>>key;
        if(search(A,n,key)){
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int search(int*, int, int)':
a.cc:6:5: error: expected ',' or ';' before 'A'
    6 |     A[n] = key;
      |     ^
Language: C++

using namespace std;

//???????????°??????TEST????????????????????¬???????????????????????????????????¢????????????
#define TEST //*******************************************************************************************************************************************

//?????????????????¨??§?????\????????????????????????????????°?????????????¨???????????????????dout???????????????????????§???????????¬??????????????????????????????????????????
#ifdef TEST
    #define dout cout
#else
    stringstream dummy; //???????????°??????dout?????????????????????????????????
    #define dout dummy.str(""); dummy.clear(stringstream::goodbit); dummy //dummy?????????????????????????????????????????¨?????¢?????¢???????????????
    //???????????¨??????????????????goodbit?????????????????????????????¨???????????´????????????????????????????????¨?????°?????????????????§???????????????????????????????????? http://d.hatena.ne.jp/linden/20060427/p1
#endif


int main(void) {
    int n, q;
    
    cin >> n;
    int S[n+1]; //S[n]???????????????????????????
    for(int i=0; i<n; i++) cin>>S[i];
    
    cin >> q;
    int T[n];
    for(int i=0; i<q; i++) cin>>T[i];
    
    
//    dout<<"S = ";
//    for(int i=0; i<n; i++) dout<<S[i]<<" ";
//    dout<<endl;
//    
//    dout<<"T = ";
//    for(int i=0; i<q; i++) dout<<T[i]<<" ";
//    dout<<endl;
    
    
    //search T from S
    int ans = 0;
    for (int i=0; i<q; i++) { //S[]????????????T[i]???key?????¢?´¢
        int key = T[i];
        S[n] = key; //S??????????°????????????¨??????key????????????

        int j = 0;
        while (S[j]!=key) {
            j++;
        }
        
        if(j!=n) ans++;
        
        //        for (int j=0; j<n; j++) {
//            if(T[i]==S[j]) {
//                ans++;
//                break;
//            }
//        }
    }
    
    
    //output
    cout << ans << endl;
    
    
    return 0;
}

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

#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<list>
using namespace std;

int main()
{
	int n,q;
	int s[10010]={0},t[510]={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];
	}
	int cnt=0;
	for(int i=0;i<q;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(t[i]==s[j])cnt++,continue;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:45: error: expected primary-expression before 'continue'
   31 |                         if(t[i]==s[j])cnt++,continue;
      |                                             ^~~~~~~~
Language: C++

 #include <cstdio>
 using namespace std;
 int serch(int A[],int n,int key){
   int i=0;
   A[n]=key;
   while(A[i]!=key){
     i++;
   }
   return i!=n;
 }
 int main(){
   int n,S[10000],q,key;
   int i,sum;
   scanf("%d",&n);
   for(i=0;i<n;i++){
     scanf("%d",S[i]);
   }
   scanf("%d",&q);
   for(i=0;i<n;i++){
     scanf("%d",key);
     if(serch(A,n,key)){
       sum++;
     }
   }
   printf("%d\n",sum);
   return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: 'A' was not declared in this scope
   21 |      if(serch(A,n,key)){
      |               ^
Language: C++

 #include <cstdio>
 using namespace std;
 int serch(int A[],int n,int key){
   int i=0;
   A[n]=key;
   while(A[i]!=key){
     i++;
   }
   return i!=n;
 }
 int main(){
   int n,S[10000],q,key;
   int i,sum;
   scanf("%d",&n);
   for(i=0;i<n;i++){
     scanf("%d",&S[i]);
   }
   scanf("%d",&q);
   for(i=0;i<n;i++){
     scanf("%d",&key);
     if(serch(A,n,key)){
       sum++;
     }
   }
   printf("%d\n",sum);
   return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: 'A' was not declared in this scope
   21 |      if(serch(A,n,key)){
      |               ^
Language: C++

#include<iostream>

using namespace std;

int linearSearch () {

    int i;

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

        if (A[i] == key) {

            return 1;

        }

    }

    return 0;

}

int main () {

    int n, A[10000], q, i, key, count = 0;

    cin >> n;

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

        cin >> A[i];

    }

    cin >> q;

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

        cin >> key;

        count += linesrSearch ();

    }

    cout << count << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int linearSearch()':
a.cc:9:21: error: 'n' was not declared in this scope
    9 |     for (i = 0; i < n; i++) {
      |                     ^
a.cc:11:13: error: 'A' was not declared in this scope
   11 |         if (A[i] == key) {
      |             ^
a.cc:11:21: error: 'key' was not declared in this scope; did you mean 'key_t'?
   11 |         if (A[i] == key) {
      |                     ^~~
      |                     key_t
a.cc: In function 'int main()':
a.cc:41:18: error: 'linesrSearch' was not declared in this scope; did you mean 'linearSearch'?
   41 |         count += linesrSearch ();
      |                  ^~~~~~~~~~~~
      |                  linearSearch
Language: C++

#include<iostream>

using namespace std;

int linearSearch (int A[], int key, int n) {

    int i;

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

        if (A[i] == key) {

            return 1;

        }

    }

    return 0;

}

int main () {

    int n, A[10000], q, i, key, count = 0;

    cin >> n;

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

        cin >> A[i];

    }

    cin >> q;

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

        cin >> key;

        count += linearSearch (A[], key, n);

    }

    cout << count << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:34: error: expected primary-expression before ']' token
   41 |         count += linearSearch (A[], key, n);
      |                                  ^
Language: C++

#include<iostream>

using namespace std;

int main () {

    int n, A[10000], q, i, j, key, count = 0;

    cin >> n;

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

        cin >> A[i];

    }

    cin >> q;

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

        cin >> key;

        for (j = 0; j < n; j++) {

            if (t == A[j]) {

                count++;

            }

        }

    }

    cout << count << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 't' was not declared in this scope
   25 |             if (t == A[j]) {
      |                 ^
Language: C++

#include<iostream>

using namespace std;

int linearSearch (int A[], int key, int n) {

    int i;

    A[n] = key;

    while (A[i] != key) {

        i++;

    }

    if (i == n) {

        return 0;

    }

    return 1;

}

int main () {

    int n, S[10001], q, T[500] i, count = 0;

    cin >> n;

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

        cin >> S[i];

    }

    cin >> q;

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

        cin >> T[i];

        if (linearSearch (A, B[i], n)) {

            count++;

        }

    }

    cout << count << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:32: error: expected initializer before 'i'
   29 |     int n, S[10001], q, T[500] i, count = 0;
      |                                ^
a.cc:33:10: error: 'i' was not declared in this scope
   33 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:41:10: error: 'i' was not declared in this scope
   41 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:43:16: error: 'T' was not declared in this scope
   43 |         cin >> T[i];
      |                ^
a.cc:45:27: error: 'A' was not declared in this scope
   45 |         if (linearSearch (A, B[i], n)) {
      |                           ^
a.cc:45:30: error: 'B' was not declared in this scope
   45 |         if (linearSearch (A, B[i], n)) {
      |                              ^
a.cc:47:13: error: 'count' was not declared in this scope
   47 |             count++;
      |             ^~~~~
a.cc:53:13: error: 'count' was not declared in this scope
   53 |     cout << count << endl;
      |             ^~~~~
Language: C++

#include<iostream>

using namespace std;

int linearSearch (int A[], int key, int n) {

    int i;

    A[n] = key;

    while (A[i] != key) {

        i++;

    }

    if (i == n) {

        return 0;

    }

    return 1;

}

int main () {

    int n, S[10001], q, T[500] i, count = 0;

    cin >> n;

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

        cin >> S[i];

    }

    cin >> q;

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

        cin >> T[i];

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

            count++;

        }

    }

    cout << count << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:32: error: expected initializer before 'i'
   29 |     int n, S[10001], q, T[500] i, count = 0;
      |                                ^
a.cc:33:10: error: 'i' was not declared in this scope
   33 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:41:10: error: 'i' was not declared in this scope
   41 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:43:16: error: 'T' was not declared in this scope
   43 |         cin >> T[i];
      |                ^
a.cc:47:13: error: 'count' was not declared in this scope
   47 |             count++;
      |             ^~~~~
a.cc:53:13: error: 'count' was not declared in this scope
   53 |     cout << count << endl;
      |             ^~~~~
Language: C++

#include<iostream>

using namespace std;

int linearSearch (int A[], int key, int n) {

    int i;

    A[n] = key;

    while (A[i] != key) {

        i++;

    }

    if (i == n) {

        return 0;

    }

    return 1;

}

int main () {

    int n, S[10001], q, T[500] i, count = 0;

    cin >> n;

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

        cin >> S[i];

    }

    cin >> q;

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

        cin >> T[i];

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

            count++;

        }

    }

    cout << count << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:32: error: expected initializer before 'i'
   29 |     int n, S[10001], q, T[500] i, count = 0;
      |                                ^
a.cc:33:10: error: 'i' was not declared in this scope
   33 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:41:10: error: 'i' was not declared in this scope
   41 |     for (i = 0; i < q; i++) {
      |          ^
a.cc:43:16: error: 'T' was not declared in this scope
   43 |         cin >> T[i];
      |                ^
a.cc:47:13: error: 'count' was not declared in this scope
   47 |             count++;
      |             ^~~~~
a.cc:53:13: error: 'count' was not declared in this scope
   53 |     cout << count << endl;
      |             ^~~~~
Language: C++

#include<iostream>

using namespace std;

int linearSearch (int A[], int key, int n) {

    int i;

    A[n] = key;

    while (A[i] != key) {

        i++;

    }

    if (i == n) {

        return 0;

    }

    return 1;

}

int main () {

    int n, S[10001], q, T[500] i, count = 0;

    cin >> n;

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

        cin >> S[i];

    }

    cin >> q;

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

        cin >> T[i];

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

            count++;

        }

    }

    cout << count << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:32: error: expected initializer before 'i'
   29 |     int n, S[10001], q, T[500] i, count = 0;
      |                                ^
a.cc:33:10: error: 'i' was not declared in this scope
   33 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:41:10: error: 'i' was not declared in this scope
   41 |     for (i = 0; i < q; i++) {
      |          ^
a.cc:43:16: error: 'T' was not declared in this scope
   43 |         cin >> T[i];
      |                ^
a.cc:47:13: error: 'count' was not declared in this scope
   47 |             count++;
      |             ^~~~~
a.cc:53:13: error: 'count' was not declared in this scope
   53 |     cout << count << endl;
      |             ^~~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int n,q;
    cin>>n;
    int S[n];
    for(int i=0;i<n;i++){cin>>S[i];}
    cin>>q;
    int T[q];
    for(int i=0;i<q;i++){cin>>T[i];}
    int m=min(n,q);
    int Q[m];
    int k=0;
    for(int i=0;i<n;i++)
        for(int j=i;j<q;j++)
            if(S[i]==T[j])
                k++;
    cout<<k<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: expected '}' at end of input
   19 |     cout<<k<<endl;
      |                   ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^