Language: C++

#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        k: usize,
        p: [usize; n],
    }

    let mut s = vec![0; 1000];
    let mut st = 0;
    for i in 0..1000 {
        st += i + 1;
        s[i] = st;
    }

    let mut ps = 0.0;
    for i in 0..k {
        ps += s[p[i] - 1] as f64 / p[i] as f64;
    }
    let mut ans = 0.0;
    for i in 0..n {
        if ps > ans {
            ans = ps;
        }
        ps -= s[p[i] - 1] as f64 / p[i] as f64;
        if i + k < n {
            ps += s[p[k + i] - 1] as f64 / p[i + k] as f64;
        }
    }
    println!("{}", ans);
}


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #[
    1 | #[allow(dead_code)]
      |  ^
a.cc:6:2: error: invalid preprocessing directive #[
    6 | #[allow(dead_code)]
      |  ^
a.cc:11:2: error: invalid preprocessing directive #[
   11 | #[allow(unused_macros)]
      |  ^
a.cc:20:10: error: invalid preprocessing directive #[
   20 |         #[allow(unused_mut, unused_variables, bare_trait_objects)]
      |          ^
a.cc:33:2: error: invalid preprocessing directive #[
   33 | #[allow(unused_macros)]
      |  ^
a.cc:49:2: error: invalid preprocessing directive #[
   49 | #[allow(unused_macros)]
      |  ^
a.cc:60:10: error: too many decimal points in number
   60 |         (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
      |          ^~~~~~~
a.cc:84:2: error: invalid preprocessing directive #[
   84 | #[allow(unused_imports)]
      |  ^
a.cc:86:2: error: invalid preprocessing directive #[
   86 | #[allow(unused_imports)]
      |  ^
a.cc:89:2: error: invalid preprocessing directive #[
   89 | #[allow(dead_code)]
      |  ^
a.cc:95:2: error: invalid preprocessing directive #[
   95 | #[allow(dead_code)]
      |  ^
a.cc:97:2: error: invalid preprocessing directive #[
   97 | #[allow(dead_code)]
      |  ^
a.cc:109:14: error: too many decimal points in number
  109 |     for i in 0..1000 {
      |              ^~~~~~~
a.cc:115:14: error: too many decimal points in number
  115 |     for i in 0..k {
      |              ^~~~
a.cc:119:14: error: too many decimal points in number
  119 |     for i in 0..n {
      |              ^~~~
a.cc:2:1: error: 'fn' does not name a type
    2 | fn is_whitespace(c: &char) -> bool {
      | ^~
a.cc:7:1: error: 'fn' does not name a type
    7 | fn is_eol(c: &char) -> bool {
      | ^~
a.cc:12:1: error: 'macro_rules' does not name a type
   12 | macro_rules! input {
      | ^~~~~~~~~~~
a.cc:34:1: error: 'macro_rules' does not name a type
   34 | macro_rules! input_inner {
      | ^~~~~~~~~~~
a.cc:50:1: error: 'macro_rules' does not name a type
   50 | macro_rules! read_value {
      | ^~~~~~~~~~~
a.cc:85:1: error: 'use' does not name a type
   85 | use std::cmp::{max, min};
      | ^~~
a.cc:87:1: error: 'use' does not name a type
   87 | use std::collections::{BinaryHeap, HashMap, HashSet};
      | ^~~
a.cc:91:5: error: 'from' does not name a type
   91 |     from: usize,
      |     ^~~~
a.cc:96:6: error: expected initializer before 'Graph'
   96 | type Graph = Vec<Vec<usize>>;
      |      ^~~~~
a.cc:98:8: error: found ':' in nested-name-specifier, expected '::'
   98 | const M: usize = 1_000_000_007;
      |        ^
      |        ::
a.cc:98:7: error: 'M' does not name a type
   98 | const M: usize = 1_000_000_007;
      |       ^
a.cc:100:1: error: 'fn' does not name a type
  100 | fn main() {
      | ^~