Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
int n,  color;
int d[30][30];
int c[500][500];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>color;
    vector<int> mod0(31);
    vector<int> mod1(31);
    vector<int> mod2(31);
    for (int i = 0; i < =color; i++)
    {
        mod0[i]=0;
        mod1[i]=0;
        mod2[i]=0;
    }
    ll ans=INF;
    for (int i = 0; i < color; i++)
    {
        for(int j=0;j<color;j++)
        cin >> d[i][j];
    }
    for (int i = 0; i < n; i++)
    {
        for(int j=0;j<;j++)
        cin >> c[i][j];
        if((i+j)%3==0){
            mod0[c]++;
        }
        if((i+j)%3==1){
            mod1[c]++;
        }
        if((i+j)%3==2){
            mod2[c]++;
        }
    } 
    for(int i=1;i<=color;i++){
        for(int j=1:j<=color;j++){
            ll sum=0;
            if(i==j)continue;
            for(int k=1;k<=color;k++){
                if(i==k||k==j) continue;
                for(int l=1;l<color;i++){
                    sum+=mod0[l]*c[l-1][i-1];
                }
                for(int l=1;l<color;i++){
                    sum+=mod1[l]*c[l-1][j-1];
                }
                for(int l=1;l<color;i++){
                    sum+=mod0[l]*c[l-1][k-1];
                }
            }
            ans=min(sum,ans);
        }
    }
    cout << ans << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:25: error: expected primary-expression before '=' token
   48 |     for (int i = 0; i < =color; i++)
      |                         ^
a.cc:62:23: error: expected primary-expression before ';' token
   62 |         for(int j=0;j<;j++)
      |                       ^
a.cc:64:15: error: 'j' was not declared in this scope
   64 |         if((i+j)%3==0){
      |               ^
a.cc:65:18: error: invalid conversion from 'int (*)[500]' to 'std::vector<int>::size_type' {aka 'long unsigned int'} [-fpermissive]
   65 |             mod0[c]++;
      |                  ^
      |                  |
      |                  int (*)[500]
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:67:15: error: 'j' was not declared in this scope
   67 |         if((i+j)%3==1){
      |               ^
a.cc:68:18: error: invalid conversion from 'int (*)[500]' to 'std::vector<int>::size_type' {aka 'long unsigned int'} [-fpermissive]
   68 |             mod1[c]++;
      |                  ^
      |                  |
      |                  int (*)[500]
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:70:15: error: 'j' was not declared in this scope
   70 |         if((i+j)%3==2){
      |               ^
a.cc:71:18: error: invalid conversion from 'int (*)[500]' to 'std::vector<int>::size_type' {aka 'long unsigned int'} [-fpermissive]
   71 |             mod2[c]++;
      |                  ^
      |                  |
      |                  int (*)[500]
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:75:18: error: initializer in range-based 'for' loop
   75 |         for(int j=1:j<=color;j++){
      |                  ^
a.cc:75:29: error: expected ')' before ';' token
   75 |         for(int j=1:j<=color;j++){
      |            ~                ^
      |                             )
a.cc:75:30: error: 'j' was not declared in this scope
   75 |         for(int j=1:j<=color;j++){
      |                              ^