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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int N_MAX = 210, M_MAX = N_MAX*(N_MAX-1)/2, R_MAX = 8;
const int INF = 1e8;
int V,E,R;
int G[N_MAX][N_MAX];

void warshall_floyd(){
  rep(w,V)rep(v,V)rep(u,v+1,V) 
    G[v][u] = G[u][v] = min(G[v][u],G[v][w] + G[w][u]);
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> V >> E >> R;
  vector<int> r(R);
  rep(i,R){
    cin >> r[i]; --r[i];
  }

  rep(v,V)rep(u,V) G[v][u] = (v==u) ? 0:INF;

  rep(i,E){
    int f,t,c; cin >> f >> t >> c; --f;--t;
    G[f][t] = G[t][f] = c; 
  }

  warshall_floyd();

  ll res = INF;
  sort(all(r));
  do{
    ll route = 0;
    rep(i,R-1) route += G[r[i]][r[i+1]];
    res = min(res,route);
  }while(next_permutation(all(r)));

  cout << res << endl;
  return 0;
}


Compiler output:
a.cc:38:30: error: macro "rep" passed 3 arguments, but takes just 2
   38 |   rep(w,V)rep(v,V)rep(u,v+1,V)
      |                              ^
a.cc:3:9: note: macro "rep" defined here
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |         ^~~
a.cc: In function 'void warshall_floyd()':
a.cc:38:19: error: 'rep' was not declared in this scope
   38 |   rep(w,V)rep(v,V)rep(u,v+1,V)
      |                   ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int N_MAX = 210, M_MAX = N_MAX*(N_MAX-1)/2, R_MAX = 8;
const int INF = 1e8;
int V,E,R;
int G[N_MAX][N_MAX];

void warshall_floyd(){
  rep(w,V)rep(v,V)rep(u,V) 
    G[v][u] = min(G[v][u],G[v][w] + G[w][u]);
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> V >> E >> R;
  vector<int> vr(R)
  rep(i,R){
    int r;cin >> r;
    --r;
    vr[i] = r;
  }
  rep(v,V)rep(u,V){
    G[v][u] = INF;
    if(v==u)G[v][u] = 0;
  }
  rep(i,E){
    int f,t,c;cin >> f >> t >> c;
    --f;--t;
    G[f][t] = c; 
    G[t][f] = c; 
  }
  warshall_floyd();

  ll minimum = INF;
  do{
    ll route = 0;
    rep(i,R-1){
      route += G[vr[i]][vr[i+1]];
    }
    minimum = min(route,minimum);
  }while(next_permutation(all(vr)));
  cout << minimum << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:3:18: error: expected ',' or ';' before 'for'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                  ^~~
a.cc:47:3: note: in expansion of macro 'rep'
   47 |   rep(i,R){
      |   ^~~
a.cc:47:7: error: 'i' was not declared in this scope
   47 |   rep(i,R){
      |       ^
a.cc:3:42: note: in definition of macro 'rep'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                          ^
a.cc:47:7: error: 'i_max' was not declared in this scope
   47 |   rep(i,R){
      |       ^
a.cc:3:44: note: in definition of macro 'rep'
    3 | #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
      |                                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int N_MAX = 210, M_MAX = N_MAX*(N_MAX-1)/2, R_MAX = 8;
const int INF = 1e8;
int V,E,R;
int vr[R_MAX];
int G[N_MAX][N_MAX];

void warshall_floyd(){
  rep(w,V)rep(v,V)rep(u,V) 
    if(G[v][u] > G[v][w] + G[w][u])G[v][u] = G[v][w] + G[w][u];
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> V >> E >> R;
  rep(i,R){
    int r;cin >> r;
    --r;
    vr[i] = r;
  }

  rep(v,V)rep(u,V) G[v][u] = INF;

  int f,t,c;
  rep(i,E){
    cin >> f >> t >> c;
    --f;--t;F
    G[f][t] = G[t][f] = c; 
  }

  warshall_floyd();

  int minimum = MAX_I;
  int route;
  do{
    route = 0;
    rep(i,R-1) route += G[vr[i]][vr[i+1]];
    minimum = min(route,minimum);
  }while(next_permutation(vr,vr+R));

  cout << minimum << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:13: error: 'F' was not declared in this scope
   58 |     --f;--t;F
      |             ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(ll i=0; i<(n); ++i)
#define FOR(i,a,b) for(ll i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MOD = (ll)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;
const ll MAX_V = 1001;

vector<vector<ll> > d(MAX_V, vector<ll>(MAX_V, INFLL)); //距離と隣接行列を兼ねる（ただし対角=0とする）
vector<vector<ll> > pre(MAX_V, vector<ll>(MAX_V, 0)); //iからjへの最短経路でjの前の点
ll n; 
void warshall_floyd(bool rep_pre = true) {
    if(rep_pre) {
        for (ll i = 0; i < n; i++) {
            for (ll j = 0; j < n; j++) {
                pre[i][j] = i;
            }
        }
    }
    for (ll k = 0; k < n; k++) {
        for (ll i = 0; i < n; i++) {
            for (ll j = 0; j < n; j++) {
                ll a = d[i][j];
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                if(rep_pre && a != d[i][j]) {
                    pre[i][j] = pre[k][j]; //iからjへの最短経路でjの前の点
                }
            }
        }
    }
}

void get_path(ll s, ll t) {
    while (t != s) {
        cout << t;
        t = pre[s][t];
    }
    cout << s << endl;
}

ll main () {

    cin >> n;  //★ちゃんと指定することに注意！！
    ll m,r; cin >>m>>r;
    ll array[r]; REP(i,r) cin >> array[i];
    REP (i,n) d[i][i] = 0;
    for (ll i = 0; i < m; i++) {
        ll f,t,c; cin >>f>>t>>c;
        f--;
        t--;
        d[f][t] = c;
        d[t][f] = c; //無向グラフのとき
    }
    warshall_floyd(true);

    ll res = INFLL;
    do {
        ll sum = 0;
        for(ll i=0; i<r-1; i++){
            ll s = array[i];
            s--;
            ll t = array[i+1];
            t--;
            sum += d[s][t];
        }
        res = min(res, sum);
    } while (next_permutation(array,array+r));

    cout << res << endl;
    return 0;
}


Compiler output:
a.cc:58:1: error: '::main' must return 'int'
   58 | ll main () {
      | ^~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int N, M, R;
int r[10];
ll ans;
bool used[10];
ll d[220][220];

void dfs(int c, int last, ll dist) { //dfsの添え字に必要な情報全て載せる！！
    if(c == R) {
        if(ans > dist) ans = dist;
        return;
    }
    rep(i, R) {
        if(!used[i]) {
            used[i] = true;
            if(las == -1) dfs(c + 1, i, 0);
            else dfs(c + 1, i, dist + d[r[las]][r[i]]);
            used[i] = false;
        }
    }
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    cin >> N >> M >> R;
    rep(i, R) {
        cin >> r[i];
        r[i] --;
    }
    rep(i, M) {
        int A, B; ll C;
        cin >> A >> B >> C;
        A --; B --;
        d[A][B] = C;
        d[B][A] = C;
    }
    rep(i, N) {
        d[i][i] = 0;
    }
    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    ans = INF;
    rep(i, 10) used[i] = false;
    //基本は全探索！！
    dfs(0, -1, 0);
    cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, ll)':
a.cc:67:16: error: 'las' was not declared in this scope; did you mean 'last'?
   67 |             if(las == -1) dfs(c + 1, i, 0);
      |                ^~~
      |                last
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int N, M, R;
int r[10];
ll ans;
bool used[10];

void dfs(int c, int last, ll dist) {
    if(c == R) {
        if(ans > dist) ans = dist;
        return;
    }
    rep(i, R) {
        if(!used[i]) {
            used[i] = true;
            if(las == -1) dfs(c + 1, i, 0);
            else dfs(c + 1, i, dist + d[r[las]][r[i]]);
            used[i] = false;
        }
    }
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    cin >> N >> M >> R;
    rep(i, R) {
        cin >> r[i];
        r[i] --;
    }
    ll d[220][220];
    rep(i, M) {
        int A, B; ll C;
        cin >> A >> B >> C;
        A --; B --;
        d[A][B] = C;
        d[B][A] = C;
    }
    rep(i, N) {
        d[i][i] = 0;
    }
    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    ans = INF;
    rep(i, 10) used[i] = false;
    //基本は全探索！！
    dfs(0, -1, 0);
    cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, ll)':
a.cc:66:16: error: 'las' was not declared in this scope; did you mean 'last'?
   66 |             if(las == -1) dfs(c + 1, i, 0);
      |                ^~~
      |                last
a.cc:67:39: error: 'd' was not declared in this scope
   67 |             else dfs(c + 1, i, dist + d[r[las]][r[i]]);
      |                                       ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int N, M, R;
int r[10];
ll ans;
bool used[10];

void dfs(int c, int last, ll dist) {
    if(c == R) {
        if(ans > dist) ans = dist;
        return;
    }
    rep(i, R) {
        if(!used[i]) {
            used[i] = true;
            if(las == -1) dfs(c + 1, i, 0);
            else dfs(c + 1, i, dist + d[r[last]][r[i]]);
            used[i] = false;
        }
    }
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    cin >> N >> M >> R;
    rep(i, R) {
        cin >> r[i];
        r[i] --;
    }
    ll d[220][220];
    rep(i, M) {
        int A, B; ll C;
        cin >> A >> B >> C;
        A --; B --;
        d[A][B] = C;
        d[B][A] = C;
    }
    rep(i, N) {
        d[i][i] = 0;
    }
    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    ans = INF;
    rep(i, 10) used[i] = false;
    //基本は全探索！！
    dfs(0, -1, 0);
    cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, ll)':
a.cc:66:16: error: 'las' was not declared in this scope; did you mean 'last'?
   66 |             if(las == -1) dfs(c + 1, i, 0);
      |                ^~~
      |                last
a.cc:67:39: error: 'd' was not declared in this scope
   67 |             else dfs(c + 1, i, dist + d[r[last]][r[i]]);
      |                                       ^
Language: C++

import sys
from heapq import heappush, heappop
from collections import deque
from itertools import permutations
input = sys.stdin.readline

def dijkstra(N, start, adj_dict):
    distance = [float('inf')] * N
    distance[start] = 0
    priority_queue = []
    
    for i in range(N):
        heappush(priority_queue, (distance[i], i))
        
    while len(priority_queue) > 0:
        (current_dist, current_node) = heappop(priority_queue)
        if distance[current_node] < current_dist:
            continue
        for next_node, w in adj_dict[current_node]:
            if distance[next_node] >= distance[current_node] + w:
                distance[next_node] = distance[current_node] + w
                heappush(priority_queue, (distance[next_node], next_node))
    
    return distance

N, M, R = map(int, input().split())
r = list(map(int, input().split()))
adj_dict = {i: deque([]) for i in range(N)}

for _ in range(M):
    a_i, b_i, c_i = map(int, input().split())
    adj_dict[a_i-1].append((b_i-1, c_i))
    adj_dict[b_i-1].append((a_i-1, c_i))

distance_map = [dijkstra(N, start, adj_dict) for start in range(N)]
ans = 1000000000

for route in permutations(r):
    ans_cand = 0
    
    for i in range(len(route)-1):
        ans_cand += distance_map[route[i]-1][route[i+1]-1]
    
    ans = min([ans, ans_cand])

print(ans)


Compiler output:
a.cc:8:23: warning: multi-character character constant [-Wmultichar]
    8 |     distance = [float('inf')] * N
      |                       ^~~~~
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:30:1: error: expected unqualified-id before 'for'
   30 | for _ in range(M):
      | ^~~
Language: C++

//
//  main.cpp
//
// g++ -std=c++14 main.cpp
//

//#include "main.hpp"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;

int main(void){
    int INF = 1e9;
    int v, e, t, d[205][205];
    cin >> v >> e >> t;
    
    vector<int> r;
    for (int i = 0; i < t; i++) {
        int tmp;
        cin >> tmp;
        r.push_back(tmp - 1);
    }
    
    for (int i = 0; i < v; i++) {
        for (int j = 0; j < v; j++) {
            if (i == j) d[i][j] = 0;
            else d[i][j] = INF;
        }
    }
    
    for (int i = 0; i < e; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;  b--;
        d[a][b] = d[b][a] = c;
    }
    
    //warshall_floyd
    for (int k = 0; k < v; k++) {
        for (int i = 0; i < v; i++) {
            for (int j = 0; j < v; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    
    sort(r.begin(), r.end());
    
    do {
        int tp = 0;
        for (int i = 0; i < t - 1; i++) tp += d[r[i]][r[i + 1]];
        mn = min(mn, tp);
    } while (next_permutation(r.begin(), r.end()));
    
    cout << mn << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:9: error: 'mn' was not declared in this scope
   55 |         mn = min(mn, tp);
      |         ^~
a.cc:58:13: error: 'mn' was not declared in this scope
   58 |     cout << mn << endl;
      |             ^~
Language: C++

//
//  main.cpp
//
// g++ -std=c++14 main.cpp
//

//#include "main.hpp"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;

ll INF = 1e18;
ll v, e, t, d[205][205];

void warshall_floyd() {
    for (int k = 0; k < v; k++) {
        for (int i = 0; i < v; i++) {
            for (int j = 0; j < v; j++) {
                if (d[i][j] != INF || d[i][k] != INF) {
                    if (d[i][j] != INF || d[k][j] != INF)
                        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
    }
}


int main(void){
    cin >> v >> e >> t;
    vector<ll> r, rr;
    for (int i = 0; i < t; i++) {
        ll tmp;
        cin >> tmp;
        r.push_back(tmp - 1);
    }
    for (int i = 0; i < t; i++) s.push_back(r[t - 1 - i]);
    
    for (int i = 0; i < v; i++) {
        for (int j = 0; j < v; j++) {
            if (i == j) d[i][j] = 0;
            else d[i][j] = INF;
        }
    }
    
    for (int i = 0; i < e; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;  b--;
        d[a][b] = c;
        d[b][a] = c;
    }
    
    warshall_floyd();
    warshall_floyd();
    
    ll mn = 1e18;
    do {
        ll tp = 0;
        for (int i = 0; i < t - 1; i++) tp += d[r[i]][r[i + 1]];
        mn = min(mn, tp);
    } while (next_permutation(r.begin(), r.end()));
    
    ll tmp = 0;
    for (int i = 0; i < t - 1; i++) tp += d[rr[i]][rr[i + 1]];
    mn = min(mn, tmp);
    
    cout << mn << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:33: error: 's' was not declared in this scope
   40 |     for (int i = 0; i < t; i++) s.push_back(r[t - 1 - i]);
      |                                 ^
a.cc:68:37: error: 'tp' was not declared in this scope; did you mean 'tmp'?
   68 |     for (int i = 0; i < t - 1; i++) tp += d[rr[i]][rr[i + 1]];
      |                                     ^~
      |                                     tmp
Language: C++

#include"bits/stdc++.h"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define int long long
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const int mod=1000000007;

int mpow(int a,int x);
int m_inv(int n){return mpow(n,mod-2);}

int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}

signed main(){
	int N,M,R;
	cin>>N>>M>>R;
	vector<ll> r(R);
	rep(i,R){
		int a;
		cin>>a;
		r[i]=a-1;
	}
	vector<vector<ll>> d(N,vector<ll>(N));
	rep(i,N) rep(j,N) d[i][j]=INT_MAX;
	rep(i,M){
		ll a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		if(d[a][b]>c){
		    d[a][b]=c;
		    d[b][a]=c;
		}
	}
	
	rep(k,N) rep(i,N) rep(j,N){
		if(d[i][j]>d[i][k]+d[k][j]) d[i][j]=d[i][k]+d[k][j];
	}
	ll ans=INT_MAX;
	do{
		ll tmp=0;
		rep(i,R-1) tmp+=d[r[i]][r[i+1]];
		ans=min(ans,tmp);
		}while(next_permutation(r.begin(),r.end()));
	cout<<ans<<endl;
}

Compiler output:
/usr/bin/ld: /tmp/cccXnEX3.o: in function `m_inv(long long)':
a.cc:(.text+0x19): undefined reference to `mpow(long long, long long)'
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio > 
using namespace std; 
#define INF (1<<29)
int N,M,R;
int d[201][201]; int r[9];
int A,B,C;
int res;
bool used [9];
    void dfs(int c,int las,int dist) {
    if(c==R+1) {
if(res>dist)res=dist; return;
}
for(int i=1;i<=R;i++)if(!used[i]) {
              used[i]=true; if(las==-1)dfs(c+1,i,0);
else dfs(c+1,i,dist+d[r[las]][r[i]]); used[i]=false;
        }
  }
      int main () {
    scanf("%d%d%d",&N,&M,&R);
for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)if(i!=j)d[i][j]=INF; for(int i=1;i<=R;i++)scanf("%d",&r[i]);
for(int i=1;i<=M;i++)
{
scanf("%d%d%d",&A,&B,&C); if(d[A][B]>C)d[A][B]=d[B][A]=C;
}
for(int k=1;k<=N;k++)
for(int i=1;i<=N;i++)
for(int j=1;j<=N;j++)
                      if(d[i][j]>d[i][k]+d[k][j]) d[i][j]=d[i][k]+d[k][j];
    res=INF; dfs(1,-1,0); printf("%d\n",res);
      }


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

#include <cstdio > using namespace std; #define INF (1<<29)
int N,M,R;
int d[201][201]; int r[9];
int A,B,C;
int res;
bool used [9];
    void dfs(int c,int las,int dist) {
    if(c==R+1) {
if(res>dist)res=dist; return;
}
for(int i=1;i<=R;i++)if(!used[i]) {
              used[i]=true; if(las==-1)dfs(c+1,i,0);
else dfs(c+1,i,dist+d[r[las]][r[i]]); used[i]=false;
        }
  }
      int main () {
    scanf("%d%d%d",&N,&M,&R);
for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)if(i!=j)d[i][j]=INF; for(int i=1;i<=R;i++)scanf("%d",&r[i]);
for(int i=1;i<=M;i++)
{
scanf("%d%d%d",&A,&B,&C); if(d[A][B]>C)d[A][B]=d[B][A]=C;
}
for(int k=1;k<=N;k++)
for(int i=1;i<=N;i++)
for(int j=1;j<=N;j++)
                      if(d[i][j]>d[i][k]+d[k][j]) d[i][j]=d[i][k]+d[k][j];
    res=INF; dfs(1,-1,0); printf("%d\n",res);
      }


Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <cstdio > using namespace std; #define INF (1<<29)
      |                    ^~~~~
a.cc:1:10: fatal error: cstdio : No such file or directory
    1 | #include <cstdio > using namespace std; #define INF (1<<29)
      |          ^~~~~~~~~
compilation terminated.
Language: C++

include <cstdio > using namespace std; #define INF (1<<29)
int N,M,R;
int d[201][201]; int r[9];
int A,B,C;
int res;
bool used [9];
    void dfs(int c,int las,int dist) {
    if(c==R+1) {
if(res>dist)res=dist; return;
}
for(int i=1;i<=R;i++)if(!used[i]) {
              used[i]=true; if(las==-1)dfs(c+1,i,0);
else dfs(c+1,i,dist+d[r[las]][r[i]]); used[i]=false;
        }
  }
      int main () {
    scanf("%d%d%d",&N,&M,&R);
for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)if(i!=j)d[i][j]=INF; for(int i=1;i<=R;i++)scanf("%d",&r[i]);
for(int i=1;i<=M;i++)
{
scanf("%d%d%d",&A,&B,&C); if(d[A][B]>C)d[A][B]=d[B][A]=C;
}
for(int k=1;k<=N;k++)
for(int i=1;i<=N;i++)
for(int j=1;j<=N;j++)
                      if(d[i][j]>d[i][k]+d[k][j]) d[i][j]=d[i][k]+d[k][j];
    res=INF; dfs(1,-1,0); printf("%d\n",res);
      }

Compiler output:
a.cc:1:40: error: stray '#' in program
    1 | include <cstdio > using namespace std; #define INF (1<<29)
      |                                        ^
a.cc:1:1: error: 'include' does not name a type
    1 | include <cstdio > using namespace std; #define INF (1<<29)
      | ^~~~~~~
a.cc:1:41: error: 'define' does not name a type
    1 | include <cstdio > using namespace std; #define INF (1<<29)
      |                                         ^~~~~~
a.cc: In function 'void dfs(int, int, int)':
a.cc:8:11: error: 'R' was not declared in this scope
    8 |     if(c==R+1) {
      |           ^
a.cc:11:16: error: 'R' was not declared in this scope
   11 | for(int i=1;i<=R;i++)if(!used[i]) {
      |                ^
a.cc: In function 'int main()':
a.cc:17:21: error: 'N' was not declared in this scope
   17 |     scanf("%d%d%d",&N,&M,&R);
      |                     ^
a.cc:17:24: error: 'M' was not declared in this scope
   17 |     scanf("%d%d%d",&N,&M,&R);
      |                        ^
a.cc:17:27: error: 'R' was not declared in this scope
   17 |     scanf("%d%d%d",&N,&M,&R);
      |                           ^
a.cc:17:5: error: 'scanf' was not declared in this scope
   17 |     scanf("%d%d%d",&N,&M,&R);
      |     ^~~~~
a.cc:18:59: error: 'INF' was not declared in this scope
   18 | for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)if(i!=j)d[i][j]=INF; for(int i=1;i<=R;i++)scanf("%d",&r[i]);
      |                                                           ^~~
a.cc:27:9: error: 'INF' was not declared in this scope
   27 |     res=INF; dfs(1,-1,0); printf("%d\n",res);
      |         ^~~
a.cc:27:27: error: 'printf' was not declared in this scope
   27 |     res=INF; dfs(1,-1,0); printf("%d\n",res);
      |                           ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include <cstdio > using namespace std; #define INF (1<<29)
Language: C++

#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    int N, M, R; cin >> N >> M >> R;
    vi r(R); 
    REP(i, R) {
        cin >> r[i];
        r[i]--;
    }
    vi A(M), B(M), C(M);
    REP(i,M) {
        cin >> A[i] >> B[i] >> C[i];
        A[i]--; B[i]--;
    }

    vvi es(N);
    map<pii, int> cost;
    REP(i,M) {
        es[A[i]].push_back(B[i]);
        cost[pii(A[i], B[i])] = C[i];
        es[B[i]].push_back(A[i]);
        cost[pii(B[i], A[i])] = C[i];
    }

    vvl d;
    warshall(d, es, cost);

    vs sr;
    REP(i, R) sr.push_back(to_string(r[i]));

    vector<vs> perm;
    get_permutation(perm, sr);
    
    ll ans = LINF;
    for(vs ptn : perm) {
        ll sum = 0;
        int x = stoi(ptn[0]);
        for (int i = 1; i < ptn.size(); i++) {
            int nx = stoi(ptn[i]);
            sum += d[x][nx];
            x = nx;
        }
        ans = min(ans, sum);
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:5: error: 'warshall' was not declared in this scope
   54 |     warshall(d, es, cost);
      |     ^~~~~~~~
a.cc:60:5: error: 'get_permutation' was not declared in this scope
   60 |     get_permutation(perm, sr);
      |     ^~~~~~~~~~~~~~~
Language: C++

signed main(void){
    int n,m,r;cin>>n>>m>>r;
    vector<vector<int>>wf(n,vector<int>(n,INF));
    vector<int>R(r);rep(i,r){cin>>R[i];R[i]--;}
    int f,t,c;
    rep(i,m){
        cin>>f>>t>>c;f--;t--;
        wf[f][t]=c;wf[t][f]=c;
    }
    rep(k,n)rep(i,n)rep(j,n){
        wf[i][j]=min(wf[i][j],wf[i][k]+wf[k][j]);
    }
    int ans=INF;int com;
    do{
        com=0;
        rep(i,r-1){
            com+=wf[R[i]][R[i+1]];
        }
        ans=min(ans,com);
        //rep(i,r)cout<<R[i]<<' ';
        //cout<<':'<<com<<endl;
    }while(next_permutation(all(R)));
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:15: error: 'cin' was not declared in this scope
    2 |     int n,m,r;cin>>n>>m>>r;
      |               ^~~
a.cc:3:5: error: 'vector' was not declared in this scope
    3 |     vector<vector<int>>wf(n,vector<int>(n,INF));
      |     ^~~~~~
a.cc:3:19: error: expected primary-expression before 'int'
    3 |     vector<vector<int>>wf(n,vector<int>(n,INF));
      |                   ^~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int>R(r);rep(i,r){cin>>R[i];R[i]--;}
      |            ^~~
a.cc:4:25: error: 'i' was not declared in this scope
    4 |     vector<int>R(r);rep(i,r){cin>>R[i];R[i]--;}
      |                         ^
a.cc:4:21: error: 'rep' was not declared in this scope
    4 |     vector<int>R(r);rep(i,r){cin>>R[i];R[i]--;}
      |                     ^~~
a.cc:10:9: error: 'k' was not declared in this scope
   10 |     rep(k,n)rep(i,n)rep(j,n){
      |         ^
a.cc:13:13: error: 'INF' was not declared in this scope
   13 |     int ans=INF;int com;
      |             ^~~
a.cc:19:13: error: 'min' was not declared in this scope; did you mean 'main'?
   19 |         ans=min(ans,com);
      |             ^~~
      |             main
a.cc:22:33: error: 'R' was not declared in this scope
   22 |     }while(next_permutation(all(R)));
      |                                 ^
a.cc:22:29: error: 'all' was not declared in this scope
   22 |     }while(next_permutation(all(R)));
      |                             ^~~
a.cc:22:12: error: 'next_permutation' was not declared in this scope
   22 |     }while(next_permutation(all(R)));
      |            ^~~~~~~~~~~~~~~~
a.cc:23:5: error: 'cout' was not declared in this scope
   23 |     cout<<ans<<endl;
      |     ^~~~
a.cc:23:16: error: 'endl' was not declared in this scope
   23 |     cout<<ans<<endl;
      |                ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  int N,M,R; cin >> N >> M >> R;
  int dist[N + 10][N + 10] = {100000000000000};
  
  vector<int> r(R); for(int i = 0; i < R; i++){ cin >> r[i];}
  
  for(int i = 0; i < M; i++){
 int a,b,c; cin >> a >> b >> c; 
    dist[a][b] = c; dist[b][a] = c;}
  
  for(int k = 1; k <= N; k++){
    for(int i = 1; i <= N; i++){
      for(int j = 1; j <= N; j++){

        dist[i][j] = min(dist[i][j], (dist[i][k] + dist[k][j]));}}}
  
  int min_dist = 1000000000000;
  do{ int sum = 0;
    for(int i = 0; i < R - 1; i++){
      sum += dist[r[i]][r[i+1]];}
     
     min_dist = min(min_dist,sum);
    }while(next_permutation(r.begin(),r.end()));
           
           cout << min_dist << endl;
           return 0;}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:31: error: narrowing conversion of '100000000000000' from 'long int' to 'int' [-Wnarrowing]
    9 |   int dist[N + 10][N + 10] = {100000000000000};
      |                               ^~~~~~~~~~~~~~~
a.cc:23:18: warning: overflow in conversion from 'long int' to 'int' changes value from '1000000000000' to '-727379968' [-Woverflow]
   23 |   int min_dist = 1000000000000;
      |                  ^~~~~~~~~~~~~
Language: C++


# include<cstdio>
using namespace std ;
# define INF (1 < <29)
int N ,M , R ;
int d [201][201];
int r [9];
int A ,B , C ;
int res ;
bool used [9];

void dfs ( int c , int las , int dist )
{
    if ( c == R +1)
    {
        if ( res > dist ) res = dist ;
        return ;
    }
    for ( int i =1; i <= R ; i ++) if (! used [ i ])
        {
            used [ i ]= true ;
            if ( las == -1) dfs ( c +1 ,i ,0);
            else dfs ( c +1 ,i , dist + d [ r [ las ]][ r [ i ]]);
            used [ i ]= false ;
        }
}
int main ()
{
    scanf ( "%d %d %d" ,&N ,& M ,& R );
    for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
    for ( int i =1; i <= R ; i ++) scanf ( " % d " ,& r [ i ]);
    for ( int i =1; i <= M ; i ++)
    {
        scanf ( "%d %d %d" ,&A ,& B ,& C );
        if ( d [ A ][ B ] > C ) d [ A ][ B ]= d [ B ][ A ]= C ;
    }
    for ( int k =1; k <= N ; k ++)
        for ( int i =1; i <= N ; i ++)
            for ( int j =1; j <= N ; j ++)
                if ( d [ i ][ j ] > d [ i ][ k ]+ d [ k ][ j ])
                    d[ i ][ j ]= d [ i ][ k ]+ d [ k ][ j ];
    res = INF ;
    dfs (1 , -1 ,0);
    printf ( "%d\n" , res );
}




Compiler output:
a.cc: In function 'int main()':
a.cc:4:19: error: expected primary-expression before '<' token
    4 | # define INF (1 < <29)
      |                   ^
a.cc:30:95: note: in expansion of macro 'INF'
   30 |     for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
      |                                                                                               ^~~
a.cc:4:19: error: expected primary-expression before '<' token
    4 | # define INF (1 < <29)
      |                   ^
a.cc:42:11: note: in expansion of macro 'INF'
   42 |     res = INF ;
      |           ^~~
Language: C++


# include<cstdio>
using namespace std ;
# define INF (1 < <29)
int N ,M , R ;
int d [201][201];
int r [9];
int A ,B , C ;
int res ;
bool used [9];

void dfs ( int c , int las , int dist )
{
    if ( c == R +1)
    {
        if ( res > dist ) res = dist ;
        return ;
    }
    for ( int i =1; i <= R ; i ++) if (! used [ i ])
        {
            used [ i ]= true ;
            if ( las == -1) dfs ( c +1 ,i ,0);
            else dfs ( c +1 ,i , dist + d [ r [ las ]][ r [ i ]]);
            used [ i ]= false ;
        }
}
int main ()
{
    scanf ( " %d %d %d " ,&N ,& M ,& R );
    for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
    for ( int i =1; i <= R ; i ++) scanf ( " % d " ,& r [ i ]);
    for ( int i =1; i <= M ; i ++)
    {
        scanf ( " %d %d %d " ,&A ,& B ,& C );
        if ( d [ A ][ B ] > C ) d [ A ][ B ]= d [ B ][ A ]= C ;
    }
    for ( int k =1; k <= N ; k ++)
        for ( int i =1; i <= N ; i ++)
            for ( int j =1; j <= N ; j ++)
                if ( d [ i ][ j ] > d [ i ][ k ]+ d [ k ][ j ])
                    d[ i ][ j ]= d [ i ][ k ]+ d [ k ][ j ];
    res = INF ;
    dfs (1 , -1 ,0);
    printf ( " % d \n " , res );
}




Compiler output:
a.cc: In function 'int main()':
a.cc:4:19: error: expected primary-expression before '<' token
    4 | # define INF (1 < <29)
      |                   ^
a.cc:30:95: note: in expansion of macro 'INF'
   30 |     for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
      |                                                                                               ^~~
a.cc:4:19: error: expected primary-expression before '<' token
    4 | # define INF (1 < <29)
      |                   ^
a.cc:42:11: note: in expansion of macro 'INF'
   42 |     res = INF ;
      |           ^~~
Language: C++


# include < cstdio >
using namespace std ;
# define INF (1 < <29)
int N ,M , R ;
int d [201][201];
int r [9];
int A ,B , C ;
int res ;
bool used [9];

void dfs ( int c , int las , int dist )
{
    if ( c == R +1)
    {
        if ( res > dist ) res = dist ;
        return ;
    }
    for ( int i =1; i <= R ; i ++) if (! used [ i ])
        {
            used [ i ]= true ;
            if ( las == -1) dfs ( c +1 ,i ,0);
            else dfs ( c +1 ,i , dist + d [ r [ las ]][ r [ i ]]);
            used [ i ]= false ;
        }
}
int main ()
{
    scanf ( " %d %d %d " ,&N ,& M ,& R );
    for ( int i =1; i <= N ; i ++) for ( int j =1; j <= N ; j ++) if ( i != j ) d [ i ][ j ]= INF ;
    for ( int i =1; i <= R ; i ++) scanf ( " % d " ,& r [ i ]);
    for ( int i =1; i <= M ; i ++)
    {
        scanf ( " %d %d %d " ,&A ,& B ,& C );
        if ( d [ A ][ B ] > C ) d [ A ][ B ]= d [ B ][ A ]= C ;
    }
    for ( int k =1; k <= N ; k ++)
        for ( int i =1; i <= N ; i ++)
            for ( int j =1; j <= N ; j ++)
                if ( d [ i ][ j ] > d [ i ][ k ]+ d [ k ][ j ])
                    d[ i ][ j ]= d [ i ][ k ]+ d [ k ][ j ];
    res = INF ;
    dfs (1 , -1 ,0);
    printf ( " % d \n " , res );
}




Compiler output:
a.cc:2:11: fatal error:  cstdio : No such file or directory
    2 | # include < cstdio >
      |           ^~~~~~~~~~
compilation terminated.
Language: C

#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
//#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=0;i<b;i++)
#define REP(i,a,b) for(int i=0;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout <<(f?"Yes":"No")<<endl//fが真の場合Yesを出力、偽の場合Noを出力
#define yes(f) cout <<(f?"yes":"no")<<endl
#define YES(f) cout <<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())

using namespace std;

const int mod=1e9+7;

signed main(){
    int h,w;
    cin >> h >> w;
    int n;
    cin >> n;
    vvi field(h*w,0);
    vi color_num(n);
    rep(i,n)cin >> color_num[i];

    //処理
   int current[2]={0,0};
   int muki=1;
   int j=0;
   rep(i,h*w)
   {
       if(color_num[j]==0)j++;
       else color_num[j]--;
       field[current[0]][current[1]]=j+1;
    if((current[0]==h-1&&muki==1)||(current[1]==0&&muki==0))current[1]++;
    else if(muki)
    {
        current[0]++;
    }
    else current[0]--;
   } 


   rep(i,h)
   {
       rep(j,w)
       {
           cout << field[i][j];
       }
       cout << endl;
   }
}


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

#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=0;i<b;i++)
#define REP(i,a,b) for(int i=0;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout <<(f?"Yes":"No")<<endl//fが真の場合Yesを出力、偽の場合Noを出力
#define yes(f) cout <<(f?"yes":"no")<<endl
#define YES(f) cout <<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())

using namespace std;

const int mod=1e9+7;

signed main(){
    int h,w;
    cin >> h >> w;
    int n;
    cin >> n;
    vvi field(h*w,0);
    vi color_num(n);
    rep(i,n)cin >> color_num[i];

    //処理
   int current[2]={0,0};
   int muki=1;
   int j=0;
   rep(i,h*w)
   {
       if(color_num[j]==0)j++;
       else color_num[j]--;
       field[current[0]][current[1]]=j+1;
    if((current[0]==h-1&&muki==1)||(current[1]==0&&muki==0))current[1]++;
    else if(muki)
    {
        current[0]++;
    }
    else current[0]--;
   } 


   rep(i,h)
   {
       rep(j,w)
       {
           cout << field[i][j];
       }
       cout << endl;
   }
}


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

#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
using namespace std;
int main(){
    int N,M,R,A,B,C,ans=INT_MAX,c;
    cin>>N>>M>>R;
    vector<int>r(R);
    for(i=0;i<R;i++)cin>>r[i];
    int d[N][N]={};
    for(i=0;i<N*N;i++)d[i/N][i%N]=(i/N==i%N?0:INT_MAX);
    for(i=0;i<M;i++){
        cin>>A>>B>>C;
        if(d[A-1][B-1]>C)d[A-1][B-1]=d[B-1][A-1]=C;
    }
    for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
    sort(r.begin(),r.end());
    do{
        for(i=1,c=0;i<r.size();i++)c+=d[r[i-1]-1][r[i]-1];
        if(ans>c)ans=c;
    }while(next_permutation(r.begin(),r.end()));
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'i' was not declared in this scope
   10 |     for(i=0;i<R;i++)cin>>r[i];
      |         ^
a.cc:12:9: error: 'i' was not declared in this scope
   12 |     for(i=0;i<N*N;i++)d[i/N][i%N]=(i/N==i%N?0:INT_MAX);
      |         ^
a.cc:13:9: error: 'i' was not declared in this scope
   13 |     for(i=0;i<M;i++){
      |         ^
a.cc:17:9: error: 'i' was not declared in this scope
   17 |     for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
      |         ^
a.cc:17:25: error: 'j' was not declared in this scope
   17 |     for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
      |                         ^
a.cc:17:41: error: 'k' was not declared in this scope
   17 |     for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
      |                                         ^
a.cc:20:13: error: 'i' was not declared in this scope
   20 |         for(i=1,c=0;i<r.size();i++)c+=d[r[i-1]-1][r[i]-1];
      |             ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    long long N,M,R,A,B,C,ans=LLONG_MAX,c,i,j,k;
    cin>>N>>M>>R;
    vector<long long>r(R);
    for(i=0;i<R;i++)cin>>r[i];
    long long d[N][N]={};
    for(i=0;i<N*N;i++)d[i/N][i%N]=(i/N==i%N?0:100000);
    for(i=0;i<M;i++){
        cin>>A>>B>>C;
        if(d[A-1][B-1]>C)d[A-1][B-1]=d[B-1][A-1]=C;
    }
    for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
    sort(r.begin(),r.end());
    do{
        for(i=1,c=0;i<r.size();i++)c+=d[r[i-1]-1][r[i]-1];
        if(ans>c)ans=c;
    }while(next_permutation(r.begin(),r.end()));
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:31: error: 'LLONG_MAX' was not declared in this scope
    6 |     long long N,M,R,A,B,C,ans=LLONG_MAX,c,i,j,k;
      |                               ^~~~~~~~~
a.cc:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     for(i=0;i<R;i++)cin>>r[i];
      |         ^
a.cc:11:9: error: 'i' was not declared in this scope
   11 |     for(i=0;i<N*N;i++)d[i/N][i%N]=(i/N==i%N?0:100000);
      |         ^
a.cc:12:9: error: 'i' was not declared in this scope
   12 |     for(i=0;i<M;i++){
      |         ^
a.cc:16:9: error: 'i' was not declared in this scope
   16 |     for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
      |         ^
a.cc:16:25: error: 'j' was not declared in this scope
   16 |     for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
      |                         ^
a.cc:16:41: error: 'k' was not declared in this scope
   16 |     for(i=0;i<N;i++)for(j=0;j<N;j++)for(k=0;k<N;k++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
      |                                         ^
a.cc:19:13: error: 'i' was not declared in this scope
   19 |         for(i=1,c=0;i<r.size();i++)c+=d[r[i-1]-1][r[i]-1];
      |             ^
a.cc:19:17: error: 'c' was not declared in this scope
   19 |         for(i=1,c=0;i<r.size();i++)c+=d[r[i-1]-1][r[i]-1];
      |                 ^
a.cc:20:16: error: 'c' was not declared in this scope
   20 |         if(ans>c)ans=c;
      |                ^
Language: C++

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

int main(){
  int n,m,r;
  cin>>n>>m>>r;
  vector<int> q(r);
  rep(i,r) cin>>q[i];
  sort(q.begin(),q.end());
  int dist[n][n]={};
  rep(i,m){
    int a,b,c;
    cin>>a>>b>>c;
    dist[a][b]=c;
    dist[b][a]=c;
  }
  rep(i,n) rep(j,n) rep(k,n) dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
  int ans=1000000000;
  while(true){
    int tmp=0;
    rep(i,r-1)tmp+=dist[i][i+1];
    ans=min(ans,tmp);
    if(!next_permutation(q.begin(),q.end())) break;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   rep(i,r) cin>>q[i];
      |       ^
a.cc:8:3: error: 'rep' was not declared in this scope
    8 |   rep(i,r) cin>>q[i];
      |   ^~~