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

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

const int INF = 1e+9;
typedef pair<int, int> P;

int memo[151][11][80];
int N, M;
vector<P> G[151];

int rec(int n, int p, int m){
	if(memo[n][p][m] != -1)
		return memo[n][p][m];
		
	int res = INF;
	if(n > N){
		return 0;
	}
	if(n == N){
		res = min(res, rec(n + 1, p, m));
	}
	if(n == N - 1 && m >= 1){
		res = min(res, rec(n + 2, p, m - 1));
	}
	if(n == 0){
		for(int i = 0; i < G[0].size(); ++i){
			res = min(res, rec(n + 1, i, m));
		}
		if(m >= 1){
			for(int i = 0; i < G[1].size(); ++i){
				res = min(res, rec(n + 2, i, m - 1));
			}
		}
	}
	else{
		for(int i = 0; i < G[n].size(); ++i){
			res = min(res, rec(n + 1, i, m) + (G[n - 1][p].second + G[n][i].second) * abs(G[n][i].first - G[n - 1][p].first));
		}
		if(n != N - 1 && m >= 1){
			for(int i = 0; i < G[n + 1].size(); ++i){
				res = min(res, rec(n + 2, i, m - 1) + (G[n - 1][p].second + G[n + 1][i].second) * abs(G[n + 1][i].first - G[n - 1][p].first));
			}
		}
	}
	return memo[n][p][m] = res;
}

int main() {
	while(cin >> N >> M && (N || M)){
		memset(memo, -1, sizeof(memo));
		for(int i = 0; i <= 150; ++i)
			G[i].clear();
		int k, d, x;
		for(int i = 0; i < N; ++i){
			scanf("%d", &k);
			for(int j = 0; j < k; ++j){
				scanf("%d%d", &d, &x);
				G[i].push_back(P(d, x));
			}
		}
		cout << rec(0, 0, M) << endl;
	}
	return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <vector>
^
Main.java:3: error: illegal character: '#'
#include <map>
^
Main.java:4: error: illegal character: '#'
#include <algorithm>
^
Main.java:5: error: illegal character: '#'
#include <cmath>
^
Main.java:6: error: illegal character: '#'
#include <cstring>
^
Main.java:9: error: class, interface, enum, or record expected
const int INF = 1e+9;
^
Main.java:10: error: class, interface, enum, or record expected
typedef pair<int, int> P;
^
Main.java:12: error: class, interface, enum, or record expected
int memo[151][11][80];
^
Main.java:13: error: class, interface, enum, or record expected
int N, M;
^
Main.java:14: error: class, interface, enum, or record expected
vector<P> G[151];
^
Main.java:16: error: unnamed classes are a preview feature and are disabled by default.
int rec(int n, int p, int m){
^
  (use --enable-preview to enable unnamed classes)
Main.java:66: error: not a statement
		cout << rec(0, 0, M) << endl;
		                     ^
Main.java:60: error: illegal start of expression
			scanf("%d", &k);
			            ^
Main.java:62: error: illegal start of expression
				scanf("%d%d", &d, &x);
				              ^
Main.java:62: error: illegal start of expression
				scanf("%d%d", &d, &x);
				                  ^
16 errors
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#define INF (1000000000)
#define MOD (1000000007)
using namespace std;

typedef vector<int> VI;
typedef vector<int>::iterator VII;
typedef vector<double> VD;
typedef vector<double>::iterator VDI;
typedef vector<long>::iterator VL;
typedef vector<long>::iterator VLI;
typedef pair<int, int> P;


int d[150][1000];
int dp[150][1000][100];

int main()
{
	int n, m;
	while (scanf("%d %d", &n, &m), n + m){
		memset(d, 0, sizeof(d));
		int maxx = 0;
		
		for (int i = 0; i < n; i++){
			int k;
			scanf("%d", &k);
			for (int j = 0; j < k; j++){
				int x;
				scanf("%d", &x);
				x--;
				scanf("%d", &d[i][x]);
				
				maxx = max(maxx, x);
			}
		}
		
		for (int i = 0; i < 150; i++){
			for (int j = 0; j <= maxx; j++){
				for (int k = 0; k < 100; k++){
					if (i == 0 && d[i][j] && k == 0) dp[i][j][k] = 0;
					else dp[i][j][k] = INF;
				}
			}
		}
		
		for (int i = 0; i < n; i++){
			for (int j = 0; j <= maxx; j++){
				for (int k = 0; k <= maxx; k++){
					for (int l = 0; l <= m; l++){
						if (d[i][j] && d[i + 1][k]){
							dp[i + 1][k][l] = min(dp[i + 1][k][l], dp[i][j][l] + (d[i][j] + d[i + 1][k]) * abs(j - k));
							//printf("%d\n", dp[i + 1][k][l]);
						}
						
						if (i < n - 1 && d[i][j] && d[i + 2][k]){
							dp[i + 2][k][l + 1] = min(dp[i + 2][k][l + 1], dp[i][j][l] + (d[i][j] + d[i + 2][k]) * abs(j - k));
						}
					}
				}
			}
		}
		
		int mini = INF;
		for (int i = 0; i <= maxx i++){
			for (int j = 0; j <= m; j++){
				mini = min(mini, dp[n - 1][i][j]);
			}
		}
		
		printf("%d\n", mini);
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:80:42: error: expected ';' before 'i'
   80 |                 for (int i = 0; i <= maxx i++){
      |                                          ^~
      |                                          ;
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define INF(a) memset(a,1000000000,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define MAX 
using namespace std;

int n,m,dp[155][80][11];
vector<int> x[155],d[155];

void solve(){
 for(;;){
  cin>>n>>m;
  if(!n) break;
  int kk,xx,dd;
  FOR(i,n){
   cin>>kk;
   FOR(j,kk){
    cin>>xx>>dd;
    x[i].pb(xx);
    d[i].pb(dd);
   }
  }
  INF(dp);
  FOR(i,m+1) dp[n-1][i]=0;
  for(int i=n-2;i>=0;i--){
   FOR(j,m+1){
    FOR(k,x[i].size()){
     if(i!=n-2&&j){
      FOR(l,x[i+2].size()){
       dp[i][j][x[i][k]]=min(dp[i][j][x[i][k]],dp[i+2][j-1][x[i+2][l]]+((d[i][k]+d[i+2][l])*abs(x[i][k]-x[i+2][l])));
      }
     }
     FOR(l,x[i+1].size()){
      dp[i][j][x[i][k]]=min(dp[i][j][x[i][k]],dp[i+1][j][x[i+1][l]]+((d[i][k]+d[i+1][l])*abs(x[i][k]-x[i+1][l])));
     }
    }
   }
  }
  int mi=1000000000;
  FOR(i,x[0].size()) mi=min(mi,dp[i][m][x[0][i]]);
  cout<<mi<<endl;
 }
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:32:24: error: incompatible types in assignment of 'int' to 'int [11]'
   32 |   FOR(i,m+1) dp[n-1][i]=0;
      |              ~~~~~~~~~~^~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define MAX 
using namespace std;

int n,m;
ll dp[155][80][10],INF=1000000000000000LL;
vector<int> x[155],d[155];

void solve(){
 for(;;){
  cin>>n>>m;
  if(!n&&!m) break;
  int kk,xx,dd;
  FOR(i,n){
   cin>>kk;
   FOR(j,kk){
    cin>>xx>>dd;
    x[i+1].pb(xx);
    d[i+1].pb(dd);
   }
  }
  FOR(i,155) FOR(j,80) FOR(k,10) dp[i][j][k]=INF;
  FOR(i,m+1) FOR(j,x[n].size()) dp[n][i][j]=0LL;
  for(int i=n-1;i>0;i--){
   FOR(j,m+1){
    FOR(k,x[i].size()){
     if(j){
      if(i==n-1) dp[i][j][k]=0;
      else{
       FOR(l,x[i+2].size()){
        dp[i][j][k]=min(dp[i][j][k],dp[i+2][j-1][l]+(ll)(d[i][k]+d[i+2][l])*abs(x[i][k]-x[i+2][l]));
       }
      }
     }
     FOR(l,x[i+1].size()){
      dp[i][j][k]=min(dp[i][j][k],dp[i+1][j][l]+(ll)(d[i][k]+d[i+1][l])*abs(x[i][k]-x[i+1][l]));
     }
    }
   }
  }
  ll mi=INF;
  FOR(i,x[1].size()) mi=min(mi,dp[1][m][i]);
  if(m) FOR(i,x[2].size()) mi=min(mi,dp[2][m-1][i]);
  cout<<mi<<endl;
  x.clear(); d.clear();
 }
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:54:5: error: request for member 'clear' in 'x', which is of non-class type 'std::vector<int> [155]'
   54 |   x.clear(); d.clear();
      |     ^~~~~
a.cc:54:16: error: request for member 'clear' in 'd', which is of non-class type 'std::vector<int> [155]'
   54 |   x.clear(); d.clear();
      |                ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#define MP make_pair
#define INF 1000000000
using namespace std;

int dp[3][11][85];
vector<pair<int,int> > ve[160];
int main(){
	int N,M,a,b,c,T,I,O,tmp,cnt,cntt,hog,res;
	vector<pair<int,int> >::iterator it,lit;
	while(true){
		cin>>N>>M;
		if(N==0&&M==0) break;
		ve[0].clear();
		for(int i=1;i<=N;i++){
			ve[i].clear();
			cin>>a;
			for(int j=0;j<a;j++){
				cin>>b>>c;
				ve[i].push_back(MP(b,c));
			}
		}
		
		T=0;I=1;O=2;
		for(int i=0;i<3;i++){
			for(int j=0;j<11;j++){
				fill(dp[i][j],dp[i][j]+85,INF);
			}
		}
		for(int i=0;i<11;i++){
			ve[0].push_back(MP(i,0));
			dp[T][i][0]=0;
		}
		for(int i=0;i<(int)ve[0].size();i++){
			dp[I][i][0]=0;
		}
		
		for(int i=2;i<=N;i++){
			cnt=0;
			for(it=ve[i].begin();it!=ve[i].end();it++){
				for(int j=0;j<=min(i/2,M);j++){
					cntt=0;
					hog=INF;
					for(lit=ve[i-1].begin();lit!=ve[i-1].end();lit++){
						hog=min(hog,dp[I][cntt][j]+((lit->second)+(it->second))*abs((lit->first)-(it->first)));
						cntt++;
					}
					if(j!=0){
						cntt=0;
						for(lit=ve[i-2].begin();lit!=ve[i-2].end();lit++){
							hog=min(hog,dp[T][cntt][j-1]+((lit->second)+(it->second))*abs((lit->first)-(it->first)));
							cntt++;
						}
					}
					dp[O][cnt][j]=hog;
					//cout<<i<<" "<<cnt<<" "<<j<<" "<<hog<<endl;//
				}
				cnt++;
			}
			tmp=T;
			T=I;
			I=O;
			O=tmp;
		}
		res=INF;
		for(int i=0;i<=M;i++){
			for(int j=0;j<(int)ve[N].size();j++){
				res=min(res,dp[I][j][i]);
			}
		}
		if(i!=0)for(int i=0;i<M;i++){
			for(int j=0;j<(int)ve[N-1].size();j++){
				res=min(res,dp[T][j][i]);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:20: error: 'i' was not declared in this scope
   76 |                 if(i!=0)for(int i=0;i<M;i++){
      |                    ^
Language: C++

#include <iostream>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#define MP make_pair
#define INF 1000000000
using namespace std;

int dp[3][11][85];
vector<pair<int,int> > ve[160];
int main(){
	int N,M,a,b,c,T,I,O,tmp,cnt,cntt,hog,res;
	vector<pair<int,int> >::iterator it,lit;
	while(true){
		cin>>N>>M;
		if(N==0&&M==0) break;
		ve[0].clear();
		for(int i=1;i<=N;i++){
			ve[i].clear();
			cin>>a;
			for(int j=0;j<a;j++){
				cin>>b>>c;
				ve[i].push_back(MP(b,c));
			}
		}
		
		T=0;I=1;O=2;
		for(int i=0;i<3;i++){
			for(int j=0;j<11;j++){
				fill(dp[i][j],dp[i][j]+85,INF);
			}
		}
		for(int i=0;i<11;i++){
			ve[0].push_back(MP(i,0));
			dp[T][i][0]=0;
		}
		for(int i=0;i<(int)ve[1].size();i++){
			dp[I][i][0]=0;
		}
		
		for(int i=2;i<=N;i++){
			cnt=0;
			for(it=ve[i].begin();it!=ve[i].end();it++){
				for(int j=0;j<=min(i/2,M);j++){
					cntt=0;
					hog=INF;
					for(lit=ve[i-1].begin();lit!=ve[i-1].end();lit++){
						hog=min(hog,dp[I][cntt][j]+((lit->second)+(it->second))*abs((lit->first)-(it->first)));
						cntt++;
					}
					if(j!=0){
						cntt=0;
						for(lit=ve[i-2].begin();lit!=ve[i-2].end();lit++){
							hog=min(hog,dp[T][cntt][j-1]+((lit->second)+(it->second))*abs((lit->first)-(it->first)));
							cntt++;
						}
					}
					dp[O][cnt][j]=hog;
					//cout<<i<<" "<<cnt<<" "<<j<<" "<<hog<<endl;//
				}
				cnt++;
			}
			tmp=T;
			T=I;
			I=O;
			O=tmp;
		}
		res=INF;
		for(int i=0;i<=M;i++){
			for(int j=0;j<(int)ve[N].size();j++){
				res=min(res,dp[I][j][i]);
			}
		}
		if(i!=0)for(int i=0;i<M;i++){
			for(int j=0;j<(int)ve[N-1].size();j++){
				res=min(res,dp[T][j][i]);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:20: error: 'i' was not declared in this scope
   76 |                 if(i!=0)for(int i=0;i<M;i++){
      |                    ^
Language: C++

#include<bits/stdc++.h>
#define LL long long
#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;
static const LL INF = 1LL<<61LL;
typedef pair<LL,LL> PLL;

LL N,M;
LL ans;
LL V[160][1010];
//LL mem[160][1001][80];

LL cal(int y,int x,int m){
    LL res=INF;
    //if(mem[y][x][m]!=-1)return mem[y][x][m];
    if(y>=N)return 0;
    if(y==0){
        FOR(i,1,1000){
            if(V[y+1][i]!=INF)
            res=cal(y+1,i,m);
        }
    }
    else{
        if(V[y][x]!=INF){
            FOR(i,1,1000){
                    if(m>0&&V[y+1][i]!=INF&&V[y+2][i]!=INF){
                        LL d1=(V[y][x]+V[y+1][i])*abs(x-i);
                        LL d2=(V[y][x]+V[y+2][i])*abs(x-i);
                        res=min(cal(y+1,i,m)+d1,min(cal(y+2,i,m-1)+d2,res));
                    }
                    else if(V[y+1][i]!=INF&&V[y+2][i]==INF){
                        LL d1=(V[y][x]+V[y+1][i])*abs(x-i);
                        res=min(cal(y+1,i,m)+d1,res);
                    }
                    else if(V[y+1][i]==INF&&V[y+2][i]!=INF&&m>0){
                        LL d2=(V[y][x]+V[y+2][i])*abs(x-i);
                        res=min(cal(y+2,i,m)+d2,res);
                    }
            }
        }
    }
    return res;
}

int main(){
    cin>>N>>M;
    memset(mem,-1,sizeof(mem));
    rep(i,151)rep(j,1001)V[i][j]=INF;
    FOR(i,1,N){
        LL t;
        cin>>t;
        rep(j,t){
            LL x,k;
            cin>>x>>k;
            V[i][x]=k;
        }
    }
    ans=cal(0,0,M);
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:12: error: 'mem' was not declared in this scope
   48 |     memset(mem,-1,sizeof(mem));
      |            ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
int main(){
  int n,m;
  while(cin>>n>>m,n||m){
    int dp[200][200];
    int i,j,k,x,d,a;
    int inf = 1 << 20;
    int ans=inf;
    vector<PP> v[200]; 
    for(i=0;i<200;i++) v[i].clear();
    int c=0;
    for(i=0;i<n;i++){
      cin >> k;
      for(j=0;j<k;j++){
	cin >> x >> d;
	v[i].push_back(PP(c,P(x,d)));
	c++;
      }
    }
    fill(dp[0],dp[199],inf);
    for(i=0;i<v[0].size();i++){
      dp[v[0][i].first][0]=0;
    }
    
    for(i=0;i<n;i++){
      for(j=0;j<v[i].size();j++){
	
	for(a=0;a<=m;a++){
	  
	  if(dp[v[i][j].first][a]==inf) continue;
	  /*
	  for(k=0;k<100;k++){
	    
	    dp[v[i+1][k].first][a]=min(dp[v[i+1][k].first][a],
				       dp[v[i][j].first][a]
				       +abs(v[i+1][k].second.first-v[i][j].second.first)
				       *(v[i+1][k].second.second+v[i][j].second.second));
				       */
	  }
	  /*
	  for(k=0;k<v[i+2].size();k++){
	    dp[v[i+2][k].first][a+1]=min(dp[v[i+2][k].first][a+1],
				       dp[v[i][j].first][a]
				       +abs(v[i+2][k].second.first-v[i][j].second.first)
				       *(v[i+2][k].second.second+v[i][j].second.second));
	  }
	  */
	}
	
      }
    }
    /*
    for(i=0;i<v[n-1].size();i++){
      for(j=0;j<=m;j++){
	ans=min(ans,dp[v[n-1][i].first][j]);
      }
    }
    for(i=0;i<v[n-2].size();i++){
      for(j=0;j<=m-1;j++){
	ans=min(ans,dp[v[n-2][i].first][j]);
      }
    }
    */
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   67 |     cout << ans << endl;
      |             ^~~
      |             abs
a.cc: At global scope:
a.cc:69:3: error: expected unqualified-id before 'return'
   69 |   return 0;
      |   ^~~~~~
a.cc:70:1: error: expected declaration before '}' token
   70 | }
      | ^
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define int long long
using namespace std;

struct isi {
	int zahyou, suberi, mincost;
};
int main()
{
	int a, b;
	while (cin >> a >> b, a | b) {
		vector<isi>I[152][78]{};//??????
		int c; cin >> c;
		for (int d = 0; d < c; d++) {
			int e, f; cin >> e >> f; 
			isi g; g.zahyou = e; g.suberi = f; g.mincost = 0;
			I[0][b].push_back(g);
		}
		for (int e = 1; e < a; e++) {
			int f; scanf("%lld", &f);
			for (int g = 0; g < f; g++) {
				int h, i; scanf("%lld%lld", &h, &i); 
				for (int j = b; j >= 0; j--) {
					int m = 1 << 29;
					for (int k = 0; k < I[e-1][j].size(); k++) {
						m = min(m, I[e-1][j][k].mincost+(i + I[e - 1][j][k].suberi)*abs(h - I[e - 1][j][k].zahyou));
					}
					isi n;
					n.zahyou = h; n.suberi = i; n.mincost = m;
					I[e][j].push_back(n);
					if (e >= 2 && j<b) {
						int m = 1 << 29;
						for (int k = 0; k < I[e - 2][j + 1].size(); k++) {
							m = min(m, I[e-2][j+1][k].mincost+(i + I[e - 2][j + 1][k].suberi)*abs(h - I[e - 2][j + 1][k].zahyou));
						}
						isi n;
						n.zahyou = h; n.suberi = i; n.mincost = m;
						I[e][j].push_back(n);
					}
				}
			}
		}
		int S = 1 << 29;
		for (int x = 0; x <= b; x++) {
			for (int y = 0; y < I[a-1][x].size(); y++) {
				S = min(S, I[a-1][x][y].mincost);
			}
		}
		cout << S << endl;
	}
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define INF LLONG_MAX/3
#define int long long
using namespace std;

struct isi {
	int zahyou, suberi, mincost;
};
signed main()
{
	int a, b;
	while (cin >> a >> b, a | b) {
		vector<isi>I[152][78]{};//??????
		int c; cin >> c;
		for (int d = 0; d < c; d++) {
			int e, f; cin >> e >> f; 
			isi g; g.zahyou = e; g.suberi = f; g.mincost = 0;
			I[0][b].push_back(g);
		}
		for (int e = 1; e < a; e++) {
			int f; scanf("%lld", &f);
			for (int g = 0; g < f; g++) {
				int h, i; scanf("%lld%lld", &h, &i); 
				for (int j = b; j >= 0; j--) {
					int m = INF;
					for (int k = 0; k < I[e-1][j].size(); k++) {
						m = min(m, I[e-1][j][k].mincost+(i + I[e - 1][j][k].suberi)*abs(h - I[e - 1][j][k].zahyou));
					}
					isi n;
					n.zahyou = h; n.suberi = i; n.mincost = m;
					I[e][j].push_back(n);
					if (e >= 2 && j<b) {
						int m = INF;
						for (int k = 0; k < I[e - 2][j + 1].size(); k++) {
							m = min(m, I[e-2][j+1][k].mincost+(i + I[e - 2][j + 1][k].suberi)*abs(h - I[e - 2][j + 1][k].zahyou));
						}
						isi n;
						n.zahyou = h; n.suberi = i; n.mincost = m;
						I[e][j].push_back(n);
					}
				}
			}
		}
		int S = INF;
		for (int x = 0; x <= b; x++) {
			for (int y = 0; y < I[a-1][x].size(); y++) {
				S = min(S, I[a-1][x][y].mincost);
			}
		}
		cout << S << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: 'LLONG_MAX' was not declared in this scope
    5 | #define INF LLONG_MAX/3
      |             ^~~~~~~~~
a.cc:28:49: note: in expansion of macro 'INF'
   28 |                                         int m = INF;
      |                                                 ^~~
a.cc:5:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<algorithm>
  +++ |+#include <climits>
    5 | #define INF LLONG_MAX/3
a.cc:5:13: error: 'LLONG_MAX' was not declared in this scope
    5 | #define INF LLONG_MAX/3
      |             ^~~~~~~~~
a.cc:47:25: note: in expansion of macro 'INF'
   47 |                 int S = INF;
      |                         ^~~
a.cc:5:13: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #define INF LLONG_MAX/3
      |             ^~~~~~~~~
a.cc:47:25: note: in expansion of macro 'INF'
   47 |                 int S = INF;
      |                         ^~~
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define int long long
using namespace std;

struct isi {
	int zahyou, suberi, mincost;
};
const int INF = LLONG_MAX / 3;
signed main()
{
	int a, b;
	while (cin >> a >> b, a | b) {
		vector<isi>I[152][78]{};//??????
		int c; cin >> c;
		for (int d = 0; d < c; d++) {
			int e, f; cin >> e >> f; 
			isi g; g.zahyou = e; g.suberi = f; g.mincost = 0;
			I[0][b].push_back(g);
		}
		for (int e = 1; e < a; e++) {
			int f; scanf("%lld", &f);
			for (int g = 0; g < f; g++) {
				int h, i; scanf("%lld%lld", &h, &i); 
				for (int j = b; j >= 0; j--) {
					int m = INF;
					for (int k = 0; k < I[e-1][j].size(); k++) {
						m = min(m, I[e-1][j][k].mincost+(i + I[e - 1][j][k].suberi)*abs(h - I[e - 1][j][k].zahyou));
					}
					isi n;
					n.zahyou = h; n.suberi = i; n.mincost = m;
					I[e][j].push_back(n);
					if (e >= 2 && j<b) {
						int m = INF;
						for (int k = 0; k < I[e - 2][j + 1].size(); k++) {
							m = min(m, I[e-2][j+1][k].mincost+(i + I[e - 2][j + 1][k].suberi)*abs(h - I[e - 2][j + 1][k].zahyou));
						}
						isi n;
						n.zahyou = h; n.suberi = i; n.mincost = m;
						I[e][j].push_back(n);
					}
				}
			}
		}
		int S = INF;
		for (int x = 0; x <= b; x++) {
			for (int y = 0; y < I[a-1][x].size(); y++) {
				S = min(S, I[a-1][x][y].mincost);
			}
		}
		cout << S << endl;
	}
}

Compiler output:
a.cc:11:17: error: 'LLONG_MAX' was not declared in this scope
   11 | const int INF = LLONG_MAX / 3;
      |                 ^~~~~~~~~
a.cc:5:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<algorithm>
  +++ |+#include <climits>
    5 | #define int long long
Language: C++

#include<bits/stdc++>h>
#define int long long
using namespace std;

struct isi {
	int zahyou, suberi, mincost;
};
const int INF = LLONG_MAX / 3;
signed main()
{
	int a, b;
	while (cin >> a >> b, a | b) {
		vector<isi>I[152][78]{};//??????
		int c; cin >> c;
		for (int d = 0; d < c; d++) {
			int e, f; cin >> e >> f; 
			isi g; g.zahyou = e; g.suberi = f; g.mincost = 0;
			I[0][b].push_back(g);
		}
		for (int e = 1; e < a; e++) {
			int f; scanf("%lld", &f);
			for (int g = 0; g < f; g++) {
				int h, i; scanf("%lld%lld", &h, &i); 
				for (int j = b; j >= 0; j--) {
					int m = INF;
					for (int k = 0; k < I[e-1][j].size(); k++) {
						m = min(m, I[e-1][j][k].mincost+(i + I[e - 1][j][k].suberi)*abs(h - I[e - 1][j][k].zahyou));
					}
					isi n;
					n.zahyou = h; n.suberi = i; n.mincost = m;
					I[e][j].push_back(n);
					if (e >= 2 && j<b) {
						int m = INF;
						for (int k = 0; k < I[e - 2][j + 1].size(); k++) {
							m = min(m, I[e-2][j+1][k].mincost+(i + I[e - 2][j + 1][k].suberi)*abs(h - I[e - 2][j + 1][k].zahyou));
						}
						isi n;
						n.zahyou = h; n.suberi = i; n.mincost = m;
						I[e][j].push_back(n);
					}
				}
			}
		}
		int S = INF;
		for (int x = 0; x <= b; x++) {
			for (int y = 0; y < I[a-1][x].size(); y++) {
				S = min(S, I[a-1][x][y].mincost);
			}
		}
		cout << S << endl;
	}
}

Compiler output:
a.cc:1:23: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++>h>
      |                       ^
a.cc:1:9: fatal error: bits/stdc++>: No such file or directory
    1 | #include<bits/stdc++>h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#define int long long
#define INF INT_MAX
using namespace std;

struct isi {
	int zahyou, suberi, mincost;
};
signed main()
{
	int a, b;
	while (cin >> a >> b, a | b) {
		vector<isi>c[150][75];
		int d;
		cin >> d;
		for (int e = 0; e < d; e++) {
			isi h; h.mincost = 0;
			scanf("%lld%lld", &h.zahyou, &h.suberi);
			c[0][b].push_back(h);
		}
		for (int f = 1; f < a; f++) {
			int g; cin >> g;
			for (int h = 0; h < g; h++) {
				int i, j; scanf("%lld%lld", &i, &j);
				for (int k = b; k >= 0; k--) {
					int m = INF;
					for (int l = 0; l < c[f - 1][k].size(); l++) {
						m = min(m, c[f - 1][k][l].mincost + (c[f - 1][k][l].suberi + j)*abs(c[f - 1][k][l].zahyou - i));
					}
					if (m != INF) {
						isi r; r.zahyou = i; r.suberi = j; r.mincost = m;
						c[f][k].push_back(r);
					}
					if (k != b&&f > 1) {
						int m = INF;
						for (int l = 0; l < c[f - 2][k+1].size(); l++) {
							m = min(m, c[f - 2][k+1][l].mincost + (c[f - 2][k+1][l].suberi + j)*abs(c[f - 2][k+1][l].zahyou - i));
						}
						if (m != INF) {
							isi r; r.zahyou = i; r.suberi = j; r.mincost = m;
							c[f][k].push_back(r);
						}
					}
				}
			}
		}
		int S = INF;
		for (int p = 0; p <= b; p++) {
			for (isi q : c[a - 1][p]) {
				S = min(S, q.mincost);
			}
		}
		cout << S << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'INT_MAX' was not declared in this scope
    7 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:30:49: note: in expansion of macro 'INF'
   30 |                                         int m = INF;
      |                                                 ^~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include<vector>
  +++ |+#include <climits>
    6 | #define int long long
a.cc:7:13: error: 'INT_MAX' was not declared in this scope
    7 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:51:25: note: in expansion of macro 'INF'
   51 |                 int S = INF;
      |                         ^~~
a.cc:7:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:51:25: note: in expansion of macro 'INF'
   51 |                 int S = INF;
      |                         ^~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#define int long long
#define INF INT_MAX
using namespace std;

struct isi {
	int zahyou, suberi, mincost;
};
signed main()
{
	int a, b;
	while (cin >> a >> b, a | b) {
		vector<isi>c[152][78];
		int d;
		cin >> d;
		for (int e = 0; e < d; e++) {
			isi h; h.mincost = 0;
			scanf("%lld%lld", &h.zahyou, &h.suberi);
			c[0][b].push_back(h);
		}
		for (int f = 1; f < a; f++) {
			int g; cin >> g;
			for (int h = 0; h < g; h++) {
				int i, j; scanf("%lld%lld", &i, &j);
				if (f == 1&&b) {
					isi o; o.zahyou = i; o.suberi = j; o.mincost = 0;
					c[1][b - 1].push_back(o);
				}
				for (int k = b; k >= 0; k--) {
					int m = INF;
					for (int l = 0; l < c[f - 1][k].size(); l++) {
						m = min(m, c[f - 1][k][l].mincost + (c[f - 1][k][l].suberi + j)*abs(c[f - 1][k][l].zahyou - i));
					}
					if (m != INF) {
						isi r; r.zahyou = i; r.suberi = j; r.mincost = m;
						c[f][k].push_back(r);
					}
					if (k != b&&f > 1) {
						int m = INF;
						for (int l = 0; l < c[f - 2][k+1].size(); l++) {
							m = min(m, c[f - 2][k+1][l].mincost + (c[f - 2][k+1][l].suberi + j)*abs(c[f - 2][k+1][l].zahyou - i));
						}
						if (m != INF) {
							isi r; r.zahyou = i; r.suberi = j; r.mincost = m;
							c[f][k].push_back(r);
						}
					}
				}
			}
		}
		int S = INF;
		for (int p = 0; p <= b; p++) {
			for (isi q : c[a - 1][p]) {
				S = min(S, q.mincost);
			}
		}
		for (int p = 1; p <= b; p++) {
			for (isi q : c[a - 2][p]) {
				S = min(S, q.mincost);
			}
		}
		cout << S << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'INT_MAX' was not declared in this scope
    7 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:34:49: note: in expansion of macro 'INF'
   34 |                                         int m = INF;
      |                                                 ^~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include<vector>
  +++ |+#include <climits>
    6 | #define int long long
a.cc:7:13: error: 'INT_MAX' was not declared in this scope
    7 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:55:25: note: in expansion of macro 'INF'
   55 |                 int S = INF;
      |                         ^~~
a.cc:7:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:55:25: note: in expansion of macro 'INF'
   55 |                 int S = INF;
      |                         ^~~
Language: C++

/*
Be joyful in hope, patient in affliction, faithful in prayer.
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <vector>
#include <deque>
#include <functional>
#include <iterator>
#include <utility>
#include <bitset>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <cctype>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define SZ(x) ((int)x.size())
#define openfile {freopen("inp.txt","rt",stdin);freopen("out.txt","wt",stdout);}
#define debug 0

template <typename T> inline void next_int(T &x) {
	x = 0; char c; bool neg = false;
	while (!isdigit(c = getchar())) if (c == '-') neg = true;
	do x = x*10 + c - 48; while (isdigit(c = getchar()));
	if (neg) x = -x;
}

template <typename T> inline void write_int(T x, char last = 0) {
	if (x < 0) putchar('-'), x = abs(x);
	char tmp[20]; int cnt = 0;
	while (x >= 10) tmp[cnt++] = x % 10 + 48, x /= 10;
	tmp[cnt] = x + 48;
	FORD(i, cnt, 0) putchar(tmp[i]);
	if (last) putchar(last);
}

const ll oo = (ll)1e18+7;
int n, m;
ll dp[155][15][80];
int k[155], x[155][25], s[155][25];

int main() {
	while(scanf("%d%d", &n, &m) == 2 && n){
		static  = {};
		REP(i, 0, 155) REP(j, 0, 15)REP(k, 0, 80) dp[i][j][k] = oo;
		REP(i, 0, n) {
			scanf("%d", &k[i]);
			REP(j, 0, k[i]) scanf("%d%d", &x[i][j], &s[i][j]);
		}
		REP(i, 0, k[0]) dp[0][i][0] = 0;
		REP(i, 0, k[1]) dp[1][i][1] = 0;
		REP(i, 0, n - 1) REP(j, 0, k[i]) {
			int cur = x[i][j];
			REP(l, 0, k[i + 1]) {
				int tmp = x[i + 1][l];
				FOR(used, 0, m) dp[i + 1][l][used] = min(dp[i + 1][l][used], dp[i][j][used] + (s[i][j] + s[i + 1][l]) * abs(cur - tmp));
			}
			if(i + 2 < n) {
				REP(l, 0, k[i + 2]) {
					int tmp = x[i + 2][l];
					REP(used, 0, m) dp[i + 2][l][used + 1] = min(dp[i + 2][l][used + 1], dp[i][j][used] + (s[i][j] + s[i + 2][l]) * abs(cur - tmp));
				}
			}
		}
		ll ans = oo;
		REP(i, 0, k[n - 1]) REP(j, 0, m + 1) ans = min(ans, dp[n - 1][i][j]);
		REP(i, 0, k[n - 2]) REP(j, 0, m) ans = min(ans, dp[n - 2][i][j]);
		printf("%lld\n", ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:25: error: expected unqualified-id before '=' token
   66 |                 static  = {};
      |                         ^
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 10000000;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define int long long
#define addm(X, Y) ((X) = ((X) + (Y) % mod) % mod)

int n, m;
ll dp[155][80][1005];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        cin >> n >> m;
        if (n == 0 && m == 0) break;
        vector<vector<pair<int, int>>> st(155);
        rep(i, n) {
            int k;
            cin >> k;
            rep(j, k) {
                int x, d;
                cin >> x >> d;
                x--;
                st[i].push_back({x, d});
            }
        }
        rep(i, 155)rep(j, 80)rep(k, 1005) dp[i][j][k] = LLONG_MAX / 2;
        for (auto p : st[0]) {
            dp[0][0][p.fi] = 0;
        }
        if (m != 0) {
            for (auto p : st[1]) {
                dp[1][1][p.fi] = 0;
            }
        }
        rep(i, n)rep(j, m + 1) {
            for (auto now : st[i]) {
                if (dp[i][j][now.fi] == LLONG_MAX / 2) continue;
                if (i + 1 >= n) continue;
                for (auto nx : st[i + 1]) {
                    dp[i + 1][j][nx.fi] = min(dp[i + 1][j][nx.fi], dp[i][j][now.fi] + abs(now.fi - nx.fi) * (now.se + nx.se));
                }
                if (i + 2 >= n || j + 1 > m) continue;
                for (auto nx : st[i + 2]) {
                    dp[i + 2][j + 1][nx.fi] = min(dp[i + 2][j + 1][nx.fi], dp[i][j][now.fi] + abs(now.fi - nx.fi) * (now.se  + nx.se));
                }
            }
        }
        rep(j, m + 1)rep(k, 1001) ans = min(ans, dp[n - 1][j][k]);
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:35: error: 'ans' was not declared in this scope; did you mean 'abs'?
   85 |         rep(j, m + 1)rep(k, 1001) ans = min(ans, dp[n - 1][j][k]);
      |                                   ^~~
      |                                   abs
a.cc:86:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   86 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include"stdafx.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <vector>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define mod 1000000007
#define INF 93193111451418101
#define MIN -933111451418101
using namespace std;
typedef pair<ll, ll> P;

template <typename T, typename U>
typename std::enable_if<std::rank<T>::value == 0>::type fill_all(T &arr,
	const U &v) {
	arr = v;
}
template <typename ARR, typename U>
typename std::enable_if<std::rank<ARR>::value != 0>::type fill_all(ARR &arr,
	const U &v) {
	for (auto &i : arr) {
		fill_all(i, v);
	}
}
//------------------??????°-----------------------//
					 //-------------------???¢???°----------------------//

int main() {
	while (1) {
		ll n, m;
		std::vector<P> rock[1000];
		ll dp[155][100][30]; // n???????????¨??°???????????°?????´???
		cin >> n >> m;
		if (n + m == 0) { break; }
		REP(i, n) {
			ll k;
			cin >> k;
			REP(j, k) {
				ll place, sliplevel;
				cin >> place >> sliplevel;
				rock[i + 1].push_back(P(place, sliplevel));
			}
		}
		rock[0].push_back(P(0, 0));
		rock[n + 1].push_back(P(0, 0));
		fill_all(dp, INF);
		dp[0][0][0] = 0;
		REP(i, n + 1) { // 0???????????????n+1????????????
			REP(j, m + 1) {   //????????¨??°?????????
				REP(k, (unsigned)rock[i].size()) {
					if (dp[i][j][k] == INF) {
						continue;
					}
					if (i == 0 || i == n) {
						REP(l, (unsigned)rock[i + 1].size()) {
							dp[i + 1][j][l] = min(dp[i + 1][j][l], dp[i][j][k]);
						}
						if (j < m) {
							REP(l, (unsigned)rock[i + 2].size()) {
								dp[i + 2][j + 1][l] = min(dp[i + 2][j + 1][l], dp[i][j][k]);
							}
						}
					}
					else {
						REP(l, (unsigned)rock[i + 1].size()) {
							dp[i + 1][j][l] =
								min(dp[i + 1][j][l],
									dp[i][j][k] +
									(rock[i + 1][l].second + rock[i][k].second) *
									(abs(rock[i + 1][l].first - rock[i][k].first)));
						}
						if (j < m) {
							REP(l, (unsigned)rock[i + 2].size()) {
								dp[i + 2][j + 1][l] = min(dp[i + 2][j + 1][l], dp[i][j][k] + (rock[i + 2][l].second + rock[i][k].second) *(abs(rock[i + 2][l].first - rock[i][k].first)));
							}
						}
					}
				}
			}
		}
		ll ans = INF;
		REP(j, m + 1) {
			ans = min(ans, dp[n + 1][j][0]);
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc:1:9: fatal error: stdafx.h: No such file or directory
    1 | #include"stdafx.h"
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
#define INF 1<<30
using namespace std;
int main() {
	int row, jump;
	int dp[151][11][76];
	int val[151][11];
	int Size[151];
	int num[151][11];

	while (cin >> row >> jump, row)
	{
		
		for (int i = 0; i < row; i++) {
			cin >> Size[i];
			for (int j = 0; j < Size[i]; j++) {
				cin >> num[i][j] >> val[i][j];
			}
		}

		memset(dp, 0x7f, sizeof(dp));			//初期化
		for (int i = 0; i < Size[0]; i++)		//岸からのジャンプ
			dp[0][i][0] = 0;
		for (int i = 0; i < Size[1]; i++)
			dp[1][i][1] = 0;

		for (int i = 0; i < row-1; i++) {
			for (int j = 0; j < Size[i]; j++) {
				for (int k = 0; k < Size[i + 1]; k++) {
					int risk = (val[i][j] + val[i + 1][k])*abs(num[i][j] - num[i+1][k]);
					for (int m = 0; m <= jump; m++)
						dp[i + 1][k][m] = min(dp[i + 1][k][m], dp[i][j][m] + risk);
				}
				if (i == row - 2)continue;
				for (int k = 0; k < Size[i + 2]; k++) {
					int risk = (val[i][j] + val[i + 2][k])*abs(num[i][j] - num[i + 2][k]);
					for (int m = 0; m < jump; m++)
						dp[i + 2][k][m+1] = min(dp[i + 2][k][m+1], dp[i][j][m] + risk);
				}
			}

		}
		int Min = 0x7f7f7f7f;

		for (int i = 0; i < Size[row - 1]; i++)
			for (int j = 0; j <= jump; j++) {
				Min = min(Min, dp[row - 1][i][j]);

			}
		for (int i = 0; i < Size[row - 2]; i++)
			for (int j = 0; j < jump; j++)
				Min = min(Min, dp[row - 2][i][j]);
		
		cout << Min << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'memset' was not declared in this scope
   24 |                 memset(dp, 0x7f, sizeof(dp));                   //初期化
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<math.h>
  +++ |+#include <cstring>
    5 | #define INF 1<<30
Language: C++

#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

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

int numstone[151];
pair<int,int> stones[151][11];
int memo[151][151][11]; //memo[ツ甘敖つゥツづァツづ個仰猟猟」][ツ氾イツづ篠つオツ氾イツづ堕づーツつオツつスツ嘉アツ青脳[ツ債。ツづ個暗環置]
int n,m;

int solve(int i,int j,int k) {
  if(memo[i][j][k] != -1) return memo[i][j][k];
  if(i >= n-1) return 0;

  int l,ret = 1<<29;
  if(j < m) {
    rep(l,numstone[i+2]) {
      int cc = stones[i][k].second+stones[i+2][l].second;
      ret = min(ret, solve(i+2, j+1, l)
		+ cc*abs(stones[i][k].first-stones[i+2][l].first));
    }
  }

  rep(l, numstone[i+1]) {
    int cc = stones[i][k].second+stones[i+1][l].second;
    ret = min(ret, solve(i+1, j, l)
	      + cc*abs(stones[i][k].first-stones[i+1][l].first));
  }
  //printf("row: %d double: %d nowpos: %d ret: %d\n", i,j,k,ret);
  return memo[i][j][k] = ret;
}

int main() {
  int k,i,j;
  while(scanf("%d%d", &n, &m), n|m) {
    memset(memo, -1, sizeof(memo));

    rep(i,151) rep(j,151) rep(k,11) memo[i][j][k] = -1;
    rep(i,n) {
      scanf("%d", &k);
      numstone[i] = k;
      rep(j,k) {
	pair<int,int> p;
	scanf("%d%d", &(p.first), &(p.second));
	stones[i][j] = p;
      }
    }

    int ans = 1<<29;
    rep(i, numstone[0]) {
      ans = min(ans, solve(0,0,i));
    }
    printf("%d\n",ans);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'scanf' was not declared in this scope
   38 |   while(scanf("%d%d", &n, &m), n|m) {
      |         ^~~~~
a.cc:56:5: error: 'printf' was not declared in this scope
   56 |     printf("%d\n",ans);
      |     ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    3 | #include<algorithm>
  +++ |+#include <cstdio>
    4 | using namespace std;
Language: C++

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

#define INF (1000000000)

int dp[151][10][77];

typedef struct {
	int slip;
	int coor;
} ST;

int main(void)
{
	int n, m;
	int k[151];
	ST st[151][10];
	int ans;
	
	
	k[150] = 0;
	for (int i = 0; i < 151; i++){
		for (int j = 0; j < 10; j++){
			for (int l = 0; l < 77; l++){
				dp[i][j][l] = INF;
			}
		}
	}
	
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++){
		scanf("%d", &k[i]);
		for (int j = 0; j < k[i]; j++){
			scanf("%d%d", &st[i][j].coor, &st[i][j].slip);
		}
	}
	
	for (int i = 0; i < k[0]; i++){
		dp[0][i][0] = 0;
	}
	for (int i = 0; i < k[1]; i++){
		dp[1][i][1] = 0;
	}
	
	for (int i = 0; i < n - 1; i++){
		for (int j = 0; j < k[i]; j++){
			for (int l = 0; l <= m; l++){
				for (int h = 0; h < k[i + 1]; h++){
					dp[i + 1][h][l] = min(dp[i + 1][h][l], dp[i][j][l] + ((st[i][j].slip + st[i + 1][h].slip) * abs(st[i][j].coor - st[i + 1][h].coor)));
				}
				for (int h = 0; h < k[i + 2]; h++){
					dp[i + 2][h][l + 1] = min(dp[i + 2][h][l + 1], dp[i][j][l] + (st[i][j].slip + st[i + 2][h].slip) * abs(st[i][j].coor - st[i + 2][h].coor));
				}
			}
		}
	}
	
	ans = INF;
	for (int i = 0; i < k[n - 1]; i++){
		for (int j = 0; j <= m; j++){
			ans = min(ans, dp[n - 1][i][j]);
		}
	}
	for (int i = 0; i < k[n - 2]; i++){
		for (int j = 0; j < m; j++){
			ans = min(ans, dp[n - 2][i][j]);
		}
	}
	
	printf("%d\n", ans);
	
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:59: error: 'min' was not declared in this scope; did you mean 'main'?
   49 |                                         dp[i + 1][h][l] = min(dp[i + 1][h][l], dp[i][j][l] + ((st[i][j].slip + st[i + 1][h].slip) * abs(st[i][j].coor - st[i + 1][h].coor)));
      |                                                           ^~~
      |                                                           main
a.cc:52:63: error: 'min' was not declared in this scope; did you mean 'main'?
   52 |                                         dp[i + 2][h][l + 1] = min(dp[i + 2][h][l + 1], dp[i][j][l] + (st[i][j].slip + st[i + 2][h].slip) * abs(st[i][j].coor - st[i + 2][h].coor));
      |                                                               ^~~
      |                                                               main
a.cc:61:31: error: 'min' was not declared in this scope; did you mean 'main'?
   61 |                         ans = min(ans, dp[n - 1][i][j]);
      |                               ^~~
      |                               main
a.cc:66:31: error: 'min' was not declared in this scope; did you mean 'main'?
   66 |                         ans = min(ans, dp[n - 2][i][j]);
      |                               ^~~
      |                               main
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <algorighm>

using namespace std;

#define INF (1000000000)

int dp[151][10][77];

typedef struct {
	int slip;
	int coor;
} ST;

int main(void)
{
	int n, m;
	int k[151];
	ST st[151][10];
	int ans;
	
	
	k[150] = 0;
	for (int i = 0; i < 151; i++){
		for (int j = 0; j < 10; j++){
			for (int l = 0; l < 77; l++){
				dp[i][j][l] = INF;
			}
		}
	}
	
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++){
		scanf("%d", &k[i]);
		for (int j = 0; j < k[i]; j++){
			scanf("%d%d", &st[i][j].coor, &st[i][j].slip);
		}
	}
	
	for (int i = 0; i < k[0]; i++){
		dp[0][i][0] = 0;
	}
	for (int i = 0; i < k[1]; i++){
		dp[1][i][1] = 0;
	}
	
	for (int i = 0; i < n - 1; i++){
		for (int j = 0; j < k[i]; j++){
			for (int l = 0; l <= m; l++){
				for (int h = 0; h < k[i + 1]; h++){
					dp[i + 1][h][l] = min(dp[i + 1][h][l], dp[i][j][l] + ((st[i][j].slip + st[i + 1][h].slip) * abs(st[i][j].coor - st[i + 1][h].coor)));
				}
				for (int h = 0; h < k[i + 2]; h++){
					dp[i + 2][h][l + 1] = min(dp[i + 2][h][l + 1], dp[i][j][l] + (st[i][j].slip + st[i + 2][h].slip) * abs(st[i][j].coor - st[i + 2][h].coor));
				}
			}
		}
	}
	
	ans = INF;
	for (int i = 0; i < k[n - 1]; i++){
		for (int j = 0; j <= m; j++){
			ans = min(ans, dp[n - 1][i][j]);
		}
	}
	for (int i = 0; i < k[n - 2]; i++){
		for (int j = 0; j < m; j++){
			ans = min(ans, dp[n - 2][i][j]);
		}
	}
	
	printf("%d\n", ans);
	
	return (0);
}

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

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
#include <cmath>
#include <ctime>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define REP(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define MSG(a) cout << #a << " "  << a << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

const int INF = 1 << 30;
const int MAX_X = 1005;
unsigned int dp[6][MAX_X][80];

int main()
{
	int n, m;
	while(cin >> n >> m && n)
	{
		rep(x,MAX_X) rep(y,6) rep(d,m+1) dp[y%6][x][d] = INF;
		vector<vint> r(MAX_X, vint(n+10));
		rep(i,MAX_X)rep(j,n) r[i][j]=0;

		rep(i,n)
		{
			int s;
			cin >> s;
			rep(j,s)
			{
				int x, d;
				cin >> x >> d;
				r[x][i] = d;
			}
		}

		rep(x,MAX_X)if(r[x][0]) dp[0][x][m] = 0;
		rep(x,MAX_X)if(r[x][1]) dp[1][x][m-1] = 0;

		for(int y = 1; y < n; y++)
		{
		memcpy(dp[y%5], dp[5], sizeof(dp[y%5]));
		for(int x = 0; x < MAX_X; x++)
		{
			
			if(r[x][y])
			{
				// ツ津環湘ュツジツδδδ督プ
				rep(nx, MAX_X) rep(d, m+1)
					if(dp[(y-1)%5][nx][d] != INF)
						chmin(dp[y%5][x][d], dp[(y-1)%5][nx][d] + (r[x][y] + r[nx][y-1]) * abs(x - nx));

				// ツ暗ェツ段ツづづ篠つオ
				if(1 < y)
					rep(nx, MAX_X) REP(d, 1, m+1)
						if(dp[(y-2)%5][nx][d] != INF)
							chmin(dp[y%5][x][d-1], dp[(y-2)%5][nx][d] + (r[x][y] + r[nx][y-2]) * abs(x - nx));
			}
		}
		}
		unsigned int res = INF;
		rep(x, MAX_X) rep(d, m+1) chmin(res, dp[(n-1)%5][x][d]);
		rep(x, MAX_X) REP(d, 1, m+1) chmin(res, dp[(n-2)%5][x][d]);
		cout << res << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:17: error: 'memcpy' was not declared in this scope
   53 |                 memcpy(dp[y%5], dp[5], sizeof(dp[y%5]));
      |                 ^~~~~~
a.cc:13:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include <ctime>
  +++ |+#include <cstring>
   13 | using namespace std;
Language: C++

#include <iostream>
#include <cstdlib>
using namespace std;
const int INF = (1<<29);

int main(){
  int n,m;
  while(cin >> n >> m && (n || m)){
    int dp[150][10][80], a[150][10], x[150][10];
    for(int i=0;i<150;i++){
      for(int j=0;j<10;j++){
	for(int k=0;k<80;k++) dp[i][j][k] = INF;
	a[i][j] = INF;
      }
    }
    for(int i=0;i<n;i++){
      int k;
      cin >> k;
      for(int j=0;j<k;j++){
	int b,c;
	cin >> b >> c;
	x[i][j] = b;
	a[i][j] = c;
      }
    }
    for(int i=0;i<10;i++) dp[0][i][0] = 0;

    for(int i=0;i<n-1;i++){
      for(int l=0;l<=m;l++){
	for(int j=0;j<10;j++){
	  if(a[i][j] == INF) continue;
	  for(int k=0;k<10;k++){
	    if(a[i+1][k] == INF) continue;
	    dp[i+1][k][l] = min(dp[i+1][k][l],dp[i][j][l] + (a[i][j] + a[i+1][k]) * (abs(x[i+1][k]-x[i][j])));
	  }
	  if(i < n - 2 && l != m){
	    for(int k=0;k<10;k++){
	      if(a[i+2][k] == INF) continue;
	      dp[i+2][k][l+1] = min(dp[i+2][k][l+1],dp[i][j][l] + (a[i][j] + a[i+2][k]) * (abs(x[i+2][k]-x[i][j])));
	    }
	  }
	}
      }
    }

    int ans = INF;
    for(int j=0;j<=m;j++) for(int k=0;k<10;k++) ans = min(ans,dp[n-1][k][j]);
    for(int j=0;j<m;j++) for(int k=0;k<10;k++) ans = min(ans,dp[n-2][k][j])

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

Compiler output:
a.cc: In function 'int main()':
a.cc:48:76: error: expected ';' before 'cout'
   48 |     for(int j=0;j<m;j++) for(int k=0;k<10;k++) ans = min(ans,dp[n-2][k][j])
      |                                                                            ^
      |                                                                            ;
   49 | 
   50 |     cout << ans << endl;
      |     ~~~~