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

/**
 *  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
 */
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>

using namespace std;

int
main()
{
    string line;
    getline(cin, line);

    int level = 0;
    vector<int> levels(line.length() + 1); // level at the point
    levels[0] = level;
    map<int, pair<int, int> > areas; // start, end, area
    map<int, int> working; // start, workarea
    for (int i = 0; i < line.length(); i++) {
        working.insert(map<int, int>::value_type(i, 0));

        set<int> delist;
        switch (line[i]) {
          case '\\':
            level--;
            for (auto& it : working) {
                working[it.first] += 2 * (levels[it.first] - level) - 1;
            }
            break;
          case '_':
            for (auto& it : working) {
                if (levels[it.first] == level) { delist.insert(it.first); }
                working[it.first] += 2 * (levels[it.first] - level);
            }
            break;
          case '/':
            level++;
            for (auto& it : working) {
                if (levels[it.first] <= level) { delist.insert(it.first); }
                if (levels[it.first] < level) break;
                working[it.first] += 2 * (levels[it.first] - level) + 1;
            }
            break;
        }
        for (auto& it : delist) {
            if (working[it] > 0)
            areas.insert(map<int, pair<int, int> >::value_type(it, make_pair(i + 1, working[it] / 2)));
            working.erase(it);
        }
        levels[ i + 1 ] = level;
    }

    vector<int> k;
    auto it = areas.cbegin();
    int next;
    int total = 0;
    while (it != areas.end()) {
        next = it->second.first;
        total += it->second.second;
        k.push_back(it->second.second);
        while (it != areas.end() && it->first < next) advance(it, 1);
    }

    cout << total << endl;
    cout << k.size();
    for (auto& it : k) { cout << ' ' << it; }
    cout << endl;

    cerr << read_msec << ", " << loop_msec << ", " << arrange_msec << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:13: error: 'read_msec' was not declared in this scope
   73 |     cerr << read_msec << ", " << loop_msec << ", " << arrange_msec << endl;
      |             ^~~~~~~~~
a.cc:73:34: error: 'loop_msec' was not declared in this scope
   73 |     cerr << read_msec << ", " << loop_msec << ", " << arrange_msec << endl;
      |                                  ^~~~~~~~~
a.cc:73:55: error: 'arrange_msec' was not declared in this scope
   73 |     cerr << read_msec << ", " << loop_msec << ", " << arrange_msec << endl;
      |                                                       ^~~~~~~~~~~~
Language: C++

#include<cstdio>
#include<stack>
#include<cstring>
using namespace std;

struct node
{
    int id;
    char c;
} a[20005];
char s[20005];
int ans1[20005], ans2[20005], ans3[20005];
int ans[20005];
int main()
{
    gets(s);
    int len=strlen(s);
    for(int i=0; i<len; i++)
    {
        a[i].c=s[i];
        a[i].id=i;
    }
    stack<node> Q;
    int sum=0, j=0, res=0;
    for(int i=0; i<len; i++)
    {
        if(a[i].c=='\\' || a[i].c=='_') Q.push(a[i]);
        else
        {
            while(!Q.empty())
            {
                node temp;
                temp=Q.top();
                Q.pop();
                if(temp.c=='\\')
                {
                    sum+=a[i].id-temp.id;
                    break;
                }
            }
        }
        if(sum!=0 && (Q.empty() || i==len-1))
        {
            ans1[j++]=sum;
            res+=sum;
            sum=0;
        }
    }

    stack<node> T;
    sum=0, j=0, res=0;
    for(int i=len-1; i>=0; i--)
    {
        if(a[i].c=='/' || a[i].c=='_') T.push(a[i]);
        else
        {
            while(!T.empty())
            {
                node temp;
                temp=T.top();
                T.pop();
                if(temp.c=='/')
                {
                    sum+=temp.id-a[i].id;
                    break;
                }
            }
        }
        if(sum!=0 && (T.empty() || i==0))
        {
            ans2[j++]=sum;
            res+=sum;
            sum=0;
        }
    }

    for(int i=j-1, k=0; i>=0; i--, k++)
        ans3[k]=ans2[i];
    int k=0;
    for(int i=0, j=0; ans1[i]!=0 && ans3[j]!=0;)
    {
        if(ans1[i]==ans3[j])
        {
            ans[k++]=ans1[i];
            i++, j++;
        }
        else if(ans1[i]>ans3[j])
        {
            ans[k++]=ans3[j];

            ans1[i]-=ans3[j];
            j++;
        }
        else if(ans1[i]<ans3[j])
        {
            ans[k++]=ans1[i];

            ans3[j]-=ans1[i];
            i++;
        }

    }
    printf("%d\n", res);
    printf("%d", k);
    for(int i=0; i<k; i++)
        printf(" %d", ans[i]);
    printf("\n");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   16 |     gets(s);
      |     ^~~~
      |     getw
Language: C++

#include<cstdio>
#include<stack>
#include<cstring>
using namespace std;

struct node
{
    int id;
    char c;
} a[20005];

char s[20005];
int ans1[20005], ans2[20005], ans3[20005];
int ans[20005];
int main()
{
    gets(s);
    int len=strlen(s);
    for(int i=0; i<len; i++)
    {
        a[i].c=s[i];
        a[i].id=i;
    }
    stack<node> Q;
    int sum=0, j=0, res=0;
    for(int i=0; i<len; i++)
    {
        if(a[i].c=='\\' || a[i].c=='_') Q.push(a[i]);
        else
        {
            while(!Q.empty())
            {
                node temp;
                temp=Q.top();
                Q.pop();
                if(temp.c=='\\')
                {
                    sum+=a[i].id-temp.id;
                    break;
                }
            }
        }
        if(sum!=0 && (Q.empty() || i==len-1))
        {
            ans1[j++]=sum;
            res+=sum;
            sum=0;
        }
    }

    stack<node> T;
    sum=0, j=0, res=0;
    for(int i=len-1; i>=0; i--)
    {
        if(a[i].c=='/' || a[i].c=='_') T.push(a[i]);
        else
        {
            while(!T.empty())
            {
                node temp;
                temp=T.top();
                T.pop();
                if(temp.c=='/')
                {
                    sum+=temp.id-a[i].id;
                    break;
                }
            }
        }
        if(sum!=0 && (T.empty() || i==0))
        {
            ans2[j++]=sum;
            res+=sum;
            sum=0;
        }
    }

    for(int i=j-1, k=0; i>=0; i--, k++)
        ans3[k]=ans2[i];
    int k=0;
    for(int i=0, j=0; ans1[i]!=0 && ans3[j]!=0;)
    {
        if(ans1[i]==ans3[j])
        {
            ans[k++]=ans1[i];
            i++, j++;
        }
        else if(ans1[i]>ans3[j])
        {
            ans[k++]=ans3[j];

            ans1[i]-=ans3[j];
            j++;
        }
        else if(ans1[i]<ans3[j])
        {
            ans[k++]=ans1[i];

            ans3[j]-=ans1[i];
            i++;
        }

    }
    printf("%d\n", res);
    printf("%d", k);
    for(int i=0; i<k; i++)
        printf(" %d", ans[i]);
    printf("\n");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   17 |     gets(s);
      |     ^~~~
      |     getw
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;
#define p pair<char,int>
int main(){
  string a;
  p b[20000];
  int n=0,cnt=0,c[100000]={},t=0,sum=0;
  cin>>a;
  for(int i=0;i<a.size();i++){
    if(a[i]!='/'&&a[i]!='_')n--;
    b[i]=make_pair(a[i],n);
    if(a[i]=='/')n++;
  }
  for(int i=0;i<a.size();i++){
    if(a[i]!='/'&&a[i]!='_'){
      for(int j=i;j<a.size();j++){
        if(a[j]=='/'&&b[j].second==b[i].second){
          if(i>=t)t=0,cnt++;
          c[cnt]+=j-i;
          sum+=j-i;
          if(j>t)t=j;
          break;
        }
      }
    }
  }
  cout<<sum<<endl<<cnt<<" ";
  for(int i=1;i<cnt+1;i++){
    if(I-1)cout<<" ";
    cout<<c[i];
  }cout<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:8: error: 'I' was not declared in this scope
   31 |     if(I-1)cout<<" ";
      |        ^
Language: C++

#include<iostream>
#include<stack>
#include<string>
#include<vecyor>
#include<algorithm>
using namespace std;
int main()
{
    stack(int) s1);
    stack<pair<int,int>>  s2;
    char ch;
    int sum=0;
    for(int i=0;cin>>ch;i++)
        if(ch=='\\') s1.push(i);
    else if(ch=='/'&&s1.size()>0)
    {
        int j=s1.top();
        s1.pop();
        sum+=i-j;
        int a=i-j;
        while(s2.size()>0)
        {
         while(s2.size()>0&&s2.top.first>j)
         {
             a+=s2.top().second;s2.pop();
         }
         s2.push(make-pair(j,a));
        }
    }
    vector<int> ans;
         while(s2.size()>0)
         {
             ans.push_back(s2.top().second);
             s2.pop();
              }
             reverse(ans,begin(),ans.end());
             cout<<sum<<endl;
             cout<<ans.size();
             for(int i=0;i<ans.size();i++)
             {
                cout<<" ;
                cout<<ans[i];
             }
             return 0;
}

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

#include <cstring>#include <stack>#include <vector>using namespace std;stack<int> T; //??¨????¨?????????????stack<pair<int,int>> R;vector<int> r;int main() {    char str[20001];    cin>>str;    int result=0;    bool completed=false;    for(int i=0;i<strlen(str);i++)    {        if(str[i]=='\\') //??\???        {            T.push(i);        }        else if(str[i]=='/'&&!T.empty()) //???????????????        {            int x=T.top(); T.pop();            int a=i-x;            //R.push(make_pair(x,current_areas));            //int a=0;            while(!R.empty()&&R.top().first>x)            {                a+=R.top().second; R.pop();            }            if(a)               R.push(make_pair(x,a)); //?????°??\???        }    }    int sum=0;    while(!R.empty())    {        sum+=R.top().second;        r.push_back(R.top().second); R.pop();    }    cout<<sum<<endl;    cout<<r.size();    for(int i=r.size()-1;i>=0;i--)        cout<<' '<<r[i];}

Compiler output:
a.cc:1:19: warning: extra tokens at end of #include directive
    1 | #include <cstring>#include <stack>#include <vector>using namespace std;stack<int> T; //??¨????¨?????????????stack<pair<int,int>> R;vector<int> r;int main() {    char str[20001];    cin>>str;    int result=0;    bool completed=false;    for(int i=0;i<strlen(str);i++)    {        if(str[i]=='\\') //??\???        {            T.push(i);        }        else if(str[i]=='/'&&!T.empty()) //???????????????        {            int x=T.top(); T.pop();            int a=i-x;            //R.push(make_pair(x,current_areas));            //int a=0;            while(!R.empty()&&R.top().first>x)            {                a+=R.top().second; R.pop();            }            if(a)               R.push(make_pair(x,a)); //?????°??\???        }    }    int sum=0;    while(!R.empty())    {        sum+=R.top().second;        r.push_back(R.top().second); R.pop();    }    cout<<sum<<endl;    cout<<r.size();    for(int i=r.size()-1;i>=0;i--)        cout<<' '<<r[i];}
      |                   ^
/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<stack>
#include<string>
#include<vector>
using namespace std;

int main() {
	stack<int>S1;
	stack<pair<int, int>>S2;
	char ch;
	int sum = 0;
	for (int i = 0; cin >> ch; i++) {
		if (ch == '\\')S1.push(i);
		else if (ch = '/'&&S1.size() > 0) {
			int j = S1.top(); S1.pop();
			sum += i - j;
			int a = i - j;
			while (S2.size() > 0 && S2.top().first > j) {
				a += S2.top().second; S2.pop();
			}
			S2.push(make_pair(j, a));
		}
	}

	vector<int>ans;
	while (S2.size() > 0) { ans.push_back(S2.top().second); S2.pop(); }
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for (int i = 0; i < ans.size(); i++) {
		cout << " ";
		cout << ans[i];
	}
	cout << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'reverse' was not declared in this scope
   27 |         reverse(ans.begin(), ans.end());
      |         ^~~~~~~
Language: C++

#include<iostream>
#include<stack>
#include<string>
#include<vector>

using namespace std;

int main()
{
	stack<int> S1;
	stack<pair<int, int> > S2;
	char c;
	int sum=0;
	int i,j,a;
	for(i=0;cin >> c;i++)
	{
		if(c=='\\') S1.push(i);
		else if(c=='/' && S1.size()>0)
		{
			j=S1.top();
			S1.pop();
			sum+=i-j;
			a=i-j;
			while(S2.size()>0 && S2.top().first>j)
			{
				a+=S2.top().second;
				S2.pop();
			}
			S2.push(make_pair(j,a));
		}
	}
	
	vector<int> ans;
	while(S2.size()>0)
	{
		ans.push_back(S2.top().second);
		S2.pop();
	}
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for(i=0;i < ans.size();i++)
	{
	   cout << " ";
	   cout << ans[i];
	}
	cout << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'reverse' was not declared in this scope
   39 |         reverse(ans.begin(), ans.end());
      |         ^~~~~~~
Language: C++

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

struct Sq
{
	unsigned long xmax;
	unsigned long li;
};

int main()
{
	string st;
	long a = 0, hmax = 0;
	vector<long> h = { 0 };
	vector<Sq> S = { Sq{0, 0} };

	cin >> st;

	for (unsigned long i = 0; i < st.size(); i++) {

		switch (st[i]) {
			case '/':
				if (h[i] == hmax)
					hmax++;
				else {
					for (unsigned long j = 0; j < h.size(); j++) {
						if (h[h.size() - j - 1] == h[i] + 1) {
							if (S.back().xmax !=0 && (S.back().xmax < h.size() - j))
								S.push_back(Sq{ h.size() - 1 , j});
							else if (S.size() > 1 && (S[S.size() - 2].xmax > h.size() - j)) {
								while (S.size() > 1 && (S[S.size() - 2].xmax > h.size() - j)) {
									S[S.size() - 2].li += j + S.back().li;
									S.pop_back();
								}
							}
							else{
								S.back().li += j;
								S.back().xmax = h.size() - 1;
							}
							break;
						}
					}
				}
				h.push_back(h[i] + 1);
				break;
			case '\\':
				h.push_back(h[i] - 1);
				break;
			case '_':
				h.push_back(h[i]);
				break;
		}
	}

	for (unsigned long i = 0; i < S.size(); i++)
		a += S[i].li;

	cout << a << endl;

	if (a > 0) {
		cout << S.size();
		for (unsigned long i = 0; i < S.size(); i++)
			cout << " " << S[i].li;
	}
	else
		cout << "0";

	cout << endl;

	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:72:18: error: expected '}' at end of input
   72 |         return 0;
      |                  ^
a.cc:13:1: note: to match this '{'
   13 | {
      | ^
Language: C++

#include <iostream>
#include <string>
#include <stack>
using namespace std;

struct Puddle
{
  int start;
  int end;
  int area;
};

int main()
{
  string str;
  cin >> str;

  stack<int> st;
  stack<Puddle> puddles;
  for (int i = 0; i < str.length(); i++)
  {
    if (str[i] == '\\')
      st.push(i);
    else if (str[i] == '/' && !st.empty())
    {
      int start = st.top();
      st.pop();

      Puddle cur = {start, i, i - start};

      while (!puddles.empty() &&
             start < puddles.top().start && puddles.top().end < i)
      {
        cur.area += puddles.top().area;
        puddles.pop();
      }

      puddles.push(cur);
    }
  }

  int sum_of_area = 0;
  int count = 0;
  string s = "";
  while (!puddles.empty())
  {
    Puddle p = puddles.top();
    puddles.pop();
    sum_of_area += p.area;
    s = to_string(p.area) + s;
    count++;

    if (puddles.empty())
      break;
    else
      s = " " + s;
  }

  cout << sum_of_area << endl;
  cout << count;
  if (s.length > 0)
    cout << " " << s << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:9: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   61 |   if (s.length > 0)
      |       ~~^~~~~~
      |               ()
Language: C++

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

int main() {
  stack<int> S1;
  stack<pair<int, int> > S2;
  char ch;
  int sum = 0;
  for ( int i = 0; cin >> ch; i++ ) {
    if ( ch == '\\' ) S1.push(i);
    else if ( ch == '/' && S1.size() > 0 ) {
      int j = S1.top(); S1.pop();
      sum += i - j;
      int a = i - j;
      while ( S2.size() > 0 && S2.top().first > j )
        a += S2.top.second; S2.pop();
      S2.push(make_pair(j, a));
    }
  }

  vector<int> ans;
  int t = 0;
  while ( S2.size > 0 ) { ans.push_back(S2.top().second); S2.pop(); }
  reverse(ans.begin(), ans.end());
  cout << sum << endl;
  cout << ans.size();
  for ( int i = 0; i < ans.size(); i++ ) {
    cout << " ";
    t += ans[i];
    cout << ans[i];
  }
  cout << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: invalid use of member function 'std::stack<std::pair<int, int> >::top' (did you forget the '()' ?)
   20 |         a += S2.top.second; S2.pop();
      |              ~~~^~~
a.cc:27:14: error: invalid use of member function 'std::stack<_Tp, _Sequence>::size_type std::stack<_Tp, _Sequence>::size() const [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; size_type = long unsigned int]' (did you forget the '()' ?)
   27 |   while ( S2.size > 0 ) { ans.push_back(S2.top().second); S2.pop(); }
      |           ~~~^~~~
      |                  ()
Language: C++

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

int main() {
  stack<int> S1;
  stack<pair<int,int> > S2;
  char ch;
  int sum=0;
  for (int i=0; cin>>ch; i++) {
    if (ch=='\\') {
      S1.push(i);
    } else if (ch=='/' && !S1.empty()) {
      int j=S1.top();
      S1.pop();
      sum+=i-j;
      int a=i-j;
      while (!S2.empty() && S2.top().first>j) {
        a+=S2.top().second;
        S2.pop();
      }
      S2.push(make_pair(j,a));
    }
  }
  vector<int> ans;
  while (!S2.empty()) {
    ans.push_back(S2.top().second);
    S2.pop();
  }
  reverse(ans.begin(),ans.end());
  cout<<sum<<endl;
  cout<<ans.size()<<" "<<flush;
  for (int i=0; i<ans.size(); i++) {
    cout<<(i==0?"":" ")<<ans[i]<<flush;
  }
  cout<<endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:3: error: 'reverse' was not declared in this scope
   31 |   reverse(ans.begin(),ans.end());
      |   ^~~~~~~
Language: C++

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

int main(int argc, char const *argv[]) {
  stack<pair<int,char> > S;
  int section_num=0;
  int pool_sum=0;

  string input;
  std::cin >> input;;

  vector<pair<int, int> > pools;

  for (size_t i = 0; i < input.length(); i++) {
    if(input[i]=='_'){
      continue;
    }else if(input[i]=='\\'){
      pair<int,char> p = make_pair(i, input[i]);
      S.push(p);
    }else if(input[i]=='/'){
      if(S.empty()){ continue; }
      pair<int,char> l = S.top(); S.pop();
      int left = l.first;
      pair<int, int> section = make_pair(left, i);
      pools.push_back(section);
      section_num++;
      pool_sum += i - left;
    }
  }

  std::cout << pool_sum << '\n';

  sort(pools.begin(), pools.end());

  std::vector<int> pool_section; pool_section.push_back(0);

  int pool_num=1;
  pair<int,int> L = make_pair(pools[0].first, pools[0].second);

  for (size_t j = 0; j < section_num; j++) {
    if(L.first <= pools[j].first && pools[j].second <= L.second){
      pool_section[pool_num-1] += pools[j].second - pools[j].first;
    }else{
      pool_section.push_back(pools[j].second - pools[j].first);
      L = pools[j];
      pool_num++;
    }

  }
  std::cout << pool_num;

  for (size_t i = 0; i < pool_num; i++) {
    std::cout << ' ' << pool_section[i];
  }


  return 0;

}



Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:35:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   35 |   sort(pools.begin(), pools.end());
      |   ^~~~
      |   short
Language: C++

s = []
log = []
l = gets.chomp.split("")
sum = 0
for i in 0..l.size-1 do
  c = l[i]
  if c=="\\"
    s.push(i)
  elsif c=="/" && s.size>0
    right,left = i,s.pop
    sum += right - left
    log << [left,right]
  end
end
printf("%d\n",sum)

log = log.sort_by{|left,right| left }
edge = nil
sum = 0
flood = [0]
edge = log[0][1]
for i in 0..log.size-1 do
  left,right = log[i]
  if edge && edge < left
    flood << sum
    flood[0] += 1
    sum = 0
    edge = right
  end
  sum += right - left
  if i == log.size-1
    flood << sum
    flood[0] += 1
  end
end
printf("%s\n",flood.join(" "))


Compiler output:
a.cc:5:10: error: too many decimal points in number
    5 | for i in 0..l.size-1 do
      |          ^~~~~~~~~~~
a.cc:22:10: error: too many decimal points in number
   22 | for i in 0..log.size-1 do
      |          ^~~~~~~~~~~~~
a.cc:1:1: error: 's' does not name a type
    1 | s = []
      | ^
a.cc:18:1: error: 'edge' does not name a type
   18 | edge = nil
      | ^~~~
Language: C++

/*
 * ALDS1_3_D.cpp
 *
 *  Created on: Apr 26, 2018
 *      Author: 13743
 */

#include<iostream>
#include<stack>

using namespace std;

int main() {
	stack<int> s1;
	stack<pair<int, int>> s2;
	int sumR = 0;

	char c;
	for(int i=0; cin >> c; i++) {
		if(c == '\\') {
			s1.push(i);
		}
		else if(c == '/' && !s1.empty()){
			int l = s1.top(); s1.pop();
			int df = i - l;
			while(!s2.empty() && s2.top().first > l) {
				df += s2.top().second();
				s2.pop();
			}
			sumR += df;
			s2.push(make_pair(l, df));
		}
	}
}

//int main() {
//	int slope[20000];
//	int n = 0;
//	int maxH = 0;
//	int nowH = 0;
//	stack<int> tops;
//	stack<int> topInds;
//	bool nextTop = true;
//	char s;
//	while(cin >> s) {
//		if(s == '_') {
//			slope[n] = 0;
//		}
//		else if(s == '/') {
//			slope[n] = 1;
//			nextTop = true;
//			nowH++;
//			while(!tops.empty() && nowH > tops.top() && maxH > tops.top()) {
//				tops.pop();
//				topInds.pop();
//			}
//		}
//		else {
//			slope[n] = -1;
//			if(nextTop) {
//				tops.push(nowH);
//				topInds.push(n);
//				nextTop = false;
//			}
//			maxH = (nowH > maxH) ? nowH : maxH;
//			nowH--;
//		}
//		n++;
//	}
//	if(nextTop) {
//		tops.push(nowH);
//		topInds.push(n);
//	}
//
//	int sumR = 0;
//	int count = 0;
//	int rains[20000];
//	int tpR = tops.top(); tops.pop();
//	int tpRInd = topInds.top(); topInds.pop();
//	while(!tops.empty()) {
//		int tpL = tops.top();
//		int depth = 0;
//		int rain = 0;
//		int slC = 0;
//		if(tpL > tpR) {
//			do {
//				tpRInd--;
//				int sl = -slope[tpRInd];
//				slC += sl*sl;
//				rain += depth;
//				depth -= sl;
//				if(sl == 1) rain--;
//			} while(depth != 0 || slC == 0);
//		}
//		else {
//			int tpLInd = topInds.top();
//			do {
//				int sl = slope[tpLInd];
//				slC += sl*sl;
//				rain += depth;
//				depth -= sl;
//				tpLInd++;
//				if(sl == 1) rain--;
//			} while(depth != 0 || slC == 0);
//		}
//		rain += slC / 2;
//		sumR += rain;
//		rains[count] = rain;
//		count++;
//		tpR = tops.top(); tops.pop();
//		tpRInd = topInds.top(); topInds.pop();
//	}
//
//	cout << sumR << endl;
//	cout << count;
//	for(int i=0; i<count; i++) {
//		cout << " " << rains[count-1-i];
//	}
//	cout << endl;
//}





Compiler output:
a.cc: In function 'int main()':
a.cc:27:54: error: expression cannot be used as a function
   27 |                                 df += s2.top().second();
      |                                       ~~~~~~~~~~~~~~~^~
Language: C++

#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    stack<int>S1;
    stack<pair<int,int> >S2;
    char c;
    int sum=0;
    for(int i=0;cin>>c;i++){
        if(c=='\\') S1.push(i);
        else if(ch=='/' && S1.size()>0){
            int j=S1.top();S1.pop();
            sum+=i-j;
            int a=i-j;
            while(S2.size()>0 && S2.top().first>j){
                a+=S2.top().second;S2.pop();
            }
            S2.push(make_pair(j,a));
        }
    }
    vector<int>ans;
    while(S2.size()>0){ans.push_back(S2.top().second);S2.pop();}
    reverse(ans.begin(),ans.end());
    cout<<sum<<endl;
    cout<<ans.size();
    for(int i=0;i<ans.size();i++){
       cout<<" ";
       cout<<ans[i];
    }
    cout<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'ch' was not declared in this scope; did you mean 'c'?
   15 |         else if(ch=='/' && S1.size()>0){
      |                 ^~
      |                 c
Language: C++

import java.util.Scanner;

public class Main {
	public static int sumarea(String str, int sdepth, int edepth) {
		int i, len, start = sdepth, end = edepth, depth = 0;
		double area = 0;
		len = str.length();
		for (i = 0; i < len; i++) {
			if (start > end && str.charAt(i) == '\\') {
				start--;
			} else {
				switch (str.charAt(i)) {
					case '\\':
						area += depth - 0.5;
						depth -= 1;
						break;
					case '/':
						area += depth + 0.5;
						depth += 1;
						break;
					case '_':
						area += depth;
						break;
					default:
						continue;
				}
			}
		}
		return (int) -area;
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 0, j = 0, len, start = -1, end = -1, depth = 0, sdepth = 0, edepth = 0, count = 0, memo = 0;
		int sum = 0;
		String str;
		str = scan.next();
		len = str.length();
		j = len / 2 + 1;
		int[] area = new int[j];
		j = 0;
		while (i < len) {
			for (i = memo; i < len; i++) {
				if (start == -1 && str.charAt(i) == '\\') {
					start = i;
					depth = 0;
					sdepth = 0;
				}
				if (start != -1) {
					switch (str.charAt(i)) {
						case '\\':
							depth -= 1;
							break;
						case '/':
							if (end == -1) {
								end = i;
								edepth = depth;
							}
							depth += 1;
							if (depth > edepth) {
								end = i;
								edepth = depth;
							}
							if (edepth == 0) {
								area[j] = sumarea(str.substring(start, end + 1), sdepth, edepth);
								sum += area[j];
								count++;
								j++;
								start = -1;
								end = -1;
							}
							break;
						default:
							continue;
					}
				}
			}
			if (start < end  && sdepth > edepth) {
				area[j] = sumarea(str.substring(start, end + 1), sdepth, edepth);
				sum += area[j];
				count++;
				i = end + 1;
				j++;
				memo = end;
				start = -1;
				end = -1;
			}
			if (i >= len)
				break;
		}
		System.out.print(sum + "\n" + count + " ");
		for (i = 0; i < count; i++) {
			if (i < count - 1) {
				System.out.print(area[i] + " ");
			} else {
				System.out.println(area[i] + "");
			}
		}
		scan.close();
	}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

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

int main() {
  stack<int> S1;
  stack<pair<int, int> > S2;
  char ch;
  int sum = 0;
  for (int = 0; cin >> ch; i++) {
    if (ch == "\\") {
      S1.push(i);
    } else if (ch == "/" && S1.size() > 0) {
      int j = S1.top(); S1.pop();
      sum += i - j;
      int a = i - j;
      while (S2.size() > 0 && S2.top().first > j) {
        a += S2.top().second; S2.pop();
      }
      S2.push(make_pair(j, a));
    }
  }

  vector<int> ans;
  while (S2.size() > 0) {
    ans.push_back(S2.top().second);
    S2.pop();
  }
  reverse(ans.begin(), ans.end());
  cout << sum << endl;
  cout << ans.size();
  for (int i = 0; i < ans.size(); i++) {
    cout << "  ";
    cout << ans[i];
  }
  cout << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: expected unqualified-id before '=' token
   14 |   for (int = 0; cin >> ch; i++) {
      |            ^
a.cc:14:11: error: expected ';' before '=' token
   14 |   for (int = 0; cin >> ch; i++) {
      |           ^~
      |           ;
a.cc:14:12: error: expected primary-expression before '=' token
   14 |   for (int = 0; cin >> ch; i++) {
      |            ^
a.cc:14:26: error: expected ')' before ';' token
   14 |   for (int = 0; cin >> ch; i++) {
      |       ~                  ^
      |                          )
a.cc:14:28: error: 'i' was not declared in this scope
   14 |   for (int = 0; cin >> ch; i++) {
      |                            ^
Language: C++

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

int main() {
  stack<int> S1;
  stack<pair<int, int> > S2;
  char ch;
  int sum = 0;
  for (int i = 0; cin >> ch; i++) {
    if (ch == "\\") {
      S1.push(i);
    } else if (ch == "/" && S1.size() > 0) {
      int j = S1.top(); S1.pop();
      sum += i - j;
      int a = i - j;
      while (S2.size() > 0 && S2.top().first > j) {
        a += S2.top().second; S2.pop();
      }
      S2.push(make_pair(j, a));
    }
  }

  vector<int> ans;
  while (S2.size() > 0) {
    ans.push_back(S2.top().second);
    S2.pop();
  }
  reverse(ans.begin(), ans.end());
  cout << sum << endl;
  cout << ans.size();
  for (int i = 0; i < ans.size(); i++) {
    cout << "  ";
    cout << ans[i];
  }
  cout << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     if (ch == "\\") {
      |         ~~~^~~~~~~
a.cc:17:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |     } else if (ch == "/" && S1.size() > 0) {
      |                ~~~^~~~~~
Language: C++

#include <cstdlib>
#include <iostream>
#include <stack>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
    int i, j, sum, a;
    char ch;
    stack<int> S1;
    stack<pair<int, int> > S2;
    vector<int> V;
    
    sum = 0;
    for (i = 0; cin >> ch; i++) {
        if (ch == '\\') {
               S1.push(i);
        } else if (ch == '/' && S1.size() > 0) {
               j = S1.top(); S1.pop();
               sum += (i - j);
               a = i - j;
               while (S2.size() > 0 && S2.top().first > j) {
                     a += S2.top().second; S2.pop();
               }
               S2.push(make_pair(j, a));
        }
    }
    
    while (S2.size() > 0) {
          V.push_back(S2.top().second); S2.pop();     
    } 
    reverse(V.begin(), V.end());
    cout << sum << endl;
    cout << V.size();
    for (i = 0; i < V.size(); i++) {
        cout << " ";
        cout << V[i];
    }
    
    return EXIT_SUCCESS;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:34:5: error: 'reverse' was not declared in this scope
   34 |     reverse(V.begin(), V.end());
      |     ^~~~~~~
Language: C++

#include <iostream>
#include <stack>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
    int i, j, sum, a;
    char ch;
    stack<int> S1;
    stack<pair<int, int> > S2;
    vector<int> V;
    
    sum = 0;
    for (i = 0; cin >> ch; i++) {
        if (ch == '\\') {
               S1.push(i);
        } else if (ch == '/' && S1.size() > 0) {
               j = S1.top(); S1.pop();
               sum += (i - j);
               a = i - j;
               while (S2.size() > 0 && S2.top().first > j) {
                     a += S2.top().second; S2.pop();
               }
               S2.push(make_pair(j, a));
        }
    }
    
    while (S2.size() > 0) {
          V.push_back(S2.top().second); S2.pop();     
    } 
    reverse(V.begin(), V.end());
    cout << sum << endl;
    cout << V.size();
    for (i = 0; i < V.size(); i++) {
        cout << " ";
        cout << V[i];
    }
    cout << endl;
    
    return 0;
}



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:33:5: error: 'reverse' was not declared in this scope
   33 |     reverse(V.begin(), V.end());
      |     ^~~~~~~
Language: C++

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

int main() {
    stack<int> S1;
    stack<pair<int, int> > S2;
    char ch;
    int sum=0;
    
    for (int i=0; cin >> ch; i++) {
        if (ch=='\') S1.push(i);
        else if (ch=='/' && S1.size()>0) {
            int j = S1.top(); S1.pop();
            sum += i-j;
            int a = i-j;
            while (S2.size() > 0 && S2.top().first > j) {
                a += S2.top().second; S2.pop();
            }
            S2.push(make_pair(j, a));
        }
    }
    
    vector<int> ans;
    while (S2.size() > 0) { ans.push_back(S2.top().second); S2.pop(); }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for (int i=0; i<ans.size(); i++) {
        cout << " ";
        cout << ans[i];
    }
    cout << endl;
    
    return 0;
}


Compiler output:
a.cc:15:17: warning: missing terminating ' character
   15 |         if (ch=='\') S1.push(i);
      |                 ^
a.cc:15:17: error: missing terminating ' character
   15 |         if (ch=='\') S1.push(i);
      |                 ^~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:16:9: error: expected primary-expression before 'else'
   16 |         else if (ch=='/' && S1.size()>0) {
      |         ^~~~
a.cc:15:17: error: expected ')' before 'else'
   15 |         if (ch=='\') S1.push(i);
      |            ~    ^
      |                 )
   16 |         else if (ch=='/' && S1.size()>0) {
      |         ~~~~     
a.cc:25:5: error: expected primary-expression before '}' token
   25 |     }
      |     ^
Language: C++

import java.util.Scanner;
import java.util.Stack;

public class Main {
	String input;
	public static void main(String args[]) {
		new Main().run();
	}
	Main() {
		Scanner scan = new Scanner(System.in);
		input = scan.nextLine();
	}
	void run() {
		int len = input.length();
		Stack<Area> areaStack = new Stack<Area>();
		Stack<Integer> slash = new Stack<Integer>();
		for (int i = 0; i < len; i++) {
			switch(input.charAt(i)) {
			case '\\':
				slash.push(i);
				break;
			case '/':
				if (!slash.isEmpty()) {
					Area v = new Area(slash.pop(),i);
					while (!areaStack.isEmpty()) {
						Area latest = areaStack.pop();
						if (!v.isChild(latest)) {
							areaStack.push(latest);
							break;
						}
						v.addSize(latest.getSize());
					}
					areaStack.push(v);
				}
				break;
			case '_':
				break;
			}
		}
		int[] areaSize = new int[areaStack.size()];
		int sum = 0;
		for (int i = 0; i < areaSize.length; i++) {
			areaSize[i] = areaStack.pop().getSize();
			sum += areaSize[i];
		}
		System.out.println(sum);
		System.out.print(areaSize.length);
		for (int i = areaSize.length - 1; i >= 0; i--) {
			System.out.print(" " + areaSize[i]);
		}
	}
	class Area {
		private int left;
		private int right;
		private int size;
		Area() {
			left = 0;
			right = 0;
		}
		Area(int l,int r){
			left = l;
			right = r;
			size = right - left;
		}
		public void addSize(int i) {
			size += i;
		}
		public boolean isChild(Area area) {
			return left < area.getLeft() && right > area.getRight();
		}
		public int getLeft() {
			return left;
		}
		public int getRight() {
			return right;
		}
		public int getSize() {
			return size;
		}
	}
}



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Stack;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: Java

#include<stdio.h>
 
int N[10000];
int n;

 
 
int search(int key) {
	int i=0;
	
	N[n] = key;
	while(N[i] != key) {
		i++;
		if(i == n) return 0;
		else return 1;
	}
}
	
int main(void) {
	int i,p=0,q;
	int m[500];
		
	scanf("%d",&n);
	for(i=0;i < n; i++) {
		scanf("%d",&N[i]);
	}
		
	scanf("%d", &q);
	for(i=0;i < q; i++) {
		scanf("%d",&m[i]);
	}
		
	 for(i = 0; i < q; i++){
   		 if(1 == search(N[i])) p++;
  	 }
 
  printf("%d",p);
 
  return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
int n;
^
  (use --enable-preview to enable unnamed classes)
Main.java:19: error: <identifier> expected
int main(void) {
             ^
Main.java:21: error: ']' expected
	int m[500];
	      ^
Main.java:23: error: illegal start of expression
	scanf("%d",&n);
	           ^
Main.java:25: error: illegal start of expression
		scanf("%d",&N[i]);
		           ^
Main.java:28: error: illegal start of expression
	scanf("%d", &q);
	            ^
Main.java:30: error: illegal start of expression
		scanf("%d",&m[i]);
		           ^
9 errors
Language: Java

#include<stdio.h>
 
int N[10000];
int n;

 
 
int search(int key) {
	int i=0;
	
	N[n] = key;
	while(N[i] != key) {
		i++;
		if(i == n) return 0;
		else return 1;
	}
}
	
int main(void) {
	int i,p=0,q;
	int m[500];
		
	scanf("%d",&n);
	for(i=0;i < n; i++) {
		scanf("%d",&N[i]);
	}
		
	scanf("%d", &q);
	for(i=0;i < q; i++) {
		scanf("%d",&m[i]);
	}
		
	 for(i = 0; i < q; i++){
   		 if(1 == search(N[i])) p++;
  	 }
 
  printf("%d\n", p);
 
  return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
int n;
^
  (use --enable-preview to enable unnamed classes)
Main.java:19: error: <identifier> expected
int main(void) {
             ^
Main.java:21: error: ']' expected
	int m[500];
	      ^
Main.java:23: error: illegal start of expression
	scanf("%d",&n);
	           ^
Main.java:25: error: illegal start of expression
		scanf("%d",&N[i]);
		           ^
Main.java:28: error: illegal start of expression
	scanf("%d", &q);
	            ^
Main.java:30: error: illegal start of expression
		scanf("%d",&m[i]);
		           ^
9 errors
Language: Java

#include<stdio.h>
 
int N[10000];
int n;
 

	
int main(void) {
	int i,p=0,q;
	int m[500];
		
	scanf("%d",&n);
	for(i=0;i < n; i++) {
		scanf("%d",&N[i]);
	}
		
	scanf("%d", &q);
	for(i=0;i < q; i++) {
		scanf("%d",&m[i]);
	}
		
	 for(i = 0; i < q; i++){
   		 if(search(N[i])) p++;
  	 }
 
  printf("%d\n", p);
 
  return 0;
}


int search(int key) {
	int i=0;
	
	N[n] = key;
	while(N[i] != key) i++;
		if(i == n) return 0;
		else return 1;
	}



Compiler output:
Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
int n;
^
  (use --enable-preview to enable unnamed classes)
Main.java:8: error: <identifier> expected
int main(void) {
             ^
Main.java:10: error: ']' expected
	int m[500];
	      ^
Main.java:12: error: illegal start of expression
	scanf("%d",&n);
	           ^
Main.java:14: error: illegal start of expression
		scanf("%d",&N[i]);
		           ^
Main.java:17: error: illegal start of expression
	scanf("%d", &q);
	            ^
Main.java:19: error: illegal start of expression
		scanf("%d",&m[i]);
		           ^
9 errors
Language: Java

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

public class Main103d {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String[] str=br.readLine().split(" ");
		int[] S=new int[n];
		for(int i=0;i<n;i++)
			S[i]=Integer.parseInt(str[i]);
		
		int q=Integer.parseInt(br.readLine());
		str=br.readLine().split(" ");
		int[] T=new int[q];
		for(int i=0;i<q;i++)
			T[i]=Integer.parseInt(str[i]);
		
		System.out.println(method(S,T));
		

	}
	static int method(int[] s,int[] t){
		if(s.length<t.length){
			int[] tmp=s;
			s=t;
			t=tmp;
		}
		int count=0;
		for(int i=0;i<t.length;i++){
			for(int j=0;j<s.length;j++){
				if(t[i]==s[j])count++;
				
				
			}
		}
		
		return count;
	}

}

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

import java.util.Scanner;

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

        int n = scanner.nextInt();
        String[] numbers = new String[n];
        for (int i = 0; i < n; i++) {
            numbers[i] = scanner.next();
        }

        int q = scanner.nextInt();
        String[] patterns = new String[q];
        for (int i = 0; i < q; i++) {
            patterns[i] = scanner.next();
        }

        int count = 0;
        for (int i = 0; i < q; i++) {
            String pattern = patterns[i];
            for (int j = 0; j < n; j++) {
                if (pattern.equals(numbers[j])) {
                    ++count;
                    break;
                }
            }
        }

        System.out.println(count);
    }
}

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

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main_linear_search {
  public static void main(String[] args) {
    int i, j;
    Scanner sc = new Scanner(System.in); 
    int n = Integer.parseInt(sc.next());;
    int t[] = new int[n];

    for (i=0; i<n; i++)
      t[i] = Integer.parseInt(sc.next());;

    int q = Integer.parseInt(sc.next());;
    Set s = new HashSet();
    for (i=0; i<q; i++)
      s.add(Integer.parseInt(sc.next()));

    int res = 0;
    for (i=0; i<n; i++)
      if (s.contains(t[i])) res++;

    System.out.println(res);
  }
}

Compiler output:
Main.java:7: error: class Main_linear_search is public, should be declared in a file named Main_linear_search.java
public class Main_linear_search {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main_linear_search {
  public static void main(String[] args) {
    int i, j;
    Scanner sc = new Scanner(System.in); 
    int n = Integer.parseInt(sc.next());;
    int t[] = new int[n];

    for (i=0; i<n; i++)
      t[i] = Integer.parseInt(sc.next());;

    int q = Integer.parseInt(sc.next());;
    HashSet s = new HashSet();
    for (i=0; i<q; i++) {
      int a = Integer.parseInt(sc.next());
      if (s.contains(a)) s.add(a);
    }

    int res = 0;
    for (i=0; i<n; i++)
      if (s.contains(t[i])) res++;

    System.out.println(res);
  }
}

Compiler output:
Main.java:7: error: class Main_linear_search is public, should be declared in a file named Main_linear_search.java
public class Main_linear_search {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Arrays;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int ans=0;
int n=Integer.parseInt(line);
int[] a=new int[n];
StringTokenizer st1=new StringTokenizer(br.readLine);
for(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());
int m=Integer.parseInt(br.readLine());
StringTokenizer st2=new StringTokenizer(br.readLine);
for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(Arrays.asList(a).contains(b)) ans++;
}
out.println(ans);
out.flush();
}
}
}

Compiler output:
Main.java:11: error: cannot find symbol
BufferedReader br=new BufferedReader(new InputReader(System.in));
                                         ^
  symbol:   class InputReader
  location: class Main
Main.java:17: error: cannot find symbol
StringTokenizer st1=new StringTokenizer(br.readLine);
                                          ^
  symbol:   variable readLine
  location: variable br of type BufferedReader
Main.java:20: error: cannot find symbol
StringTokenizer st2=new StringTokenizer(br.readLine);
                                          ^
  symbol:   variable readLine
  location: variable br of type BufferedReader
3 errors
Language: Java

import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
 
class Main{
 
static final PrintWriter out=new PrintWriter(System.out);
 
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int ans=0;
int n=Integer.parseInt(line);
ArrayList<Integer> array=new ArrayList<Integer>();
StringTokenizer st1=new StringTokenizer(br.readLine());
for(int i=0;i<n;i++){
a=Integer.parseInt(st1.nextToken());
array.add(a);
}
int m=Integer.parseInt(br.readLine());
StringTokenizer st2=new StringTokenizer(br.readLine());
for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(array.indexOf(b)>=0) ans++;
}
out.println(ans);
out.flush();
}
}
}

Compiler output:
Main.java:18: error: cannot find symbol
a=Integer.parseInt(st1.nextToken());
^
  symbol:   variable a
  location: class Main
Main.java:19: error: cannot find symbol
array.add(a);
          ^
  symbol:   variable a
  location: class Main
2 errors
Language: Java

import java.util.Scanner;
 
public class Main {
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
 
        int n = scanner.nextInt();
        int[] numbers = new int[n];
        for (int i = 0; i < n; i++) {
            numbers[i] = scanner.nextInt();
        }
 
        int q = scanner.nextInt();
        int[] patterns = new int[q];
        for (int i = 0; i < q; i++) {
            patterns[i] = scanner.nextInt();
        }
 
        int count = 0;
        for (int i = 0; i < q; i++) {
            int pattern = patterns[i];
            for (int j = 0; j < n; j++) {
                if (pattern == numbers[j]) {
                    ++count;
                    break;
                }
            }
        }
 
        System.out.println(count);
    }
}

Compiler output:
Main.java:4: error: cannot find symbol
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
                         ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
                                                    ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
                                                                       ^
  symbol:   class InputStreamReader
  location: class Main
3 errors