Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
typedef pair<int, int> Pr;

int n, m, start;
vector<Pr> g[1000];
int dist[1000];

int solve()
{
	for (int i = 0; i < n; i++){
		dist[i] = INF;
	}
	dist[start] = 0;
	
	int k = 0;
	while (k < n){
		bool update = false;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < g[i].size(); j++){
				int from = i;
				int to = g[i][j].first;
				int cost = g[i][j].second;
				if (dist[to] > dist[from] + cost){
					dist[to] = dist[from] + cost;
					update = true;
				}
			}
		}
		if (!update) break;
		k++;
	}
	
	if (k == n) return -1;
	return 1;
}

int main()
{
	scanf("%d %d %d", &n, &m, &start);
	
	for (int i = 0; i < m; i++){
		int s, t, d;
		scanf("%d %d %d", &s, &t, &d);
		
		g[s].push_back(Pr(t, d));
	}
	
	if (solve() == -1){
		puts("NEGATIVE CYCLE");
	}
	else {
		for (int i = 0; i < n; i++){
			if (dist[i] == INF) puts("INF");
			else printf("%d\n", dist[i]);
		}
	}
}#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
typedef pair<int, int> Pr;

int n, m, start;
vector<Pr> g[1000];
int dist[1000];

int solve()
{
	for (int i = 0; i < n; i++){
		dist[i] = INF;
	}
	dist[start] = 0;
	
	int k = 0;
	while (k < n){
		bool update = false;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < g[i].size(); j++){
				int from = i;
				int to = g[i][j].first;
				int cost = g[i][j].second;
				if (dist[to] > dist[from] + cost){
					dist[to] = dist[from] + cost;
					update = true;
				}
			}
		}
		if (!update) break;
		k++;
	}
	
	if (k == n) return -1;
	return 1;
}

int main()
{
	scanf("%d %d %d", &n, &m, &start);
	
	for (int i = 0; i < m; i++){
		int s, t, d;
		scanf("%d %d %d", &s, &t, &d);
		
		g[s].push_back(Pr(t, d));
	}
	
	if (solve() == -1){
		puts("NEGATIVE CYCLE");
	}
	else {
		for (int i = 0; i < n; i++){
			if (dist[i] == INF) puts("INF");
			else printf("%d\n", dist[i]);
		}
	}
}

Compiler output:
a.cc:59:2: error: stray '#' in program
   59 | }#include <bits/stdc++.h>
      |  ^
a.cc:59:3: error: 'include' does not name a type
   59 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:61:11: error: redefinition of 'const int INF'
   61 | const int INF = 1 << 28;
      |           ^~~
a.cc:3:11: note: 'const int INF' previously defined here
    3 | const int INF = 1 << 28;
      |           ^~~
a.cc:64:5: error: redefinition of 'int n'
   64 | int n, m, start;
      |     ^
a.cc:6:5: note: 'int n' previously declared here
    6 | int n, m, start;
      |     ^
a.cc:64:8: error: redefinition of 'int m'
   64 | int n, m, start;
      |        ^
a.cc:6:8: note: 'int m' previously declared here
    6 | int n, m, start;
      |        ^
a.cc:64:11: error: redefinition of 'int start'
   64 | int n, m, start;
      |           ^~~~~
a.cc:6:11: note: 'int start' previously declared here
    6 | int n, m, start;
      |           ^~~~~
a.cc:65:12: error: redefinition of 'std::vector<std::pair<int, int> > g [1000]'
   65 | vector<Pr> g[1000];
      |            ^
a.cc:7:12: note: 'std::vector<std::pair<int, int> > g [1000]' previously declared here
    7 | vector<Pr> g[1000];
      |            ^
a.cc:66:5: error: redefinition of 'int dist [1000]'
   66 | int dist[1000];
      |     ^~~~
a.cc:8:5: note: 'int dist [1000]' previously declared here
    8 | int dist[1000];
      |     ^~~~
a.cc:68:5: error: redefinition of 'int solve()'
   68 | int solve()
      |     ^~~~~
a.cc:10:5: note: 'int solve()' previously defined here
   10 | int solve()
      |     ^~~~~
a.cc:97:5: error: redefinition of 'int main()'
   97 | int main()
      |     ^~~~
a.cc:39:5: note: 'int main()' previously defined here
   39 | int main()
      |     ^~~~