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

import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int a=s.nextInt();
		for(int i=0;i<a;i++){
			ping command=s.next();
			String str=s.next();
			for(int j=command.length()-1;j>=0;j--){
				switch(command.charAt(j)){
					case 'J':
						str=str.charAt(str.length()-1)+str.substring(0,str.length()-1);
						break;
					case 'C':
						str=str.substring(1)+str.charAt(0);
						break;
					case 'E':
						if(str.length()%2==0)
							str=str.substring(str.length()/2)+str.substring(0,str.length()/2);
						else str=str.substring(str.length()/2+1)+str.charAt(str.length()/2)+str.substring(0,str.length()/2);
						break;
					case 'A':
						String n="";
						for(int k=str.length()-1;k>=0;k--)n+=str.charAt(k);
						str=n;
						break;
					case 'P':
						for(int k=0;k<str.length();k++){
							if('1'<=str.charAt(k)&&str.charAt(k)<='9'){
								str=str.substring(0,k)+(char)(str.charAt(k)-1)+str.substring(k+1);
							}else if(str.charAt(k)=='0')str=str.substring(0,k)+'9'+str.substring(k+1);
						}
						break;
					case 'M':
						for(int k=0;k<str.length();k++){
							if('0'<=str.charAt(k)&&str.charAt(k)<='8'){
								str=str.substring(0,k)+(char)(str.charAt(k)+1)+str.substring(k+1);
							}else if(str.charAt(k)=='9')str=str.substring(0,k)+'0'+str.substring(k+1);
						}
						break;
				}
			}
			System.out.println(str);
		}
	}
}

Compiler output:
Main.java:7: error: cannot find symbol
			ping command=s.next();
			^
  symbol:   class ping
  location: class Main
1 error
Language: C++

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

int main() {
  int n; cin >> n;
  while(n--) {
    string member; cin >> member;
    string s; cin >> s;
    int siz = s.size();
    for(int i = member.size()-1; i >= 0; i--) {
      char c = member[i];
      if(c == 'C') {;
        s = s.substr(1, siz) + s[0];
      } else if(c == 'J') {
        s = s[siz-1] + s.substr(0, siz-1);
      } else if(c == 'E') {
        string temp = s.substr(0, siz/2);
        s = s.substr(siz/2, siz) + temp;
      } else if(c == 'A') {
        reverse(s.begin(), s.end());
      } else if(c == 'M') {
        for(int j = 0; j < siz; j++) {
          if('0' <= s[j] && s[j] <= '9') {
            if(s[j] != '9') s[j]++;
            else s[j] = '0';
          }
        }
      } else if(c == 'P') {
        for(int j = 0; j < siz; j++) {
          if('0' <= s[j] && s[j] <= '9') {
            if(s[j] != '0') s[j]--;
            else s[j] = '9';
          }
        }
      }
    }
    cout << s << endl;
  }
}

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

#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

void c_j(string str);
void c_c(string str);
void c_e(string str);
void c_a(string str);
void c_p(string str);
void c_m(string str);

int main()
{
	int n;
	string order, message;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> order >> message;
		for(int j = order.length()-1; j >= 0; j++){
			if(order[j] == 'J') c_j(message);
			else if(order[j] == 'C') c_c(message);
			else if(order[j] == 'E') c_e(message);
			else if(order[j] == 'A') c_a(message);
			else if(order[j] == 'P') c_p(message);
			else if(order[j] == 'M') c_m(message); 
		}
		cout << message << endl;
	}
	return 0;
}

void c_j(string str)
{
	char c;
	c = str[str.length()-1];
	str.pop_back;
	str = c + str;
}

void c_c(string str)
{
	char c;
	c = str[0];
	str.erase(str.begin());
	str += c;
}

void c_e(string str)
{
	string a;
	int l = str.length();
	a = str.substr(0, l / 2);
	if( l % 2 == 1){
		char c = str[l / 2 + 1];
		str.erase(str.begin(), str.begin() + l);
		str += c;
		str += a;
	} else {
		str.erase(str.begin(), str.begin() + (l - 1));
		str += a;
	}
}

void c_a(string str)
{
	reverse(str.begin(), str.end());
}

void c_p(string str)
{
	for(int i = 0; i < str.length() - 1; i++){
		if(isdigit(str[i])){
			int n = str[i] - '0';
			n--;
			if(n == -1) n = 9;
			str[i] = n + '0';
		}
	}
}

void c_m(string str)
{
	for(int i = 0; i < str.length() - 1; i++){
		if(isdigit(str[i])){
			int n = str[i] - '0';
			n = (n + 1) % 10;
			str[i] = n + '0';
		}
	}
}

Compiler output:
a.cc: In function 'void c_j(std::string)':
a.cc:48:13: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   48 |         str.pop_back;
      |         ~~~~^~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 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:2:
/usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here
 2174 |       pop_back() noexcept
      |       ^~~~~~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

void c_j(string str);
void c_c(string str);
void c_e(string str);
void c_a(string str);
void c_p(string str);
void c_m(string str);

int main()
{
	int n;
	string order, message;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> order >> message;
		for(int j = order.length()-1; j >= 0; j++){
			if(order[j] == 'J') c_j(message);
			else if(order[j] == 'C') c_c(message);
			else if(order[j] == 'E') c_e(message);
			else if(order[j] == 'A') c_a(message);
			else if(order[j] == 'P') c_p(message);
			else if(order[j] == 'M') c_m(message); 
		}
		cout << message << endl;
	}
	return 0;
}

void c_j(string str)
{
	char c;
	c = str[str.length()-1];
	str -= c;
	str = c + str;
}

void c_c(string str)
{
	char c;
	c = str[0];
	str.erase(str.begin());
	str += c;
}

void c_e(string str)
{
	string a;
	int l = str.length();
	a = str.substr(0, l / 2);
	if( l % 2 == 1){
		char c = str[l / 2 + 1];
		str.erase(str.begin(), str.begin() + l);
		str += c;
		str += a;
	} else {
		str.erase(str.begin(), str.begin() + (l - 1));
		str += a;
	}
}

void c_a(string str)
{
	reverse(str.begin(), str.end());
}

void c_p(string str)
{
	for(int i = 0; i < str.length() - 1; i++){
		if(isdigit(str[i])){
			int n = str[i] - '0';
			n--;
			if(n == -1) n = 9;
			str[i] = n + '0';
		}
	}
}

void c_m(string str)
{
	for(int i = 0; i < str.length() - 1; i++){
		if(isdigit(str[i])){
			int n = str[i] - '0';
			n = (n + 1) % 10;
			str[i] = n + '0';
		}
	}
}

Compiler output:
a.cc: In function 'void c_j(std::string)':
a.cc:48:13: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
   48 |         str -= c;
      |         ~~~~^~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char messengers[7];
		char message[26];
		cin >> messengers;
		cin >> message;
		int messengersNum = strlen(messengers);
		int messLen = strlen(message);
		for (int j = 0; j < messengersNum; j++)
		{
			char c = messengers[j];
			if (c == 'J')
			{
				char tmp = message[0];
				for (int k = 0; k + 1 < messLen; k++)
				{
					message[k] = message[k + 1];
				}
				message[messLen - 1] = tmp;
			}
			else if (c == 'C')
			{
				char tmp = message[messLen - 1];
				for (int k = messLen - 1; k - 1 >= 0; k--)
				{
					message[k] = message[k - 1];
				}
				message[0] = tmp;
			}
			else if (c == 'E')
			{
				if (messLen % 2 == 0)
				{
					int range = messLen / 2;
					for (int k = 0; k + range< messLen; k++)
					{
						char tmp = message[k];
						message[k] = message[k + range];
						message[k + range] = tmp;
					}
				}
				else
				{
					int range = messLen / 2 + 1;
					for (int k = 0; k  + range < messLen; k++)
					{
						char tmp = message[k];
						message[k] = message[k + range];
						message[k + range] = tmp;
					}
				}
			}
			else if (c == 'A')
			{
				for (int k = 0; k < messLen - k; k++)
				{
					char tmp = message[k];
					message[k] = message[messLen - 1 - k];
					message[messLen - 1 - k] = tmp;
				}
			}
			else if (c == 'P')
			{
				for (int k = 0; k< messLen; k++)
				{
					if (message[k] >= '0' && message[k] <= '9')
					{
						message[k]++;
						if (message[k] > '9')
						{
							message[k] = '0';
						}
					}
				}
			}
			else if (c == 'M')
			{
				for (int k = 0; k< messLen; k++)
				{
					if (message[k] >= '0' && message[k] <= '9')
					{
						message[k]--;
						if (message[k] < '0')
						{
							message[k] = '9';
						}
					}
				}
			}
		}

		cout << message << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:37: error: 'strlen' was not declared in this scope
   13 |                 int messengersNum = strlen(messengers);
      |                                     ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char messengers[7];
		char message[26];
		cin >> messengers;
		cin >> message;
		int messengersNum = strlen(messengers);
		int messLen = strlen(message);
		for (int j = 0; j < messengersNum; j++)
		{
			char c = messengers[j];
			if (c == 'J')
			{
				char tmp = message[0];
				for (int k = 0; k + 1 < messLen; k++)
				{
					message[k] = message[k + 1];
				}
				message[messLen - 1] = tmp;
			}
			else if (c == 'C')
			{
				char tmp = message[messLen - 1];
				for (int k = messLen - 1; k - 1 >= 0; k--)
				{
					message[k] = message[k - 1];
				}
				message[0] = tmp;
			}
			else if (c == 'E')
			{
				if (messLen % 2 == 0)
				{
					int range = messLen / 2;
					for (int k = 0; k + range< messLen; k++)
					{
						char tmp = message[k];
						message[k] = message[k + range];
						message[k + range] = tmp;
					}
				}
				else
				{
					int range = messLen / 2 + 1;
					for (int k = 0; k  + range < messLen; k++)
					{
						char tmp = message[k];
						message[k] = message[k + range];
						message[k + range] = tmp;
					}
				}
			}
			else if (c == 'A')
			{
				for (int k = 0; k < messLen - k; k++)
				{
					char tmp = message[k];
					message[k] = message[messLen - 1 - k];
					message[messLen - 1 - k] = tmp;
				}
			}
			else if (c == 'P')
			{
				for (int k = 0; k< messLen; k++)
				{
					if (message[k] >= '0' && message[k] <= '9')
					{
						message[k]++;
						if (message[k] > '9')
						{
							message[k] = '0';
						}
					}
				}
			}
			else if (c == 'M')
			{
				for (int k = 0; k< messLen; k++)
				{
					if (message[k] >= '0' && message[k] <= '9')
					{
						message[k]--;
						if (message[k] < '0')
						{
							message[k] = '9';
						}
					}
				}
			}
		}

		cout << message << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:37: error: 'strlen' was not declared in this scope
   14 |                 int messengersNum = strlen(messengers);
      |                                     ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<stdlib.h>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <string>
#include <iostream>

using namespace std;

string turn1(string S)
{
	return S.substr(1, S.size() - 1) + S[0];
}

string turn2(string S)
{
	return S[S.size() - 1] + S.substr(0, S.size() - 1);
}

string turn3(string S)
{
	string T;

	if (S.size() % 2 == 1)
	{
		T = S.substr(S.size() / 2 + 1, S.size() / 2) + S[S.size() / 2] + S.substr(0, S.size() / 2);
	}
	else
	{
		T = S.substr(S.size() / 2, S.size() / 2) + S.substr(0, S.size() / 2);
	}

	return T;
}

string turn4(string S)
{
	reverse(S.begin(), S.end());

	return S;
}

string turn5(string S)
{
	for (int i = 0; i < S.size(); i++)
	{
		if (isdigit(S[i]))
		{
			if (S[i] == '9')
			{
				S[i] = '0';
			}
			else
			{
				S[i]++;
			}
		}
	}
}

string turn6(string S)
{
	for (int i = 0; i < S.size(); i++)
	{
		if (isdigit(S[i]))
		{
			if (S[i] == '0')
			{
				S[i] = '9';
			}
			else
			{
				S[i]--;
			}
		}
	}
}

int main()
{
	int n; string S, T;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> S >> T;

		for (int i = S.size() - 1; i >= 0; i--)
		{
			switch (S[i])
			{
				case 'C': T = turn1(T); break;
				case 'J': T = turn2(T); break;
				case 'E': T = turn3(T); break;
				case 'A': T = turn4(T); break;
				case 'M': T = turn5(T); break;
				case 'P': T = turn6(T); break;
			}
		}

		cout << T << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'std::string turn4(std::string)':
a.cc:34:9: error: 'reverse' was not declared in this scope
   34 |         reverse(S.begin(), S.end());
      |         ^~~~~~~
a.cc: In function 'std::string turn5(std::string)':
a.cc:55:1: warning: no return statement in function returning non-void [-Wreturn-type]
   55 | }
      | ^
a.cc: In function 'std::string turn6(std::string)':
a.cc:73:1: warning: no return statement in function returning non-void [-Wreturn-type]
   73 | }
      | ^
Language: C++

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

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    char a[7],ans[26],b[26],x=0,y=0;
    scanf("%s",a);
    x=strlen(a);
    scanf("%s",ans);
    y=strlen(ans);  

    for(int j=0;j<y;j++)
      b[j]=ans[j];

    for(int k=x-1;k>=0;k--){
      if(a[k]=='C'){//??????
	b[y-1]=ans[0];
	for(int j=1;j<y;j++) b[j-1]=ans[j];
      }
      else if(a[k]=='J'){//??????
	b[0]=ans[y-1];
	for(int j=0;j<y-1;j++) b[j+1]=ans[j];
      }
      else if(a[k]=='E'){//swap
	if(y%2==0)
	  for(int j=0;j<y/2;j++) 
	    swap(b[j],b[j+(y/2)]);
	else
	  for(int j=0;j<y/2;j++) 
	    swap(b[j],b[j+(y/2)+1]);



      }
      else if(a[k]=='A'){//????????????
	int o=y;
	while(1){
	  if(o==0)break;
	  for(int j=0;j<y;j++){
	    b[j]=ans[o-1];
	    o--;
	  }
	}
      }
      else if(a[k]=='M'){//+1
	for(int j=0;j<y;j++) 
	  if(ans[j]>='0'&&ans[j]<='8') b[j]=ans[j]+1;
	  else if(ans[j]=='9') b[j]=ans[j]-9;
      }
      else if(a[k]=='P')//-1
	for(int j=0;j<y;j++) 
	  if(ans[j]>='1'&&ans[j]<='9') b[j]=ans[j]-1;
	  else if(ans[j]=='0') b[j]=ans[j]+9;

      for(int j=0;j<y;j++)
	ans[j]=b[j];
    }h
    for(int j=0;j<y;j++)
      cout<<ans[j];
    cout<<endl;

  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:6: error: 'h' was not declared in this scope
   61 |     }h
      |      ^
a.cc:62:17: error: 'j' was not declared in this scope
   62 |     for(int j=0;j<y;j++)
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n
  cin>>n;
  while(n--){
    string q,s;
    cin>>q>>s;
    for(int i=0;i<q.size();i++){
      if(q[i]=='J')s=s.substr(1,s.size()-1)+s[0];
      if(q[i]=='C')s=s[s.size()-1]+s.substr(0,s.size()-1);
      if(q[i]=='E')
	for(int j=0;j<s.size()/2;j++)swap(s[j],s[(s.size()+1)/2+j]);
      if(q[i]=='A')reverse(s.begin(),s.end());
      if(q[i]=='M')
	for(int j=0;j<s.size();j++)
	  if(isdigit(s[j]))s[j]=((s[j]-'0')-1)%10+'0';
      if(q[i]=='P')
	for(int j=0;j<s.size();j++)
	  if(isdigit(s[j]))s[j]=((s[j]-'0'+10)+1)%10+'0';
    }
    cout<<s<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: expected initializer before 'cin'
    5 |   cin>>n;
      |   ^~~
a.cc:6:9: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   while(n--){
      |         ^
      |         yn
Language: C++

#include <iostream>
#include <string>

using namespace std;

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

    auto decryptJ = [](const string &s) {
        return s.back() + s.substr(0, s.size() - 1);
    };

    auto decryptC = [](const string &s) { return s.substr(1) + s.front(); };

    auto decryptE = [](const string &s) {
        if (s.size() % 2 == 0) {
            return s.substr(s.size() / 2) + s.substr(0, s.size() / 2);
        }
        else {
            return s.substr(s.size() / 2 + 1) + s[s.size() / 2] +
                   s.substr(0, s.size() / 2);
        }
    };

    auto decryptA = [](const string &s) {
        auto r = s;
        reverse(begin(r), end(r));
        return r;
    };

    auto decryptP = [](const string &s) {
        auto r = s;
        for (auto &&c : r) {
            if (c < '0' || '9' < c) {
                continue;
            }

            c = (c - '0' + 10 - 1) % 10 + '0';
        }
        return r;
    };

    auto decryptM = [](const string &s) {
        auto r = s;
        for (auto &&c : r) {
            if (c < '0' || '9' < c) {
                continue;
            }

            c = (c - '0' + 1) % 10 + '0';
        }
        return r;
    };

    for (int i = 0; i < n; ++i) {
        string order, message;
        cin >> order;
        cin >> message;
        reverse(begin(order), end(order));

        for (auto &&c : order) {
            switch (c) {
            case 'J':
                message = decryptJ(message);
                break;
            case 'C':
                message = decryptC(message);
                break;
            case 'E':
                message = decryptE(message);
                break;
            case 'A':
                message = decryptA(message);
                break;
            case 'P':
                message = decryptP(message);
                break;
            case 'M':
                message = decryptM(message);
                break;
            }
        }
        cout << message << endl;
    }
}


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

#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main () {
  int n;

  cin >> n;
  for( int i = 0; i < n; i++ ) {
    string commands, mes;
    cin >> commands >> mes;
    int len = commands.length();
    int meslen = mes.length();
    for( int j = len - 1; j >= 0; j-- ) {
      switch( commands[ j ] ) {
        case 'C':
          mes = mes.substr( 1 ) + mes[ 0 ];
          break;
        case 'J':
          mes = mes[ meslen - 1 ] + mes.substr( 0, meslen - 1 );
          break;
        case 'E':
          if( meslen % 2 == 1 ) {
            mes = 
              mes.substr( meslen / 2 + 1 ) + 
              mes[ meslen / 2 ] +
              mes.substr( 0, meslen / 2 );
          }else{
            mes = 
              mes.substr( meslen / 2 ) +
              mes.substr( 0, meslen / 2 ); 
          }
          break;
        case 'A':
          reverse( mes.begin(), mes.end() );
          break;
        case 'M':
          for( int k = 0; k < meslen; k++ ) {
            if( '0' <= mes[ k ] && mes[ k ] <= '8' ){
              mes[ k ]++;
            }else if( mes[ k ] == '9' ){
              mes[ k ] = '0';
            }
          }
          break;
        case 'P':
          for( int k = 0; k < meslen; k++ ) {
            if( '1' <= mes[ k ] && mes[ k ] <= '9' ){
              mes[ k ]--;
            }else if( mes[ k ] == '0' ){
              mes[ k ] = '9';
            }
          }
          break;
      }
    }
    cout << mes << endl;
  }

  return EXIT_SUCCESS;
}

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

#include <stdio.h>
#include <string.h>
int main() {
    int N,i,j,k,q;char T[50],c[9];scanf("%d",&N);while (N--) {
        scanf("%s%s",&c,&T);j=strlen(c),k=strlen(T)-1;
        while (j--) {
            if (c[j]=='P') {
                for (i=k;i>=0;i--) if (T[i]>='1' && T[i]<='9') T[i]--; else if (T[i]=='0') T[i]='9';}
            } else if (c[j]=='M') {
                for (i=k;i>=0;i--) if (T[i]>='0' && T[i]<='8') T[i]++; else if (T[i]=='9') T[i]='0';}
            } else if (c[j]=='E') {
                for (i=k,q=(k-1)/2;q>=0;i--,q--) swap(T[i],T[q]);
            } else if (c[j]=='A') {
                for (i=0,q=k;i<q;i++,q--) swap(T[i],T[q]);
            } else if (c[j]=='J') {
                c[8]=T[k];for (i=k;i>0;i--) T[i]=T[i-1];T[0]=c[8];
            } else {
                c[8]=T[0];for (i=0;i<k;i++) T[i]=T[i+1];T[k]=c[8];
            }
        }
        puts(T);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: 'else' without a previous 'if'
    9 |             } else if (c[j]=='M') {
      |               ^~~~
a.cc:11:15: error: 'else' without a previous 'if'
   11 |             } else if (c[j]=='E') {
      |               ^~~~
a.cc:12:50: error: 'swap' was not declared in this scope
   12 |                 for (i=k,q=(k-1)/2;q>=0;i--,q--) swap(T[i],T[q]);
      |                                                  ^~~~
a.cc:14:43: error: 'swap' was not declared in this scope
   14 |                 for (i=0,q=k;i<q;i++,q--) swap(T[i],T[q]);
      |                                           ^~~~
a.cc: At global scope:
a.cc:21:13: error: expected constructor, destructor, or type conversion before '(' token
   21 |         puts(T);
      |             ^
a.cc:22:5: error: expected declaration before '}' token
   22 |     }
      |     ^
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: C++

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

int main(){
    int n;
    cin >> n;
    while( n-- ){
        string p, m;
        cin >> p >> m;
        reverse( p.begin(), p.end() );
        for( size_t i = 0; i < p.length(); i++ ){
            switch(p[i]){
                case 'J':{
                    char tmp = m[m.length() - 1];
                    for( size_t j = m.length() - 1; j > 0; j-- ){
                        //if( j == 0 ){
                        //}else{
                            m[j] = m[j-1];
                        //}
                        //cout << m[j] << endl;
                    }
                    m[0] = tmp;
                    break;
                }case 'C':{
                    char tmp = m[0];
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( j == m.length() - 1 ) m[j] = tmp;
                        else m[j] = m[j+1];
                    }
                    break;
                }case 'E':{
                    string tmp = m.substr( 0, m.length() / 2 );
                    m = m.substr( (m.length() + 1) / 2 );
                    m.append( tmp );
                    break;
                }case 'A':{
                    reverse( m.begin(), m.end() );
                    break;
                }case 'P':{
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( '1' <= m[j] && m[j] <= '9' ){
                            m[j]--;
                        }else if( '0' == m[j] ){
                            m[j] = '9';
                        }
                    }
                    break;
                }case 'M':{
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( '0' <= m[j] && m[j] <= '8' ){
                            m[j]++;
                        }else if( '9' == m[j] ){
                            m[j] = '0';
                        }
                    }
                    break;
                }
            }
        }
        cout << m << endl;
    }
}

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

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

int main(){
    int n;
    cin >> n;
    while( n-- ){
        string p, m;
        cin >> p >> m;
        reverse( p.begin(), p.end() );
        for( size_t i = 0; i < p.length(); i++ ){
            if( p[i] == 'J' ){
                char tmp = m[m.length() - 1];
                for( size_t j = m.length() - 1; j > 0; j-- ){
                    //if( j == 0 ){
                    //}else{
                        m[j] = m[j-1];
                    //}
                    //cout << m[j] << endl;
                }
                m[0] = tmp;
                break;
            }if( p[i] == 'C' ){
                char tmp = m[0];
                for( size_t j = 0; j < m.length(); j++ ){
                    if( j == m.length() - 1 ) m[j] = tmp;
                    else m[j] = m[j+1];
                }
                break;
            }if( p[i] == 'E' ){
                string tmp = m.substr( 0, m.length() / 2 );
                m = m.substr( (m.length() + 1) / 2 );
                m.append( tmp );
                break;
            }if( p[i] == 'A' ){
                reverse( m.begin(), m.end() );
                break;
            }if( p[i] == 'J' ){
                for( size_t j = 0; j < m.length(); j++ ){
                    if( '1' <= m[j] && m[j] <= '9' ){
                        m[j]--;
                    }else if( '0' == m[j] ){
                        m[j] = '9';
                    }
                }
                break;
            }if( p[i] == 'M' ){
                for( size_t j = 0; j < m.length(); j++ ){
                    if( '0' <= m[j] && m[j] <= '8' ){
                        m[j]++;
                    }else if( '9' == m[j] ){
                        m[j] = '0';
                    }
                }
                break;
            }
        }
        cout << m << endl;
    }
}

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

#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    while( n-- ){
        string p, m;
        cin >> p >> m;
        reverse( p.begin(), p.end() );
        for( size_t i = 0; i < p.length(); i++ ){
            switch(p[i]){
                case 'J':{
                    char tmp = m[m.length() - 1];
                    for( size_t j = m.length() - 1; j > 0; j-- ){
                        //if( j == 0 ){
                        //}else{
                            m[j] = m[j-1];
                        //}
                        //cout << m[j] << endl;
                    }
                    m[0] = tmp;
                    break;
                }case 'C':{
                    char tmp = m[0];
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( j == m.length() - 1 ) m[j] = tmp;
                        else m[j] = m[j+1];
                    }
                    break;
                }case 'E':{
                    string tmp = m.substr( 0, m.length() / 2 );
                    m = m.substr( (m.length() + 1) / 2 );
                    m.append( tmp );
                    break;
                }case 'A':{
                    reverse( m.begin(), m.end() );
                    break;
                }case 'P':{
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( '1' <= m[j] && m[j] <= '9' ){
                            m[j]--;
                        }else if( '0' == m[j] ){
                            m[j] = '9';
                        }
                    }
                    break;
                }case 'M':{
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( '0' <= m[j] && m[j] <= '8' ){
                            m[j]++;
                        }else if( '9' == m[j] ){
                            m[j] = '0';
                        }
                    }
                    break;
                }
            }
        }
        cout << m << endl;
    }
}

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

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

int main(){
    int n;
    cin >> n;
    while( n-- ){
        string p, m;
        cin >> p >> m;
        reverse( p.begin(), p.end() );
        for( size_t i = 0; i < p.length(); i++ ){
            if( p[i] == 'J' ){
                char tmp = m[m.length() - 1];
                for( size_t j = m.length() - 1; j > 0; j-- ){
                    //if( j == 0 ){
                    //}else{
                        m[j] = m[j-1];
                    //}
                    //cout << m[j] << endl;
                }
                m[0] = tmp;
                break;
            }if( p[i] == 'C' ){
                char tmp = m[0];
                for( size_t j = 0; j < m.length(); j++ ){
                    if( j == m.length() - 1 ) m[j] = tmp;
                    else m[j] = m[j+1];
                }
                break;
            }if( p[i] == 'E' ){
                string tmp = m.substr( 0, m.length() / 2 );
                m = m.substr( (m.length() + 1) / 2 );
                m.append( tmp );
                break;
            }if( p[i] == 'A' ){
                reverse( m.begin(), m.end() );
                break;
            }if( p[i] == 'P' ){
                for( size_t j = 0; j < m.length(); j++ ){
                    if( '1' <= m[j] && m[j] <= '9' ){
                        m[j]--;
                    }else if( '0' == m[j] ){
                        m[j] = '9';
                    }
                }
                break;
            }if( p[i] == 'M' ){
                for( size_t j = 0; j < m.length(); j++ ){
                    if( '0' <= m[j] && m[j] <= '8' ){
                        m[j]++;
                    }else if( '9' == m[j] ){
                        m[j] = '0';
                    }
                }
                break;
            }
        }
        cout << m << endl;
    }
}

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

#include <iostream>
#include <string>
#include <stdio.h>
#include <cstdio>
using namespace std;

int main(){
    int n;
    cin >> n;
    while( n-- ){
        string p, m;
        cin >> p >> m;
        reverse( p.begin(), p.end() );
        for( size_t i = 0; i < p.length(); i++ ){
            if( p[i] == 'J' ){
                char tmp = m[m.length() - 1];
                for( size_t j = m.length() - 1; j > 0; j-- ){
                    //if( j == 0 ){
                    //}else{
                        m[j] = m[j-1];
                    //}
                    //cout << m[j] << endl;
                }
                m[0] = tmp;
                break;
            }if( p[i] == 'C' ){
                char tmp = m[0];
                for( size_t j = 0; j < m.length(); j++ ){
                    if( j == m.length() - 1 ) m[j] = tmp;
                    else m[j] = m[j+1];
                }
                break;
            }if( p[i] == 'E' ){
                string tmp = m.substr( 0, m.length() / 2 );
                m = m.substr( (m.length() + 1) / 2 );
                m.append( tmp );
                break;
            }if( p[i] == 'A' ){
                reverse( m.begin(), m.end() );
                break;
            }if( p[i] == 'P' ){
                for( size_t j = 0; j < m.length(); j++ ){
                    if( '1' <= m[j] && m[j] <= '9' ){
                        m[j]--;
                    }else if( '0' == m[j] ){
                        m[j] = '9';
                    }
                }
                break;
            }if( p[i] == 'M' ){
                for( size_t j = 0; j < m.length(); j++ ){
                    if( '0' <= m[j] && m[j] <= '8' ){
                        m[j]++;
                    }else if( '9' == m[j] ){
                        m[j] = '0';
                    }
                }
                break;
            }
        }
        cout << m << endl;
    }
}

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

import java.util.*;

public class Main2{

    int n;
    int max = 1<<15;

    void solve(){
        Scanner sc = new Scanner(System.in);

        int[] cnt = new int[max+1];
        for(int i=1; i*i<=max; i++){
            cnt[i*i]++;
            for(int j=i; j*j+i*i<=max; j++){
                cnt[i*i+j*j]++;
                for(int k=j; k*k+j*j+i*i<=max; k++){
                    cnt[i*i+j*j+k*k]++;
                    for(int l=k; l*l+k*k+j*j+i*i<=max; l++){
                        cnt[i*i+j*j+k*k+l*l]++;
                    }
                }
            }
        }

        while(true){
            n = sc.nextInt();
            if(n==0) break;
            System.out.println(cnt[n]);
        }
    }

    public static void main(String[] args){
        new Main2().solve();
    }
}

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

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

#define MAX (1<<15)+2

int dp[MAX][5][SQRT];

int main(){

    dp[0][0][1] = 1;
    for(int i = 0; i < MAX; i++){
        for(int j = 0; j < 5; j++){
            for(int k = 1; k < sqrt(MAX); k++) if(dp[i][j][k] > 0){
                for(int l = k; l < sqrt(MAX); l++){ // l*lを加算
                    if(i+l*l >= MAX || j + 1 >= 5)break;
                    dp[i+l*l][j+1][l] += dp[i][j][k];
                }
            }
        }
    }

    int n;
    while(cin >> n, n){
        int ans = 0;
        for(int i = 1; i < 5; i++){
            for(int j = 1; j < sqrt(MAX); j++) ans += dp[n][i][j];
        }
        cout << ans << endl;
    }
}



Compiler output:
a.cc:7:16: error: 'SQRT' was not declared in this scope
    7 | int dp[MAX][5][SQRT];
      |                ^~~~
a.cc: In function 'int main()':
a.cc:11:5: error: 'dp' was not declared in this scope
   11 |     dp[0][0][1] = 1;
      |     ^~
Language: C++

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

#define MAX (1<<15)+2

int dp[MAX][5][sqrt(MAX)];

int main(){

    dp[0][0][1] = 1;
    for(int i = 0; i < MAX; i++){
        for(int j = 0; j < 5; j++){
            for(int k = 1; k < sqrt(MAX); k++) if(dp[i][j][k] > 0){
                for(int l = k; l < sqrt(MAX); l++){ // l*lを加算
                    if(i+l*l >= MAX || j + 1 >= 5)break;
                    dp[i+l*l][j+1][l] += dp[i][j][k];
                }
            }
        }
    }

    int n;
    while(cin >> n, n){
        int ans = 0;
        for(int i = 1; i < 5; i++){
            for(int j = 1; j < sqrt(MAX); j++) ans += dp[n][i][j];
        }
        cout << ans << endl;
    }
}



Compiler output:
a.cc:7:20: error: conversion from '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} to 'long unsigned int' in a converted constant expression
    7 | int dp[MAX][5][sqrt(MAX)];
      |                ~~~~^~~~~
a.cc:7:20: error: could not convert 'std::sqrt<int>(((1 << 15) + 2))' from '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} to 'long unsigned int'
    7 | int dp[MAX][5][sqrt(MAX)];
      |                ~~~~^~~~~
      |                    |
      |                    __gnu_cxx::__enable_if<true, double>::__type {aka double}
a.cc:7:20: error: size of array 'dp' has non-integral type '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'}
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> a;
typedef long long ll;
ll dp[1 << 15][1 << 8][5];

// idxより後でk個以内をとってnを作る方法は何通り
ll dfs(int n, int idx, int k)
{
    ll & res = dp[n][idx][k];
    if (res != -1)return res;

    if (n == 0) res = 1;
    else {
        res = 0;
        if (k == 0) return res;
        for (int i = idx; i < a.size(); i++)
        {
            if (n - a[i] >= 0)
            {
                res += dfs(n - a[i], i, k - 1);
            }
        }
    }
    return res;
}

int main(){
    for (int i = 1; i*i <= 1 << 15; i++){
        a.push_back(i*i);
    }
    memset(dp, -1, sizeof(dp));
    int n;
    while (cin>> n && n)
    {
        cout << dfs(n, 0, 4) << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 'memset' was not declared in this scope
   36 |     memset(dp, -1, sizeof(dp));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>											
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <functional>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

vector<int> v;
int n;
int dp[4][200][33000];
int solve(int i, int j, int res)
{
	if (dp[i][j][res] >= 0) return dp[i][j][res];
	if (i == 4)
	{
		if (res == n) return 1;
		else return 0;
	}
	int res;
	if (j == v.size()) return 0;
	res = solve(i, j + 1, res) + solve(i + 1, j, res + v[j]);
	return dp[i][j][res] = res;
}

int main()
{
	memset(dp, -1, sizeof(dp));
	for (int i = 0;; i++)
	{
		v.push_back(i*i);
		if (i*i > 33000) break;
	}

	while (cin>>n)
	{
		cout << solve(0, 0, 0) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int, int)':
a.cc:38:13: error: declaration of 'int res' shadows a parameter
   38 |         int res;
      |             ^~~
a.cc:30:29: note: 'int res' previously declared here
   30 | int solve(int i, int j, int res)
      |                         ~~~~^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
??
using namespace std;
??
int dp[200][5][(1<<15)+1];
??
int main(){
????????int n;
????????vector<int> sq;
??????????
????????for(int i=1;i*i<=(1 << 15);++i){
????????????????sq.push_back(i*i);
????????}
????????int sqn = sq.size();
??
??
??
????????dp[0][0][0] = 1;
??
????????for(int i=1;i<=sqn;++i){
????????????????for(int j=0;j<=(1 << 15);++j){
????????????????????????for(int k=0;k<=4;++k){
????????????????????????????????for(int l=0;l<=4;++l){
????????????????????????????????????????if(k+l <= 4 && j+sq[i-1]*l <= (1 << 15)){
????????????????????????????????????????????????dp[i][k+l][j+sq[i-1]*l] += dp[i-1][k][j];
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}
????????????????}
????????}
??????????
????????while(cin >> n && n){
????????????????int ret = 0;
??
????????????????for(int i=0;i<=4;++i){
????????????????????????ret += dp[sqn][i][n];
????????????????}
????????????????cout << ret << endl;
????????}
}

Compiler output:
a.cc:5:1: error: expected unqualified-id before '?' token
    5 | ??
      | ^
a.cc:7:1: error: expected unqualified-id before '?' token
    7 | ??
      | ^
a.cc:9:1: error: expected unqualified-id before '?' token
    9 | ??
      | ^
Language: C++

#include<iostream>
using namespace std; int i, j, k, l, n, s, t;
int main() {
	while (true) {
		cin >> n; s = 0; t = sqrt(n) + 1;
		if (!n) { break; }
		for (i = 0; i < t; i++) {
			for (j = i; j < t; j++) {
				for (k = j; k < t; k++) {
					for (l = k; l < t; l++) {
						if (i*i + j*j + k*k + l*l == n) {
							s++;
						}
					}
				}
			}
		}
		cout << s << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:38: error: 'sqrt' was not declared in this scope
    5 |                 cin >> n; s = 0; t = sqrt(n) + 1;
      |                                      ^~~~
Language: C++

#include<iostream>
using namespace std;int i,j,k,l,n,s,t;
int main(){
while(true){
cin>>n;s=0;t=sqrt(n)+1;
if(!n){break;}
for(i=0;i<t;i++){
for(j=i;j<t;j++){
for(k=j;k<t;k++){
for(l=k;l<t;l++){
if(i*i+j*j+k*k+l*l==n){
s++;
}
}
}
}
}
cout<<s<<endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: 'sqrt' was not declared in this scope
    5 | cin>>n;s=0;t=sqrt(n)+1;
      |              ^~~~
Language: C++

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

import static java.lang.Integer.parseInt;

/**
 * Lagrange's Four-Square Theorem
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		//2^15 = 32768
		//sqrt(32768) = 181.01...
		int[] vs = new int[182];
		int[][] dp = new int[32769][4];

		for (int i = 1; i < 182; i++) {
			vs[i] = i * i;
			dp[vs[i]][0] = 1;
		}

		for (int i = 181; i >= 1; i--) {
			for (int j = 1; j < 4; j++) {
				for (int k = vs[i]; k < 32769; k++) {
					if (dp[k][j - 1] > 0 && k + vs[i] < 32769) {
						dp[k + vs[i]][j] += dp[k][j - 1];
					}
				}
			}
		}

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = parseInt(line);
			if (n == 0) break;

			int sum = 0;
			for (int i = 0; i < 4; i++) {
				sum += dp[n][i];
			}
			System.out.println(sum);

		} //end while
	}//end main
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.BufferedReader;
      | ^~~~~~
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.io.IOException;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import static java.lang.Integer.parseInt;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: expected unqualified-id before 'public'
   10 | public class Main {
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define double long double

const int GETA = 2000;
const int MAX = 4200;
int n;
bool check[MAX];

struct P{
	int x, y;
} p[100];

typedef pair<double, double> Pdd;
P p1[100], p2[100];
double A[100], B[100];

double f(double a, double b, double y){
	return (y - b) / a;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	while(cin >> n, n){
		for(int i = 0; i < n; i++){
			cin >> p[i].x >> p[i].y;
			p[i].x += GETA, p[i].y += GETA;
		}
		for(int i = 0; i < n; i++){
			p1[i] = p[i], p2[i] = p[(i + 1) % n];
			if(p1[i].y > p2[i].y) swap(p1[i], p2[i]);
			if(p1[i].x == p2[i].x || p1[i].y == p2[i].y) continue;
			A[i] = double(p2[i].y - p1[i].y) / (p2[i].x - p1[i].x);
			B[i] = p1[i].y - A[i] * p1[i].x;
		}

		int ans = 0;
		for(int y = 0; y <= MAX; y++){
			// y??????(y+1)
			vector<Pdd> v;
			for(int i = 0; i < n; i++){
				if(p1[i].y == p2[i].y) continue;
				if(y + 1 <= p1[i].y || p2[i].y <= y) continue;
				if(p1[i].x == p2[i].x){
					v.push_back({ p1[i].x, p1[i].x });
				}
				else{
					double d1 = f(A[i], B[i], y), d2 = f(A[i], B[i], y + 1);
					v.push_back({ min(d1, d2), max(d1,d2) });
				}
			}
			if(v.size() == 0) continue;
			memset(check, 0, sizeof check);
			sort(v.begin(), v.end());
			for(int i = 0; i < v.size(); i += 2){
				Pdd d1 = v[i], d2 = v[i + 1];
				int l = (int)(min(d1.first, d1.second) + 1e-8);
				double rr = max(d2.first, d2.second);
				int r = (int)rr;
				if(abs(rr - r) > 1e-8) r++;
				//cout << y << " " << r - l << endl;
				//ans += r - l;
				for(int j = l; j < r; j++){
					if(!check[j]){
						ans++;
						check[j] = 1;
					}
				}
			}
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:16: error: expected primary-expression before 'long'
    4 | #define double long double
      |                ^~~~
a.cc:40:32: note: in expansion of macro 'double'
   40 |                         A[i] = double(p2[i].y - p1[i].y) / (p2[i].x - p1[i].x);
      |                                ^~~~~~
Language: Java


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

public class Main {

	
	//　日数、雲の場所、左上の降ってない日数、右上、左下、右下
	static int n;
	static int[][][][][][] dp;
	static int[][] field;
	static int[] v1={-8,-4,-1,-2,1,2,4,8,0};
	static int[] v2={0,1,4,5};
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		for(;;){
			n=cin.nextInt();
			if(n==0)break;
			stack=new Stack<Integer[]>();
			field = new int[n][17];
			for(int i=0;i<n;i++){
				for(int j=1;j<17;j++){
					field[i][j]=cin.nextInt();
				}
			}
			dp=new int[n][12][7][7][7][7];
			for(int i=0;i<n;i++){
				for(int j=0;j<12;j++){
					for(int k=0;k<7;k++){
						for(int l=0;l<7;l++){
							for(int m=0;m<7;m++){
								for(int nn=0;nn<7;nn++){
									dp[i][j][k][l][m][nn]=1<<30;
								}
							}
						}
					}
				}
				
			}
//			output();
			if(isOkay(0,6)){
				System.out.println(dp(0,6,0,0,0,0));
			}
			else{
				System.out.println("0");
			}
			
			
		}
	}
	// lt:lefttop rb rightbottom
	static int dp(int m,int position,int lt,int rt,int lb,int rb){
		if(lt>6||rt>6||lb>6||rb>6){
			return 0;
		}
		if(m==n){
			return 1;
		}


		if(!isOkay(m,position)){
//			System.out.println("  notOkay "+(m+1)+" "+position);
			return 0;
		}
		if(dp[m][position][lt][rt][lb][rb]!=1<<30)return dp[m][position][lt][rt][lb][rb];

		int re=0;
		for(int i=0;i<v1.length;i++){
			int pp=move(position,v1[i]);
			if(pp<=0||pp>=12){
//				System.out.println("  gai "+pp);
				continue;
			}
			int[] a = rain(pp,lt,rt,lb,rb);
			int llt=a[0];
			int rrt=a[1];
			int llb=a[2];
			int rrb=a[3];
			re=Math.max(re,
					dp(m+1,pp,llt,rrt,llb,rrb)
					);
		}
		return dp[m][position][lt][rt][lb][rb]=re;
	}
	static int move(int position,int a){
		int re = position+a;
		if(position==1){
			if(a < 0)return -1;
		}
		else if(position==2){
			if(a==2)return -1;
			if(a<-1)return -1;
		}
		else if(position==3){
			if(a==1||a==2)return -1;
		}
		else if(position==5){
			if(a==-2)return -1;
		}
		else if(position==6){
			
		}
		else if(position==7){
			if(a==2)return -1;
		}
		else if(position==9){
			if(a==-2)return -1;
		}
		else if(position==10){
			
		}
		else if(position==11){
			
		}
		return re;
	}
	static boolean isOkay(int m,int position){
		/*
		for(int j=1;j<17;j++){
			if((j-1)%4==0)System.out.println();
			System.out.print(field[m][j]+" ");
		}
		System.out.println();
		*/
		for(int i=0;i<4;i++){
			int pp=position+v2[i];
			if(field[m][pp]==1)return false;
		}
		return true;
	}
	static int[] rain(int position,int lt,int rt,int lb,int rb){
		lt++;
		rt++;
		lb++;
		rb++;
		if(position==1){
			lt=0;
		}
		else if(position==3){
			rt=0;
		}
		else if(position==9){
			lb=0;
		}
		else if(position==11){
			rb=0;
		}
		return new int[]{lt,rt,lb,rb}; 
	}
	static void output(){
		for(int i=0;i<n;i++){
			for(int j=1;j<17;j++){
				if((j-1)%4==0)System.out.println();
				System.out.print(field[i][j]+" ");
			}
			System.out.println();
		}
	}
}

Compiler output:
Main.java:19: error: cannot find symbol
			stack=new Stack<Integer[]>();
			^
  symbol:   variable stack
  location: class Main
1 error