Language: C++

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{BufWriter, Write};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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)*}
    };
}

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($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, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! { k: usize }
    let mut check = true;
    let mut a = 7;
    //k回でa_iのkの剰余が全て出るので鳩の巣原理より
    if k == 1 || k % 7 == 0 {
        puts!("1");
    }
    for i in 2..k+1 {
        a = a * 10 + 7;
        a = a % k;
        if a == 0 {
            puts!("{}", i);
            check = false;
            break;
        }
    }
    if check {
        puts!("-1");
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #[
    1 | #[allow(unused_imports)]
      |  ^
a.cc:3:2: error: invalid preprocessing directive #[
    3 | #[allow(unused_imports)]
      |  ^
a.cc:46:10: error: too many decimal points in number
   46 |         (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
      |          ^~~~~~~
a.cc:59:2: error: invalid preprocessing directive #[
   59 | #[allow(unused)]
      |  ^
a.cc:63:2: error: invalid preprocessing directive #[
   63 | #[allow(unused)]
      |  ^
a.cc:81:14: error: too many decimal points in number
   81 |     for i in 2..k+1 {
      |              ^~~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::cmp::*;
      | ^~~
a.cc:4:1: error: 'use' does not name a type
    4 | use std::collections::*;
      | ^~~
a.cc:5:1: error: 'use' does not name a type
    5 | use std::io::{BufWriter, Write};
      | ^~~
a.cc:7:1: error: 'macro_rules' does not name a type
    7 | macro_rules! input {
      | ^~~~~~~~~~~
a.cc:23:1: error: 'macro_rules' does not name a type
   23 | macro_rules! input_inner {
      | ^~~~~~~~~~~
a.cc:32:1: error: 'macro_rules' does not name a type
   32 | macro_rules! read_value {
      | ^~~~~~~~~~~
a.cc:60:1: error: 'macro_rules' does not name a type
   60 | macro_rules! debug {
      | ^~~~~~~~~~~
a.cc:64:1: error: 'macro_rules' does not name a type
   64 | macro_rules! debugln {
      | ^~~~~~~~~~~
a.cc:68:1: error: 'fn' does not name a type
   68 | fn solve() {
      | ^~
a.cc:95:1: error: 'fn' does not name a type
   95 | fn main() {
      | ^~