Language: Java

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef pair<int, pi> pii;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define fax(i, a) for (int i = 0; i < (a); i++)
#define f0x(i, a, b) for (int i = (a); i < (b); i++)
#define faxd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define f0xd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define memeset memset

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;
const ld PI = 4*atan((ld)1);

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
vector<int> adj[MX]; bool vis[MX];
void dfs(int v){
	vis[v] = true;
	for(int e : adj[v]){
		if(!vis[e]){
			dfs(e);
		}
	}
}
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
	int n,m; cin >> n >> m;
	ll ans = 0;
	fax(i,m){
		int u,v,w; cin >> u >> v >> w;
		u--; v--;
		adj[u].pb(v); adj[v].pb(u);
	}
	fax(i,n){
		if(!vis[i]){
			dfs(i);
			++ans;
		}
	}
	cout << ans;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#pragma GCC optimize ("O3")
^
Main.java:2: error: illegal character: '#'
#pragma GCC target ("sse4")
^
Main.java:4: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
#pragma GCC optimize ("O3")
        ^
  (use --enable-preview to enable unnamed classes)
Main.java:4: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:8: error: class, interface, enum, or record expected
typedef long long ll;
^
Main.java:9: error: class, interface, enum, or record expected
typedef long double ld;
^
Main.java:10: error: class, interface, enum, or record expected
typedef complex<ld> cd;
^
Main.java:12: error: class, interface, enum, or record expected
typedef pair<int, int> pi;
^
Main.java:13: error: class, interface, enum, or record expected
typedef pair<ll,ll> pl;
^
Main.java:14: error: class, interface, enum, or record expected
typedef pair<ld,ld> pd;
^
Main.java:15: error: class, interface, enum, or record expected
typedef pair<int, pi> pii;
^
Main.java:17: error: class, interface, enum, or record expected
typedef vector<int> vi;
^
Main.java:18: error: class, interface, enum, or record expected
typedef vector<ld> vd;
^
Main.java:19: error: class, interface, enum, or record expected
typedef vector<ll> vl;
^
Main.java:20: error: class, interface, enum, or record expected
typedef vector<pi> vpi;
^
Main.java:21: error: class, interface, enum, or record expected
typedef vector<pl> vpl;
^
Main.java:22: error: class, interface, enum, or record expected
typedef vector<cd> vcd;
^
Main.java:24: error: illegal character: '#'
#define fax(i, a) for (int i = 0; i < (a); i++)
^
Main.java:24: error: class, interface, enum, or record expected
#define fax(i, a) for (int i = 0; i < (a); i++)
        ^
Main.java:24: error: class, interface, enum, or record expected
#define fax(i, a) for (int i = 0; i < (a); i++)
                                  ^
Main.java:24: error: class, interface, enum, or record expected
#define fax(i, a) for (int i = 0; i < (a); i++)
                                           ^
Main.java:25: error: illegal character: '#'
#define f0x(i, a, b) for (int i = (a); i < (b); i++)
^
Main.java:25: error: class, interface, enum, or record expected
#define f0x(i, a, b) for (int i = (a); i < (b); i++)
                                       ^
Main.java:25: error: class, interface, enum, or record expected
#define f0x(i, a, b) for (int i = (a); i < (b); i++)
                                                ^
Main.java:26: error: illegal character: '#'
#define faxd(i,a,b) for (int i = (b)-1; i >= (a); i--)
^
Main.java:26: error: class, interface, enum, or record expected
#define faxd(i,a,b) for (int i = (b)-1; i >= (a); i--)
                                        ^
Main.java:26: error: class, interface, enum, or record expected
#define faxd(i,a,b) for (int i = (b)-1; i >= (a); i--)
                                                  ^
Main.java:27: error: illegal character: '#'
#define f0xd(i,a) for (int i = (a)-1; i >= 0; i--)
^
Main.java:27: error: class, interface, enum, or record expected
#define f0xd(i,a) for (int i = (a)-1; i >= 0; i--)
                                      ^
Main.java:27: error: class, interface, enum, or record expected
#define f0xd(i,a) for (int i = (a)-1; i >= 0; i--)
                                              ^
Main.java:28: error: illegal character: '#'
#define trav(a, x) for (auto& a : x)
^
Main.java:29: error: illegal character: '#'
#define memeset memset
^
Main.java:31: error: illegal character: '#'
#define mp make_pair
^
Main.java:32: error: illegal character: '#'
#define pb push_back
^
Main.java:33: error: illegal character: '#'
#define f first
^
Main.java:34: error: illegal character: '#'
#define s second
^
Main.java:35: error: illegal character: '#'
#define lb lower_bound
^
Main.java:36: error: illegal character: '#'
#define ub upper_bound
^
Main.java:38: error: illegal character: '#'
#define sz(x) (int)x.size()
^
Main.java:39: error: illegal character: '#'
#define all(x) begin(x), end(x)
^
Main.java:40: error: illegal character: '#'
#define rsz resize
^
Main.java:43: error: class, interface, enum, or record expected
const ll INF = 1e18;
^
Main.java:44: error: class, interface, enum, or record expected
const int MX = 200005;
^
Main.java:45: error: class, interface, enum, or record expected
const ld PI = 4*atan((ld)1);
^
Main.java:47: error: class, interface, enum, or record expected
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
^
Main.java:47: error: '{' expected
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
                ^
Main.java:47: error: <identifier> expected
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
                              ^
Main.java:48: error: class, interface, enum, or record expected
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
^
Main.java:48: error: '{' expected
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
                ^
Main.java:48: error: <identifier> expected
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
                              ^
Main.java:49: error: class, interface, enum, or record expected
vector<int> adj[MX]; bool vis[MX];
^
Main.java:49: error: class, interface, enum, or record expected
vector<int> adj[MX]; bool vis[MX];
                     ^
Main.java:59: error: not a statement
   ios::sync_with_stdio(false);
   ^
Main.java:61: error: not a statement
	int n,m; cin >> n >> m;
	                  ^
Main.java:64: error: not a statement
		int u,v,w; cin >> u >> v >> w;
		                         ^
Main.java:74: error: not a statement
	cout << ans;
	     ^
Main.java:59: error: ';' expected
   ios::sync_with_stdio(false);
                       ^
Main.java:63: error: ';' expected
	fax(i,m){
	        ^
Main.java:68: error: ';' expected
	fax(i,n){
	        ^
60 errors