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

#include<iostream>
#include<queue>
#include<vector>
#include<functional>

using namespace std;

struct Edge{
	int to,cost;
	Edge(){}
	Edge(int to,int cost):to(to),cost(cost){}
};

int dijkstra(const vector< vector<Edge> > vve,int s,int t){
	priority_queue<pair<int,int>, vector< pair<int,int> >, greater< pair<int,int> > > que;
	pair<int,int> pii;
	pii.first = 0;
	pii.second = s;
	que.push(pii);

	vector<int> dist(vve.size(), INT_MAX);
	
	while(!que.empty()){
		int cost = que.top().first;
		int now = que.top().second;
		que.pop();

		if(dist[now] <= cost){
			continue;
		}

		dist[now] = cost;

		for(int i=0;i<vve[now].size();i++){
			que.push( make_pair(vve[now][i].cost + cost, vve[now][i].to) );
		}
	}

	return dist[t];
}

int main(){
	int n,m;
	while(true){
		cin >> n >> m;
		if(n == 0 && m==0){
			break;
		}

		vector< vector<Edge> > coin(m);
		vector< vector<Edge> > time(m);

		for(int i=0;i<n;i++){
			int a,b,c,t;
			cin >> a >> b >> c >> t;
			coin[a-1].push_back(Edge(b-1,c));
			coin[b-1].push_back(Edge(a-1,c));
			time[a-1].push_back(Edge(b-1,t));
			time[b-1].push_back(Edge(a-1,t));
		}

		int k;
		cin >> k;
		for(int i=0;i<k;i++){
			int p,q,r;
			cin >> p >> q >> r;
			int ans;
			if(r){
				ans = dijkstra(time,p-1,q-1);
			}else{
				ans = dijkstra(coin,p-1,q-1);
			}
			cout << ans << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int dijkstra(std::vector<std::vector<Edge> >, int, int)':
a.cc:21:38: error: 'INT_MAX' was not declared in this scope
   21 |         vector<int> dist(vve.size(), INT_MAX);
      |                                      ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<functional>
  +++ |+#include <climits>
    5 |
Language: C++

#include<iostream>
#include<queue>
#include<algorithm>
#include<utility>
#include<vector>
using namespace std;

#define MAX_M 110

struct edge{int to,cost;};
typedef pair<int,int> P;

vector<edge> c[2][MAX_M];

int dijkstra(int s,int e,bool r){
	int d[MAX_M];
	for(int i=0;i<MAX_M;i++){
		d[i]=INT_MAX;
	}
	priority_queue<P,vector<P>,greater< P > > que;
	
	d[s]=0;
	
	que.push(P(0,s));
	
	while(!que.empty()){
		P p=que.top();que.pop();
		int v=p.second;
		if(d[v]<p.first) continue;
		for(int i=0;i<c[r][v].size();i++){
			edge e=c[r][v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
	
	return d[e];
}

int main(){
	int n,m;
	while(cin>>n>>m,n!=0||m!=0){
		for(int i=0;i<n;i++){
			int a,b,cos,tim;
			cin>>a>>b>>cos>>tim;
			edge co,t;
			co.to=b;co.cost=cos;
			t.to=b;t.cost=tim;
			c[0][a].push_back(co);
			c[1][a].push_back(t);
		}
		cin>>n;
		for(int i=0;i<n;i++){
			int s,e;
			bool r;
			cin>>s>>e>>r;
			int ans=dijkstra(s,e,r);
			cout<<ans<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int dijkstra(int, int, bool)':
a.cc:18:22: error: 'INT_MAX' was not declared in this scope
   18 |                 d[i]=INT_MAX;
      |                      ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<utility>
  +++ |+#include <climits>
    5 | #include<vector>
Language: C++

#include<iostream>
#include<queue>
#include<algorithm>
#include<utility>
#include<vector>
#include<climits>
using namespace std;

#define MAX_M 110

struct edge{int to,cost;};
typedef pair<int,int> P;

vector<edge> c[2][MAX_M];

int dijkstra(int s,int e,bool r){
	int d[MAX_M];
	for(int i=0;i<MAX_M;i++){
		d[i]=INT_MAX;
	}
	priority_queue<P,vector<P>,greater< P > > que;
	
	d[s]=0;
	
	que.push(P(0,s));
	
	while(!que.empty()){
		P p=que.top();que.pop();
		int v=p.second;
		if(d[v]<p.first) continue;
		for(int i=0;i<c[r][v].size();i++){
			edge e=c[r][v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
	
	return d[e];
}

int main(){
	int n,m;
	while(cin>>n>>m,n!=0||m!=0){
		for(int r=0;r<2;r++){
			for(int i=0;i<MAX_M;i++){
				c[r][i].clear;
			}
		}
		for(int i=0;i<n;i++){
			int a,b,cos,tim;
			cin>>a>>b>>cos>>tim;
			edge co,t;
			co.to=b;co.cost=cos;
			t.to=b;t.cost=tim;
			c[0][a].push_back(co);
			c[1][a].push_back(t);
		}
		cin>>n;
		for(int i=0;i<n;i++){
			int s,e;
			bool r;
			cin>>s>>e>>r;
			int ans=dijkstra(s,e,r);
			cout<<ans<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:41: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::clear() [with _Tp = edge; _Alloc = std::allocator<edge>]'
   48 |                                 c[r][i].clear;
      |                                 ~~~~~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/queue:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1607:7: note: declared here
 1607 |       clear() _GLIBCXX_NOEXCEPT
      |       ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <map>
using namespace std;

typedef pair<int,int> P;

const int MAX_V = 101;
const int INF = 1000000009;
struct edge { int to, cost, time; };
vector<edge> G[MAX_V];
int dist[MAX_V];

int dijkstra(int s, int t, int type) {
	fill(dist, dist+MAX_V, INF);
	dist[s] = 0;
	priority_queue<P, vector<P>, greater<P> > que;
	que.push(P(0, s));
	while(!que.empty()) {
		P n = que.top(); que.pop();
		int v = n.second;
		if(v == t) return dist[v];

		for(int i=0; i<G[v].size(); i++) {
			edge& e = G[v][i];
			if(type == 0) {
				if(dist[e.to] > dist[v] + e.cost) {
					dist[e.to] = dist[v] + e.cost;
					que.push(P(dist[e.to], e.to));
				}
			} else {
				if(dist[e.to] > dist[v] + e.time) {
					dist[e.to] = dist[v] + e.time;
					que.push(P(dist[e.to], e.to));
				}
			}
		}
	}
	return INF;
}

int M, N, K;
int a, b, c, time;
int p, q, r;


int main() {
	while(scanf("%d%d", &N, &M), N|M) {
		for(int i=0; i<MAX_V; i++) G[i].clear();

		for(int i=0; i<N; i++) {
			scanf("%d%d%d%d", &a, &b, &c, &time);
			edge e = { b, c, time };
			G[a].push_back(e);
		}

		scanf("%d", &K);
		for(int i=0; i<K; i++) {
			scanf("%d%d%d", &p, &q, &r);
			int d = dijkstra(p, q, r);
			printf("%d\n", d);
		}
	}
}

Compiler output:
a.cc:44:14: error: 'int time' redeclared as different kind of entity
   44 | int a, b, c, time;
      |              ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:54:47: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   54 |                         edge e = { b, c, time };
      |                                               ^
      |                                               |
      |                                               time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int a, b, time, cost, querys;
	int i, j, k, p, q, r, n, m;
	int times[100][100], costs[100][100];

	while (true) {
		cin >> n >> m;
		if (!n && !m)
			break;

		for (i = 0; i < m; i++) {
			for (j = 0; j < m; j++) {
				times[i][j] = (i == j) ? 0 : 1e9;
				costs[i][j] = (i == j) ? 0 : 1e9;
			}
		}

		for (i = 0; i < n; i++) {
			cin >> a >> b >> cost >> time;
			times[a - 1][b - 1] = time;
			costs[a - 1][b - 1] = cost;
		}

		for (k = 0; k < m; k++) {
			for (i = 0; i < m; i++) {
				for (j = 0; j < m; j++) {
					times[i][j] = min(times[i][j], times[i][k] + times[k][j]);
					costs[i][j] = min(costs[i][j], costs[i][k] + costs[k][j]);
				}
			}
		}

		cin >> querys;
		for (i = 0; i < querys; i++) {
			cin >> p >> q >> r;
			cout << r ? times[p - 1][q - 1] : costs[p - 1][q - 1] << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:79: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   42 |                         cout << r ? times[p - 1][q - 1] : costs[p - 1][q - 1] << endl;
      |                                                           ~~~~~~~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include<iostream>
using namespace std;
int line[3001][3001],c[3001][3001],t[3001][3001];
int stop[3001]={0};
int ls[3001]={0}; 
int route_cost(int p,int q){
  int top = -1;
  for(int i=0;i<ls[p];i++){
    cout << line[p][i] << endl;
    if(stop[line[p][i]]!=0) continue;
    stop[p]++;
    if(q==line[p][i]){
	stop[p] = 0;
	return c[p][q];
   }
int h = route_cost(line[p][i],q)+c[p][line[p][i]];
    else if(top<0||top>h){
      top = h+c[p][line[p][i]];
    }
  }
  stop[p] = 0;
  return top;
}
int route_time(int p,int q){
  int top = -1;
  for(int i=0;i<ls[p];i++){
    //cout << "P " << p << endl;
    cout << line[p][i] << endl;
    if(stop[line[p][i]]!=0) continue;
    stop[p]++;
      if(q==line[p][i]){
	stop[p] = 0;
	 return t[p][q];
      }
h = route_time(line[p][i],q)+t[p][line[p][i]];
      else if(top<0||top>h){
	top = h;
	//cout << 'O' << endl;
      }
  }
  stop[p] = 0;
  return top;
}
int main(){
  int n,m;
  int a,b,cost,time;
  while(cin>>n>>m){
    if(n==0&&m==0) break;
    for(int i=0;i<n;i++){
      cin >> a >> b >> cost >> time;
      line[a][ls[a]] = b;
      ls[a]++;
      line[b][ls[b]] = a;
      ls[b]++;
      c[a][b] = cost;
      c[b][a] = cost;
      t[a][b] = time;
      t[b][a] = time;
      //cout << "line " << line[a][ls[a]-1] << ' ' << line[b][ls[b]-1] << endl; 
    }
    int k;
    cin >> k;
    int p,q,r;
    for(int i=0;i<k;i++){
      cin>>p>>q>>r;
      if(r==0) cout << route_cost(p,q) << endl;
      else if(r==1) cout << route_time(p,q) << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int route_cost(int, int)':
a.cc:17:5: error: 'else' without a previous 'if'
   17 |     else if(top<0||top>h){
      |     ^~~~
a.cc: In function 'int route_time(int, int)':
a.cc:35:1: error: 'h' was not declared in this scope
   35 | h = route_time(line[p][i],q)+t[p][line[p][i]];
      | ^
a.cc:36:7: error: 'else' without a previous 'if'
   36 |       else if(top<0||top>h){
      |       ^~~~
Language: C++

#include<iostream>
using namespace std;
int line[3001][3001],c[3001][3001],t[3001][3001];
int stop[3001]={0};
int ls[3001]={0}; 
int route_cost(int p,int q){
  int top = -1;
  for(int i=0;i<ls[p];i++){
    //cout << line[p][i] << endl;
    if(stop[line[p][i]]!=0) continue;
    stop[p]++;
    if(q==line[p][i]){
	stop[p] = 0;
	return c[p][q];
   }
int h = route_cost(line[p][i],q)+c[p][line[p][i]];
    else if(top<0||top>h){
      top = h+c[p][line[p][i]];
    }
  }
  stop[p] = 0;
  return top;
}
int route_time(int p,int q){
  int top = -1;
  for(int i=0;i<ls[p];i++){
    //cout << "P " << p << endl;
    //cout << line[p][i] << endl;
    if(stop[line[p][i]]!=0) continue;
    stop[p]++;
      if(q==line[p][i]){
	stop[p] = 0;
	 return t[p][q];
      }
h = route_time(line[p][i],q)+t[p][line[p][i]];
      else if(top<0||top>h){
	top = h;
	//cout << 'O' << endl;
      }
  }
  stop[p] = 0;
  return top;
}
int main(){
  int n,m;
  int a,b,cost,time;
  while(cin>>n>>m){
    if(n==0&&m==0) break;
    for(int i=0;i<n;i++){
      cin >> a >> b >> cost >> time;
      line[a][ls[a]] = b;
      ls[a]++;
      line[b][ls[b]] = a;
      ls[b]++;
      c[a][b] = cost;
      c[b][a] = cost;
      t[a][b] = time;
      t[b][a] = time;
      //cout << "line " << line[a][ls[a]-1] << ' ' << line[b][ls[b]-1] << endl; 
    }
    int k;
    cin >> k;
    int p,q,r;
    for(int i=0;i<k;i++){
      cin>>p>>q>>r;
      if(r==0) cout << route_cost(p,q) << endl;
      else if(r==1) cout << route_time(p,q) << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int route_cost(int, int)':
a.cc:17:5: error: 'else' without a previous 'if'
   17 |     else if(top<0||top>h){
      |     ^~~~
a.cc: In function 'int route_time(int, int)':
a.cc:35:1: error: 'h' was not declared in this scope
   35 | h = route_time(line[p][i],q)+t[p][line[p][i]];
      | ^
a.cc:36:7: error: 'else' without a previous 'if'
   36 |       else if(top<0||top>h){
      |       ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#define INF (1<<30)
#define COST 0
#define TIME 1

using namespace std;

typedef pair<int, int> p;

vector<p> costs[105], times[105];
int dist[105];
void dijkstra(vector<p> *edge, int s){
	fill(dist, dist + 105, INF);
	dist[s] = 0;
	priority_queue<p, vector<p>, greater<p> > q;
	q.push(p(0, s));
	while(!q.empty()){
		p tmp = q.top();q.pop();
		int d = tmp.first, from = tmp.second;
		if(dist[from] < d)continue;		
		for(int i = 0; i < edge[from].size(); i++){
			int to = edge[from][i].first, c = edge[from][i].second;
			if(dist[to] < dist[from] + c)continue;
			dist[to] = dist[from] + c;
			q.push(p(dist[to], to));
		}
	}
}

int main(){
	while(true){
		int n, m;
		cin >> n >> m;
		if(!n && !m)
			break;
		costs.clear();
		times.clear();
		for(int i = 0; i < n; i++){
			int a, b, c, t;
			cin >> a >> b >> c >> t;
			costs[a].push_back(p(b, c));
			costs[b].push_back(p(a, c));
			times[a].push_back(p(b, t));
			times[b].push_back(p(a, t));
		}
		int k;
		cin >> k;
		for(int i = 0; i < k; i++){
			int p, q, r;
			cin >> p >> q >> r;
			if(r == COST){
				dijkstra(costs, p);
			}else{
				dijkstra(times, p);
			}
			cout << dist[q] << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:23: error: request for member 'clear' in 'costs', which is of non-class type 'std::vector<std::pair<int, int> > [105]'
   40 |                 costs.clear();
      |                       ^~~~~
a.cc:41:23: error: request for member 'clear' in 'times', which is of non-class type 'std::vector<std::pair<int, int> > [105]'
   41 |                 times.clear();
      |                       ^~~~~
Language: C++

#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;
const int MAX = 10000;

/** Problem0200 : Traveling Alone : One-way Ticket of Youth **/
int costG[100][100];
int timeG[100][100];

int main()
{
	int n, m, a, b, c, t;
	
	while (cin >> n >> m, n!=0 && m!=0) {
		rep(i, 100) {
			rep(j, 100) {
				costG[i][j]=INF;
				timeG[i][j]=INF;
			}
		}
		
		rep(k, n) {
			cin >> a >> b >> c >> t;
			a--; b--;
			costG[a][b] = c;
			costG[b][a] = c;
			timeG[a][b] = t;
			timeG[b][a] = t;
		}
		
		rep(k, m) {
			rep(i, m) {
				rep(j, m) {
					costG[i][j] = min(costG[i][j], costG[i][k]+costG[k][j]);
					timeG[i][j] = min(timeG[i][j], timeG[i][k]+timeG[k][j]);
				}
			}
		}
		
		int k, p, q, r;
		cin >> k;
		rep(i, k) {
			cin >> p >> q >> r;
			p--; q--;
			if (r==0) {
				cout << costG[p][q] << endl;
			} else {
				cout << timeG[p][q] << endl;
			}
		}
	}
	re

Compiler output:
a.cc: In function 'int main()':
a.cc:67:9: error: 're' was not declared in this scope; did you mean 'rep'?
   67 |         re
      |         ^~
      |         rep
a.cc:67:11: error: expected '}' at end of input
   67 |         re
      |           ^
a.cc:26:1: note: to match this '{'
   26 | {
      | ^
Language: C++

//2013-5

#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <time.h>
#define mp make_pair
#define INF 1e8
#define fs first
#define sc second
#define rep(x,n) for(int x = 0;x < n;x ++)
#define Rep(x,n) for(int x = 1;x <= n;x ++)
using namespace std;

int d[2][105][105]; //行き先、cost...0 time...1

int main(){
    int n,m;
    while(scanf("%d %d",&n,&m)&&(n!=0||m!=0){

    rep(i,m){
        rep(j,m){
            d[0][i][j]=INF;
            d[1][i][j]=INF;
        }
    }
    rep(i,m){
        d[0][i][i]=0;
        d[1][i][i]=0;
    }

    rep(i,n){
        int a,b,cost,time;
        scanf("%d %d %d %d",&a,&b,&cost,&time);
        a--;b--;
        d[0][a][b]=cost;
        d[0][b][a]=cost;
        d[1][a][b]=time;
        d[1][b][a]=time;
    }
    
    
    rep(i,2){
        rep(j,m){
            rep(k,m){
                rep(l,m){
                    d[i][k][l]=min(d[i][k][l],d[i][k][j]+d[i][j][l]);
                    if(d[i][k][l]>INF)
                        d[i][k][l]=INF;
                }
            }
        }
    }
    
    int k;
    scanf("%d",&k);
    rep(i,k){
        int p,q,r;
        scanf("%d %d %d",&p,&q,&r);
        p--;q--;
        printf("%d\n",d[r][p][q]);
    }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:45: error: expected ')' before '{' token
   24 |     while(scanf("%d %d",&n,&m)&&(n!=0||m!=0){
      |          ~                                  ^
      |                                             )
Language: Java

class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			HashMap<String, Integer> data = new HashMap<String, Integer>();
			int items = sc.nextInt();
			if (items == 0) {
				break;
			}
			for (int i = 0; i < items; i++) {
				data.put(sc.next(), sc.nextInt());
			}
			int craftrecipe = sc.nextInt();
			for (int j = 0; j < craftrecipe; j++) {
				String item = sc.next();
				int source = sc.nextInt();
				int money = 0;
				for (int k = 0; k < source; k++) {
					String a = sc.next();
					money += data.get(a);
				}
				if (data.get(item) > money) {
					data.put(item, money);
				}
			}
			String answer = sc.next();
			System.out.println(data.get(answer));
		}
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
			HashMap<String, Integer> data = new HashMap<String, Integer>();
			^
  symbol:   class HashMap
  location: class Main
Main.java:5: error: cannot find symbol
			HashMap<String, Integer> data = new HashMap<String, Integer>();
			                                    ^
  symbol:   class HashMap
  location: class Main
4 errors
Language: Java

8
wood 3000
string 800
rice 36
water 0
racket 5000
microphone 9800
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
8
^
1 error
Language: Java

import java.util.HashMap;
import java.util.Scanner;

public class Vol2_201 {

	void run() {
		Scanner in = new Scanner(System.in);
		
		HashMap<String, Integer> item = new HashMap<String, Integer>();
		
		while(true) {
			int N = Integer.parseInt(in.next());
			if (N == 0) break;
			for(int i = 0; i < N; i++) {
				item.put(in.next(), Integer.parseInt(in.next()));
			}
			
			int M = Integer.parseInt(in.next());
			for(int i = 0; i < M; i++) {
				String item_name = in.next();
				int item_cost = item.get(item_name);
				int X = Integer.parseInt(in.next());
				int recipe_cost = 0;
				for(int j = 0; j < X; j++) {
					recipe_cost += item.get(in.next());
				}
				if(item_cost > recipe_cost) {
					item.put(item_name, recipe_cost);
				}
			}
			System.out.println(item.get(in.next()));
		}
	}
	
	public static void main(String[] args) {
		new Vol2_201().run();
	}
}

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


import java.util.*;

class P0200 {

    Scanner sc;
    HashMap<Integer, Integer> itemList;
    HashMap<String, Integer> key;
    LinkedList<Integer>[] itemComb;

    long solve(int item) {
        long sum = 0;
        if (itemComb[item].isEmpty()) {
            return itemList.get(item);
        }
        for (int str : itemComb[item]) {
            sum += solve(str);
        }
        return Math.min(itemList.get(item), sum);
    }

    void run() {
        sc = new Scanner(System.in);

        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            itemList = new HashMap<Integer, Integer>();
            key = new HashMap<String, Integer>();
            itemComb = new LinkedList[n];
            for (int i = 0; i < n; i++) {
                String item = sc.next();
                itemList.put(i, sc.nextInt());
                key.put(item, i);
                itemComb[i] = new LinkedList<Integer>();
            }
            int m = sc.nextInt();
            for (int i = 0; i < m; i++) {
                String item = sc.next();
                int num = sc.nextInt();
                for (int j = 0; j < num; j++) {
                    itemComb[key.get(item)].add( key.get(sc.next()) );
                }
            }
            System.out.println(solve( key.get(sc.next()) ) );
        }
    }

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

Compiler output:
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Language: Java


import java.util.*;

class Main {

    Scanner sc;
    HashMap<String, Integer> itemList;
    HashMap<String, LinkedList<String>> itemComb;

    long solve(String item, long min) {
        long sum = 0;
        if ( !itemList.contains(item) )return min;
        if (itemComb.get(item).isEmpty()) {
            return itemList.get(item);
        }
        for (String str : itemComb.get(item)) {
            sum += solve(str, min);
            if (sum >= min) return min;
        }
        return sum;
    }

    void run() {
        sc = new Scanner(System.in);

        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            itemList = new HashMap<String, Integer>();
            itemComb = new HashMap<String,LinkedList<String>>();
            for (int i = 0; i < n; i++) {
                LinkedList<String> tmp = new LinkedList<String>();
                String item = sc.next();
                itemList.put(item, sc.nextInt());
                itemComb.put(item,tmp);
            }
            int m = sc.nextInt();
            for (int i = 0; i < m; i++) {
                String item = sc.next();
                int num = sc.nextInt();
                LinkedList<String> tmp = new LinkedList<String>();
                for (int j = 0; j < num; j++) {
                    tmp.add(sc.next());
                }
                itemComb.put(item,tmp);
            }
            String q = sc.next();
            System.out.println(solve( q, itemList.get(q) ) );
        }
    }

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

Compiler output:
Main.java:12: error: cannot find symbol
        if ( !itemList.contains(item) )return min;
                      ^
  symbol:   method contains(String)
  location: variable itemList of type HashMap<String,Integer>
1 error
Language: C

#include<iostream>
#include<string>
#include<map>
using namespace std;

int main(){
  int n, price, m, sum;
  string item, ingre, wantMake;
  while(cin >> n, n){
    sum = 0;
    map <string,int> itemPrice;
    while(n--){
      cin >> item >> price;
      itemPrice.insert(map<string,int>::value_type(item,price));
    }
    cin >> m;
    while(m--){
      sum = 0;
      cin >> item >> price;
      while(price--){
        cin >> ingre;
        if(itemPrice.find(ingre)!=itemPrice.end()){
          sum += itemPrice[ingre];
        }
      }
      if(itemPrice[item]>sum){
	itemPrice[item] = sum;
      }
    }
    cin >> wantMake;
    cout << itemPrice[wantMake] <<endl;
  }
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<string>
#include<map>
using namespace std;

int main(){
  int n, price, m, sum;
  string item, ingre, wantMake;
  while(cin >> n, n){
    sum = 0;
    map <string,int> itemPrice;
    while(n--){
      cin >> item >> price;
      itemPrice.insert(map<string,int>::value_type(item,price));
    }
    cin >> m;
    while(m--){
      sum = 0;
      cin >> item >> price;
      while(price--){
	cin >> ingre;
	if(itemPrice.find(ingre)!=itemPrice.end()){
          sum += itemPrice[ingre];
	}
      }
      if(itemPrice[item]>sum){
	itemPrice[item] = sum;
      }
    }
    cin >> wantMake;
    cout << itemPrice[wantMake] <<endl;
  }
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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

typedef struct{
  char name[128];
  unsigned int minprice;
  short fr_oth;
} item;

typedef struct{
  char to[128];
  unsigned int num;
  char from[100][128];
} gosei;

item list[100];
gosei makelist[100];
unsigned int m,n;

unsigned int makeans(int var);

int main(void){
  unsigned int i,j,k,ans;
  char tmpstr[128];
  unsigned int inputs;
  while(scanf("%u%*c",&n) &&n){
    for(i=0;i<n;i++)
      scanf("%s %u%*c",list[i].name,&(list[i].minprice));

    scanf("%u%*c",&m);
    for(i=0;i<m;i++){
      scanf("%s %u%*c",tmpstr,&inputs);
      for(j=0;j<n;j++){
	if(strcmp(list[j].name,tmpstr))continue;
	list[j].fr_oth=1;
	break;
      }
      strcpy(makelist[i].to,tmpstr);
      makelist[i].num=inputs;
      for(j=0;j<makelist[i].num;j++)
	scanf("%s%*c",makelist[i].from[j]);
    }
    scanf("%s%*c",tmpstr);
    for(i=0;i<n;i++){
      if(strcmp(list[i].name,tmpstr)) continue;
      k=i;
      break;
    }
    
    ans=makeans(k);
    printf("%u\n",ans);
  }
  return 0;
}

unsigned int makeans(int var){
  unsigned int i,j,k,tmp;
  if(list[var].fr_oth==1){
    tmp=0;
    for(i=0;i<m;i++){
      if(strcmp(makelist[i].to,list[var].name)) continue;
      k=i;
      break;
    }
    for(i=0;i<makelist[k].num;i++){
      for(j=0;j<n;j++){
	if(strcmp(makelist[k].from[i],list[j].name)) continue;
	break;
      }
      tmp+=makeans(j);
    }
    if(var->minprice>tmp) list[var].minprice=tmp;
    list[var].fr_oth=0;
  }
  return list[var].minprice;
}

Compiler output:
main.c: In function 'makeans':
main.c:73:11: error: invalid type argument of '->' (have 'int')
   73 |     if(var->minprice>tmp) list[var].minprice=tmp;
      |           ^~
Language: C++

#include <cstdlib>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

typedef vector<vector<int>> graph;

void dfs(int v, const graph &G, vector<bool> &visited, vector<int> &order) {
	visited[v] = true;
	for(const auto &to : G[v]) {
		if(!visited[to]) dfs(to, G, visited, order);
	}
	order.emplace_back(v);
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	for(int n; cin >> n && n;) {
		unordered_map<string, int> encoder;
		vector<int> price(n);

		for(int i = 0; i < n; ++i) {
			string name;
			cin >> name >> price[i];
			encoder[name] = i;
		}

		int m;
		cin >> m;

		graph G(n);
		for(int i = 0; i < m; ++i) {
			string target;
			int k;
			cin >> target >> k;

			const int to = encoder[target];
			for(int j = 0; j < k; ++j) {
				string from;
				cin >> from;
				G[encoder[from]].emplace_back(to);
			}
		}

		vector<bool> visited(n, false);
		vector<int> order;
		for(int v = 0; v < n; ++v) {
			if(!visited[v]) dfs(v, G, visited, order);
		}

		vector<int> sum(n, INT_MAX);
		for(int i = n - 1; i >= 0; --i) {
			const int v = order[i];
			chmin(sum[v], price[v]);

			for(const auto &to : G[v]) {
				if(sum[to] == INT_MAX) sum[to] = 0;
				sum[to] += sum[v];
			}
		}

		string want;
		cin >> want;
		cout << sum[encoder[want]] << endl;
	}

	return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:36: error: 'INT_MAX' was not declared in this scope
   56 |                 vector<int> sum(n, INT_MAX);
      |                                    ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <vector>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<string>
using namespace std;
typedef struct{
  vector<string> sozai;
  long long money;
}BUTU;
pair<string,logn long> P[1002];
BUTU butu[1024];
long long n,p,m,a,b;
string s,ss,mokuhyou;
long long tansaku(string now){
  for(int i=0;i<n;i++){
    if(P[i].first==now){
      return P[i].second;
    }
  }
  return -1;
}
long long check(string now){
  long long banti=tansaku(now);
  long long f=butu[banti].sozai.size();
  long long cnt=0;
  if(f==0){
    return butu[banti].money;
  }
  else{
    for(int i=0;i<f;i++){
      if(tansaku(butu[banti].sozai[i])!=-1){
	cnt+=check(butu[banti].sozai[i]);
      }
      else{
	return butu[banti].money;
      }
    }
    return min(cnt,butu[banti].money);
  }
  return -1;
}
main(){
  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>s>>p;
      butu[i].money=p;
      P[i].first=s;
      P[i].second=i;
    }
    cin>>m;
    for(int i=0;i<m;i++){
      cin>>s>>a;
      b=tansaku(s);
      for(int j=0;j<a;j++){
	cin>>ss;
	butu[b].sozai.push_back(ss);
      }
    }
    cin>>mokuhyou;
    cout<<check(mokuhyou)<<endl;
  }
}
    

Compiler output:
a.cc:11:13: error: 'logn' was not declared in this scope; did you mean 'long'?
   11 | pair<string,logn long> P[1002];
      |             ^~~~
      |             long
a.cc:11:22: error: template argument 2 is invalid
   11 | pair<string,logn long> P[1002];
      |                      ^
a.cc: In function 'long long int tansaku(std::string)':
a.cc:17:13: error: request for member 'first' in 'P[i]', which is of non-class type 'int'
   17 |     if(P[i].first==now){
      |             ^~~~~
a.cc:18:19: error: request for member 'second' in 'P[i]', which is of non-class type 'int'
   18 |       return P[i].second;
      |                   ^~~~~~
a.cc: At global scope:
a.cc:43:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   43 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:50:12: error: request for member 'first' in 'P[i]', which is of non-class type 'int'
   50 |       P[i].first=s;
      |            ^~~~~
a.cc:51:12: error: request for member 'second' in 'P[i]', which is of non-class type 'int'
   51 |       P[i].second=i;
      |            ^~~~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>
using namespace std;
typedef pair<string, int>P;

int main() {
	int n;
	while (cin >> n, n) {
		vector<P>v;
		for (int i = 0;i < n;i++) {
			string sa, int a;
			cin >> sa >> a;
			v.push_back(P(sa, a));
		}

		int m;
		cin >> m;
		for (int i = 0;i < m;i++) {
			string s;
			cin >> s;
			int a;
			cin >> a;

			int it=-1;
			int mny = 0;
			for (int j = 0;j < a;j++) {
				string sb;
				cin >> sb;
				for (int k = 0;k < n;k++) {
					if (sb == v[k].first) {
						mny += v[k].second;
					}
				}
			}
			for (int j = 0;j < v.size();j++) {
				if (s == v[j].first)it = j;
			}
			if (it == -1)v.push_back(P(s, mny));
			else v[it].second = mny;
		}

		string ans;
		cin >> ans;
		for (int i = 0;i < v.size();i++) {
			if (ans == v[i].first) {
				cout << v[i].second << endl;
				break;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:36: error: expected unqualified-id before 'int'
   14 |                         string sa, int a;
      |                                    ^~~
a.cc:15:38: error: 'a' was not declared in this scope; did you mean 'sa'?
   15 |                         cin >> sa >> a;
      |                                      ^
      |                                      sa
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <string>

#define REP(i,n) for(int i = (int)(n) - 1; i >= 0; --i)

using namespace std;

int costs[101];
vector<int> recipe[101];
bool flags[101];

int getCost(int goal){
	if(recipe[goal].empty()) return costs[goal];
	flags[goal] = true;
	int sum = 0;
	REP(i, recipe[goal].size()){
		if(flags[recipe[goal][i]]){
			flags[goal] = false;
			return costs[goal];
		}
		sum += getCost(recipe[goal][i]);
	}
	flags[goal] = false;
	if(sum < costs[goal]){
		return sum;
	}else{
		return costs[goal];
	}
}

int main(){
	int n, m;
	while(true){
		cin >> n;
		if(n==0)break;
		
		memset(flags, 0, sizeof(flags));

		map<string,int> hash;
		
		REP(i,n){
			string name;
			cin >> name >> costs[i];
			hash.insert(map<string,int>::value_type(name,i));
			recipe[i].clear();
		}

		cin >> m;
		REP(i, m){
			string name;
			int item;
			int num;
			cin >> name >> num;
			item = hash[name];
			recipe[item].reserve(num);
			REP(j, num){
				string mate;
				int mat;
				cin >> mate;
				mat = hash[mate];
				recipe[item].push_back(mat);
			}
		}

		string goalName;
		int goal;
		cin >> goalName;
		goal = hash[goalName];

		cout << getCost(goal) << endl;
		
	}
	
	return 0;
}

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

#include <stdio.h>
#include <queue>
#include <string.h>
using namespace std;
typedef pair<int,int> P;

//howmuch[i]:i番のアイテムの最小の値段
int howmuch[100];

//itemname[i]:i番目のアイテムの名前
char itemname[100][101];

//n:アイテムの種類 m:レシピの数
int n,m;

//resipeuseditem[i][k]:iをつくるためにkを用いたかどうかの判定
bool resipeuseditem[100][100];

//resipeN[i]:iを作るために用いたアイテムの番号を保存する
queue <int> resipeN[100];

//allminseek作業用キュー
priority_queue< P,vector<P>,greater<P> > que;

//アイテム名を番号に変換する関数
int nameTOnonber(char *);

//最小値を求める
void allminseek();

int main()
{
	int k,i,j,oTOi,o2;
	char o[101];

	scanf("%d",&n);

	while(n != 0){
	//初期化
	for(i = 0; i < 100; i++){
		for(j = 0; j < 100; j++){
			resipeuseditem[i][j] = false;
		}
	}

	//入力
	for(i = 0;i < n; i++){
		fflush(stdin);
		scanf("%s %d",itemname[i],&howmuch[i]);
		int a = nameTOnonber(itemname[i]);
		que.push(P(howmuch[i],a));
	}

	scanf("%d",&m);
	for(i = 0;i < m; i++){
		scanf("%s %d",o,&k);
		oTOi = nameTOnonber(o);
		//printf("k:%d\n",k);
		for(j = 0; j < k; j++){
			scanf("%s",o);
			o2 = nameTOnonber(o);
			resipeN[oTOi].push(o2);
			resipeuseditem[oTOi][o2] = true;
			//printf("作るもの:%d 素材[%d]:%d\n",oTOi,j,o2);
		}
		//printf("size:%d\n",resipeN[oTOi].size());
	}
	
	//探索
	allminseek();

	scanf("%s",o);
	printf("%d\n",howmuch[ nameTOnonber(o) ]);

	scanf("%d",&n);
	}
	return 0;
}

int nameTOnonber(char *name){
	for(int i = 0; i < n; i++){
		if(strcmp(itemname[i],name) == 0){
			//printf("アイテム名:%s 配列番号:%d\n",name,i);
			return i;
		}
	}

	printf("nameTOnonber変換ミス\n");
	return INT_MAX;
}

void allminseek(){

	//アイテムiを使用したかどうかのフラグ
	bool used[100];
	int temp,minNO;

	//printf("min:配列%d 値段%d",min.first,min.second);
	for(int i = 0; i < n; i++)	used[i] = false;

	while(!que.empty()){
		minNO = que.top().second;
		que.pop();
		//printf("最小値段アイテム:%s\n",itemname[minNO]);
		if(!used[ minNO ]){
			//minNOを使用しているレシピの探索と実行
			for(int i = 0;i < n; i++){
				//printf("[%d][%d]%d\n",i,minNO,resipeuseditem[i][minNO]);
				if(resipeuseditem[i][minNO]){
					temp = 0;
					for(int j = 0; j < resipeN[i].size(); j++){
						temp += howmuch[ resipeN[i].front() ];
						//printf("材料:%d 値段:%d 合計:%d\n",resipeN[i].front(),howmuch[ resipeN[i].front() ],temp);
						resipeN[i].push(resipeN[i].front());
						resipeN[i].pop();
					}
					if(howmuch[i] > temp){
						howmuch[i] = temp;
						que.push(P(temp,i));
					}
				}
			}
			
			used[ minNO ] = true;
		}
	}
}

Compiler output:
a.cc: In function 'int nameTOnonber(char*)':
a.cc:89:16: error: 'INT_MAX' was not declared in this scope
   89 |         return INT_MAX;
      |                ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <string.h>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int n, m;
map<string, int> items;
map<string, vector<string> > alc;

map<string, int> memo;
int minPrice(const string& t) {
	vector<string>& mats = alc[t];
	if (!mats.size()) return items[t];
	map<string, int>::iterator it = memo.find(t);
	if (it != memo.end()) return it->second;
	i	nt ap = 0;
	for (unsigned i = 0; i < mats.size(); i++) {
		ap += minPrice(mats[i]);
	}
	return memo[t] = min(items[t], ap);
}

int main () {
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			string name;
			int value;
			cin >> name >> value;
			items[name] = value;
		}
		cin >> m;
		for (int i = 0; i < m; i++) {
			string name;
			int k;
			cin >> name >> k;
			vector<string> mats;
			for (int j = 0; j < k; j++) {
				string mat;
				cin >> mat;
				mats.push_back(mat);
			}
			alc[name] = mats;
		}
		string target;
		cin >> target;
		cout << minPrice(target) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int minPrice(const std::string&)':
a.cc:16:9: error: 'i' was not declared in this scope; did you mean 'it'?
   16 |         i       nt ap = 0;
      |         ^
      |         it
a.cc:18:17: error: 'ap' was not declared in this scope
   18 |                 ap += minPrice(mats[i]);
      |                 ^~
a.cc:20:40: error: 'ap' was not declared in this scope
   20 |         return memo[t] = min(items[t], ap);
      |                                        ^~
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define EQ(a,b) (abs((a)-(b))<EPS)
int n,m;
struct item
{
	string name;
	int cost,size;
	vector<string> le;
};
item lis[100];
int memo[100];
int mysearch(string s)
{
	for(int i=0;i<n;i++)
	{
		if(lis[i].name==s)return i;
	}
}
int getcost(int v)
{
	if(memo[v]!=-1)return memo[v];
	else
	{
		if(lis[v].size==0)return lis[v].cost;
		else
		{
			int ans=0;
			for(int i=0;i<lis[v].size;i++)
			{
				ans+=getcost(mysearch(lis[v].le[i]));
			}
			memo[v]= min(ans,lis[v].cost);
			list[v].cost=memo[v];
			return memo[v];
		}
	}
}
int main()
{
	while(1)
	{
		fill(memo,memo+100,-1);
		cin >> n;
		if(n==0)break;
		string s;
		int c;
		for(int i=0;i<n;i++)
		{
			cin >> s >> c;
			lis[i].name=s;
			lis[i].cost=c;
			lis[i].size=0;
		}
		cin >> m;
		for(int i=0;i<m;i++)
		{
			int t,k;
			cin >> s;
			cin >> t;
			for(int j=0;j<t;j++)
			{
				string st;
				cin >> st;
				k=mysearch(s);
				lis[k].le.pb(st);
			}
			lis[k].size=t;
		}
		string str;
		cin >> str;
		cout << getcost(mysearch(str))<< endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int getcost(int)':
a.cc:52:25: error: 'list' was not declared in this scope
   52 |                         list[v].cost=memo[v];
      |                         ^~~~
a.cc:14:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
   13 | #include <set>
  +++ |+#include <list>
   14 | using namespace std;
a.cc: In function 'int mysearch(std::string)':
a.cc:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^
Language: C++

#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>
using namespace::std;
int n;

struct item{
    string name;
    int cost;
    vector<string> used;
    int size;
} ;

item list[100];
int memo[100];

int getCost(int v)
{
    if(memo[v]!=-1)return memo[v];
    int i, j;
    int ans;
    
    if (list[v].size == 0){
        return (list[v].cost);
    }
    else {
        ans = 0;
        for (i = 0; i < list[v].size; i++){
            for (j = 0; j < n; j++){
                if (list[v].used[i]== list[j].name){
                    ans += getCost(j);
                }
            }
        }
        list[v].cost = min(list[v].cost,ans);
    }
    return (list[v].cost);
}

int main(void)
{
    int i, j, k;
    int m, kk;
    string key, temp;
    int look, sum;
    
    while (1){
        scanf("%d", &n);
        
        if (n == 0){
            break;
        }
        for(i=0;i<n;i++)memo[i]=-1;
        for (i = 0; i < n; i++){
            cin >> list[i].name >> list[i].cost;
            list[i].size = 0;
        }
        
        cin >> m;
        for (i = 0; i < m; i++){
            cin >> key;
            for (j = 0; j < n; j++){
                if (key==list[j].name){
                    look = j;
                }
            }
            cin >> kk;
            list[look].size = kk;
            for (j = 0; j < kk; j++){
                cin >> temp;
                for (k = 0; k < n; k++){
                    if (temp==list[k].name){
                        list[look].used[j]=temp;
                    }
                }
            }
        }
        cin >> key;
        for (j = 0; j < n; j++){
            if (strcmp(key, list[j].name) == 0){
                look = j;
            }
        }
        
        cout << getCost(look);
        
    }
    
    return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:13: error: 'cin' was not declared in this scope
   57 |             cin >> list[i].name >> list[i].cost;
      |             ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <vector>
  +++ |+#include <iostream>
    5 | #include <algorithm>
a.cc:61:9: error: 'cin' was not declared in this scope
   61 |         cin >> m;
      |         ^~~
a.cc:61:9: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:82:17: error: 'strcmp' was not declared in this scope
   82 |             if (strcmp(key, list[j].name) == 0){
      |                 ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <vector>
  +++ |+#include <cstring>
    5 | #include <algorithm>
a.cc:87:9: error: 'cout' was not declared in this scope
   87 |         cout << getCost(look);
      |         ^~~~
a.cc:87:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: Java


public class Main {

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

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int MAX = 1000000;
		boolean[] prime = new boolean[MAX + 1];
		for (int i = 2; i <= MAX; i++) {
			if (!prime[i]) {
				for (int j = i * 2; j <= MAX; j += i) {
					prime[j] = true;
				}
			}
		}
		while (true) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			if ((n | m) == 0)
				break;
			int[] a = new int[n];
			int min = Integer.MAX_VALUE;
			boolean[] f = new boolean[m + 1];
			f[0] = true;
			for (int i = 0; i < n; i++) {
				int s = scanner.nextInt();
				min = Math.min(s, min);
				a[i] = s;
				for (int j = s * 2; j <= m; j += s) {
					f[j] = true;
				}
			}
			int max = 0;
			for (int i = min; i <= m; i++) {
				if (f[i])
					continue;
				for (int j = 0; j < n; j++) {
					if (i - a[j] >= 0 && f[i - a[j]]) {
						f[i] = true;
						break;
					}
				}
				if (f[i] && !prime[i])
					max = i;
			}
			System.out.println(max == 0 ? "NA" : max);

		}

	}
}

Compiler output:
Main.java:4: error: cannot find symbol
	public static void main(String[] args) throws IOException {
	                                              ^
  symbol:   class IOException
  location: class Main
Main.java:8: error: cannot find symbol
	private void run() throws IOException {
	                          ^
  symbol:   class IOException
  location: class Main
Main.java:9: error: cannot find symbol
		Scanner scanner = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:9: error: cannot find symbol
		Scanner scanner = new Scanner(System.in);
		                      ^
  symbol:   class Scanner
  location: class Main
4 errors
Language: Java

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

public class A0202 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int prime[] = new int[1000010];

		Arrays.fill(prime, 1);
		prime[0] = 0;
		prime[1] = 0;
		for (int i = 2; i < 1000010; i++) {
			for (int j = i * 2; j < 1000010; j += i) {
				prime[j] = 0;
			}
		}

		while (true) {
			int n = sc.nextInt();
			int cost = sc.nextInt();
			if ((n | cost) == 0) {
				break;
			}
			int price[] = new int[n];
			int array[] = new int[cost + 1];
			for (int i = 0; i < n; i++) {
				price[i] = sc.nextInt();
				array[price[i]] = 1;
			}

			int id = 0;
			while (id < cost + 1) {
				while (id < cost + 1 && array[id] == 0) {
					id++;
				}
				if (cost + 1 <= id) {
					break;
				}
				for (int i = 0; i < n; i++) {
					if (id + price[i] < cost + 1) {
						array[id + price[i]] = 1;
					}
				}
				id++;
			}
			boolean flag = false;
			for (int i = cost; 0 <= i; i--) {
				if (array[i] == 1 && prime[i] == 1) {
					System.out.println(i);
					flag = true;
				}
				if (flag) {
					break;
				}
			}

			if (!flag) {
				System.out.println("NA");
			}
		}
	}
}

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

import java.util.Scanner;

public class AtBossExpense {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		//素数のメモ作成
		int size = 1000001;
		boolean[] prime = new boolean[size];
		for(int i=2; i<size; i++){
			prime[i] = true;
		}
		for(int i=2; i*i<size; i++){
			if(prime[i]){
				for(int j=i*i; j<size; j+=i){
					prime[j] = false;
				}
			}
		}
		
		while(true){
			int set = sc.nextInt();//料理の種類
			limit = sc.nextInt();//予算上限
			if((set | limit)==0) break;
			
			int[] food = new int[set];//料理の値段
			for(int i=0; i<set; i++){
				food[i] = sc.nextInt();
			}
			//公約数チェック
			int yaku = food[0];
			for(int i=1; i<set; i++){
				yaku = ch(food[i], yaku);
				if(yaku==1){
					break;
				}
			}//2以上の公約数を持つ場合、素数を作れない
			if(yaku>1){
				System.out.println("NA");
				continue;
			}
			
			//組み合わせで選ぶことのできる価格をtrue
			memo = new boolean[limit+1];
			memo[0] = true;
			for(int i=0; i<set; i++){
				fx(food[i]);
			}
			//素数の最大金額を選択
			int ans =0;
			for(int i=limit; 0<i; i--){
				if(prime[i] && memo[i]){
					ans = i;
					break;
				}
			}
			System.out.println((ans>0)?ans:"NA");
		}
	}
	static int limit;
	static boolean[] memo;
	//公約数を求める式
	static int ch(int x, int y){
		
		x %= y;
		if(x>0) return ch(y,x);
		else return y;
	}
	//料理の組み合わせで選べる金額をtrue
	static void fx(int x){
		
		for(int j=0; j+x<=limit; j++){
			if(memo[j]==true){
				memo[j+x] = true;
			}
		}
	}
}

Compiler output:
Main.java:3: error: class AtBossExpense is public, should be declared in a file named AtBossExpense.java
public class AtBossExpense {
       ^
1 error