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

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define dist(u,v) ((abs(u.x-v.x) + abs(u.y-v.y)))
#define eql(u,v) (u.x == v.x && v.y == u.y)
#define validV(u) (abs(u.x) <= 2000 && abs(u.y) <= 2000)

typedef struct _pair{
    int x, y, d;
}pair;

void go(pair orig, pair u, pair dest);

int abs(int n) {
    return (n > 0) ? n : -n;
}

pair dir[4] = {{0,1,'U'}, {1,0,'R'}, {-1,0,'L'}, {0,-1,'D'}};
int g[2001][2001];
pair s, d;
int vis = 0;
int c = 0;

float euclid(pair u, pair v) {
    return sqrt((u.x-v.x)*(u.x-v.x) + (u.y-v.y)*(u.y-v.y));
}

int main() {
    scanf("%d %d %d %d",&s.x, &s.y, &d.x, &d.y);
    int i, j;
    for ( i = 0; i < 2001 i++) {
        for ( j=0; j < 2001; j++) {
            g[i][j] = 0;
        }
    }
    s.x += 1000;
    s.y += 1000;
    d.x += 1000;
    d.y += 1000;
    int dirX = (d.x-s.x)/abs(d.x-s.x);
    int dirY = (d.y-s.y)/abs(d.y-s.y);
    char dy1, dx1, dy2, dx2;
    dy1 = (dirY>0) ? 'U' : 'D';
    dx1 = (dirX>0) ? 'R' : 'L';
    dy2 = (dirY>0) ? 'D' : 'U';
    dx2 = (dirX>0) ? 'L' : 'R';
    int p, q;
    for (p = s.y; p != d.y; p+=dirY) {
        g[s.x][p] = 1;
        printf("%c",dy1);
    }
    for (q = s.x; q != d.x; q+=dirX) {
        g[q][p] = 1;
        printf("%c",dx1);
    }

    for (p = d.y; p != s.y; p-=dirY) {
        g[d.x][p] = 1;
        printf("%c",dy2);
    }
    for (q = d.x; q != s.x; q-=dirX) {
        g[q][p] = 1;
        printf("%c",dx2);
    }
    
    go(s,s,d);

    printf("\n");
    return 0;
}


void go(pair orig, pair u, pair dest) {
    pair a[4];

    if (eql(dest,u)) {
        //reached destination
        go(dest,dest,orig);
        return;
    }
    g[u.x][u.y] = 1;
    int min = 10000, minI = -1;
    int i;
    for (i = 0; i < 4; i++) {
        a[i].x = u.x + dir[i].x;
        a[i].y = u.y + dir[i].y;
        a[i].d = dist(a[i],dest);
        if (validV(a[i]) && (g[a[i].x][a[i].y] == 0 || eql(dest,a[i]))) {
            if (a[i].d < min) {
                min = a[i].d;
                minI = i;
            } else if ( a[i].d == min) {
                //if the current minimum lies on the same line choose the other option
                if ((a[minI].x - dest.x == 0) || (a[minI].y - dest.y == 0)) {
                    minI = i;
                } else if ( euclid(a[i],dest) < euclid(a[minI], dest)) {
                    minI = i;
                }
            }
        }
    }
    //if we have somewhere to go...
    if (minI != -1) {
        printf("%c",dir[minI].d);
        go(orig, a[minI], dest);
    }
}


Compiler output:
main.c: In function 'main':
main.c:33:26: error: expected ';' before 'i'
   33 |     for ( i = 0; i < 2001 i++) {
      |                          ^~
      |                          ;
Language: C++

#define SORT(v) sort(v.begin(), v.end())
#include "iostream"
#include "map"
#include "vector"
#include <stack>
#include "cstdlib"
#include <algorithm>
#include <cstdarg>
#include "ane.cpp"

#define INF (int)1e9
#define NMAX 200
#define MMAX 200
#define MOD 100000
using namespace std;

// コメントアウトするとdb_printf()を実行しない
#define DEBUG
// デバッグ用printf
void db_printf(const char* format, ...){
    #ifndef DEBUG
    return;
    #endif
    va_list arg;
    va_start(arg, format);
    vprintf(format, arg);  // コンソールに出力
    va_end(arg);
}
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
typedef pair<int, int> P;

int N,M,dp[NMAX][MMAX] = {};
int sx,sy,gx,gy;
std::vector<char> xmove = {'R', 'L'}, ymove = {'U', 'D'};

static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

string ans = "";

void solve(){
    // 解答アルゴリズム
    // 往路
    for (int i = 0; i < gy-sy; ++i)
    {
        ans += ymove[0];
    }
    for (int i = 0; i < gx-sx; ++i)
    {
        ans += xmove[0];
    }
    // 復路
    for (int i = 0; i < gy-sy; ++i)
    {
        ans += ymove[1];
    }
    for (int i = 0; i < gx-sx; ++i)
    {
        ans += xmove[1];
    }
    // 往路2
    ans += xmove[1];
    for (int i = 0; i < gy-sy+1; ++i)
    {
        ans += ymove[0];
    }
    for (int i = 0; i < gx-sx+1; ++i)
    {
        ans += xmove[0];
    }
    ans += ymove[1];
    // 復路2
    ans += xmove[0];
    for (int i = 0; i < gy-sy+1; ++i)
    {
        ans += ymove[1];
    }
    for (int i = 0; i < gx-sx+1; ++i)
    {
        ans += xmove[1];
    }
    ans += ymove[0];
}
void debug(){
    // デバッグ用出力
}
void answer(){
    // 解答出力
    cout << ans << endl;
}
int main(int argc, char const *argv[])
{
    // 入力の読み込み，番兵法
    ios::sync_with_stdio(false);

    Fill(dp, -1);

    cin >> sx >> sy >> gx >> gy;

    solve();
    #ifdef DEBUG
    debug();
    #endif
    answer();

    return 0;
}

Compiler output:
a.cc:9:10: fatal error: ane.cpp: No such file or directory
    9 | #include "ane.cpp"
      |          ^~~~~~~~~
compilation terminated.
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		String[] str = br.readLine().split(" ");
		int sx = Integer.parseInt(str[0]);
		int sy = Integer.parseInt(str[1]);
		int tx = Integer.parseInt(str[2]);
		int ty = Integer.parseInt(str[3]);

		int x = tx - sx;
		int y = ty - sy;
		StringBuilder sbx = new StringBuilder();
		StringBuilder sby = new StringBuilder();
		StringBuilder sbx_ = new StringBuilder();
		StringBuilder sby_ = new StringBuilder();
		for(int i = 0; i < x; i++){
			sbx.append('R');
			sbx_.append('L');
		}
		for(int i = 0; i < y; i++){
			sby.append('U');
			sby_.append('D');
		}


		sb.append(sbx.toString()).append(sby.toString())
		sb.append(sbx_.toString()).append(sby_.toString());
		sb.append('D').append('R').append(sbx.toString()).append(sby.toString()).append('U').append('L');
		sb.append('U').append('L').append(sbx_.toString()).append(sby_.toString()).append('D').append('R');

		System.out.println(sb);
	}
}

Compiler output:
Main.java:34: error: ';' expected
		sb.append(sbx.toString()).append(sby.toString())
		                                                ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int sx,sy,tx,ty,i;
  cin>>sx>>sy>>tx>>ty;
  xsa=tx-sx;
  ysa=ty-sy;
  for(i=0; i<ysa; i++){
    cout<<'U';
  }
  for(i=0;i<xsa; i++){
    cout<<'R';
  }
  for(i=0; i<ysa; i++){
    cout<<'D';
  }
  for(i=0; i<=xsa; i++){
    cout<<'L';
  }
  for(i=0; i<=ysa; i++){
    cout<<'U';
  }
  for(i=0; i<=xsa; i++){
    cout<<'R';
  }
  cout<<"DR";
  for(i=0; i<=ysa; i++){
    cout<<'D';
  }
  for(i=0; i<=xsa; i++){
    cout<<'L';
  }
  cout'U';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'xsa' was not declared in this scope
    6 |   xsa=tx-sx;
      |   ^~~
a.cc:7:3: error: 'ysa' was not declared in this scope
    7 |   ysa=ty-sy;
      |   ^~~
a.cc:33:7: error: expected ';' before 'U'
   33 |   cout'U';
      |       ^~~
      |       ;
Language: C

#include <stdio.h>

#define printCN(c, n) { while(n>0){ putchar(c); n--; } }

int main()
{
 int sx, sy, tx, ty;
 scanf("%d%d%d%d", &sx, &sy, &tx, &ty);

 printCN('U', ty-sy);
 printCN('R', tx-sx);
 printCN('D', ty-sy);
 printCN('L', tx-sx);

 putchar('L');
 printCN('U', ty-sy+1);
 printCN('R', tx-sx+1);
 putchar('D');
 putchar('R');
 printCN('D', ty-sy+1);
 printCN('L', tx-sx+1);
 putchar('U');
 
 return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:50: error: lvalue required as decrement operand
    3 | #define printCN(c, n) { while(n>0){ putchar(c); n--; } }
      |                                                  ^~
main.c:16:2: note: in expansion of macro 'printCN'
   16 |  printCN('U', ty-sy+1);
      |  ^~~~~~~
main.c:3:50: error: lvalue required as decrement operand
    3 | #define printCN(c, n) { while(n>0){ putchar(c); n--; } }
      |                                                  ^~
main.c:17:2: note: in expansion of macro 'printCN'
   17 |  printCN('R', tx-sx+1);
      |  ^~~~~~~
main.c:3:50: error: lvalue required as decrement operand
    3 | #define printCN(c, n) { while(n>0){ putchar(c); n--; } }
      |                                                  ^~
main.c:20:2: note: in expansion of macro 'printCN'
   20 |  printCN('D', ty-sy+1);
      |  ^~~~~~~
main.c:3:50: error: lvalue required as decrement operand
    3 | #define printCN(c, n) { while(n>0){ putchar(c); n--; } }
      |                                                  ^~
main.c:21:2: note: in expansion of macro 'printCN'
   21 |  printCN('L', tx-sx+1);
      |  ^~~~~~~
Language: C

#include<stdio.h>

int main(){
	int x,y,sx,sy,tx,ty,i;
	scanf("%d %d %d %d",&sx,&xy,&tx,&ty);
	x=tx-sx;
	y=ty-sy;
	for(i=0;i<x;i++) printf("U");
	for(i=0;i<y;i++) printf("R");
	for(i=0;i<x;i++) printf("D");
	for(i=0;i<=y;i++) printf("L");
	for(i=0;i<=x;i++) printf("U");
	for(i=0;i<=y;i++) printf("R");
	printf("DR");
	for(i=0;i<=x;i++) printf("D");
	for(i=0;i<=y;i++) printf("L");
	printf("U\n");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:34: error: 'xy' undeclared (first use in this function); did you mean 'ty'?
    5 |         scanf("%d %d %d %d",&sx,&xy,&tx,&ty);
      |                                  ^~
      |                                  ty
main.c:5:34: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

public class Main {
    public static void main(String[] args) {
        int sx, sy, tx, ty;

        Scanner s = new Scanner(System.in);
        sx = s.nextInt();
        sy = s.nextInt();
        tx = s.nextInt();
        ty = s.nextInt();

        int i;
        for (i = 0; i < ty - sy; i++) {
            System.out.print("U");
        }
        for (i = 0; i < tx - sx; i++) {
            System.out.print("R");
        }
        for (i = 0; i < ty - sy; i++) {
            System.out.print("D");
        }
        for (i = 0; i < tx - sx; i++) {
            System.out.print("L");
        }
        System.out.print("L");
        for (i = 0; i <= ty - sy; i++) {
            System.out.print("U");
        }
        for (i = 0; i <= tx - sx; i++) {
            System.out.print("R");
        }
        System.out.print("DR");
        for (i = 0; i <= ty - sy; i++) {
            System.out.print("D");
        }
        for (i = 0; i <= tx - sx; i++) {
            System.out.print("L");
        }
        System.out.print("U");
    }

}

Compiler output:
Main.java:5: error: cannot find symbol
        Scanner s = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner s = new Scanner(System.in);
                        ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C

$/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U

Compiler output:
main.c:1:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before '/=' token
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |  ^~
main.c:1:8: warning: data definition has no type or storage class
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |        ^
main.c:1:8: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:10: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |          ^
main.c:1:12: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |            ^
main.c:1:14: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |              ^
main.c:1:16: error: '$' undeclared here (not in a function)
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |                ^
main.c:1:18: error: expected expression before '.' token
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |                  ^
main.c:1:30: warning: data definition has no type or storage class
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |                              ^
main.c:1:30: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
main.c:1:32: error: initializer element is not constant
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |                                ^
main.c:1:36: warning: data definition has no type or storage class
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |                                    ^
main.c:1:36: error: type defaults to 'int' in declaration of 'y' [-Wimplicit-int]
main.c:1:38: error: initializer element is not constant
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |                                      ^
main.c:1:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before '?' token
    1 | $/=' ';a,b,c,d=$<.map &:to_i;x=c-a;y=d-b;puts ?U*y+?R*x+?D*(y+=1)+?L*(x+=1)+?U*y+?R*x+?D+?R+?D*y+?L*x+?U
      |                                               ^
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <bitset>
#include <map>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool visited[2020][2020];
int main(){
	int sx, sy, tx, ty;
	memset(visited, 0, sizeof visited);
	cin >> sx >> sy >> tx >> ty;
	REP(i, abs(tx-sx)){
		if(tx > sx) cout << "R";
		else cout << "L";
	}
	REP(i, abs(ty-sy)){
		if(ty > sy) cout << "U";
		else cout << "D";
	}
	REP(i, abs(tx-sx)){
		if(tx > sx) cout << "L";
		else cout << "R";
	}
	REP(i, abs(ty-sy)){
		if(ty > sy) cout << "D";
		else cout << "U";
	}
	if(tx > sx) cout << "L";
	else cout << "R";
	REP(i, abs(ty-sy)+1){
		if(ty > sy) cout << "U";
		else cout << "D";
	}
	REP(i, abs(tx-sx)+1){
		if(tx > sx) cout << "R";
		else cout << "L";
	}
	if(ty > sy) cout << "D";
	else cout << "U";
	if(tx > sx) cout << "R";
	else cout << "L";
	REP(i, abs(ty-sy)+1){
		if(ty > sy) cout << "D";
		else cout << "U";
	}
	REP(i, abs(tx-sx)+1){
		if(tx > sx) cout << "L";
		else cout << "R";
	}
	if(ty > sy) cout << "U";
	else cout << "D";
	cout << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define se second
#define fi first
#define mp make_pair
#define pb push_back
#define ll long long
const int MAXN = (int)1e7 + 1000;
const int N = 105;
const int mod = (int)1e9 + 7;
const int INF = (int)1e9;
int d[N][N];
struct edge{
    int u,v,c;
};
edge e[N];
bool ok(int number, int v1,int v2){
    return (d[v1][e[number].u] + d[e[number].v][v2] + e[number].c == d[v1][v2]);
}
int main(){
    // ifstream cin("input.txt");
    // ofstream cout("output.txt");
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin >> n >> m;
    for(int i = 0;i <= 101;i++){
        for(int j = 0;j <= 101;j++){
            d[i][j] = INF;
        }
    }
    int ans = 0;
    for(int i = 1;i <= m;i++){
        cin >> e[i].u >> e[i].v >> e[i].c;
        if(d[e[i].u][e[i].v] > e[i].c){
            d[e[i].u][e[i].v] = e[i].c;
            d[e[i].v][e[i].u] = e[i].c;
        }
    }
    for(int i = 1;i <= m;i++){
        if(e[i].c != d[e[i].u][e[i].v]){
            e[i] = INF;
        }
    }
    for(int i = 1;i <= n;i++)d[i][i] = 0;
    for(int k = 1;k <= n;k++){
        for(int i = 1;i <= n;i++){
            for(int j = 1;j <= n;j++){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    for(int i = 1;i <= m;i++){
        if(e[i].u == e[i].v || e[i].c == INF){
            ans++;
            continue;
        }
        bool need = 0;
        for(int j = 1;j <= n;j++){
            for(int k = 1;k <= n;k++){
                if(ok(i, j, k) || ok(i, k, j)){
                    need = 1;
                    break;
                }
            }
        }
        ans += (!need);
    }
    cout << ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:20: error: no match for 'operator=' (operand types are 'edge' and 'const int')
   44 |             e[i] = INF;
      |                    ^~~
a.cc:14:8: note: candidate: 'constexpr edge& edge::operator=(const edge&)'
   14 | struct edge{
      |        ^~~~
a.cc:14:8: note:   no known conversion for argument 1 from 'const int' to 'const edge&'
a.cc:14:8: note: candidate: 'constexpr edge& edge::operator=(edge&&)'
a.cc:14:8: note:   no known conversion for argument 1 from 'const int' to 'edge&&'
Language: C++

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define ll long long
#define ld long double

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)

#define pii pair<int, int>
#define pll pair<ll, ll>

#define fi first
#define se second

#define pb push_back
#define eb emplace_back

#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()

#define endl '\n'
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const int MOD=1e9+7;
const ll INF=1e18;
const double PI=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

int dist[110][110];
int pre[110][110];
int use[110][110];


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  int n, m;
  cin >> n >> m;
  
  rep(i,n)rep(j,n){
    dist[i][j]=MOD;
    pre[i][j]=i;
  }
  
  vector<int>a(n),b(n),c(n);
  rep(i,m){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
    
    dist[a[i]][b[i]]=c;
    dist[b[i]][a[i]]=c;
    
    use[a[i]][b[i]]++;
    use[b[i]][a[i]]++;
  }
  rep(k,n)rep(i,n)rep(j,n){
    chmin(dist[i][j],dist[i][k]+dist[k][j]);
  }
  
  int ans = m;
  rep(i,m){
    bool ok = false;
    rep(j,n) if(dist[j][a[i]]+c[i] == dist[j][b[i]]) ok = true;
    if(ok)ans--;
  }
  
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:22: error: cannot convert 'std::vector<int>' to 'int' in assignment
   65 |     dist[a[i]][b[i]]=c;
      |                      ^
      |                      |
      |                      std::vector<int>
a.cc:66:22: error: cannot convert 'std::vector<int>' to 'int' in assignment
   66 |     dist[b[i]][a[i]]=c;
      |                      ^
      |                      |
      |                      std::vector<int>
Language: C++

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define ll long long
#define ld long double

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)

#define pii pair<int, int>
#define pll pair<ll, ll>

#define fi first
#define se second

#define pb push_back
#define eb emplace_back

#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()

#define endl '\n'
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const int MOD=1e9+7;
const ll INF=1e18;
const double PI=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

int dist[110][110];
int pre[110][110];
int use[110][110];


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  int n, m;
  cin >> n >> m;
  
  rep(i,n)rep(j,n){
    dist[i][j]=MOD;
    pre[i][j]=i;
  }
  
  vector<int>a(n),b(n),c(n);
  while(m--){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
    
    dist[a[i]][b[i]]=c;
    dist[b[i]][a[i]]=c;
    
    use[a[i]][b[i]]++;
    use[b[i]][a[i]]++;
  }
  rep(k,n)rep(i,n)rep(j,n){
    chmin(dist[i][j],dist[i][k]+dist[k][j]);
  }
  
  int ans = m;
  rep(i,m){
    bool ok = false;
    rep(j,n) if(dist[j][a[i]]+c[i] == dist[j][b[i]]) ok = true;
    if(ok)ans--;
  }
  
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:14: error: 'i' was not declared in this scope
   61 |     cin >> a[i] >> b[i] >> c[i];
      |              ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 105;
int n, m, ans, a, b, c;
vector<int> M[2010]; // at most 2000 edges
bool good[1010];
vector<int> e[N];
int dist[N];

auto cmp = [&](int a, int b){
    int f1 = M[a][0], w1 = M[a][2];
    int f2 = M[b][0], w2 = M[b][2];
    int aa = dist[f1] + w1;
    int bb = dist[f2] + w2;
    return aa >= bb;
};
void run(int x) {
    memset(dist, 0x3f, N);
    priority_queue<int, vector<int>, decltype(cmp)> que(cmp);
    dist[x] = 0;
    for (auto z : e[x]) {
        que.push(z);
    }
    while (!que.empty()) {
        int y = que.top();
        que.pop();
        int f = M[y][0], t = M[y][1], w = M[y][2];
        int ndist = dist[f] + w;
        if (dist[t] > ndist) {
            dist[t] = ndist;
            good[y % m] = true;
            for (int z : e[t]) {
                que.push(z);
            }
        } else if (dist[t] == ndist) {
            good[y % m] = true;
        }
    }
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> a >> b >> c;
        M[i] = {a, b, c};
        M[m + i] = {b, a, c};
        e[a].push_back(i);
        e[b].push_back(i + m);
    }
    for (int i = 1; i <= n; ++i) {
        run(i);
    }
    for (int i = 0; i < m; ++i) {
        if (good[i])
            ++ans;
    }

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


Compiler output:
a.cc:25:13: error: non-local lambda expression cannot have a capture-default
   25 | auto cmp = [&](int a, int b){
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 998244353
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
struct edge{//グラフに使うヤツ
    ll from,to,cost;
};
typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

ll n,m;
vector<vector<edge> > graph;
ll cost[105][105];
bool used[105][105];

void warshall_floyd(){
    for (ll i=0;i<n;i++){
        for (ll j=0;j<n;j++){
            for (ll k=0;k<n;k++){
                if (cost[i][j]>cost[i][k]+cost[k][j]){
                    cost[i][j]=cost[i][k]+cost[k][j];
                }
            }
        }
    }
}

vector<edge> dist;

int main() {
    ll n,m;
    cin >> n >> m;
    graph=G(n);
    for (ll i=0;i<n;i++){
        for (ll j=0;j<n;j++){
            if (i==j){
                cost[i][j]=0;
            }else{
                cost[i][j]=INF;
            }
        }
    }
    for (ll i=0;i<m;i++){
        ll a,b,c;
        cin >> a >> b >> c;
        a--;
        b--;
        cost[a][b]=c;
        cost[b][a]=c;
        edge e;
        e.from=a;
        e.to=b;
        e.cost=c;
        dist.push_back(e);
        e.from=b;
        e.to=a;
        e.cost=c;
        dist.push_back(e);
    }
    warshall_floyd();
    ll ans=0;
    for (ll i=0;i<dist.size();i++){
        bool flag=false;
        for (ll j=0;j<n;j++){
            for (ll k=0;k<n;k++){
                if (cost[j][dist[i].from]+dist[i].cost+cost[dist[i].to][j]==dist[i][j]){
                    flag=true;
                }
            }
        }
        if (!flag){
            ans++;
        }
    }
    cout << ans/2 << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:82:84: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<edge>, edge>::value_type' {aka 'edge'} and 'll' {aka 'long long int'})
   82 |                 if (cost[j][dist[i].from]+dist[i].cost+cost[dist[i].to][j]==dist[i][j]){
      |                                                                                    ^
Language: C++

/*input
3 3
1 2 1
1 3 1
2 3 3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (int)(lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
#define BS(a,x) binary_search(ALL(a),x)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

int dis[maxn][maxn];
vector<pair<pii,int>> edge;

int main(){
	IOS;
	int n,m;
	cin>>n>>m;
	REP(i,n) REP(j,n){
		dis[i][j]=(i==j)?0:INF;
	}
	REP(i,m){
		int u,v,d;
		cin>>u>>v>>d;
		u--;v--;
		edge.eb(MP(u,v),d);
		dis[u][v]=dis[v][u]=d;
	}

	REP(j,n) REP(i,n) REP(k,n){
		dis[i][k]=min(dis[i][k],dis[i][j]+dis[j][k]);
	}
	// REP(i,n) REP(j,n) cout<<dis[i][j]<<" \n"[j==n-1];

	int cnt=0;
	for(auto i:edge){
		if(dis[i.F.F][i.F.S]!=i.S) cnt++;
	}
	cout<<cnt<<'\n';

	return 0;
}


Compiler output:
/tmp/ccJuXzPg.o: in function `main':
a.cc:(.text+0x1f7): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccJuXzPg.o
a.cc:(.text+0x398): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccJuXzPg.o
/tmp/ccJuXzPg.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x45f): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccJuXzPg.o
a.cc:(.text+0x478): relocation truncated to fit: R_X86_64_PC32 against symbol `edge' defined in .bss section in /tmp/ccJuXzPg.o
collect2: error: ld returned 1 exit status
Language: C++

#include<cstdio>
#include<algorithm>
int g[101][101],a[1000],b[1000],c[1000];
int const infty=10000000;
int main(){
  int n,m,answer=0;
  scanf("%d%d",&n,&m);
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      g[i][j]=infty;
    }
  }
  for(int i=0;i<m;i++){
  // コピペでfastest取ったら嫌なので
  cin >> a[i] >> b[i] >> c[i];
    g[a[i]][b[i]]=g[b[i]][a[i]]=c[i];
  }
  for(int k=1;k<=n;k++){
    for(int i=1;i<=n;i++){
      for(int j=1;j<=n;j++){
        g[i][j]=std::min(g[i][k]+g[k][j],g[i][j]);
      }
    }
  }
  for(int i=0;i<m;i++){
    bool use=false;
    for(int j=1;j<=n;j++){
      if(j==a[i]||j==b[i]){
        if(c[i]==g[a[i]][b[i]])use=true;
      // }else if(g[a[i]][j]==c[i]+g[b[i]][j])use=true;
      }
    }
    if(!use)answer++;
  }
  printf("%d",answer);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'cin' was not declared in this scope
   15 |   cin >> a[i] >> b[i] >> c[i];
      |   ^~~
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    ll M = 1;
    while( N > 0 ){
        if(N / 10 == 0){
            break;
        }
        N /= 10;
        M++;
    }
    return M;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n, m;
    cin>>n>>m;
    ll g[n][n];
    for(ll i=0;i<n;++i){
        for(ll j=0;j<n;++j){
            if(i == j){
                g[i][j] = 0;
            }else{
                g[i][j] = INF;
            }
        }
    }
    vector<ll> a(m), b(m), c(m);
    for(ll i=0;i<m;++i){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--;
        b[i]--;
        g[a[i]][b[i]] = min(g[a[i][b[i]], c[i]);
        g[b[i]][a[i]] = min(g[b[i][a[i]], c[i]]);
    }

    for(ll k=0;k<n;++k){
        for(ll i=0;i<n;++i){
            for(ll j=0;j<n;++j){
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
            }
        }
    }
    ll ans = m;
    for(ll i=0;i<m;++i){
        bool flag = false;
        for(ll j=0;j<n;++j){
            if(g[j][a[i]] + c[i] == g[j][b[i]]){
                flag = true;
            }
        }
        if(flag){
            ans--;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:35: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}]' for array subscript
   74 |         g[a[i]][b[i]] = min(g[a[i][b[i]], c[i]);
      |                                   ^
a.cc:74:47: error: expected ']' before ')' token
   74 |         g[a[i]][b[i]] = min(g[a[i][b[i]], c[i]);
      |                                               ^
      |                                               ]
a.cc:75:35: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}]' for array subscript
   75 |         g[b[i]][a[i]] = min(g[b[i][a[i]], c[i]]);
      |                                   ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <iterator>
#include <iomanip>
#include <climits>
using namespace std;

long long n;
vector<vector<pair<long long, long long> > > g;
set<pair<long long, long long> > st;

void dijkstra(long long s){
    vector<int> d (n, 1e9),  p (n, -1);
	d[s] = 0;
	set < pair<int,int> > q;
	q.insert (make_pair (d[s], s));
	while (!q.empty()) {
		int v = q.begin()->second;
		q.erase (q.begin());
 
		for (size_t j=0; j<g[v].size(); ++j) {
			int to = g[v][j].first,
				len = g[v][j].second;
			if (d[v] + len < d[to]) {
				q.erase (make_pair (d[to], to));
				d[to] = d[v] + len;
				p[to] = v;
				q.insert (make_pair (d[to], to));
			}
		}
	}
    for(int i = 0; i < n; ++n){
        if(p[i] == -1) continue;
        long long a = max(i, p[i]), b = min(i, p[i]);
        s.insert({a, b});
    }
}

int main(){
    long long n, m;
    cin >> n >> m;
    g.resize(n, vector<pair<long long, long long> >(n));
    for(int i = 0; i < m; ++i){
        long long fr, to, w;
        cin >> fr >> to >> w;
        fr--, to--;
        g[fr].push_back({to, w});
        g[to].push_back({fr, w});
    }

    for(int i = 0; i < n; ++i) dijkstra(i);

    cout << m - s.size();
    
}


Compiler output:
a.cc: In function 'void dijkstra(long long int)':
a.cc:46:11: error: request for member 'insert' in 's', which is of non-class type 'long long int'
   46 |         s.insert({a, b});
      |           ^~~~~~
a.cc: In function 'int main()':
a.cc:64:17: error: 's' was not declared in this scope
   64 |     cout << m - s.size();
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;
using P = pair<int, int>;
const long long INF = 100000000;
//ダイクストラ法の練習

int main(){
  int N,M;
  cin >> N >> M;
  vector<vector<int>> edge(101, vector<int> (0));
  vector<vector<int>> L(101, vector<int> (101) );
  rep(i, M){
    int a, b,c;
    cin >>a>>b>>c;
    edge[a].push_back(b);
    edge[b].push_back(a);
    L[a][b] = c;
    L[b][a] = c;
  }
  
  vector<vector<int>> min_dist(101, vector<int> (101))
  
  //スタートがi
  for(int i = 1; i < N; i++){
    
    //int i = 1;//テスト
  
      //準備
      priority_queue<P, vector<P>, greater<P>> pq;//pair<仮の距離、頂点>仮の距離が小さい順に並ぶ
      vector<int> dist(N+1, INF);//スタートからの最短距離を更新し続ける
        
  
  
      //初期条件
      dist[0] = 0;//頂点0は使わない
      dist[i] = 0;//頂点iまでの距離は0
      pq.push(make_pair(dist[i], i));
            
      //jが確定するまで続ける
      while(!pq.empty()){
        P p = pq.top();//仮距離最小を取り出す
        pq.pop();//削除する
        int v = p.second;//頂点を取り出す
        //更新しない場合
        //if(dist[v] < p.first){
         // continue;
       // }
        //更新する場合,vから行けるすべての頂点に対して
        for(int u:edge[v]){
          if(dist[v]+L[v][u] < dist[u]){
            dist[u] = dist[v]+L[v][u];
          
            pq.push(make_pair(dist[u], u));
          }
        }
      }
    //記録する
    for(int j = i+1; j <= N; j++){
      min_dist[i][j] = dist[j];
    }      
  }
  
  rep(i, N+1){
   rep(j, N+1){
    cout << min_dist[i][j] << " " << endl;    
   }
    cout << endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: expected ',' or ';' before 'for'
   26 |   for(int i = 1; i < N; i++){
      |   ^~~
a.cc:26:18: error: 'i' was not declared in this scope
   26 |   for(int i = 1; i < N; i++){
      |                  ^
Language: Java

import java.util.Scanner;
public class CandidatesOfNoShortestPaths {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int num_vertex=scan.nextInt();
        int num_edge=scan.nextInt();
        int[] a=new int[num_edge];
        int[] b=new int[num_edge];
        int[] c=new int[num_edge];
        int i;
        for(i=0;i<num_edge;i++){
            a[i]=scan.nextInt();
            b[i]=scan.nextInt();
            c[i]=scan.nextInt();
        }
        int[] count=new int[num_edge];
        for(i=0;i<num_edge;i++){
            count[i]=0;
        }

        int j=0;
        int  use=0;
        for(i=0;i<num_edge;i++){
            int min_d=1000;
            for(j=i+1;j<num_edge;j++){
                for(int k=0;k<num_edge;k++){
                    if(a[k]==i && b[k]==j){
                        if(min_d>c[k]){
                            use=k;
                        }
                    }
                }
                count[use]++;
            }
        }

        int answer=0;
        for(i=0;i<num_edge;i++){
            if(count[i]==0){
                answer++;
            }
        }
        System.out.println(answer);
    }
}

Compiler output:
Main.java:2: error: class CandidatesOfNoShortestPaths is public, should be declared in a file named CandidatesOfNoShortestPaths.java
public class CandidatesOfNoShortestPaths {
       ^
1 error
Language: Java

import java.util.Scanner;
public class CandidatesOfNoShortestPaths {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
    int num_vertex=scan.nextInt();
    int num_edge=scan.nextInt();
    int[] a=new int[num_edge];
    int[] b=new int[num_edge];
    int[] c=new int[num_edge];
    int i;
    for(i=0;i<num_edge;i++){
        a[i]=scan.nextInt();
        b[i]=scan.nextInt();
        c[i]=scan.nextInt();
    }
    int[] count=new int[num_edge];
    for(i=0;i<num_edge;i++){
        count[i]=0;
    }

    int j=0;
    int  use;
    for(i=0;i<num_edge;i++){
        int min_d=1000;
        for(j=i+1;j<num_edge;j++){
            for(int k=0;k<num_edge;k++){
                if(a[k]=i && b[k]==j){
                    if(min_d>c[k]){
                        use=k;
                    }
                }
            }
            count[use]++;
        }
    }

    int answer=0;
    for(i=0;i<num_edge;i++){
        if(count[i]==0){
            answer++;
        }
    }
    System.out.println(answer);
    }
}

Compiler output:
Main.java:2: error: class CandidatesOfNoShortestPaths is public, should be declared in a file named CandidatesOfNoShortestPaths.java
public class CandidatesOfNoShortestPaths {
       ^
Main.java:27: error: bad operand types for binary operator '&&'
                if(a[k]=i && b[k]==j){
                          ^
  first type:  int
  second type: boolean
Main.java:27: error: incompatible types: int cannot be converted to boolean
                if(a[k]=i && b[k]==j){
                       ^
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
// Type alias
using ll=long long;
using ld=double;
 
using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;
 
using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;
 
// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();
 
// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl
 
#define ALL(a) a.begin(),a.end()
 
// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}
template<typename T> bool chmin(T& a, const T& b) {
  if (a > b) return a = b, true; else return false;
}
 
template<typename T> bool chmax(T& a, const T& b) {
  if (a < b) return a = b, true; else return false;
}
 
 
void solve(){
  int N, M;
  cin >> N >> M;
 
  int C[105][105] = {};
  vector<vector<pi>> w(N, vector<pi>(0));
 
  rep(i, N)rep(j, N) C[i][j] = inf / 2;
  rep(i, N) dist[i][i] = 0;
 
  rep(i, M){
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    C[a][b] = c;
    C[b][a] = c;
    w[a].emplace_back(make_pair(b, c));
    w[b].emplace_back(make_pair(a, c));
  }
 
  rep(k, N){
    rep(i, N){
      rep(j, N){
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }
 
  bool used[105][105] = {};
  rep(i, N){
    rep(j, N){
      for(auto e: w[j]){
        int node = e.first;
        int cost = e.second;
        if(C[i][node] + cost == C[i][j]){
          used[node][j] = true;
          used[j][node] = true;
        }
      }
    }
  }
 
  int sum = 0;
  rep(i, N){
    rep(j, N){
      if(used[i][j]) sum++;
    }
  }
 
  cout << M - sum / 2 << endl;
}
 
int main(){
// FastIO
//ios_base::sync_with_stdio(false);
cin.tie(NULL);
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:77:13: error: 'dist' was not declared in this scope
   77 |   rep(i, N) dist[i][i] = 0;
      |             ^~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:4:2: error: expected ';' before 'const'
    4 | 2 const int inf = 100000000;
      |  ^~~~~~
      |  ;
a.cc:5:2: error: expected ';' before numeric constant
    5 | 3
      |  ^
      |  ;
    6 | 3
      | ~ 
a.cc:8:2: error: expected ';' before 'cin'
    8 | 5 cin >> n >> m;
      |  ^~~~
      |  ;
a.cc:9:2: error: expected ';' before numeric constant
    9 | 6
      |  ^
      |  ;
   10 | 7 int a[1000],b[1000],c[1000],dist[100][100];
      | ~ 
a.cc:11:2: error: expected ';' before numeric constant
   11 | 8
      |  ^
      |  ;
   12 | 9 for(int i = 0; i < m; ++i){
      | ~ 
a.cc:12:18: error: 'i' was not declared in this scope
   12 | 9 for(int i = 0; i < m; ++i){
      |                  ^
a.cc:12:22: error: 'm' was not declared in this scope; did you mean 'tm'?
   12 | 9 for(int i = 0; i < m; ++i){
      |                      ^
      |                      tm
a.cc:16:3: error: expected ';' before numeric constant
   16 | 13
      |   ^
      |   ;
   17 | 14 for(int i = 0; i < n; ++i){
      | ~~ 
a.cc:17:23: error: 'n' was not declared in this scope
   17 | 14 for(int i = 0; i < n; ++i){
      |                       ^
a.cc:25:3: error: expected ';' before numeric constant
   25 | 22
      |   ^
      |   ;
   26 | 23 for(int i = 0; i < m; ++i){
      | ~~ 
a.cc:30:3: error: expected ';' before numeric constant
   30 | 27
      |   ^
      |   ;
   31 | 28 for(int k = 0; k < n; ++k){
      | ~~ 
a.cc:31:19: error: 'k' was not declared in this scope
   31 | 28 for(int k = 0; k < n; ++k){
      |                   ^
a.cc:38:3: error: expected ';' before numeric constant
   38 | 35
      |   ^
      |   ;
   39 | 36 int ans=m;
      | ~~ 
a.cc:40:3: error: expected ';' before 'for'
   40 | 37 for(int i = 0; i < m; ++i){
      |   ^~~~
      |   ;
a.cc:47:3: error: expected ';' before numeric constant
   47 | 44
      |   ^
      |   ;
   48 | 45 cout << ans << endl;
      | ~~ 
a.cc:49:3: error: expected ';' before '}' token
   49 | 46 }
      |   ^~
      |   ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const ll maxv=105;
int dist[maxv][maxv];
int n;
void warshallfloyd(){
  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]);
}
 
 
signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll m; cin>>n>>m;
  rep(i,n) rep(j,n) dist[i][j]=INF;
  vector<tuple<ll,ll,ll>> es;
  rep(i,m){
    ll a,b,c; cin>>a>>b>>c;
    a--,b--;
    es.emplace_back(a,b,c);
    dist[a][b]=dist[b][a]=c;
  }
  
  warshall_floyd();
  
  ll ans=0;
  rep(i,m){
    ll a,b,c;
    tie(a,b,c)=es[i];
    if(dist[a][b]<c) ans++;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:3: error: 'warshall_floyd' was not declared in this scope; did you mean 'warshallfloyd'?
   63 |   warshall_floyd();
      |   ^~~~~~~~~~~~~~
      |   warshallfloyd
Language: C++

# include <iostream>

using namespace std;



int main(){
  int N, M;
  int a, b, c, count;
  int d[100][100], dc[100][100];

  // load the graph
  for(int m = 0; m < M; m++) {
    cin >> a >> b >> c;
    d[a][b] = c;
    d[b][a] = c;
  }
  dc = d;

  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]);
      }
    }
  }

  count = 0;
  for (int n = 0; n < N; n++) {
    for (int m = n; m < N; m++) {
      if (d[n][m] - dc[n][m] < 0) {
	count ++;
      }
    }
  }

  cout << count << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:6: error: invalid array assignment
   18 |   dc = d;
      |   ~~~^~~