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

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int N,C,X;
int D[30][39];
int t[3][30];
int main() {
    scanf("%d%d",&N,&C);
    rep(i,C) rep(j,C) scanf("%d",&D[i][j]);
    rep(i,N) rep(j,N) scanf("%d",&X), t[(i+j)%3][X-1]++;
    int res =1 < <30;
    rep(i,C)rep(j,C)if(i!=j)rep(k,C)if(i!=k&&j!=k) {
        int tt =0;
        rep(l,C)tt += D[l][i]*t[0][l];
        rep(l,C)tt += D[l][j]*t[1][l];
        rep(l,C)tt += D[l][k]*t[2][l];
        if(tt<res) res=tt;
    }
    printf("%d\n",res);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: expected primary-expression before '<' token
   13 |     int res =1 < <30;
      |                  ^
Language: C++

N,C=map(int,input().split())
D=[list(map(int,input().split())) for i in range(C)]
c=[list(map(int,input().split())) for i in range(N)]
count=[[0]*C for i in range(3)]
for i in range(1,N+1):
  for j in range(1,N+1):
    count[(i+j)%3][c[i-1][j-1]-1]+=1
ans=1001
for i in range(C):
  for j in range(C):
    if i==j:
      continue
    for k in range(C):
      if i==k or j==k:
        continue
      tmp=0
      for x in range(C):
        tmp+=D[x][i]*count[0][x]+D[x][j]*count[1][x]+D[x][k]*count[2][x]
      if ans>tmp:
        ans=tmp
print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N,C=map(int,input().split())
      | ^
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll mod = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

int main(){
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N,C;
    cin >> N >> C;
    vector < vector<int> > d(C,vector<int>(C, 0));
    vector < vector<int> > t(3,vector<int>(C, 0));

    REP(i,C)
    {
        REP(j,c)
        {
            cin >> d[i][j];
        }
    }
    REP(i,N)
    {
        REP(j,N)
        {
            int c;
            cin >> c;
            --c;
            ++t[(i+j) % 3][c];
        }
    }

    ll res = INF;
    for(int i = 0; i < C; ++i)
    {
        for(int j = 0; j < C; ++j)
        {
            if(i == j)continue;
            if(int k = 0; k < C; ++k)
            {
                if(i == k || j == k)continue;
                ll tmp = 0;
                for(int l = 0; l < C; ++l)
                {
                    tmp += D[l][i] * t[0][l];
                }
                for(int l = 0; l < C; ++l)
                {
                    tmp += D[l][j] * t[1][l];
                }
                for(int l = 0; l < C; ++l)
                {
                    tmp += D[l][k] * t[2][l];
                }

                res = min(res, tmp);
            }
        }
    }

    cout << res << endl;



    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: 'c' was not declared in this scope
   33 |         REP(j,c)
      |               ^
a.cc:11:46: note: in definition of macro 'REP'
   11 | #define REP(i, n) for (long long i = 0; i < (n); i++)
      |                                              ^
a.cc:55:32: error: expected ')' before ';' token
   55 |             if(int k = 0; k < C; ++k)
      |               ~                ^
      |                                )
a.cc:55:36: error: 'k' was not declared in this scope
   55 |             if(int k = 0; k < C; ++k)
      |                                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,c;
  cin >> n >> c;
 int d[35][35],t[3][35];
  
  for(int i=0;i<c;i++){
    for(int j=0;j<c;j++){
      cin >> d[i][j];
    }
  }
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      int s;
      cin >> s;
      t[(i+j)%3][s-1]++;
    }
  }
  
 long long int ans=1e18;
  
  for(int i=0;i<c;i++){
    for(int j=0;j<c;j++){
      
      if(i!=j){
        for(int k=0;k<c;k++){
          if(i!=k&&j!=k){
            int tem=0;
            
      for(int l=0;l<c;l++) tem+=d[l][i]*t[0][l]; 
      for(int l=0;l<c;l++) tem+=d[l][j]*t[1][l];
      for(int l=0;l<c;l++) tem+=d[l][k]*t[2][l];
            
            ans=min(ans,tem);
          }
        }
      }
    }
  }
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:20: error: no matching function for call to 'min(long long int&, int&)'
   36 |             ans=min(ans,tem);
      |                 ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:36:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   36 |             ans=min(ans,tem);
      |                 ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:36:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   36 |             ans=min(ans,tem);
      |                 ~~~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    int n,c; cin >> n >> c;
    int d[35][35];
    int oc[505][505]
    int cost[3][35];
    rep(i,n){
        rep(j,n){
            cin >> oc[i][j];
            oc[i][j]--;
        }
    }
    rep(i,c){
        rep(j,c){
            cin >> d[i][j];
        }
    }
    rep(i,c){
        rep(j,n){
            rep(k,n){
                cost[(j+k)%3][c] += d[oc[i][j]][c];
            }
        }
    }

    int ans = 1<<30;
    int col[3];
    rep(col[0],c){
        rep(col[1],c){
            if(c[0] == c[1]) continue;
            rep(col[2],c){
                if(col[1] == col[2] || col[0] == col[2]) continue;
                int tmp = 0;
                rep(i,3) tmp += cost[i][col[i]];
                ans = min(ans, tmp);
            }
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: expected initializer before 'int'
   12 |     int cost[3][35];
      |     ^~~
a.cc:15:20: error: 'oc' was not declared in this scope; did you mean 'c'?
   15 |             cin >> oc[i][j];
      |                    ^~
      |                    c
a.cc:27:17: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   27 |                 cost[(j+k)%3][c] += d[oc[i][j]][c];
      |                 ^~~~
      |                 cosl
a.cc:27:39: error: 'oc' was not declared in this scope; did you mean 'c'?
   27 |                 cost[(j+k)%3][c] += d[oc[i][j]][c];
      |                                       ^~
      |                                       c
a.cc:3:28: error: array must be initialized with a brace-enclosed initializer
    3 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                            ^
a.cc:34:5: note: in expansion of macro 'rep'
   34 |     rep(col[0],c){
      |     ^~~
a.cc:3:28: error: array must be initialized with a brace-enclosed initializer
    3 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                            ^
a.cc:35:9: note: in expansion of macro 'rep'
   35 |         rep(col[1],c){
      |         ^~~
a.cc:36:17: error: invalid types 'int[int]' for array subscript
   36 |             if(c[0] == c[1]) continue;
      |                 ^
a.cc:36:25: error: invalid types 'int[int]' for array subscript
   36 |             if(c[0] == c[1]) continue;
      |                         ^
a.cc:3:28: error: array must be initialized with a brace-enclosed initializer
    3 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                            ^
a.cc:37:13: note: in expansion of macro 'rep'
   37 |             rep(col[2],c){
      |             ^~~
a.cc:40:33: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   40 |                 rep(i,3) tmp += cost[i][col[i]];
      |                                 ^~~~
      |                                 cosl
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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 (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

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


int N, C, D[30][30], c[505][505];
int pre[3][30];
//---------------------------------------------------------------------------------------------------
void _main() {
  	cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> C;
    rep(y, C) rep(x, C) cin >> D[y][x];
    rep(y, N) rep(x, N) cin >> c[y][x], c[y][x]--;
 
    rep(col, C) rep(y, N) rep(x, N) pre[(y + x) % 3][col] += D[c[y][x]][col];
 
    int ans = INTINF;
    rep(c0, C) rep(c1, C) rep(c2, C) {
        if (c0 == c1) continue;
        if (c0 == c2) continue;
        if (c1 == c2) continue;
 
        chmin(ans, pre[0][c0] + pre[1][c1] + pre[2][c2]);
    }
    cout << ans << endl;
}


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>

using namespace std;

const int D = 1e3;

int main() {
    int n, c;
    cin >> n >> c;
    int d[c][c];
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < c; j++) {
            cin >> d[i][j];
        }
    }

    int cnt[3][c];
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int a;
            cin >> a;
            cnt[(i+j)%3][a-1]++;
        }
    }

    int ans = D * n * n;
    for (int x = 0; x < c; x++) {
        for (int y = 0; y < c; y++) {
            for (int z = 0; z < c; z++) {
                if (x != y && y != z && z != x) {
                    int cur = 0;
                    for (int t = 0; t < c; t++) {
                        cur += cnt[0][t] * d[t][x];
                        cur += cnt[1][t] * d[t][y];
                        cur += cnt[2][t] * d[t][z];
                    }
                    ans = cur < ans ? cur : ans;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

#include <iostream>
#include <iomanip>
#include <limits>

using namespace std;

struct Info
{
    int color;
    int cost;
};

int D[30][30];
int c[500][500];

int main()
{
    int N, C;

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

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

    Info cand[3][4];
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 4; j++)
        {
            cand[i][j] = {0, numeric_limits<int>::max()};
        }

    for (int col = 0; col < C; col++)
    {
        Info tmp[3];
        for (int i = 0; i < 3; i++)
        {
            tmp[i].color = col;
            tmp[i].cost = 0;
        }

        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++)
            {
                int fromCol = c[i][j];
                tmp[(i + j + 2) % 3].cost += D[fromCol][col];
            }

        for (int i = 0; i < 3; i++)
        {
            cand[i][3] = tmp[i];
            sort(cand[i], cand[i] + 4, [](const auto &lh, const auto &rh) {
                return lh.cost < rh.cost;
            });
        }
    }

    int smin = numeric_limits<int>::max();
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            for (int k = 0; k < 3; k++)
            {
                Info c0 = cand[0][i];
                Info c1 = cand[1][j];
                Info c2 = cand[2][k];
                if (c0.color != c1.color && c1.color != c2.color && c2.color != c0.color)
                {
                    int s = c0.cost + c1.cost + c2.cost;
                    smin = min(smin, s);
                }
            }

    cout << smin << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:13: error: 'sort' was not declared in this scope; did you mean 'short'?
   60 |             sort(cand[i], cand[i] + 4, [](const auto &lh, const auto &rh) {
      |             ^~~~
      |             short
Language: C

#include<bits/stdc++.h>
using namespace std;
int n,c,d[35][35],p[505][505],cnt[3][30];
int main()
{
	cin>>n>>c;
	for(int i=1;i<=c;i++)for(int j=1;j<=c;j++)cin>>d[i][j];
	for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)
	{
		int a;
		cin>>a;
		cnt[(i+j)%3][a]++;
	}
	long long ans=2e9;
	for(int i=1;i<=c;i++)for(int j=1;j<=c;j++)for(int k=1;k<=c;k++)
	{
		if(i==j||j==k||i==k)continue;
		long long tot=0;
		for(int l=1;l<=c;l++)tot+=cnt[0][l]*d[l][i]+cnt[1][l]*d[l][j]+cnt[2][l]*d[l][k];
		ans=min(ans,tot);
	}
	cout<<ans<<endl;
	return 0;
}

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

#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<utility>
#include<algorithm>
#include<functional>
#include<ctime>
#include<cmath>
#include<cstdlib>
#include<cstdio>
using namespace std;
long long sc[3][40];
int c[40][40];
int g[550][550];
int main()
{
	int N,M;
	cin>>N>>M;
	for(int i=0;i<M;i++)
		for(int j=0;j<M;j++)
			cin>>c[i][j];
	for(int i=0;i<N;i++)
		for(int j=0;j<N;j++)
		{
			cin>>g[i][j];
			for(int k=0;k<M;k++)
				sc[(i+j)%3][k]+=c[g[i][j]-1][k];
		}
	long long ans=LLONG_MAX;
	for(int i=0;i<M;i++)
		for(int j=0;j<M;j++)
			for(int k=0;k<M;k++)
				if(i!=j&&j!=k&&k!=i)
				{
					long long sum=sc[0][i]+sc[1][j]+sc[2][k];
					ans=min(ans,sum);
				}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:23: error: 'LLONG_MAX' was not declared in this scope
   37 |         long long ans=LLONG_MAX;
      |                       ^~~~~~~~~
a.cc:19:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   18 | #include<cstdio>
  +++ |+#include <climits>
   19 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;
//定義場所//
int i, j, k, l, m, n;
int N, C;
int D[500][500];
int c[500][500];
////////////

int main()
{
	cin >> N >> C;
	for (i = 0; i < C; i++) {
		for (j = 0; j < C; j++) {
			cin >> D[i][j];
		}
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			cin >> c[i][j];
		}
	}
	vector<int> zero(C, 0);
	vector<int> one(C, 0);
	vector<int> two(C, 0);
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			for (k = 0; k < C; k++) {
				if ((i + j + 2) % 3 == 0) {
					zero[k] += D[c[i][j]-1][k];
				}
				else if ((i + j + 2) % 3 == 1) {
					one[k] += D[c[i][j]-1][k];
				}
				else {
					two[k] += D[c[i][j]-1][k];
				}
			}
		}
	}
	int ans = 10000000;
	for (i = 0; i < C; i++) {
		for (j = 0; j < C; j++) {
			for (k = 0; k < C; k++) {
				if (i == j || j == k || k == i) {
					
				}
				else {
					ans = min(ans, zero[i] + one[j] + two[k]);
				}
			}
		}
	}
	cout << ans;

Compiler output:
a.cc: In function 'int main()':
a.cc:59:21: error: expected '}' at end of input
   59 |         cout << ans;
      |                     ^
a.cc:16:1: note: to match this '{'
   16 | {
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;
//定義場所//
int i, j, k, l, m, n;
int N, C;
int D[500][500];
int c[500][500];
////////////

int main()
{
	cin >> N >> C;
	for (i = 0; i < C; i++) {
		for (j = 0; j < C; j++) {
			cin >> D[i][j];
		}
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			cin >> c[i][j];
		}
	}
	vector<int> zero(C, 0);
	vector<int> one(C, 0);
	vector<int> two(C, 0);
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			for (k = 0; k < C; k++) {
				if ((i + j + 2) % 3 == 0) {
					zero[k] += D[c[i][j]-1][k];
				}
				else if ((i + j + 2) % 3 == 1) {
					one[k] += D[c[i][j]-1][k];
				}
				else {
					two[k] += D[c[i][j]-1][k];
				}
			}
		}
	}
	int ans = 10000000;
	for (i = 0; i < C; i++) {
		for (j = 0; j < C; j++) {
			for (k = 0; k < C; k++) {
				if (i == j || j == k || k == i) {
					//continue;
				}
				else {
					ans = min(ans, zero[i] + one[j] + two[k]);
				}
			}
		}
	}
	cout << ans;

Compiler output:
a.cc: In function 'int main()':
a.cc:59:21: error: expected '}' at end of input
   59 |         cout << ans;
      |                     ^
a.cc:16:1: note: to match this '{'
   16 | {
      | ^
Language: C++

import itertools as it

n,m = map(int,input().split())

d = []
for i in range(m):
    l = list(map(int,input().split()))
    d.append(l)

cs = [[] for i in range(3)]
for i in range(1,n+1):
    row = list(map(int,input().split()))
    for j, c in enumerate(row):
        cs[(i + (j+1)) % 3].append(c)

#print(cs)
ds = [[] for i in range(3)]
for i in range(1,m+1):
    for j in range(3):
        t = 0
        for e in cs[j]:
            t += d[e-1][i-1]
        ds[j].append((t,i))

#print(ds)

ans = -1
cands = list(it.product(ds[0][:3],ds[1][:3], ds[2][:3]))
for cand in cands:
#    print(cand)
    if cand[0][1] == cand[1][1] \
            or cand[1][1] == cand[2][1] \
            or cand[2][1] == cand[0][1]:
        continue
    calc = cand[0][0] + cand[1][0] + cand[2][0]
#    print(calc)
    if ans == -1:
        ans = calc
    else:
        ans = min(ans, calc)

print(ans)


Compiler output:
a.cc:16:2: error: invalid preprocessing directive #print
   16 | #print(cs)
      |  ^~~~~
a.cc:25:2: error: invalid preprocessing directive #print
   25 | #print(ds)
      |  ^~~~~
a.cc:30:6: error: invalid preprocessing directive #print
   30 | #    print(cand)
      |      ^~~~~
a.cc:36:6: error: invalid preprocessing directive #print
   36 | #    print(calc)
      |      ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import itertools as it
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

int main(){
  int N,C;
  long long int iwakan=0;
  cin>>N>>C;
  vector<vector<int>> D(C,vector<int>(C));
  vector<vector<int>> c(N,vector<int>(N));
  
  for(int i=0;i<C;i++){
    for(int j=0;j<C;j++)
      cin>>D.at(i).at(j);
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++)
      cin>>c.at(i).at(j);
  }
  
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if((i+1+j+1)%3!=c.at(i).at(j)%3){
        iwakan += D(c.at(i).at(j)-1,(i+1+j+1)%3);
      }
    }
  }
  cout<<iwakan<<endl;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: no match for call to '(std::vector<std::vector<int> >) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type, int)'
   23 |         iwakan += D(c.at(i).at(j)-1,(i+1+j+1)%3);
      |                   ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#if 0
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std ;
#else
#include <bits/stdc++.h>
#endif

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N,  C;
	
	cin >> N >> C;

	int d[C][C];
	int c[N][N];
	int t[3][C];
	memset(t, 0, sizeof(t));

	rep(i, C)
	{
		rep(j,C)
		{
			cin >> d[i][j];
		}
	}

	rep(i, N)
	{
		rep(j, N)
		{
			cin >> c[i][j];
			t[(i+j)%3][c[i][j]-1]++;
		}
	}

	int ans = INT_MAX;

	rep(i, C)
	{
		rep(j, C)
		{
			if (i == j)
			{
				continue;
			}

			rep(k, C)
			{
				if ((i == k) || (j == k))
				{
					continue;
				}

				int tt =0;
				rep (l , C ) tt += d[l][i]* t[0][l];
				rep (l , C ) tt += d[l][j]* t[1][l];
				rep (l , C ) tt += d[l][k]* t[2][l];
				if ( tt < ans ) ans = tt ;
			}
		}
	}

	cout << ans << endl;

	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   30 |         cin.tie(NULL);
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:9:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:31:9: error: 'ios' has not been declared
   31 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:86:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   86 |         cout << ans << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:86:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   86 |         cout << ans << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N,  C;
	
	cin >> N >> C;

	int d[C][C];
	int c[N][N];
	int t[3][C];
	memset(t, 0, sizeof(t));

	rep(i, C)
	{
		rep(j,C)
		{
			cin >> d[i][j];
		}
	}

	rep(i, N)
	{
		rep(j, N)
		{
			cin >> c[i][j];
			t[(i+j)%3][c[i][j]-1]++;
		}
	}

	int ans = INT_MAX;

	rep(i, C)
	{
		rep(j, C)
		{
			if (i == j)
			{
				continue;
			}

			rep(k, C)
			{
				if ((i == k) || (j == k))
				{
					continue;
				}

				int tt =0;
				rep (l , C ) tt += d[l][i]* t[0][l];
				rep (l , C ) tt += d[l][j]* t[1][l];
				rep (l , C ) tt += d[l][k]* t[2][l];
				if ( tt < ans ) ans = tt ;
			}
		}
	}

	cout << ans << endl;

	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:19: error: 'INT_MAX' was not declared in this scope
   55 |         int ans = INT_MAX;
      |                   ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <cstring>
  +++ |+#include <climits>
    6 | using namespace std ;
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <cstdlib>
#include <math.h>

using namespace std;

typedef long long ll;
#define rep(i, n) for(long (i) = 0; (i) < (long) (n); (i)++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,a,b) for(long i=(a);i<(b);i++)
#define rrep1(i,a,b) for(long i=(a);i<=(b);i++)
#define rrrep(i,a,b) for(long i=(a);i>=(b);i--)
#define define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define X first
#define Y second
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int> >
#define vpl vector<pair<long, long> >
#define vppl vector<pair<long, pair<long, long> > >

const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const ll LINF = 1e18;


int pow(int x) {
	if (x == 0) {
		return 1;
	}
	else {
		return pow(x - 1) * 2;
	}
}

int main(int argc, char const *argv[])
{
    int N,C;
    cin >> N >> C;
    int a[C][C];
    rep(i,C) {
        rep(j,C) {
            cin >> a[i][j];
        }
    }
    vi a1,a2,a3;
    rep(i,N){
        rep(j,N){
            int x;
            cin >> x;
            if ((i + j)%3==0) {
                a1.push_back(x);
            } else if ((i+j)%3==1)
            {
                a2.push_back(x);
            } else
            {
                a3.push_back(x);
            }
        }
    }
    vpl b1,b2,b3;
    rep(j,C){
        long total = 0;
        rep(i, a1.size()) {
            total += a[a1[i]-1][j];
        }
        b1.push_back(make_pair(total,j));
    }
    rep(j,C){
        long total = 0;
        rep(i, a2.size()) {
            total += a[a2[i]-1][j];
        }
        b2.push_back(make_pair(total,j));
    }
    rep(j,C){
        long total = 0;

        rep(i, a3.size()) {
            total += a[a3[i]-1][j];
        }
        b3.push_back(make_pair(total,j));
    }
    sort(ALL(b1));
    sort(ALL(b2));
    sort(ALL(b3));
    long min = LONG_MAX;
    if (N ==1) { // 1の場合パターンはb2, b3に値が入っていないためケア
        cout << b1[0].first << endl;
        return 0;
    }
    
    rep(i,3){
        rep(j,3){
            rep(k,3){
                if (b1[i].second == b2[j].second || b1[i].second == b3[k].second || b2[j].second == b3[k].second) {
                    continue;
                }
                int total = b1[i].first + b2[j].first + b3[k].first;
                if (total < min) {
                    min = total;
                }
            }
        }
    }

    cout << min;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:94:16: error: 'LONG_MAX' was not declared in this scope
   94 |     long min = LONG_MAX;
      |                ^~~~~~~~
a.cc:8:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <math.h>
  +++ |+#include <climits>
    8 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
#define rep(i, n) for(int i = 0; i < n; i++)
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main(){
    //入力
    int n, C; cin >> n >> C;
    int D[C][C];
    int c[n][n];
    vector<int> v0, v1, v2;
    ll sum = 0;
    ll mn0 = 1000000000, mn1 = 100000000, mn2 = 10000000000;
    ll ans = 0;
    rep(i, C){
        rep(j, C){
            cin >> D[i][j];
        }
    }
    int color[3][30] = {0};
    rep(i, n){
        rep(j, n){
            cin >> c[i][j];
            color[(i+j)%3][c[i][j]-1]++;
        }
    }
    rep(i, n){
        rep(j, n){
            if(i != j){
                rep(k, n){
                    if(i != k && j != k){
                        int tt = 0;
                        rep(l,C) tt += D[l][i]*color[0][l];
                        rep(l,C) tt += D[l][j]*color[1][l];
                        rep(l,C) tt += D[l][k]*color[2][l];
                        mn = min(mn, tt); 
                    }
                }
            }
        }
    }
    cout << mn << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:25: error: 'mn' was not declared in this scope; did you mean 'mn2'?
   43 |                         mn = min(mn, tt);
      |                         ^~
      |                         mn2
a.cc:49:13: error: 'mn' was not declared in this scope; did you mean 'mn2'?
   49 |     cout << mn << endl;
      |             ^~
      |             mn2
Language: C++

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

int main() {
  int N, C, D[30][30], c[500][500];
  cin >> N >> C;
  for (int i = 0; i < C; i++)
    for (int j = 0; j < C; j++) cin >> D[i][j];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) cin >> c[i][j];
  int costD[30][3] = {};
  for (int goodc = 0; goodc < C; goodc++)
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++)
        costD[goodc][(i+j)%3] += D[c[i][j]-1][goodc];
  vector<int> kohoD;
  for (int c1 = 0; c1 < C; c1++) {
    for (int c2 = 0; c2 < C; c2++) {
      if (c1 == c2) continue;
      for (int c3 = 0; c3 < C; c3++) {
        if (c1 == c3 || c2 == c3) continue;
        kohoD.push_back(costD[c1][0] + costD[c2][1] + costD[c3][2]);
      }
    }
  }
  cout << *min_element(kohoD.begin(), kohoD.end());
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:12: error: 'min_element' was not declared in this scope
   27 |   cout << *min_element(kohoD.begin(), kohoD.end());
      |            ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
signed main(){
  int n,c,ans=1e9;
  cin>>n>>c;
  int a[n][n],d[c][c];
  int s[3][c];
  r(i,3)r(j,c)s[i][j]=0;
  r(i,c)r(j,c)cin>>d[i][j];
  r(i,n)r(j,n)cin>>a[i][j],a[i][j]--;
 
  r(i,n)r(j,n)s[(i+j)%3][a[i][j]]++;
  r(i,c)r(j,c)if(i!=j)r(k,c)if(i!=k&&j!=k){
    int sum=0;
    r(l,c){
      sum+=d[l][i]*s[0][l];
      sum+=d[l][j]*s[1][l];
      sum+=d[l][k]*s[2][l];
    }
    ans=min(ans,sum);
  }
  cout<<ansl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'ansl' was not declared in this scope; did you mean 'ans'?
   24 |   cout<<ansl;
      |         ^~~~
      |         ans
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;

// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using int128 = __int128;
using cint = cpp_int;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)

// Debug
#define debug(...)                                                             \
    {                                                                          \
        cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                     \
        for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";               \
        cerr << endl;                                                          \
    }

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)

// Stream
#define input(a) scanf("%lld", &(a))
#define output(a) printf("%lld\n", (a))
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }

class WarshallFloyd {
private:
    const int n;
    vector<vector<int>> d;
public:
    WarshallFloyd(int _n) : n(_n), d(_n, vector<int>(_n)) {
        rep(i, n) rep(j, n) {
            d[i][j] = (i == j ? 0 : INF);
        }
    }
    // directed
    void setDist(int i, int j, int c) {
        d[i][j] = c;
    }
    int getDist(int i, int j) {
        return d[i][j];
    }
    void calc() {
        rep(k, n) rep(i, n) rep(j, n) {
            d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }
};

ll N, C, X, S, M = INF, W[50][50], A[50][3], D[50][3];
signed main() {
    cin >> N >> C;
    WarshallFloyd W(C);
    rep(i, C) rep(j, C) {
        cin >> W[50][50];
    }
    W.calc();
    rep(i, N) rep(j, N) {
        cin >> X;
        A[X - 1][(i + j) % 3]++;
    }
    rep(i, C) rep(j, C) rep(k, 3) {
        D[j][k] += A[i][k] * W[i][j];
    }
    rep(i, C) rep(j, C) rep(k, C) {
        S = 0;
        if((i - j) * (j - k) * (k - i)) {
            S += D[i][0];
            S += D[j][1];
            S += D[k][2];
            if(S < M) M = S;
        }
    }
    cout << M << endl;
}

// for compilation: g++ -O3 -o _ _.cpp -std=c++17

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

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

int main(){
	int N,C;
	cin >> N >> C;
	vector< vector< int >  > D = vector< vector< int >  >(C,vector< int > (C,0));
	vector< vector< int >  > grid = vector< vector< int >  >(N,vector< int > (N,0));
	
	for(int i = 0; i < C; i++)
	{
		
		for(int j = 0; j < C; j++)
		{
			cin >> D[i][j];
		}
		
	}
	
	for(int i = 0; i < N; i++)
	{
		
		for(int j = 0; j < N; j++)
		{
			cin >> grid[i][j];
		}
		
	}
	vector< vector< int >  > cnt = vector< vector< int >  >(3,vector< int > (C,0));

	
	for(int i = 0; i < N; i++)
	{
		
		for(int j = 0; j < N; j++)
		{
			cnt[(i+j)%3][grid[i][j]-1] ++;
		}
		
	}
	
	int minv= INT_MAX;
	for(int i = 0; i < C; i++)
	{
		
		for(int j = 0; j < C; j++)
		{
			
			for(int k = 0; k < C; k++)
			{
				if(i==j || j==k || i==k){
					continue;
				}else{
					int sum =0;
					for(int l=0;l<C;l++) sum += cnt[0][l] * D[l][i];
					for(int l=0;l<C;l++) sum += cnt[1][l] * D[l][j];
					for(int l=0;l<C;l++) sum += cnt[2][l] * D[l][k];
					minv = min(minv, sum);
					
				}
			}
			
		}
		
	}

	cout << minv << endl;
	return 0;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:43:19: error: 'INT_MAX' was not declared in this scope
   43 |         int minv= INT_MAX;
      |                   ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

int n,m;
int d[35][35],c[1010][1010];

int sum(int a,int b,int e){
    int x=0;
    rep(i,n)rep(j,n){
        if(!(i+j)%3)
            x+=d[c[i][j]][a];
        if((i+j)%3==1)
            x+=d[c[i][j]][b];
        if((i+j)%3==2)
            x+=d[c[i][j]][e];
    }
    return x;
}

int main(){
    int ans=1e9;
    cin>>n>>m;
    rep(i,m)rep(j,m)cin>>d[i][j];
    rep(i,n)rep(j,n)cin>>c[i][j];
    
    rep(a,m)rep(b,m)rep(e,m){
        if(a==b||b==e||e==a)
            continue;
        ans=min(ans,sum(a,b,e);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:31: error: expected ')' before ';' token
   32 |         ans=min(ans,sum(a,b,e);
      |                ~              ^
      |                               )
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

int n,m;
int d[35][35],c[1010][1010];

int sum(int a,int b,int c){
    int x=0;
    rep(i,n)rep(j,n){
        if(!(i+j)%3)
            x+=d[(c[i][j])][a];
        if((i+j)%3==1)
            x+=d[(c[i][j])][b];
        if((i+j)%3==2)
            x+=d[(c[i][j])][c];
    }
    return x;
}

int main(){
    int ans=1e9;
    cin>>n>>m;
    rep(i,m)rep(j,m)cin>>d[i][j];
    rep(i,n)rep(j,n)cin>>c[i][j];
    
    rep(a,m)rep(b,m)rep(c,m){
        if(a==b||b==c||c==a)
            continue;
        ans=min(ans,sum(a,b,c));
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int sum(int, int, int)':
a.cc:14:20: error: invalid types 'int[int]' for array subscript
   14 |             x+=d[(c[i][j])][a];
      |                    ^
a.cc:16:20: error: invalid types 'int[int]' for array subscript
   16 |             x+=d[(c[i][j])][b];
      |                    ^
a.cc:18:20: error: invalid types 'int[int]' for array subscript
   18 |             x+=d[(c[i][j])][c];
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

int n,m,d[35][35],c[1010][1010];

int sum(int a,int b,int c){
    int x=0;
    rep(i,n)rep(j,n){
        if(!(i+j)%3)
            x+=d[(c[i][j])][a];
        if((i+j)%3==1)
            x+=d[(c[i][j])][b];
        if((i+j)%3==2)
            x+=d[(c[i][j])][c];
    }
    return x;
}

int main(){
    int ans=1e9;
    cin>>n>>m;
    rep(i,m)rep(j,m)cin>>d[i][j];
    rep(i,n)rep(j,n)cin>>c[i][j];
    
    rep(a,m)rep(b,m)rep(c,m){
        if(a==b||b==c||c==a)
            continue;
        ans=min(ans,sum(a,b,c));
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int sum(int, int, int)':
a.cc:13:20: error: invalid types 'int[int]' for array subscript
   13 |             x+=d[(c[i][j])][a];
      |                    ^
a.cc:15:20: error: invalid types 'int[int]' for array subscript
   15 |             x+=d[(c[i][j])][b];
      |                    ^
a.cc:17:20: error: invalid types 'int[int]' for array subscript
   17 |             x+=d[(c[i][j])][c];
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

int n,m,d[35][35],c[1010][1010];

int sum(int a,int b,int c){
    int x=0;
    rep(i,n)rep(j,n){
        if(!(i+j)%3)
            x+=d[c[i][j]][a];
        if((i+j)%3==1)
            x+=d[c[i][j]][b];
        if((i+j)%3==2)
            x+=d[c[i][j]][c];
        }
    return x;
}

int main(){
    int ans=1e9;
    cin>>n>>m;
    rep(i,m)rep(j,m)cin>>d[i][j];
    rep(i,n)rep(j,n)cin>>c[i][j];
    
    rep(a,m)rep(b,m)rep(c,m){
        if(a==b||b==c||c==a)
            continue;
        ans=min(ans,sum(a,b,c));
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int sum(int, int, int)':
a.cc:13:19: error: invalid types 'int[int]' for array subscript
   13 |             x+=d[c[i][j]][a];
      |                   ^
a.cc:15:19: error: invalid types 'int[int]' for array subscript
   15 |             x+=d[c[i][j]][b];
      |                   ^
a.cc:17:19: error: invalid types 'int[int]' for array subscript
   17 |             x+=d[c[i][j]][c];
      |                   ^
Language: C++

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

int main(){
  int n, c, ans;
  cin >> n >> c;
  int d[c][c], c[n][n], sum[3][c], inco[3][c];
  for (int i=0; i<3; i++)
    for(int t=0; t<c; t++)
      sum[i][t] =0, inco[i][t] = 0;
  for (int i=0; i<c; i++)
    for(int t=0; t<c; t++)
      cin >> d[i][t];
  for (int i=0; i<n; i++){
    for(int t=0; t<n; t++){
      cin >> c[i][t];
      sum[(i+t)%3][c[i][t]]++;
    }
  }
  for (int i=0; i<3; i++)
    for(int t=0; t<c; t++)
      for(int s=0; s<c; s++)
        inco[i][t] += sum[i][s]*d[s][t];
  ans = inco[0][0] + inco[1][0] + inco[0][0];
  for (int i=0; i<c; i++)
    for(int t=0; t<c; t++)
      for(int s=0; s<c; s++)
        if(ans > inco[0][i] + inco[1][t] + inco[0][s])
          ans = inco[0][i] + inco[1][t] + inco[0][s];
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: conflicting declaration 'int c [n][n]'
    9 |   int d[c][c], c[n][n], sum[3][c], inco[3][c];
      |                ^
a.cc:7:10: note: previous declaration as 'int c'
    7 |   int n, c, ans;
      |          ^
a.cc:18:15: error: invalid types 'int[int]' for array subscript
   18 |       cin >> c[i][t];
      |               ^
a.cc:19:21: error: invalid types 'int[int]' for array subscript
   19 |       sum[(i+t)%3][c[i][t]]++;
      |                     ^
Language: C++

// d.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"


#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N, C;
	cin >> N >> C;
	vector<vector<int>> d(C);
	vector<vector<int>> c(N);

	for (int i = 0; i < C; ++i) {
		d[i] = vector<int>(C);
		for (int j = 0; j < C; ++j) {
			cin >> d[i][j];
		}
	}
	for (int i = 0; i < N; ++i) {
		c[i] = vector<int>(N);
		for (int j = 0; j < N; ++j) {
			cin >> c[i][j];
		}
	}
	vector<vector<int>> s(3);
	for (int i = 0; i < 3; ++i) {
		s[i] = vector<int>(C);
		for (int j = 0; j < C; ++j)
			s[i][j] = 0;
	}
	for (int i = 0; i < N; ++i)
		for (int j = 0; j < N; ++j)
			for (int k = 0; k < C; ++k)
				s[(i + j) % 3][k] += d[c[i][j] - 1][k];
	long long m = 500 * 500 * 1000;
	for (int i = 0; i < C; ++i)
		for (int j = 0; j < C; ++j)
			for (int k = 0; k < C; ++k)
				if (i != j && j != k && k != i)
					m = ((m < s[0][i] + s[1][j] + s[2][k]) ? m : s[0][i] + s[1][j] + s[2][k]);
	cout << m << endl;
	return 0;
}



Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

import numpy as np
buf = input().split()
N = int(buf[0])
C = int(buf[1])
D = np.zeros((C, C))
for i in range(C):
	buf = input().split()
	for j in range(C):
		D[i][j] = int(buf[j])
		
c = np.zeros(3)
for i in range(2, N+2):
	c[(i%3)] += i-1
for i in range(N+2, 2*N+1):
	c[(i%3)] += N-1-(i-(N+2))
	
grid = -np.ones((3, int(np.max(c))))
groopcount = np.zeros(3)
for i in range(N):
	buf = input().split()
	for j in range(N):
		groop = (i+1+j+1)%3
		grid[groop][int(groopcount[groop])] = int(buf[j])-1
		groopcount[groop] += 1
#print(grid)
iwakan = np.zeros((3, C))

for groop in range(3):
	for color in range(C):
		#print(c3 + ((N*N)%3)//(groop+1))
		for i in range(int(c[groop])):
			#print(groop, color, i)
			#print(grid[groop][i])
			#print(D[int(grid[groop][i]-1)][color])
			iwakan[groop][color] += D[int(grid[groop][i])][color]
#print(iwakan)

miniwakan = np.zeros((3, 3))
cminiwakan = np.zeros((3, 3))
for groop in range(3):
	buf = iwakan[groop]
	for best in range(3):
		miniwakan[groop][best] = np.min(buf)
		mcolor = np.argmin(buf)
		cminiwakan[groop][best] = mcolor
		buf[mcolor] = 1000*c[groop]
#print(miniwakan)
#print(cminiwakan)
min = 1000*np.max(c)
for i in range(3):
	for j in range(3):
		for k in range(3):
			bufmin = miniwakan[0][i] + miniwakan[1][j] + miniwakan[2][k]
			c0 = cminiwakan[0][i]
			c1 = cminiwakan[1][j]
			c2 = cminiwakan[2][k]
			if((c0!=c1) and (c0!=c2) and (c1!=c2) and bufmin<min):
				min = bufmin

print(int(min))
					
			

# your code goes here

Compiler output:
a.cc:25:2: error: invalid preprocessing directive #print
   25 | #print(grid)
      |  ^~~~~
a.cc:30:18: error: invalid preprocessing directive #print
   30 |                 #print(c3 + ((N*N)%3)//(groop+1))
      |                  ^~~~~
a.cc:32:26: error: invalid preprocessing directive #print
   32 |                         #print(groop, color, i)
      |                          ^~~~~
a.cc:33:26: error: invalid preprocessing directive #print
   33 |                         #print(grid[groop][i])
      |                          ^~~~~
a.cc:34:26: error: invalid preprocessing directive #print
   34 |                         #print(D[int(grid[groop][i]-1)][color])
      |                          ^~~~~
a.cc:36:2: error: invalid preprocessing directive #print
   36 | #print(iwakan)
      |  ^~~~~
a.cc:47:2: error: invalid preprocessing directive #print
   47 | #print(miniwakan)
      |  ^~~~~
a.cc:48:2: error: invalid preprocessing directive #print
   48 | #print(cminiwakan)
      |  ^~~~~
a.cc:64:3: error: invalid preprocessing directive #your
   64 | # your code goes here
      |   ^~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>

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

int N, C, X;
int D[30][30];
int t[3][30];

int main() {
  scanf("%d %d", &N, &C);
  rep(i,C) rep(j,C) scanf("%d", &D[i][j]);
  rep(i,N) rep(j,N) scanf("%d", &X), ++t[(i+j)%3][X-1];
  
  int res = 1 << 30;
  rep(i,C) rep(j, C) if(i!=j) rep(k,C) if(i!=k && j!=k) {
    int tt = 0;
    rep(l,C) tt += D[l][i]*t[0][l];
    rep(l,C) tt += D[l][j]*t[1][l];
    rep(l,C) tt += D[l][k]*t[2][l];
    if (tt < res) res = tt;
  }
  pritnf("%d\n", res);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'pritnf' was not declared in this scope; did you mean 'printf'?
   22 |   pritnf("%d\n", res);
      |   ^~~~~~
      |   printf
Language: C++

import itertools

n, c = map(int, input().split())
color = [list(map(int, input().split()))for i in range(c)]  # 違和感
grid = [list(map(int, input().split()))for i in range(n)]  # 色
ans = 1000000000
cnt = 0
li = []
for i in range(c):
    li.append(i+1)
for mark in list(itertools.permutations(li, 3)):
    x = mark[0]  # 余り0をｘ、1をｙ、2をｚとする方法
    y = mark[1]
    z = mark[2]
    for i in range(n):
        for j in range(n):
            if (i+j) % 3 == 0:
                cnt += color[grid[i][j]-1][x-1]
            elif (i+j) % 3 == 1:
                cnt += color[grid[i][j]-1][y-1]
            elif (i+j) % 3 == 2:
                cnt += color[grid[i][j]-1][z-1]
    if cnt < ans:
        ans = cnt
    cnt = 0
print(ans)




Compiler output:
a.cc:4:61: error: stray '#' in program
    4 | color = [list(map(int, input().split()))for i in range(c)]  # 違和感
      |                                                             ^
a.cc:5:60: error: stray '#' in program
    5 | grid = [list(map(int, input().split()))for i in range(n)]  # 色
      |                                                            ^
a.cc:12:18: error: stray '#' in program
   12 |     x = mark[0]  # 余り0をｘ、1をｙ、2をｚとする方法
      |                  ^
a.cc:12:20: error: extended character 、 is not valid in an identifier
   12 |     x = mark[0]  # 余り0をｘ、1をｙ、2をｚとする方法
      |                    ^
a.cc:12:20: error: extended character 、 is not valid in an identifier
a.cc:1:1: error: 'import' does not name a type
    1 | import itertools
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'