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

#define ll long long
#define MAX 10000

#include <vector>
#include <algorithm>
#include <queue>

using namespace std;
static const int INF = (1 << 21);

int n;
priority_queue<pair<int,int>> PQ;
vector<pair<int, int>> adj[MAX];
int color[MAX];
int d[MAX];

void dj(int s){
	for (int i = 0;i < n;i++) {
		d[i]=INF;
		color[i] = 0;
	}
	
	d[s] = 0;
	PQ.push(make_pair(0, 0));
	color[0] = 1;

	while (!PQ.empty()) {
		pair<int, int> f = PQ.top(); 
		PQ.pop();
		int u = f.second;
		color[u] = 2;

		if (d[u] < f.first*(-1)) continue;

		for(int j=0;j<adj[u].size();j++){
			int v = adj[u][j].first;
			if (color[v] == 2) continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v] * (-1), v));
				color[v] = 1;
			}
		}
	}

	for (int i = 0;i < n;i++) {
		cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
	}

}

int main() {
	cin >> n;
	for (int i = 0;i < n;i++) {
		int u, k;
		cin >> u >> k;
		for (int j = 0;j < k;j++) {
			int v, c;
			cin >> v >> c;
			adj[u].push_back(make_pair(v,c));
		}
	}

	dj(0);

}

Compiler output:
a.cc: In function 'void dj(int)':
a.cc:47:17: error: 'cout' was not declared in this scope
   47 |                 cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
      |                 ^~~~
a.cc:7:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    6 | #include <queue>
  +++ |+#include <iostream>
    7 | 
a.cc:47:66: error: 'endl' was not declared in this scope
   47 |                 cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
      |                                                                  ^~~~
a.cc:7:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    6 | #include <queue>
  +++ |+#include <ostream>
    7 | 
a.cc: In function 'int main()':
a.cc:53:9: error: 'cin' was not declared in this scope
   53 |         cin >> n;
      |         ^~~
a.cc:53:9: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#define ll long long
#define MAX 10000

#inlude <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;
static const int INF = (1 << 21);

int n;
priority_queue<pair<int,int>> PQ;
vector<pair<int, int>> adj[MAX];
int color[MAX];
int d[MAX];

void dj(int s){
	for (int i = 0;i < n;i++) {
		d[i]=INF;
		color[i] = 0;
	}
	
	d[s] = 0;
	PQ.push(make_pair(0, 0));
	color[0] = 1;

	while (!PQ.empty()) {
		pair<int, int> f = PQ.top(); 
		PQ.pop();
		int u = f.second;
		color[u] = 2;

		if (d[u] < f.first*(-1)) continue;

		for(int j=0;j<adj[u].size();j++){
			int v = adj[u][j].first;
			if (color[v] == 2) continue;
			if (d[v] > d[u] + adj[u][j].second) {
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v] * (-1), v));
				color[v] = 1;
			}
		}
	}

	for (int i = 0;i < n;i++) {
		cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
	}

}

int main() {
	cin >> n;
	for (int i = 0;i < n;i++) {
		int u, k;
		cin >> u >> k;
		for (int j = 0;j < k;j++) {
			int v, c;
			cin >> v >> c;
			adj[u].push_back(make_pair(v,c));
		}
	}

	dj(0);

}

Compiler output:
a.cc:4:2: error: invalid preprocessing directive #inlude; did you mean #include?
    4 | #inlude <iostream>
      |  ^~~~~~
      |  include
a.cc: In function 'void dj(int)':
a.cc:48:17: error: 'cout' was not declared in this scope
   48 |                 cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
      |                 ^~~~
a.cc:8:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 | #include <queue>
  +++ |+#include <iostream>
    8 | 
a.cc:48:66: error: 'endl' was not declared in this scope
   48 |                 cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
      |                                                                  ^~~~
a.cc:8:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    7 | #include <queue>
  +++ |+#include <ostream>
    8 | 
a.cc: In function 'int main()':
a.cc:54:9: error: 'cin' was not declared in this scope
   54 |         cin >> n;
      |         ^~~
a.cc:54:9: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

class Node
{
private:
	list<int> next_node_list;
	list<int> next_weight_list;
public:
	Node();
	void AddNextNode(int id, int weight);
	void SetWeight(long weight);
	void DistributeWeight();
	long weight_from_0;
	bool check;
};

Node::Node()
{
	weight_from_0 = -1;
	check = false;
}

Node *Node_list;

struct GreatNode
{
	bool operator()(const Node *n1, const Node *n2) const;
};
bool GreatNode::operator()(const Node *n1, const Node *n2) const
{
	return n1->weight_from_0 > n2->weight_from_0;
}
priority_queue<Node*, vector<Node*>, GreatNode > que;

void Node::AddNextNode(int id, long weight)
{
	next_node_list.push_back(id);
	next_weight_list.push_back(weight);
}

void Node::SetWeight(int weight)
{
	if (weight_from_0 == -1 || weight < weight_from_0) {
		weight_from_0 = weight;
	}
}

void Node::DistributeWeight()
{
	check = true;
	list<int>::iterator itr2 = next_weight_list.begin();
	for(list<int>::iterator itr = next_node_list.begin(); itr != next_node_list.end(); itr++){	
		if (Node_list[*itr].check == false) {
			Node_list[*itr].SetWeight(weight_from_0 + *itr2);
			que.push(&Node_list[*itr]);
		}
		itr2++;
	}
	next_node_list.clear();
	next_weight_list.clear();
}

int main(void)
{
	//input
	int n;
	cin >> n;
	Node_list = new Node[n]();
	for (int i = 0; i < n; i++) {
		int u, k;
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			int v, c;
			cin >> v >> c;
			Node_list[i].AddNextNode(v, c);
		}
	}

	//weight from 0 ?
	Node_list[0].check = true;
	Node_list[0].weight_from_0 = 0;
	Node_list[0].DistributeWeight();
	while (!que.empty()) {
		Node *node = que.top();
		que.pop();
		node->DistributeWeight();
	}

	//output
	for (int i = 0; i < n; i++) {
		cout << i << " " << Node_list[i].weight_from_0 << endl;
	}
	
	return 0;
}


Compiler output:
a.cc:39:6: error: no declaration matches 'void Node::AddNextNode(int, long int)'
   39 | void Node::AddNextNode(int id, long weight)
      |      ^~~~
a.cc:14:14: note: candidate is: 'void Node::AddNextNode(int, int)'
   14 |         void AddNextNode(int id, int weight);
      |              ^~~~~~~~~~~
a.cc:7:7: note: 'class Node' defined here
    7 | class Node
      |       ^~~~
a.cc:45:6: error: no declaration matches 'void Node::SetWeight(int)'
   45 | void Node::SetWeight(int weight)
      |      ^~~~
a.cc:15:14: note: candidate is: 'void Node::SetWeight(long int)'
   15 |         void SetWeight(long weight);
      |              ^~~~~~~~~
a.cc:7:7: note: 'class Node' defined here
    7 | class Node
      |       ^~~~
Language: C++


import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner in = new Scanner(System.in);

		int u = in.nextInt();
		int[][] mat = new int[u][u];
		for (int i = 0; i < u; i++) {
			Arrays.fill(mat[i], -1);
		}
		for (int i = 0; i < u; i++) {
			int fromNode = in.nextInt();
			int toNodeCount = in.nextInt();
			for (int j = 0; j < toNodeCount; j++) {
				int toNode = in.nextInt();
				int edgeWeight = in.nextInt();
				mat[fromNode][toNode] = edgeWeight;
			}
		}

		// solve
		Set<Integer> x = new HashSet<>();
		Set<Integer> y = new HashSet<>();
		boolean[] visit = new boolean[u];
		for (int i = 1; i < u; i++) {
			y.add(i);
		}
		int[] nodeCost = new int[u];
		Arrays.fill(nodeCost, Integer.MAX_VALUE);
		x.add(0);
		nodeCost[0] = 0;
		visit[0] = true;

		while (!y.isEmpty()) {
			int min = Integer.MAX_VALUE;
			int v = -1;
			for (int from : x) {
				for (int to = 0; to < u; to++) {
					int visitCost = mat[from][to] + nodeCost[from];
					// toのノードが最小コストで訪問済でない場合
					if (mat[from][to] != -1 && !visit[to] && visitCost <= nodeCost[to]) {
						nodeCost[to] = visitCost;
						if (nodeCost[to] < min) {
							min = nodeCost[to];
							v = to;
						}
					}
				}
			}
			x.add(v);
			y.remove(v);
			visit[v] = true;
		}

		for (int i = 0; i < u; i++) {
			System.out.println(i + " " + nodeCost[i]);
		}
	}

}



Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.IOException;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Arrays;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.HashSet;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Scanner;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.Set;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
    8 | public class Main {
      | ^~~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <climits>
#include <queue>
#include <map>
using namespace std;

typedef map<int, int>::iterator mitr;

map<int, int> w[100];
int d[100];
char pos[100];

priority_queue<pair<int,int> > others;
pair<int,int> p;

void findPath(){
    p = others.top();
    others.pop();
    while(pos[p.second]){
        p = others.top();
        others.pop();
    }
    pos[p.second]=1;

    int tmpu = p.second;
    int tmpd = -p.first;

    for(mitr i=w[tmpu].begin();i!=w[tmpu].end();i++){
        if(tmpd + i->second < d[i->first]){
            d[i->first] = tmpd + i->second;
            others.push(make_pair(-d[i->first],i->first));
        }
    }
}

int main(){
    int i,j,u,k,n,v,c;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d",&u,&k);
        for(j=0;j<k;j++){
            scanf("%d %d",&v,&c);
            w[u][v] = c;
        }
    }

    memset(pos,0,sizeof(char)*100);
    for(i=0;i<n;i++)d[i]=INT_MAX;
    d[0] = 0;
    others.push(make_pair(0,0));
    for(i=0;i<n;i++)findPath();
    for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);

    return 0;
}



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

import queue


class Edge:
    def __init__(self, from_v, to_v, cost):
        self.from_v = from_v
        self.to_v = to_v
        self.cost = cost

    def __lt__(self, other):
        return self.cost < other.cost

    def get_from_v(self):
        return self.from_v

    def get_to_v(self):
        return self.to_v

    def get_cost(self):
        return self.cost


class Vertex:
    def __init__(self, cost, id):
        self.cost = cost
        self.id = id

    def __lt__(self, other):
        return self.cost < other.cost

    def get_cost(self):
        return self.cost

    def get_id(self):
        return self.id


class Dijkstra:
    def __init__(self, number_of_vertex):
        # self.edges = []
        self.graf = [[] for _ in range(number_of_vertex)]
        self.number_of_vertex = number_of_vertex
        self.distance = []  # 最短距離
        self.INF = 1145141919810

    def add_edge(self, from_v, to_v, cost):
        # self.edges.append(Edge(from_v, to_v, cost))
        self.graf[from_v].append(Edge(from_v, to_v, cost))

    def compute_shortest_distance(self, start):
        self.distance = [self.INF] * self.number_of_vertex
        self.distance[start] = 0
        que = queue.PriorityQueue()

        que.put(Vertex(0, start))

        while not que.empty():
            top = que.get()
            cost = top.get_cost()
            id = top.get_id()
            if self.distance[id] < cost: continue
            for a_edge in self.graf[id]:
                to_v = a_edge.get_to_v()
                from_v = a_edge.get_from_v()
                prev_cost = self.distance[from_v]
                next_cost = self.distance[to_v]
                if next_cost > prev_cost + a_edge.get_cost():
                    next_cost = prev_cost + a_edge.get_cost()
                    self.distance[to_v] = next_cost
                    que.put(Vertex(next_cost, to_v))


n = int(input())
dij = Dijkstra(n)

for i in range(n):
    tmp = list(map(int, input().split()))
    u = tmp[0]
    k = tmp[1]
    vc = tmp[2:]
    for j in range(k):
        dij.add_edge(u, vc[2 * j], vc[2 * j + 1])

dij.compute_shortest_distance(0)

for i in range(n):
    print(str(i) + " " + str(dij.distance[i]))



Compiler output:
a.cc:40:11: error: invalid preprocessing directive #self
   40 |         # self.edges = []
      |           ^~~~
a.cc:43:29: error: stray '#' in program
   43 |         self.distance = []  # 最短距離
      |                             ^
a.cc:47:11: error: invalid preprocessing directive #self
   47 |         # self.edges.append(Edge(from_v, to_v, cost))
      |           ^~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import queue
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<utility>
#include<limits>
using namespace std;
typedef pair<int, int> Edge;
int main()
{
	int n; cin >> n;
	vector< vector< Edge > > lists;

	for (int i = 0; i < n; i++)
	{
		vector<Edge> list;
		int u, k;
		cin >> u >> k;
		for (int j = 0; j < k; j++)
		{
			Edge edge;
			cin >> edge.second >> edge.first;
			list.push_back(edge);
		}
		lists.push_back(list);
	}

	vector<int> costs(n, INT32_MAX);
	costs[0] = 0;
	priority_queue<Edge> queue;
	for (Edge edge : lists[0])
		queue.push(edge);

	while (!queue.empty())
	{
		Edge edge = queue.top(); queue.pop();
		int dest = edge.second;
		int cost = edge.first;
		if (costs[dest] < cost)continue;
		int new_cost = costs[edge.second] = edge.first;

		for (Edge next : lists[dest])
		{
			next.first += new_cost;
			queue.push(next);
		}
	}
	for (int i = 0; i < n; i++)
		cout << i << " " << costs[i] << endl;

	char c;
	cin >> c;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:30: error: 'INT32_MAX' was not declared in this scope
   28 |         vector<int> costs(n, INT32_MAX);
      |                              ^~~~~~~~~
a.cc:7:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    6 | #include<limits>
  +++ |+#include <cstdint>
    7 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<utility>
#include<limits>
using namespace std;
typedef pair<int, int> Edge;
int main()
{
	int n; cin >> n;
	vector< vector< Edge > > lists;

	for (int i = 0; i < n; i++)
	{
		vector<Edge> list;
		int u, k;
		cin >> u >> k;
		for (int j = 0; j < k; j++)
		{
			Edge edge;
			cin >> edge.second >> edge.first;
			list.push_back(edge);
		}
		lists.push_back(list);
	}

	vector<int> costs(n, INT32_MAX);
	costs[0] = 0;
	priority_queue<Edge> queue;
	for (Edge edge : lists[0])
		queue.push(edge);

	while (!queue.empty())
	{
		Edge edge = queue.top(); queue.pop();
		int dest = edge.second;
		int cost = edge.first;
		if (costs[dest] < cost)continue;
		int new_cost = costs[edge.second] = edge.first;

		for (Edge next : lists[dest])
		{
			next.first += new_cost;
			if(costs[next.second]==INT_MAX)
				queue.push(next);
		}
	}
	for (int i = 0; i < n; i++)
		cout << i << " " << costs[i] << endl;

	char c;
	cin >> c;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:30: error: 'INT32_MAX' was not declared in this scope
   28 |         vector<int> costs(n, INT32_MAX);
      |                              ^~~~~~~~~
a.cc:7:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    6 | #include<limits>
  +++ |+#include <cstdint>
    7 | using namespace std;
a.cc:45:48: error: 'INT_MAX' was not declared in this scope
   45 |                         if(costs[next.second]==INT_MAX)
      |                                                ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<limits>
  +++ |+#include <climits>
    7 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

static const int MAX = 10000;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;


int n;
vector<pair<int, int> > adj[MAX]

void dijkstra() {
  priority_queue<pair<int, int> > PQ;
  int color [MAX];
  int d[MAX];

  for (int i = 0; i < n; i++) {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  PQ.push(make_pair(0, 0));
  color[0] = GRAY;

  while (!PQ.empty()) {
    pair<int, int> f = PQ.top(); PQ.pop();
    int u = f.second;

    color[u] = BLACK;

    for (int j = 0; j < adj[u].size(); j++) {
      int v = adj[u][j].first;
      if (color[v] == BLACK) {
        continue;
      }
      if (d[v] > d[u] + adj[u][j].second) {
        d[v] = d[u] + adj[u][j].second;
        PQ.push(make_pair(d[v] * (-1), v));
        color[v] = GRAY;
      }
    }

  for (int i = 0; i < n; i++) {
    cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
  }
}

int main() {
  cin >> n;

  int k, u, v, c;;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v >> c;
      adj[u].push_back(make_pair(v, c));
    }
  }

  dijkstra();

  return 0;
}


Compiler output:
a.cc:17:1: error: expected initializer before 'void'
   17 | void dijkstra() {
      | ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

static const int MAX = 10000;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int> > adj[MAX];

void dijkstra() {
  priority_queue<pair<int, int> > PQ;
  int color [MAX];
  int d[MAX];

  for (int i = 0; i < n; i++) {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  PQ.push(make_pair(0, 0));
  color[0] = GRAY;

  while (!PQ.empty()) {
    pair<int, int> f = PQ.top(); PQ.pop();
    int u = f.second;

    color[u] = BLACK;

    for (int j = 0; j < adj[u].size(); j++) {
      int v = adj[u][j].first;
      if (color[v] == BLACK) {
        continue;
      }
      if (d[v] > d[u] + adj[u][j].second) {
        d[v] = d[u] + adj[u][j].second;
        PQ.push(make_pair(d[v] * (-1), v));
        color[v] = GRAY;
      }
    }

  for (int i = 0; i < n; i++) {
    cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
  }
}

int main() {
  cin >> n;

  int k, u, v, c;;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v >> c;
      adj[u].push_back(make_pair(v, c));
    }
  }

  dijkstra();

  return 0;
}




Compiler output:
a.cc: In function 'void dijkstra()':
a.cc:53:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   53 | int main() {
      |         ^~
a.cc:53:9: note: remove parentheses to default-initialize a variable
   53 | int main() {
      |         ^~
      |         --
a.cc:53:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:53:12: error: a function-definition is not allowed here before '{' token
   53 | int main() {
      |            ^
a.cc:68:2: error: expected '}' at end of input
   68 | }
      |  ^
a.cc:16:17: note: to match this '{'
   16 | void dijkstra() {
      |                 ^
Language: C++

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

static const int MAX = 10000;
static const int INF = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int,int>> adj[MAX];

void dijkstra(){
    int color[MAX], d[MAX];

    for(int i = 0; i < n; i++){
        color[i] = WHITE;
        d[i] = INF;
    }

    d[0] = 0;

    // pair<vに到達するまでのスコア、v>
    priority_queue<pair<int,int>> pq;
    pq.push({0,0});

    while(!pq.empty()){
        pair<int,int> p = pq.top(); pq.pop();
        int u = p.second;
        
        color[u] = BLACK;
        if(d[u] < p.first*(-1)) continue;

        for(int j = 0; j < adj[u].size(); j++){
            int v = adj[u][j].first;
            if(color[v] == BLACK)   continue;
            if(d[v] > d[u] + adj[u][v].second){
                d[v] = d[u] + adj[u][v].second;
                pq.push((-1)*d[v], v);
                color[v] = GRAY;
            }
        }
    }

    for(int i = 0; i < n; i++){
        cout << i << " " << d[i] << endl;
    }
}

int main(){
   int u, k, v, c;

   cin >> n;
   for(int i = 0; i < n; i++){
       cin >> u >> k;
       for(int j = 0; j < k; j++){
           cin >> v >> c;
           adj[u].push_back({v,c});
       }
   }

   dijkstra();

   return 0;
}


Compiler output:
a.cc: In function 'void dijkstra()':
a.cc:41:24: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(int, int&)'
   41 |                 pq.push((-1)*d[v], v);
      |                 ~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; value_type = std::pair<int, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; value_type = std::pair<int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 2 provided
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1<<20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK= 2;

int n;
vector<pair<int, int> > adj[MAX]; // 重み付き有向グラフの隣接リスト表現

void dijkstra() {
    priority_queue<pair<int, int> > PQ;
    int color[MAX];
    int d[MAX];
    for (int i=0; i<n; i++) {
        d[i] = INFTY;
        color[i] = WHITE;
    }
    
    d[0] = 0;
    PQ.push(make_pair(0, 0));
    color[0] = GRAY;
    
    while ( !PQ.empty() ) {
        pair<int, int> f = PQ.top(); PQ.pop();
        int u = f.second;
        
        color[u] = BLACK;
        
        // 最小値を取り出し、それが最短でなければ無視
        if (d[u] < f.first * (-1)) continue;
        
        for (int j=0; j<adj[u].size(); j++) {
            int v = adj[u][j].first;
            if (color[v] == BLACK) continue;
            if (d[v] > d[u] + adj[u][j].second) {
                d[v] =  d[u] + adj[u][j].second
                // priority_queueはデフォルトで大きい値を優先するため-1をかける
                PQ.push(make_pair(d[v]*(-1), v));
                color[v] = GRAY;
            }
        }
    }
    
    for (int i=0; i<n; i++) {
        printf("%d %d\n", i, d[i]);
    }
}

int main() {
    int k, u, v, c;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        scanf("%d %d", &u, &k);
        for (int j=0; j<k; j++) {
            scanf("%d %d", &v, &c);
            adj[u].push_back(make_pair(v, c));
        }
    }
    
    dijkstra();
    
    return 0;
}


Compiler output:
a.cc: In function 'void dijkstra()':
a.cc:40:48: error: expected ';' before 'PQ'
   40 |                 d[v] =  d[u] + adj[u][j].second
      |                                                ^
      |                                                ;
   41 |                 // priority_queueはデフォルトで大きい値を優先するため-1をかける
   42 |                 PQ.push(make_pair(d[v]*(-1), v));
      |                 ~~
Language: C++

#include<iostream>
#include<cstdio>
#include<climits>
using namespace std;
  
#define N 10001
int n;
  
int g[N][N];
  
int weight[N];
bool us[N];
  
//prim
void prim(){
  
  int v;
   
  weight[0]=0;
    
  while(true){
    v=-1;
     
    for(int i=0;i<n;i++){
      if(us[i]!=true && (v==-1 ||weight[i]<weight[v]))v=i;
    }
  
    if(v==-1)break;
    us[v]=true;
   
  
    for(int i=0;i<n;i++){
      if(weight[i]>(g[v][i]+weight[v])){
  
        weight[i]=(g[v][i]+weight[v]);
        //      cout <<"fsafa"<<endl;
      }
    }
  }
   
}
  
  
int main(){
  
  int u,k1,c,v;
  
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      g[i][j]=9953535;
    }
  }
  
  //load n
  cin >>n;
  
  //load data
  for(int i=0;i<n;i++){
    weight[i]=INT_MAX;
    us[i]=false;
    scanf("%d %d",&u,&k1);
    for(int j=0;j<k1;j++){
      scanf("%d %d",&v,&c);
      g[u][v]=c;
      //    cout <<g[i][j]<<" ";
    }
    //    cout <<endl;
  }
  
  
  
  
  //print
  prim();
  
  for(int i=0;i<n;i++){
    cout <<i<<" "<<weight[i]<<endl;
  }
delete g[][];
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:10: error: expected primary-expression before ']' token
   79 | delete g[][];
      |          ^
a.cc:79:12: error: expected primary-expression before ']' token
   79 | delete g[][];
      |            ^
Language: C++

#include<iostream>
#include<cstdio>
#include<climits>
using namespace std;
  
#define N 10001
int n;
  
int g[N][N];
  
int weight[N];
bool us[N];
  
//prim
void prim(){
  
  int v;
   
  weight[0]=0;
    
  while(true){
    v=-1;
     
    for(int i=0;i<n;i++){
      if(us[i]!=true && (v==-1 ||weight[i]<weight[v]))v=i;
    }
  
    if(v==-1)break;
    us[v]=true;
   
  
    for(int i=0;i<n;i++){
      if(weight[i]>(g[v][i]+weight[v])){
  
        weight[i]=(g[v][i]+weight[v]);
        //      cout <<"fsafa"<<endl;
      }
    }
  }
   
}
  
  
int main(){
  
  int u,k1,c,v;
  
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      g[i][j]=9953535;
    }
  }
  
  //load n
  cin >>n;
  
  //load data
  for(int i=0;i<n;i++){
    weight[i]=INT_MAX;
    us[i]=false;
    scanf("%d %d",&u,&k1);
    for(int j=0;j<k1;j++){
      scanf("%d %d",&v,&c);
      g[u][v]=c;
      //    cout <<g[i][j]<<" ";
    }
    //    cout <<endl;
  }
  
  
  
  
  //print
  prim();
  
  for(int i=0;i<n;i++){
    cout <<i<<" "<<weight[i]<<endl;
  }
delete g[];
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:10: error: expected primary-expression before ']' token
   79 | delete g[];
      |          ^
Language: C++

#include<iostream>
#include<vector>
#include<queue>
#include <bitset>
using namespace std;
template< typename FirstType, typename SecondType >
struct PairComparator {
  bool operator()( const pair<FirstType, SecondType>& p1, const pair<FirstType, SecondType>& p2 ) const 
    {  
		return p1.first > p2.first;
    }
};
bool inMST(vector< std::pair<int,int> > & MST,int j) {
	for (int k=0;k<(int)MST.size();++k){
		if(j == MST[k].second)
			return true;
	}
	return false;
}
int main(){
	int n;
	cin >> n;
	//vector<int> E(n*n,-1);
	vector<vector<pair<int,int> > > edge(n);
	vector<int> DPG(n,-1);
	vector< std::pair<int,int> > MST;
	std::bitset<10000> flg;

	{
		for(int j=0;j<n;++j) {
			int u,k; 
			cin >> u >> k;
			edge[u].resize(k);
			for(int i=0;i<k;++i){
				int v,c;
				cin >> v >> c;
				edge[u][i] = make_pair(v,c);
			}
		}
	}
	priority_queue<pair<int,pair<int,int> >,vector< pair<int,pair<int,int> > >,
		PairComparator<int,pair<int,int> > > r;

	int cost = 0;
	int i=0;
	MST.push_back(pair<int,int>(i,i));
	flg.set(i);
	DPG[i] = 0;
	while((int)MST.size() < n) {
		int ii=i*n;
//		for (int j=0;j<n;++j) 
		for (int p=0;p<(int)edge[i].size();++p)
		{
			pair<int,int> add = std::make_pair(i,edge[i][p].first);
//			if (!inMST(MST,add.second))
			if (!flg.test(edge[i][p].first))
			{
				r.push(std::pair<int,std::pair<int,int> >(edge[i][p].second+DPG[i],add));
			}
		}
		pair<int,pair<int,int> > top;
		while (!r.empty()) {
			top = r.top();
			r.pop();
//			if (!inMST(MST,top.second.second))
			if (!flg.test(top.second.second))
			{
				break;
			}
		}
		cost += top.first;
		MST.push_back(top.second);
		flg.set(top.second.second);
		i = top.second.second;
		if (DPG[top.second.first] < 0){
			::_DEBUG_ERROR("invalid");
		}
		DPG[i] = top.first;
//		for(int j=0;j<n;++j)
		for (int p=0;p<(int)edge[i].size();++p)
		{
			int j = edge[i][p].first;
			if (DPG[j] < 0)continue;
			DPG[j] = std::min(DPG[j],DPG[i] + edge[i][p].second);
		}
	}
	for (int j=0;j<n;++j) {
		cout << j << " " <<  DPG[j] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:27: error: '::_DEBUG_ERROR' has not been declared
   76 |                         ::_DEBUG_ERROR("invalid");
      |                           ^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef unsigned short ushort;
typedef vector <int> vi;
typedef vector <vi> vvi;

class blanch{
	public:
		bool visited;
		int distance;
		ushort from;
};
typedef vector <blanch> vb;

int make_graph(vvi &graph, vb &nodes){
	int n=graph.size();
	for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
			graph[i][j]=-1;
		}
		nodes[i].visited = false;
		nodes[i].distance = INT_MAX;
	}

	for (int i=0; i<n; i++){
		int i2,n2;
		cin>>i2;
		cin>>n2;
		for (int j=0; j<n2; j++){
			int j2;
			cin>>j2;
			cin>>graph[i2][j2];
		}
	}
	return 0;
}

int Shortest_Path(vvi &graph, vb &nodes){

	int n = graph.size(), p1=0;
	nodes[p1].distance = 0;

	while (p1 != -1){
		nodes[p1].visited=true;
		cout<<"node: "<<p1<<", distance: "<<nodes[p1].distance<<endl;
		for (int p2 = 0; p2 < n; p2++){
			int *tmp = &graph[p1][p2];
			if (*tmp!=-1 && nodes[p2].visited==false){
				int tmp2 = *tmp + nodes[p1].distance;
				if (tmp2 < nodes[p2].distance){
					nodes[p2].distance = tmp2;
					nodes[p2].from = p1;
				}
			}
		}

		p1 = -1;
		int tmp;
		tmp = INT_MAX;
		for (int i=0; i<n; i++){
			if (nodes[i].visited==false && nodes[i].distance<tmp){
				p1 = i;
				tmp = nodes[i].distance;
			}
		}
	}
	return 0;
}

int resultout(vb &nodes){
	int n = nodes.size();
	for (int i=0; i<n; i++){
		cout<<i<<" "<<nodes[i].distance<<endl;
	}
	return 0;
}

int main(void){

	int n;
	cin>>n;
	vvi G(n, vi(n));
	vb nodes(n);

	make_graph(G, nodes);

	Shortest_Path(G, nodes);

	resultout(nodes);

	return 0;
} 

Compiler output:
a.cc: In function 'int make_graph(vvi&, vb&)':
a.cc:23:37: error: 'INT_MAX' was not declared in this scope
   23 |                 nodes[i].distance = INT_MAX;
      |                                     ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
a.cc: In function 'int Shortest_Path(vvi&, vb&)':
a.cc:60:23: error: 'INT_MAX' was not declared in this scope
   60 |                 tmp = INT_MAX;
      |                       ^~~~~~~
a.cc:60:23: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef unsigned short ushort;

class blanch{
	public:
		bool visited;
		int distance;
		ushort from;
		ushort to;
};
typedef vector <blanch> vb;
typedef vector <vb> vvb;

int make_graph(vvb &graph, vb &nodes){

	int n=nodes.size();
	for (ushort i=0; i<n; i++){
		nodes[i].visited = false;
		nodes[i].distance = INT_MAX;
	}

	for (ushort i=0; i<n; i++){
		int i2, n2;
		cin>>i2;
		cin>>n2;

		blanch bl0;
		bl0.visited = false;
		bl0.from = i2;

		for (ushort j=0; j<n2; j++){
			ushort j2;
			cin>>bl0.to;
			cin>>bl0.distance;

			graph[i2].push_back(bl0);
		}
	}
	return 0;
}

int Shortest_Path(vvb &graph, vb &nodes){

	int n = graph.size(), p1=0;
	nodes[p1].distance = 0;
	int p2;
	while (p1 != -1){
		nodes[p1].visited=true;
		for (int i = 0; i < (int)graph[p1].size(); i++){
			blanch tmp = graph[p1][i];
			p2=tmp.to;
			if (nodes[p2].visited==false){
				int tmp2 = tmp.distance + nodes[p1].distance;
				if (tmp2 < nodes[p2].distance){
					tmp.distance = tmp2;
					nodes[p2] = tmp;
				}
			}
		}
		p1 = -1;
		int tmp;
		tmp = INT_MAX;
		for (int i=0; i<n; i++){
			if (nodes[i].visited==false && nodes[i].distance<tmp){
				p1 = i;
				tmp = nodes[i].distance;
			}
		}
	}
	return 0;
}

int resultout(vb &nodes){
	int n = nodes.size();
	for (int i=0; i<n; i++){
		cout<<i<<" "<<nodes[i].distance<<endl;
	}
	return 0;
}

int main(void){

	int n;
	cin>>n;
	vvb G(n, vb());
	vb nodes(n);

	make_graph(G, nodes);

	Shortest_Path(G, nodes);

	resultout(nodes);
	G.clear();
	nodes.clear();

	return 0;
} 

Compiler output:
a.cc: In function 'int make_graph(vvb&, vb&)':
a.cc:21:37: error: 'INT_MAX' was not declared in this scope
   21 |                 nodes[i].distance = INT_MAX;
      |                                     ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
a.cc: In function 'int Shortest_Path(vvb&, vb&)':
a.cc:64:23: error: 'INT_MAX' was not declared in this scope
   64 |                 tmp = INT_MAX;
      |                       ^~~~~~~
a.cc:64:23: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: Java

package kadai1.prog1.main;

import java.util.Scanner;

public class Prog006 {
	public static final int N=8;
	public static final int free=-1;
	public static final int not_free=1;

	static int row[]=new int [N];
	static int col[]=new int [N];
	static int dpos[]=new int [2*N-1];
	static int dneg[]=new int [2*N-1];
	static boolean x[][]=new boolean [N][N];

	public static void initialize(){
		for(int i=0;i<N;i++){
			row[i]=free;
			col[i]=free;
		}
		for(int i=0;i<2*N-1;i++){
			dpos[i]=free;
			dneg[i]=free;
		}
	}
	public static void print(){
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				System.out.print((row[i]==j)?"Q":".");
			}
			System.out.println();
		}
	}
	public static void solve(int i){
		if(i==N){
			print();
			return;
		}
		for(int j=0;j<N;j++){
			if(col[j]==not_free || dpos[i+j]==not_free || dneg[i-j+N-1]==not_free){
				continue;
			}
			row[i]=j;
			col[i]=not_free;
			dpos[i]=not_free;
			dneg[i]=not_free;
			solve(i+1);
			row[i]=free;
			col[i]=free;
			dpos[i]=free;
			dneg[i]=free;
		}
	}
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		initialize();
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				x[i][j]=false;
			}
		}
		int k=stdIn.nextInt();
		for(int i=0;i<k;i++){
			int r=stdIn.nextInt();
			int c=stdIn.nextInt();
			x[r][c]=true;
		}
		solve(0);
		return;
	}
}

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

import java.util.Scanner;

public class Prog006 {
	public static final int N=8;
	public static final int free=-1;
	public static final int not_free=1;

	static int row[]=new int [N];
	static int col[]=new int [N];
	static int dpos[]=new int [2*N-1];
	static int dneg[]=new int [2*N-1];
	static boolean x[][]=new boolean [N][N];

	public static void initialize(){
		for(int i=0;i<N;i++){
			row[i]=free;
			col[i]=free;
		}
		for(int i=0;i<2*N-1;i++){
			dpos[i]=free;
			dneg[i]=free;
		}
	}
	public static void print(){
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				if(x[i][j]){
					if(row[i]!=j){
						return;
					}
				}
			}
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				System.out.print(row[i]==j?"Q":".");
			}
			System.out.println();
		}
	}
	public static void solve(int i){
		if(i==N){
			print();
			return;
		}
		for(int j=0;j<N;j++){
			if(col[j]==not_free || dpos[i+j]==not_free || dneg[i-j+N-1]==not_free)
				continue;
			row[i]=j;
			col[i]=dpos[i]=dneg[i]=not_free;
			solve(i+1);
			row[i]=col[i]=dpos[i]=dneg[i]=free;
		}
	}
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		initialize();
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				x[i][j]=false;
			}
		}
		int k=stdIn.nextInt();
		for(int i=0;i<k;i++){
			int r=stdIn.nextInt();
			int c=stdIn.nextInt();
			x[r][c]=true;
		}
		solve(0);
	}
}

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

#include<stdio.h>
#define N 8
#define free -1
#define notfree 1
#define FALSE 2
#define TRUE 3

 int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
 int X[N][N];

 void initialize(void);
 void printbord(void);
 void recursive(int);

 int main(){
            int i,j,k,r,c;
            initialize();
            
            for(i=0;i<N;i++){
                             for(j=0;j<N;j++){
                                              X[i][j]=FALSE;
                                              }
                             }
            scanf("%d",&k);
            for(i=0;i<k;i++){
                             scanf("%d%d",&r,&c);
                             X[r][c]=TRUE;
                             }
            recrusive(0);

            return 0;
            }


 void initialize(){
                   int i;
                   for(i=0;i<N;i++){
                                    row[i]=free;
                                    col[i]=free;
                                    }

                   for(i=0;i<2*N-1;i++){
                                        dpos[i]=free;
                                        dneg[i]=free;
                                        }
                    }

 void printboard(){
                   int i,j;
                   for(i=0;i<N;i++){
                                    if(X[i][j]==TRUE){
                                                      if(row[i]!=j)return;
                                                      }


                   for(i=0;i<N;i++){
                                    for(j=0;j<N;j++){
                                                     if(row[i]==j)printf("Q");
                                                     else printf(".");
                                                     }
                                    printf("\n");
                                    }
                   }

 void recursive(int i){
                    int j;
                    if(i==N){
                             printboard();
                             return;
                             }
                    for(j=0;j<N;j++){
                      if(notfree==col[j]||notfree==dpos[i+j]||notfree==dneg[i-j+N-1])continue;
                      row[i]=j;
                      col[j]=dpos[i+j]=dneg[i-j+N-1]=notfree;
                      recursive(i+1);
                      row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=free;
                      }
                }





Compiler output:
main.c: In function 'main':
main.c:29:13: error: implicit declaration of function 'recrusive'; did you mean 'recursive'? [-Wimplicit-function-declaration]
   29 |             recrusive(0);
      |             ^~~~~~~~~
      |             recursive
main.c: In function 'printboard':
main.c:78:17: error: expected declaration or statement at end of input
   78 |                 }
      |                 ^
Language: C

#include<stdio.h>
#define N 8
#define free -1
#define notfree 1
#define FALSE 2
#define TRUE 3

 int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
 int X[N][N];

 void initialize(void);
 void printbord(void);
 void recursive(int);

 int main(){
            int i,j,k,r,c;
            initialize();
            
            for(i=0;i<N;i++){
                             for(j=0;j<N;j++){
                                              X[i][j]=FALSE;
                                              }
                             }
            scanf("%d",&k);
            for(i=0;i<k;i++){
                             scanf("%d%d",&r,&c);
                             X[r][c]=TRUE;
                             }
            recrusive(0);

            return 0;
            }


 void initialize(){
                   int i;
                   for(i=0;i<N;i++){
                                    row[i]=free;
                                    col[i]=free;
                                    }

                   for(i=0;i<2*N-1;i++){
                                        dpos[i]=free;
                                        dneg[i]=free;
                                        }
                    }

 void printboard(){
                   int i,j;
                   for(i=0;i<N;i++){
                                    if(X[i][j]==TRUE){
                                                      if(row[i]!=j)return;
                                                      }


                   for(i=0;i<N;i++){
                                    for(j=0;j<N;j++){
                                                     if(row[i]==j)printf("Q");
                                                     else printf(".");
                                                     }
                                    printf("\n");
                                    }
                   }

 void recursive(int i){
                    int j;
                    if(i==N){
                             printboard();
                             return;
                             }
                    for(j=0;j<N;j++){
                      if(notfree==col[j]||notfree==dpos[i+j]||notfree==dneg[i-j+N-1])continue;
                      row[i]=j;
                      col[j]=dpos[i+j]=dneg[i-j+N-1]=notfree;
                      recursive(i+1);
                      row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=free;
                      }
                     }





Compiler output:
main.c: In function 'main':
main.c:29:13: error: implicit declaration of function 'recrusive'; did you mean 'recursive'? [-Wimplicit-function-declaration]
   29 |             recrusive(0);
      |             ^~~~~~~~~
      |             recursive
main.c: In function 'printboard':
main.c:78:22: error: expected declaration or statement at end of input
   78 |                      }
      |                      ^
Language: C

#include<stdio.h>
#define N 8
#define free -1
#define notfree 1
#define FALSE 2
#define TRUE 3

 int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
 int X[N][N];

 void initialize(void);
 void printbord(void);
 void recursive(int);

 int main(){
            int i,j,k,r,c;
            initialize();
            
            for(i=0;i<N;i++){
                             for(j=0;j<N;j++){
                                              X[i][j]=FALSE;
                                              }
                             }
            scanf("%d",&k);
            for(i=0;i<k;i++){
                             scanf("%d%d",&r,&c);
                             X[r][c]=TRUE;
                             }
            recrusive(0);

            return 0;
            }


 void initialize(){
                   int i;
                   for(i=0;i<N;i++){
                                    row[i]=free;
                                    col[i]=free;
                                    }

                   for(i=0;i<2*N-1;i++){
                                        dpos[i]=free;
                                        dneg[i]=free;
                                        }
                    }

 void printboard(){
                   int i,j;
                   for(i=0;i<N;i++){
                                    if(X[i][j]==TRUE){
                                                      if(row[i]!=j)return;
                                                      }
                                    }

                   for(i=0;i<N;i++){
                                    for(j=0;j<N;j++){
                                                     if(row[i]==j)printf("Q");
                                                     else printf(".");
                                                     }
                                    printf("\n");
                                    }
                   }

 void recursive(int i){
                    int j;
                    if(i==N){
                             printboard();
                             return;
                             }
                    for(j=0;j<N;j++){
                      if(notfree==col[j]||notfree==dpos[i+j]||notfree==dneg[i-j+N-1])continue;
                      row[i]=j;
                      col[j]=dpos[i+j]=dneg[i-j+N-1]=notfree;
                      recursive(i+1);
                      row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=free;
                      }
                     }





Compiler output:
main.c: In function 'main':
main.c:29:13: error: implicit declaration of function 'recrusive'; did you mean 'recursive'? [-Wimplicit-function-declaration]
   29 |             recrusive(0);
      |             ^~~~~~~~~
      |             recursive
Language: C

#include <iostream>
int board[8];
int col[8];
int diag1[15];
int diag2[15];
int fixed[8];
bool search(int r) {
    if (r == 8) return true;
    if (fixed[r]) return search(r+1);
    for (int c = 0; c < 8; c++) {
        if (col[c] || diag1[r-c+7] || diag2[r+c]) continue;
        board[r] = c;
        col[c] = true;
        diag1[r-c+7] = true;
        diag2[r+c] = true;
        bool ans = search(r+1);
        if (ans) return true;
        col[c] = false;
        diag1[r-c+7] = false;
        diag2[r+c] = false;
    }
    return false;
}
int main() {
    int k;
    std::cin>>k;
    for (int i=0;i<k;i++) {
        int r,c;
        std::cin>>r>>c;
        board[r] = c;
        col[c] += 1;
        diag1[r-c+7] += 1;
        diag2[r+c] += 1;
        fixed[r] = true;
    }
    search(0);
    for (int i=0;i<8;i++) {
        for (int j=0;j<8;j++) {
            std::cout.put(board[i] == j ? 'Q' : '.');
        }
        std::cout << '\n';
    }
    return 0;
}



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