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

#include <bitset>
#include <cstdlib>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

string convert[128];

inline string to_binary_string(int x) {
	return bitset<6>(x).to_string();
}

inline void init() {
	for(int i = 0; i < 26; ++i) {
		convert['A' + i] = to_binary_string(i);
		convert['a' + i] = to_binary_string(i + 26);
	}

	for(int i = 0; i < 10; ++i) {
		convert['0' + i] = to_binary_string(52 + i);
	}

	convert[static_cast<int>('+')] = to_binary_string(62);
	convert[static_cast<int>('/')] = to_binary_string(63);
}

inline string decode(const string &s, int len) {
	string res = "";
	for(const int &c : s) {
		res += convert[c];
	}
	return res.substr(0, len);
}

inline vector<string> input_image(int w, int h) {
	vector<string> res;
	res.reserve(h);

	for(int i = 0; i < h; ++i) {
		string in;
		cin >> in;
		res.emplace_back(decode(move(in), w));
	}

	return res;
}

void rotate(vector<string> &mat) {
	const int n = mat.size();
	const auto tmp = mat;

	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			const int tx = -i + n - 1;
			const int ty = j;
			mat[ty][tx] = tmp[i][j];
		}
	}

}

typedef unsigned long long hash_t;

unordered_map<hash_t, int> rolling_hash_2d(const vector<string> &s, int size) {
	constexpr hash_t base_w = 1000000007ull;
	constexpr hash_t base_h = 9999931ull;

	const int h = s.size();
	const int w = s[0].size();

	hash_t pow_hash_w = 1;
	hash_t pow_hash_h = 1;
	for(int i = 0; i < size; ++i) {
		pow_hash_w *= base_w;
		pow_hash_h *= base_h;
	}

	vector<vector<hash_t>> hash_w(h, vector<hash_t>(w));
	for(int i = 0; i < h; ++i) {
		hash_t tmp = 0ull;
		for(int j = 0; j < w; ++j) {
			tmp = tmp * base_w + s[i][j];
			if(j >= size) tmp -= pow_hash_w * s[i][j - size];
			hash_w[i][j] = tmp;
		}
	}

	unordered_map<hash_t, int> res;
	for(int j = 0; j < w; ++j) {
		hash_t tmp = 0ull;
		for(int i = 0; i < h; ++i) {
			tmp = tmp * base_h + hash_w[i][j];
			if(i >= size) tmp -= pow_hash_h * hash_w[i - size][j];
			if(i >= size - 1) ++res[tmp];
		}
	}

	return res;
}

void print(const vector<string> &mat) {
	for(const auto &s : mat) {
		cout << s << endl;
	}
	cout << endl;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	init();

	for(int w, h, p; cin >> w >> h >> p && w;) {
		const vector<string> image = input_image(w, h);
		auto hash_i = rolling_hash_2d(image, p);

		vector<string> pattern = input_image(p, p);

		int ans = 0;
		for(int rev = 0; rev < 2; ++rev) {
			for(int rot = 0; rot < 4; ++rot) {
				const hash_t target = rolling_hash_2d(pattern, p).cbegin()->first;
				ans += hash_i[target];
				hash_i[target] = 0;
				rotate(pattern);
			}

			for(auto &s : pattern) reverse(begin(s), end(s));
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

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


#if 0

#endif
#include <vector>
#include <algorithm>
#include <iostream>
#define MAX_M 105
#define MAX_N 105
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;

double double_max = numeric_limits<double>::max();
double double_min = numeric_limits<double>::min();

int M, N;
int X1[MAX_M], Y1[MAX_M];
int X2[MAX_N], Z2[MAX_N];

double width(int X[], int Y[], int n, double x) {
    double lb = double_max, ub = -double_min;
    rep(i, n) {
        // cout << X[i] << Y[i] << endl;
        double x1 = X[i], y1 = Y[i];
        double x2 = X[(i + 1) % n], y2 = Y[(i + 1) % n];
        if ((x1 - x) * (x2 - x) <= 0 && x1 != x2) {
            double a = (y1 - y2) / (x1 - x2);
            double b = (y1 * x2 - y2 * x1) / (x2 - x1);
            double y = a * x + b;
            lb = min(lb, y);
            ub = max(ub, y);
        }
    }
    // cout << max(0.0, ub - lb) << endl;
    // cout << "------------" << endl;
    return max(0.0, ub - lb);
}

void solve() {
    int min1 = *min_element(X1, X1 + M), max1 = *max_element(X1, X1 + M);
    int min2 = *min_element(X2, X2 + N), max2 = *max_element(X2, X2 + N);
    vector<int> xs;
    rep(i, M)
        xs.push_back(X1[i]);
    rep(i, N)
        xs.push_back(X2[i]);
    sort(xs.begin(), xs.end());

    double total = 0;
    for (int i = 0; i < xs.size() - 1; i++) {
        double a = xs[i], b = xs[i + 1], c = (a + b) / 2;
        if (min1 <= c && c <= max1 && min2 <= c && c <= max2) {
            double fa = width(X1, Y1, M, a) * width(X2, Z2, N, a);
            double fb = width(X1, Y1, M, b) * width(X2, Z2, N, b);
            double fc = width(X1, Y1, M, c) * width(X2, Z2, N, c);
            total += (b - a) / 6 * (fa + 4 * fc + fb);
        }
    }

    cout << total << endl;
}

int main() {
    while (cin >> M >> N) {
        if (M == 0 && N == 0)
            break;

        rep(i, M)
            cin >> X1[i] >> Y1[i];
        rep(i, N)
            cin >> X2[i] >> Z2[i];

        solve();
    }
}


Compiler output:
a.cc:13:21: error: 'numeric_limits' was not declared in this scope
   13 | double double_max = numeric_limits<double>::max();
      |                     ^~~~~~~~~~~~~~
a.cc:13:36: error: expected primary-expression before 'double'
   13 | double double_max = numeric_limits<double>::max();
      |                                    ^~~~~~
a.cc:14:21: error: 'numeric_limits' was not declared in this scope
   14 | double double_min = numeric_limits<double>::min();
      |                     ^~~~~~~~~~~~~~
a.cc:14:36: error: expected primary-expression before 'double'
   14 | double double_min = numeric_limits<double>::min();
      |                                    ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
int m,n;
const double EPS = 1e-11;
vector<pair<int,int> > Pxy,Pyz;
pair<int,int> tem;
vector<int> X;


double width(vector<pair<int,int> > polygon,double x){
    vector<double> w;
    for(int i=0;i<polygon.size();i++){
        pair<int,int> p=polygon[i];
        pair<int,int> q=polygon[(i+1)%polygon.size()];
        if((p.first-x)<EPS){
            w.push_back(1.0*p.second);
        }
        else if(p.first<x && x<q.first|| p.first>0 && x>q.first){
            int x0=p.first;
            int y0=p.second;
            int x1=q.first;
            int y1=q.second;
            w.push_back(y0+1.0*(y1-y0)*(x-x0)/(x1-x0));
        }
    }
    assert(w.size()>0);
    vector<double>::iterator maxs=max_element(w.begin(),w.end());
    vector<double>::iterator mins=min_element(w.begin(),w.end());
    return (maxs-mins);
}

int volume(vector<pair<int,int> >Pxy,vector<pair<int,int> >Pxz,vector<int> X){
    double total=0.0;
    int xmin = max((*min_element(Pxy.begin(), Pxy.end())).first,
                   (*min_element(Pxz.begin(), Pxz.end())).first);
    int xmax = min((*max_element(Pxy.begin(), Pxy.end())).first,
                   (*max_element(Pxz.begin(), Pxz.end())).first);
    sort(X.begin(), X.end());
    for(int i=0;i<X.size()-1;i++){
        int a=X[i];
        int b=X[i+1];
        if(!(xmin <= a && a <= xmax &&xmin <= b && b<< xmax) ){
            continue;
        }
        double m=(a+b)/2.0;
        double va = width(Pxy, a)*width(Pxz, a);
        double vb = width(Pxy, b)*width(Pxz, b);
        double vm = width(Pxy, m)*width(Pxz, m);
        double area=((b-a)/6.0)*(va + 4.0*vm + vb);
        total+=area;
    }
    return total;
}
int main(){
    while(cin>>m>>n&&n!=0){
        for(int i=1;i<=m;i++){
            cin>>tem.first>>tem.second;
            Pxy.push_back(tem);
            X.push_back(x);
        }
        for(int j=1;j<=n;j++){
            cin>>tem.first>>tem.second;
            Pxz.push_back(tem);
            X.push_back(x);
        }
        cout << fixed << volume(PXY, PXZ, X) << endl;
    }
}




Compiler output:
a.cc: In function 'int main()':
a.cc:60:25: error: 'x' was not declared in this scope
   60 |             X.push_back(x);
      |                         ^
a.cc:64:13: error: 'Pxz' was not declared in this scope; did you mean 'Pyz'?
   64 |             Pxz.push_back(tem);
      |             ^~~
      |             Pyz
a.cc:65:25: error: 'x' was not declared in this scope
   65 |             X.push_back(x);
      |                         ^
a.cc:67:33: error: 'PXY' was not declared in this scope; did you mean 'Pxy'?
   67 |         cout << fixed << volume(PXY, PXZ, X) << endl;
      |                                 ^~~
      |                                 Pxy
a.cc:67:38: error: 'PXZ' was not declared in this scope
   67 |         cout << fixed << volume(PXY, PXZ, X) << endl;
      |                                      ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
int m,n;
const double EPS = 1e-11;
vector<pair<int,int> > Pxy,Pyz;
pair<int,int> tem;
vector<int> X;


double width(vector<pair<int,int> > polygon,double x){
    vector<double> w;
    for(int i=0;i<polygon.size();i++){
        pair<int,int> p=polygon[i];
        pair<int,int> q=polygon[(i+1)%polygon.size()];
        if((p.first-x)<EPS){
            w.push_back(1.0*p.second);
        }
        else if(p.first<x && x<q.first|| p.first>0 && x>q.first){
            int x0=p.first;
            int y0=p.second;
            int x1=q.first;
            int y1=q.second;
            w.push_back(y0+1.0*(y1-y0)*(x-x0)/(x1-x0));
        }
    }
    assert(w.size()>0);
    vector<double>::iterator maxs=max_element(w.begin(),w.end());
    vector<double>::iterator mins=min_element(w.begin(),w.end());
    return (maxs-mins);
}

int volume(vector<pair<int,int> >Pxy,vector<pair<int,int> >Pxz,vector<int> X){
    double total=0.0;
    int xmin = max((*min_element(Pxy.begin(), Pxy.end())).first,
                   (*min_element(Pxz.begin(), Pxz.end())).first);
    int xmax = min((*max_element(Pxy.begin(), Pxy.end())).first,
                   (*max_element(Pxz.begin(), Pxz.end())).first);
    sort(X.begin(), X.end());
    for(int i=0;i<X.size()-1;i++){
        int a=X[i];
        int b=X[i+1];
        if(!(xmin <= a && a <= xmax &&xmin <= b && b<< xmax) ){
            continue;
        }
        double m=(a+b)/2.0;
        double va = width(Pxy, a)*width(Pxz, a);
        double vb = width(Pxy, b)*width(Pxz, b);
        double vm = width(Pxy, m)*width(Pxz, m);
        double area=((b-a)/6.0)*(va + 4.0*vm + vb);
        total+=area;
    }
    return total;
}
int main(){
    while(cin>>m>>n&&n!=0){
        for(int i=1;i<=m;i++){
            cin>>tem.first>>tem.second;
            Pxy.push_back(tem);
            X.push_back(tem.first);
        }
        for(int j=1;j<=n;j++){
            cin>>tem.first>>tem.second;
            Pxz.push_back(tem);
            X.push_back(tem.first);
        }
        cout << fixed << volume(Pxy, Pxz, X) << endl;
    }
}




Compiler output:
a.cc: In function 'int main()':
a.cc:64:13: error: 'Pxz' was not declared in this scope; did you mean 'Pyz'?
   64 |             Pxz.push_back(tem);
      |             ^~~
      |             Pyz
a.cc:67:38: error: 'Pxz' was not declared in this scope; did you mean 'Pyz'?
   67 |         cout << fixed << volume(Pxy, Pxz, X) << endl;
      |                                      ^~~
      |                                      Pyz
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <stack>
#include <queue>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <list>
#include <string.h>
using namespace std;
typedef long long int ll; typedef pair <int, int> P;
const double INF = 1000000000; const double EPS = 10e-9;
int x1[100], y[100], x2[100], z[100];
double width(int *X, int *Y, int n, double x) {
	double lb = -INF, ub = INF;
	for (int i = 0; i < n; i++)
	{
		double x1 = X[i], x2 = X[(i + 1) % n], y1 = Y[i], y2 = Y[(i + 1) % n];
		if ((x1 - x) * (x2 - x) >= 0) continue;
		double y = y1 + (y2 - y1) * (x - x1) / (x2 - x1);
		lb = max(lb, y);
		ub = min(ub, y);
	}
	return lb - ub;
}
int main()
{
	vector <int> x;
	int m, n; cin >> m >> n;
	for (int i = 0; i < m; i++) {
		cin >> x1[i] >> y[i];
		x.push_back(x1[i]);
	}
	int minx1 = *min_element(x1, x1 + m), maxx1 = *max_element(x1, x1 + m);
	int minx2 = *min_element(x2, x2 + n), maxx2 = *max_element(x2, x2 + n);
	for (int i = 0; i < n; i++) {
		cin >> x2[i] >> z[i];
		x.push_back(x2[i]);
	}
	sort(x.begin(), x.end());
	double res = 0.0;
	for (int i = 0; i + 1 < m + n; i++)
	{
		int a = x[i], b = x[i + 1], c = (a + b) / 2;
		if (minx1 < c && c < maxx1 && minx2 < c && c < maxx2)
		{
			double sa = width(x1, y, m, a) * width(x2, z, n, a);
			double sb = width(x1, y, m, b) * width(x2, z, n, b);
			double sc = width(x1, y, m, c) * width(x2, z, n, c);
			res += (b - a) / 6 * (sa + sb + 4 * sc);
		}
	}
	printf("%.10f\n", res);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:22: error: 'min_element' was not declared in this scope
   36 |         int minx1 = *min_element(x1, x1 + m), maxx1 = *max_element(x1, x1 + m);
      |                      ^~~~~~~~~~~
a.cc:42:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   42 |         sort(x.begin(), x.end());
      |         ^~~~
      |         sqrt
a.cc:47:38: error: 'maxx1' was not declared in this scope
   47 |                 if (minx1 < c && c < maxx1 && minx2 < c && c < maxx2)
      |                                      ^~~~~
a.cc:47:64: error: 'maxx2' was not declared in this scope
   47 |                 if (minx1 < c && c < maxx1 && minx2 < c && c < maxx2)
      |                                                                ^~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

double width(int *x, int *y, int size, double given_x){
    double max_point = -1000.0, min_point = 1000.0;
    for(int i = 0; i < size; i++){
        double x1 = x[i], y1 = y[i], x2 = x[(i+1)%size], y2 = y[(i+1)%size];
        if((x1-given_x)*(x2-given_x) <= 0 && x1 != x2){
            double value = (y2-y1) * (given_x-x1) / (x2-x1) + y1; 
            max_point = max(value, max_point);
            min_point = min(value, min_point);
        }
    }
    return max_point - min_point;
}

int main(){
    int m, n;
    while(cin >> m >> n && m > 0){
        int xy[100];
        int y[100];
        int xz[100];
        int z[100];
        int max_xy = -105;
        int min_xy = 105;
        for(int i = 0; i < m; i++){
            cin >> xy[i] >> y[i];
            max_xy = max(max_xy, xy[i]);
            min_xy = min(min_xy, xy[i]);
        }
        int max_xz = -105;
        int min_xz = 105;
        for(int i = 0; i < n; i++){
            cin >> xz[i] >> z[i];
            max_xz = max(max_xz, xz[i]);
            min_xz = min(min_xz, xz[i]);
        }
        int xmin = max(min_xy, min_xz);
        int xmax = min(max_xy, max_xz);
        vector<int> v;
        for(int i = 0; i < m; i++) v.push_back(xy[i]);
        for(int i = 0; i < n; i++) v.push_back(xz[i]);
        sort(v.begin(), v.end());
        double ans = 0;
        for(int i = 0; i < v.size(); i++){
            double a = v[i], b = v[i+1];
            if(xmin <= a && a <= xmax && xmin <= b && b <= xmax){
                double mid = (a + b) / 2.0;
                double va = width(xy, y, m, a) * width(xz, z, n, a);
                double vb = width(xy, y, m, b) * width(xz, z, n, b);
                double vm = width(xy, y, m, mid) * width(xz, z, n, mid);
                ans += (b-a)/6 * (va + 4*vm + vb);
            }
        }
        cout << ans << endl;
    }
}

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

#include <iostream>
#include <vector>
#include <complex>
#include <stdio.h>

using namespace std;

typedef complex<int> P;

double getWidth(vector<P> &g, int x){
	double m = 1e10, M = -1e10;
	for(int i=0;i<g.size();i++){
		P a = g[i], b = g[(i+1)%g.size()];
		if(real(a) > real(b)) swap(a, b);
		if(real(a) != real(b) && real(a) <= x && x <= real(b)){
			double mid = (double)(x-real(a))/(real(b)-real(a));
			double d = imag(a)*(1-mid)+imag(b)*mid;
			m = min(d, m);
			M = max(d, M);
		}
	}
	return max(0.0, M-m);
}

int main(){
	int n, m;
	while(cin >> m >> n, m){
		vector<P> gy(m), gz(n);
		int sy = 100, ey = -100, sz = 100, ez = -100; 
		for(int i=0;i<m;i++){
			fin >> real(gy[i]) >> imag(gy[i]);
			sy = min(sy, real(gy[i]));
			ey = max(ey, real(gy[i]));
		}
		for(int i=0;i<n;i++){
			fin >> real(gz[i]) >> imag(gz[i]);
			sz = min(sz, real(gz[i]));
			ez = max(ez, real(gz[i]));
		}
		double res = 0.0;
		for(int i=max(sy, sz);i+1<=min(ey, ez);i++){
			double py = getWidth(gy, i), cy = getWidth(gy, i+1), pz = getWidth(gz, i), cz = getWidth(gz, i+1);
			res += (cy*cz+(cy+py)*(cz+pz)+py*pz)/6.0;
		}
		printf("%.4lf\n", res);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:25: error: 'fin' was not declared in this scope; did you mean 'sin'?
   31 |                         fin >> real(gy[i]) >> imag(gy[i]);
      |                         ^~~
      |                         sin
a.cc:36:25: error: 'fin' was not declared in this scope; did you mean 'sin'?
   36 |                         fin >> real(gz[i]) >> imag(gz[i]);
      |                         ^~~
      |                         sin
Language: C++

#include <fstream>
#include <vector>
#include <complex>
#include <stdio.h>

using namespace std;

typedef complex<int> P;

double getWidth(vector<P> &g, int x){
	double m = 1e10, M = -1e10;
	for(int i=0;i<g.size();i++){
		P a = g[i], b = g[(i+1)%g.size()];
		if(real(a) > real(b)) swap(a, b);
		if(real(a) != real(b) && real(a) <= x && x <= real(b)){
			double mid = (double)(x-real(a))/(real(b)-real(a));
			double d = imag(a)*(1-mid)+imag(b)*mid;
			m = min(d, m);
			M = max(d, M);
		}
	}
	return max(0.0, M-m);
}

int main(){
	int n, m;
	while(cin >> m >> n, m){
		vector<P> gy(m), gz(n);
		int sy = 100, ey = -100, sz = 100, ez = -100; 
		for(int i=0;i<m;i++){
			cin >> real(gy[i]) >> imag(gy[i]);
			sy = min(sy, real(gy[i]));
			ey = max(ey, real(gy[i]));
		}
		for(int i=0;i<n;i++){
			cin >> real(gz[i]) >> imag(gz[i]);
			sz = min(sz, real(gz[i]));
			ez = max(ez, real(gz[i]));
		}
		double res = 0.0;
		for(int i=max(sy, sz);i+1<=min(ey, ez);i++){
			double py = getWidth(gy, i), cy = getWidth(gy, i+1), pz = getWidth(gz, i), cz = getWidth(gz, i+1);
			res += (cy*cz+(cy+py)*(cz+pz)+py*pz)/6.0;
		}
		printf("%.4lf\n", res);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:15: error: 'cin' was not declared in this scope
   27 |         while(cin >> m >> n, m){
      |               ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <complex>
  +++ |+#include <iostream>
    4 | #include <stdio.h>
Language: C++

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

const int INF = 1<<29;
const int MAX_N = 100;
const int MAX_M = 100;

int M, N;
int X1[MAX_M], Y1[MAX_M];
int X2[MAX_N], Z2[MAX_N];

double width(int* X, int* Y, int n, double x) {
  double lb = INF, ub = -INF;
  for(itn i=0; i<n; i++) {
    double x1 = X[i], y1 = Y[i], x2 = X[(i+1)%n], y2 = y[(i+1) % n];
    
    if((x1-x)*(x2-x) <= 0 && x1 != x2) {
      double y = y1 + (y2 - y1) * (x - x1) / (x2 - x1);
      
      lb = min(lb, y);
      ub = max(ub, y);
    }
  }
  
  return max(0.0, ub - lb);
}

void solve() {
  int min1 = *min_element(X1, X1 + M), max1 = *max_element(X1, X1 + M);
  int min2 = *min_element(X2, X2 + N), max2 = *max_element(X2, X2 + N);
  
  vector<int> xs;
  
  for(int i=0; i<M; i++) xs.push_back(X1[i]);
  for(int i=0; i<N; i++) xs.push_back(X2[i]);
  
  sort(xs.begin(), xs.end());
  
  double res = 0;
  for(int i=0; i+1<xs.size(); i++) {
    double a = xs[i], b = xs[i+1], c = (a+b) / 2;
    if(min1 <= c && c <= max1 && min2 <= c && c <= max2) {
      double fa = width(X1, Y1, M, a) * width(X2, Z2, N, a);
      double fb = width(X1, Y1, M, b) * width(X2, Z2, N, b);
      double fc = width(X1, Y1, M, c) * width(X2, Z2, N, c);
      res += (b - a) / 6 * (fa + 4 * fc + fb);
    }
  }
  
  printf("%.10f\n", res);
}

int main() {
  
  while(cin >> M >> N && (M|N)) {
    for(int i=0; i<M; i++) cin >> X1[i] >> Y1[i];
    for(int i=0; i<N; i++) cin >> X2[i] >> Z2[i];
    
    solve();
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'double width(int*, int*, int, double)':
a.cc:15:7: error: 'itn' was not declared in this scope; did you mean 'int'?
   15 |   for(itn i=0; i<n; i++) {
      |       ^~~
      |       int
a.cc:15:16: error: 'i' was not declared in this scope
   15 |   for(itn i=0; i<n; i++) {
      |                ^
a.cc:18:16: error: 'x2' was not declared in this scope; did you mean 'X2'?
   18 |     if((x1-x)*(x2-x) <= 0 && x1 != x2) {
      |                ^~
      |                X2
a.cc:19:24: error: 'y2' was not declared in this scope; did you mean 'y'?
   19 |       double y = y1 + (y2 - y1) * (x - x1) / (x2 - x1);
      |                        ^~
      |                        y
Language: C

#include <bits/stdc++.h>

using namespace std;

map<string, int> dict; 
map<string, int> enter;

int main()
{
    //freopen("input.txt", "r" ,stdin);
    int n;
    while (scanf("%d", &n)==1)
    {
        dict.clear();
        enter.clear();
        int m, d, hours, minutes;
        char str[100];
        char flag[100];
        for (int i=1; i<=n; i++)
        {
            scanf("%d/%d", &m, &d);
            scanf("%d:%d", &hours, &minutes);
            scanf("%s%s", flag, str);

            //printf("%d %d %d %d %s %s\n", m, d, hours, minutes, flag, str);
            if (flag[0] == 'I')
            {
                if (string(str) == "000")
                {
                    enter["000"] = hours*60+minutes;
                    for (map<string, int>::iterator ite = enter.begin(); ite!=enter.end(); ite++)
                        if (ite->second!=0)
                            ite->second = hours*60+minutes;
                }
                else
                    enter[string(str)] = hours*60+minutes;
            }
            else
            {
                if (string(str) != "000")
                {
                    if (enter["000"])
                        dict[string(str)] += hours*60+minutes - enter[string(str)];
                    enter[string(str)] = 0;
                }
                else
                {
                    for (map<string, int>::iterator ite = enter.begin(); ite!=enter.end(); ite++)
                    {
                        if (ite->first!="000"&& ite->second!=0)
                        {
                            dict[ite->first] += hours*60+minutes - ite->second;
                            ite->second = hours*60+minutes;
                        }
                    }
                    enter["000"] = 0;
                }
            }
        }
        int ans = 0;
        for (map<string, int>::iterator ite = dict.begin(); ite!=dict.end(); ite++)
        {
            //printf("%s %d\n", ite->first.c_str(), ite->second);
            ans = max(ans, ite->second);
        }
        printf("%d\n", ans);
    }
    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <map>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;
int get(int hour,int mi)
{
	return hour*60+mi;
}
int main()
{
    int n;
    while(scanf("%d",&n),n)
    {
    	int mon,day,hour,mi,ans=0,per,maxn=0;
    	int now;
    	int visit[10000];
    	int getin[10000];
    	int getou[10000];
    	int fin[10000];
    	char s[10];
 		memset(visit,0,sizeof(visit));
 		memset(fin,0,sizeof(fin));
        for(int i=1;i<=n;i++)
        {
          scanf("%d/%d %d:%d%s%d",&mon,&day,&hour,&mi,s,&per);
 		  now=get(hour,mi);
 		  maxn=max(maxn,per);
 		  if(s[0]=='I'&&per!=0)
 		  {
             getin[per]=now;
             visit[per]=1;
 		  }
 		  else if(s[0]=='O'&&per!=0)
 		  {
 		  	visit[per]=0;
 		  	if(visit[0])
 		  		fin[per]+=now-max(getin[0],getin[per]);
 		  }
 		  else if(s[0]=='I'&&per==0)
 		  {
               visit[0]=1;
               getin[0]=now;
 		  }
 		  else
 		  {
              visit[0]=0;
              for(int i=1;i<=maxn;i++)
              	if(visit[i])
              		fin[i]+=now-max(getin[0],getin[i]);
 		  }
        }
        ans=0;
        for(int i=1;i<=maxn;i++)
        	ans=max(ans,fin[i]);
        printf("%d\n",ans);
    }
	return 0;
}

Compiler output:
main.c:2:10: fatal error: iostream: No such file or directory
    2 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <string>
#include <time.h>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define inf 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;

int n,m,cap;
string ssrc,sdest;
int src,dest;
set<string>s;
string ss;
map<string,int> mp;
int des[3005];
string a[3000];
string b[3000];

struct node{
	int dis;
	int to;
	node(int dis,int to):dis(dis),to(to){
	}
};
set<string>::iterator it;





struct node1{
	int go;
	int node;
};
queue<node1>q;





bool flag[3333];
int dist[3333][2000];
vector<node>p[3333];
bool inq[3333];
int main()
{
	while(1)
	{
		scanf("%d %d %d",&n,&m,&cap);
		cap*=10;
		cin>>ssrc>>sdest;
		s.insert(ssrc);
		s.insert(sdest);
		for(int i=0;i<n;i++)
		{
			cin>>a[i]>>b[i]>>des[i];
			s.insert(a[i]);
			s.insert(b[i]);
		}
		int num=0;
		for(it=s.begin();it!=s.end();it++)
		{
			mp[*it]=num;
			num++;
		}
		for(int i=0;i<n;i++)
		{
			p[mp[a[i]]].push_back(node(mp[b[i]],des[i]));
			p[mp[b[i]]].push_back(node(mp[a[i]],des[i]));
		}
		for(int i=0;i<m;i++)
		{
			cin>>ss;
			flag[mp[ss]]=1;
		}
	//	for(int i=0;i<num;i++)printf("%d\n",flag[i]);
     	src=mp[ssrc];
    	dest=mp[sdest];
    	
    	
    	
    	for(int i=0;i<num;i++)
    	{
    		for(int j=0;j<=cap;j++)
    		dist[i][j]=inf;
    	}
    	dist[src]=0;
    	node1 now,then;
    	now.go=cap;
    	now.node=src;
    	q.push(now);
    	while(!q.empty())
    	{
    		now=q.front();
    		q.pop();
    		inq[now.node]=0;
    		then.go=now.go;
    		if(flag[now.node]==1)
    		{
    			then.go=cap;
    		}
    		for(int i=0;i<p[now.node].size();i++)
    		{
    			int d=p[now][i].dis;
    			int t=p[now][j].t;
    			if(then.go>d&&dis[t][then.go-d]>dis[now.node][now.go]+d)
    			{
    				
    			}
    		}
    	}
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
	}
}

Compiler output:
main.c:2:10: fatal error: iostream: No such file or directory
    2 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
using namespace std;

int main(void){
    int n;
    while(cin>>n,n!=0){
        map<int, valarray<int>> lg;
        map<int,int> ans;
        int mm,dd,h,m,id,yesterday=0;
        rep(ln,n+1){
            char c;
            if(ln!=n)scanf("%d/%d %d:%d %c %d",&mm,&dd,&h,&m,&c,&id);
            if((yesterday!=0 && yesterday!=mm*100+dd) || ln==n){
                if(lg.find(0)!=lg.end()){
                    for(auto p:lg){
                        if(p.first==0) continue;
                        valarray<int> q=p.second+lg[0];
                        partial_sum(all(q),begin(q));
                        ans[p.first]+=q.apply([](int x){return x==2?1:0;}).sum();
                    }
                }
                lg.clear();
                yesterday=0;
            }
            yesterday=mm*100+dd;
            if(lg.find(id)==lg.end()){
                lg[id]=valarray<int>(0,1441);
            }
            lg[id][h*60+m]+=(c=='I'?1:-1);
        }
        int avl=0;
        for(auto i:ans){
            avl=max(avl,i.second);
        }
        cout<<avl<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:18: error: 'class std::valarray<int>' has no member named 'begin'
    4 | #define all(a) a.begin(),a.end()
      |                  ^~~~~
a.cc:21:37: note: in expansion of macro 'all'
   21 |                         partial_sum(all(q),begin(q));
      |                                     ^~~
a.cc:4:28: error: 'class std::valarray<int>' has no member named 'end'
    4 | #define all(a) a.begin(),a.end()
      |                            ^~~
a.cc:21:37: note: in expansion of macro 'all'
   21 |                         partial_sum(all(q),begin(q));
      |                                     ^~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,t[1005],ent[1005],ans;
bool isin[1500];
char md[10],hm[10],io[10],id[10];
char mdd[10];
int gettime()
{
    int hh=(hm[0]-'0')*10+(hm[1]-'0');
    int mi=(hm[3]-'0')*10+(hm[4]-'0');
    return hh*60+mi;
}
int main()
{
    ///freopen("in.txt","r",stdin);
    while(scanf("%d",&n)&&n!=0)
    {
        memset(t,0,sizeof t);
        mdd[0]='s';
        ans=0;
        while(n--)
        {
            scanf("%s%s%s%s",md,hm,io,id);
            if(strcmp(md,mdd)!=0)
            {
                memset(isin,false,sizeof isin);
                memcpy(mdd,md,sizeof md);
            }
            int ID=(id[0]-'0')*100+(id[1]-'0')*10+(id[2]-'0');
            if(io[0]=='I')
            ent[ID]=gettime();
            else
            {
                int endtime=gettime();
                if(ID==0)
                {
                    for(int i=ent[ID];i<endtime;i++)
                    isin[i]=true;
                    ent[ID]=0;///陦ィ遉コ蟾イ扈丞源驟?                }
                else
                {
                    ///蜈域峩譁ー螂ウ逾樒噪迥カ諤?                    if(ent[0]!=0)
                    {
                        for(int i=ent[0];i<endtime;i++)
                        {
                            isin[i]=true;
                        }
                    }
                    for(int i=ent[ID];i<endtime;i++)
                    {
                        if(isin[i])
                        t[ID]++;
                    }
                }
                ans=max(t[ID],ans);
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: expected '}' before 'else'
   43 |                 else
      |                 ^~~~
a.cc:39:17: note: to match this '{'
   39 |                 {
      |                 ^
Language: Java

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class SorcerersDonut {
	Scanner in = new Scanner(System.in);
	int h, w;
	char[][] map;
	boolean[][] visited;
	int[] dirx = {-1, 0, 1, -1, 1, -1, 0, 1};
	int[] diry = {-1, -1, -1, 0, 0, 1, 1, 1};
	HashSet<String> hash;
	String ans;
	int x, y;
	
	public void run() {
		while (true) {
			h = in.nextInt();
			w = in.nextInt();
			if ((h|w) == 0) break;
			map = new char[h][w];
			hash = new HashSet<String>(0);
			ans = "";
			for (int i = 0; i < h; i++) {
				String s = in.next();
				for (int j = 0; j < w; j++) {
					map[i][j] = s.charAt(j);
				}
			}

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					for (int k = 0; k < 8; k++) {
						x = j; y = i;
						StringBuilder sb = new StringBuilder(map[y][x]);
						for ( ; ; ) {
							x = (x + dirx[k] + w) % w;
							y = (y + diry[k] + h) % h;
							sb.append(map[y][x]);
							if (hash.contains(sb.toString())) {
								if (sb.length() > ans.length() || (sb.length() == ans.length() && ans.compareTo(sb.toString()) > 0)) {
									ans = sb.toString();
								}
							} else if (sb.toString().length() >= Math.max(2, ans.length())) {
								hash.add(sb.toString());
							}
							if (x == j && y == i) break;
						}
						
					}
				}
			}
			
			if (ans.length() < 2)
				System.out.println(0);
			else
				System.out.println(ans);
		}
	}
	
	public static void main(String[] args) {
		new SorcerersDonut().run();
	}

}

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

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

const int maxn = 40;
const int dx[] = {1, -1, 0, 0 , 1, 1, -1, -1},
	 	  dy[] = {0, 0, 1, -1, 1, -1, 1, -1};

int n, m, ml, cnt;
char donut[maxn][maxn];
string ans[2000];
map<string, int> mp;

int main()
{
#ifdef LOCAL
	freopen("B.in", "r", stdin);
#endif
	while(scanf("%d%d", &n, &m) != EOF) {
		if(n == 0 && m == 0)	break;
		ml = cnt = 0;
		mp.clear();
		for(int i = 0; i < n; i++)
			scanf("%s", donut[i]);
		for(int i = 0; i < n; i++)
			for(int j = 0; j < m; j++) 
				for(int k = 0; k < 8; k++) {
					string tmp = "";
					int nx = i, ny = j;
					do{
						tmp += donut[nx][ny];
						if(tmp.size() >= 2 && tmp.size() >= ml) {
							if(!mp[tmp])	mp.insert(pair <string, int> (tmp, 1));	
							else if(tmp.size() == ml && mp[tmp] == 1) 
								ans[cnt++] = tmp;
							else if(tmp.size() > ml) {
								ml = tmp.size();
								cnt = 0;
								ans[cnt++] = tmp;
							}
						}
						mp[tmp]++;						
						nx = (nx+dx[k]+n)%n;
						ny = (ny+dy[k]+m)%m;
					}while(nx != i || ny != j);	
//					cout << tmp << endl;	
					/*
					if(!mp[tmp])	mp.insert(pair <string, int> (tmp, 1));	
					else {
						if(tmp.size() == ml && mp[tmp] == 1) {
							ans[cnt++] = tmp;
						}
						else if(tmp.size() > ml) {
							ml = tmp.size();
							cnt = 0;
							ans[cnt++] = tmp;
						}
						mp[tmp]++;
					}
					*/
				}
		sort(ans, ans+cnt);
		if(cnt)	printf("%s\n", ans[0].c_str());
		else	printf("0\n");
	}
	return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <cstdio>
#include <string>
#include <set>
#include <vector>
using  namespace std;

int dr[]={-1, -1, -1, 0, 0, 1, 1, 1};
int dc[]={-1, 0, 1, -1, 1, -1, 0, 1};

bool cmp(const string& a, const string& b)
{
    if (a.size()<b.size()) return 1;
    if (a.size()>b.size()) return 0;
    return a>b;
}

int main()
{
    int n, m;
    while (scanf("%d%d", &n, &m), n) {
        char s[11][21];
        for(int i=0;i<n;++i) scanf("%s", s[i]);

        int maxlen=0;
        vector<string> spells[200];
        for(int i=0;i<n;++i) for(int j=0;j<m;++j) for(int k=0;k<8;++k) {
            int r=i, c=j, q=0;
            string t;
            do {
                t+=s[r][c];
                spells[q++].push_back(t);
                r=(r+dr[k]+2*n)%n;
                c=(c+dc[k]+2*m)%m;
            } while (r!=i || c!=j);
            maxlen=max(maxlen, q);
        }

        string res;
        for(int k=1;k<maxlen;++k) {
            int N=spells[k].size();
            set<string> v;
            for(int i=0;i<N;++i) {
                if (v.count(spells[k][i]) and cmp(res, spells[k][i]))
                    res=spells[k][i];
                v.insert(spells[k][i]);
            }
        }
        puts(res.size()?res.c_str():"0");
    }
    return 0;
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include <cstdio>
#include <string>
#include <map>

using namespace std;

int h, w;
char str[32][32];

int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

void generate(int sy, int sx, map<string, int> &rec)
{
	char tmp[2] = {0, 0};
	
	for (int i = 0; i < 8; i++){
		tmp[0] = str[sy][sx];
		string s = tmp;
		int ny = sy, nx = sx;
		while (1){
			ny = (ny + h + dy[i]) % h; nx = (nx + w + dx[i]) % w;
			if (ny == sy && nx == sx) break;
			tmp[0] = str[ny][nx];
			s += tmp;
			if (rec.count(s) > 0) rec[s] += 1;
			else rec[s] = 1;
		}
	}
}

int main()
{
	while (scanf("%d %d", &h, &w) && h){
		for (int i = 0; i < h; i++) scanf("%s", str[i]);
		map<string, int> occ;
		
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				generate(i, j, occ);
			}
		}
		
		string ans = "";
		for (map<string, int>::iterator it = occ.begin(); it != occ.end(); it++){
			if (it->second > 1 && it->first.size() >= ans.size()){
				if (it->first.size() > ans.size()) ans = it->first;
				else if (it->first.size() == ans.size() && it->first < ans) ans = it->second;
			}
		}
		
		if (ans != "") printf("%s\n", ans.c_str());
		else printf("0\n");
	}
	return (0);
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C++

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

int lcm(int a, int b){
  return a/__gcd(a, b) * b;
}

int main(int argc, char *argv[]){
  int w, h;
  while(cin >> h >> w, h){
    string torus[30];
    string s[2222];
    for (int i = 0; i < h; i++) {
      cin >> torus[i];
    }
    int l = lcm(w, h);
    int num = 0;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        for (int k = 0; k < h; k++) {
          s[num].push_back(torus[(h + i + k)%h][j]);
          s[num + 1].push_back(torus[(h + i - k)%h][j]);
        }
        
        for (int k = 0; k < w; k++) {
          s[num + 2].push_back(torus[i][(w + j + k)%w]);
          s[num + 3].push_back(torus[i][(w + j - k)%w]);
        }
        
        for (int k = 0; k < l; k++) {
          s[num + 4].push_back(torus[(l*h + i + k)%h][(l*w + j + k)%w]);
          s[num + 5].push_back(torus[(l*h + i - k)%h][(l*w + j + k)%w]);
          s[num + 6].push_back(torus[(l*h + i + k)%h][(l*w + j - k)%w]);
          s[num + 7].push_back(torus[(l*h + i - k)%h][(l*w + j - k)%w]);
        }
        num += 8;
      }
    }
    sort(s, s + 8*w*h);
    string ans = s[0];
    for (int i = 0; i < 8*w*h - 1; i++) {
      int length = 0;
      for (int j = 0;
           j < min(s[i].length(), s[i + 1].length()) - 1; j++) {
        if(s[i][length] == s[i + 1][length])length++;
        else break;
      }
      if(length > ans.length())ans = s[i].substr(0,length);
    }
    if(ans.length() > 1)std::cout << ans << std::endl;
    else std::cout << 0 << std::endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int lcm(int, int)':
a.cc:7:12: error: '__gcd' was not declared in this scope
    7 |   return a/__gcd(a, b) * b;
      |            ^~~~~
a.cc: In function 'int main(int, char**)':
a.cc:41:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   41 |     sort(s, s + 8*w*h);
      |     ^~~~
      |     short
Language: C++

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

int lcm(int a, int b){
  return a/gcd(a, b) * b;
}

int main(int argc, char *argv[]){
  int w, h;
  while(cin >> h >> w, h){
    string torus[30];
    string s[2222];
    for (int i = 0; i < h; i++) {
      cin >> torus[i];
    }
    int l = lcm(w, h);
    int num = 0;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        for (int k = 0; k < h; k++) {
          s[num].push_back(torus[(h + i + k)%h][j]);
          s[num + 1].push_back(torus[(h + i - k)%h][j]);
        }
        
        for (int k = 0; k < w; k++) {
          s[num + 2].push_back(torus[i][(w + j + k)%w]);
          s[num + 3].push_back(torus[i][(w + j - k)%w]);
        }
        
        for (int k = 0; k < l; k++) {
          s[num + 4].push_back(torus[(l*h + i + k)%h][(l*w + j + k)%w]);
          s[num + 5].push_back(torus[(l*h + i - k)%h][(l*w + j + k)%w]);
          s[num + 6].push_back(torus[(l*h + i + k)%h][(l*w + j - k)%w]);
          s[num + 7].push_back(torus[(l*h + i - k)%h][(l*w + j - k)%w]);
        }
        num += 8;
      }
    }
    sort(s, s + 8*w*h);
    string ans = s[0];
    for (int i = 0; i < 8*w*h - 1; i++) {
      int length = 0;
      for (int j = 0;
           j < min(s[i].length(), s[i + 1].length()) - 1; j++) {
        if(s[i][length] == s[i + 1][length])length++;
        else break;
      }
      if(length > ans.length())ans = s[i].substr(0,length);
    }
    if(ans.length() > 1)std::cout << ans << std::endl;
    else std::cout << 0 << std::endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int lcm(int, int)':
a.cc:7:12: error: 'gcd' was not declared in this scope
    7 |   return a/gcd(a, b) * b;
      |            ^~~
a.cc: In function 'int main(int, char**)':
a.cc:41:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   41 |     sort(s, s + 8*w*h);
      |     ^~~~
      |     short
Language: C++

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

int gcd(int a, int b){
  if(b == 0)return a;
  return gcd(b, a%b);
}

int lcm(int a, int b){
  return a/gcd(a, b) * b;
}

int main(int argc, char *argv[]){
  int w, h;
  while(cin >> h >> w, h){
    string torus[30];
    string s[2222];
    for (int i = 0; i < h; i++) {
      cin >> torus[i];
    }
    int l = lcm(w, h);
    int num = 0;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        for (int k = 0; k < h; k++) {
          s[num].push_back(torus[(h + i + k)%h][j]);
          s[num + 1].push_back(torus[(h + i - k)%h][j]);
        }
        
        for (int k = 0; k < w; k++) {
          s[num + 2].push_back(torus[i][(w + j + k)%w]);
          s[num + 3].push_back(torus[i][(w + j - k)%w]);
        }
        
        for (int k = 0; k < l; k++) {
          s[num + 4].push_back(torus[(l*h + i + k)%h][(l*w + j + k)%w]);
          s[num + 5].push_back(torus[(l*h + i - k)%h][(l*w + j + k)%w]);
          s[num + 6].push_back(torus[(l*h + i + k)%h][(l*w + j - k)%w]);
          s[num + 7].push_back(torus[(l*h + i - k)%h][(l*w + j - k)%w]);
        }
        num += 8;
      }
    }
    sort(s, s + 8*w*h);
    string ans = s[0];
    for (int i = 0; i < 8*w*h - 1; i++) {
      int length = 0;
      for (int j = 0;
           j < min(s[i].length(), s[i + 1].length()) - 1; j++) {
        if(s[i][length] == s[i + 1][length])length++;
        else break;
      }
      if(length > ans.length())ans = s[i].substr(0,length);
    }
    if(ans.length() > 1)std::cout << ans << std::endl;
    else std::cout << 0 << std::endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:46:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   46 |     sort(s, s + 8*w*h);
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>

using namespace std;

long long int dx[] = { 0,1,1,1,0,-1,-1,-1 };
long long int dy[] = { 1,1,0,-1,-1,-1,0,1 };

int main()
{
	long long int M , N;
	while(cin >> M >> N , M || N)
	{
		vector<vector<char>>D(M , vector<char>(N));
		set<string>SS;
		string ans;
		for(size_t i = 0; i < M; i++)
		{
			for(size_t j = 0; j < N; j++)
			{
				cin >> D[i][j];
			}
		}
		for(long long int i = 0; i < M; i++)
		{
			for(long long int j = 0; j < N; j++)
			{
				long long int startx = j , starty = i;
				for(long long int k = 0; k < 8; k++)
				{
					long long int p = 1;
					string s;
					s.push_back(D[starty][startx]);
					while(!( ( startx + p*dx[k] + N * 2000 ) % N == startx && ( starty + p*dy[k] + M * 2000 ) % M == starty ))
					{
						s.push_back(D[( starty + p*dy[k] + M * 205 ) % M][( startx + p*dx[k] + N * 205 ) % N]);
						if(s.length() > ans.length())
						{
							if(SS.find(s) != SS.end())
							{
								ans = s;
							} else
							{
								SS.insert(s);
							}
						}
						p++;
					}
				}
			}
		}
		if(ans.length<=1)
		{
			cout << 0 << endl;
		} else
		{
			cout << ans << endl;
		}
	}
}

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

#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int h,w;
  int i,j,k;
  int ai[]={ 1, 1, 1, 0, 0,-1,-1,-1};
  int aj[]={ 1, 0,-1, 1,-1, 1, 0,-1};
  cin >> h >> w;
  while(h!=0){
    string str[10];
    for(i=0;i<h;i++) cin >> str[i];
    vector <string> li;
    vector <string> ans;
    int mal=1;
    for(i=0;i<h;i++){
      //cout << i << endl;
      for(j=0;j<w;j++){
	for(k=0;k<8;k++){
	  int bi=i,bj=j;
	  string buf;
	  buf += str[i][j];
	  bi+=ai[k];bj+=aj[k];
	  if(bi<0) bi=h-1;
	  if(bi>=h) bi=0;
	  if(bj<0) bj=w-1;
	  if(bj>=w) bj=0;
	  while(bi!=i||bj!=j){
	    buf+=str[bi][bj];
	    if(buf.size()>=mal){
	      if(find(li.begin(),li.end(),buf)!=li.end()) {
		if(buf.size()>mal) ans.clear();
		ans.push_back(buf);
		mal=buf.size();
	      }else{
		li.push_back(buf);
	      }
	    }
	    bi+=ai[k];bj+=aj[k];
	    if(bi<0) bi=h-1;
	    if(bi>=h) bi=0;
	    if(bj<0) bj=w-1;
	    if(bj>=w) bj=0;
	  }
	}
      }
    }
    //for(i=0;i<li.size();i++) cout << li[i] << endl;
    sort(ans.begin(),ans.end());
    //for(i=0;i<ans.size();i++) cout << ans[i] << endl;
    if(ans.size()!=0) cout << ans[0] << endl;
    else cout << 0 << endl;
    cin >> h >> w;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:22: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   32 |               if(find(li.begin(),li.end(),buf)!=li.end()) {
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:32:22: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   32 |               if(find(li.begin(),li.end(),buf)!=li.end()) {
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:50:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   50 |     sort(ans.begin(),ans.end());
      |     ^~~~
      |     short