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

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<ll,ll>pl;

const int MAX_N = 40;

ll n,m;
ll v[MAX_N];
ll w[MAX_N];
vector<pl> x,y;

void solve(int s,int t,vector<pl> &x)
{
	int z = t-s;
	for(int i=0;i<(1<<z);i++){
		pl p = pl(0,0);
		rep(j,z){
			if(i>>j&1){
				p.first += w[s+j];
				p.second += v[s+j];
			}
		}
		x.push_back(p);
	}
}

int main()
{
	cin >> n >> lm;
	rep(i,n){
		cin >> v[i] >> w[i];
	}
	solve(0,n/2,x);
	solve(n/2,n,y);
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	ll t=0;
	ll maxv = -(1LL<60);
	ll ans = 0;
	for(int i=x.size()-1;i>=0;i--){
		pl p = x[i];
		while(t < y.size() && p.first+y[t].first <= lm){
			maxv = max(maxv,y[t].second);
			t++;
		}
		ans = max(ans,p.second+maxv);
	}
	cout << ans << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:21: error: 'lm' was not declared in this scope; did you mean 'tm'?
   36 |         cin >> n >> lm;
      |                     ^~
      |                     tm
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<ll,ll>pl;

const int MAX_N = 40;

ll n,lm;
ll v[MAX_N];
ll w[MAX_N];
vector<pl> x,y;

void func(int si,int ti,vector<P> &x){
  int size=ti-si;
  rep(bit,1<<size){
    pl p=pl(0,0);
    for(int i=0;i<size;i++){
      if(bit>>i&1){
        p.first+=w[si+i];
        p.second+=v[si+i];
      }
    }
    x.push_back(p);
  }
}
  
int main(){
  cin>>N>>W;
  for(int i=0;i<N;i++)cin>>v[i]>>w[i];
    
  func(0,N/2,x);
  sort(x.begin(),x.end());
  func(N/2,N,y);
  sort(y.begin(),y.end());
    
  ll target=0,maxm=-(1LL<<60),ans=0;
    
  for(int i=(int)x.size()-1;i>=0;i--){
    pl p=x[i];
    while(target<(int)y.size() && p.first+y[target].first <=W ){
      maxm=max(maxm,y[target].second);
      target++;
    }
    ans=max(ans,maxm+p.second);
  }
  
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:8: error: 'N' was not declared in this scope
   34 |   cin>>N>>W;
      |        ^
a.cc:34:11: error: 'W' was not declared in this scope
   34 |   cin>>N>>W;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<ll,ll>pl;

const int MAX_N = 40;

ll N,W;
ll v[MAX_N];
ll w[MAX_N];
vector<pl> x,y;

void func(int si,int ti,vector<P> &x){
  int size=ti-si;
  rep(bit,1<<size){
    pl p=pl(0,0);
    for(int i=0;i<size;i++){
      if(bit>>i&1){
        p.first+=w[si+i];
        p.second+=v[si+i];
      }
    }
    x.push_back(p);
  }
}
  
int main(){
  cin>>N>>W;
  for(int i=0;i<N;i++)cin>>v[i]>>w[i];
    
  func(0,N/2,x);
  sort(x.begin(),x.end());
  func(N/2,N,y);
  sort(y.begin(),y.end());
    
  ll target=0,maxm=-(1LL<<60),ans=0;
    
  for(int i=(int)x.size()-1;i>=0;i--){
    pl p=x[i];
    while(target<(int)y.size() && p.first+y[target].first <=W ){
      maxm=max(maxm,y[target].second);
      target++;
    }
    ans=max(ans,maxm+p.second);
  }
  
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: invalid initialization of reference of type 'std::vector<std::pair<int, int> >&' from expression of type 'std::vector<std::pair<long long int, long long int> >'
   37 |   func(0,N/2,x);
      |              ^
a.cc:19:36: note: in passing argument 3 of 'void func(int, int, std::vector<std::pair<int, int> >&)'
   19 | void func(int si,int ti,vector<P> &x){
      |                         ~~~~~~~~~~~^
a.cc:39:14: error: invalid initialization of reference of type 'std::vector<std::pair<int, int> >&' from expression of type 'std::vector<std::pair<long long int, long long int> >'
   39 |   func(N/2,N,y);
      |              ^
a.cc:19:36: note: in passing argument 3 of 'void func(int, int, std::vector<std::pair<int, int> >&)'
   19 | void func(int si,int ti,vector<P> &x){
      |                         ~~~~~~~~~~~^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<ll,ll>pl;

const int MAX_N = 40;

ll N,W;
ll v[MAX_N];
ll w[MAX_N];
vector<pl> x,y;

void func(int si,int ti,vector<pl> &x){
  int size=ti-si;
  rep(bit,1<<size){
    pl p=pl(0,0);
    for(int i=0;i<size;i++){
      if(bit>>i&1){
        p.first+=w[si+i];
        p.second+=v[si+i];
      }
    }
    x.push_back(p);
  }
}
  
int main(){
  cin>>N>>W;
  rep(i=0,N){
  	cin>>v[i]>>w[i];
  }
 
  func(0,N/2,x);
  sort(x.begin(),x.end());
  func(N/2,N,y);
  sort(y.begin(),y.end());
    
  ll target=0,maxm=-(1LL<<60),ans=0;
    
  for(int i=x.size()-1;i>=0;i--){
    pl p=x[i];
    while(target<y.size() && p.first+y[target].first <=W ){
      maxm=max(maxm,y[target].second);
      target++;
    }
    ans=max(ans,maxm+p.second);
  }
  
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: lvalue required as left operand of assignment
   35 |   rep(i=0,N){
      |         ^
a.cc:5:26: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(int i=0;i<n;i++)
      |                          ^
a.cc:35:9: error: lvalue required as increment operand
   35 |   rep(i=0,N){
      |         ^
a.cc:5:34: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                  ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<ll,ll>pl;

const int MAX_N = 40;

ll n,w\lm;
ll v[MAX_N];
ll w[MAX_N];
vector<pl> x,y;

void solve(int s,int t,vector<pl> &x)
{
	int z = t-s;
	rep(i,1<<z){
		pl p = pl(0,0);
		rep(j,z){
			if(i&(1<<j)){
				p.first += w[s+j];
				p.second += v[s+j];
			}
		}
		x.push_back(p);
	}
}

int main()
{
	cin >> n >> lm;
	rep(i,n){
		cin >> v[i] >> w[i];
	}
	solve(0,n/2,x);
	solve(n/2,n,y);
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	ll t=0;
	ll maxv = 0;
	ll ans = 0;
	for(int i=x.size()-1;i>=0;i--){
		while(t < y.size() && x[i].first+y[t].first <= lm){
			maxv = max(maxv,y[t].second);
			t++;
		}
		ans = max(ans,maxv+x[i].second);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:14:7: error: stray '\' in program
   14 | ll n,w\lm;
      |       ^
a.cc:14:8: error: expected initializer before 'lm'
   14 | ll n,w\lm;
      |        ^~
a.cc: In function 'int main()':
a.cc:36:21: error: 'lm' was not declared in this scope; did you mean 'tm'?
   36 |         cin >> n >> lm;
      |                     ^~
      |                     tm
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<ll,ll>pl;

const int MAX_N = 40;

ll v[MAX_N];
ll w[MAX_N];
vector<pl> x,y;

void solve(int s,int t,vector<pl> &x)
{
	int z = t-s;
	rep(i,1<<z){
		pl p = pl(0,0);
		rep(j,z){
			if(i&(1<<j)){
				p.first += w[s+j];
				p.second += v[s+j];
			}
		}
		x.push_back(p);
	}
}

int main()
{
	int n
	ll m;
	cin >> n >> lm;
	rep(i,n){
		cin >> v[i] >> w[i];
	}
	solve(0,n/2,x);
	solve(n/2,n,y);
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	ll t=0;
	ll maxv = -(1LL<<60);
	ll ans = 0;
	for(int i=x.size()-1;i>=0;i--){
		while(t < y.size() && x[i].first+y[t].first <= lm){
			maxv = max(maxv,y[t].second);
			t++;
		}
		ans = max(ans,maxv+x[i].second);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:12: error: expected initializer before 'long'
    2 | #define ll long long
      |            ^~~~
a.cc:36:9: note: in expansion of macro 'll'
   36 |         ll m;
      |         ^~
a.cc:37:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   37 |         cin >> n >> lm;
      |                ^
      |                yn
a.cc:37:21: error: 'lm' was not declared in this scope; did you mean 'tm'?
   37 |         cin >> n >> lm;
      |                     ^~
      |                     tm
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long int64;

int64 N, v[40], w[40], W;

void dfs(int idx, int sz, int64 vv, int64 ww, vector< pair< int64, int64 > > &kk)
{
  if(idx == sz) {
    kk.emplace_back(ww, vv);
    return;
  }
  dfs(idx + 1, sz, vv + v[idx], ww + w[idx], kk);
  dfs(idx + 1, sz, vv, ww, kk);
}

int main()
{
  cin >> N >> W;
  for(int i = 0; i < N; i++) cin >> v[i] >> w[i];

  vector< pair< int64, int64 > > a, b;
  dfs(0, N >> 1, 0, 0, a);
  dfs(N >> 1, N, 0, 0, b);
  sort(begin(b), end(b));

  int64 ret = 0;
  for(auto &ss : a) {
    if(ss.first <= W) {
      auto get = lower_bound(begin(b), end(b), make_pair(W - ss.first + 1, 0LL));
      if(get != begin(b)) ret = max(ret, ss.second + (--get)->second));
    }
  }
  cout << ret << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:70: error: expected ';' before ')' token
   33 |       if(get != begin(b)) ret = max(ret, ss.second + (--get)->second));
      |                                                                      ^
      |                                                                      ;
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
//#include "MyMath.h"
//#include "DataStructure.h"
#include <string.h>
#include <map>
#include <set>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <functional>
#include <math.h>
using namespace std;
const int num = 500, num1 = 10000000;
double numd = 10000000.0;
typedef long long int ll;
const int INF = 2000000000;
int a[200000],bit[200001];
int sum(int i, int bit[]) {
	int sum = 0;
	while (i > 0) {
		sum += bit[i];
		i -= i & -i;
	}
	return sum;
}
void add(int i, int x, int n, int *bit) {
	while (i <= n) {
		bit[i] += x;
		i += i & -i;
	}
}
int main() {
	int n;
	memset(bit, 0, sizeof(bit));
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ll su = 0;
	for (int i = 0; i < n; i++) {
		su += i - sum(a[i], bit);
		add(a[i], 1, n, bit);
	cout << su << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:35:12: note: to match this '{'
   35 | int main() {
      |            ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
//#include "MyMath.h"
//#include "MyDisjointset.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <map>
using namespace std;
typedef pair<int, int> P; typedef long long int ll;
const int INF = 2000000000;
int main() {
	ll n, W; cin >> n >> W;
	ll *v = new ll[n], *w = new ll[n];
	for (int i = 0; i < n; i++)
		cin >> v[i] >> w[i];
	int h = n / 2;
	P *h1 = new P[1 << h];
	memset(h1, 0, sizeof(h1));
	for (int i = 0; i < (1 << h); i++)
		for (int j = 0; j < h; j++)
			if (i >> j & 1) { h1[i].second += v[j]; h1[i].first += w[i]; }
	sort(h1, h1 + (1 << h));
	int m = 0;
	for (int i = 1; i < (1 << h); i++) 
		if (h1[m].second < h1[i].second) 
			h1[++m] = h1[i];
	m++;
	int hr = n - n / 2;
	P *h2 = new P[1 << hr];
	memset(h2, 0, sizeof(h2));
	for (int i = 0; i < (1 << hr); i++)
		for (int j = 0; j < hr; j++)
			if (i >> j & 1) { h2[i].second += v[h + j]; h2[i].first += w[h + j]; }
	ll res = -1;
	for (int i = 0; i < (1 << hr); i++) {
		ll mw = W - h2[i].first;
		ll t = (lower_bound(h1, h1 + m, P(mw, INF)) - 1)->second;
		res = max(res, h2[i].second + t);
	}
	cout << res << endl;
}

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

/*
 * Contents   : AOJ DPL 1 H
 * Author     : Kitaura Hiromi
 * LastUpdate : 20180625
 * Since      : 20180625
 */
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int v[41], w[41];
pair<ll, ll> ps[1<<20]; // sw, svを保持
int N, W;
int main(void){
    cin >> N >> W;
    for(int i=0; i<N; i++) cin >> v[i] >> w[i];
    // 前半分の2^N/2を全探索
    for(int i=0; i<1<<N/2; i++){
        ll sw=0, sv=0;
        for(int j=0; j<N/2; j++){
            if(i>>j & 1){
                sw += w[j];
                sv += v[j];
            }
        }
    ps[i] = make_pair(sw, sv);
    }
    // sw[i] <= sw[j]かつsv[i] >= sv[j]なるjを取り除く
    sort(ps, ps+(1<<N/2));
    int m = 1;
    for(int i=1; i<1<<N/2; i++){
        if(ps[m-1].second < ps[i].second){
            ps[m++] = ps[i];
        }
    }
    // 後ろ半分の2^N/2を全探索
    for(int i=0; i<1<<N/2; i++){
        ll sw=0, sv=0;
        for(int j=0; j<N-N/2; j++){
            if(i>>j & 1){
                sw += w[N/2+j];
                sv += v[N/2+j];
            }
        }
        if(sw <= W){
            ll tv = (lower_bound(ps, ps+m, make_pair(W-sw, INF)) - 1)->second;
            res = max(res, sv+tv);
        }
    }
    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:60: error: 'INF' was not declared in this scope
   45 |             ll tv = (lower_bound(ps, ps+m, make_pair(W-sw, INF)) - 1)->second;
      |                                                            ^~~
a.cc:46:13: error: 'res' was not declared in this scope
   46 |             res = max(res, sv+tv);
      |             ^~~
a.cc:49:13: error: 'res' was not declared in this scope
   49 |     cout << res << endl;
      |             ^~~
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph, memo;

	void run() {
		N = sc.nextInt(); // edge number
		M = sc.nextInt(); // vertex number
		graph = new int[N][N];
		memo = new int[N][1 << N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
			Arrays.fill(memo[i], -1);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		int res = tsp(1, 0);
		System.out.println(res == INF ? -1 : res);
	}

	int tsp(int mask, int pos) {
	   if(mask==VISITED_ALL){
		return dist[pos][0];
	}
	if(dp[mask][pos]!=-1){
	   return dp[mask][pos];
	}

	//Now from current node, we will try to go to every other node and take the min ans
	int ans = INT_MAX;

	//Visit all the unvisited cities and take the best route
	for(int city=0;city<n;city++){

		if((mask&(1<<city))==0){

			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			ans = min(ans, newAns);
		}

	}
	
	return dp[mask][pos] = ans;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:30: error: cannot find symbol
	   if(mask==VISITED_ALL){
	            ^
  symbol:   variable VISITED_ALL
  location: class Main
Main.java:31: error: cannot find symbol
		return dist[pos][0];
		       ^
  symbol:   variable dist
  location: class Main
Main.java:33: error: cannot find symbol
	if(dp[mask][pos]!=-1){
	   ^
  symbol:   variable dp
  location: class Main
Main.java:34: error: cannot find symbol
	   return dp[mask][pos];
	          ^
  symbol:   variable dp
  location: class Main
Main.java:38: error: cannot find symbol
	int ans = INT_MAX;
	          ^
  symbol:   variable INT_MAX
  location: class Main
Main.java:41: error: cannot find symbol
	for(int city=0;city<n;city++){
	                    ^
  symbol:   variable n
  location: class Main
Main.java:45: error: cannot find symbol
			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			             ^
  symbol:   variable dist
  location: class Main
Main.java:46: error: cannot find symbol
			ans = min(ans, newAns);
			      ^
  symbol:   method min(int,int)
  location: class Main
Main.java:51: error: cannot find symbol
	return dp[mask][pos] = ans;
	       ^
  symbol:   variable dp
  location: class Main
9 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph, memo;
	
	int VISITED_ALL = (1<<n) -1;

	void run() {
		N = sc.nextInt(); // edge number
		M = sc.nextInt(); // vertex number
		graph = new int[N][N];
		memo = new int[N][1 << N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
			Arrays.fill(memo[i], -1);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		int res = tsp(1, 0);
		System.out.println(res == INF ? -1 : res);
	}

	int tsp(int mask, int pos) {
	   if(mask==VISITED_ALL){
		return dist[pos][0];
	}
	if(dp[mask][pos]!=-1){
	   return dp[mask][pos];
	}

	//Now from current node, we will try to go to every other node and take the min ans
	int ans = INT_MAX;

	//Visit all the unvisited cities and take the best route
	for(int city=0;city<n;city++){

		if((mask&(1<<city))==0){

			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			ans = min(ans, newAns);
		}

	}
	
	return dp[mask][pos] = ans;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:10: error: cannot find symbol
	int VISITED_ALL = (1<<n) -1;
	                      ^
  symbol:   variable n
  location: class Main
Main.java:33: error: cannot find symbol
		return dist[pos][0];
		       ^
  symbol:   variable dist
  location: class Main
Main.java:35: error: cannot find symbol
	if(dp[mask][pos]!=-1){
	   ^
  symbol:   variable dp
  location: class Main
Main.java:36: error: cannot find symbol
	   return dp[mask][pos];
	          ^
  symbol:   variable dp
  location: class Main
Main.java:40: error: cannot find symbol
	int ans = INT_MAX;
	          ^
  symbol:   variable INT_MAX
  location: class Main
Main.java:43: error: cannot find symbol
	for(int city=0;city<n;city++){
	                    ^
  symbol:   variable n
  location: class Main
Main.java:47: error: cannot find symbol
			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			             ^
  symbol:   variable dist
  location: class Main
Main.java:48: error: cannot find symbol
			ans = min(ans, newAns);
			      ^
  symbol:   method min(int,int)
  location: class Main
Main.java:53: error: cannot find symbol
	return dp[mask][pos] = ans;
	       ^
  symbol:   variable dp
  location: class Main
9 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph, memo;
	
	static int VISITED_ALL = (1<<n) -1;

	void run() {
		N = sc.nextInt(); // edge number
		M = sc.nextInt(); // vertex number
		graph = new int[N][N];
		memo = new int[N][1 << N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
			Arrays.fill(memo[i], -1);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		int res = tsp(1, 0);
		System.out.println(res == INF ? -1 : res);
	}

	int tsp(int mask, int pos) {
	   if(mask==VISITED_ALL){
		return dist[pos][0];
	}
	if(dp[mask][pos]!=-1){
	   return dp[mask][pos];
	}

	//Now from current node, we will try to go to every other node and take the min ans
	int ans = INT_MAX;

	//Visit all the unvisited cities and take the best route
	for(int city=0;city<n;city++){

		if((mask&(1<<city))==0){

			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			ans = min(ans, newAns);
		}

	}
	
	return dp[mask][pos] = ans;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:10: error: cannot find symbol
	static int VISITED_ALL = (1<<n) -1;
	                             ^
  symbol:   variable n
  location: class Main
Main.java:33: error: cannot find symbol
		return dist[pos][0];
		       ^
  symbol:   variable dist
  location: class Main
Main.java:35: error: cannot find symbol
	if(dp[mask][pos]!=-1){
	   ^
  symbol:   variable dp
  location: class Main
Main.java:36: error: cannot find symbol
	   return dp[mask][pos];
	          ^
  symbol:   variable dp
  location: class Main
Main.java:40: error: cannot find symbol
	int ans = INT_MAX;
	          ^
  symbol:   variable INT_MAX
  location: class Main
Main.java:43: error: cannot find symbol
	for(int city=0;city<n;city++){
	                    ^
  symbol:   variable n
  location: class Main
Main.java:47: error: cannot find symbol
			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			             ^
  symbol:   variable dist
  location: class Main
Main.java:48: error: cannot find symbol
			ans = min(ans, newAns);
			      ^
  symbol:   method min(int,int)
  location: class Main
Main.java:53: error: cannot find symbol
	return dp[mask][pos] = ans;
	       ^
  symbol:   variable dp
  location: class Main
9 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph, memo;
	
	int VISITED_ALL = ((1<<n) -1);

	void run() {
		N = sc.nextInt(); // edge number
		M = sc.nextInt(); // vertex number
		graph = new int[N][N];
		memo = new int[N][1 << N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
			Arrays.fill(memo[i], -1);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		int res = tsp(1, 0);
		System.out.println(res == INF ? -1 : res);
	}

	int tsp(int mask, int pos) {
	   if(mask==VISITED_ALL){
		return dist[pos][0];
	}
	if(dp[mask][pos]!=-1){
	   return dp[mask][pos];
	}

	//Now from current node, we will try to go to every other node and take the min ans
	int ans = INT_MAX;

	//Visit all the unvisited cities and take the best route
	for(int city=0;city<n;city++){

		if((mask&(1<<city))==0){

			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			ans = min(ans, newAns);
		}

	}
	
	return dp[mask][pos] = ans;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:10: error: cannot find symbol
	int VISITED_ALL = ((1<<n) -1);
	                       ^
  symbol:   variable n
  location: class Main
Main.java:33: error: cannot find symbol
		return dist[pos][0];
		       ^
  symbol:   variable dist
  location: class Main
Main.java:35: error: cannot find symbol
	if(dp[mask][pos]!=-1){
	   ^
  symbol:   variable dp
  location: class Main
Main.java:36: error: cannot find symbol
	   return dp[mask][pos];
	          ^
  symbol:   variable dp
  location: class Main
Main.java:40: error: cannot find symbol
	int ans = INT_MAX;
	          ^
  symbol:   variable INT_MAX
  location: class Main
Main.java:43: error: cannot find symbol
	for(int city=0;city<n;city++){
	                    ^
  symbol:   variable n
  location: class Main
Main.java:47: error: cannot find symbol
			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			             ^
  symbol:   variable dist
  location: class Main
Main.java:48: error: cannot find symbol
			ans = min(ans, newAns);
			      ^
  symbol:   method min(int,int)
  location: class Main
Main.java:53: error: cannot find symbol
	return dp[mask][pos] = ans;
	       ^
  symbol:   variable dp
  location: class Main
9 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph, memo;
	
	int visitedAll = ((1<<n) -1);

	void run() {
		N = sc.nextInt(); // edge number
		M = sc.nextInt(); // vertex number
		graph = new int[N][N];
		memo = new int[N][1 << N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
			Arrays.fill(memo[i], -1);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		int res = tsp(1, 0);
		System.out.println(res == INF ? -1 : res);
	}

	int tsp(int mask, int pos) {
	   if(mask==VISITED_ALL){
		return dist[pos][0];
	}
	if(dp[mask][pos]!=-1){
	   return dp[mask][pos];
	}

	//Now from current node, we will try to go to every other node and take the min ans
	int ans = INT_MAX;

	//Visit all the unvisited cities and take the best route
	for(int city=0;city<n;city++){

		if((mask&(1<<city))==0){

			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			ans = min(ans, newAns);
		}

	}
	
	return dp[mask][pos] = ans;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:10: error: cannot find symbol
	int visitedAll = ((1<<n) -1);
	                      ^
  symbol:   variable n
  location: class Main
Main.java:32: error: cannot find symbol
	   if(mask==VISITED_ALL){
	            ^
  symbol:   variable VISITED_ALL
  location: class Main
Main.java:33: error: cannot find symbol
		return dist[pos][0];
		       ^
  symbol:   variable dist
  location: class Main
Main.java:35: error: cannot find symbol
	if(dp[mask][pos]!=-1){
	   ^
  symbol:   variable dp
  location: class Main
Main.java:36: error: cannot find symbol
	   return dp[mask][pos];
	          ^
  symbol:   variable dp
  location: class Main
Main.java:40: error: cannot find symbol
	int ans = INT_MAX;
	          ^
  symbol:   variable INT_MAX
  location: class Main
Main.java:43: error: cannot find symbol
	for(int city=0;city<n;city++){
	                    ^
  symbol:   variable n
  location: class Main
Main.java:47: error: cannot find symbol
			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			             ^
  symbol:   variable dist
  location: class Main
Main.java:48: error: cannot find symbol
			ans = min(ans, newAns);
			      ^
  symbol:   method min(int,int)
  location: class Main
Main.java:53: error: cannot find symbol
	return dp[mask][pos] = ans;
	       ^
  symbol:   variable dp
  location: class Main
10 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph, memo;
	
	int VISITED_ALL;

	void run() {
		N = sc.nextInt(); // edge number
		M = sc.nextInt(); // vertex number
		graph = new int[N][N];
		memo = new int[N][1 << N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
			Arrays.fill(memo[i], -1);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		VISITED_ALL = ((1<<n) -1);
		int res = tsp(1, 0);
		System.out.println(res == INF ? -1 : res);
	}

	int tsp(int mask, int pos) {
	   if(mask==VISITED_ALL){
		return dist[pos][0];
	}
	if(dp[mask][pos]!=-1){
	   return dp[mask][pos];
	}

	//Now from current node, we will try to go to every other node and take the min ans
	int ans = INT_MAX;

	//Visit all the unvisited cities and take the best route
	for(int city=0;city<n;city++){

		if((mask&(1<<city))==0){

			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			ans = min(ans, newAns);
		}

	}
	
	return dp[mask][pos] = ans;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:27: error: cannot find symbol
		VISITED_ALL = ((1<<n) -1);
		                   ^
  symbol:   variable n
  location: class Main
Main.java:34: error: cannot find symbol
		return dist[pos][0];
		       ^
  symbol:   variable dist
  location: class Main
Main.java:36: error: cannot find symbol
	if(dp[mask][pos]!=-1){
	   ^
  symbol:   variable dp
  location: class Main
Main.java:37: error: cannot find symbol
	   return dp[mask][pos];
	          ^
  symbol:   variable dp
  location: class Main
Main.java:41: error: cannot find symbol
	int ans = INT_MAX;
	          ^
  symbol:   variable INT_MAX
  location: class Main
Main.java:44: error: cannot find symbol
	for(int city=0;city<n;city++){
	                    ^
  symbol:   variable n
  location: class Main
Main.java:48: error: cannot find symbol
			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			             ^
  symbol:   variable dist
  location: class Main
Main.java:49: error: cannot find symbol
			ans = min(ans, newAns);
			      ^
  symbol:   method min(int,int)
  location: class Main
Main.java:54: error: cannot find symbol
	return dp[mask][pos] = ans;
	       ^
  symbol:   variable dp
  location: class Main
9 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph, memo;
	
	int VISITED_ALL;

	void run() {
		N = sc.nextInt(); // edge number
		M = sc.nextInt(); // vertex number
		graph = new int[N][N];
		memo = new int[N][1 << N];
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
			Arrays.fill(memo[i], -1);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		VISITED_ALL = ((1 << M) -1);
		int res = tsp(1, 0);
		System.out.println(res == INF ? -1 : res);
	}

	int tsp(int mask, int pos) {
	   if(mask==VISITED_ALL){
		return dist[pos][0];
	}
	if(dp[mask][pos]!=-1){
	   return dp[mask][pos];
	}

	//Now from current node, we will try to go to every other node and take the min ans
	int ans = INT_MAX;

	//Visit all the unvisited cities and take the best route
	for(int city=0;city<n;city++){

		if((mask&(1<<city))==0){

			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			ans = min(ans, newAns);
		}

	}
	
	return dp[mask][pos] = ans;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:34: error: cannot find symbol
		return dist[pos][0];
		       ^
  symbol:   variable dist
  location: class Main
Main.java:36: error: cannot find symbol
	if(dp[mask][pos]!=-1){
	   ^
  symbol:   variable dp
  location: class Main
Main.java:37: error: cannot find symbol
	   return dp[mask][pos];
	          ^
  symbol:   variable dp
  location: class Main
Main.java:41: error: cannot find symbol
	int ans = INT_MAX;
	          ^
  symbol:   variable INT_MAX
  location: class Main
Main.java:44: error: cannot find symbol
	for(int city=0;city<n;city++){
	                    ^
  symbol:   variable n
  location: class Main
Main.java:48: error: cannot find symbol
			int newAns = dist[pos][city] + tsp( mask|(1<<city), city);
			             ^
  symbol:   variable dist
  location: class Main
Main.java:49: error: cannot find symbol
			ans = min(ans, newAns);
			      ^
  symbol:   method min(int,int)
  location: class Main
Main.java:54: error: cannot find symbol
	return dp[mask][pos] = ans;
	       ^
  symbol:   variable dp
  location: class Main
8 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph;
	Map<Integer, Map<Integer, Integer>> dp = new HashMap<>();

	void run() {
		N = sc.nextInt(); 
		M = sc.nextInt();
		graph = new int[N][N];
		
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		
	
	}
	
	

	int tsp(int mask, int v) {
		if dp.contains(mask) && dp.get(mask).contains(v))  return dp.get(mask).get(v);
		
		if (mask == (1 << N) - 1) return graph[v][0];

		int res = INF;
		for (int i = 0; i < N; i++) {
		    if(mask & (1 << i) != 0) continue;
		    int tmp = graph[v][0] + tsp(mask | (1 << N), i);
		    if(tmp < res) res = tmp;
		}
		
		if(!dp.contains(mask)){
		   dp.put(mask, new HashMap<>());
		}
		
		dp.get(mask).put(v,res);
		
		return res;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:32: error: '(' expected
		if dp.contains(mask) && dp.get(mask).contains(v))  return dp.get(mask).get(v);
		  ^
1 error
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph;
	Map<Integer, Map<Integer, Integer>> dp = new HashMap<>();

	void run() {
		N = sc.nextInt(); 
		M = sc.nextInt();
		graph = new int[N][N];
		
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		
	
	}
	
	

	int tsp(int mask, int v) {
		if (dp.contains(mask) && dp.get(mask).contains(v))  return dp.get(mask).get(v);
		
		if (mask == (1 << N) - 1) return graph[v][0];

		int res = INF;
		for (int i = 0; i < N; i++) {
		    if(mask & (1 << i) != 0) continue;
		    int tmp = graph[v][0] + tsp(mask | (1 << N), i);
		    if(tmp < res) res = tmp;
		}
		
		if(!dp.contains(mask)){
		   dp.put(mask, new HashMap<>());
		}
		
		dp.get(mask).put(v,res);
		
		return res;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:9: error: cannot find symbol
	Map<Integer, Map<Integer, Integer>> dp = new HashMap<>();
	^
  symbol:   class Map
  location: class Main
Main.java:9: error: cannot find symbol
	Map<Integer, Map<Integer, Integer>> dp = new HashMap<>();
	             ^
  symbol:   class Map
  location: class Main
Main.java:9: error: cannot find symbol
	Map<Integer, Map<Integer, Integer>> dp = new HashMap<>();
	                                             ^
  symbol:   class HashMap
  location: class Main
Main.java:38: error: bad operand types for binary operator '&'
		    if(mask & (1 << i) != 0) continue;
		            ^
  first type:  int
  second type: boolean
Main.java:44: error: cannot find symbol
		   dp.put(mask, new HashMap<>());
		                    ^
  symbol:   class HashMap
  location: class Main
5 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph;
	Map<Integer, Map<Integer, Integer>> dp = new HashMap<>();

	void run() {
		N = sc.nextInt(); 
		M = sc.nextInt();
		graph = new int[N][N];
		
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		
	
	}
	
	

	int tsp(int mask, int v) {
		if (dp.contains(mask) && dp.get(mask).contains(v))  return dp.get(mask).get(v);
		
		if (mask == (1 << N) - 1) return graph[v][0];

		int res = INF;
		for (int i = 0; i < N; i++) {
		    if(mask & (1 << i) != 0) continue;
		    int tmp = graph[v][0] + tsp(mask | (1 << N), i);
		    if(tmp < res) res = tmp;
		}
		
		if(!dp.contains(mask)){
		   dp.put(mask, new HashMap<>());
		}
		
		dp.get(mask).put(v,res);
		
		return res;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:33: error: cannot find symbol
		if (dp.contains(mask) && dp.get(mask).contains(v))  return dp.get(mask).get(v);
		      ^
  symbol:   method contains(int)
  location: variable dp of type Map<Integer,Map<Integer,Integer>>
Main.java:33: error: cannot find symbol
		if (dp.contains(mask) && dp.get(mask).contains(v))  return dp.get(mask).get(v);
		                                     ^
  symbol:   method contains(int)
  location: interface Map<Integer,Integer>
Main.java:39: error: bad operand types for binary operator '&'
		    if(mask & (1 << i) != 0) continue;
		            ^
  first type:  int
  second type: boolean
Main.java:44: error: cannot find symbol
		if(!dp.contains(mask)){
		      ^
  symbol:   method contains(int)
  location: variable dp of type Map<Integer,Map<Integer,Integer>>
4 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph;
	Map<Integer, Map<Integer, Integer>> dp = new HashMap<>();

	void run() {
		N = sc.nextInt(); 
		M = sc.nextInt();
		graph = new int[N][N];
		
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		
	
	}
	
	

	int tsp(int mask, int v) {
		if (dp.containsKey(mask) && dp.get(mask).containsKey(v))  return dp.get(mask).get(v);
		
		if (mask == (1 << N) - 1) return graph[v][0];

		int res = INF;
		for (int i = 0; i < N; i++) {
		    if(mask & (1 << i) != 0) continue;
		    int tmp = graph[v][0] + tsp(mask | (1 << N), i);
		    if(tmp < res) res = tmp;
		}
		
		if(!dp.containsKey(mask)){
		   dp.put(mask, new HashMap<>());
		}
		
		dp.get(mask).put(v,res);
		
		return res;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:39: error: bad operand types for binary operator '&'
		    if(mask & (1 << i) != 0) continue;
		            ^
  first type:  int
  second type: boolean
1 error
Language: Java

import java.util.Arrays;
import java.util.Scanner;
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	int N, M;
	int INF = Integer.MAX_VALUE / 2;
	int[][] graph;
	Map<Integer, Map<Integer, Integer>> dp = new HashMap<>();

	void run() {
		N = sc.nextInt(); 
		M = sc.nextInt();
		graph = new int[N][N];
		
		for (int i = 0; i < N; i++) {
			Arrays.fill(graph[i], INF);
		}
		for (int i = 0; i < M; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int cost = sc.nextInt();
			graph[s][t] = cost;
		}
		
	    return tsp(1, 0);
	}
	
	

	int tsp(int mask, int v) {
		if (dp.containsKey(mask) && dp.get(mask).containsKey(v))  return dp.get(mask).get(v);
		
		if (mask == (1 << N) - 1) return graph[v][0];

		int res = INF;
		for (int i = 0; i < N; i++) {
		    if((mask & (1 << i)) != 0) continue;
		    int tmp = graph[v][0] + tsp(mask | (1 << N), i);
		    if(tmp < res) res = tmp;
		}
		
		if(!dp.containsKey(mask)){
		   dp.put(mask, new HashMap<>());
		}
		
		dp.get(mask).put(v,res);
		
		return res;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Compiler output:
Main.java:27: error: incompatible types: unexpected return value
	    return tsp(1, 0);
	              ^
1 error
Language: C++

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

int dp[1 << 15][15];
int n;
int m[15][15];

int rec(int s,int v){
  if(dp[s][v]>=0){
    return dp[s][v];
  }

  if(s ==((1 << n)-1) && v==0){
    //printf("v=0\n");

    return dp[s][v]=0;
  }

  int res = 1000*15+1;

  for(int u=0;u<n;u++){
    if((!(s >> u & 1)) && m[v][u]>=0){
      //printf("m:%d",m[v][u]);
      res = min(res,rec(s | (1 << u),u)+m[v][u]);
    } 
  }
  //printf("res=%d\n",res);
  return dp[s][v]=res;
}

int main(){
  int v,e;
  cin >> v >> e;
  n=v;
  
    memset(m,-1,sizeof(m));


  int s,t,d;
  for(int i=0;i<e;i++){
    cin >> s >> t >> d;
    m[s][t]=d;
  }
  
  memset(dp,-1,sizeof(dp));
  int ans=rec(0,0);
  if(ans==15001){
    printf("%d\n",-1);
  }
  else{
    printf("%d\n",ans);
  }
  
}

    

Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: 'memset' was not declared in this scope
   37 |     memset(m,-1,sizeof(m));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

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

int dp[1 << 15][15];
int n;
int m[15][15];

int rec(int s,int v){
  if(dp[s][v]>=0){
    return dp[s][v];
  }

  if(s ==((1 << n)-1) && v==0){
    //printf("v=0\n");

    return dp[s][v]=0;
  }

  int res = 1000*15+1;

  for(int u=0;u<n;u++){
    if((!(s >> u & 1)) && m[v][u]>=0){
      //printf("m:%d",m[v][u]);
      res = min(res,rec(s | (1 << u),u)+m[v][u]);
    } 
  }
  //printf("res=%d\n",res);
  return dp[s][v]=res;
}

int main(){
  int v,e;
  cin >> v >> e;
  n=v;
  
    memset(m,-1,sizeof(m));


  int s,t,d;
  for(int i=0;i<e;i++){
    cin >> s >> t >> d;
    m[s][t]=d;
  }
  
  memset(dp,-1,sizeof(dp));
  int ans=rec(0,0);
  if(ans==15001){
    printf("%d\n",-1);
  }
  else{
    printf("%d\n",ans);
  }
  
}

    

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
class edge{
	public:
	int t,d,lim;
	edge(int it,int id,int ilim){
		t=it;	d=id;	lim=ilim;
	}
	bool operator>(edge a){
		return lim>a.lim;
	}
	bool operator<(edge a){
		return lim<a.lim;
	}
	bool operator>=(edge a){
		return lim>=a.lim;
	}
	bool operator<=(edge a){
		return lim<=a.lim;
	}
	bool operator==(edge a){
		return lim==a.lim;
	}
};
vector<edge> e[20];
ll dp[16][1<<16];
int main(){
	int n,m;	cin>>n>>m;
	for(int i=0;i<m;i++){
		int s,t,d,ti;	cin>>s>>t>>d>>ti;
		e[s-1].push_back(edge(t-1,d,ti));
		e[t-1].push_back(edge(s-1,d,ti));
	}
	for(int i=0;i<n;i++){
		for(int j=(1<<n)-1;j>=0;j--){
			dp[i][j]=2e14;
		}
	}
	dp[0][0]=0;	cnt[0][0]=1;
	for(int i=0;i<(1<<n)-1;i++){
		for(int j=0;j<n;j++){
			if(dp[j][i]==2e14)	continue;
			for(int k=0;k<(int)e[j].size();k++){
				if(dp[j][i]+e[j][k].d<=e[j][k].lim){
					int next=i|(1<<e[j][k].t);
					if(next==i)	continue;
					if(dp[e[j][k].t][next]>dp[j][i]+e[j][k].d){
						dp[e[j][k].t][next]=dp[j][i]+e[j][k].d;
					}
				}
			}
		}
	}
	if(dp[0][(1<<n)-1]==2e14){
		cout<<-1<<endl;
		return 0;
	}
	cout<<dp[0][(1<<n)-1]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
   40 |         dp[0][0]=0;     cnt[0][0]=1;
      |                         ^~~
      |                         int
Language: C++

#include <iostream>

using namespace std;

#define MAX_CITY_NUM 15
#define MAX 100000000

int d[MAX_CITY_NUM][MAX_CITY_NUM];

int tsp(int start, int visited_flag, int city_num){
    int rtn = MAX;
    //??¨????????????????¨???????????????´???
    if(visited_flag == (1 << city_num) - 1){
        if (d[start][0] == -1) {
            return rtn;
        }else{
            return d[start][0];
        }
    }
    
    for (int i = 0; i < city_num; i++) {
        //??????????¨???????????????§????????´???
        if (
            !(visited_flag & (1 << i))
            &&
            d[start][i] != -1
            )
        {
            rtn = min(
                      rtn,
                      d[start][i] + tsp(i, visited_flag | (1 << i), city_num)
                      );
        }
    }
    
    return rtn;
}


int main(){
    
    int V, E, frm, to, cost, ans;
    
    cin >> V >> E;
    
    //-1??§?????????
    memset(d, -1, sizeof(d));
    for (int i = 0; i < E; i++){
        cin >> frm >> to >> cost;
        d[frm][to] = cost;
    }
    
    ans = tsp(0, 1, V);
    
    if (ans >= MAX) {
        cout << -1 << endl;
    }
    else{
        cout << ans << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:5: error: 'memset' was not declared in this scope
   47 |     memset(d, -1, sizeof(d));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include <iostream>
#include <cstdlib>

using namespace std;

#define MAX_CITY_NUM 15
#define MAX 100000000

int d[MAX_CITY_NUM][MAX_CITY_NUM];

int tsp(int start, int visited_flag, int city_num){
    int rtn = MAX;
    //??¨????????????????¨???????????????´???
    if(visited_flag == (1 << city_num) - 1){
        if (d[start][0] == -1) {
            return rtn;
        }else{
            return d[start][0];
        }
    }
    
    for (int i = 0; i < city_num; i++) {
        //??????????¨???????????????§????????´???
        if (
            !(visited_flag & (1 << i))
            &&
            d[start][i] != -1
            )
        {
            rtn = min(
                      rtn,
                      d[start][i] + tsp(i, visited_flag | (1 << i), city_num)
                      );
        }
    }
    
    return rtn;
}


int main(){
    
    int V, E, frm, to, cost, ans;
    
    cin >> V >> E;
    
    //-1??§?????????
    memset(d, -1, sizeof(d));
    for (int i = 0; i < E; i++){
        cin >> frm >> to >> cost;
        d[frm][to] = cost;
    }
    
    ans = tsp(0, 1, V);
    
    if (ans >= MAX) {
        cout << -1 << endl;
    }
    else{
        cout << ans << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:5: error: 'memset' was not declared in this scope
   48 |     memset(d, -1, sizeof(d));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdlib>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
using namespace std;

int main(){
	int a, b, c, d;
	cin >> a >> b >> c
	for( int i = a; i <= b; i++){
	if( c&i == 0 ){ ++d }
	}
	cout << d << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:27: error: expected ';' before 'for'
    6 |         cin >> a >> b >> c
      |                           ^
      |                           ;
    7 |         for( int i = a; i <= b; i++){
      |         ~~~                
a.cc:7:25: error: 'i' was not declared in this scope
    7 |         for( int i = a; i <= b; i++){
      |                         ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
using namespace std;
const int INF=INT_MAX/2;

struct edge { int to, weight;};
typedef vector<edge> Edges;
typedef vector<Edges> Graph;

int  DP[1 << 15][15];

int rec(int S, int v, int V, Graph &G){
	if(DP[S][v]>=0){
		return DP[S][v];
	}
	if (S==(1 << V)-1 && v==0) 
	{
		return DP[S][v]=0;
	}

	int r = INF;
	for(int i=0;i<G[v].size();i++){
		edge f = G[v][i];
		if((S >> f.to)%2==0){
			r=min(r,rec((S | (1 << f.to)) ,f.to,V,G)+f.weight);
		}
	}
	return DP[S][v]=r;
}

int main(){
	int V,E,d,s;
	edge e;
	cin >> V >> E ;

	Graph G(V);
	for (int i=0;i<E;i++){
		cin >> s >> e.to >> e.weight;
		G[s].push_back(e);
	}

	memset(DP,-1,sizeof(DP));
	cout << rec(0,0,V,G) <<endl;
	return 0 ;
}

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

#include<algorithm>
#include<vector>
#include<limits>
#include<cstdio>
#define rep(i,a) for(int i=0;i<(a);++i)
#define clr(a,v) memset((a),(v),sizeof(a))

const int MAX_V = 15, INF = std::numeric_limits<int>::max()>>2;

int V, E;
std::vector<std::vector<int> > d( MAX_V, std::vector<int>( MAX_V, INF ) );
int dp[1<<MAX_V+1][MAX_V];

int sv;

int rec( int S, int v )
{
    if( S == (1<<V)-1 && v == sv )
        return dp[S][v] = 0;

    if( ~dp[S][v] )
        return dp[S][v];

    int ret = INF;

    rep( u, V ) if( !(S>>u&1) )
        ret = std::min( ret, rec( S|1<<u, u )+d[v][u] );

    return dp[S][v] = ret;
}

int main()
{
    scanf( "%d%d", &V, &E );
    rep( i, E )
    {
        int s, t;
        scanf( "%d%d", &s, &t );
        scanf( "%d", &d[s][t] );
    }

    int ans = INF;
    rep( v, V )
    {
        clr( dp, -1 );
        sv = v;
        ans = std::min( ans, rec( 0, v ) );
    }

    printf( "%d\n", ans==INF?-1:ans );

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: 'memset' was not declared in this scope
    6 | #define clr(a,v) memset((a),(v),sizeof(a))
      |                  ^~~~~~
a.cc:45:9: note: in expansion of macro 'clr'
   45 |         clr( dp, -1 );
      |         ^~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<cstdio>
  +++ |+#include <cstring>
    5 | #define rep(i,a) for(int i=0;i<(a);++i)