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

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

#define A 1355471101  // large prime number 1.
#define B 1466700101  // large prime number 2.
#define M 1522101101  // large prime number 3, larger than A and B.

int main()
{
    int i, j, H, W, R, C;
    string *T;

    scanf("%d %d", &H, &W);
    T = new string [H];
    for(i = 0; i < H; i++){ cin >> T[i]; }
    scanf("%d %d", &R, &C);

    long long hash[1000][1000];
    long long s;

    for(i = 0; i < R; i++){
        s = 0;
        char P[1000];
        scanf("%s", P);
        for(j = 0; j < C; j++){
            s = (s * A + P[j]) % M;
            hash[i][j] = s;
        }
    }
    for(j = 0; j < C; j++){
        s = 0;
        for(i = 0; i < R; i++){
            s = (s * B + hash[i][j]) % M;
            hash[i][j] = s;
        }
    }
    long long last_has = hash[R - 1][C - 1];

    for(i = 0; i < H; i++){
        s = 0;
        for(j = 0; j < W; j++){
            s = (s * A + T[i][j]) % M;
            hash[i][j] = s;
        }
    }
    for(j = 0; j < W; j++){
        s = 0;
        for(i = 0; i < H; i++){
            s = (s * B + hash[i][j]) % M;
            hash[i][j] = s;
        }
    }

    long long power_a, power_b, power_c, x, y, z;
    x = A, y = R, z = 1;
    for( ; y; y >>= 1){ if((y & 1) != 0){ z = (z * x) % M; } x = (x * x) % M; }
    power_a = z;
    x = B, y = C, z = 1;
    for( ; y; y >>= 1){ if((y & 1) != 0){ z = (z * x) % M; } x = (x * x) % M; }
    power_b = z;
    power_c = (power_a * power_b) % M;

    long long block1, block2, block3;
    for(i = R - 1; i < H; i++){
        for(j = C - 1; j < W; j++){
            block1 = ((i >= R ? hash[i - R][j] : 0) * power_a) % M;
            block2 = ((j >= C ? hash[i][j - C] : 0) * power_b) % M;
            block3 = M - ((((i >= R && j >= C) ? hash[i - R][j - C] : 0) * power_c) % M);
            if(hash[i][j] == (block1 + block2 + block3 + last_has) % M){
            printf("%d %d\n", i - R + 1, j - C + 1);
            }
        }
    }
	delete [] T; delete [] P;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:32: error: 'P' was not declared in this scope
   76 |         delete [] T; delete [] P;
      |                                ^
Language: C++

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

int main(){
	long H, W, R, C;
	string T[1000], P[1000];
	cin >> H >> W;
	for (long i = 0; i < H; i++){
		cin >> T[i];
	}
	cin >> R >> C;
	if (H < R || W < C) return 0;
	for (long i = 0; i < R; i++){
		cin >> P[i];
	}
	for (long i = 0; i < H - R + 1; i++){
		// for (long j = 0; j < W - C + 1; j++){
			// if (T[i][j] == P[0][0]){
			// 	if (T[i].substr(j, C) == P[0]){
			long l = T[i].find(P[0], 0);
			if (l != -1){
					if (R == 1) printf("%ld %ld\n", i, j);
					else {
						for (long k = 1; k < R; k++){
							if (T[i + k].substr(j, C) != P[k]) break;
							if (k == R - 1) printf("%ld %ld\n", i, j);
						}
					}
			}
			// 	}
			// }
		// }
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:76: error: 'j' was not declared in this scope
   24 |                                         if (R == 1) printf("%ld %ld\n", i, j);
      |                                                                            ^
a.cc:27:77: error: 'j' was not declared in this scope
   27 |                                                         if (T[i + k].substr(j, C) != P[k]) break;
      |                                                                             ^
a.cc:28:96: error: 'j' was not declared in this scope
   28 |                                                         if (k == R - 1) printf("%ld %ld\n", i, j);
      |                                                                                                ^
Language: C++

#include<bits/stdc++.h>
#define HIRA 177771
#define R 1000
using namespace std;
typedef unsigned long long ull;
ull ab[R][R],cd[R][R];
ull lo[R][R],to[R][R];
string su[R],pu[R];
int main(){
  int h1,w1,h11,w11;
  cin>>h1>>w1;
 
  for(int i=0;i<h1;i++)cin>>su[i];
 
  for(int i=0;i<h1;i++)
    for(int j=0;j<w1;j++)ab[i][j]=su[i][j];
 
  cin>>h11>>w11;
  for(int i=0;i<h11;i++)cin>>pu[i];
 
  for(int i=0;i<h11;i++)
    for(int j=0;j<w11;j++)cd[i][j]=pu[i][j]; 
 
 
 
  ull sawa=0;
  for(int i=0;i<h11;i++)
    for(int j=0;j<w11;j++)sawa=sawa*HIRA+cd[i][j];
 
  for(int j=0;j<h1;j++){
    ull bor=0,gojob=1;
    for(int i=0;i<w11;i++)bor*=HIRA,bor+=sawabor[j][i],gojob*=HIRA;
    lo[j][w11-1]=bor;
    for(int i=w11;i<w1;i++){
      bor*=HIRA,bor+=sawabor[j][i],bor-=sawabor[j][i-w11]*gojob;
      lo[j][i]=bor;
    }
  }
 
  for(int j=w11-1;j<w1;j++){
    ull bor=0,gojob=1,n=1;
    for(int i=0;i<w11;i++)n*=HIRA;
    for(int i=0;i<h11;i++)bor*=n,bor+=lo[i][j],gojob*=n;
    to[h11-1][j]=bor;
    for(int i=h11;i<h1;i++){
      bor*=n,bor+=lo[i][j],bor-=lo[i-h11][j]*gojob; 
      to[i][j]=bor;
    }
  }
 
 
  for(int i=h11-1;i<h1;i++)
    for(int j=w11-1;j<w1;j++)
      if(sawa==to[i][j])printf("%d %d\n",i-h11+1,j-w11+1);
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:42: error: 'sawabor' was not declared in this scope; did you mean 'sawa'?
   32 |     for(int i=0;i<w11;i++)bor*=HIRA,bor+=sawabor[j][i],gojob*=HIRA;
      |                                          ^~~~~~~
      |                                          sawa
a.cc:35:22: error: 'sawabor' was not declared in this scope; did you mean 'sawa'?
   35 |       bor*=HIRA,bor+=sawabor[j][i],bor-=sawabor[j][i-w11]*gojob;
      |                      ^~~~~~~
      |                      sawa
Language: C++

t = gets.chomp
q = gets.to_i
q.times{
  p = gets.chomp
  if t.index(p) == nil then
    puts "0"
  else
    puts "1"
  end
}

Compiler output:
a.cc:1:1: error: 't' does not name a type
    1 | t = gets.chomp
      | ^
Language: C


def isEqual(T,P):
    for i in range(len(T)-len(P)+1):
        if T[i:i+len(P)] == P:
            return 1
    return 0

T = input()
n = int(input())

for i in range(n):
    P = input()
    print(isEqual(T,P))

Compiler output:
main.c:2:1: error: unknown type name 'def'
    2 | def isEqual(T,P):
      | ^~~
main.c: In function 'isEqual':
main.c:2:17: error: expected declaration specifiers before ':' token
    2 | def isEqual(T,P):
      |                 ^
main.c:2:5: error: type of 'T' defaults to 'int' [-Wimplicit-int]
    2 | def isEqual(T,P):
      |     ^~~~~~~
main.c:2:5: error: type of 'P' defaults to 'int' [-Wimplicit-int]
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define M 1000000
#define N 1000

int main(){

 int i;
 int j;
 int num;
 int str_length;
 int cmp_length;
 char *str;
 char *cmp;

  str = (char *)malloc(sizeof(char) * M);
  cmp = (char *)malloc(sizeof(char) * N);

  scanf("%s",str);
  str_length = strlen(str);

  scanf("%d",&num);
  for(i=0;i<num;i++){
  scanf("%s",cmp);
  cmp_length = strlen(cmp);
  for(j=0;j<str_length;j++){

  if( strncmp(str+j,cmp,cmp_length) ==0 ){
  printf("1");
  break;
  }

  if(j==str_length-1){
  printf("0");
  }

   }
  }

  return 0;

Compiler output:
main.c: In function 'main':
main.c:42:3: error: expected declaration or statement at end of input
   42 |   return 0;
      |   ^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdio>
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string s,q;
	cin>>s;
	s+='$';
	int n=s.size();
	vector<int>suff(n);
	iota(suff.begin(),suff.end(),0);
	{
		const char *str=s.c_str();
		sort(suff.begin(),suff.end(),[&](int a,int b){
			return strcmp(str+a,str+b);
		});
	}
	vector<pair<char,int>>sorted(n);
	for(int i=0;i<n;i++)sorted[i]={s[(suff[i]-1+n)%n],i};
	sort(sorted.begin(),sorted.end());

	int T;
	for(cin>>T;T--;){
		string q;
		cin>>q;
		int start=0,stop=n,idx=q.size()-1;
		for(;idx>=0;idx--){
			pair<char,int> ql={q[idx],start},qr={q[idx],stop};
			start=lower_bound(sorted.begin(),sorted.end(),ql)-sorted.begin();
			stop=lower_bound(sorted.begin(),sorted.end(),qr)-sorted.begin();
			if(start==stop)break;
		}
		if(idx<0){
			//for(;start<stop;start++)printf("%d\n",suff[start]);
			puts("1");
		}else{
			puts("0");
		}
	}
}

Compiler output:
a.cc: In lambda function:
a.cc:21:32: error: 'strcmp' was not declared in this scope
   21 |                         return strcmp(str+a,str+b);
      |                                ^~~~~~
a.cc:7:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <cstdio>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
using namespace std;
struct SAComp{
	const int h,*g;
	SAComp(const int h, const int* g) : h(h), g(g) {}
	bool operator()(const int a, const int b){
		return a == b ? false : g[a] != g[b] ? g[a] < g[b] : g[a+h] < g[b+h];
	}
};
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string s;
	cin>>s;
	s+='$';
	int n=s.size();
	vector<int>suff(n);
	iota(suff.begin(),suff.end(),0);
	{
		const char *str=s.c_str();
		sort(suff.begin(),suff.end(),SAComp(0,str));
	}
	vector<pair<char,int>>sorted(n);
	for(int i=0;i<n;i++)sorted[i]={s[(suff[i]-1+n)%n],i};
	sort(sorted.begin(),sorted.end());

	int T;
	for(cin>>T;T--;){
		string q;
		cin>>q;
		int start=0,stop=n,idx=q.size()-1;
		for(;idx>=0;idx--){
			pair<char,int> ql={q[idx],start},qr={q[idx],stop};
			start=lower_bound(sorted.begin(),sorted.end(),ql)-sorted.begin();
			stop=lower_bound(sorted.begin(),sorted.end(),qr)-sorted.begin();
			if(start==stop)break;
		}
		if(idx<0){
			//{vector<int>v;for(;start<stop;start++)v.push_back(suff[start]);sort(v.begin(),v.end());for(auto &e:v)printf("%d\n",e);}
			puts("1");
		}else{
			puts("0");
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:58: error: no matching function for call to 'SAComp::SAComp(int, const char*&)'
   28 |                 sort(suff.begin(),suff.end(),SAComp(0,str));
      |                                                          ^
a.cc:11:9: note: candidate: 'SAComp::SAComp(int, const int*)'
   11 |         SAComp(const int h, const int* g) : h(h), g(g) {}
      |         ^~~~~~
a.cc:11:40: note:   no known conversion for argument 2 from 'const char*' to 'const int*'
   11 |         SAComp(const int h, const int* g) : h(h), g(g) {}
      |                             ~~~~~~~~~~~^
a.cc:9:8: note: candidate: 'constexpr SAComp::SAComp(const SAComp&)'
    9 | struct SAComp{
      |        ^~~~~~
a.cc:9:8: note:   candidate expects 1 argument, 2 provided
a.cc:9:8: note: candidate: 'constexpr SAComp::SAComp(SAComp&&)'
a.cc:9:8: note:   candidate expects 1 argument, 2 provided
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
using namespace std;
struct SAComp{
	const int h,*g;
	SAComp(const int h, const char* g) : h(h), g(g) {}
	bool operator()(const int a, const int b){
		return a == b ? false : g[a] != g[b] ? g[a] < g[b] : g[a+h] < g[b+h];
	}
};
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string s;
	cin>>s;
	s+='$';
	int n=s.size();
	vector<int>suff(n);
	iota(suff.begin(),suff.end(),0);
	{
		const char *str=s.c_str();
		sort(suff.begin(),suff.end(),SAComp(0,str));
	}
	vector<pair<char,int>>sorted(n);
	for(int i=0;i<n;i++)sorted[i]={s[(suff[i]-1+n)%n],i};
	sort(sorted.begin(),sorted.end());

	int T;
	for(cin>>T;T--;){
		string q;
		cin>>q;
		int start=0,stop=n,idx=q.size()-1;
		for(;idx>=0;idx--){
			pair<char,int> ql={q[idx],start},qr={q[idx],stop};
			start=lower_bound(sorted.begin(),sorted.end(),ql)-sorted.begin();
			stop=lower_bound(sorted.begin(),sorted.end(),qr)-sorted.begin();
			if(start==stop)break;
		}
		if(idx<0){
			//{vector<int>v;for(;start<stop;start++)v.push_back(suff[start]);sort(v.begin(),v.end());for(auto &e:v)printf("%d\n",e);}
			puts("1");
		}else{
			puts("0");
		}
	}
}

Compiler output:
a.cc: In constructor 'SAComp::SAComp(int, const char*)':
a.cc:11:54: error: cannot convert 'const char*' to 'const int*' in initialization
   11 |         SAComp(const int h, const char* g) : h(h), g(g) {}
      |                                                      ^
      |                                                      |
      |                                                      const char*
Language: C++

#include <string>
#include <iostream>

using namespace std;

string S, T; int Q, R, A; char STR[1005];

int main()
{
	cin >> S >> Q;

	for (int i = 0; i < Q; i++)
	{
		scanf("%s", STR);

		T = S.substr(0, strlen(STR));

		R = S.size() - strlen(STR);

		A = strlen(STR);

		for (int j = 0; j <= R; j++)
		{
			if (j)
			{
				T.erase(T.begin());

				T += S[j + A];
			}

			if (strcmp(T.c_str(), STR) == 0)
			{
				printf("1\n");

				goto Exit;
			}
		}

		printf("0\n");

	Exit:;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:33: error: 'strlen' was not declared in this scope
   16 |                 T = S.substr(0, strlen(STR));
      |                                 ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 | 
a.cc:31:29: error: 'strcmp' was not declared in this scope
   31 |                         if (strcmp(T.c_str(), STR) == 0)
      |                             ^~~~~~
a.cc:31:29: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int Q, doubles, lengths, dat[1000009], tmp[1000009], arrays[1000009]; string S, T;
bool compare_suffix(int i, int j) {
	if (dat[i] == dat[j]) {
		int ri = (i + doubles <= lengths ? dat[i + doubles] : -1);
		int rj = (j + doubles <= lengths ? dat[j + doubles] : -1);
		return ri < rj;
	}
	return dat[i] < dat[j];
}
void suffix_array() {
	lengths = S.size();
	for (int i = 0; i <= lengths; i++) arrays[i] = i, dat[i] = i < lengths ? S[i] : -1;
	for (doubles = 1; doubles <= lengths; doubles <<= 1) {
		sort(arrays.begin(), arrays.begin() + lengths + 1, compare_suffix);
		tmp[arrays[0]] = 0;
		for (int i = 1; i <= lengths; i++) tmp[arrays[i]] = tmp[arrays[i - 1]] + (compare_suffix(arrays[i - 1], arrays[i]) ? 1 : 0);
		for (int i = 0; i <= lengths; i++) dat[i] = tmp[i];
	}
}
string S, T; int Q;
int main() {
	cin >> S >> Q;
	suffix_array(S);
	for (int i = 0; i < Q; i++) {
		cin >> T;
		int l = 0, r = sa.size(); bool flag = false;
		while (r - l > 1) {
			int m = (l + r) / 2;
			string S1 = S.substr(sa[m], T.size());
			if (S1 == T) {
				flag = true; break;
			}
			if (S1 < T) l = m;
			else r = m;
		}
		printf(flag ? "1\n" : "0\n");
	}
}

Compiler output:
a.cc: In function 'void suffix_array()':
a.cc:19:29: error: request for member 'begin' in 'arrays', which is of non-class type 'int [1000009]'
   19 |                 sort(arrays.begin(), arrays.begin() + lengths + 1, compare_suffix);
      |                             ^~~~~
a.cc:19:45: error: request for member 'begin' in 'arrays', which is of non-class type 'int [1000009]'
   19 |                 sort(arrays.begin(), arrays.begin() + lengths + 1, compare_suffix);
      |                                             ^~~~~
a.cc: At global scope:
a.cc:25:8: error: redefinition of 'std::string S'
   25 | string S, T; int Q;
      |        ^
a.cc:6:78: note: 'std::string S' previously declared here
    6 | int Q, doubles, lengths, dat[1000009], tmp[1000009], arrays[1000009]; string S, T;
      |                                                                              ^
a.cc:25:11: error: redefinition of 'std::string T'
   25 | string S, T; int Q;
      |           ^
a.cc:6:81: note: 'std::string T' previously declared here
    6 | int Q, doubles, lengths, dat[1000009], tmp[1000009], arrays[1000009]; string S, T;
      |                                                                                 ^
a.cc:25:18: error: redefinition of 'int Q'
   25 | string S, T; int Q;
      |                  ^
a.cc:6:5: note: 'int Q' previously declared here
    6 | int Q, doubles, lengths, dat[1000009], tmp[1000009], arrays[1000009]; string S, T;
      |     ^
a.cc: In function 'int main()':
a.cc:28:21: error: too many arguments to function 'void suffix_array()'
   28 |         suffix_array(S);
      |         ~~~~~~~~~~~~^~~
a.cc:15:6: note: declared here
   15 | void suffix_array() {
      |      ^~~~~~~~~~~~
a.cc:31:32: error: 'sa' was not declared in this scope
   31 |                 int l = 0, r = sa.size(); bool flag = false;
      |                                ^~
Language: C++

#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int Q, doubles, lengths, dat[1000009], tmp[1000009], arrays[1000009]; string S, T;
bool compare_suffix(int i, int j) {
	if (dat[i] == dat[j]) {
		int ri = (i + doubles <= lengths ? dat[i + doubles] : -1);
		int rj = (j + doubles <= lengths ? dat[j + doubles] : -1);
		return ri < rj;
	}
	return dat[i] < dat[j];
}
void suffix_array() {
	lengths = S.size();
	for (int i = 0; i <= lengths; i++) arrays[i] = i, dat[i] = i < lengths ? S[i] : -1;
	for (doubles = 1; doubles <= lengths; doubles <<= 1) {
		sort(arrays, arrays + lengths + 1, compare_suffix);
		tmp[arrays[0]] = 0;
		for (int i = 1; i <= lengths; i++) tmp[arrays[i]] = tmp[arrays[i - 1]] + (compare_suffix(arrays[i - 1], arrays[i]) ? 1 : 0);
		for (int i = 0; i <= lengths; i++) dat[i] = tmp[i];
	}
}
int main() {
	cin >> S >> Q;
	suffix_array(S);
	for (int i = 0; i < Q; i++) {
		cin >> T;
		int l = 0, r = S.size() + 1; bool flag = false;
		while (r - l > 1) {
			int m = (l + r) / 2;
			string S1 = S.substr(arrays[m], T.size());
			if (S1 == T) {
				flag = true; break;
			}
			if (S1 < T) l = m;
			else r = m;
		}
		printf(flag ? "1\n" : "0\n");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: too many arguments to function 'void suffix_array()'
   27 |         suffix_array(S);
      |         ~~~~~~~~~~~~^~~
a.cc:15:6: note: declared here
   15 | void suffix_array() {
      |      ^~~~~~~~~~~~
Language: C++

#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int Q, doubles, lengths, dat[1000009], tmp[1000009], arrays[1000009]; string S, T;
bool compare_suffix(int i, int j) {
	if (dat[i] == dat[j]) {
		int ri = (i + doubles <= lengths ? dat[i + doubles] : -1);
		int rj = (j + doubles <= lengths ? dat[j + doubles] : -1);
		return ri < rj;
	}
	return dat[i] < dat[j];
}
void suffix_array() {
	lengths = S.size();
	for (int i = 0; i <= lengths; i++) arrays[i] = i, dat[i] = i < lengths ? S[i] : -1;
	for (doubles = 1; doubles <= lengths; doubles <<= 1) {
		sort(arrays, arrays + lengths + 1, compare_suffix);
		tmp[arrays[0]] = 0;
		for (int i = 1; i <= lengths; i++) tmp[arrays[i]] = tmp[arrays[i - 1]] + (compare_suffix(arrays[i - 1], arrays[i]) ? 1 : 0);
		for (int i = 0; i <= lengths; i++) dat[i] = tmp[i];
	}
}
int main() {
	cin >> S >> Q;
	suffix_array();
	for (int i = 0; i < Q; i++) {
		cin >> T;
		int l = 0, r = S.size() + 1, f = 0;
		while (r - l > 1) {
			int m = (l + r) / 2;
			string S1 = S.substr(arrays[m], T.size());
			if (S1 == T) flag = 1; break;
			if (S1 < T) l = m;
			else r = m;
		}
		printf("%d\n", f);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:38: error: 'flag' was not declared in this scope
   34 |                         if (S1 == T) flag = 1; break;
      |                                      ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

int *Lv;
int n, k;

bool cmp_Lv(const int i, const int j){ return Lv[i] < Lv[j]; }

bool cmp(const int i, const int j){
    if(Lv[i] != Lv[j]){ return Lv[i] < Lv[j]; }
    int L_i = (i + k >= n ? -1 : Lv[i + k]);
    int L_j = (j + k >= n ? -1 : Lv[j + k]);

    return L_i < L_j;
}

int main()
{
    int *A, *newLv;
    std::string T;
    std::cin >> T;
    n = T.size();

    A = new int [n + 1]; Lv = new int [n + 1]; newLv = new int [n + 1];

    int i;
    for(i = 0; i < n; i++){ A[i] = i; }
    for(i = 0; i < n; i++){ Lv[i] = T[i]; }
    std::sort(A, A + n, cmp_Lv);

    newLv[A[0]] = 0;
    for(i = 1; i < n; i++){
        newLv[A[i]] = newLv[A[i - 1]] + (Lv[A[i]] != Lv[A[i - 1]] ? 1 : 0);
    }
    for(i = 0; i < n; i++){ Lv[i] = newLv[i]; }

    k = 1;
    while(1){
        if(k > n) break;

        std::sort(A, A + n, cmp);
        newLv[A[0]] = 0;
        for(i = 1; i < n; i++){ newLv[A[i]] = newLv[A[i - 1]] + (cmp(A[i - 1], A[i]) ? 1 : 0); }
        for(i = 0; i < n; i++){ Lv[i] = newLv[i]; }

        if(Lv[A[n - 1]] == n - 1) break;
        k <<= 1;
    };

    delete [] Lv; delete [] newLv;

	std::string P;
    int q, left, right, mid, crit;
    bool exist;
    scanf("%d", &q);

    A[n] = n;

    while(q){
        cin >> P;
        left = 0, right = n, exist = false;
        while(left < right){

            if(n < P.size()){ exist = false; break; }

            mid = (left + right) / 2;
            crit = T.compare(A[mid], P.size(), P);

            if(crit > 0){ right = mid; }
            else if(crit < 0){ left = mid + 1; }
            else{ exist = true; break; }
        };
        if(T.compare(A[right], P.size(), P) == 0) exist = true;
        if(exist){ printf("1\n"); }else{ printf("0\n"); }
        q--;
    }
	delete [] A;
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair< P , int > PP;

void suffixArray(char* s,vector<int> &res2){
  
  int len=strlen(s);
  vector<int> res(len+1);
  vector< PP > tmp(len+1);
  res2=vector<int>(len+1);
  
  for(int i=0;i<=len;i++)res[i]=s[i];
  
  for(int k=1;k<=len;k*=2){
    
    for(int i=0;i<=len;i++){
      tmp[i].first.first=res[i];
      tmp[i].first.second=(i+k<=len?res[i+k]:0);
      tmp[i].second=i;
    }
    sort(tmp.begin(),tmp.end());
    int C=0;
    for(int i=0;i<=len;i++){
      int id=tmp[i].second;
      if(i&& (tmp[i-1].first<tmp[i].first))C++;
      res[id]=C;
    }
  }

  //  vector<int> res2(len+1);
  for(int i=0;i<=len;i++)res2[ res[i] ]=i;
  return res2;
}

char s[1000005];
char t[1000005];
int main(){
  scanf("%s",s);
  vector<int> ans;
  suffixArray(s,ans);

  int Q;
  scanf("%d",&Q);
  
  while(Q--){
    scanf("%s",t);
    int len=strlen(t);
    int l=0,r=ans.size(),m;
    while(r-l>1){
      m=(l+r)/2;
      if( strncmp( s+ans[m] , t ,len ) <=0 )l=m;
      else r=m;
    }
    if(strncmp(s+ans[l],t,len)==0)printf("1\n");
    else printf("0\n");
  }
  
  /*
  for(int i=0;i<(int)ans.size();i++){
    printf("%d %s\n",ans[i], (s+ans[i]) );
  }
  */
  
  return 0;
}

Compiler output:
a.cc: In function 'void suffixArray(char*, std::vector<int>&)':
a.cc:33:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   33 |   return res2;
      |          ^~~~
Language: C++

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

int n, k;
string s;
vector<int> order;
vector<int> tmp;
vector<int> sa;

bool compare_sa(const int &i, const int &j)
{
  if(order[i] != order[j]) return order[i] < order[j];
  else
  {
    int ri = i + k <= n ? order[i+k] : -1;
    int rj = j + k <= n ? order[j+k] : -1;
    return ri < rj;
  }
}

void construct_sa()
{
  for(int i = 0; i <= n; i++)
  {
    sa[i] = i;
    order[i] = i < n ? s[i] : -1;
  }
  for(k = 1; k <= n; k*=2)
  {
    sort(sa.begin(),sa.end(),compare_sa);
    tmp[sa[0]] = 0;
    for(int i = 1; i <= n; i++)
      tmp[sa[i]] = tmp[sa[i-1]] + (compare_sa(sa[i-1],sa[i])?1:0);
    for(int i = 0; i <= n; i++)
      order[i] = tmp[i];
  }
}

void init()
{
  n = s.size();
  order.resize(n+1);
  tmp.resize(n+1);
  sa.resize(n+1);
  construct_sa();
}

bool contain(string t)
{
  int l=0, r=n;
  while(r-l>1)
  {
    int m = (l+r)/2;
    if(s.compare(sa[m],t.size(),t)<0) l = m;
    else r = m;
  }
  return s.compare(sa[r],t.size(),t) == 0;
}

int main(){

	cin >> s;
	string t;
	int q ; cin >> q;
	init();
	construct_sa ();
	for (int i = 0; i < count; ++i)
	 {
	 	cin >> t;
	 	cout << contain(t) << endl;
	 } 
	 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:27: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   67 |         for (int i = 0; i < count; ++i)
      |                         ~~^~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>

int main(){
    size_t pos;
    int n;
	std::string T;
	std::cin >> T;
	std::cin >> n;
    std::string T = "BANNANABANANAN";
    for(int i=0;i<n;i++){
    	std::string P;
    	cin >> P;
    	std::string::const_iterator search_result;
    	search_result = boost::algorithm::boyer_moore_search(T.begin(), T.end(),P.begin(), P.end());
    	if(search_result - T.begin() >= 0){
    		printf("1\n");
		}else{
   		 	printf("0\n");
   		}
   	}
}

Compiler output:
a.cc:3:10: fatal error: boost/algorithm/searching/knuth_morris_pratt.hpp: No such file or directory
    3 | #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <boost/algorithm/searching/boyer_moore.hpp>

int main(){
    size_t pos;
    int n;
	std::string T;
	std::cin >> T;
	std::cin >> n;
    for(int i=0;i<n;i++){
    	std::string P;
    	std::cin >> P;
    	std::string::const_iterator search_result;
    	search_result = boost::algorithm::boyer_moore_search(T.begin(), T.end(),P.begin(), P.end());
    	if(search_result < T.end() ){
    		printf("1\n");
		}else{
   		 	printf("0\n");
   		}
   	}
}

Compiler output:
a.cc:4:10: fatal error: boost/algorithm/searching/boyer_moore.hpp: No such file or directory
    4 | #include <boost/algorithm/searching/boyer_moore.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
int n,sa[1<<20],r[1<<20],tmp[1<<20];
char s[1<<20];
int k;
bool comp(int i,int j)
{
	if(r[i]!=r[j])return r[i]<r[j];
	else
	{
		int ri=i+k<=n?r[i+k]:-1;
		int rj=j+k<=n?r[j+k]:-1;
		return ri<rj;
	}
}
void construct()
{
	n=strlen(s);
	for(int i=0;i<=n;i++)
	{
		sa[i]=i;
		r[i]=i<n?s[i]:-1;
	}
	for(k=1;k<=n;k*=2)
	{
		sort(sa,sa+n+1,comp);
		tmp[sa[0]]=0;
		for(int i=1;i<=n;i++)
		{
			tmp[sa[i]]=tmp[sa[i-1]]+comp(sa[i-1],sa[i]);
		}
		for(int i=0;i<=n;i++)r[i]=tmp[i];
	}
}
char t[1010];
int T;
int c(int i)
{
	int j=0;
	for(;j<T&&s[i+j]==t[j];j++);
	return j<T?t[j]-s[i+j]:0;
}
bool func()
{
	int f=0,l=n+1;
	while(l-f>1)
	{
		int m=(f+l)/2;
		if(c(sa[m])<0)l=m;
		else f=m;
	}
	return c(sa[f])==0;
}
main()
{
	gets(s);
	int p;scanf("%d\n",&p);
	construct();
	for(;gets(t);)
	{
		T=strlen(t);
		puts(func()?"1":"0");
	}
}



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

from collections import defaultdict
from math import floor, log 


class NoMatch(Exception):
    pass


class IndexMatch:
    MAX_KEYLEN = 13

    def __init__(self, text):
        self.text = text
        self.keylen = self._select_keylen()
        self._create_index()

    def _select_keylen(self):
        chars = set(list(self.text))
        return min(floor(log(len(self.text), len(chars))), self.MAX_KEYLEN)

    def _create_index(self):
        index = defaultdict(set)
        particles = set()
        for i in range(len(self.text)+1):
            for j in range(max(i-self.keylen, 0), i): 
                if i - j < self.keylen // 2:
                    particles.add(self.text[j:i])
                else:
                    index[self.text[j:i]].add(j)
        self.index = index
        self.particles = particles

    def match(self, search_text):
        def _match(lo, hi):
            text = search_text[lo:hi]
            if hi-lo <= self.keylen:
                return self.index[text]

            mid = (lo + hi) // 2
            pre = _match(lo, mid)
            post = _match(mid, hi) 

            if len(pre) == 0 or len(post) == 0:
                raise NoMatch()

            indices = set(i for i in pre if i+mid-lo in post)
            return indices

        if len(search_text) < self.keylen // 2:
            return search_text in self.particles

        try:
            match = _match(0, len(search_text))
            return len(match) > 0 
        except NoMatch:
            return False


def run():
    s1 = input()
    n = int(input())

    matcher = IndexMatch(s1)
    for _ in range(n):
        s2 = input()
        if matcher.match(s2):
            print(1)
        else:
            print(0)


if __name__ == '__main__':
    run()



Compiler output:
a.cc:72:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   72 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import defaultdict
      | ^~~~
Language: C

#include <stdio.h>
#include <stdlib.h>

typedef struct weight_
{
    int Num;
    int Wei;
    double OneNum;
}wgt;

int main()
{
    int N,W;
    double d1,d2,tmp=0;
    scanf("%d %d",&N,&W);
    wgt box;
    wgt *X = malloc(sizeof(wgt)*N);
    for(int i=0;i<N;i++)
    {
        scanf("%lf%lf",&d1,&d2);
        X[i].Num = d1;
        X[i].Wei = d2;
        X[i].OneNum = d1/d2;
    }
    for(int i=0;i<N;i++)
    {
        for(int l=N-1;i<l;l--)
        {
            if(X[l].OneNum>X[l-1].OneNum)
            {
                box = X[l];
                X[l] = X[l-1];
                X[l-1] = box;
            }
    }
    for(int i=0;i<N;i++)
    {
        if(X[i].Wei < W)
        {
            tmp += X[i].Wei * X[i].OneNum;
            W = W - X[i].Wei;
        }
        else
        {
            tmp += X[i].OneNum * W;
            break;
        }
    }
    printf("%lf\n",tmp);
}


Compiler output:
main.c: In function 'main':
main.c:50:1: error: expected declaration or statement at end of input
   50 | }
      | ^
Language: Java

import java.util.*;

public class Main() {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        Scanner inp2 = new Scanner(System.in);

        for (int k = 0; k < total; k++) {
            a[k] = inp2.nextInt();
        }

        for (int i = 1; i < a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;
        }
        
        for (int l = 0; l < total; l++) {
            System.out.print(a[l] + " ");
        }
    }
}



Compiler output:
Main.java:3: error: '{' expected
public class Main() {
                 ^
1 error
Language: Java

import java.util.*;
import java.util.scanner;


public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        Scanner inp2 = new Scanner(System.in);

        for (int k = 0; k < total; k++) {
            a[k] = inp2.nextInt();
        }

        for (int i = 0; i < a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;
        }
        
        for (int l = 0; l < total; l++) {
            System.out.print(a[l] + " ");
        }
    }
}



Compiler output:
Main.java:2: error: cannot find symbol
import java.util.scanner;
                ^
  symbol:   class scanner
  location: package java.util
1 error
Language: Java

import java.util.Scanner;

public class test{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int ary[]= new int[n];
		int a,b;
		for (int i=0;i<n;++i){
			ary[i]=sc.nextInt();
		}

		for (int i=0;i<n;++i){
			for (int j=i;j>0;--j){
				a= Math.min(ary[j],ary[j-1]);
				b= Math.max(ary[j], ary[j-1]);
				ary[j-1]=a;
				ary[j]=b;
			}
			for (int k=0;k<n;++k){
				System.out.print(ary[k]);
			}
			System.out.println();
		}
	}
}


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

import java.util.Scanner;

public class test{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int ary[]= new int[n];
		int a,b;
		for (int i=0;i<n;++i){
			ary[i]=sc.nextInt();
		}

		for (int i=0;i<n;++i){
			for (int j=i;j>0;--j){
				a= Math.min(ary[j],ary[j-1]);
				b= Math.max(ary[j], ary[j-1]);
				ary[j-1]=a;
				ary[j]=b;
			}
			for (int k=0;k<n;++k){
				System.out.print(ary[k]+" ");
			}
			System.out.println();
		}
	}
}


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

public class InsertionSort{
  public static void main(String [] args){
    for(int i = 0; i < args.length; i++)
      System.out.println(args[i]);
  }
}


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


  public static void main(String [] args){
    for(int i = 0; i < args.length; i++)
      System.out.println(args[i]);
  }



Compiler output:
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
  public static void main(String [] args){
                ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

import java.util.Scanner;

public class InsertionSort {
	public static void main(String argv[]) {
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int array[] = new int[length];
		for (int i = 0; i < length; i++) {
			array[i] = in.nextInt();
		}
		print(array);
		
		int reference, next;
		
		for (int j = 1; j < length; j++) {
			reference = j - 1;
			next = array[j];
			while (next >= 0 && array[reference] > next) {
				array[reference + 1] = array[reference];
				reference--;
			}
			array[reference+1] = next;
			print(array);
		}
		
	}
	private static void print(int array[]) {
		for (int i = 0; i < array.length; i++) {
			System.out.print(array[i]);
		}
		System.out.println("\n");
	}
}



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

package AIZU;

import java.util.Scanner;

public class InsertionSort {
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext())
			System.out.println(scan.next());
	}
}



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

import java.util.Scanner;

public class InsertionSort {
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext())
			System.out.println(scan.next());
	}
}



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

import java.util.Scanner;

public class InsertSort {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] sorted = new int[n];
		for(int i = 0; i < n; i++) {
			sorted[i] = in.nextInt();
		}
		for(int i = 0; i < n; i++) {
			int temp = sorted[i];
			int j = i-1;
			while(j >= 0 && temp < sorted[j]) {
				sorted[j+1] = sorted[j];
				j--;
			}
			sorted[j+1] = temp;
		}
		for (int e : sorted) {
			System.out.print(e);
		}
	}

}



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

import java.util.Scanner;

public class InsertionSort {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
        String len = in.nextLine();
        String n = in.nextLine();
        String[] numbers = n.split(" ");
        int[] nums = new int[Integer.parseInt(len)];
        
        for (int s = 0; s < numbers.length; s++) {
        	nums[s] = Integer.parseInt(numbers[s]);
        }
        
        int j = 0;
        for (int i = 1; i < nums.length; i++) {
        	int key = nums[i];
        	j = i - 1;
        	
        	while (j >= 0 && nums[j] > key){
        		nums[j+1] = nums[j];
        		j--;
        	}
        	nums[j+1] = key;
            
        	for (int b = 0; b < nums.length; b++) {
        		System.out.println(nums[b]);
        		if (b < nums.length - 1) {
        			System.out.println(" ");
        		}
        	}
        }
	}
}


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


import java.util.Scanner;

public class InsertionSort {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);	
		int N = in.nextInt();
		int[] A = new int[N];
		
		for (int i = 0; i < N; i++) {
			A[i] = in.nextInt();
		}
		
		for (int k : A) {
			System.out.print(k + " ");					
		}
		for (int i = 1; i <= A.length-1; i++) {
			int key = A[i];
			int j = i-1;
			while (j >= 0 && A[j] > key) {
				A[j+1] = A[j];
				j--;
				
				
			}
			A[j+1] = key;
			System.out.print('\n');
			for (int k : A) {
				System.out.print(k + " ");					
			}
			
		}
		
	}
}


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

import java.util.Scanner;

public class InsertionSort {
    public static void main(String[] args) {
    	Scanner in = new Scanner(System.in);
    	int a = in.nextInt();
    	int[] ints = new int[a];
    	
    	for (int i=0; i<a; i++) {
            ints[i] = in.nextInt();
        }
    	int MyArray;
    	for (int i=0; i<a; i++) {
    		MyArray = ints[i];
            
            int j = i - 1;
            while (j>=0 && ints[j]>MyArray) {
                ints[j+1] = ints[j];
                j--;
            }
            ints[j+1] = MyArray;
            
            for (int o=0; i<ints.length; o++) {
                System.out.print(ints[o]);
                if (i!=ints.length-1) {System.out.print(" ");}
        }
    	}
            
            
    	       
}
}


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

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

import java.lang.StringBuilder;

class InsertionSort{




    public static void main(String[] args) throws IOException {


        // read the input
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int length = Integer.parseInt(br.readLine());

        int[] numbers = new int[length];

        String[] line = br.readLine().split(" ");

        // copy numbers into our list
        for(int i=0; i< length; i++){
            numbers[i] = Integer.parseInt(line[i]);
        }

        /**
        int length = 6;
        int[] numbers = new int[]{5,2,4,6,1,3};
         */


        InsertionSort is = new InsertionSort();
        is.toString(numbers);
        is.insertionSort(length,numbers);

    public void insertionSort(int n,int[] numbers){
        for (int i = 1; i < n; i++) {
            int key = numbers[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;

            while (j >= 0 && numbers[j] > key){
                numbers[j+1] = numbers[j];
                j--;
            }

            numbers[j+1] = key;

            toString(numbers);

        }
    }
    // print the current list
    public void toString(int[] numbers){
        StringBuilder ans = new StringBuilder().append(numbers[0]);
        for (int x = 1; x < numbers.length; x++)
            ans.append(" ").append(numbers[x]);
        System.out.println(ans.toString());

    }


    }
}


Compiler output:
Main.java:38: error: illegal start of expression
    public void insertionSort(int n,int[] numbers){
    ^
Main.java:66: error: class, interface, enum, or record expected
}
^
2 errors
Language: Java

import java.util.Scanner;

public class InsertionSort {
	static Scanner in = new Scanner(System.in);
    public static void main(String[] args) {
    	
    	int a = in.nextInt();
    	int[] ints = new int[a];
    	
    	for (int i=0; i<a; i++) {
            ints[i] = in.nextInt();
        }
    	int MyArray;
    	for (int i=0; i<a; i++) {
    		MyArray = ints[i];
            
            int j = i - 1;
            while (j>=0 && ints[j]>MyArray) {
                ints[j+1] = ints[j];
                j--;
            }
            ints[j+1] = MyArray;
            print(ints);
    	}
    }
            static void print (int num[]) {
                for (int i=0; i<num.length; i++) {
                    System.out.print(num[i]);
                    if (i!=num.length-1) {System.out.print(" ");}
                }
                System.out.println();
            
            
    	       
            }
}



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

import java.util.Scanner;

public class InsertionSort {
	static Scanner in = new Scanner(System.in);
    public static void main(String[] args) {
    	
    	int a = in.nextInt();
    	int[] ints = new int[a];
    	
    	for (int i=0; i<a; i++) {
            ints[i] = in.nextInt();
        }
    	int MyArray;
    	for (int i=0; i<a; i++) {
    		MyArray = ints[i];
            
            int j = i - 1;
            while (j>=0 && ints[j]>MyArray) {
                ints[j+1] = ints[j];
                j--;
            }
            ints[j+1] = MyArray;
            
            for (int t=0; t<ints.length; t++) {
                System.out.print(ints[t]);
                if (t!=ints.length-1) {System.out.print(" ");}
            }
            System.out.println();
            
            
    	} 
            
    	       
            }
}


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

import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
// Get numbers
int n = input.nextInt();
int[] nums = new int[n];

// fill array
for(int i = 0; i < n; i++){
 nums[i] = input.nextInt();
}

insertSort(n, nums);
}

public static void insertSort(int n, int[] nums){
for(int i = 1; i< nums.length-1; i++){
    System.out.println(nums);
    int key = nums[i];
    // insert A[i] into the sorted sequence A[0,...,j-1] 
    int j = i - 1;
    while(j >= 0 && nums[j] > key){
        nums[j+1] = nums[j];
        j--;
    }
    nums[j+1] = key;
}
System.out.println(nums);
}


Compiler output:
Main.java:30: error: reached end of file while parsing
}
 ^
1 error
Language: Java

*
 * Created by heads on 8/24/2018.
 */
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
// Get numbers
        int n = input.nextInt();
        int[] nums = new int[n];

// fill array
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

        insertSort(n, nums);
    }

    public static void insertSort(int n, int[] nums){
        for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        }
        printHelp(nums);
    }

    private static void printHelp(int[] nums){
        for(int i : nums){
            System.out.print(i + " ");
        }
        System.out.print("\n");
    }
}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
*
^
Main.java:5: error: class, interface, enum, or record expected
import java.util.Scanner;
^
2 errors
Language: Java

import java.util.Scanner;

import java.lang.StringBuilder;

class Main{

    public void insertionSort(int n,int[] numbers){

        toString(numbers);

        for (int i = 1; i < n; i++) {
            int key = numbers[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;

            while (j >= 0 && numbers[j] > key){
                numbers[j+1] = numbers[j];
                j--;
            }

            numbers[j+1] = key;
            // print the current list
            toString(numbers);

        }
    }
    public void toString(int[] numbers){

        /**
        StringBuilder ans = new StringBuilder().append(numbers[0]);
        for (int x = 1; x < numbers.length; x++)
            ans.append(" ").append(numbers[x]);
        System.out.println(ans.toString());
         */

        String ans = "" +numbers[0];

        for (int i = 1; i < numbers.length; i++)
            ans = ans + " " + numbers[i];

        System.out.println(ans);
    }


    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int length = sc.nextInt();

        int[] numbers = new int[length];

        int i = 0;
        while(sc.hasNextInt() && i < length) {
            numbers[i] = sc.nextInt();
            i++;
        }

        InsertionSort is = new InsertionSort();

        is.insertionSort(length,numbers);

        // Test
        //is.insertionSort(6,new int[]{5,2,4,6,1,3});
        //is.insertionSort(3,new int[]{1,2,3});

    }
}


Compiler output:
Main.java:58: error: cannot find symbol
        InsertionSort is = new InsertionSort();
        ^
  symbol:   class InsertionSort
  location: class Main
Main.java:58: error: cannot find symbol
        InsertionSort is = new InsertionSort();
                               ^
  symbol:   class InsertionSort
  location: class Main
2 errors
Language: Java

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int length = reader.nextInt();
		reader.nextLine();
		String list = reader.nextLine();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < list.length(); i++) {
			if(!list.substring(i, i+1).equals(" ")){
				intList[k] = Integer.parseInt(list.substring(i, i + 1));
				k++;
			}
		}
		for(int i = 1; i < intList.length; i++) {
			for(int m = 0; m < intList.length; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println("");
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
		}
	}
}


Compiler output:
Main.java:4: error: cannot find symbol
		Scanner reader = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner reader = new Scanner(System.in);
		                     ^
  symbol:   class Scanner
  location: class Main
2 errors