Language: C++

use io::*;

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);

    let a: i64 = sc.next();
    let b: i64 = sc.next();
    let c: i64 = sc.next();
    let k: i64 = sc.next();

    let m: Mat = [[0, 1, 1], [1, 0, 1], [1, 1, 0]];

    let mm = mpow(&m, k);

    let ma = mm[0][0] * a + mm[0][1] * b + mm[0][2] * c;
    let mb = mm[1][0] * a + mm[1][1] * b + mm[1][2] * c;
    let ans = ma - mb;

    if ans.abs() > 1000_000_000_000_000_000 {
        println!("Unfair");
    } else {
        println!("{}", ans);
    }
}

type Mat = [[i64; 3]; 3];

fn mpow(a: &Mat, n: i64) -> Mat {
    if n == 0 {
        [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
    } else {
        let t = mpow(a, n / 2);
        if n % 2 == 0 {
            t
        } else {
            mmul(&t, a)
        }
    }
}

fn mmul(a: &Mat, b: &Mat) -> Mat {
    let mut c: Mat = [[0; 3]; 3];

    for i in 0..3 {
        for j in 0..3 {
            for k in 0..3 {
                c[i][j] += a[i][k] * b[k][j];
            }
        }
    }

    c
}

//-----

pub mod io {
    use std;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T>(&mut self) -> T
        where
            T: std::str::FromStr,
            <T as std::str::FromStr>::Err: std::fmt::Debug,
        {
            let s = self.iter.next().unwrap();
            s.parse::<T>().unwrap()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Compiler output:
a.cc:45:14: error: too many decimal points in number
   45 |     for i in 0..3 {
      |              ^~~~
a.cc:46:18: error: too many decimal points in number
   46 |         for j in 0..3 {
      |                  ^~~~
a.cc:47:22: error: too many decimal points in number
   47 |             for k in 0..3 {
      |                      ^~~~
a.cc:61:24: warning: missing terminating ' character
   61 |     pub struct Scanner<'a> {
      |                        ^
a.cc:61:24: error: missing terminating ' character
   61 |     pub struct Scanner<'a> {
      |                        ^~~~~
a.cc:62:41: warning: missing terminating ' character
   62 |         iter: std::str::SplitWhitespace<'a>,
      |                                         ^
a.cc:62:41: error: missing terminating ' character
   62 |         iter: std::str::SplitWhitespace<'a>,
      |                                         ^~~~
a.cc:65:10: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
   65 |     impl<'a> Scanner<'a> {
      |          ^~~~~~~~~~~~~~
a.cc:66:24: warning: multi-character literal with 18 characters exceeds 'int' size of 4 bytes
   66 |         pub fn new(s: &'a str) -> Scanner<'a> {
      |                        ^~~~~~~~~~~~~~~~~~~~~
a.cc:1:1: error: 'use' does not name a type
    1 | use io::*;
      | ^~~
a.cc:3:1: error: 'fn' does not name a type
    3 | fn main() {
      | ^~
a.cc:27:1: error: 'type' does not name a type; did you mean 'typeof'?
   27 | type Mat = [[i64; 3]; 3];
      | ^~~~
      | typeof
a.cc:27:19: error: expected unqualified-id before numeric constant
   27 | type Mat = [[i64; 3]; 3];
      |                   ^
a.cc:27:23: error: expected unqualified-id before numeric constant
   27 | type Mat = [[i64; 3]; 3];
      |                       ^
a.cc:29:1: error: 'fn' does not name a type
   29 | fn mpow(a: &Mat, n: i64) -> Mat {
      | ^~
a.cc:42:1: error: 'fn' does not name a type
   42 | fn mmul(a: &Mat, b: &Mat) -> Mat {
      | ^~
a.cc:58:1: error: 'pub' does not name a type
   58 | pub mod io {
      | ^~~
a.cc:65:5: error: 'impl' does not name a type
   65 |     impl<'a> Scanner<'a> {
      |     ^~~~
a.cc:82:5: error: 'pub' does not name a type
   82 |     pub fn read_string() -> String {
      |     ^~~
a.cc:90:5: error: 'pub' does not name a type
   90 |     pub fn read_line() -> String {
      |     ^~~
a.cc:95:1: error: expected declaration before '}' token
   95 | }
      | ^