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

import Control.Monad
import Text.Printf
import Control.Applicative
import Data.List as L

main :: IO()
main = do
  _ <- getLine
  a <- map read . words <$> getLine
  printf "%d" $ slv a

slv :: [Integer] -> Integer
slv a = slv' a 0
  where slv' a@(aa:aas) ret = slv' aas (ret + fromIntegral (length [x | x <- (scanl1 (+) a), x == 0]))
        slv' [] ret = ret

Compiler output:
a.cc:13:12: warning: missing terminating ' character
   13 | slv a = slv' a 0
      |            ^
a.cc:13:12: error: missing terminating ' character
   13 | slv a = slv' a 0
      |            ^~~~~
a.cc:14:12: warning: multi-character literal with 21 characters exceeds 'int' size of 4 bytes
   14 |   where slv' a@(aa:aas) ret = slv' aas (ret + fromIntegral (length [x | x <- (scanl1 (+) a), x == 0]))
      |            ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:15:12: warning: missing terminating ' character
   15 |         slv' [] ret = ret
      |            ^
a.cc:15:12: error: missing terminating ' character
   15 |         slv' [] ret = ret
      |            ^~~~~~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import Control.Monad
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C

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

int main(){
  int n;
  int* a = (int*)malloc(sizeof(int)*n);
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }

  int rlt=0;
  for(int i=0;i<n;i++){
    int sum=0;
    for(int j=i;j<n;j++){
      sum+=a[j];
      if(sum==0)rlt+=1;
    }
  }
  cout<<rlt<<endl;
  return 0;
}

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


import java.util.*;
	public class Main2{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            int n = Integer.parseInt(sc.next());
            long[] sum = new long[n+1];
            long temp = 0;
            long count = 0;
            
            sum[0] = 0;
            
            for(int i=0; i<n; i++){
            	temp += Integer.parseInt(sc.next());
            	sum[i+1] = temp;
            }
            
            for(int i=0; i<n+1; i++){
            	for(int j=0; j<i; j++){
            		if(sum[j] - sum[i] == 0){
            			count++;
            		}
            	}
            }
            
            //出力
            System.out.println(count);
            sc.close();
        }
    }
	

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

N = int(input())
A = [int(i) for i in input().split())]

ans = 0

for i in range(0,N-1):
 for j in range(i+1,N):
  if sum(A[i:j])==0:
   ans +=1

print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: Java

import java.util.Scanner;

public class AGC023_A {

	int n;
	int[] a;

	void run() {
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			System.out.println(fnc());
		}
	}

	String fnc() {
		long cnt = 0L;

		for (int i = 0; i < n; i++) {
			long sum = a[i];
			if (sum == 0L) {
				cnt++;
			}
			for (int j = i + 1; j < n; j++) {
				sum += a[j];
				if (sum == 0L) {
					cnt++;
				}
			}
		}

		return "" + cnt;
	}

	public static void main(String[] args) {
		new AGC023_A().run();
	}

}


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

#include <bits\stdc++.h>
using namespace std;
long long n,m,i,j,sum,ans;
map<long long,long long> cnt;
int main()
{
	cnt[0]=1;
	ios_base::sync_with_stdio(0);
	cin>>n;
	for (i=1;i<=n;i++)
	{
		long long x;
		cin>>x;
		sum+=x;
		ans+=cnt[sum];
		cnt[sum]++;
	}
	cout<<ans;
	return 0;
}

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

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
  int n;
  cin >> n;
  vector<string> s(n);
  REP(i,n) cin >> s[i];
  ll ans = 0;
  REP(b,n){
    vector<string> t(n);
    REP(i,n) t[i] = s[i].substr(b+1) + s[i].substr(0, b+1);
    
    bool flag = true;
    REP(i,n) REP(j,n){
      if(s[i][nj]!=s[nj][i]) flag = false;
    }
    if(flag) ans += n;
  }
  cout << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:15: error: 'nj' was not declared in this scope; did you mean 'j'?
   23 |       if(s[i][nj]!=s[nj][i]) flag = false;
      |               ^~
      |               j
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
char s[610][610];
/*void move(int& x,int& y,int const& a,int const& b,int const& n){
  x+=a;
  y+=b;
  x=x%n;
  y=y%n;
}*/

#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
int main(){
  char before='.';
  int n,x,y;
  int cor=0;
  char buf;
  cin>>n;
  rep(i,n){
    rep(j,n){
      cin>>buf;
      s[i][j]=buf;
      s[i+n][j]=buf;
      s[i][j+n]=buf;
      s[i+n][j+n]=buf;
      if(before==buf)cor++;
      before=buf;
    }
  }
  if(cor==n*n)goto kk;
  int ans=0;
  rep(a,n){
    rep(b,n){
      int check=0;
      //      move(x,y,i,j,n);
      rep(i,n){
	rep(j,n){
	  if(s[i+a][j+b]!=s[j+a][i+b])goto FINE;
	}
      }
      ans++;
    FINE:;
    }
  }
 kk:
  if(cor==n*n)ans=n*n;
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:2: error: jump to label 'kk'
   49 |  kk:
      |  ^~
a.cc:34:20: note:   from here
   34 |   if(cor==n*n)goto kk;
      |                    ^~
a.cc:35:7: note:   crosses initialization of 'int ans'
   35 |   int ans=0;
      |       ^~~
Language: C++

#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

const int MAXN = 2100;

char S[MAXN][MAXN];
string diagonals[MAXN];
int n;

int good[MAXN][MAXN][MAXN];

void solve() {
	cin >> n;

	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			cin >> S[i][j];
			S[i + n][j] = S[i][j];
			S[i][j + n] = S[i][j];
			S[i + n][j + n] = S[i][j];
		}
	}

	for(int i = 0; i < 2 * n; ++i) {
		for(int j = 0; j < 2 * n; ++j) {
			diagonals[i + j].push_back(S[i][j]);
		}
	}

	for(int d = 0; d < MAXN; ++d) {
		if(!diagonals[d].empty()) {
			DBG(d);

			DBG(diagonals[d]);
			int sz = len(diagonals[d]);

			for(int l = sz - 1; l >= 0; --l) {
				good[d][l][l] = 1;

				if(l + 1 < sz) {
					good[d][l][l + 1] = (diagonals[d][l] == diagonals[d][l + 1]);
				}

				for(int r = l + 2; r < sz; ++r) {
					if(diagonals[d][l] == diagonals[d][r]) {
						good[d][l][r] = good[d][l + 1][r - 1];
					}
				}
			}
		}
	}

	int answ = 0;

	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			int ok = 1;

			for(int d = i + j; d <= i + n - 1 + j + n - 1; ++d) {
				int fst = max(0, d - 2 * n + 1);
				int l = max(i, d - j - n + 1) - fst;
				int r = min(i + n - 1, d - j) - fst;
				assert(l <= r);

				if(!good[d][l][r]) {
					DBG(d); DBG(l); DBG(r);
					ok = 0;
					break;
				}
			}

			answ += ok;
		}
	}

	cout << answ << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Compiler output:
/tmp/ccqwNoc6.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x668): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
const long long INF = 1LL << 60;
using namespace std;
int n;
map<string, ll> mp;

void shiftX(vector<string> &s)
{
    rep(i, n)
    {
        s[i] = "aaaa"//s[i].substr(1) + s[i][0];
        // cerr << s[i].size() << endl;
    }
}
void shiftY(vector<string> &s)
{
    string tmp = s[0];
    rep(j, n - 1)
    {

        s[j] = s[j + 1];
    }
    s.back() = tmp;
}

void add(vector<string> &s)
{
    string key = "";
    rep(i, n)
    {
        key += s[i];
    }
    //cerr << key << endl;
    mp[key]++;
}

int main(int argc, char const *argv[])
{
    cin >> n;
    vector<string> s(n, "");
    rep(i, n) cin >> s[i];
    rep(i, n)
    {
        rep(j, n)
        {
    
            shiftX(s);
        }
        shiftY(s);
        //add(s);
    }
    ll ans = 0;
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'void shiftX(std::vector<std::__cxx11::basic_string<char> >&)':
a.cc:27:22: error: expected ';' before '}' token
   27 |         s[i] = "aaaa"//s[i].substr(1) + s[i][0];
      |                      ^
      |                      ;
   28 |         // cerr << s[i].size() << endl;
   29 |     }
      |     ~
Language: C

#include <stdio.h>

int main() {
    int N;
    scanf("%d", &N);
    char S[305][305];
    for (int i = 0; i < N; ++i) {
        scanf("%s", S[i]);
    }

    int ans = 0;
    for (int a = 0; a < N; ++a) for (int b = 0; b < N; ++b) {
        bool ok = true;
        for (int i = 0; i < N; ++i) for (int j = 0; j <= i; ++j) {
            if (S[i][j] != S[(j + b - a + N) % N][(i + a - b + N) % N]) {
                ok = false;
                break;
            }
        }
        ans += ok;
    }
    printf("%d\n", ans);
}


Compiler output:
main.c: In function 'main':
main.c:13:9: error: unknown type name 'bool'
   13 |         bool ok = true;
      |         ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:13:19: error: 'true' undeclared (first use in this function)
   13 |         bool ok = true;
      |                   ^~~~
main.c:13:19: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:13:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:22: error: 'false' undeclared (first use in this function)
   16 |                 ok = false;
      |                      ^~~~~
main.c:16:22: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=2001,INF=1<<30;
 
int main(){
    
    int N;cin>>N;
    vector<vector<char>> S(N,vector<char>(N));

    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cin>>S[i][j];
        }
    }

    int cnt=0;

    for(int k=0;k<N;k++){
        bool flag=true;
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S[(l+k)&N][j]!=S[(j+k)%N][i]) flag=false;
            }
        }
        if(flag) cnt++;
    }

    cout<<cnt*N<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: 'l' was not declared in this scope
   24 |                 if(S[(l+k)&N][j]!=S[(j+k)%N][i]) flag=false;
      |                       ^
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

char S[575][575];
map<char, int> mp;
//解説AC
//https://atcoder.jp/contests/agc023/submissions/4531157
int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  REP(i,n) REP(j,n) {
    cin >> S[i][j];
  }

  REP(i,n){
    bool ok = true;
    REP(j, n-1) FOR(k, j+1, n) if(s[(i+j)%n][j] != s[(i+k)%n][j]) ok = false;
    t += ok;
  }
  cout << t*n << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:35: error: 's' was not declared in this scope
   62 |     REP(j, n-1) FOR(k, j+1, n) if(s[(i+j)%n][j] != s[(i+k)%n][j]) ok = false;
      |                                   ^
a.cc:63:5: error: 't' was not declared in this scope
   63 |     t += ok;
      |     ^
a.cc:65:11: error: 't' was not declared in this scope
   65 |   cout << t*n << endl;
      |           ^
Language: C++

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

#define LL long long

int Mod=1000000007;
int a=5;
int b=7;

int n,ret;
int hs[605][605][605],hs2[605][605][605],ths,nhs;
char mp[605][605];

void hash() {
	n<<=1;
	for(int i=1;i<=n;i++) 
		for(int j=1;j<=n;j++) 
			for(int k=j;k<=n;k++) {
				hs[i][j][k]=(LL)(hs[i][j][k-1]*a+mp[i][k]-'a')%Mod;
				hs2[i][j][k]=(LL)(hs2[i][j][k-1]*a+mp[k][i]-'a')%Mod;
			}
	n>>=1;
}

int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%s",mp[i]+1);
		for(int j=1;j<=n;j++) 
			mp[i+n][j]=mp[i][j+n]=mp[i+n][j+n]=mp[i][j];
	}
	hash();
	for(int ed=n,i=1;i<=n;i++,ed++) 
		for(int j=1;j<=n;j++) {
			ths=nhs=0;
			for(int k=i+n-1;k>=i;k--) 
				ths=(LL)(ths*b+hs[k][j][j+n-1])%Mod;
			for(int k=j+n-1;k>=j;k--)
				nhs=(LL)(nhs*b+hs2[k][i][i+n-1])%Mod;
			if(ths==nhs) ret++;
		}
	cout<<ret<<endl;
	return 0;
}
/*
abab
caca
abab
caca
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: reference to 'hash' is ambiguous
   32 |         hash();
      |         ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:14:6: note:                 'void hash()'
   14 | void hash() {
      |      ^~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N;
  cin>>N;
  char S1[N][N];
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      cin>>S1[i][j];
    }
  }
  char S2[N][N];
  int ans=0;
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      for (int k=0; k<N; k++) {
        S2[j][k]=S[(i+j)%N][k];
      }
    }
    bool ok=true;
    for (int j=0; j<N; j++) {
      for (int k=0; k<N; k++) {
        if (S2[j][k]!=S2[k][j]) {
          ok=false;
        }
      }
    }
    if (ok) {
      ans+=N;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:18: error: 'S' was not declared in this scope
   21 |         S2[j][k]=S[(i+j)%N][k];
      |                  ^
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;

int main()
{

	int N, x, ans =0;
	bool flag;
	cin >> N;
	vector<vector<char>> a(N, vector<char>(N));
	for (int i = 0; i < N; i++) {
		cin >> x;
		x = a[i][];
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {
				if (a[j+i][k] != a[k][j+i]) {
					flag = false;
				}
			}
		}
		if (flag == true) {
			ans += N;
		}
		flag = true;
	}

	cout << ans;

	char qq;
	cin >> qq;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: expected primary-expression before ']' token
   22 |                 x = a[i][];
      |                          ^
Language: C++

#include <iostream>
#include <vector>
#include <list>
#include <string>
struct Pair {
	int a, b;
};
int main() {
	int n;
	std::cin >> n;
	std::vector<std::string> strings(n);
	for (auto &s : strings) {
		std::cin >> s;
	}
	std::list<int> list;
	for (auto a = 0; a < n; ++a) {
list.push_back(a);
	}
	for (auto i = 0; i < n; ++i) {
		list.remove_if([i, n, &strings](const int a){ 
			for (auto j = 0; j < n; ++j) {
				if (strings[i][j] != strings[(j + n - p.a) % n][(i + p.a + n) % n]) return true;
			}
			return false;
		});
	}
	std::cout << list.size() * n << std::endl;
}

Compiler output:
a.cc: In lambda function:
a.cc:22:71: error: 'p' was not declared in this scope
   22 |                                 if (strings[i][j] != strings[(j + n - p.a) % n][(i + p.a + n) % n]) return true;
      |                                                                       ^
Language: C++

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

char rec[310][310];
int n, ans;

int sm(int x, int offset) {
	return (x + offset + n - 1) % n + 1;
}

int main() {
	scanf("%d\n", &n);
	for (int i = 1; i <= n; i++) {
		gets(rec[i]+1);
	}
	for (int a = 0; a < n; a++) {
		for (int b = 0; b < n; b++) {
			for (int i = 1; i <= n; i++) {
				for (int j = 1; j <= n; j++) {
					int nx = sm(i, a-b);
					int ny = sm(j, b-a);
					if (rec[i][j] != rec[ny][nx]) goto end;
				}
			}
			// printf("%d %d\n", a, b);
			ans++;
			end:;
		}
	}
	printf("%d", ans);
	return 0;
}

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

#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  string board[305];
  for (int i = 0; i < n; i++) {
    cin >> board[i];
  }

  int count = 0;
  for (int i = 0; i < n; i++) {
    int a = 0;
    int b = i;
    char new_grid[305][305];
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
	new_grid[(j + a) % n][(k + b) % n] = grid[j][k];
      }
    }

    bool ok = true;
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
	if (new_grid[j][k] != new_grid[k][j]) {
	  ok = false;
	  break;
	}
      }
      if (!ok) break;
    }
    if (ok) count++;
  }
  
  cout << count * n;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:46: error: 'grid' was not declared in this scope
   22 |         new_grid[(j + a) % n][(k + b) % n] = grid[j][k];
      |                                              ^~~~
Language: C

#include <stdio.h>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
using namespace std;

int N;
char S[600][600];

int main(void) {
  scanf("%d\n", &N);
  REP(i, 0, N) scanf("%s", S[i]);

  REP(i, 0, N) REP(j, 0, N) {
    S[i + N][j] = S[i][j];
    S[i][j + N] = S[i][j];
    S[i + N][j + N] = S[i][j];
  }

  int ans = 0;
  REP(A, 0, N) REP(B, 0, N) {
    int ok = 1;
    REP(i, 0, N) if(ok) REP(j, 0, N) if(ok) {
      ok = ok && S[A + i][B + j] == S[A + j][B + i];
    }
    ans += ok;
  }
  printf("%d\n", ans);

  // ll ans = 0;
  // REP(k, 0, N) {
  //   bool ok = true;
  //   REP(i, 0, N) REP(j, 0, N) {
  //     ll nj = (i - k + N) % N, ni = (j + k) % N;
  //     ok = ok && S[i][j] == S[ni][nj];
  //   }
  //   if(ok) ans += N;
  // }
  // cout << ans << endl;
}


Compiler output:
main.c:3:1: error: unknown type name 'using'
    3 | using namespace std;
      | ^~~~~
main.c:3:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    3 | using namespace std;
      |                 ^~~
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

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

    int n;
    cin >> n;

    vector<string> input(n);
    for(int i = 0; i < n; ++i){
        cin >> input[i];
    }

    if (n==1) { cout << 1 << endl; }

    vector<string> field(n*2);
    for(int i = 0; i < n; ++i){
        field[i] = input[i] + input[i];
    }
    for(int i = 0; i < n; ++i){
        field[n+i] = input[i] + input[i];
    }

    for (int i = 0; i < n; ++i) {
        int a = 0, b = i;

        bool isOK = true;
        for (int x = 0; x < n; ++x) {
            for (int y = 0; y < n; ++y) {
                int ax = a+x, ay = b+y;
                int bx = a+y, by = b+x;

                if (field[ax][ay] != field[bx][by]) {
                    isOK = false;
                }
            }
        }
        if (isOK) {
            ans += n - i;
        }
    }

    for (int i = 1; i < n; ++i) {
        int a = i, b = 0;

        bool isOK = true;
        for (int x = 0; x < n; ++x) {
            for (int y = 0; y < n; ++y) {
                int ax = a+x, ay = b+y;
                int bx = a+y, by = b+x;

                if (field[ax][ay] != field[bx][by]) {
                    isOK = false;
                }
            }
        }
        if (isOK) {
            ans += n - i;
        }
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   46 |             ans += n - i;
      |             ^~~
      |             abs
a.cc:65:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   65 |             ans += n - i;
      |             ^~~
      |             abs
a.cc:69:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   69 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <cstring>

using namespace std;
const int INF = (1<<30);
typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for (int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair

ll ans = 0;
char s[301][301];
int main() 
{
   int n;
   cin>>n;
   rep(i,n)rep(j,n) cin>>s[i][j];

   bool isOK=false;
   rep(A,n){
      isOK=true;
      rep(i,n) {
        for(int j=0;j<n;+++j){
          if(s[(i+A)%n][j]!=s[(j+B)%n][(i+A)%n]) isOK=false;
      }
      if(isOK) ans++;
}
   }
    ans=ans*n;

    cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:27: error: lvalue required as increment operand
   42 |         for(int j=0;j<n;+++j){
      |                           ^~
a.cc:43:34: error: 'B' was not declared in this scope
   43 |           if(s[(i+A)%n][j]!=s[(j+B)%n][(i+A)%n]) isOK=false;
      |                                  ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <cstring>

using namespace std;
const int INF = (1<<30);
typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for (int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair

ll ans = 0;
char s[301][301];
int main() 
{
   int n;
   cin>>n;
   rep(i,n) rep(j,n) cin>>s[i][j];

   bool isOK=false;
   rep(A,n){
      isOK=true;
      rep(i,n) for(int j=0;j<n;+++j){
          if(s[(i+A)%n][j]!=s[j][(i+A)%n]) isOK=false;
      }
      if(isOK) ans++;
   }
    ans=ans*n;

    cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:34: error: lvalue required as increment operand
   41 |       rep(i,n) for(int j=0;j<n;+++j){
      |                                  ^~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <cstring>

using namespace std;
const int INF = (1<<30);
typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for (int i = 0; i < a; i++)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define mp make_pair

ll ans = 0;
char s[301][301];
int main() 
{
   int n;
   cin>>n;
   rep(i,n)rep(j,n) cin>>s[i][j];

   bool isOK=false;
   rep(A,n){
      isOK=true;
      rep(i,n) for(int j=0;j<n;+++j){
          if(s[(i+A)%n][j]!=s[(j+B)%n][(i+A)%n]) isOK=false;
      }
      if(isOK) ans++;
   }
    ans=ans*n;

    cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:34: error: lvalue required as increment operand
   41 |       rep(i,n) for(int j=0;j<n;+++j){
      |                                  ^~
a.cc:42:34: error: 'B' was not declared in this scope
   42 |           if(s[(i+A)%n][j]!=s[(j+B)%n][(i+A)%n]) isOK=false;
      |                                  ^
Language: C

#include <stdio.h>
#include <iostream>
#include <stdbool.h>

using namespace std;

int main()
{
    char table[300][300] = {'\0'};
    char dust[10];
    int table_size = 0;
    int count = 0;
    bool flag = true;
    cin >> table_size;

    for (int i = 0; i < table_size; i++)
    {
        for (int j = 0; j < table_size; j++)
        {
            cin >> table[i][j];
        }
    }

    for (int k = 0; k < table_size; k++)
    {
        for (int l = 0; l < table_size; l++)
        {
            for (int i = 0; (i < table_size) && (flag); i++)
            {
                for (int j = 0; (j < table_size) && (flag); j++)
                {
                    if ((i != j) && (table[(i+k)%table_size][(j+l)%table_size] != table[(j+k)%table_size][(i+l)%table_size])){
                        flag = false;
                    }
                }    
            }
            if(flag==true)
                count++;
            else
                flag=true;

        }
    }
    printf("%d", count);
    return 0;
}

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>

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int n;cin>>n;
  string str[n];
  int used[256][256]={};
  int ans1=0,ans2=0,ans3=0;
  vector<pair<char,char> >vcc;
  for(int i=0;i<n;i++)cin>>str[i];
  for(int a=0;a<n;a++){
    bool flag2=true;
    for(int i=a;i<a+n;i++){
      for(int j=1+(i-a);j<n;j++){
	if(str[i%n][j%n]!=str[j%n][i%n]){
	  flag2=false;
	}
      }
      if(flag2==false)break;
    }
    if(flag2)ans++;
  }
  for(int a=0;a<n;a++){
    bool flag2=true;
    for(int i=a;i<a+n;i++){
      for(int j=1+i;j<n;j++){
	if(str[i%n][j%n]!=str[j%n][i%n]){
	  flag2=false;
	}
      }
      if(flag2==false)break;
    }
    if(flag2)ans2++;
  }
  for(int a=0;a<n;a++){
    bool flag2=true;
    for(int i=0;i<n;i++){
      for(int j=1+i;j<a+n;j++){
	if(str[i%n][j%n]!=str[j%n][i%n]){
	  flag2=false;
	}
      }
      if(flag2==false)break;
    }
    if(flag2)ans3++;
  }
  int anss=max(ans,ans2);
  anss=max(ans,ans3);
  cout<<anss*n<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: 'ans' was not declared in this scope; did you mean 'ans3'?
   29 |     if(flag2)ans++;
      |              ^~~
      |              ans3
a.cc:55:16: error: 'ans' was not declared in this scope; did you mean 'anss'?
   55 |   int anss=max(ans,ans2);
      |                ^~~
      |                anss
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;
char s[906][906];
int dp[603][603][303];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s[i]+1;
		for(int j=1;j<=n;j++){
			s[i+n][j]=s[i][j];
			s[i][j+n]=s[i][j];
			s[i+n][j+n]=s[i][j];
		}
	}
	for(int i=1;i<=n*2;i++){
		for(int j=1;j<=n*2;j++){
			for(int z=0;z<n;z++){
				if(j+z>=2*n || i+z>=2*n)break;
				if(s[i][j+z]==s[i+z][j]){
					dp[i][j][z]=1;
				//	cout<<i<<" "<<j<<" "<<z<<endl;
				}else{
					break;
				}
			}
			
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			int flag=1;
			for(int z=n-1;z>=0;z--){
				int k=n-z-1;
				//cout<<k<<endl;
			//	cout<<i+k<<" "<<j+k<<" "<<z<<" -- "<<dp[i+k][j+k][z]<<endl;
				if(dp[i+k][j+k][z]==0){
					flag=0;break;
				}
			}
			if(flag)ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}
韦富成  21:57:56
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;
char s[906][906];
bool dp[603][603][303];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s[i]+1;
		for(int j=1;j<=n;j++){
			s[i+n][j]=s[i][j];
			s[i][j+n]=s[i][j];
			s[i+n][j+n]=s[i][j];
		}
	}
	for(int i=1;i<=n*2;i++){
		for(int j=1;j<=n*2;j++){
			for(int z=0;z<n;z++){
				if(j+z>=2*n || i+z>=2*n)break;
				if(s[i][j+z]==s[i+z][j]){
					dp[i][j][z]=1;
				//	cout<<i<<" "<<j<<" "<<z<<endl;
				}else{
					break;
				}
			}
			
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			int flag=1;
			for(int z=n-1;z>=0;z--){
				int k=n-z-1;
				//cout<<k<<endl;
			//	cout<<i+k<<" "<<j+k<<" "<<z<<" -- "<<dp[i+k][j+k][z]<<endl;
				if(dp[i+k][j+k][z]==0){
					flag=0;break;
				}
			}
			if(flag)ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc:51:1: error: '\U000097e6\U00005bcc\U00006210' does not name a type
   51 | 韦富成  21:57:56
      | ^~~~~~
a.cc:56:6: error: redefinition of 'char s [906][906]'
   56 | char s[906][906];
      |      ^
a.cc:5:6: note: 'char s [906][906]' previously declared here
    5 | char s[906][906];
      |      ^
a.cc:57:6: error: conflicting declaration 'bool dp [603][603][303]'
   57 | bool dp[603][603][303];
      |      ^~
a.cc:6:5: note: previous declaration as 'int dp [603][603][303]'
    6 | int dp[603][603][303];
      |     ^~
a.cc:58:5: error: redefinition of 'int main()'
   58 | int main()
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main()
      |     ^~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;


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

	vector<vector<char>> S;

	S = vector<vector<char>>(N, vector<char>(N, 0));

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> S[i][j];
		}
	}

	int count = 0;

	for (int A = 0; A < N; A++) {
		for (int B = 0; B < N; B++) {

			int flag = 0;

			for (int i = 0; i < N && flag==0; i++) {
				for (int j = 0; j < N-i; j++) {
					int i2, j2,i3,j3;

					if (i - A >= 0) {
						i2 = i - A ;
					}
					else {
						i2 = i - A + N;
					}
					if (j - B >= 0) {
						j2 = j - B ;
					}
					else {
						j2 = j - B + N;
					}

					if (j - A >= 0) {
						i3 = j - A;
					}
					else {
						i3 = j - A + N;
					}
					if (i - B >= 0) {
						j3 = i - B;
					}
					else {
						j3 = i - B + N;
					}

					if (S[i2][j2] != S[j3][i3]) {
						flag = -1;
						break;
					}
				}
			}

			if (flag == 0) {
				count++;
			}
		}
	}

	cout << count << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'vector' was not declared in this scope
   12 |         vector<vector<char>> S;
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:12:23: error: expected primary-expression before 'char'
   12 |         vector<vector<char>> S;
      |                       ^~~~
a.cc:14:9: error: 'S' was not declared in this scope
   14 |         S = vector<vector<char>>(N, vector<char>(N, 0));
      |         ^
a.cc:14:27: error: expected primary-expression before 'char'
   14 |         S = vector<vector<char>>(N, vector<char>(N, 0));
      |                           ^~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;

const int INF = 1001001001;
const ll INFLL = 1001001001001001001LL;


template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }


int main() {


	/*
	ll N;

	scanf("%lld", &N);

	vector<ll> A;
	
	for (int i = 0; i < N; i++) {
		ll tmp;
		scanf("%lld", &tmp);
		A.push_back(tmp);
	}

	ll ans = 0;

	
	int *lookup;
	lookup = new int[N];
	for (int i = 0; i < N; ++i) {
		lookup[i] = 0;
	}

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j <= i; ++j) {
			lookup[j] += A[i];
			if (lookup[j] == 0) {
				++ans;
			}
		}
	}


	printf("%lld",ans);

	delete(lookup);


	*/

	int N;
	scanf("%d", &N);

	char Mat[301][301];

	for (int i = 0; i < N; i++) {

			scanf_s("%s", Mat[i], N+1);

	}

	int ans = 0;
	for (int a = 0; a < N; a++) {
		for (int b = 0; b < N; b++) {
			bool bAns = true;
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < N; ++j) {
					if (Mat[(a + i) % N][(b + j) % N] != Mat[(a + j) % N][(b + i) % N]) {
						bAns = false;
						goto bAns;
					}
				}
			}
			bAns:
			if (bAns) {
				++ans;
			}
		}
	}


	printf("%d", ans);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   85 |                         scanf_s("%s", Mat[i], N+1);
      |                         ^~~~~~~
      |                         scanf
Language: C++

#include <iostream>
#include <vector>
#include <unordered_map>
int mod(int x, int n) {
    return ((x % n) + n) % n;
}
int main() {
	int n;
    std::cin >> n;
    std::vector<std::vector<char>> v(n,std::vector<char>(n, 'a'));
    std::unordered_map<char, std::vector<std::pair<int, int> > > m;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            std::cin>> v[i][j];
            if (m.find(v[i][j]) == m.end()) {
                std::vector<std::pair<int, int> > q;
                q.push_back(std::pair<int, int> (i, j));
                m.insert(std::pair<  char, std::vector<std::pair<int, int> > > (v[i][j], q));
            } else {
                m[v[i][j] ].push_back(std::pair<int, int> (i, j));
            }
        }
    }
    std::vecot<char> hui;
    for (auto it = m.begin(); it != m.end(); ++it) {
        if (it->second.size() % 2 == 1) {
            hui.push_back(it->first);
        }
    }
    int res = 0;
    for(int a = 0; a < n; ++a) {
        for(int b = 0; b < n; ++b) {
            int fl = 0;
            for (int i = 0; i < hui.size(); ++i) {
                fl = 1;
                for(auto p : m[hui[i]]) {
                    if (mod(p.first - a,n) == mod(p.second - b,n)) {
                        fl = 0;
                        break;
                    }
                }
                if (fl == 1) {
                    break;
                }
            }
            for(int i = 0; i < n; ++i) {
                for(int j = 0; j < n; ++j) {
                    if (v[mod(i - a,n)][mod(j - b,n)] != v[mod(j - a,n)][mod(i - b,n)]) {
                        fl = 1;
                        //std::cout << a << b <<'\n';
                        //std::cout << v[mod(i - a,n)][mod(j - b,n)] << v[mod(i - a,n)][mod(i - a,n)];
                        break;
                    }
                }
                if (fl) break;
            }
            if (fl == 0) res += 1;

        }
    }
    std::cout << res << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:10: error: 'vecot' is not a member of 'std'; did you mean 'vector'?
   24 |     std::vecot<char> hui;
      |          ^~~~~
      |          vector
a.cc:24:16: error: expected primary-expression before 'char'
   24 |     std::vecot<char> hui;
      |                ^~~~
a.cc:27:13: error: 'hui' was not declared in this scope
   27 |             hui.push_back(it->first);
      |             ^~~
a.cc:34:33: error: 'hui' was not declared in this scope
   34 |             for (int i = 0; i < hui.size(); ++i) {
      |                                 ^~~
Language: C++

import sys
from collections import deque
import copy

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    field = []
    for i in range(N):
        input_raw = read_func().strip()
        field.append(input_raw)

    judge_ij = []
    judge_arr = [[0 for i in range(N)] for j in range(N)]

    for i in range(N):
        if i == 0:
            judge_ij.append((i + 1, N - 1))
        else:
            judge_ij.append((0, i))
        for j in range(N):
            judge_arr[i][j] = field[(i - j) % N][j]

    good_list = []
    for i in range(N):
        is_good = True
        for k in range(N):
            if judge_arr[k][judge_ij[(i + k) % N][0]] != judge_arr[k][judge_ij[(i + k) % N][1]]:
                is_good = False
                break;
        if is_good == True:
            good_list.append(i)

    print len(good_list) * N

if __name__ == '__main__':
    main()


Compiler output:
a.cc:48:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   48 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:18:5: error: 'input_raw' does not name a type
   18 |     input_raw = read_func().strip().split()
      |     ^~~~~~~~~
a.cc:43:9: error: expected unqualified-id before 'if'
   43 |         if is_good == True:
      |         ^~
Language: C++

#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
using namespace std;
typedef long long LL;
const int maxn = 7e2+10;

int n;
char str[maxn][maxn];

bool judge(int x,int y)
{
    int num = 5e7 / n / n;
    for(int k=0; k<num; k++)
    {
        int i = rand() % n;
        int j = rand() % n;
        if(str[x+i][y+j]!=str[x+j][y+i])
            return false;
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            if(str[i+x][j+y]!=str[x+j][y+i])
                return false;
        }
    }
    return true;
}

void solve()
{
    int ans = 0 ;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            if(judge(i,j))
                ++ans;
        }
    }
    printf("%d\n",ans);
}

int main()
{
#ifdef LOCAL_IM0QIANQIAN
    freopen("test.in","r",stdin);
#else
//    IO;
#endif // LOCAL_IM0QIANQIAN
    srand(time(NULL));
    scanf("%d%*c",&n);
    for(int i=0; i<n; i++)
        gets(str[i]);
    for(int i=0; i<n+n; i++)
    {
        for(int j=0; j<n+n; j++)
        {
            if(i<n&&j<n)
                continue;
            str[i][j] = str[i%n][j%n];
        }
    }
    solve();
    return 0;
}


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

#include<bits/stdc++.h>
#define pi 3.141592653897932384626
//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
using namespace std;
char a[305][305];
int main()
{
    long n;
    cin>>n;
    gets(a[0]);
    for(long i=0;i<n;i++)gets(a[i]);
    long s=0;
    for(long x=0;x<n;++x){
        long flag=1;
        for(long i=0;i<n;++i){
            for(long j=0;j<n;++j){
                if(a[(x+i)%n][j]!=a[j][(i+x)%n])
                    flag=0;
            }
        }
        s+=flag;
    }
    printf("%ld\n",s*n);
    return 0;
}


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

#include<bits/stdc++.h>
#define pi 3.141592653897932384626
//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
using namespace std;
char a[305][305];
int main()
{
    long n;
    cin>>n;gets(a[0]);
    for(long i=0;i<n;i++)gets(a[i]);
    long s=0;
    for(long x=0;x<n;++x){
        long flag=1;
        for(long i=0;i<n;++i){
            for(long j=0;j<n;++j){
                if(a[(x+i)%n][j]!=a[j][(i+x)%n])
                    flag=0;
            }
        }
        s+=flag;
    }
    printf("%ld\n",s*n);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |     cin>>n;gets(a[0]);
      |            ^~~~
      |            getw
Language: C++

#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,n) rep2(i,0,n-1)
int MOD=1000000000+7;

using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");
int mem[1000001][1000001]={};
ll int dp[1000001][1000001]={};

int dp(int a,int b){
    if(mem[a][b]==1) return dp[a][b];
    if(a==2&&b==1) return 1;
    if(a>b*2) return 0;
    if(a<b+2) return 0;
    mem[a][b]=1;
    return dp[a][b]=dp[a-1][b-1]+dp[a-2][b-1];
}
main(){
    int n;
    cin>>n;
    ll int ans=0;
    ll int per[1000001]={};
per[0]=1;
ll int temp=1;
rep2(i,1,1000000){
    per[i]=temp;
    temp*=(i+1);
    temp%=MOD;
}
    rep2(i,n%2+1,n-1)
    {
        ans+=dp[n][i]*per(n-i);
        ans%=MOD;
    }
    cout<<ans;
    return 0;
}


Compiler output:
a.cc:12:19: error: 'int dp(int, int)' redeclared as different kind of entity
   12 | int dp(int a,int b){
      |                   ^
a.cc:10:8: note: previous declaration 'long long int dp [1000001][1000001]'
   10 | ll int dp[1000001][1000001]={};
      |        ^~
a.cc:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   20 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:34:26: error: 'per' cannot be used as a function
   34 |         ans+=dp[n][i]*per(n-i);
      |                       ~~~^~~~~
Language: C++

#include<bits/stdc++.h>
#define LL long long 
using namespace std;
const int MAXN = 1e6 + 10, INF = 1e9 + 7, mod = 1000000007;
template<typename A, typename B> inline void chmax(A &x, B y) {
	x = x > y ? x : y;
}
template<typename A, typename B> inline void chmin(A &x, B y) {
	x = x < y ? x : y;
}
template<typename A, typename B> inline int mul(A x, B y) {
	return 1ll * x * y % mod;
}
template<typename A, typename B> inline void add2(A &x, B y) {
	if(x + y < 0) x = x + y + mod;
	else x = (x + y >= mod ? x + y - mod : x + y);
}
template<typename A, typename B> inline int add(A x, B y) {
	if(x + y < 0) return x + y + mod;
	else return x + y >= mod ? x + y - mod : x + y;
}
template<typename A, typename B> fp(A a, B p) {
	int base = 1;
	while(p) {
		if(p & 1) base = mul(base, a);
		a = mul(a, a); p >>= 1;
	}
	return base;
}
inline int read() {
	char c = getchar(); int x = 0, f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}
int N, fac[MAXN], ifac[MAXN], f[MAXN];
int C(int N, int M) {
	if(M > N) return 0;
	return mul(fac[N], mul(ifac[M], ifac[N - M]));
}
int main() {
	N = read(); fac[0] = 1;
	for(int i = 1; i <= N; i++) fac[i] = mul(i, fac[i - 1]);
	ifac[N] = fp(fac[N], mod - 2);
	for(int i = N; i >= 1; i--) ifac[i - 1] = mul(ifac[i], i);
	int down = N / 2 + (N & 1);
	for(int i = down; i < N; i++) 
		f[i] = mul(mul(C(i - 1, N - i - 1), fac[i]), fac[N - i - 1]);
	int ans = 0;
	for(int i = down; i < N; i++) add2(ans, mul(i, add(f[i], -f[i - 1])));
	cout << ans;
	return 0;
}
/*
3
0 1 1
5 7 3
*/

Compiler output:
a.cc:22:34: error: ISO C++ forbids declaration of 'fp' with no type [-fpermissive]
   22 | template<typename A, typename B> fp(A a, B p) {
      |                                  ^~
Language: C++

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

const int M=1E9+7;

unsigned int doit(int i,int j){
	if (i==j) return 0;
	if (j-i==1) return 1;
	int mid=(i+j)/2;
	unsigned int ret=(doit(i,mid)+doit(mid+1,j))%M;
	long long p = (1LL * (mid-i+1) * (j-mid))%M;
	ret = (ret + p)%M;
	return ret;
}

int main(){
	int n,cin>>n;
	unsigned int s=doit(0,n-1);
	cout << s+1;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: expected initializer before '>>' token
   17 |         int n,cin>>n;
      |                  ^~
Language: C++

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

const int M=1E9+7;

unsigned int doit(int i,int j){
	if (i==j) return 0;
	if (j-i==1) return 1;
	int mid=(i+j)/2;
	unsigned int ret=(doit(i,mid)+doit(mid+1,j))%M;
	long long p=(1LL * (mid-i+1) * (j-mid))%M
	ret = (ret + p)%M;
	return ret;
}

int main(){
	int n,cin>>n;
	unsigned int s=doit(0,n-1);
	cout << s+1;
}

Compiler output:
a.cc: In function 'unsigned int doit(int, int)':
a.cc:12:9: error: expected ',' or ';' before 'ret'
   12 |         ret = (ret + p)%M;
      |         ^~~
a.cc: In function 'int main()':
a.cc:17:18: error: expected initializer before '>>' token
   17 |         int n,cin>>n;
      |                  ^~