Language: C++

#![allow(unused_imports, unused_variables, dead_code)]
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

// https://beta.atcoder.jp/contests/arc065/tasks/arc065_b

fn bfs(
    cmap: &Vec<Vec<i64>>
) -> bool {
    let mut q: VecDeque<usize> = VecDeque::new();
    let mut visited: [bool; 100005] = [false; 100005];
    let mut node: [i64; 100005] = [0; 100005];
    for n in 0..cmap.len() {
        if visited[n] { continue; }
        visited[n] = true;
        node[n] = 0;
        q.push_back(n);
        while !q.is_empty() {
            let &c = q.front().unwrap();
            for i in 0..cmap.len() {
                if i == c { continue; }
                let c_to_i = cmap[c][i];
                if c_to_i == 110000 { continue; }
                if visited[i] { // 既に決めた場所なのでチェック
                    if node[c] + c_to_i == node[i] { continue; } //OK
                    else { return false; }
                }
                // きたことないのでNodeの値を決める
                node[i] = node[c] + c_to_i;
                visited[i] = true;
                q.push_back(i);
            }
            q.pop_front();
        }
    }
    return true;
}

fn main() {
    let cin = stdin(); let cin = cin.lock(); let mut sc = Scanner::new(cin);

    let (n, m): (usize, usize) = (sc.read(), sc.read());
    // NxNの２次元配列
    let mut lrd: Vec<Vec<i64>> = vec![vec![110000; n]; n];

    for i in 0..m {
        let (l, r, d): (usize, usize, i64) = (sc.read(), sc.read(), sc.read());
        let l = l - 1; let r = r - 1;
        lrd[l][r] = d;
        lrd[r][l] = -d;
    }

    if !bfs(&lrd) { println!("No"); }
    else { println!("Yes"); }
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #![allow(unused_imports, unused_variables, dead_code)]
      |  ^
a.cc:17:14: error: too many decimal points in number
   17 |     for n in 0..cmap.len() {
      |              ^~~~~~~~~~~
a.cc:24:22: error: too many decimal points in number
   24 |             for i in 0..cmap.len() {
      |                      ^~~~~~~~~~~
a.cc:50:14: error: too many decimal points in number
   50 |     for i in 0..m {
      |              ^~~~
a.cc:61:16: warning: missing terminating ' character
   61 | struct Scanner<'a> {
      |                ^
a.cc:61:16: error: missing terminating ' character
   61 | struct Scanner<'a> {
      |                ^~~~~
a.cc:62:20: warning: missing terminating ' character
   62 |     cin: StdinLock<'a>,
      |                    ^
a.cc:62:20: error: missing terminating ' character
   62 |     cin: StdinLock<'a>,
      |                    ^~~~
a.cc:64:6: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
   64 | impl<'a> Scanner<'a> {
      |      ^~~~~~~~~~~~~~
a.cc:65:27: warning: multi-character literal with 15 characters exceeds 'int' size of 4 bytes
   65 |     fn new(cin: StdinLock<'a>) -> Scanner<'a> {
      |                           ^~~~~~~~~~~~~~~~~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::io::{stdin, Read, StdinLock};
      | ^~~
a.cc:3:1: error: 'use' does not name a type
    3 | use std::str::FromStr;
      | ^~~
a.cc:4:1: error: 'use' does not name a type
    4 | use std::fmt::*;
      | ^~~
a.cc:5:1: error: 'use' does not name a type
    5 | use std::str::*;
      | ^~~
a.cc:6:1: error: 'use' does not name a type
    6 | use std::cmp::*;
      | ^~~
a.cc:7:1: error: 'use' does not name a type
    7 | use std::collections::*;
      | ^~~
a.cc:11:1: error: 'fn' does not name a type
   11 | fn bfs(
      | ^~
a.cc:43:1: error: 'fn' does not name a type
   43 | fn main() {
      | ^~
a.cc:61:8: error: 'Scanner' is not a class template
   61 | struct Scanner<'a> {
      |        ^~~~~~~
a.cc:62:5: error: 'cin' was not declared in this scope
   62 |     cin: StdinLock<'a>,
      |     ^~~
a.cc:63:1: error: expected unqualified-id before '}' token
   63 | }
      | ^
a.cc:63:1: error: expected declaration before '}' token
a.cc:64:1: error: 'impl' does not name a type
   64 | impl<'a> Scanner<'a> {
      | ^~~~