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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cmath>
#include<complex>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
//const int INF = 1e9;
typedef long long ll;
#define MV 1010
const double EPS = 1e-8;
const double INF = 1e9+10;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};


struct edge{double cost;int to; };
vector <edge> G[MV];
bool used[MV+2];
double d[MV+1];

int V,E;

void dijkstra(int first){
  fill(d,d+MV,INF);
  fill(used,used+MV,false);
  d[first] = 0;
  
  for(int i = 0;i < V;i++){
    
    int now = MV-1;
    for(int j = 0;j < V;j++){
      //cout <<  d[now] <<"       "  <<  d[j] << endl;
      if(used[j] == false && d[now] > d[j]){
	now = j;
      }
    }
    //cout << now << endl;
    used[now] = true;
    //cout << used[now] << endl;
    for(int j = 0;j < G[now].size();j++){
      edge e = G[now][j];
      //cout << d[e.to] << "       " << d[now]+e.cost << endl; 
      d[e.to] = min(d[e.to] , d[now]+e.cost);
    }
    for(int j = 0;j < V;j++)
      //cout << d[j] << "   ";
      //cout << endl;


    
  }
}

struct C {
  P p; double r;
  C(const P &p, double r) : p(p), r(r) { }
};


int main(){
  
  vector <C> c;
  double a,b,o;
  cin >> a >> b;
  P p = P(a,b);
  C cc = C(p,0);
  c.pb(cc);
  cin >> a >> b;
  p = P(a,b);
  cc = C(p,0);
  c.pb(cc);
  int n;
  cin >> n;
  REP(i,n){
    cin >> a >> b >> o;
    p = P(a,b);
    cc = C(p,o);
    c.pb(cc);
  }
  REP(i,c.size()){
    //cout << "c[i].p" << "  " <<  (double)c[i].r << endl;
  }
  V = n+2;
 
  REP(i,n+1){
    for(int j = i+1;j < n+2;j++){
      edge e;
      e.to = j;
      double x = (double)abs(c[i].p-c[j].p);
      //cout << "x = " << x << endl;
      e.cost = (double)max(x-c[i].r-c[j].r,0.0);
      //cout << e.cost << endl;
      G[i].pb(e);
      //cout <<i <<"  from  " <<j <<"  to  " <<  G[i][j].cost << endl;
      e.to = i;
      G[j].pb(e);
      
    }
  }
  REP(i,n+2){
    REP(j,G[i].size()){
      //cout <<i <<"  from  " <<j <<"  to  " <<  G[i][j].cost << endl;
    }
  }
  dijkstra(0);
  printf("%.10lf\n",d[1]);
  return 0;
}

Compiler output:
a.cc: In function 'void dijkstra(int)':
a.cc:72:3: error: expected primary-expression before '}' token
   72 |   }
      |   ^
Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<queue>
using namespace std;

struct P {
  double x,y,r;
};

using Q = pair<int,double>;

double dist (P& a, P& b) {
  return max(hypot(a.x-b.x,a.y-b.y)-a.r-b.r,0.0);
}

int main () {
  double xs,ys,xt,yt; cin>>xs>>ys>>xt>>yt;
  int n; cin>>n;
  vector<P> circles;
  circles.push_back((P){xs,ys,0});
  for(int i=0;i<n;++i){
    double x,y,r; cin>>x>>y>>r;
    circles.push_back((P){x,y,r});
  }
  circles.push_back((P){xt,yt,0});
  n+=2;
  double dp[n]; dp[0]=0;
  for(int i=1;i<n;++i)
    dp[i] = 1.7e308;
  priority_queue< Q, vector<Q> , greater<Q> > q;
  for(int i = 0; i < n; ++i) {
    q.push(make_pair(i,dp[i]));
  }
  while(!q.empty()){
    Q qf = q.top();q.pop();
    int id = qf.first;
	if(dp[id] < qf.SE)continue;
    P& p = circles[id];
    for(int i = 1; i < n; ++i) {
      if(i == id) continue;
      double d = dp[id] + dist(p,circles[i]);
      if(d < dp[i]){
	dp[i] = d;
	if(i != n-1)
	  q.push(make_pair(i,d));
      }
    }
  }
  printf("%.10f\n", dp[n-1]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:24: error: 'using Q = struct std::pair<int, double>' {aka 'struct std::pair<int, double>'} has no member named 'SE'
   39 |         if(dp[id] < qf.SE)continue;
      |                        ^~
Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
#include<queue>
using namespace std;

struct P {
  double x,y,r;
};

using Q = pair<int,double>;

double dist (P& a, P& b) {
  return max(hypot(a.x-b.x,a.y-b.y)-a.r-b.r,0.0);
}

int main () {
  double xs,ys,xt,yt; cin>>xs>>ys>>xt>>yt;
  int n; cin>>n;
  vector<P> circles;
  circles.push_back((P){xs,ys,0});
  for(int i=0;i<n;++i){
    double x,y,r; cin>>x>>y>>r;
    circles.push_back((P){x,y,r});
  }
  circles.push_back((P){xt,yt,0});
  n+=2;
  double dp[n]; dp[0]=0;
  for(int i=1;i<n;++i)
    dp[i] = 1.7e308;
  priority_queue< Q, vector<Q> , greater<Q> > q;
  for(int i = 0; i < n; ++i) {
    q.push(make_pair(i,dp[i]));
  }
  while(!q.empty()){
    Q qf = q.top();q.pop();
    int id = qf.first;
	if(dp[id] < pf.SE)continue;
    P& p = circles[id];
    for(int i = 1; i < n; ++i) {
      if(i == id) continue;
      double d = dp[id] + dist(p,circles[i]);
      if(d < dp[i]){
	dp[i] = d;
	if(i != n-1)
	  q.push(make_pair(i,d));
      }
    }
  }
  printf("%.10f\n", dp[n-1]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:21: error: 'pf' was not declared in this scope; did you mean 'qf'?
   39 |         if(dp[id] < pf.SE)continue;
      |                     ^~
      |                     qf
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define P pair<double,int>
#define PP pair<P,int>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
struct edge{
    int to;
    double cost;
};
const int MAX_V=1002;
int V;
vector<edge> G[MAX_V];
double d[MAX_V];
void dijkstra(int s){
    fill(d,d+V,INF);
    priority_queue<P,vector<P>,greater<P> > que;
    d[s]=0.0;
    que.push(P(0,s));
    while(que.size()){
        P p=que.top();que.pop();
        if(p.fi>d[p.se])continue;
        REP(i,G[p.se].size()){
            edge e=G[p.se][i];
            if(d[e.to]>p.fi+e.cost){
                d[e.to]=p.fi+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}
struct T{
    double x,y,r;
};
signed main(){
    vector<T> vec;
    REP(i,2){
        T t;
        cin>>t.x>>t.y;
        t.r=0;
        vec.pb(t);
    }
    cin>>V;
    REP(i,V){
        T t;
        cin>>t.x>>t.y>>t.r;
        vec.pb(t);
    }
    V+=2;
    REP(i,V){
        REP(j,V){
            edge t;
            t.to=j;
            t.cost=max(0.0LL,sqrt(pow(vec[i].x-vec[j].x,2)+pow(vec[i].y-vec[j].y,2))-vec[i].r-vec[j].r);
            G[i].pb(t);
        }
    }
    dijkstra(0);
    printf("%.10lf\n",d[1]);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:24: error: unable to find numeric literal operator 'operator""LL'
   65 |             t.cost=max(0.0LL,sqrt(pow(vec[i].x-vec[j].x,2)+pow(vec[i].y-vec[j].y,2))-vec[i].r-vec[j].r);
      |                        ^~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const ld INF = 1e9;
const int MAX_N = 1002;

struct edge { int to; ld cost; };
typedef pair<ld, int>P;
int N;
vector<edge>G[MAX_N];
ld d[MAX_N];

void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P>>que;
	fill(d, d + N, INF);
	d[s] = 0.0;
	que.push(P(0.0, s));
	while (!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}
int main() {
	cin.sync_with_stdio(false);
	int xs, ys, xt, yt;
	cin >> xs >> ys >> xt >> yt;
	cin >> N;
	vector<int>x(N+2), y(N+2),r(N+2);
	x[0] = xs; y[0] = ys; x[N + 1] = xt; y[N + 1] = yt;
	rep(i, N) {
		cin >> x[i + 1] >> y[i + 1] >> r[i + 1];
	}
	rep(i, N + 2) {
		rep(j, N + 2) {
			if (i == j)continue;
			edge e1;
			e1.to = j; e1.cost =(ld)max(0,0,sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j])) - r[i] - r[j]);
			G[i].push_back(e1);
		}
	}
	dijkstra(0);
	cout << setprecision(10) << d[N + 1] << endl;

	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = double]':
a.cc:51:31:   required from here
   51 |                         e1.to = j; e1.cost =(ld)max(0,0,sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j])) - r[i] - r[j]);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

typedef pair<int,int> pii;
typedef pair<double,double > pdd;
typedef pair<int,pii > pipdd;
typedef pair<int,double> pid;
typedef pair<pii,pdd> ppiipdd;
typedef pair<double,int> pdi;

vector<ppiipdd> V;
vector<pid> G[1010];

int N;
double sx,sy,gx,gy;
double D[1010];

int main()
{
    scanf("%lf%lf%lf%lf",&sx,&sy,&gx,&gy);
    scanf("%d",&N);
    for(int i = 0; i < N + 2; i++)
    {
        D[i] = -1;
    }
    V.push_back(make_pair(make_pair(N,0),make_pair(sx,sy)));
    V.push_back(make_pair(make_pair(N + 1,0),make_pair(gx,gy)));
    for(int i = 0; i < N; i++)
    {
        double x,y;
        int r;
        scanf("%lf%lf%d",&x,&y,&r);
        V.push_back(make_pair(make_pair(i,r),make_pair(x,y)));
    }
    for(int i = 0; i < V.size(); i++)
    {
        for(int j = i; j < V.size(); j++)
        {
            double x = (V[i].second.first - V[j].second.first) * (V[i].second.first - V[j].second.first);
            double y = (V[i].second.second - V[j].second.second) * (V[i].second.second - V[j].second.second);
            double length = max(0.0,sqrt(x + y) - (double)V[i].first.second - (double)V[j].first.second);
            G[V[i].first.first].push_back(make_pair(V[j].first.first,length));
            G[V[j].first.first].push_back(make_pair(V[i].first.first,length));
        }
    }
    priority_queue<pdi ,vector<pdi>,greater<pdi> >  Q;
    Q.push(make_pair(0,N));
    while(Q.size())
    {
        pdi now = Q.top();
        Q.pop();
        if(D[now.second] != -1)
        {
            continue;
        }
        D[now.second] = now.first;
        for(int i = 0; i < G[now.second].size(); i++)
        {
            Q.push(make_pair(now.first + G[now.second][i].second,G[now.second][i].first));
        }
    }
    printf("%lf\n",D[N + 1]);
    return 0;
}


Compiler output:
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end

sx,sy,ex,ey = inp
n = inp[0]
t = []
rec = na(n+2,999999999)
t[0] = [sx,sy,0]
t[1] = [ex,ey,0]
n.times do 
  t.push(inp)
end
ind = 0
tab = (1..n+1).to_a
rec[0] = 0
(n+1).times do
  max = 999999999
  nex = -1
  tab.each do |d|
    kyori = [(((t[ind][0] - t[d][0])**2 + (t[ind][1] - t[d][1])**2))**0.5 - (t[ind][2] + t[d][2]) + rec[ind],0].max
    if rec[d] > kyori
      rec[d] = kyori
      if max > kyori
        max = kyori
        nex = d
      end
    end
  end
  ind = nex
  tab.delete(ind)
end
p rec[1]

Compiler output:
a.cc:5:28: error: too many decimal points in number
    5 | def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
      |                            ^~~~
a.cc:23:8: error: too many decimal points in number
   23 | tab = (1..n+1).to_a
      |        ^~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
      | ^~~
a.cc:6:29: error: 'a' does not name a type
    6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
      |                             ^
a.cc:6:48: error: expected unqualified-id before 'return'
    6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
      |                                                ^~~~~~
a.cc:8:46: error: 'end' does not name a type
    8 | def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
      |                                              ^~~
a.cc:9:62: error: 'end' does not name a type
    9 | def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
      |                                                              ^~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl
#define eps 0.00000000001
#define all(x) x.begin(),x.end()
typedef pair<double,int> P;
typedef pair<int,P> PP;
int xs,ys,xt,yt;
int n;
double x[2000];
double y[2000];
double r[2000];
double d[1000000];
int V,E;
class edge
{
	public:int to;
	double cost;
};
vector<edge> G[1001];
void dijkstra(int s)
{
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0.000,s));
	fill(d,d+V,INF);
	d[s]=0.000;
	while(!que.empty())
	{
		P p=que.top();que/.pop();
		int v=p.second;
		if(d[v]<p.first) continue;
		rep(i,G[v].size())
		{
			edge e=G[v][i];
			int vv=e.to;
			if(d[e.to]>d[v]+e.cost)
			{
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
		
	}
}
double dis;
int main()
{
	cin>>xs>>ys>>xt>>yt;
	//scanf("%lf%lf%lf%lf",&xs,&ys,&xt,&yt);
	cin>>n;
	V=n+2;
	E=(n+2)*(n+3)/2;
	rep(i,n)
	{
		//scanf("%lf%lf%lf",&x[i],&y[i],&r[i]);
		cin>>x[i]>>y[i]>>r[i];
	}
	x[n]=xs;
	y[n]=ys;
	r[n]=0.000000;
	r[n+1]=0.000000;
	x[n+1]=xt;
	y[n+1]=yt;
	rep(i,n+2)
	{
		rep2(j,i+1,n+2)
		{
			dis=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-r[i]-r[j];
			if(dis<0)dis=0.000;
			edge ee;
			ee.to=j;
			ee.cost=dis;
			G[i].push_back(ee);
			ee.to=i;
			G[j].push_back(ee);
		}
	}
	dijkstra(n);
	//cout<<d[n+1]<<endl;
	printf("%.11f\n",d[n+1]);
	/*getchar();
	fflush(stdin);*/
	return 0;
}

Compiler output:
a.cc: In function 'void dijkstra(int)':
a.cc:42:35: error: expected primary-expression before '.' token
   42 |                 P p=que.top();que/.pop();
      |                                   ^
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <queue>
#include <utility>

#define INF 1000000005
#define MP make_pair

using namespace std;
long long int x[1005],y[1005],r[1005],n,dis[1005],edge[1005][1005];
bool use[1005];
pair<double,int> P;
priority_queue<pair<double,int>>Q;

double cal(double a,double b,double r){
    double ans=sqrt(pow(a,2)+pow(b,2))-r;
    if(ans<0)ans=0;
    return ans;
}

int main() {
    cin>>x[0]>>y[0]>>x[1]>>y[1];
    r[0]=r[1]=0;
    cin>>n;
    for(int i=2;i<n+2;i++){
        cin>>x[i]>>y[i]>>r[i];
        use[i]=false;
        dis[i]=INF;
    }
    dis[0]=0;dis[1]=INF;
    use[0]=true;use[1]=false;
    
    for(int i=0;i<n+2:i++){
        for(int j=0;j<n+2;i++){
            edge[i][j]=cal(x[i]-x[j],y[i]-y[j],r[i]+r[j]);
        }
    }
    for(int i=0;i<n+2;i++){
        Q.push(MP(edge[0][i],i));
    }
    while(!Q.empty()){
        P=Q.top();
        Q.pop();
        if(use[P.second]==true)continue;
        if(P.second==2){
            cout<<P.first;
            return 0;
        }
        dis[P.second]=P.first;
        use[P.second]=true;
        for(int i=0;i<n+2;i++){
            if(dis[i]<P.first+edge[i][P.second]){
  Q.push(MP(P.first+edge[i][P.second],i));
            }
        } 
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   34 |     for(int i=0;i<n+2:i++){
      |                 ^
a.cc:34:22: error: expected ';' before ':' token
   34 |     for(int i=0;i<n+2:i++){
      |                      ^
      |                      ;
a.cc:39:5: error: expected primary-expression before 'for'
   39 |     for(int i=0;i<n+2;i++){
      |     ^~~
a.cc:38:6: error: expected ';' before 'for'
   38 |     }
      |      ^
      |      ;
   39 |     for(int i=0;i<n+2;i++){
      |     ~~~
a.cc:39:5: error: expected primary-expression before 'for'
   39 |     for(int i=0;i<n+2;i++){
      |     ^~~
a.cc:38:6: error: expected ')' before 'for'
   38 |     }
      |      ^
      |      )
   39 |     for(int i=0;i<n+2;i++){
      |     ~~~
a.cc:34:8: note: to match this '('
   34 |     for(int i=0;i<n+2:i++){
      |        ^
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <queue>
#include <pair>

#define INF 1000000005
#define MP make_pair

using namespace std;
long long int x[1005],y[1005],r[1005],n,dis[1005],edge[1005][1005];
bool use[1005];
pair<double,int> P;
priority_queue<pair<double,int>>Q;

double cal(double a,double b,double r){
    double ans=sqrt(pow(a,2)+pow(b,2))-r;
    if(ans<0)ans=0;
    return ans;
}

int main() {
    cin>>x[0]>>y[0]>>x[1]>>y[1];
    r[0]=r[1]=0;
    cin>>n;
    for(int i=2;i<n+2;i++){
        cin>>x[i]>>y[i]>>r[i];
        use[i]=false;
        dis[i]=INF;
    }
    dis[0]=0;dis[1]=INF;
    use[0]=true;use[1]=false;
    
    for(int i=0;i<n+2:i++){
        for(int j=0;j<n+2;i++){
            edge[i][j]=cal(x[i]-x[j],y[i]-y[j],r[i]+r[j]);
        }
    }
    for(int i=0;i<n+2;i++){
        Q.push(MP(edge[0][i],i));
    }
    while(!Q.empty()){
        P=Q.top();
        Q.pop();
        if(use[P.second]==true)continue;
        if(P.second==2){
            cout<<P.first;
            return 0;
        }
        dis[P.second]=P.first;
        use[P.second]=true;
        for(int i=0;i<n+2;i++){
            if(dis[i]<P.first+edge[i][P.second]){
  Q.push(MP(P.first+edge[i][P.second],i));
            }
        } 
    }
    return 0;
}

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

#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
using namespace std;

const int MAX_V=1010;//頂点数の最大値
const double INF=999999999999.9;
double cost[MAX_V][MAX_V];//cost[u][v]は辺e=(u,v)のコスト、辺が無い場合はINF
double d[MAX_V];//頂点sからの最小距離
bool used[MAX_V];//既に使われたかのフラグ
int V;//頂点数

void dijkstra(int s){
    fill(d,d+V,INF);
    fill(used,used+V,false);
    d[s]=0.0;
    while(true){
        int v = -1;
        //まだ使われていない頂点のうち距離が最小のものを探す。
        for(int u=0;u<V;u++){
            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++){
            d[u] = min(d[u],d[v]+cost[v][u]);
        }
    }
}

double dist(double xi,double yi,double xj,double yj){
    double res = sqrt(1.0*(xi-xj)*(xi-xj)+1.0*(yi-yj)*(yi-yj));
    return res;
}

int main(){
    double xs,ys,xt,yt;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    xs=1.0*a; ys=1.0*b; xt=1.0*c; yt=1.0*d;
    int N;
    cin>>N;
    V=N+2;
    double x[1010],y[1010],r[1010];
    for(int i=0;i<N;i++){
        int x,y,r;
        cin>>x>>y>>r;
        x[i]=1.0*x; y[i]=1.0*y; r[i]=1.0*r;
    }
    cost[N][N+1]=dist(xs,ys,xt,yt);
    cost[N][N]=0.0;
    cost[N+1][N]=dist(xs,ys,xt,yt);
    cost[N+1][N+1]=0.0;
    for(int i=0;i<N;i++){
        cost[i][N]=max(dist(x[i],y[i],xs,ys)-1.0*r[i], 0.0);
        cost[N][i]=max(dist(x[i],y[i],xs,ys)-1.0*r[i], 0.0);
        cost[i][N+1]=max(dist(x[i],y[i],xt,yt)-1.0*r[i], 0.0);
        cost[N+1][i]=max(dist(x[i],y[i],xt,yt)-1.0*r[i], 0.0);
        for(int j=0;j<N;j++){
            cost[i][j]=max(dist(x[i],y[i],x[j],y[j])-1.0*r[i]-1.0*r[j] , 0.0);
        }
    }
    dijkstra(N);
    cout<<d[N+1]<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:10: error: invalid types 'int[int]' for array subscript
   55 |         x[i]=1.0*x; y[i]=1.0*y; r[i]=1.0*r;
      |          ^
a.cc:55:22: error: invalid types 'int[int]' for array subscript
   55 |         x[i]=1.0*x; y[i]=1.0*y; r[i]=1.0*r;
      |                      ^
a.cc:55:34: error: invalid types 'int[int]' for array subscript
   55 |         x[i]=1.0*x; y[i]=1.0*y; r[i]=1.0*r;
      |                                  ^
a.cc:71:12: error: invalid types 'int[int]' for array subscript
   71 |     cout<<d[N+1]<<endl;
      |            ^
Language: C++

#include <cstdio>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <algorithm>
#include <sstream>
#include <tuple>
#include <queue>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;

#define ten(n) ((int)1e##n)
#define COUT cout <<
#define SPACE_COUT << " "  <<
#define COMMA_COUT << ", " <<
#define ENDL << endl;

double distance(tuple<ll, ll, ll> n1, tuple<ll, ll, ll> n2) {
    double x = get<0>(n1) - get<0>(n2);
    double y = get<1>(n1) - get<1>(n2);
    double r = get<2>(n1) + get<2>(n2);
    double dist = sqrt(x * x + y * y) - r;
    return dist > 0 ? dist : 0;
}

class AscendPair {
  public:
    bool operator() (pair<double, int> n1, pair<double, int> n2) {
        return n1.first > n2.first;
    }
};

int
main()
{
    cin.tie(0);
    cout << setprecision(12);
    ios::sync_with_stdio(false);
    
    int N;
    vector<tuple<ll, ll, ll> > nodes;
    ll x, y, r;
    cin >> x >> y;
    nodes.push_back(make_tuple(x, y, 0));
    cin >> x >> y;
    nodes.push_back(make_tuple(x, y, 0));
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> x >> y >> r;
        nodes.push_back(make_tuple(x, y, r));        
    }
    
    vector<double> dijkstra(nodes.size());
    vector<vector<double> >  paths(nodes.size());
    for (int i = 0; i < nodes.size(); ++i) {
        tuple<ll, ll, ll> node = nodes[i];
        vector<double>& path = paths[i];
        for (int j = 0; j < nodes.size(); ++j) {
            double dist = distance(node, nodes[j]);
            path[j].push_back(dist);
        }
        dijkstra[i] = DBL_MAX;
    }

    set<int> used;
    priority_queue<pair<double, int> , vector<pair<double, int> >, AscendPair > pq;
    pq.push(make_pair(0, 0));
    while(!pq.empty()) {
        pair<double, int> kv = pq.top(); pq.pop();
        double cost = kv.first;
        int index = kv.second;        
        used.insert(index);

        if (dijkstra[index] < cost) continue;
        dijkstra[index] = cost;

        vector<double> path = paths[index];
        for (int i = 0; i < nodes.size(); ++i) { 
            if (used.find(i) != used.end()) continue;
            pq.push(make_pair(cost + path[i], i));
        }        
    }
    cout << dijkstra[1] << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:21: error: request for member 'push_back' in '(& path)->std::vector<double>::operator[](((std::vector<double>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'}
   71 |             path[j].push_back(dist);
      |                     ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
 
#define D  double
typedef pair<D,int>T;
int N;
int X[1111],Y[1111],R[1111];
D dist[1111];
D INF=1e10;
D EPS=1e-9;
 
int table2[1111][1111];
D table[1111][1111];
 
signed main(){
 
    cin>>X[0]>>Y[0]>>X[1]>>Y[1];
    cin>>N;
    rep(i,N)cin>>X[i+2]>>Y[i+2]>>R[i+2];
    N+=2;
 
    rep(i,N)rep(j,N){
        table2[i][j]=(X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]);
        table[i][j]=sqrt(1.0*table2[i][j]);
    }
 
    fill_n(dist,1111,INF);
    dist[0]=0;
    priority_queue<T,vector<T>,greater<T>>que;
    que.push(make_pair(0,0));
    while(que.size()){
        D d;
        int idx;
        tie(d,idx)=que.top();
        que.pop();

        if(dist[i]<d) continue;

        rep(i,N){
            int foo=table2[i][idx];
            int bar=R[i]+R[idx];
            D cost=d;
            if(foo>bar*bar+EPS) cost+=sqrt(1.0*foo)-bar;
            if(dist[i]>EPS+cost){
                dist[i]=cost;
                que.push(T(dist[i],i));
            }
        }
    }
    printf("%.20f\n",dist[1]);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:17: error: 'i' was not declared in this scope
   51 |         if(dist[i]<d) continue;
      |                 ^
Language: C++

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<queue>
using namespace std;
int main(void){
	long double a[1002][1002];
	int n;
	int x[1002];
	int y[1002];
	int r[1002];
	long double d[1002];
	int e[1002];
	priority_queue<pair<double, int>> t;
	pair<double, int> pai;
	long long z;
	long long c;
	int p;
	int q;
	int s;
	int k;
	int zz;
	scanf("%d %d %d %d", &s, &k, &p, &q);
	scanf("%d", &n);
	x[0] = s;
	y[0] = k;
	x[n + 1] = p;
	y[n + 1] = q;
	r[0] = 0;
	r[n + 1] = 0;
	for (int i = 1; i <= n; i++){
		scanf("%d %d %d", &x[i], &y[i], &r[i]);
	}
	for (int i = 0; i < n + 2; i++){
		for (int j = i + 1; j < n + 2; j++){
			z = (y[j] - y[i])*(y[j] - y[i]);
			z = (x[j] - x[i])*(x[j] - x[i]) + z;
			a[i][j] = sqrt(z) - r[i] - r[j];
			a[j][i] = sqrt(z) - r[i] - r[j];
if(a[i][j]<0){
a[i][j]=0;
a[j][i]=0;
}
		}
		a[i][i] = 1;
		d[i] = 200000000;
		e[i] = 0;
	}
	d[0] = 0;
	t.push(make_pair(d[0], 0));
	for (int i = 0; t.empty() == 0 && e[n + 1] == 0; i++){
		zz = 0;
		for (int j = 0; t.empty() == 0 && zz == 0; j++){
			pai = t.top();
			z = pai.second;
			if (e[z] == 0)zz++;
			else t.pop();
		}
		if (zz == 0)break;
 
		e[z] = 1;
		for (int j = 0; j < n + 2; j++){
			if (d[z] + a[z][j] < d[j])
			{
				d[j] = d[z] + a[z][j];
 
				t.push(make_pair(-d[j], j));
			}
		}
		t.pop();
	}
 
	double m;
	int dd[20];
	m = d[n + 1];
printf(" %llf\n",d[n+1]);
	return 0;
}

Compiler output:
a.cc:62:1: error: extended character   is not valid in an identifier
   62 |  
      | ^
a.cc:68:1: error: extended character   is not valid in an identifier
   68 |  
      | ^
a.cc:74:1: error: extended character   is not valid in an identifier
   74 |  
      | ^
a.cc: In function 'int main()':
a.cc:62:1: error: '\U000000a0' was not declared in this scope
   62 |  
      | ^
a.cc:68:2: error: expected ';' before 't'
   68 |  
      |  ^
      |  ;
   69 |                                 t.push(make_pair(-d[j], j));
      |                                 ~
a.cc:74:1: error: '\U000000a0' was not declared in this scope
   74 |  
      | ^
a.cc:77:9: error: 'm' was not declared in this scope
   77 |         m = d[n + 1];
      |         ^
Language: C++

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<queue>
using namespace std;
int main(void){
	long double a[1002][1002];
	int n;
	int x[1002];
	int y[1002];
	int r[1002];
	long double d[1002];
	int e[1002];
	priority_queue<pair<double, int>> t;
	pair<double, int> pai;
	long long z;
	long long c;
	int p;
	int q;
	int s;
	int k;
	int zz;
	scanf("%d %d %d %d",&s, &k, &p, &q);
		scanf("%d", &n);
		x[0] = s;
		y[0] = k;
		x[n + 1] = p;
		y[n + 1] = q;
		r[0] = 0;
		r[n + 1] = 0;
		for (int i = 1; i <= n; i++){
			scanf("%d %d %d", &x[i], &y[i], &r[i]);
		}
		for (int i = 0; i < n + 2; i++){
			for (int j = i+1; j < n + 2; j++){
				z = (y[j] - y[i])*(y[j] - y[i]);
				z = (x[j] - x[i])*(x[j] - x[i]) + z;
				a[i][j] = sqrt(z)-r[i]-r[j];
				a[j][i] = sqrt(z)-r[i]-r[j];
			}
			a[i][i] = 1;
			d[i] = 200000000000;
			e[i] = 0;
		}
		d[0] = 0;
		t.push(make_pair(d[0], 0));
		for (int i = 0; t.empty() == 0&&e[n+1]==0; i++){
			zz = 0;
			for (int j = 0; t.empty() == 0 && zz == 0; j++){
				pai = t.top();
				z = pai.second;
				if (e[z] == 0)zz++;
				else t.pop();
			}
			if (zz == 0)break;
 
			e[z] = 1;
			for (int j = 0; j < n+2; j++){
				if (d[z] + a[z][j] < d[j])
				{
					d[j] = d[z] + a[z][j];
					t.push(make_pair(-d[j],j));
				}
			}
			t.pop();
		}
		double m;
		int dd[20];
		m = d[n + 1];
		for (int i = 0; i < 15; i++){
			if (i<10)dd[i] = round(m - 0.4999999999999);
			else dd[i] = round(m);
			m = m - dd[i];
			m = m * 10;
			printf("%d", dd[i]);
			if (i == 0)printf(".");
		}
		printf("\n");
 
	return 0;
}

Compiler output:
a.cc:58:1: error: extended character   is not valid in an identifier
   58 |  
      | ^
a.cc:81:1: error: extended character   is not valid in an identifier
   81 |  
      | ^
a.cc: In function 'int main()':
a.cc:58:1: error: '\U000000a0' was not declared in this scope
   58 |  
      | ^
a.cc:81:1: error: '\U000000a0' was not declared in this scope
   81 |  
      | ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)

double d[1002][1002];
double x[1002];
double y[1002];
double r[1002];
double cost[1002];
int done[1002] = {0};

int main(void)
{
	cin >> x[0] >> y[0];
	double xt, yt;
	cin >> xt >> yt;
	int N;
	cin >> N;
	x[N + 1] = xt;
	y[N + 1] = yt;

	Rep(i, N){
		cin >> x[i + 1] >> y[i + 1] >> r[i + 1];
	}
	Rep(a, N + 2){
		cost[a] = -1;
		Rep(b, N + 2){
			double dd = sqrt(pow(x[a] - x[b], 2) + pow(y[a] - y[b], 2)) - r[a] - r[b];
			if(dd < 0) dd = 0;
			d[a][b] = d[b][a] = dd;
		}
	}

	cost[0] = 0;
	while(1){
		int p = -1;
		Rep(i, N + 2){
			if(done[i] || cost[i] < 0){
				continue;
			}

			if(p == -1){
				p = i;
			}else if(cost[i] < cost[p]){
				p = i;
			}
		}

		if(p == -1){
			break;
		}

		done[p] = 1;

		Rep(i, N + 2){
			if(i == p) continue;
			double cost_ = cost[p] + d[p][i];
			if(cost[i] < 0 || cost[i] > cost_){
				cost[i] = cost_;
			}
		}
	}

	printf("%.10f\n", cost[N + 1]);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:42: error: 'pow' was not declared in this scope
   34 |                         double dd = sqrt(pow(x[a] - x[b], 2) + pow(y[a] - y[b], 2)) - r[a] - r[b];
      |                                          ^~~
a.cc:34:37: error: 'sqrt' was not declared in this scope
   34 |                         double dd = sqrt(pow(x[a] - x[b], 2) + pow(y[a] - y[b], 2)) - r[a] - r[b];
      |                                     ^~~~
Language: C

#include <stdio.h>
#include <math.h>
#define INF 1000000000

typedef struct {
    int x;
    int y;
    int r;
} baria;

double distance (baria a, baria b) {
    double result;
    result = sqrt(pow((double)a.x - (double)b.x, 2) + pow((double)a.y - (double)b.y, 2));
    result -= (a.r + b.r);
    if (result < 0) return 0;
    return result;
}

int main() {
    int i, j;
    double kyori;
    int N;
    int xs, ys, xt, yt;
    scanf("%d %d %d %d", &xs, &ys, &xt, &yt);
    scanf("%d", &N);
    
    typedef struct {
        double dist[N+2];
        double cost;
        int isUsed;
    } daiku;
    
    baria bar[N+2];
    bar[0].x = xs;
    bar[0].y = ys;
    bar[0].r = 0;
    bar[N+1].x = xt;
    bar[N+1].y = yt;
    bar[N+1].r = 0;

    
    for (i = 1; i < N+2; i++) {
        scanf("%d %d %d", &bar[i].x, &bar[i].y, &bar[i].r);
    }
    
    daiku dai[N+2];
    for (i = 0; i < N+2; i++) {
        for (j = 0; j < N+2; j++) {
            dai[i].dist[j] = distance(bar[i], bar[j]);
        }
        dai[i].cost = INF;
        dai[j].isUsed = 0;
    }
    dai[0].cost = 0;
    dai[0].isUsed = 1;
    
    while(1){
        double min = INF;
        for(i = 0; i < N+2; i++){
            if(!dai[i].isUsed && min > dai[i].cost) min = dai[i].cost;
        }
        if(min == INF)
            break;
        for(i = 0; i < N+2; i++){
            if(dai[i].cost == min){
                for(j = 0; j < N+2; j++){
                    if(dai[j].cost > dai[i].dist[j] + dai[i].cost) {
                        dai[j].cost = dai[i].dist[j] + dai[i].cost
                    }
                }
            }
        }
    }
    
    printf("%lf\n", dai[N+1].cost);
    
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:68:67: error: expected ';' before '}' token
   68 |                         dai[j].cost = dai[i].dist[j] + dai[i].cost
      |                                                                   ^
      |                                                                   ;
   69 |                     }
      |                     ~
Language: C++

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <vector>
#include <queue>
using namespace std;
#define INF 1e12
#define maxn 1005
int x[maxn];
int y[maxn];
int r[maxn];
int vis[maxn];
double dis[maxn];
vector<pair<int, double>>G[maxn];
struct point{
	int id;
	double dis;
	point(int id, double dis) : id(id),dis(dis){}
	bool operator <(const point &x)const{
		return x.dis < dis;
	}
};
int main()
{
	int xs, ys, xt, yt;
	cin >> xs >> ys >> xt >> yt;
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++){
		scanf("%d%d%d", &x[i], &y[i], &r[i]);
	}
	x[0] = xs; y[0] = ys; x[n + 1] = xt; y[n + 1] = yt; r[0] = 0; r[n + 1] = 0;
	for (int i = 0; i <= n + 1; i++){
		for (int j = 0; j <= n + 1; j++){
			double dis = sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
			if (r[i] + r[j] >= dis)
				dis = 0;
			else
				dis = dis - r[i] - r[j];
			G[i].push_back(make_pair(j, dis));
			G[j].push_back(make_pair(i, dis));
		}
	}
	memset(vis, 0, sizeof(vis));
	for (int i = 0; i <= n + 1; i++)
		dis[i] = INF;
	vis[0] = 1;
	dis[0] = 0.0;
	priority_queue<point>q;
	q.push(point(0, 0.0));
	while (!q.empty()){
		int cur = q.top().id;
		q.pop();
		vis[cur] = 1;
		for (int i = 0; i < G[cur].size(); i++){
			int np = G[cur][i].first;
			if (vis[np] != 1 && dis[np] > dis[cur] + G[cur][i].second){
				dis[np] = dis[cur] + G[cur][i].second;
				q.push(point(np, dis[np]));
			}
		}
	}

	printf("%0.10lf\n", dis[n + 1]);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:9: error: 'memset' was not declared in this scope
   45 |         memset(vis, 0, sizeof(vis));
      |         ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <queue>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

#include <iostream>
#include <cmath>
#include <queue>
#include <iomanip>
using namespace std;
typedef pair<double, int> P;

int xs, ys, xt, yt;
int N;
int x[1000], y[1000], r[1000];
struct edge {int to; double cost;};
vector<edge> G[1002];
double d[1002];

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d, d+N+2, DBL_MAX);
    d[s] = 0.0;
    que.push(P(0, s));
    while(!que.empty()){
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i=0; i<G[v].size(); i++){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

double getCost(int x1, int y1, int r1, int x2, int y2, int r2){
    double temp = sqrt(pow(x1-x2, 2) + pow(y1-y2, 2));
    return max(0.0, temp - r1 - r2);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    cin >> xs >> ys >> xt >> yt;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> x[i] >> y[i] >> r[i];
    }
    for(int i=0; i<N; i++){
        double c = getCost(xs, ys, 0, x[i], y[i], r[i]);
        G[0].push_back(edge{i+1, c});
        G[i+1].push_back(edge{0, c});
        c = getCost(xt, yt, 0, x[i], y[i], r[i]);
        G[N+1].push_back(edge{i+1, c});
        G[i+1].push_back(edge{N+1, c});
    }
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            double c = getCost(x[i], y[i], r[i], x[j], y[j], r[j]);
            G[i+1].push_back(edge{j+1, c});
            G[j+1].push_back(edge{i+1, c});
        }
    }
    dijkstra(0);
    cout << setprecision(32) << d[N+1] << endl;


	return 0;
}


Compiler output:
a.cc: In function 'void dijkstra(int)':
a.cc:17:20: error: 'DBL_MAX' was not declared in this scope
   17 |     fill(d, d+N+2, DBL_MAX);
      |                    ^~~~~~~
a.cc:5:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
    4 | #include <iomanip>
  +++ |+#include <cfloat>
    5 | using namespace std;
Language: C++

ll N,K,M;
ll mo=1000000007;
vector<ll> V;
ll dp[2020];

ll modpow(ll a, ll n = mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

vector<ll> enumdiv(ll n) {
	vector<ll> S;
	for(ll i=1;i*i<=n;i++) if(n%i==0) {S.push_back(i); if(i*i!=n) S.push_back(n/i); }
	sort(S.begin(),S.end());
	return S;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	
	V=enumdiv(N);
	M=V.size();
	
	ll ret=0;
	FOR(x,M) {
		dp[x] = modpow(K,(V[x]+1)/2);
		FOR(y,x) if(V[x]%V[y]==0) dp[x] += mo - dp[y];
		dp[x] %= mo;
		
		if(V[x]%2==0) {
			ret += dp[x]*V[x]/2;
		}
		else {
			ret += dp[x]*V[x];
		}
	}
	cout<<ret%mo<<endl;
	
	
}

Compiler output:
a.cc:1:1: error: 'll' does not name a type
    1 | ll N,K,M;
      | ^~
a.cc:2:1: error: 'll' does not name a type
    2 | ll mo=1000000007;
      | ^~
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<ll> V;
      | ^~~~~~
a.cc:4:1: error: 'll' does not name a type
    4 | ll dp[2020];
      | ^~
a.cc:6:1: error: 'll' does not name a type
    6 | ll modpow(ll a, ll n = mo-2) {
      | ^~
a.cc:12:1: error: 'vector' does not name a type
   12 | vector<ll> enumdiv(ll n) {
      | ^~~~~~
a.cc: In function 'void solve()':
a.cc:20:28: error: 'string' was not declared in this scope
   20 |         int i,j,k,l,r,x,y; string s;
      |                            ^~~~~~
a.cc:22:9: error: 'cin' was not declared in this scope
   22 |         cin>>N>>K;
      |         ^~~
a.cc:22:14: error: 'N' was not declared in this scope
   22 |         cin>>N>>K;
      |              ^
a.cc:22:17: error: 'K' was not declared in this scope
   22 |         cin>>N>>K;
      |                 ^
a.cc:24:9: error: 'V' was not declared in this scope
   24 |         V=enumdiv(N);
      |         ^
a.cc:24:11: error: 'enumdiv' was not declared in this scope; did you mean 'enum'?
   24 |         V=enumdiv(N);
      |           ^~~~~~~
      |           enum
a.cc:25:9: error: 'M' was not declared in this scope
   25 |         M=V.size();
      |         ^
a.cc:27:9: error: 'll' was not declared in this scope; did you mean 'l'?
   27 |         ll ret=0;
      |         ^~
      |         l
a.cc:28:9: error: 'FOR' was not declared in this scope
   28 |         FOR(x,M) {
      |         ^~~
a.cc:40:9: error: 'cout' was not declared in this scope
   40 |         cout<<ret%mo<<endl;
      |         ^~~~
a.cc:40:15: error: 'ret' was not declared in this scope
   40 |         cout<<ret%mo<<endl;
      |               ^~~
a.cc:40:19: error: 'mo' was not declared in this scope
   40 |         cout<<ret%mo<<endl;
      |                   ^~
a.cc:40:23: error: 'endl' was not declared in this scope
   40 |         cout<<ret%mo<<endl;
      |                       ^~~~
Language: C++

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

const int MOD = int(1e9) + 7;
using lint = long long;

struct modint {
    int v;
    modint(lint v_ = 0): v(v_ % MOD) { }
    modint operator+ (const modint &m) const {
        return modint(v + m.v);
    }
    modint operator- (const modint &m) const {
        return modint(v - m.v + MOD);
    }
    modint operator* (const modint &m) const {
        return modint((lint)v * m.v);
    }
    modint operator+= (const modint &m) {
        v = (v + m.v) % MOD;
        return *this;
    }
    modint operator*= (const modint &m) {
        v = ((lint)v * m.v) % MOD;
        return *this;
    }
    modint operator-= (const modint &m) {
        v = (v - m.v + MOD) % MOD;
        return *this;
    }
    modint pow(int k) {
        modint cur(v), ret(1);
        while(k > 0) {
            if(k & 1) ret *= cur;
            cur = cur * cur;
            k >>= 1;
        }
        return ret;
    }
    modint inv() {
        return pow(MOD - 2);
    }
};

const modint INV2 = modint(2).inv();

int N, K;

modint ans;

modint ways[int(5.1e4)];

int main() {
    scanf("%d%d", &N, &K);
    
    vector<int> divs;
    for(int i = 1; i * i <= N; i++) {
        if(N % i == 0) {
            divs.push_back(i);
            if(i * i != N) divs.push_back(N/i);
        }
    }
    
    sort(divs.begin(), divs.end());
    
    for(int i = 0; i < int(divs.size()); i++) {
        // degree of freedom : divs[i]
        
        ways[i] += modint(K).pow((divs[i] + 1) / 2);
        for(int j = 0; j < i; j++) if(divs[i] % divs[j] == 0) ways[i] -= ways[j];
        
        ans += (divs[i] % 2 == 1 ? modint(1) : INV2) * ways[i] * divs[i];
    }
    
    printf("%d\n", ans.v);
    
    
    return 0;
}

/*
N이 홀수

ABCBA => A, B, C 중 하나라도 다르면 서로 다른 수열을 얻음

BCBAA -> B=A, C=A -> 전부 같아야
CBAAB -> C=B=A
BAABC -> B=C=A
AABCB -> A=B=C

염려:
DEFED
EFEDD
FEDDE
EDDEF
DDEFE


N이 짝수 -> A, B, C가 하나라도 다르면 서로 다른 palin 수열 2개가 같은 결과

ABCCBA 
BCCBAA B=A=C
CCBAAB C=B=A
CBAABC (palin!)
BAABCC B=C=A
AABCCB A=B=C
*/ac

Compiler output:
a.cc:107:3: error: 'ac' does not name a type
  107 | */ac
      |   ^~
Language: C++

#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=10005,mod=1000000007;
int n,k,prm[N],c[N],a[N],tot;
typedef long long LL;
LL ret,ans;

LL getmi(LL a,LL x)
{
	LL rt=1;
	while(x)
	{
		if(x&1) rt=rt*a%mod;
		a=a*a%mod,x>>=1;
	}
	return rt;
}

void dfs2(int x,int d,int val)
{
	if(x>tot)
	{
		if(d&1) ret=(ret+d*getmi(k,(d/val+1)/2))%mod;
		else ret=(ret+d/2*getmi(k,(d/val+1)/2))%mod;
		return;
	}
	int nw=a[x]?prm[x]:1;
	rep(i,a[x],c[x]) dfs2(x+1,d*nw,val),nw*=prm[x];
}

void dfs1(int x,int mu,int val)
{
	if(x>tot)
	{
		ret=0,dfs2(1,1,val);
		ans=(ans+mu*ret)%mod;
		return;
	}
	a[x]=0,dfs1(x+1,mu,val);
	a[x]=1,dfs1(x+1,-mu,val*prm[x]);
}

int main()
{
	scanf("%d%d",&n,&k);
	int x=n,lim=sqrt(n);
	rep(i,2,lim) if(x%i==0)
	{
		prm[++tot]=i;
		while(x%i==0) x/=i,++c[tot];
	}
	if(x>1) prm[++tot]=x,c[tot]=1;
	dfs1(1,1,1);
	printf("%lld\n",(ans+mod)%mod);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:21: error: 'sqrt' was not declared in this scope
   51 |         int x=n,lim=sqrt(n);
      |                     ^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define MOD 1000000007

long long bipow(long long K, int p){
    if(p == 0) return 1;
    if(p % 2 == 0){
        long long tmp = (K * K) % MOD;
        return bipow(tmp, p / 2) % MOD;
    }else
        return (K * bipow(K, p-1)) % MOD;
}

vector<long long> divs(int n){
    vector<long long> ret;
    for(int i=1; i*i<=n; i++){
        if(n % i == 0){
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N, K;
    cin >> N >> K;

    vector<long long> dv = divs(N);
    sort(dv.begin(), dv.end());

    vector<long long> num(dv.size(), 0);

    num[0] = K;
    for(int i=1; i<dv.size(); i++){
        long long d = dv[i];
        long long tmp1 = bipow(K, (d+1)/2);
        long long tmp2 = 0;
        for(int j=0; j<i; j++){
            int d2 = dv[j];
            if(d % d2 == 0) tmp2 = (tmp2 + num[j]) % MOD;
        }
        num[i] = (tmp1 - tmp2 + MOD) % MOD;
    }
    long long ans = 0;
    for(int i=0; i<dv.size(); i++){
        long long d = dv[i];
        if(d % 2 == 0)
            ans += (num[i] * d / 2) % MOD;
        else
            ans += (num[i] * d) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   33 |     sort(dv.begin(), dv.end());
      |     ^~~~
      |     short
Language: C++

#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

#pragma region
template<class T>
vector<T> getDivisor(T n){
	vector<T> v;
	for(int i=1;i*i<=n;++i){
		if( n%i == 0 ){
			v.push_back(i);
			if( i != n/i ){//平方数で重複して数えないように
				v.push_back(n/i);
			}
		}
	}
	sort(v.begin(), v.end());
	return v;
}
#pragma endregion //約数列挙 getDivisor(n):O(√n)

void solve(){
	cin >> N >> K;
	dfs( N );
	
	vector<LL> yaku = getDivisor(N);
	int size = yaku.size();
	LL ans = 0;
	
	for(int i=0;i<size;++i){
		if( yaku[i] & 1 ){//奇数長の最小周期
			ans += (memo[ yaku[i] ]* yaku[i]);
		}else{//偶数長の最小周期
			/*
			↓ここから回るABCCBA
			ABC
			ABC←ここから回るCBAABC
			前半分を反転したものが後ろ半分になっている(偶数長の回文)
			サイクリックシフトで前半分をすべて後ろに持っていくと
			並びはそのままで後ろ半分の位置にくる。
			後ろ半分も並び順はそのままで前にくる。
			←→が→←の様にならぶ。
			→←もまた最小周期の条件を満たす。?
			サイクリックシフトで半分重複する。
			←1←2 →2→1
			→2→1 ←1←2
			偶数長の周期があったとすると、それをつなげた
			→2→1も周期性がある。
			回文なので←1←2も周期性がある。
			これは
			←1←2 →2→1が最小周期の条件と矛盾するので
			→2→1 ←1←2は偶数長の周期を持たない。

			→2→1 ←1←2が奇数長の周期を持つとする。
			元の長さが偶数なので、奇数長の周期が偶数個表れる。
			よって→2→1は奇数周期の回文を繋げて構成されている。
			同じ回文を繋げた文字列も回文なので
			←1←2も回文で奇数長の周期を持つ。
			←1←2 →2→1が奇数長の周期を持つ事になる。
			←1←2 →2→1が内部に周期を持たない事と矛盾するので
			→2→1 ←1←2は奇数長の周期を持たない。

			→2→1 ←1←2は内部に周期を持たない。
			*/
			ans += (memo[ yaku[i] ]* yaku[i]/2);
		}
		ans %= MOD;
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Compiler output:
a.cc: In function 'void solve()':
a.cc:65:16: error: 'N' was not declared in this scope
   65 |         cin >> N >> K;
      |                ^
a.cc:65:21: error: 'K' was not declared in this scope
   65 |         cin >> N >> K;
      |                     ^
a.cc:66:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   66 |         dfs( N );
      |         ^~~
      |         ffs
a.cc:74:33: error: 'memo' was not declared in this scope
   74 |                         ans += (memo[ yaku[i] ]* yaku[i]);
      |                                 ^~~~
a.cc:107:33: error: 'memo' was not declared in this scope
  107 |                         ans += (memo[ yaku[i] ]* yaku[i]/2);
      |                                 ^~~~