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

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

int main(){
	string s;
	string left("([");
	string right(")]");
	while(getline(cin,s),s!="."){
		stack<char> acc;
		for(int unsigned i = 0;i<s.size();i++){
			for(int unsigned j=0;j<left.size();j++){
				if(s[i] == left[j]){
					acc.push(right[j]);	
				}
			}
			if(find(right.begin(),right.end(),s[i]) != left.end() && !acc.empty()){
				if(acc.top() == s[i]){
					acc.pop();
				} else {
					break;
				}
			}
		}
		if(acc.empty()){
			cout << "yes" << endl;
		} else {
			cout << "no" << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:32: error: no matching function for call to 'find(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   20 |                         if(find(right.begin(),right.end(),s[i]) != left.end() && !acc.empty()){
      |                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:4:
/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, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_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:20:32: note:   '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' is not derived from 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >'
   20 |                         if(find(right.begin(),right.end(),s[i]) != left.end() && !acc.empty()){
      |                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

using namespace std;

string s;
vector<bool> out;

int main(){
	do{
		s.clear();
		do{
			string temp;
			getline(cin,temp);
			s+=temp;
		}while(s[s.length()-1]!='.');
		if (s.length()!=1){
			stack<int> st;	//(=0,[=1;
			int i=0,l=s.length();
			for (;i<l;i++){
				if (s[i]=='('){
					st.push(0);
				}
				else if (s[i]=='['){
					st.push(1);
				}
				else if (s[i]==')'){
					if (st.empty){
						out.push_back(false);
						break;
					}
					int type=st.top();
					st.pop();
					if (type!=0){
						out.push_back(false);
						break;
					}
				}
				else if (s[i]==']'){
					if (st.empty()){
						out.push_back(false);
						break;
					}
					int type=st.top();
					st.pop();
					if (type!=1){
						out.push_back(false);
						break;
					}
				}
			}
			if (i==l){
				if (st.empty()){
					out.push_back(true);
				}
				else{
					out.push_back(false);
				}
			}
		}
	}while(s.length()!=1);
	for (int i=0;i<out.size();i++){
		printf("%s\n",out[i] ? "yes" : "no");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:53: error: cannot convert 'std::stack<int>::empty' from type 'bool (std::stack<int>::)() const' to type 'bool'
   31 |                                         if (st.empty){
      |                                                     ^
Language: C++

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

using namespace std;

string s;
vector<bool> out;

int main(){
	do{
		s.clear();
		do{
			string temp;
			getline(cin,temp);
			s+=temp;
		}while(s[s.length()-1]!='.');
		if (s.length()!=1){
			stack<bool> st;	//(=0,[=1;
			int i=0,l=s.length();
			for (;i<l;i++){
				if (s[i]=='('){
					st.push(0);
				}
				else if (s[i]=='['){
					st.push(1);
				}
				else if (s[i]==')'){
					if (st.empty){
						out.push_back(false);
						break;
					}
					int type=st.top();
					st.pop();
					if (type!=0){
						out.push_back(false);
						break;
					}
				}
				else if (s[i]==']'){
					if (st.empty()){
						out.push_back(false);
						break;
					}
					int type=st.top();
					st.pop();
					if (type!=1){
						out.push_back(false);
						break;
					}
				}
			}
			if (i==l){
				if (st.empty()){
					out.push_back(true);
				}
				else{
					out.push_back(false);
				}
			}
		}
	}while(s.length()!=1);
	for (int i=0;i<out.size();i++){
		printf("%s\n",out[i] ? "yes" : "no");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:53: error: cannot convert 'std::stack<bool>::empty' from type 'bool (std::stack<bool>::)() const' to type 'bool'
   31 |                                         if (st.empty){
      |                                                     ^
Language: C++

#include <iostream>
using namespace std;

bool isYes(char input[]);

int main()
{
	char Input[101];
	int i=0;
	while(true){
		cin.getline(Input, sizeof(Input));
		isYes(Input){
			cout << "yes" << endl;
		} else {
			cout << "no" << endl;
		}
		if(Input[0] == '.') break;
		i++;
	}

	return 0;
}

bool isYes(char Input[])
{
	int prep[50], prepnum=0, p=3;
	for(int i=0; Input[i]!='.'; i++){
		if(Input[i] == '('){
			if(p != 3){
				prep[prepnum] = p;
				prepnum++;
			}
			p=0;
		} else if(Input[i] == '['){
			if(p != 3){
				prep[prepnum] = p;
				prepnum++;
			}
			p=1;
		} else if(Input[i] == ')'){
			if(p!=0){
				return false;
			} else {
				if(prepnum==0) p=3;
				else {
					p = prep[prepnum-1];
					prepnum--;
				}
			}
		} else if(Input[i] == ']'){
			if(p!=1){
				return false;
			} else {
				if(prepnum==0) p=3;
				else {
					p = prep[prepnum-1];
					prepnum--;
				}
			}
		}
	}
	return true;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: expected ';' before '{' token
   12 |                 isYes(Input){
      |                             ^
      |                             ;
a.cc:14:19: error: 'else' without a previous 'if'
   14 |                 } else {
      |                   ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
void test(int );
int f;
char ch[101]; 
int main(){
  while(1){
    int j=0;
    while(1){
      scanf("%c",&ch[j]);
      if(ch[j]=='.')break;
      j++; 
    }
    if(j==0)break;
    int count=0,count1=0;
    for(int i=0;i<j;i++){
      if(count1<0||count<0||f==1)break; 

      if(ch[i]=='[')count++;
      else if(ch[i]=='(')count1++;
      else if(ch[i]==']')test(i);
      else if(ch[i]==')')test(i);
    }
    if(count==0&&count1==0)cout<<"yes"<<endl;
    else cout<<"no"<<endl;  
    char a;
    scanf("%c",&a);
  }
  return 0;
}
void test(int x){
  f=0;
  int count2;
  if(ch[x]==')'){
    count1--;
    for(int i=x-1;i>=0;i--)
      if(ch[i]=='('){
	count2=0;
	for(int j=x-1;j>i;i++)
	  if(ch[i]=='[')count2++;
	  else if(ch[i]==']')count2--;
	if(count2>=1)f=1;
      }
  }
  else{
    count--;
    for(int i=x-1;i>=0;i--)
      if(ch[i]=='['){
	count2=0;
	for(int j=x-1;j>i;i++)
	  if(ch[i]=='(')count2++;
	  else if(ch[i]==')')count2--;
	if(count2>=1)f=1;
      }
  }
}

Compiler output:
a.cc: In function 'void test(int)':
a.cc:37:5: error: 'count1' was not declared in this scope; did you mean 'count2'?
   37 |     count1--;
      |     ^~~~~~
      |     count2
a.cc:48:5: error: 'count' was not declared in this scope; did you mean 'count2'?
   48 |     count--;
      |     ^~~~~
      |     count2
Language: C++

#include "limits"
#include "algorithm"
#include "iostream"
#include "cmath"
#include "string"
#include "map"
#include "iomanip"
#include "stack"
using namespace std;

int main(){
  char S[110];
  bool FLAG;
  stack<char> temp;
  while(1){
    FLAG=true;
    gets(S);
    if(S[0]=='.')break;
    for(int i=0;S[i]!='.';++i){
      if(S[i]=='(' || S[i]=='[')temp.push(S[i]);
      if(S[i]==')'){
        if(temp.empty()){
          FLAG=false;
          break;
        }
        char a=temp.top();
        temp.pop();
        if(a!='('){
          FLAG=false;
          break;
        }

      }
      if(S[i]==']'){
        if(temp.empty()){
          FLAG=false;
          break;
        }
        char a=temp.top();
        temp.pop();
        if(a!='['){
          FLAG=false;
          break;
        }
      }
    }
    if(FLAG)cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
}

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 <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    while(getline(cin,s),s!="."){
        string c;
        int d=1;
        stack<char> w;
        for(int i=0;i<s.size();i++)if(s[i]==')'||s[i]=='('||s[i]=='['||s[i]==']')c+=s[i];
            for(int i=0;i<c.size();i++){
            if(c[i]=='['||c[i]=='(')w.push(c[i]);
            else if(c[i]==']'&&w.top()=='['||c[i]==')'&&w.top()=='(')w.pop();
            else {dbreak;}
        }
        if(w.empty())cout<<"yes"<<endl;
        else fail:cout<<"no"<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: 'dbreak' was not declared in this scope
   13 |             else {dbreak;}
      |                   ^~~~~~
Language: C++

#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<stdlib.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  while(1){
    stack<int> sta;//[]:1 ():2 
    bool ans=true;
    char c[150];
    gets(c);
    if(c[0]=='.')break;
    else if(c[0]=='[')sta.push(1);
    else if(c[0]=='(')sta.push(2);
    else if(c[0]==']' || c[0]==')')ans=false;
    int i=0;
    while(ans){
      i++;
      // printf("c='%c'\n",c[i]);
      if(c[i]=='[')sta.push(1);
      else if(c[i]=='(')sta.push(2);
      else if(c[i]==']')
	if(sta.size() && sta.top()==1)sta.pop();
	else{
	  ans=false;
	  break;
	}
      else if(c[i]==')')
	if(sta.size() && sta.top()==2)sta.pop();
	else{
	  ans=false;
	  break;
	}
      else if(c[i]=='.')break;
    }
    if(sta.size()==0 && ans)cout<<"yes"<<endl;
    else{
      cout<<"no"<<endl;
    }
  }

}

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

#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<stdlib.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  while(1){
    stack<int> sta;//[]:1 ():2 
    bool ans=true;
    char c[150];
    gets(c);
    if(c[0]=='.')break;
    else if(c[0]=='[')sta.push(1);
    else if(c[0]=='(')sta.push(2);
    else if(c[0]==']' || c[0]==')')ans=false;
    int i=0;
    while(ans){
      i++;
      // printf("c='%c'\n",c[i]);
      if(c[i]=='[')sta.push(1);
      else if(c[i]=='(')sta.push(2);
      else if(c[i]==']')
	if(sta.size() && sta.top()==1)sta.pop();
	else{
	  ans=false;
	  break;
	}
      else if(c[i]==')')
	if(sta.size() && sta.top()==2)sta.pop();
	else{
	  ans=false;
	  break;
	}
      else if(c[i]=='.')break;
    }
    if(sta.size()==0 && ans)cout<<"yes"<<endl;
    else{
      cout<<"no"<<endl;
    }
  }


}

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

#include <string>
#include <algorithm>
#include <stack>

using namespace std;

int main()
{
  int no,size;
  string v;
  stack<char> sta;
  string end(".");
  char a5;

  while(1){
    no = 0;
    getline(cin,v);

    if(v == end){
      break;
    }

    for(char e : v){
      if(e == '[' || e == '('){
        sta.push(e);
      }
      else if(e == ']'){
        a5 = sta.top();
        sta.pop();

        if(a5 != '['){
          no = 1;
        }
      }
      else if(e == ')'){
        a5 = sta.top();
        sta.pop();

        if(a5 != '('){
          no = 1;
        }
      }
      if(no == 1){
        break;
      }
    }

    size = sta.size();

    if(size != 0){
      no = 1;
    }

    if(no == 1){
      cout<<"no"<<endl;
    }
    else{
      cout<<"yes"<<endl;
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'cin' was not declared in this scope
   17 |     getline(cin,v);
      |             ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <stack>
  +++ |+#include <iostream>
    4 | 
a.cc:55:7: error: 'cout' was not declared in this scope
   55 |       cout<<"no"<<endl;
      |       ^~~~
a.cc:55:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:55:19: error: 'endl' was not declared in this scope
   55 |       cout<<"no"<<endl;
      |                   ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <stack>
  +++ |+#include <ostream>
    4 | 
a.cc:58:7: error: 'cout' was not declared in this scope
   58 |       cout<<"yes"<<endl;
      |       ^~~~
a.cc:58:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:58:20: error: 'endl' was not declared in this scope
   58 |       cout<<"yes"<<endl;
      |                    ^~~~
a.cc:58:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

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

stack<bool> s;
char c[128];

int main(){
	char *p;
	bool f;
	while (gets(c), c[0] != '.') {
		s = stack<bool>();
		p = &c[0];
		f = false;
		while (*p != '.') {
			switch (*p)
			{
			case'(':
				s.push(true); break;
			case'[':
				s.push(false); break;
			case')':
				if (!s.empty() && s.top()) {
					s.pop();  break;
				}
				f = true;
				break;
			case']':
				if (!s.empty() && !s.top()) {
					s.pop(); break;
				}
				f = true;
				break;
			default:
				break;
			}
			if (f) {
				break;
			}
			p++;
		}
		if (f || !s.empty()) {
			printf("no\n");
		}
		else {
			printf("yes\n");
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'gets' was not declared in this scope; did you mean 'getw'?
   11 |         while (gets(c), c[0] != '.') {
      |                ^~~~
      |                getw
Language: C++

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

stack<bool> s;
char c[128];

int main(){
	char *p;
	bool f;
	while (gets_s(c), c[0] != '.') {
		s = stack<bool>();
		p = &c[0];
		f = false;
		while (*p != '.') {
			switch (*p)
			{
			case'(':
				s.push(true); break;
			case'[':
				s.push(false); break;
			case')':
				if (!s.empty() && s.top()) {
					s.pop();  break;
				}
				f = true;
				break;
			case']':
				if (!s.empty() && !s.top()) {
					s.pop(); break;
				}
				f = true;
				break;
			default:
				break;
			}
			if (f) {
				break;
			}
			p++;
		}
		if (f || !s.empty()) {
			printf_s("no\n");
		}
		else {
			printf_s("yes\n");
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'gets_s' was not declared in this scope
   11 |         while (gets_s(c), c[0] != '.') {
      |                ^~~~~~
a.cc:43:25: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   43 |                         printf_s("no\n");
      |                         ^~~~~~~~
      |                         printf
a.cc:46:25: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   46 |                         printf_s("yes\n");
      |                         ^~~~~~~~
      |                         printf
Language: C++


#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
#define out(S) cout<<(S)<<endl;
#define REP(i,b) for(size_t i=0;i<(b);i++)
#define rREP(i,b) for(int i=(b)-1;i>=0;i--)
#define FOR(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define Foreach(item,collection) for(auto item:collection)
#define mod(i) ((i) % (ll)(1e9 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9 + 5))))
#define Yes out("Yes")
#define No out("No")
#define NO out("NO")
#define YES out("YES")
#define INF 1e10;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define IfOut(condition,text) if((condition)){out(text);return 0;}
#define IfeOut(condition,itext,etext) if(condition){out(itext);return 0;}else{out(etext);return 0;}
#define Select(collection,condition,result) Foreach(i,collection){result+=condition;}
#define GetAuto(_N,vect) {cin>>_N;vect.resize(_N);REP(i,_N){cin>>vect[i];}}
#define beginend(vec) (vec).begin(),(vec).end()
#define pb(item) push_back(item)
#define removeAll(vec,deleg) auto itr=remove_if(beginend(vec),deleg);vec.erase(itr,vec.end());
void removeAt(string& s, int index) { s.erase(index, 1); }
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
ll manhattanDistance(ll x1, ll y1, ll x2, ll y2) { return (abs(x2 - x1) + abs(y2 - y1)); }
vector<ll> sieveOfEratosthenes(int max) {ll prime;double sqrtmax = sqrt(max);vector<ll> primeVec, searchVec;FOR(i, 2, max + 1) searchVec.push_back(i);do{prime = searchVec[0];primeVec.push_back(prime);auto itr = remove_if(beginend(searchVec), [=](ll x)->bool {return x%prime == 0; });searchVec.erase(itr, searchVec.end());} while (prime < sqrtmax);primeVec.reserve(primeVec.size() + searchVec.size());primeVec.insert(primeVec.end(), beginend(searchVec));return primeVec;}

int solve(string S) {
	int maru = 0, kaku = 0;
	Foreach(i, S) {
		if (i == '(') maru++;
		else if (i == '[') kaku++;
		else if (i == ')') {
			if (maru > 0) maru--;
			else {
				break;
			}
		}
		else if (i == ']') {
			if (kaku > 0)kaku--;
			else {
				break;
			}
		}
	}
	IfeOut(kaku == 0 && maru == 0, "yes", "no");
}

int main() {
	char S[105];
	while (cin.getline(S, sizeof(S)))
	{
		if (strlen(S) == 1 && S[0] == '.') break;
		solve(S);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:21: error: 'strlen' was not declared in this scope
   71 |                 if (strlen(S) == 1 && S[0] == '.') break;
      |                     ^~~~~~
a.cc:10:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <set>
  +++ |+#include <cstring>
   10 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
main(){
  char s[101];
  while(gets(s),s[0]!='.'){
    stack<char> a;
    int i=0;
    for(;s[i]!='.';++i){
      if(!(s[i]-'(')||!(s[i]-'['))a.push(s[i]);
      if(s[i]==')')if(a.empty()||a.top()!='(')break;else a.pop();
      if(s[i]==']')if(a.empty()||a.top()!='[')break;else a.pop();
    }cout<<(s[i]!='.'||!a.empty()?"no":"yes")<<endl;
  }
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    5 |   while(gets(s),s[0]!='.'){
      |         ^~~~
      |         getw
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstdio>
#define F(i,n) for(int i=0;i<(int)(n);i++)
#define INF 100000000
#define ll long long

using namespace std;
typedef pair<int, int> P;

int main() {
	char b;
	string a;
	int ans,i,j,p=0;
	stack<int> s;
	while (1) {
		ans = 0;
		i = 0;
		while (s.size()!=0) {
			s.pop();
		}
		getline(cin, a);
		F(j,n) {
			if (i == 0 && a[j] == '.') {
				p = 1;
				break;
			}
			if (a[j] == '.') {
				if (s.size()!=0 ){
					ans = 1;
					break;
				}
				break;
			}
			if (a[j] == '(')s.push(1);
			if (a[j] == '[')s.push(2);
			if (a[j] == ')') {
				if (s.size() == 0) {
					ans = 1;
					continue;
				}
				if (s.top() == 1) {
					s.pop();
				}
				else {
					ans = 1;
				}
			}
			if (a[j] == ']') {
				if (s.size() == 0) {
					ans = 1;
					continue;
				}
				if (s.top() == 2) {
					s.pop();
				}
				else {
					ans = 1;
				}
			}
			i = 1;

		}
		if (p == 1)break;
		if (ans == 0)cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: 'n' was not declared in this scope
   27 |                 F(j,n) {
      |                     ^
a.cc:8:36: note: in definition of macro 'F'
    8 | #define F(i,n) for(int i=0;i<(int)(n);i++)
      |                                    ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstdio>
#define F(i,n) for(int i=0;i<(int)(n);i++)
#define INF 100000000
#define ll long long

using namespace std;
typedef pair<int, int> P;

int main() {
	string a;
	int ans,i,j,p=0;
	stack<int> s;
	while (1) {
		ans = 0;
		i = 0;
		while (s.size()!=0) {
			s.pop();
		}
		getline(cin, a);
		F(j,n) {
			if (i == 0 && a[j] == '.') {
				p = 1;
				break;
			}
			if (a[j] == '.') {
				if (s.size()!=0 ){
					ans = 1;
					break;
				}
				break;
			}
			if (a[j] == '(')s.push(1);
			if (a[j] == '[')s.push(2);
			if (a[j] == ')') {
				if (s.size() == 0) {
					ans = 1;
					break;
				}
				if (s.top() == 1) {
					s.pop();
				}
				else {
					ans = 1;
				}
			}
			if (a[j] == ']') {
				if (s.size() == 0) {
					ans = 1;
					break;
				}
				if (s.top() == 2) {
					s.pop();
				}
				else {
					ans = 1;
					break;
				}
			}
			i = 1;

		}
		if (p == 1)break;
		if (ans == 0)cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: 'n' was not declared in this scope
   26 |                 F(j,n) {
      |                     ^
a.cc:8:36: note: in definition of macro 'F'
    8 | #define F(i,n) for(int i=0;i<(int)(n);i++)
      |                                    ^
Language: C++

#include <iostream>

class CStack
{
public:
    CStack()
    {
        topIndex = 0;
    }
    ~CStack(){;}
    
    void push(char charactor)
    {
        if(topIndex < 100)  /* スタック可能数を超えてpushした場合、なにもしない */
        {
            stack[topIndex] = charactor;
            ++topIndex;
        }
    }
    char pop(void)
    {
        if(topIndex > 0)
        {
            --topIndex;
            return stack[topIndex];
        }
        return '\0';
    }
    char top(void)
    {
        return stack[topIndex-1];
    }
    bool enpty(void)
    {
        if(topIndex == 0)
        {
            return true;
        }
        return false;
    }
    
private:
    int topIndex;
    char stack[100];
};

/* 括弧の左右が対になっているか */
bool isMatchLeftRight(char left, char right)
{
    if((left == '(') %% (right == ')'))
    {
        return true;
    }
    if((left == '[') && (right == ']'))
    {
        return true;
    }
    return false;
}

/* 1行がバランスしているか */
bool isBalance(char* line)
{
    bool result = true;
    CStack cStack;      /* スタック生成 */
    
    for(int index=0; index<100; ++index)
    {
        /* 行の最後か */
        if(line[index]=='.')
        {
            break;
        }
        
        if((line[index]=='(') || (line[index]=='['))
        {
            cStack.push(line[index]);    /* 左括弧をpush */
        }
        else
        {
            if((line[index]==')') || (line[index]==']'))
            {
                if(isMatchLeftRight(cStack.top(), line[index]))
                {
                    cStack.pop();        /* 直前の左括弧をpop */
                }
                else
                {
                    result = false;
                    break;
                }
            }
        }
    }
    
    if((result==true) && (cStack.enpty()))
    {
        result = true;
    }
    else
    {
        result = false;
    }
    return result;
}

int main(void)
{
    for(;;)
    {
        std::string sLine(100, '\0');
        getline(std::cin, sLine);   /* 1行取得 */
        
        if(sLine.size()>100) /* 100文字を超えていたら終了 */
        {
            break;
        }
        if(sLine[0]=='.')    /* データセットの最後なら処理終了 */
        {
            break;
        }
        
        /* 苦肉の策 */
        char line[100] = {'\0'};
        for(int index=0; index<sLine.size(); ++index)
        {
            line[index] = sLine[index];
        }

        /* 1行がバランスしているかチェック */
        bool result = true;
        result = isBalance(line);
        
        /* 1行の結果を出力 */
        if(result == true)
        {
            std::cout << "yes" << std::endl;
        }
        else
        {
            std::cout << "no" << std::endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'bool isMatchLeftRight(char, char)':
a.cc:50:23: error: expected primary-expression before '%' token
   50 |     if((left == '(') %% (right == ')'))
      |                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


bool f(string s){
  vector<char> q;

  rep(i,s.size()){
    if(s[i]=='('||s[i]=='[') q.push_back(s[i]);
    if(s[i]==')'){
      if(q.size()==0) return false;
      if(q[q.size()-1]=='[') return false;
      q.pop_back();
    }
    if(s[i]==']'){
      if(q.size()==0) return false;
      if(q[q.size()-1]=='(') return false;
      q.pop_back();
    }
  }

  if(q.size()) return false;

  return true;
}





Compiler output:
/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 <bits/stdc++.h>

using namespace std;

#define MAX_LSIZE 100  // 一行の最大の長さ 
char buff[MAX_LSIZE+2];  // 一行の文字列を格納する配列     
// 行末の改行文字、NULL 文字も格納される 
char stack[MAX_LSIZE];  // スタック 
int sp;    // スタックポインタ 
 
int main() {   char c;  // 処理する文字を入れる変数   
    int match; // 括弧のバランス状況を表す   // 1 -> バランス,  0 -> 非バランス, -1 -> まだ不明   
    int i;   
    while(1){     
        fgets(buff, MAX_LSIZE+2, stdin); // 標準入力より配列 buff に１行読み込む     
        if(buff[0] == '.') break; // 先頭の文字が '.' なら終了     
        match = -1;  // バランス状況はまだ不明     
        sp = 0;   // stack pointer sp を初期化     
        for(i=0; ; i++){ // 文字列の先頭から順に１文字ずつ以下の処理を行う       
        c = buff[i];  // c = 処理対象の文字       
        switch(c){       
            case '(':       
            case '[':  
                    stack[sp++] = c; 
                    break;  // stack に 左括弧 を入れる       
            case ')': // stack が空か、 // stack から取り出した文字が '(' でなければバランスしていない  
                if(sp==0) match=0;  
                else if(stack[--sp] != '(') match = 0;  
                break;       
            case ']': // stack が空か、 // stack から取り出した文字が '[' でなければバランスしていない  
                if(sp==0) match=0;  
                else if(stack[--sp] != '[') match = 0;  
                break;       
            case '.': // stack が空ならバランス、そうでなければ非バランス  
                if(sp==0) match=1;  
                else match=0;       
            }       
            if(match != -1) break; // 結果が判明したので終了    
        } 
        if(match) printf("yes\n"); // 結果を出力     
        else printf("no\n");   
    } 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: reference to 'stack' is ambiguous
   24 |                     stack[sp++] = c;
      |                     ^~~~~
In file included from /usr/include/c++/14/stack:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:160,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_stack.h:99:11: note: candidates are: 'template<class _Tp, class _Sequence> class std::stack'
   99 |     class stack
      |           ^~~~~
a.cc:8:6: note:                 'char stack [100]'
    8 | char stack[MAX_LSIZE];  // スタック
      |      ^~~~~
a.cc:28:25: error: reference to 'stack' is ambiguous
   28 |                 else if(stack[--sp] != '(') match = 0;
      |                         ^~~~~
/usr/include/c++/14/bits/stl_stack.h:99:11: note: candidates are: 'template<class _Tp, class _Sequence> class std::stack'
   99 |     class stack
      |           ^~~~~
a.cc:8:6: note:                 'char stack [100]'
    8 | char stack[MAX_LSIZE];  // スタック
      |      ^~~~~
a.cc:32:25: error: reference to 'stack' is ambiguous
   32 |                 else if(stack[--sp] != '[') match = 0;
      |                         ^~~~~
/usr/include/c++/14/bits/stl_stack.h:99:11: note: candidates are: 'template<class _Tp, class _Sequence> class std::stack'
   99 |     class stack
      |           ^~~~~
a.cc:8:6: note:                 'char stack [100]'
    8 | char stack[MAX_LSIZE];  // スタック
      |      ^~~~~
Language: C++


#include<iostream>
#include<stack>
using namespace std;
main(){
int i,f;
for(string s;getline(cin,s),s[0]!='.';){
 stack<char> t;
 for(f=i=0;c=s[i++],c!='.';){
  if(c==40|c==91)t.push(c);
  if(c==41|c==93){
   if(!t.empty()&&c-t.top()<3)t.pop();
   else f=1;
  }
 }
 puts(!f&t.empty()?"yes":"no");
}}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:12: error: 'c' was not declared in this scope
    9 |  for(f=i=0;c=s[i++],c!='.';){
      |            ^
Language: C++


#include<iostream>
#include<stack>
main(){
for(char i,f,c,s[101];gets(s),s[0]-'.';){
 std::stack<char> t;
 for(f=i=0;c=s[i++],c!='\0';){
  if(c==40|c==91)t.push(c);
  if(c==41|c==93){
   if(t.size()&&c-t.top()<3)t.pop();
   else f=1;
  }
 }
 puts(f&t.size()?"no":"yes");
}}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:5:23: error: 'gets' was not declared in this scope; did you mean 'getw'?
    5 | for(char i,f,c,s[101];gets(s),s[0]-'.';){
      |                       ^~~~
      |                       getw
Language: C++

#include <iostream>
#include <deque>
#include <cstring>
using namespace std;
bool beginC(char c) {
	return (c == '[' || '(' == c);
}
bool endC(char c) {
	return (c == ']' || ')' == c);
}
bool cuple(char l, char r) {
	return (l == '(' && r == ')') || (l == '[' && r == ']');
}
int size;
bool solve(char str[]) {
	deque<char> deq;
	for (int i = 0; i < size; i++) {
		if (beginC(str[i])) {
			deq.push_front(str[i]);
		}
		else if (endC(str[i])) {
			if (deq.empty()) return false;
			char recent = deq.front();
			if (!cuple(recent, str[i])) {
				return false;
			}
			deq.pop_front();
		}
	}
	return deq.size() == 0;
}

int main() {
	char str_c[128];
	while (1) {
		gets(str_c);
		size = strlen(str_c);
		string str(str_c);
		if (str == ".") return 0;
		cout << (solve(str_c) ? "yes" : "no") <<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'bool solve(char*)':
a.cc:17:29: error: reference to 'size' is ambiguous
   17 |         for (int i = 0; i < size; i++) {
      |                             ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:14:5: note:                 'int size'
   14 | int size;
      |     ^~~~
a.cc: In function 'int main()':
a.cc:36:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   36 |                 gets(str_c);
      |                 ^~~~
      |                 getw
a.cc:37:17: error: reference to 'size' is ambiguous
   37 |                 size = strlen(str_c);
      |                 ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:14:5: note:                 'int size'
   14 | int size;
      |     ^~~~
Language: C++

#include<stack>
#include<cstdio>
#include<cstring>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	for(char s[101];gets(s),strcmp(s,".");){
		bool ok=true;
		stack<char> St;
		rep(i,strlen(s)){
			if(s[i]=='(') St.push(s[i]);
			if(s[i]=='[') St.push(s[i]);
			if(s[i]==')') if(St.empty() || St.top()=='[') { ok=false; break; } else St.pop();
			if(s[i]==']') if(St.empty() || St.top()=='(') { ok=false; break; } else St.pop();
		}
		puts(ok?"yes":"no");
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: 'gets' was not declared in this scope; did you mean 'getw'?
   10 |         for(char s[101];gets(s),strcmp(s,".");){
      |                         ^~~~
      |                         getw
Language: C++

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

using namespace std;

int main(void){
  string s;
  stack<char> str;

  while(getline(cin,s) && s!="."){

    string ch;
    for(int i=0;i<s.length;i++)
      if(s[i]=='{' || s[i]=='(' || s[i]=='}' || s[i]==')')ch+=s[i];

    for(int i=0;i<ch.length();i++){
      
      if(ch[i]=='(' || ch[i]=='{')str.push(s[i]);
      
      if(ch[i]==')' && str.top()=='(')str.pop();
      if(ch[i]=='}' && str.top()=='}')str.pop();
    }

    cout << str.empty()?"YES":"NO" << endl;

  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: 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 '()' ?)
   14 |     for(int i=0;i<s.length;i++)
      |                   ~~^~~~~~
      |                           ()
a.cc:25:36: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
   25 |     cout << str.empty()?"YES":"NO" << endl;
      |                               ~~~~~^~~~~~~
Language: C++

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

using namespace std;

int main(void){
  string s;
  stack<char> str;

  while(getline(cin,s) && s!="."){
    flag = true;
    string ch;
    for(int i=0;i<s.size();i++)
      if(s[i]=='{' || s[i]=='(' || s[i]=='}' || s[i]==')')ch+=s[i];

    for(int i=0;i<ch.length();i++){
      
      if(ch[i]=='(' || ch[i]=='{')str.push(s[i]);
      else if(ch[i]==')' && str.top()=='(')str.pop();
      else if(ch[i]=='}' && str.top()=='}')str.pop();
      else {
	flag = false;
	break;
      }
    }

    cout << (flag && str.empty()?"YES":"NO") << endl;

  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'flag' was not declared in this scope
   12 |     flag = true;
      |     ^~~~
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <stack>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

char str[1000];
int main() {
  while (gets(str), str[0] != '.') {
    stack<int> st;
    int len = strlen(str);
    bool ok = true;
    REP(i, len) {
      if (str[i] == '(') { st.push('('); }
      else if (str[i] == '[') { st.push('['); }
      else if (str[i] == ')') {
        if (st.empty() || st.top() != '(') { ok = false; break; }
        st.pop();
      } else if (str[i] == ']') {
        if (st.empty() || st.top() != '[') { ok = false; break; }
        st.pop();
      }
    }
    if (!st.empty()) { ok = false; }
    puts(ok ? "yes" : "no");
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: 'gets' was not declared in this scope; did you mean 'getw'?
   25 |   while (gets(str), str[0] != '.') {
      |          ^~~~
      |          getw
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <stack>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

char str[1000];
int main() {
  while (fgets(str, stdin), str[0] != '.') {
    stack<int> st;
    int len = strlen(str);
    bool ok = true;
    REP(i, len) {
      if (str[i] == '(') { st.push('('); }
      else if (str[i] == '[') { st.push('['); }
      else if (str[i] == ')') {
        if (st.empty() || st.top() != '(') { ok = false; break; }
        st.pop();
      } else if (str[i] == ']') {
        if (st.empty() || st.top() != '[') { ok = false; break; }
        st.pop();
      }
    }
    if (!st.empty()) { ok = false; }
    puts(ok ? "yes" : "no");
  }
}

Compiler output:
In file included from a.cc:1:
a.cc: In function 'int main()':
a.cc:25:21: error: invalid conversion from 'FILE*' to 'int' [-fpermissive]
   25 |   while (fgets(str, stdin), str[0] != '.') {
      |                     ^~~~~
      |                     |
      |                     FILE*
a.cc:25:15: error: too few arguments to function 'char* fgets(char*, int, FILE*)'
   25 |   while (fgets(str, stdin), str[0] != '.') {
      |          ~~~~~^~~~~~~~~~~~
/usr/include/stdio.h:654:14: note: declared here
  654 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
      |              ^~~~~
Language: C++

#include <iostream>
#include <climits>
#include <string>
#include <cstring>
#include <stack>

using namespace std;

char s[1000];

string solve()
{
	stack<char> st;

	for(int i = 0; s[i] != '.'; i++)
	{
		if( s[i] == '(' )
		{
			st.push('(');
		}
		else if( s[i] == '[' )
		{
			st.push('[');
		}
		else if( s[i] == ')' )
		{
			if( !st.empty() && st.top() == '(' )
				st.pop();
			else
				st.push(')');
		}
		else if( s[i] == ']' )
		{
			if( !st.empty() && st.top() == '[' )
				st.pop();
			else
				st.push(']');
		}
	}

	if( st.empty() && st.empty() )
		return "yes";
	else 
		return "no";
}

int main()
{
	while( gets(s), s[0] != '.' )
	{
		cout << solve() << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:16: error: 'gets' was not declared in this scope; did you mean 'getw'?
   49 |         while( gets(s), s[0] != '.' )
      |                ^~~~
      |                getw
Language: C++

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

int main()
{
	//string tmp;
	char tmp[105];
	while(1)
	{
		//cin>>tmp;
		gets(tmp);
		if(tmp[0]=='.') break;
		else
		{
			bool flag=true;
			stack<char> s;
			for(int i=0;tmp[i]!='.';i++)
			{
				char top=' ';
				if(!s.empty()) top=s.top();
				if(tmp[i]=='('||tmp[i]=='[') s.push(tmp[i]);
				else if(top=='('&&tmp[i]==')') s.pop();
				else if(top=='['&&tmp[i]==']') s.pop();
				else if(tmp[i]==')'||tmp[i]==']') {flag=false; break;}
			}

			if(!s.empty()) flag=false;

			cout<<(flag?"yes":"no")<<endl;
		}
	}
	return 0;
}

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

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

using namespace std;

void solve(){
	string s;
	while(getline(cin,s)&&s!="."){
		stack<char> sk;
		bool ok=true;
		for(int i=0;i<s.size();i++){
			if(s[i]=='(')sk.push('(');
			else if(s[i]=='[')sk.push('[');
			else if(s[i]==')'){
				if(sk.size()&&sk.top()=='('){
					sk.pop();
				}
				else{
					ok=false;
					break;
				}
			}
			else if(s[i]==']'){
				if(sk.size()&&sk.top()=='['){
					sk.pop();
				}
				else{
					ok=false;
					break;
				}
			}
		}
		if(ok)cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
}

Compiler output:
/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 <vector>
#include <algorithm>
#include <string>
#include <stack>

using namespace std;

void solve(){
	string s;
	while(getline(cin,s)&&s!="."){
		stack<char> sk;
		bool ok=true;
		for(int i=0;i<s.size();i++){
			if(s[i]=='(')sk.push('(');
			else if(s[i]=='[')sk.push('[');
			else if(s[i]==')'){
				if(sk.size()&&sk.top()=='('){
					sk.pop();
				}
				else{
					ok=false;
					break;
				}
			}
			else if(s[i]==']'){
				if(sk.size()&&sk.top()=='['){
					sk.pop();
				}
				else{
					ok=false;
					break;
				}
			}
		}
		if(ok&&sk.size()==0)cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
}

Compiler output:
/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>
using namespace std;

int main(void){
	char std[101];
	
	while(1){
		//入力
		gets(std);
		if(std[0]=='.')break;

		//計算
		stack<int> s;
		s.push(0);
		int flag=1;
		for(int i=0; std[i]!='.'; i++){
			if		(std[i]=='('){
				s.push(1);
			}else if(std[i]=='['){
				s.push(2);
			}else if(std[i]==')'){
				if(s.top()!=1){flag=0; break;}
				s.pop();
			}else if(std[i]==']'){
				if(s.top()!=2){flag=0; break;}
				s.pop();
			}
		}
		if(s.top()!=0){
			flag=0;
		}

		//出力
		if(flag)
			cout << "yes" << endl;
		else
			cout << "no" << endl;
	}
	
	return 0;
}

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

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

int main(void){
	char str[101];
	
	while(1){
		//入力
		gets(str);
		if(str[0]=='.')break;

		//計算
		stack<int> s;
		s.push(0);
		int flag=1;
		for(int i=0; str[i]!='.'; i++){
			if		(str[i]=='('){
				s.push(1);
			}else if(str[i]=='['){
				s.push(2);
			}else if(str[i]==')'){
				if(s.top()!=1){flag=0; break;}
				s.pop();
			}else if(str[i]==']'){
				if(s.top()!=2){flag=0; break;}
				s.pop();
			}
		}
		if(s.top()!=0){
			flag=0;
		}

		//出力
		if(flag)
			cout << "yes" << endl;
		else
			cout << "no" << endl;
	}
	
	return 0;
}

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

// AOJ 1173

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

int main(void)
{
	while (1){
		string str;
		getline(cin, str);
		if (str == "."){
			break;
		}
		
		stack <char> st;
		bool flag = true;
		for (int i = 0; i < str.length(); i++){
			if (str[i] == '(' || str[i] == '['){
				st.push(str[i]);
			}
			if (str[i] == ')'){
				if (st.size() == 0 || st.top == '['){
					flag = false;
				}
				else if (st.top() == '('){
					st.pop();
				}
			}
			if (str[i] == ']'){
				if (st.size() == 0 || st.top == '('){
					flag = false;
				}
				else if (st.top() == '['){
					st.pop();
				}
			}
		}
		if (st.size() == 0 && flag){
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:62: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator=='
   24 |                                 if (st.size() == 0 || st.top == '['){
      |                                                       ~~~~~~ ^~ ~~~
      |                                                          |      |
      |                                                          |      char
      |                                                          <unresolved overloaded function type>
a.cc:32:62: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator=='
   32 |                                 if (st.size() == 0 || st.top == '('){
      |                                                       ~~~~~~ ^~ ~~~
      |                                                          |      |
      |                                                          |      char
      |                                                          <unresolved overloaded function type>
Language: C++


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

using namespace std;

int main(){
  string str;
 
  while ( 1 ){
    string s = "yes";
    getline( cin, str );
    if ( str[0] == '.' ) break;
    stack<char> sta;
    for ( int i = 0; str[i] != '\0'; i++ ){
      if ( str[i] == '(' || str[i] == '[' ){
        sta.push( str[i] );
      }else if ( str[i] == ')' ){
        if ( sta.top() == '(' ){
          sta.pop();
	}else{
	  s = "no";
	  break;
	}
      }else if ( str[i] == ']' ){
        if ( sta.top() == '[' ){
          sta.pop();
        }else{
	  s = "no";
	  break;
	}
      }
    }
    if ( !sta.empty() ) s = "no";
    cout << s << endl;
  }
}

Compiler output:
a.cc:20:33: error: stray '\23' in program
   20 |         if ( sta.top() == '(' ){<U+0013>
      |                                 ^~~~~~~~