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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
static const int MAX = 100;
static const int INF = 1e7;
int n, m, d[MAX][MAX];
vector<pair<int, P> > v;

void warshall_floyd(){
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            for (int k = 0; k < n; k++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }
}

int check(){
    int res = 0;
    bool short;
    for (int i = 0; i < m; i++){
        short = true;
        for (int j = 0; j < n; j++){
            if (!short) break;
            if (d[j][v[i].second.first] + v[i].first \
            == d[j][v[i].second.second]){
                if (short) res += 1;
                short = false;
            }
        }
    }
    return res;
}

int main(){
    int a, b, c, ans;
    sc(n) sc(m)
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++) d[i][j] = INF;
        d[i][i] = 0;
    }
    for (int i = 0; i < m; i++){
        sc(a) sc(b) sc(c)
        d[a - 1][b - 1] = c;
        d[b - 1][a - 1] = c;
        v.push_back(make_pair(c, P(a - 1, b - 1)));
    }
    warshall_floyd();
    ans = check();
    cout << m - ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int check()':
a.cc:28:10: error: declaration does not declare anything [-fpermissive]
   28 |     bool short;
      |          ^~~~~
a.cc:30:15: error: expected unqualified-id before '=' token
   30 |         short = true;
      |               ^
a.cc:32:18: error: expected primary-expression before 'short'
   32 |             if (!short) break;
      |                  ^~~~~
a.cc:32:18: error: expected ')' before 'short'
   32 |             if (!short) break;
      |                ~ ^~~~~
      |                  )
a.cc:35:26: error: expected unqualified-id before ')' token
   35 |                 if (short) res += 1;
      |                          ^
a.cc:36:23: error: expected unqualified-id before '=' token
   36 |                 short = false;
      |                       ^
Language: C++

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

const int INF = 1<<29;

const int MAX_V = 110;

const int MAX_E = 1100;

int N, M;

int a[MAX_E], b[MAX_E], c[MAX_E]; //各辺
int dist[MAX_V][MAX_V] //Warshall-Floyd用

int main(){
    cin >> N >> M;
    
    //Warshall-Floydでよくやる初期化
    
    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++){
            dist[i][j] = INF;
        }
        dist[i][i] = 0; //自分自身への距離は０
    } 
    
    //input
    for (int i = 0; i < M; i++){
        cin >> a[i] >> b[i] >> c[i];
        
        a[i]--, b[i]--;
        dist[a[i]][b[i]] = c[i];
        dist[b[i]][a[i]] = c[i];
    }
    
    // Warshall-floyd 
    for (int k = 0; k < N; k++){
        for (int i = 0; i < N; i++){
            for (int j = 0; j < N: j++){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    
    int res = 0;
    
    for (int i = 0 ; i < M; i++){
        if (c[i] > dist[a[i]b[i]]) res++;
    }
    cout << res << endl;
    
}

Compiler output:
a.cc:16:1: error: expected initializer before 'int'
   16 | int main(){
      | ^~~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef pair<int, pair<int, int>> PP;

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<PP>> r(n, vector<PP>());
  vector<vector<int>> l(n, vector<int>(n, INT_MAX));
  vector<int> u(m);
  for(int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    r.at(--a).push_back({--b, {c, i}});
    r.at(b).push_back({a, {c, i}});
  }
  priority_queue<PP, vector<PP>, greater<PP>> que;
  for(int i = 0; i < n; i++) {
    que.push(PP(i, P(0, -1)));
    l.at(i).at(i) = 0;
    while(que.size()) {
      PP p = que.top();
      que.pop();
      if(l.at(i).at(p.first) < p.second.first)
        continue;
      if(p.second.second >= 0)
        u.at(p.second.second) = 1;
      for(auto e : r.at(p.first)) {
        if(l.at(i).at(e.first) > p.second.first + e.second.first) {
          que.push(
              PP(e.first, P(p.second.first + e.second.first, e.second.second)));
          l.at(i).at(e.first) = p.second.first + e.second.first;
        }
      }
    }
  }
  int o = 0;
  for(int i = 0; i < m; i++)
    o += u[i];
  cout << m - o << endl;
}

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

import java.util.*;
import java.io.*;

//別解：最短経路か判定する部分
//エッジがいずれかの頂点間の最短経路であるかいなかの調べ方を
//各エッジについて、全ての出発点と全ての到着点を調べ、その最短経路に使われるか調べる方法

class Edge{
	int from, to, cost;

	public Edge(int from, int to, int cost) {
		super();
		this.from = from;
		this.to = to;
		this.cost = cost;
	}
	
}

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt(), m = fs.nextInt();
		int g[][] = new int[n][n];
		int inf = Integer.MAX_VALUE/2;
		for(int i=0;i<n;i++)for(int j=0;j<n;j++) {
			if(i==j)g[i][j]=0;
			else g[i][j] = inf;
		}
		
		Edge[] es = new Edge[m];
		
		for(int i=0;i<m;i++) {
			int a = fs.nextInt()-1, b = fs.nextInt()-1, c = fs.nextInt();
			g[a][b] = g[b][a] = c;
			es[i] = new Edge(a,b,c);
		}
			
		for(int k=0;k<n;k++) {
			for(int i=0;i<n;i++) {
				for(int j=0;j<n;j++) {
					g[i][j] = Math.min(g[i][j], g[i][k]+g[k][j]);
				}
			}
		}
		
		int cnt = 0;
		for(Edge e : es) {
			int from = e.from, to = e.to, cost = e.cost;
			boolean ok = false;
			for(int i=0;i<n;i++) {
				for(int j=0;j<n;j++) {
					if(g[i][j]==g[i][from] + cost + g[to][j])ok = true;
					else if(g[i][j]==g[i][to] + cost + g[from][j])ok=true;
				}
			}
			if(!ok)cnt++;
		}
		System.out.println(cnt);
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}


Compiler output:
Main.java:122: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

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

void dij(int V, int E, vector<vector<int> >a, int src, vector<bool> &c)
{
	int dist[V] = {INT_MAX};
  	dist[src] = 0;
  	for (int i = 1; i <= V - 1; i++) 
    { 
        for (int j = 0; j < E; j++) 
        { 
            int u = a[j][0]; 
            int v = a[j][1]; 
            int weight = a[j][2]; 
            if (dist[u] != INT_MAX && dist[u] + weight < dist[v])
            {
                dist[v] = dist[u] + weight;
              	c[j] = true;
            }
        } 
    }
}

int main()
{
  	int n, m;
  	cin>>n>>m;
  	vector<vector<int> >a(n, vector<int> (m, 0));
  	//vector<vector<bool> >vis(n, vector<int> (m, false));
  	for(int i = 0; i < n; i++)
    	for(int j = 0; j < m; j++)
          	cin>>a[i][j];
  	//memset(vis, false, sizeof(vis));
  	vector<bool> c(m, false);
  	bellman(n, m, a, 0, c);
  	int res = 0;
  	for(int i = 0; i < m; i++)
      	if(c[i] == false)
          	res++;
  	cout<<res<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: 'bellman' was not declared in this scope
   35 |         bellman(n, m, a, 0, c);
      |         ^~~~~~~
Language: C++

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

void dij(int V, int E, vector<vector<int> >a, int src, vector<bool> &c)
{
	int dist[V] = {INT_MAX};
  	dist[src] = 0;
  	for (int i = 1; i <= V - 1; i++) 
    { 
        for (int j = 0; j < E; j++) 
        { 
            int u = a[j][0]; 
            int v = a[j][1]; 
            int weight = a[j][2]; 
            if (dist[u] != INT_MAX && dist[u] + weight < dist[v])
            {
                dist[v] = dist[u] + weight;
              	c[j] = true;
            }
        } 
    }
}

int main()
{
  	int n, m;
  	cin>>n>>m;
  	vector<vector<int> >a(n, vector<int> (m, 0));
  	//vector<vector<bool> >vis(n, vector<int> (m, false));
  	for(int i = 0; i < n; i++)
    	for(int j = 0; j < m; j++)
          	cin>>a[i][j];
  	//memset(vis, false, sizeof(vis));
  	vector<bool> c(m, false);
  	bellman(n, m, a, vis, 0, c);
  	int res = 0;
  	for(int i = 0; i < m; i++)
      	if(c[i] == false)
          	res++;
  	cout<<res<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:26: error: 'vis' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |                          ^~~
a.cc:35:9: error: 'bellman' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |         ^~~~~~~
Language: C++

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

void dij(int V, int E, vector<vector<int> >a, int src, vector<bool> &c)
{
	int dist[V] = INT_MAX;
  	dist[src] = 0;
  	for (int i = 1; i <= V - 1; i++) 
    { 
        for (int j = 0; j < E; j++) 
        { 
            int u = a[j][0]; 
            int v = a[j][1]; 
            int weight = a[j][2]; 
            if (dist[u] != INT_MAX && dist[u] + weight < dist[v])
            {
                dist[v] = dist[u] + weight;
              	c[j] = true;
            }
        } 
    }
}

int main()
{
  	int n, m;
  	cin>>n>>m;
  	vector<vector<int> >a(n, vector<int> (m, 0));
  	//vector<vector<bool> >vis(n, vector<int> (m, false));
  	for(int i = 0; i < n; i++)
    	for(int j = 0; j < m; j++)
          	cin>>a[i][j];
  	//memset(vis, false, sizeof(vis));
  	vector<bool> c(m, false);
  	bellman(n, m, a, vis, 0, c);
  	int res = 0;
  	for(int i = 0; i < m; i++)
      	if(c[i] == false)
          	res++;
  	cout<<res<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'void dij(int, int, std::vector<std::vector<int> >, int, std::vector<bool>&)':
a.cc:6:23: error: array must be initialized with a brace-enclosed initializer
    6 |         int dist[V] = INT_MAX;
      |                       ^~~~~~~
a.cc: In function 'int main()':
a.cc:35:26: error: 'vis' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |                          ^~~
a.cc:35:9: error: 'bellman' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |         ^~~~~~~
Language: C++

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

void dij(int V, int E, vector<vector<int> >a, int src, vector<bool> &c)
{
	int dist[V] = INT_MAX;
  	dist[src] = 0;
  	for (int i = 1; i <= V - 1; i++) 
    { 
        for (int j = 0; j < E; j++) 
        { 
            int u = a[j][0]; 
            int v = a[j][1]; 
            int weight = a[j][2]; 
            if (dist[u] != INT_MAX && dist[u] + weight < dist[v])
            {
                dist[v] = dist[u] + weight;
              	c[j] = true;
            }
        } 
    }
}

int main()
{
  	int n, m;
  	cin>>n>>m;
  	vector<vetcor<int> >a(n, vector<int> (m, 0));
  	//vector<vector<bool> >vis(n, vector<int> (m, false));
  	for(int i = 0; i < n; i++)
    	for(int j = 0; j < m; j++)
          	cin>>a[i][j];
  	//memset(vis, false, sizeof(vis));
  	vector<bool> c(m, false);
  	bellman(n, m, a, vis, 0, c);
  	int res = 0;
  	for(int i = 0; i < m; i++)
      	if(c[i] == false)
          	res++;
  	cout<<res<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'void dij(int, int, std::vector<std::vector<int> >, int, std::vector<bool>&)':
a.cc:6:23: error: array must be initialized with a brace-enclosed initializer
    6 |         int dist[V] = INT_MAX;
      |                       ^~~~~~~
a.cc: In function 'int main()':
a.cc:28:16: error: 'vetcor' was not declared in this scope
   28 |         vector<vetcor<int> >a(n, vector<int> (m, 0));
      |                ^~~~~~
a.cc:28:26: error: template argument 1 is invalid
   28 |         vector<vetcor<int> >a(n, vector<int> (m, 0));
      |                          ^
a.cc:28:26: error: template argument 2 is invalid
a.cc:28:28: error: expected unqualified-id before '>' token
   28 |         vector<vetcor<int> >a(n, vector<int> (m, 0));
      |                            ^
a.cc:32:22: error: 'a' was not declared in this scope
   32 |                 cin>>a[i][j];
      |                      ^
a.cc:35:23: error: 'a' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |                       ^
a.cc:35:26: error: 'vis' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |                          ^~~
a.cc:35:9: error: 'bellman' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |         ^~~~~~~
Language: C++

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

void dij(int V, int E, vector<vector<int> >a, int src, vector<bool> &c)
{
	int dist[V] = INT_MAX;
  	dist[src] = 0;
  	for (int i = 1; i <= V - 1; i++) 
    { 
        for (int j = 0; j < E; j++) 
        { 
            int u = a[j][0]; 
            int v = a[j][1]; 
            int weight = a[j][2]; 
            if (dist[u] != INT_MAX && dist[u] + weight < dist[v])
            {
                dist[v] = dist[u] + weight;
              	c[j] = true;
            }
        } 
    }
}

int main()
{
  	int n, m;
  	cin>>n>>m;
  	vector<vetor<int> >a(n, vector<int> (m, 0));
  	//vector<vector<bool> >vis(n, vector<int> (m, false));
  	for(int i = 0; i < n; i++)
    	for(int j = 0; j < m; j++)
          	cin>>a[i][j];
  	//memset(vis, false, sizeof(vis));
  	vector<bool> c(m, false);
  	bellman(n, m, a, vis, 0, c);
  	int res = 0;
  	for(int i = 0; i < m; i++)
      	if(c[i] == false)
          	res++;
  	cout<<res<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'void dij(int, int, std::vector<std::vector<int> >, int, std::vector<bool>&)':
a.cc:6:23: error: array must be initialized with a brace-enclosed initializer
    6 |         int dist[V] = INT_MAX;
      |                       ^~~~~~~
a.cc: In function 'int main()':
a.cc:28:16: error: 'vetor' was not declared in this scope
   28 |         vector<vetor<int> >a(n, vector<int> (m, 0));
      |                ^~~~~
a.cc:28:25: error: template argument 1 is invalid
   28 |         vector<vetor<int> >a(n, vector<int> (m, 0));
      |                         ^
a.cc:28:25: error: template argument 2 is invalid
a.cc:28:27: error: expected unqualified-id before '>' token
   28 |         vector<vetor<int> >a(n, vector<int> (m, 0));
      |                           ^
a.cc:32:22: error: 'a' was not declared in this scope
   32 |                 cin>>a[i][j];
      |                      ^
a.cc:35:23: error: 'a' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |                       ^
a.cc:35:26: error: 'vis' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |                          ^~~
a.cc:35:9: error: 'bellman' was not declared in this scope
   35 |         bellman(n, m, a, vis, 0, c);
      |         ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#define MAX_V 104

int d[MAX_V][MAX_V]; //d[u][v]は辺e=(u,v)のコスト(存在しない場合はINF,d[i][i]=0)
int V; //頂点数
int nex[MAX_V][MAX_V]; //iからjへの最短経路におけるiの1つ後の点

ll path[MAX_V][MAX_V];

void warshall_floyd(){
    rep(i, 0, V){
        rep(j, 0, V){
            nex[i][j] = j;
        }
    }
    for(int k = 0; k < V; k++)
        for(int i = 0; i < V; i++)
            for(int j = 0; j < V; j++){
                if(d[i][k] + d[k][j] < d[i][j]){
                    d[i][j] = d[i][k] + d[k][j];
                    nex[i][j] = nex[i][k];
                }
            }
}

void print_path(int start, int goal){
    for(int cur = start; cur != goal; cur = nex[cur][goal]){
        path[cur][nex[cur][goal]] = 1;
        path[nex[cur][goal]][cur] = 1;
    }
    path[cur][nex[cur][goal]] = 1;
    path[nex[cur][goal]][cur] = 1;
}

int main(void){
    ll n, m;
    cin >> n >> m;

    V = n;

    rep(i, 0, V){
        rep(j, 0, V){
            path[i][j] = -1;
        }
    }

    rep(i, 0, m){
        ll a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        d[a][b] = c;
        d[b][a] = c;
        path[a][b] = 0;
    }

    warshall_floyd();
    rep(i, 0, V){
        rep(j, 0, V){
            print_path(i, j);
        }
    }

    ll sum = 0;
    rep(i, 0, V){
        rep(j, 0, V){
            if(path[i][j] == 0){
                sum++;
            }
        }
    }
    cout << sum << endl;
    return 0;

}


Compiler output:
a.cc: In function 'void print_path(int, int)':
a.cc:38:10: error: 'cur' was not declared in this scope
   38 |     path[cur][nex[cur][goal]] = 1;
      |          ^~~
Language: C++

int main(void){
2 const int inf = 100000000;
 3
3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
int n,m; cin>>n>>m;
int a[1000],b[1000],c[1000],dist[100][100];
for(inti=0;i< cin >> a[i] >> a[i]--,b[i]--;
}
for(inti=0;i< for(int j = 0;
m; ++i){
b[i] >> c[i];
n; ++i){ j<n;++j){
} }
if(i==j)
    dist[i][j]=0;
else
    dist[i][j]=inf;
for(inti=0;i<m;++i){ dist[a[i]][b[i]]=min(dist[a[i]][b[i]],c[i]); dist[b[i]][a[i]]=min(dist[b[i]][a[i]],c[i]);
}
for(intk=0;k<n;++k){ for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
} }
}
int ans=m; for(inti=0;i<m;++i){
        bool shortest=false;
        for(int j = 0; j < n; ++j) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
        if(shortest==true){
ans=ans-1; }
}
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:2: error: expected ';' before 'const'
    2 | 2 const int inf = 100000000;
      |  ^~~~~~
      |  ;
a.cc:3:3: error: expected ';' before numeric constant
    3 |  3
      |   ^
      |   ;
    4 | 3 4 5 6 7 8 9
      | ~  
a.cc:6:10: error: 'cin' was not declared in this scope
    6 | int n,m; cin>>n>>m;
      |          ^~~
a.cc:6:15: error: 'n' was not declared in this scope
    6 | int n,m; cin>>n>>m;
      |               ^
a.cc:6:18: error: 'm' was not declared in this scope
    6 | int n,m; cin>>n>>m;
      |                  ^
a.cc:8:5: error: 'inti' was not declared in this scope; did you mean 'int'?
    8 | for(inti=0;i< cin >> a[i] >> a[i]--,b[i]--;
      |     ^~~~
      |     int
a.cc:8:12: error: 'i' was not declared in this scope
    8 | for(inti=0;i< cin >> a[i] >> a[i]--,b[i]--;
      |            ^
a.cc:9:1: error: expected primary-expression before '}' token
    9 | }
      | ^
a.cc:8:44: error: expected ')' before '}' token
    8 | for(inti=0;i< cin >> a[i] >> a[i]--,b[i]--;
      |    ~                                       ^
      |                                            )
    9 | }
      | ~                                           
a.cc:9:1: error: expected primary-expression before '}' token
    9 | }
      | ^
a.cc: At global scope:
a.cc:10:1: error: expected unqualified-id before 'for'
   10 | for(inti=0;i< for(int j = 0;
      | ^~~
a.cc:10:12: error: 'i' does not name a type
   10 | for(inti=0;i< for(int j = 0;
      |            ^
a.cc:11:1: error: 'm' does not name a type
   11 | m; ++i){
      | ^
a.cc:11:4: error: expected unqualified-id before '++' token
   11 | m; ++i){
      |    ^~
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>

using namespace std;


int main(){

  int n,m,a[1000],b[1000],c[1000],dist[100][100],ans =0;
  cin >> n>> m;
  
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--,b[i]--;
     
  }
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j){
      dist[i][j] = 0;
      }
      else{
        dist[i][j] = 1e9;
      }
    }
  }
  
  
  for(int i=0;i<m;i++){
    
      dist[a[i]][b[i]] = min(dist[a[i]][b[i]],c[i]);
    dist[b[i]][a[i]] = min(dist[b[i]][a[i]],c[i]);
    
  }
  
 
  for (int k = 0; k < n; k++){       
    for (int i = 0; i < n; i++) {    
      for (int j = 0; j < n; j++) {  
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  
  for(int i=0;i<m;i++){
    bool ant = false;
    for(int j=0;j<n;j++){
    if(dist[j][a[i]] ==dist[a[i]][b[i]]-c[i]){
      ant = true;
    }
      if(ant){
        ans++;
      }
    }
  }
  
  cout << m-ans << endl;
}
  
  
  
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: 'd' was not declared in this scope
   42 |         d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      |         ^
Language: C++

#include <iostream>

using namespace std ;

int a[40], b[40], c[40];
int n, ma, mb;

int main(void){
    cin>>n;
    cin>>ma;
    cin>>mb;
    for(int i=0;i<n;i++){
        cin>>a[i];
        cin>>b[i];
        cin>>c[i];
    }
    int ans=search(0, 0, 0, 0);
    if(ans==10000) ans=-1;
    cout<<ans;
}

int search(int sumA, int sumB, int sumC, int st){
    if(st==n-1){
            if(sumA*mb==sumB*ma && sumA!=0) return sumC;
            else if((sumA+a[n-1])*mb==(sumB+b[n-1]*ma)) return sumC+c[n-1];
            else return 10000;
        }
        return min(search(sumA+a[st], sumB+b[st], sumC+c[st], st+1), search(sumA, sumB, sumC, st+1));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: no matching function for call to 'search(int, int, int, int)'
   17 |     int ans=search(0, 0, 0, 0);
      |             ~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate: 'template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> _ForwardIterator1 std::search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
 2332 |     search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note:   candidate expects 5 arguments, 4 provided
Language: C++

#include <cstdio>

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

using namespace std;

const int INF=1<<29;

int main(){
	int n,m,a[100],b[100],c[100];
	scanf("%d%d",&n,&m);
	rep(i,m) scanf("%d%d%d",&a[i],&b[i],&c[i]), a[i]--, b[i]--;

	int d[100][100];
	rep(u,n) rep(v,n) d[u][v]=d[v][u]=(u==v?0:INF);
	rep(i,m) d[a[i]][b[i]]=d[b[i]][a[i]]=c[i];

	rep(k,n) rep(i,n) rep(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);

	int ans=0;
	rep(i,m) if(c[i]>d[a[i]][b[i]]) ans++;
	printf("%d\n",ans);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:44: error: 'min' was not declared in this scope; did you mean 'main'?
   18 |         rep(k,n) rep(i,n) rep(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      |                                            ^~~
      |                                            main
Language: C++

#include <bits/stdc++.h>
#define l_ength size
const int inf = 1000000;
using ll = long long;
using namespace std;

struct edge{
	int from;
	int to;
	int cost;
};

int main(){
	int n, m; cin >> n >> m;
	int dist[n][n];
	vector<edge> graph;
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < n; ++j ){
			dist[i][j] = ( i == j ) ? 0 : INF;
		}
	}
	for( int i = 0; i < m; ++i ){
		int a, b, c; cin >> a >> b >> c; --a; --b;
		dist[a][b] = dist[b][a] = c;
		graph.push_back( ( edge ){ a, b, c } );
	}
	for( int k = 0; k < n; ++k ){
		for( int i = 0; i < n; ++i ){
			for( int j = 0; j < n; ++j ){
				/*
				ここで inf の足し算が行われることに注意
				1<<30 のとき inf+inf == 1<<31 でオーバーフローする
				*/
				dist[i][j] = min( dist[i][j], dist[i][k]+dist[k][j] );
			}
		}
	}
	/*
	使われない辺の必要条件: 辺 s → t について，d(s, t) < c(s, t) （⇔ その辺を使わない最短経路がある）
	この必要条件に入らない辺については d(s, t) = c(s, t) となるが，これは s → t のルートでこの辺を使うことを示している
	よって「ある辺が使われる ⇔ d(s, t) = c(s, t) 」が成り立ち，これをチェックすれば O(M) で計算できる
	*/
	int ans = 0;
	for( auto e : graph ) if( d[e.from][e.to] < e.cost ) ++ans;
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:55: error: 'INF' was not declared in this scope
   19 |                         dist[i][j] = ( i == j ) ? 0 : INF;
      |                                                       ^~~
a.cc:44:35: error: 'd' was not declared in this scope
   44 |         for( auto e : graph ) if( d[e.from][e.to] < e.cost ) ++ans;
      |                                   ^
Language: C++

#include <bits/stdc++.h>
#define l_ength size
using ll = long long;
const int inf = 1000000;
const int mod = 1000000007;
using namespace std;

struct edge{
	int from;
	int to;
	int cost;
};

int main(){
	int n, m; cin >> n >> m;
	int dist[n][n];
	vector<edge> graph;
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < n; ++j ){
			dist[i][j] = ( i == j ) ? 0 : infll;
		}
	}
	for( int i = 0; i < m; ++i ){
		int a, b, c; cin >> a >> b >> c; --a; --b;
		dist[a][b] = dist[b][a] = c;
		graph.push_back( ( edge ){ a, b, c } );
	}
	for( int k = 0; k < n; ++k ){
		for( int i = 0; i < n; ++i ){
			for( int j = 0; j < n; ++j ){
				dist[i][j] = min( dist[i][j], dist[i][k]+dist[k][j] );
			}
		}
	}
	int ans = 0;
	for( auto e : graph ){
		bool flag = false;
		for( int i = 0; i < n; ++i ){
			for( int j = i+1; j < n; ++j ){
				// この条件は「i → j の最短距離に辺 e が使われる」と同値
				if( dist[i][e.from]+e.cost+dist[e.to][j] == dist[i][j] || dist[i][e.to]+e.cost+dist[e.from][j] == dist[i][j] ){
					flag = true;
				}
			}
		}
		if( !flag ) ++ans;
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:55: error: 'infll' was not declared in this scope; did you mean 'inf'?
   20 |                         dist[i][j] = ( i == j ) ? 0 : infll;
      |                                                       ^~~~~
      |                                                       inf
Language: C++

#include <bits/stdc++.h>
#define l_ength size
using ll = long long;
using namespace std;
const int inf = 1000000;

struct edge{
	int from;
	int to;
	int cost;
};

int main(){
	int n, m; cin >> n >> m;
	int dist[n][n];
	vector<edge> graph;
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < n; ++j ){
			dist[i][j] = INF;
		}
	}
	for( int i = 0; i < n; ++i ) dist[i][i] = 0;
	for( int i = 0; i < m; ++i ){
		int a, b, c; cin >> a >> b >> c; --a; --b;
		dist[a][b] = dist[b][a] = c;
		graph.push_back( ( edge ){ a, b, c } );
	}
	for( int k = 0; k < n; ++k ){
		for( int i = 0; i < n; ++i ){
			for( int j = 0; j < n; ++j ){
				dist[i][j] = min( dist[i][j], dist[i][k]+dist[k][j] );
			}
		}
	}
	int ans = 0;
	for( auto e : graph ){
		bool flag = false;
		for( int i = 0; i < n; ++i ){
			for( int j = i+1; j < n; ++j ){
				// この条件は「i → j の最短距離に辺 e が使われる」と同値
				if( dist[i][e.from]+e.cost+dist[e.to][j] == dist[i][j] ){
					flag = true;
					goto endloop;
				}
			}
		}
		endloop:
		if( !flag ) ++ans;
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:38: error: 'INF' was not declared in this scope
   19 |                         dist[i][j] = INF;
      |                                      ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = pow(10, 7);
int main(){
  int n, m;cin>>n>>m;
  vector<vector<int>> dis(n, vector<int>(n, INF));
  vector<pair<P, int>> edge(m);
  for(int i=0;i<m;i++){
    int a, b, c;cin>>a>>b>>c;a--;b--;
    dis[a][b]=dis[b][a]=c;
    edge[i]=make_pair(P(a, b), c);
  }
  for(int i=0;i<n;i++)dis[i][i]=0;
  for(int k=0;i<n;k++){
  	for(int i=0;j<n;i++){
      for(int j=0;k<n;j++){
        if(dis[i][k]==INF || dis[k][j]==INF)continue;
        dis[i][j] = min(dis[i][j], dis[i][k]+dis[k][j]);
      }
    }
  }
  int ans=m;
  for(int i=0;i<m;i++){
    bool used=false;
    for(int j=0;j<n;j++){
      if(dis[j][edge[i].first.first]==dis[j][edge[i].first.second]+edge[i].second)used=true;
    }
    if(used)ans--;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'i' was not declared in this scope
   16 |   for(int k=0;i<n;k++){
      |               ^
a.cc:17:21: error: 'j' was not declared in this scope
   17 |         for(int i=0;j<n;i++){
      |                     ^
Language: C++

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

int inf = 10000001;

int main(){
    int n, m;cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    vector<int> c(m);
    vector<vector<int> > dp(n+1, vector<int>(n+1));
    for(int i = 0; i<m;i++){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;b[i]--
    }
    for(int i = 0; i<n;i++){
        for(int l = 0; l < n; l++){
            if(i == l){dp[i][l] = 0;}
            else{dp[i][l] = inf;}
        }
    }
    for(int i = 0; i<m;i++){
        dp[a[i]][b[i]] = c[i];
        dp[b[i]][a[i]] = c[i];
    }
    for(int k = 0; k<n;k++){
        for(int i = 0; i<n;i++){
            for(int l = 0; l<n; l++){
                dp[i][l] = min(dp[i][l], dp[i][k]+dp[k][l]);
            }
        }
    }
    int ans = n;
    int j = 0;
    for(int i = 0; i<m; i++){
        j = 0;
        for(int l = 0; l<n; l++){
            if(dp[l][a[i]] + c[i] == dp[l][b[i]]){j = 1;}   
        }
        if(j == 1){ans--;}
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: expected ';' before '}' token
   14 |         a[i]--;b[i]--
      |                      ^
      |                      ;
   15 |     }
      |     ~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}



bool used[100][100];

// O(V^3)
void warshall_floyd(int n, vector<vector<int> > &g) {
    for(int k = 0; k < n; ++k)
        for(int i = 0; i < n; ++i)
            for(int j = 0; j < n; ++j) {
                if(chmin(g[i][j], g[i][k] + g[k][j])) {
                    used[i][j] = false;
                    used[i][k] = true;
                    used[k][j] = true;
                }
            }
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll n,m; cin >> n >> m;
    vector<vector<int> > g(n,vector<int>(n,1e9));
    int as[100], bs[100];
    for(int i=0; i < m; ++i){
        int a,b,c;
        cin >> a >> b >> c;
        --a; --b;
        g[a][b] = c;
        g[b][a] = c;
        as[i] = a;
        bs[i] = b;
    }
    warshall_floyd(n, g);

    int ans = 0;
    for(int i=0; i < m; ++i) {
        if(!used[as[i]][bs[i]]) ++ans;
    }

    cout << ans << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'll' was not declared in this scope
   27 |     ll n,m; cin >> n >> m;
      |     ^~
a.cc:27:20: error: 'n' was not declared in this scope
   27 |     ll n,m; cin >> n >> m;
      |                    ^
a.cc:27:25: error: 'm' was not declared in this scope; did you mean 'tm'?
   27 |     ll n,m; cin >> n >> m;
      |                         ^
      |                         tm
Language: C++

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

void warshall_floyd(int n, vector<vector<int> > &g) {
    for(int k = 0; k < n; ++k)
        for(int i = 0; i < n; ++i)
            for(int j = 0; j < n; ++j) g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll n,m; cin >> n >> m;
    vector<vector<int> > g(n,vector<int>(n));
    map<pair<int,int>,int> mp;
    for(int i=0; i < m; ++i){
        int a,b,c;
        cin >> a >> b >> c;
        --a; --b;
        g[a][b] = c;
        g[b][a] = c;
        mp[make_pair(a,b)] = c;
    }
    warshall_floyd(n, g);

    int ans = 0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if(g[itr->first.first][itr->first.second] != itr->second) ++ans;
    }

    cout << ans << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'll' was not declared in this scope
   15 |     ll n,m; cin >> n >> m;
      |     ^~
a.cc:15:20: error: 'n' was not declared in this scope
   15 |     ll n,m; cin >> n >> m;
      |                    ^
a.cc:15:25: error: 'm' was not declared in this scope; did you mean 'tm'?
   15 |     ll n,m; cin >> n >> m;
      |                         ^
      |                         tm
Language: C++

#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
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);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int N,M;
	cin>>N>>M;
	int INF=1<<29;
	vector<int> a(M),b(M),c(M);
	vector<vector<int>> dist(N,vector<int>(N,INF));
	rep(i,M){
		cin>>a[i]>>b[i]>>c[i];
		a[i]--;b[i]--;
		dist[a[i]][b[i]]=c[i];
		dist[b[i]][a[i]]=c[i];
	}
	rep(k,N) rep(i,N) rep(j,N){
		if(dist[i][j]>dist[i][k]+dist[k][j]) dist[i][j]=dist[i][k]+dist[k][j];
	}
	int ans=M;
	rep(i,M){
		bool shortest=false;
		rep(j,n) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
		if(shortest) ans--;
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:23: error: 'n' was not declared in this scope
   72 |                 rep(j,n) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
      |                       ^
a.cc:5:38: note: in definition of macro 'repi'
    5 | #define repi(i,a,b) for(int i=(a);i<(b);++i)
      |                                      ^
a.cc:3:39: note: in expansion of macro '_rep'
    3 | #define _overload3(_1,_2,_3,name,...) name
      |                                       ^~~~
a.cc:72:17: note: in expansion of macro 'rep'
   72 |                 rep(j,n) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
      |                 ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int INF = 100100100;
const int MAX_V = 1100;
int cost[MAX_V][MAX_V];
int d[MAX_V];
bool used[MAX_V];
int V;
int previ[MAX_V];

void dijkstra(int s){
    fill(d, d+V, INF);
    fill(used, used+V, false);
    fill(previ, previ+V, -1);
    d[s] = 0;

    while(true){
        int v = -1;
        rep(u,V){
            if(!used[u] && (v==-1 || d[u]<d[v]))v=u;
        }
        if(v==-1)break;
        used[v] = true;

        for(int u=0;u<V;u++){
            if(d[u]>d[v]+cost[v][u]){
                d[u] = d[v] + cost[v][u];
                previ[u] = v;
            }
        }
    }
}

vector<int> get_path(int t){
    vector<int> path;
    for(;t!=-1;t=previ[t])path.push_back(t);
    reverse(path.begin(), path.end());
    return path;
}

int main() {
    cin >> V;
    rep(i,V){
        rep(j,V){
            if(i==j){
                cost[i][j] = 0;
            }else{
                cost[i][j] = INF;
            }
        }
    }
    int E;
    rep(i,E){
        int from,to,c;
        cin >> from >> to >> c;
        from--;
        to--;
        cost[from][to] = c;
        cost[to][from] = c;
    }

    flag[V][V];
    rep(i,V){
        rep(j,V){
            flag[i][j] = 0;
        }
    }

    rep(i,V){
        dijkstra(i);
        rep(j,V){
            vi v = get_path(j);
            int from = i;
            rep(k,v.size()){
                flag[from][v[k]] = 1;
                from = v[k];
            }
        }
    }

    int ans = 0;
    rep(i,V){
        rep(j,V){
            if(i!=j && cost[i][j]!=INF){
                if(flag[i][j]==0)ans++;
            }
        }
    }

    cout << ans/2 << endl;

    return 0;
}
 
 


Compiler output:
a.cc: In function 'int main()':
a.cc:75:5: error: 'flag' was not declared in this scope
   75 |     flag[V][V];
      |     ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
const int M=100010;
int INF=1000000007;
using ll=long long;



int main(){
	int n,m;
	int a[110],b[110],c[110];
	cin>>n>>m;
	int dis[110][110]={};
	//ワーシャルフロイド法;
	rep(i,0,n){
		rep(j,0,n){
			if(i!=j)dis[i][j]=dis[j][i]=INF;
		}
	}
	rep(i,0,m){
		cin>>a[i]>>b[i]>>c[i];
		a[i]--,b[i]--;
		dis[a[i]][b[i]]=min(dis[a[i]][b[i]],c[i]);
		dist[b[i]][a[i]]=min(dis[b[i]][a[i]],c[i]);
	}
	rep(k,0,n){
		rep(i,0,n){
			rep(j,0,n){
				dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
			}
		}
	}
	//ワーシャルフロイド法により,
	//全ての経路を最短化した.
	//この時、j==a[i]ならa[i]→b[i]が最短経路となっている;
	int ans=m;
	rep(i,0,m){
		bool f=false;
		rep(j,0,n)if(dis[j][a[i]]+c[i]==dis[j][b[i]])f=true;
		if(f)ans--;
	}
	cout<<ans<<endl;
}
	

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: 'dist' was not declared in this scope; did you mean 'dis'?
   26 |                 dist[b[i]][a[i]]=min(dis[b[i]][a[i]],c[i]);
      |                 ^~~~
      |                 dis
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> path(110,vector<int>(110,-1));
int shorter(int s,int e){
  if(path[s][e] == -1) return 0;
  int MIN = path[s][e];
  for(int i = 0;i < 110;i++){
    if(path[s][i]==-1)break;
    else{
      MIN = min(MIN,shorter(i,e));
    }
  }
  if(MIN < path[s][e])return 1;
  else 0;
}  
int main(){
  int n,m;
  cin >> n >> m;
  int ans = 0;
  for(int i = 0;i < m;i++){
    int a,b,c;
    cin >> a >> b >> c;
    path[a][b] = c;
    path[b][a] = c;
  }
  for(int i = 1;i <= n;i++){
    path[i][i] = 0;
  }    
  for(int i = 1;i <= n;i++){
    for(int j = 1 < i;j++){
      ans += shorter(i,j);
    }
  }
  cout << ans << endl;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:30:26: error: expected ';' before ')' token
   30 |     for(int j = 1 < i;j++){
      |                          ^
      |                          ;
a.cc: In function 'int shorter(int, int)':
a.cc:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^
Language: C++

#include <stdio.h>
using namespace std;
int main(void)
{
    const int inf = 100000000;

    int n, m;
    cin >> n >> m;

    int a[1000], b[1000], c[1000], dist[100][100];

    for (int i = 0; i < m; ++i)
    {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            if (i == j)
            {
                dist[i][j] = 0;
            }
            else
            {
                dist[i][j] = inf;
            }
        }
    }

    for (int i = 0; i < m; ++i)
    {
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    for (int k = 0; k < n; ++k)
    {
        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < n; ++j)
            {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = m;
    for (int i = 0; i < m; ++i)
    {
        bool shortest = false;
        for (int j = 0; j < n; ++j)
        {
            if (dist[j][a[i]] + c[i] == dist[j][b[i]])
            {

                shortest = true;
            }
        }
        if (shortest == true)
        {
            ans = ans - 1;
        }
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> n >> m;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:35:28: error: 'min' was not declared in this scope; did you mean 'main'?
   35 |         dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
      |                            ^~~
      |                            main
a.cc:45:30: error: 'min' was not declared in this scope; did you mean 'main'?
   45 |                 dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      |                              ^~~
      |                              main
a.cc:68:5: error: 'cout' was not declared in this scope
   68 |     cout << ans << endl;
      |     ^~~~
a.cc:68:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:68:20: error: 'endl' was not declared in this scope
   68 |     cout << ans << endl;
      |                    ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <stdio.h>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

int main(void)
{
    const int inf = 100000000;

    int n, m;
    cin >> n >> m;

    int a[1000], b[1000], c[1000], dist[100][100];

    for (int i = 0; i < m; ++i)
    {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            if (i == j)
            {
                dist[i][j] = 0;
            }
            else
            {
                dist[i][j] = inf;
            }
        }
    }

    for (int i = 0; i < m; ++i)
    {
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    for (int k = 0; k < n; ++k)
    {
        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < n; ++j)
            {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = m;
    for (int i = 0; i < m; ++i)
    {
        bool shortest = false;
        for (int j = 0; j < n; ++j)
        {
            if (dist[j][a[i]] + c[i] == dist[j][b[i]])
            {

                shortest = true;
            }
        }
        if (shortest == true)
        {
            ans = ans - 1;
        }
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> n >> m;
      |     ^~~
a.cc:33:28: error: 'min' was not declared in this scope; did you mean 'main'?
   33 |         dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
      |                            ^~~
      |                            main
a.cc:43:30: error: 'min' was not declared in this scope; did you mean 'main'?
   43 |                 dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      |                              ^~~
      |                              main
a.cc:66:5: error: 'cout' was not declared in this scope
   66 |     cout << ans << endl;
      |     ^~~~
a.cc:66:20: error: 'endl' was not declared in this scope
   66 |     cout << ans << endl;
      |                    ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>

#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define for1(i, n) for (int i = 1; i <= (int)n; ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF (1 << 30)

using namespace std;

typedef long long i64;
typedef vector<int> vi;
typedef vector<i64> vi64;
typedef vector<vi> vvi;
typedef vector<vi64> vvi64;
typedef double ld;

int d[100][100];

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int N, M;
    cin >> N >> M;

    memset(d, INF, sizeof(d[0][0]) * 100 * 100);

    vi a(M), b(M), c(M);
    forn(i, M) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;

        d[a[i]][b[i]] = c[i];
        d[b[i]][a[i]] = c[i];
    }


    forn(k, N) {
      forn(i, N) {
        forn(j, N) {
          d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
      }
    }

    int ans = 0;
    forn(k, M) {
      if (d[a[k]][b[k]] != c[k]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: 'memset' was not declared in this scope
   37 |     memset(d, INF, sizeof(d[0][0]) * 100 * 100);
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 |