Language: C++

#include <cstdio>
#include <vector>
#include <algorithm>
using std::sort;
using std::vector;

int min(int a, int b){return (a<b)?a:b;}

const int MAXN = 500+10;
const int MAXEDGE = MAXN * MAXN;

struct edge{int u, v, c;}Edge[MAXEDGE];
bool comp(edge a, edge b){return a.c < b.c;}
vector<edge> graph[MAXN];
bool used[MAXEDGE];

int SET[MAXN];
int Find(int x){
    if(SET[x]==x) return x;
    else return SET[x] = Find(SET[x]);
}

int res, sum;
int dfs_no[MAXN];
int low[MAXN];
int dfs_time;

int dfs(int u,int fa, int Cost){
    dfs_no[u] = ++dfs_time;
    low[u] = dfs_no[u];
    for(int i=0 ; i<graph[u].size() ; i++){
        int to = graph[u][i].u + graph[u][i].v - u;
        if(to==fa) continue;
        if(dfs_no[to])
            low = min(low, low[to]);
        else{
            int back = dfs(to, u, Cost);
            if(back > low && graph[u][i].c==Cost){
                res++;
                sum += Cost;
            }
            low = min(low, back);
        }
    }
    return low;
}

int main(){
    int N, M;
    scanf("%d %d", &N, &M);
    for(int i=1;i<=N;i++)
        SET[i] = i;
    for(int i=0;i<M;i++)
        scanf("%d %d %d", &Edge[i].u, &Edge[i].v, &Edge[i].c);
    sort(Edge, Edge+M, comp);
    int i, j;
    for(i=0;i<M;i=j){
        int cost = Edge[i].c;
        for(j=i ; j<M && Edge[j].c==cost ; j++){
            int aset = Find(Edge[j].u);
            int bset = Find(Edge[j].v);
            if(aset==bset) continue;
            graph[Edge[j].u].push_back(Edge[j]);
            graph[Edge[j].v].push_back(Edge[j]);
        }
        for(j=i ; j<M && Edge[j].c==cost ; j++){
            int aset = Find(Edge[j].u);
            int bset = Find(Edge[j].v);
            if(aset!=bset) SET[aset] = bset;
        }
        dfs_time=0;
        for(int k=1;k<=N;k++) dfs_no[k] = 0;
        for(int k=1;k<=N;k++){
            if(dfs_no[k]==0){
                dfs(k, 0, cost);
            }
        }
    }
    printf("%d %d\n", res, sum);
    return 0;
}

Compiler output:
a.cc: In function 'int dfs(int, int, int)':
a.cc:35:23: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   35 |             low = min(low, low[to]);
      |                       ^~~
      |                       |
      |                       int*
a.cc:7:13: note:   initializing argument 1 of 'int min(int, int)'
    7 | int min(int a, int b){return (a<b)?a:b;}
      |         ~~~~^
a.cc:35:17: error: incompatible types in assignment of 'int' to 'int [510]'
   35 |             low = min(low, low[to]);
      |             ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:38:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   38 |             if(back > low && graph[u][i].c==Cost){
      |                ~~~~~^~~~~
a.cc:42:23: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   42 |             low = min(low, back);
      |                       ^~~
      |                       |
      |                       int*
a.cc:7:13: note:   initializing argument 1 of 'int min(int, int)'
    7 | int min(int a, int b){return (a<b)?a:b;}
      |         ~~~~^
a.cc:42:17: error: incompatible types in assignment of 'int' to 'int [510]'
   42 |             low = min(low, back);
      |             ~~~~^~~~~~~~~~~~~~~~
a.cc:45:12: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   45 |     return low;
      |            ^~~
      |            |
      |            int*