The USA Construction Operation (USACO) recently ordered Farmer John to arrange a row of $$$n$$$ haybale piles on the farm. The $$$i$$$-th pile contains $$$a_i$$$ haybales. However, Farmer John has just left for vacation, leaving Bessie all on her own. Every day, Bessie the naughty cow can choose to move one haybale in any pile to an adjacent pile. Formally, in one day she can choose any two indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$) such that $$$|i-j|=1$$$ and $$$a_i>0$$$ and apply $$$a_i = a_i - 1$$$, $$$a_j = a_j + 1$$$. She may also decide to not do anything on some days because she is lazy.Bessie wants to maximize the number of haybales in pile $$$1$$$ (i.e. to maximize $$$a_1$$$), and she only has $$$d$$$ days to do so before Farmer John returns. Help her find the maximum number of haybales that may be in pile $$$1$$$ if she acts optimally!

fn solution() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let t: u32 = line.trim().parse().unwrap();
    for _ in 0..t {
        let mut line = String::new();
        io::stdin().read_line(&mut line).unwrap();
        let mut pieces = line.split_whitespace();
        let n: u32 = pieces.next().unwrap().parse().unwrap();
        let d: u32 = pieces.next().unwrap().parse().unwrap();

        let mut line = String::new();
        io::stdin().read_line(&mut line).unwrap();
        let pieces = line.split_whitespace();
        let mut a = Vec::new();

        for v_str in pieces {
            let v: u32 = v_str.parse().unwrap();
            a.push(v);
        }

        let mut days = 0;
        for i in 1..(n as usize) {
            while days < d && a[i] > 0 {
                for j in (1..(i + 1)).rev() {
                    if days >= d {
                        break;
                    }

                    a[j] -= 1;
                    a[j - 1] += 1;
                    days += 1;
                }
            }
        }

        println!("{}", a[0]);
    }
}


You are given an integer $$$n$$$. Check if $$$n$$$ has an odd divisor, greater than one (does there exist such a number $$$x$$$ ($$$x > 1$$$) that $$$n$$$ is divisible by $$$x$$$ and $$$x$$$ is odd).For example, if $$$n=6$$$, then there is $$$x=3$$$. If $$$n=4$$$, then such a number does not exist.

int solution() {
  long long int n = 0;
  long long int x = 0;
  long long int fl = 0;
  scanf("%lld", &n);
  for (long long int t = 0; t < n; t++) {
    scanf("%lld", &x);
    fl = 0;
    while (x % 2 == 0) {
      x /= 2;
    }
    if (x % 2 == 1 && x != 1) {
      fl = 1;
    }
    if (fl == 0) {
      printf("NO\n");
    } else {
      printf("YES\n");
    }
  }
  return 0;
}

fn solution() {
    let mut buf = BufWriter::new(io::stdout().lock());
    io::stdin()
        .lines()
        .skip(1)
        .flatten()
        .flat_map(|s| s.parse::<isize>())
        .for_each(|n| {
            let ans = if n.wrapping_neg() & n == n {
                "NO"
            } else {
                "YES"
            };
            writeln!(buf, "{ans}").ok();
        });
}


Score : <var>300</var> points

Problem Statement

In some other world, today is Christmas Eve.

There are <var>N</var> trees planted in Mr. Takaha's garden. The height of the <var>i</var>-th tree <var>(1 \leq i \leq N)</var> is <var>h_i</var> meters.

He decides to choose <var>K</var> trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.

More specifically, let the height of the tallest decorated tree be <var>h_{max}</var> meters, and the height of the shortest decorated tree be <var>h_{min}</var> meters. The smaller the value <var>h_{max} - h_{min}</var> is, the better. What is the minimum possible value of <var>h_{max} - h_{min}</var>?

Constraints

<var>2 \leq K < N \leq 10^5</var>

<var>1 \leq h_i \leq 10^9</var>

<var>h_i</var> is an integer.

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>K</var>
<var>h_1</var>
<var>h_2</var>
<var>:</var>
<var>h_N</var>

Output

Print the minimum possible value of <var>h_{max} - h_{min}</var>.

Sample Input 1

5 3
10
15
11
14
12

Sample Output 1

2

If we decorate the first, third and fifth trees, <var>h_{max} = 12, h_{min} = 10</var> so <var>h_{max} - h_{min} = 2</var>. This is optimal.

Sample Input 2

5 3
5
7
5
7
7

Sample Output 2

0

If we decorate the second, fourth and fifth trees, <var>h_{max} = 7, h_{min} = 7</var> so <var>h_{max} - h_{min} = 0</var>. This is optimal.

There are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).

int solution(void) {
  int a[100000];
  int min;
  int n;
  int i;
  int b;
  int k;
  int x;
  int tmp;
  int j;
  int count;
  int answer;
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    b = b + a[i];
  }

  int increment;
  int temp;
  int array_size = n;

  increment = 4;
  while (increment > 0) {
    for (i = 0; i < array_size; i++) {
      j = i;
      temp = a[i];
      while ((j >= increment) && (a[j - increment] > temp)) {
        a[j] = a[j - increment];
        j = j - increment;
      }
      a[j] = temp;
    }
    if (increment / 2 != 0) {
      increment = increment / 2;
    } else if (increment == 1) {
      increment = 0;
    } else {
      increment = 1;
    }
  }
  count = 0;
  min = 999999999;
  j = 0;
  for (i = 0; i < n - k + 1; i++) {
    count = a[i + k - 1] - a[i];
    if (count <= min) {
      min = count;
    }
  }
  printf("%d\n", min);
  return 0;
}

fn solution() {
    let mut stdin = io::stdin();
    let mut buf = String::new();
    let _ = stdin.read_to_string(&mut buf);
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let k: usize = iter.next().unwrap().parse().unwrap();
    let mut h: Vec<u32> = iter.map(|x| x.parse().unwrap()).collect();

    h.sort();
    println!(
        "{}",
        (0..(n - k + 1)).map(|i| h[i + k - 1] - h[i]).min().unwrap()
    );
}


Score : <var>100</var> points

Problem Statement

There is a right triangle <var>ABC</var> with <var>∠ABC=90°</var>.

Given the lengths of the three sides, <var>|AB|,|BC|</var> and <var>|CA|</var>, find the area of the right triangle <var>ABC</var>.

It is guaranteed that the area of the triangle <var>ABC</var> is an integer.

Constraints

<var>1 \leq |AB|,|BC|,|CA| \leq 100</var>

All values in input are integers.

The area of the triangle <var>ABC</var> is an integer.

Input

Input is given from Standard Input in the following format:

<var>|AB|</var> <var>|BC|</var> <var>|CA|</var>

Output

Print the area of the triangle <var>ABC</var>.

Sample Input 1

3 4 5

Sample Output 1

6

This triangle has an area of <var>6</var>.

Sample Input 2

5 12 13

Sample Output 2

30

This triangle has an area of <var>30</var>.

Sample Input 3

45 28 53

Sample Output 3

630

This triangle has an area of <var>630</var>.

int solution() {
  int ab = 0;
  int bc = 0;
  int ca = 0;

  scanf("%d %d %d", &ab, &bc, &ca);

  printf("%d\n", (ab * bc) / 2);

  return 0;
}

fn solution() {
    let mut l = String::new();
    stdin().read_line(&mut l).unwrap();
    let l: Vec<isize> = l.split_whitespace().take(2).flat_map(str::parse).collect();
    println!("{}", l[0] * l[1] / 2);
}


Score : <var>300</var> points

Problem Statement

There are <var>N</var> cubes stacked vertically on a desk.

You are given a string <var>S</var> of length <var>N</var>. The color of the <var>i</var>-th cube from the bottom is red if the <var>i</var>-th character in <var>S</var> is 0, and blue if that character is 1.

You can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.

At most how many cubes can be removed?

Constraints

<var>1 \leq N \leq 10^5</var>

<var>|S| = N</var>

Each character in <var>S</var> is 0 or 1.

Input

Input is given from Standard Input in the following format:

<var>S</var>

Output

Print the maximum number of cubes that can be removed.

Sample Input 1

0011

Sample Output 1

4

All four cubes can be removed, by performing the operation as follows:

Remove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.

Remove the first and second cubes from the bottom.

Sample Input 2

11011010001011

Sample Output 2

12

Sample Input 3

0

Sample Output 3

0

fn solution() {
    let mut input = String::new();
    let mut stack: Vec<char> = Vec::new();
    std::io::stdin().read_line(&mut input).ok();
    let s = input.trim();
    for c in s.chars() {
        if c != '1' && c != '0' {
            continue;
        }

        match stack.last() {
            None => stack.push(c),
            Some(&l) => {
                if l == c {
                    stack.push(c);
                } else {
                    stack.pop();
                }
            }
        }
    }

    println!("{}", s.len() - stack.len());
}


Entrance Examination

The International Competitive Programming College (ICPC) is famous
for its research on competitive programming.
Applicants to the college are required to take its entrance examination.

The successful applicants of the examination are chosen as follows.

The score of any successful applicant is higher than that of any unsuccessful applicant.

The number of successful applicants n must be between nmin and nmax, inclusive.
We choose n within the specified range that maximizes the gap.
Here, the gap means the difference between the lowest score of
successful applicants and the highest score of unsuccessful applicants.

 When two or more candidates for n make exactly the same gap,
use the greatest n among them.

Let's see the first couple of examples given in Sample Input below.
In the first example, nmin and nmax are two and four, respectively, and there are five applicants whose scores are 100, 90, 82, 70, and 65.
For n of two, three and four, the gaps will be 8, 12, and 5, respectively.
We must choose three as n, because it maximizes the gap.

In the second example, nmin and nmax are two and four, respectively, and there are five applicants whose scores are 100, 90, 80, 75, and 65.
For n of two, three and four, the gap will be 10, 5, and 10,
respectively. Both two and four maximize the gap, and we must choose the
 greatest number, four.

You are requested to write a program that computes the number of successful applicants that satisfies the conditions.

Input

The input consists of multiple datasets. Each dataset is formatted as follows.

m nmin nmax

P1

P2

...

Pm

The first line of a dataset contains three integers separated by single spaces.
m represents the number of applicants, nmin represents the minimum number of successful applicants, and nmax represents the maximum number of successful applicants.
Each of the following m lines contains an integer
Pi, which represents the score of each applicant.
The scores are listed in descending order.
These numbers satisfy 0 < nmin < nmax < m ≤ 200, 0 ≤ Pi ≤ 10000 (1 ≤ i ≤ m) and  Pnmin > Pnmax+1. These ensure that there always exists an n satisfying the conditions.

The end of the input is represented by a line containing three zeros separated by single spaces.

Output

For each dataset, output the number of successful applicants in a line.

Sample Input

5 2 4
100
90
82
70
65
5 2 4
100
90
80
75
65
3 1 2
5000
4000
3000
4 2 3
10000
10000
8000
8000
4 2 3
10000
10000
10000
8000
5 2 3
100
80
68
60
45
0 0 0

Output for the Sample Input

3
4
2
2
3
2

int solution(void) {
  int num = 1;
  int a = 1;
  int b = 1;
  while (1) {
    scanf("%d %d %d", &num, &a, &b);
    if (num == 0 && a == 0 && b == 0) {
      break;
    }
    int i;
    int point[num];
    for (i = 1; i <= num; i++) {
      scanf("%d", &point[i]);
    }
    int sa = 0;
    int max = 0;
    int ba = 0;
    for (i = a; i < b + 1; i++) {
      int d = point[i];
      int c = point[i + 1];
      sa = c - d;
      sa = sa * (-1);
      if (sa >= max) {
        max = sa;
        ba = i;
      }
    }
    printf("%d\n", ba);
  }
  return 0;
}

fn solution() {
    loop {
        let mut buf1 = String::new();
        io::stdin().read_line(&mut buf1).ok();
        let mut iter = buf1.split_whitespace().map(|n| usize::from_str(n).unwrap());
        let (m, nmin, nmax) = (
            iter.next().unwrap(),
            iter.next().unwrap(),
            iter.next().unwrap(),
        );

        if m == 0 && nmin == 0 && nmax == 0 {
            return;
        }

        let mut v: Vec<u16> = Vec::new();
        for _ in 0..m {
            let mut buf2 = String::new();
            io::stdin().read_line(&mut buf2).ok();
            let p: u16 = match buf2.trim().parse() {
                Ok(num) => num,
                Err(e) => {
                    panic!("{}", e)
                }
            };
            v.push(p);
        }

        let mut ans_n: u16 = 0;
        let mut ans_gap: u16 = 0;
        for i in nmin..nmax + 1 {
            let gap = v[i - 1] - v[i];
            if gap < ans_gap {
                continue;
            }

            ans_gap = gap;
            ans_n = i as u16;
        }
        println!("{}", ans_n);
    }
}


Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop — $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and the bottle of the second type costs $$$b$$$ burles correspondingly.Polycarp wants to spend as few money as possible. Your task is to find the minimum amount of money (in burles) Polycarp needs to buy exactly $$$n$$$ liters of water in the nearby shop if the bottle of the first type costs $$$a$$$ burles and the bottle of the second type costs $$$b$$$ burles. You also have to answer $$$q$$$ independent queries.

fn solution() -> Result<(), Box<dyn std::error::Error>> {
    let mut buf = String::new();

    stdin().read_line(&mut buf)?;

    let queries: i64 = buf.trim().parse()?;
    buf.clear();

    for _ in 0..queries {
        {
            stdin().read_line(&mut buf)?;

            let mut tmp = buf.split_whitespace().map(|x| x.parse::<i64>());
            let liter = tmp.next().unwrap()?;
            let a = tmp.next().unwrap()?;
            let b = tmp.next().unwrap()?;

            println!("{}", (liter / 2) * (2 * a).min(b) + a * (liter % 2));
        }
        buf.clear();
    }

    Ok(())
}


Score : <var>100</var> points

Problem Statement

Kode Festival is an anual contest where the hardest stone in the world is determined. (Kode is a Japanese word for "hardness".)

This year, <var>2^N</var> stones participated. The hardness of the <var>i</var>-th stone is <var>A_i</var>.

In the contest, stones are thrown at each other in a knockout tournament.

When two stones with hardness <var>X</var> and <var>Y</var> are thrown at each other, the following will happen:

When <var>X</var> > <var>Y</var>:
  The stone with hardness <var>Y</var> will be destroyed and eliminated.
  The hardness of the stone with hardness <var>X</var> will become <var>X-Y</var>.

When <var>X</var> = <var>Y</var>:
  One of the stones will be destroyed and eliminated.
  The hardness of the other stone will remain the same.

When <var>X</var> < <var>Y</var>:
  The stone with hardness <var>X</var> will be destroyed and eliminated.
  The hardness of the stone with hardness <var>Y</var> will become <var>Y-X</var>.

The <var>2^N</var> stones will fight in a knockout tournament as follows:

The following pairs will fight: (the <var>1</var>-st stone versus the <var>2</var>-nd stone), (the <var>3</var>-rd stone versus the <var>4</var>-th stone), ...

The following pairs will fight: (the winner of (<var>1</var>-st versus <var>2</var>-nd) versus the winner of (<var>3</var>-rd versus <var>4</var>-th)), (the winner of (<var>5</var>-th versus <var>6</var>-th) versus the winner of (<var>7</var>-th versus <var>8</var>-th)), ...

And so forth, until there is only one stone remaining.

Determine the eventual hardness of the last stone remaining.

Constraints

<var>1 \leq N \leq 18</var>

<var>1 \leq A_i \leq 10^9</var>

<var>A_i</var> is an integer.

Input

The input is given from Standard Input in the following format:

<var>N</var>
<var>A_1</var>
<var>A_2</var>
:
<var>A_{2^N}</var>

Output

Print the eventual hardness of the last stone remaining.

Sample Input 1

2
1
3
10
19

Sample Output 1

7

Sample Input 2

3
1
3
2
4
6
8
100
104

Sample Output 2

2

fn solution() {
    let mut s = String::new();
    use std::io::Read;
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut s = s.split_whitespace();
    let n: usize = s.next().unwrap().parse().unwrap();
    let mut a: Vec<i32> = s.take(1 << n).map(|a| a.parse().unwrap()).collect();
    while a.len() > 1 {
        let mut next = vec![];
        for a in a.chunks(2) {
            if a[0] > a[1] {
                next.push(a[0] - a[1]);
            } else if a[0] == a[1] {
                next.push(a[0]);
            } else {
                next.push(a[1] - a[0]);
            }
        }
        a = next;
    }
    println!("{}", a[0]);
}


Leha somehow found an array consisting of n integers. Looking at it, he came up with a task. Two players play the game on the array. Players move one by one. The first player can choose for his move a subsegment of non-zero length with an odd sum of numbers and remove it from the array, after that the remaining parts are glued together into one array and the game continues. The second player can choose a subsegment of non-zero length with an even sum and remove it. Loses the one who can not make a move. Who will win if both play optimally?

int solution() {
  int n = 0;
  int odd_flag = 0;
  int num = 0;

  while (scanf("%d", &n) != EOF) {
    while (n > 0) {
      n--;

      scanf("%d", &num);

      if (num % 2 == 1) {
        odd_flag = 1;
      }
    }

    if (odd_flag == 1) {
      printf("First\n");
    } else {
      printf("Second\n");
    }

    odd_flag = 0;
  }

  return 0;
}

fn solution() {
    let mut line = String::new();
    let stdin = io::stdin();
    stdin.lock().read_line(&mut line).unwrap();
    line.clear();
    stdin.lock().read_line(&mut line).unwrap();
    if line
        .split_whitespace()
        .fold(false, |acc, s| acc | ((s.parse::<i32>().unwrap() & 1) != 0))
    {
        println!("First");
    } else {
        println!("Second");
    }
}


Score : <var>100</var> points

Problem Statement

There are three houses on a number line: House <var>1</var>, <var>2</var> and <var>3</var>, with coordinates <var>A</var>, <var>B</var> and <var>C</var>, respectively.
Print Yes if we pass the coordinate of House <var>3</var> on the straight way from House <var>1</var> to House <var>2</var> without making a detour, and print No otherwise.

Constraints

<var>0\leq A,B,C\leq 100</var>

<var>A</var>, <var>B</var> and <var>C</var> are distinct integers.

Input

Input is given from Standard Input in the following format:

<var>A</var> <var>B</var> <var>C</var>

Output

Print Yes if we pass the coordinate of House <var>3</var> on the straight way from House <var>1</var> to House <var>2</var> without making a detour, and print No otherwise.

Sample Input 1

3 8 5

Sample Output 1

Yes

We pass the coordinate <var>5</var> on the straight way from the house at coordinate <var>3</var> to the house at coordinate <var>8</var>.

Sample Input 2

7 3 1

Sample Output 2

No

Sample Input 3

10 2 4

Sample Output 3

Yes

Sample Input 4

31 41 59

Sample Output 4

No

int solution(void) {
  int a = 3;
  int b = 8;
  int c = 5;
  scanf("%d%d%d", &a, &b, &c);
  if ((c > a && c < b) || (a > c && b < c)) {
    printf("Yes");
  } else {
    printf("No");
  }
  return 0;
}

fn solution() {
    let mut s = String::new();

    io::stdin().read_line(&mut s).expect("Faled to read line");

    let numbers: Vec<i32> = s
        .split(' ')
        .map(|s| s.trim())
        .filter(|s| !s.is_empty())
        .map(|s| s.parse().unwrap())
        .collect();

    let a = numbers[0];
    let b = numbers[1];
    let c = numbers[2];

    if (a < c && c < b) || (a > c && c > b) {
        println!("Yes")
    } else {
        println!("No");
    }
}


There is an infinite set generated as follows:  $$$1$$$ is in this set.  If $$$x$$$ is in this set, $$$x \cdot a$$$ and $$$x+b$$$ both are in this set. For example, when $$$a=3$$$ and $$$b=6$$$, the five smallest elements of the set are:  $$$1$$$,  $$$3$$$ ($$$1$$$ is in this set, so $$$1\cdot a=3$$$ is in this set),  $$$7$$$ ($$$1$$$ is in this set, so $$$1+b=7$$$ is in this set),  $$$9$$$ ($$$3$$$ is in this set, so $$$3\cdot a=9$$$ is in this set),  $$$13$$$ ($$$7$$$ is in this set, so $$$7+b=13$$$ is in this set). Given positive integers $$$a$$$, $$$b$$$, $$$n$$$, determine if $$$n$$$ is in this set.

int solution() {
  long long t;
  scanf("%lld\n", &t);
  while (t--) {
    long long n;
    long long a;
    long long b;
    scanf("%lld %lld %lld\n", &n, &a, &b);
    long long m = n % b;

    if (a == 1) {
      if ((n - 1) % b == 0) {
        puts("Yes");
      } else {
        puts("No");
      }
      continue;
    }

    long long x = 1;
    long long found = 0;
    while (x <= n) {
      if (x % b == m) {
        found = 1;
        break;
      }
      x *= a;
    }
    if (found) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
}

fn solution() {
    let std_in = stdin();
    let in_lock = std_in.lock();
    let input = BufReader::new(in_lock);

    let std_out = stdout();
    let out_lock = std_out.lock();
    let mut output = BufWriter::new(out_lock);

    let mut lines = input.lines().map(|r| r.unwrap());

    let s = lines.next().unwrap();
    let mut it = s.split_whitespace().map(|s| s.parse::<usize>().unwrap());

    let t = it.next().unwrap();

    'cases: for _ in 0..t {
        let s = lines.next().unwrap();
        let mut it = s.split_whitespace().map(|s| s.parse::<u64>().unwrap());

        let n = it.next().unwrap();
        let a = it.next().unwrap();
        let b = it.next().unwrap();

        let mut p = 1;

        while p <= n {
            let x = n - p;

            if x % b == 0 {
                writeln!(&mut output, "Yes").unwrap();
                continue 'cases;
            }

            if a == 1 {
                break;
            }
            p *= a;
        }

        writeln!(&mut output, "No").unwrap();
    }
}


Score : <var>300</var> points

Problem Statement

Given is a permutation <var>P_1, \ldots, P_N</var> of <var>1, \ldots, N</var>.
Find the number of integers <var>i</var> <var>(1 \leq i \leq N)</var> that satisfy the following condition:

For any integer <var>j</var> <var>(1 \leq j \leq i)</var>, <var>P_i \leq P_j</var>.

Constraints

<var>1 \leq N \leq 2 \times 10^5</var>

<var>P_1, \ldots, P_N</var> is a permutation of <var>1, \ldots, N</var>.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>P_1</var> <var>...</var> <var>P_N</var>

Output

Print the number of integers <var>i</var> that satisfy the condition.

Sample Input 1

5
4 2 5 1 3

Sample Output 1

3

<var>i=1</var>, <var>2</var>, and <var>4</var> satisfy the condition, but <var>i=3</var> does not - for example, <var>P_i > P_j</var> holds for <var>j = 1</var>.

Similarly, <var>i=5</var> does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.

Sample Input 2

4
4 3 2 1

Sample Output 2

4

All integers <var>i</var> <var>(1 \leq i \leq N)</var> satisfy the condition.

Sample Input 3

6
1 2 3 4 5 6

Sample Output 3

1

Only <var>i=1</var> satisfies the condition.

Sample Input 4

8
5 7 4 2 6 8 1 3

Sample Output 4

4

Sample Input 5

1
1

Sample Output 5

1

int solution(void) {
  int n;
  scanf("%d", &n);
  int array[n];
  int j = 1;
  int count = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &array[i]);
    while (j <= i) {
      if (j == i && array[i] <= array[j]) {
        count++;
        break;
      }
      if (array[i] <= array[j] && j < i) {
        j++;
      } else if (array[i] >= array[j]) {
        break;
      }
    }
  }
  printf("%d", count);
  return EXIT_SUCCESS;
}

fn solution() {
    let mut buf = String::new();
    let stdin = std::io::stdin();
    stdin.lock().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let mut n = iter.next().unwrap().parse::<usize>().unwrap();
    let p_vec = iter
        .map(|e| e.parse::<usize>().unwrap())
        .collect::<Vec<usize>>();

    let mut ans = 0_usize;
    for &p in &p_vec {
        if p <= n {
            ans += 1;
            n = p;
        }
    }

    println!("{}", ans);
}


You have a stripe of checkered paper of length $$$n$$$. Each cell is either white or black.What is the minimum number of cells that must be recolored from white to black in order to have a segment of $$$k$$$ consecutive black cells on the stripe?If the input data is such that a segment of $$$k$$$ consecutive black cells already exists, then print 0.

int solution() {
  int t;
  scanf("%d", &t);
  while (t > 0) {
    int n;
    int k;
    scanf("%d %d", &n, &k);

    char string[n + 1];
    scanf("%s", string);

    int left = 0;
    int white = 0;
    int min_whites = n;
    for (int right = 0; right < n; right++) {
      if (string[right] == 'W') {
        ++white;
      }
      if (right - left + 1 == k) {
        if (white < min_whites) {
          min_whites = white;
        }
      } else if (right - left + 1 > k) {
        if (string[left] == 'W') {
          white--;
        }
        left++;
      }
      if (right - left + 1 == k) {
        if (white < min_whites) {
          min_whites = white;
        }
      }
    }
    printf("%d\n", min_whites);
    t--;
  }

  return 0;
}

fn solution() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("Err");

    for _i in 0..input.trim().to_string().parse::<u16>().unwrap() {
        input = String::new();
        io::stdin().read_line(&mut input).expect("Err");
        let mut data: Vec<u32> = vec![];
        for i in input.trim().to_string().split(" ") {
            data.push(i.parse::<u32>().unwrap());
        }

        input = String::new();
        io::stdin().read_line(&mut input).expect("Err");
        let cases: Vec<char> = input.trim().to_string().chars().collect();
        let mut max_count: u32 = 0;
        for i in 0..(data[0] - data[1] + 1) {
            let mut count: u32 = 0;
            for j in 0..data[1] {
                if cases[(i + j) as usize] == 'B' {
                    count += 1;
                }
            }
            if count > max_count {
                max_count = count;
            }
        }
        println!("{}", data[1] - max_count);
    }
}


You are given an array $$$a$$$ of length $$$n$$$. The array is called 3SUM-closed if for all distinct indices $$$i$$$, $$$j$$$, $$$k$$$, the sum $$$a_i + a_j + a_k$$$ is an element of the array. More formally, $$$a$$$ is 3SUM-closed if for all integers $$$1 \leq i < j < k \leq n$$$, there exists some integer $$$1 \leq l \leq n$$$ such that $$$a_i + a_j + a_k = a_l$$$.Determine if $$$a$$$ is 3SUM-closed.

int solution() {
  int t;
  scanf("%d", &t);
  long long arr[200001];
  while (t--) {
    int n;
    scanf("%d", &n);
    int pos = 0;
    int neg = 0;
    int zeroes = 0;
    for (int i = 0; i < n; i++) {
      scanf("%lld", &arr[i]);
      if (arr[i] > 0) {
        pos++;
      } else if (arr[i] < 0) {
        neg++;
      } else {
        zeroes++;
      }
    }
    if (zeroes == n) {
      printf("Yes\n");
      continue;
    }
    if (zeroes > 0) {
      if (pos >= 2 || neg >= 2) {
        printf("No\n");
        continue;
      }
      neg = 0;
      pos = 0;
      long long temp1;
      long long temp2;
      for (int i = 0; i < n; i++) {
        if (arr[i] < 0) {
          neg = 1;
          temp1 = arr[i];
        } else if (arr[i] > 0) {
          pos = 1;
          temp2 = arr[i];
        }
      }
      if (neg == 1 && pos == 1 && temp1 != -temp2) {
        printf("No\n");
        continue;
      } else {
        printf("Yes\n");
        continue;
      }
    } else if (zeroes == 0) {
      if (pos >= 3 || neg >= 3) {
        printf("No\n");
        continue;
      }
    }
    int check = 0;
    int temp = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        for (int k = j + 1; k < n; k++) {
          long long sum = arr[i] + arr[j] + arr[k];
          for (int l = 0; l < n; l++) {
            if (sum == arr[l]) {
              check++;
              break;
            }
          }
          temp++;
        }
      }
    }
    if (check == temp) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
  }
  return 0;
}

fn solution() {
    let mut content = String::new();
    io::stdin()
        .read_to_string(&mut content)
        .expect("Unable to read from stdin");

    let mut lines = content.lines();
    let num_tests: usize = lines.next().unwrap().parse().unwrap();
    'test: for _ in 0..num_tests {
        let _n: usize = lines.next().unwrap().parse().unwrap();
        let a: Vec<i64> = lines
            .next()
            .unwrap()
            .split(" ")
            .map(|token| token.parse::<i64>().unwrap())
            .collect();
        let mut b: Vec<i64> = vec![];
        let mut positives = 0;
        let mut negatives = 0;
        let mut zeros = 0;
        for k in a {
            if k > 0 {
                if positives < 2 {
                    b.push(k);
                    positives += 1;
                } else {
                    println!("NO");
                    continue 'test;
                }
            } else if k < 0 {
                if negatives < 2 {
                    b.push(k);
                    negatives += 1;
                } else {
                    println!("NO");
                    continue 'test;
                }
            } else {
                if zeros == 0 {
                    b.push(k);
                    zeros += 1;
                }
            }
        }
        let c: HashSet<i64> = HashSet::from_iter(b.iter().cloned());

        for i in 0..b.len() {
            for j in i + 1..b.len() {
                for k in j + 1..b.len() {
                    if !c.contains(&(b[i] + b[j] + b[k])) {
                        println!("NO");
                        continue 'test;
                    }
                }
            }
        }

        println!("YES");
    }
}


This problem differs from the next one only in the presence of the constraint on the equal length of all numbers $$$a_1, a_2, \dots, a_n$$$. Actually, this problem is a subtask of the problem D2 from the same contest and the solution of D2 solves this subtask too.A team of SIS students is going to make a trip on a submarine. Their target is an ancient treasure in a sunken ship lying on the bottom of the Great Rybinsk sea. Unfortunately, the students don't know the coordinates of the ship, so they asked Meshanya (who is a hereditary mage) to help them. He agreed to help them, but only if they solve his problem.Let's denote a function that alternates digits of two numbers $$$f(a_1 a_2 \dots a_{p - 1} a_p, b_1 b_2 \dots b_{q - 1} b_q)$$$, where $$$a_1 \dots a_p$$$ and $$$b_1 \dots b_q$$$ are digits of two integers written in the decimal notation without leading zeros.In other words, the function $$$f(x, y)$$$ alternately shuffles the digits of the numbers $$$x$$$ and $$$y$$$ by writing them from the lowest digits to the older ones, starting with the number $$$y$$$. The result of the function is also built from right to left (that is, from the lower digits to the older ones). If the digits of one of the arguments have ended, then the remaining digits of the other argument are written out. Familiarize with examples and formal definitions of the function below.For example: $$$$$$f(1111, 2222) = 12121212$$$$$$ $$$$$$f(7777, 888) = 7787878$$$$$$ $$$$$$f(33, 44444) = 4443434$$$$$$ $$$$$$f(555, 6) = 5556$$$$$$ $$$$$$f(111, 2222) = 2121212$$$$$$Formally,  if $$$p \ge q$$$ then $$$f(a_1 \dots a_p, b_1 \dots b_q) = a_1 a_2 \dots a_{p - q + 1} b_1 a_{p - q + 2} b_2 \dots a_{p - 1} b_{q - 1} a_p b_q$$$;  if $$$p < q$$$ then $$$f(a_1 \dots a_p, b_1 \dots b_q) = b_1 b_2 \dots b_{q - p} a_1 b_{q - p + 1} a_2 \dots a_{p - 1} b_{q - 1} a_p b_q$$$. Mishanya gives you an array consisting of $$$n$$$ integers $$$a_i$$$. All numbers in this array are of equal length (that is, they consist of the same number of digits). Your task is to help students to calculate $$$\sum_{i = 1}^{n}\sum_{j = 1}^{n} f(a_i, a_j)$$$ modulo $$$998\,244\,353$$$.

int solution() {
  long long int n;
  long long int i;
  long long int cnt = 0;
  long long int count = 0;
  long long int flag = 0;
  long long int t = 0;
  long long int finalans = 0;
  scanf("%d", &n);
  long long int a[n];
  long long int r[100] = {0};
  long long int d[100] = {0};
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n; i++) {
    t = a[i];
    cnt = 49;
    while (t > 0) {
      d[cnt] += t % 10;
      t /= 10;
      cnt--;
    }
  }
  cnt = 49;
  for (i = 49; i > 0; i = i - 2) {
    if (cnt < 0) {
      break;
    }
    r[i] = (n * d[cnt]) + count;
    count = r[i] / 10;
    r[i] = r[i] % 10;
    r[i - 1] = (n * d[cnt]) + count;
    count = r[i - 1] / 10;
    r[i - 1] = r[i - 1] % 10;
    cnt--;
  }
  for (i = 0; i <= 49; i++) {
    if (r[i] != 0) {
      flag = 1;
    }
    if (flag == 1) {
      finalans = (finalans * 10 + r[i]) % 998244353;
    }
  }
  printf("%d", finalans);
  return 0;
}

fn solution() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();

    let n = get!();
    let md = 998244353;
    let mut ans = 0;
    for _ in 0..n {
        let mut x = get!();
        let mut p = 11;
        while x > 0 {
            let d = x % 10;
            x /= 10;
            ans += (p * d) % md;
            ans %= md;
            p *= 100;
            p %= md;
        }
    }
    let tmp = ans;
    for _ in 1..n {
        ans += tmp;
        ans %= md;
    }

    println!("{}", ans);
}


Score : <var>200</var> points

Problem Statement

There is a rectangle in the <var>xy</var>-plane, with its lower left corner at <var>(0, 0)</var> and its upper right corner at <var>(W, H)</var>. Each of its sides is parallel to the <var>x</var>-axis or <var>y</var>-axis. Initially, the whole region within the rectangle is painted white.

Snuke plotted <var>N</var> points into the rectangle. The coordinate of the <var>i</var>-th (<var>1 ≦ i ≦ N</var>) point was <var>(x_i, y_i)</var>.

Then, he created an integer sequence <var>a</var> of length <var>N</var>, and for each <var>1 ≦ i ≦ N</var>, he painted some region within the rectangle black, as follows:

If <var>a_i = 1</var>, he painted the region satisfying <var>x < x_i</var> within the rectangle.

If <var>a_i = 2</var>, he painted the region satisfying <var>x > x_i</var> within the rectangle.

If <var>a_i = 3</var>, he painted the region satisfying <var>y < y_i</var> within the rectangle.

If <var>a_i = 4</var>, he painted the region satisfying <var>y > y_i</var> within the rectangle.

Find the area of the white region within the rectangle after he finished painting.

Constraints

<var>1 ≦ W, H ≦ 100</var>

<var>1 ≦ N ≦ 100</var>

<var>0 ≦ x_i ≦ W</var> (<var>1 ≦ i ≦ N</var>)

<var>0 ≦ y_i ≦ H</var> (<var>1 ≦ i ≦ N</var>)

<var>W</var>, <var>H</var> (21:32, added), <var>x_i</var> and <var>y_i</var> are integers.

<var>a_i</var> (<var>1 ≦ i ≦ N</var>) is <var>1, 2, 3</var> or <var>4</var>.

Input

The input is given from Standard Input in the following format:

<var>W</var> <var>H</var> <var>N</var>
<var>x_1</var> <var>y_1</var> <var>a_1</var>
<var>x_2</var> <var>y_2</var> <var>a_2</var>
<var>:</var>
<var>x_N</var> <var>y_N</var> <var>a_N</var>

Output

Print the area of the white region within the rectangle after Snuke finished painting.

Sample Input 1

5 4 2
2 1 1
3 3 4

Sample Output 1

9

The figure below shows the rectangle before Snuke starts painting.

First, as <var>(x_1, y_1) = (2, 1)</var> and <var>a_1 = 1</var>, he paints the region satisfying <var>x < 2</var> within the rectangle:

Then, as <var>(x_2, y_2) = (3, 3)</var> and <var>a_2 = 4</var>, he paints the region satisfying <var>y > 3</var> within the rectangle:

Now, the area of the white region within the rectangle is <var>9</var>.

Sample Input 2

5 4 3
2 1 1
3 3 4
1 4 2

Sample Output 2

0

It is possible that the whole region within the rectangle is painted black.

Sample Input 3

10 10 5
1 6 1
4 1 3
6 9 4
9 4 2
3 1 3

Sample Output 3

64

fn solution() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();

    let whn: Vec<usize> = s.trim().split(' ').map(|x| x.parse().unwrap()).collect();

    let mut x1 = 0;
    let mut x2 = whn[0];
    let mut y1 = 0;
    let mut y2 = whn[1];

    for _ in 0..whn[2] {
        let mut s = String::new();
        io::stdin().read_line(&mut s).ok();

        let xya: Vec<usize> = s.trim().split(' ').map(|x| x.parse().unwrap()).collect();

        if xya[2] == 1 {
            x1 = cmp::max(x1, xya[0]);
        } else if xya[2] == 2 {
            x2 = cmp::min(x2, xya[0]);
        } else if xya[2] == 3 {
            y1 = cmp::max(y1, xya[1]);
        } else {
            y2 = cmp::min(y2, xya[1]);
        }
    }

    println!(
        "{}",
        if x1 < x2 && y1 < y2 {
            (x2 - x1) * (y2 - y1)
        } else {
            0
        }
    );
}


There are $$$n$$$ slimes in a row. Each slime has an integer value (possibly negative or zero) associated with it.Any slime can eat its adjacent slime (the closest slime to its left or to its right, assuming that this slime exists). When a slime with a value $$$x$$$ eats a slime with a value $$$y$$$, the eaten slime disappears, and the value of the remaining slime changes to $$$x - y$$$.The slimes will eat each other until there is only one slime left. Find the maximum possible value of the last slime.

int solution() {

  int n;
  scanf("%d", &n);
  int en;
  if (n == 1) {
    scanf("%d", &en);
    printf("%d\n", en);
  } else {
    long long sum = 0;
    int p;
    int ne;
    p = ne = 0;
    int mi = 1000000000;
    while (n--) {
      scanf("%d", &en);
      if (en > 0) {
        p = 1;
        if (en < mi) {
          mi = en;
        }
      } else if (en < 0) {
        en = -en;
        ne = 1;
        if (en < mi) {
          mi = en;
        }
      } else {
        p = ne = 1;
        mi = 0;
      }
      sum += en;
    }
    if (p && ne) {
      printf("%lld\n", sum);
    } else {
      printf("%lld\n", sum - (2 * mi));
    }
  }

  return 0;
}

fn solution() {
    let mut buffer = String::new();
    {
        let stdin = io::stdin();
        let mut handle = stdin.lock();
        handle.read_to_string(&mut buffer).unwrap();
    }

    let arr = buffer
        .split_whitespace()
        .map(|x| x.parse::<i64>().expect("convert to number"))
        .collect::<Vec<_>>();

    let n = arr[0];

    let arr2: Vec<_> = arr.into_iter().skip(1).collect();

    let pos = arr2.iter().all(|x| *x >= 0);
    let neg = arr2.iter().all(|x| *x <= 0);

    let mut ans = 0;

    if n == 1 {
        println!("{}", arr2[0]);
        return;
    }

    if pos {
        let aa = arr2.iter().min().unwrap();
        let s: i64 = arr2.iter().sum();
        ans = s - 2 * aa;
    } else if neg {
        let aa = arr2.iter().max().unwrap();
        let s: i64 = arr2.iter().sum();
        ans = 2 * aa - s;
    } else {
        ans = arr2.iter().map(|x| x.abs()).sum();
    }

    println!("{}", ans);
}


You are given a grid with $$$n$$$ rows and $$$m$$$ columns. We denote the square on the $$$i$$$-th ($$$1\le i\le n$$$) row and $$$j$$$-th ($$$1\le j\le m$$$) column by $$$(i, j)$$$ and the number there by $$$a_{ij}$$$. All numbers are equal to $$$1$$$ or to $$$-1$$$. You start from the square $$$(1, 1)$$$ and can move one square down or one square to the right at a time. In the end, you want to end up at the square $$$(n, m)$$$.Is it possible to move in such a way so that the sum of the values written in all the visited cells (including $$$a_{11}$$$ and $$$a_{nm}$$$) is $$$0$$$?

fn solution() {
    let mut buf = String::new();
    let stdin = io::stdin();

    let (mut n, mut m): (usize, usize);
    let mut grid: Vec<Vec<i32>> = vec![];
    let mut max_sums: Vec<Vec<i32>> = vec![];
    let mut min_sums: Vec<Vec<i32>> = vec![];

    stdin.read_line(&mut buf).expect("bruh");
    let tests: i32 = buf.trim().parse().unwrap();

    for _ in 0..tests {
        buf.clear();
        grid.clear();
        max_sums.clear();
        min_sums.clear();
        stdin.read_line(&mut buf).expect("bruh");
        n = buf.trim().split(' ').collect::<Vec<&str>>()[0]
            .parse()
            .unwrap();
        m = buf.trim().split(' ').collect::<Vec<&str>>()[1]
            .parse()
            .unwrap();

        for _ in 0..n {
            buf.clear();
            stdin.read_line(&mut buf).expect("bruh");

            grid.push(
                buf.trim()
                    .split(' ')
                    .map(|x| x.parse::<i32>().unwrap())
                    .collect(),
            );
            max_sums.push(Vec::new());
            min_sums.push(Vec::new());
        }

        max_sums[0].push(grid[0][0]);
        min_sums[0].push(grid[0][0]);

        for i in 0..n {
            for j in 0..m {
                if i == 0 && j == 0 {
                    continue;
                }

                max_sums[i].push(i32::MIN);
                min_sums[i].push(i32::MAX);

                if i != 0 {
                    max_sums[i][j] = cmp::max(max_sums[i][j], max_sums[i - 1][j] + grid[i][j]);
                    min_sums[i][j] = cmp::min(min_sums[i][j], min_sums[i - 1][j] + grid[i][j]);
                }

                if j != 0 {
                    max_sums[i][j] = cmp::max(max_sums[i][j], max_sums[i][j - 1] + grid[i][j]);
                    min_sums[i][j] = cmp::min(min_sums[i][j], min_sums[i][j - 1] + grid[i][j]);
                }
            }
        }

        if (n + m) % 2 != 0 && max_sums[n - 1][m - 1] >= 0 && min_sums[n - 1][m - 1] <= 0 {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}


Polycarp likes numbers that are divisible by 3.He has a huge number $$$s$$$. Polycarp wants to cut from it the maximum number of numbers that are divisible by $$$3$$$. To do this, he makes an arbitrary number of vertical cuts between pairs of adjacent digits. As a result, after $$$m$$$ such cuts, there will be $$$m+1$$$ parts in total. Polycarp analyzes each of the obtained numbers and finds the number of those that are divisible by $$$3$$$.For example, if the original number is $$$s=3121$$$, then Polycarp can cut it into three parts with two cuts: $$$3|1|21$$$. As a result, he will get two numbers that are divisible by $$$3$$$.Polycarp can make an arbitrary number of vertical cuts, where each cut is made between a pair of adjacent digits. The resulting numbers cannot contain extra leading zeroes (that is, the number can begin with 0 if and only if this number is exactly one character '0'). For example, 007, 01 and 00099 are not valid numbers, but 90, 0 and 10001 are valid.What is the maximum number of numbers divisible by $$$3$$$ that Polycarp can obtain?

fn solution() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();

    let s = get().as_bytes();

    let mut p1 = 0;
    let mut p2 = 0;
    let mut ans = 0;
    for i in 0..s.len() {
        let c = s[i] as u64;
        if c.is_multiple_of(3) {
            ans += 1;
            p1 = 0;
            p2 = 0;
        } else {
            if c % 3 == 1 {
                p1 += 1;
            } else {
                p2 += 1;
            }
            if p1 > 2 || p2 > 2 || (p1 > 0 && p2 > 0) {
                ans += 1;
                p1 = 0;
                p2 = 0;
            }
        }
    }
    println!("{}", ans);
}


You are given a string $$$s$$$ consisting only of lowercase Latin letters.You can rearrange all letters of this string as you wish. Your task is to obtain a good string by rearranging the letters of the given string or report that it is impossible to do it.Let's call a string good if it is not a palindrome. Palindrome is a string which is read from left to right the same as from right to left. For example, strings "abacaba", "aa" and "z" are palindromes and strings "bba", "xd" are not.You have to answer $$$t$$$ independent queries.

int solution() {
  int t;
  scanf("%d", &t);
  while (t--) {
    char str[1001];
    scanf("%s", str);
    int len = strlen(str);
    if (len == 1) {
      puts("-1");
    } else {
      int cnt[26];
      memset(cnt, 0, sizeof(cnt));
      for (int i = 0; str[i]; ++i) {
        ++cnt[str[i] - 'a'];
      }
      for (int i = 0; i < 26; ++i) {
        if (cnt[i] == len) {
          printf("-1");
          break;
        }
        for (int j = 0; j < cnt[i]; ++j) {
          putchar('a' + i);
        }
      }
      putchar('\n');
    }
  }
  return 0;
}

fn solution() {
    let mut reader = BufReader::new(io::stdin());

    let mut Tstr = String::new();
    reader.read_line(&mut Tstr);
    let T = Tstr.trim().parse::<i32>().unwrap();

    for _i in 0..T {
        let mut Qstr = String::new();
        reader.read_line(&mut Qstr);
        Qstr = Qstr.trim().to_string();
        if Qstr.len() == 1 {
            println!("-1")
        } else {
            let mut ok = true;
            for i in 1..Qstr.len() {
                ok &= Qstr.as_bytes()[i] == Qstr.as_bytes()[i - 1];
            }

            if ok {
                println!("-1");
            } else {
                let Qstr_slice: &str = &Qstr[..];

                let mut chars: Vec<char> = Qstr_slice.chars().collect();
                chars.sort_by(|a, b| b.cmp(a));

                let ans = String::from_iter(chars);
                println!("{}", ans);
            }
        }
    }
}


Score: <var>300</var> points

Problem Statement

Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.

A game is played by <var>N</var> players, numbered <var>1</var> to <var>N</var>. At the beginning of a game, each player has <var>K</var> points.

When a player correctly answers a question, each of the other <var>N-1</var> players receives minus one (<var>-1</var>) point. There is no other factor that affects the players' scores.

At the end of a game, the players with <var>0</var> points or lower are eliminated, and the remaining players survive.

In the last game, the players gave a total of <var>Q</var> correct answers, the <var>i</var>-th of which was given by Player <var>A_i</var>.
For Kizahashi, write a program that determines whether each of the <var>N</var> players survived this game.

Constraints

All values in input are integers.

<var>2 \leq N \leq 10^5</var>

<var>1 \leq K \leq 10^9</var>

<var>1 \leq Q \leq 10^5</var>

<var>1 \leq A_i \leq N\ (1 \leq i \leq Q)</var>

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>K</var> <var>Q</var>
<var>A_1</var>
<var>A_2</var>
<var>.</var>
<var>.</var>
<var>.</var>
<var>A_Q</var>

Output

Print <var>N</var> lines. The <var>i</var>-th line should contain Yes if Player <var>i</var> survived the game, and No otherwise.

Sample Input 1

6 3 4
3
1
3
2

Sample Output 1

No
No
Yes
No
No
No

In the beginning, the players' scores are <var>(3, 3, 3, 3, 3, 3)</var>.

Player <var>3</var> correctly answers a question. The players' scores are now <var>(2, 2, 3, 2, 2, 2)</var>.

Player <var>1</var> correctly answers a question. The players' scores are now <var>(2, 1, 2, 1, 1, 1)</var>.

Player <var>3</var> correctly answers a question. The players' scores are now <var>(1, 0, 2, 0, 0, 0)</var>.

Player <var>2</var> correctly answers a question. The players' scores are now <var>(0, 0, 1, -1, -1, -1)</var>.

Players <var>1, 2, 4, 5</var> and <var>6</var>, who have <var>0</var> points or lower, are eliminated, and Player <var>3</var> survives this game.

Sample Input 2

6 5 4
3
1
3
2

Sample Output 2

Yes
Yes
Yes
Yes
Yes
Yes

Sample Input 3

10 13 15
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9

Sample Output 3

No
No
No
No
Yes
No
No
No
Yes
No

int solution(void) {
  int score[200000] = {0};
  long N = 0;
  long K = 0;
  long Q = 0;
  scanf("%ld %ld %ld", &N, &K, &Q);
  for (long i = 0; i < Q; i++) {
    int A = 0;
    scanf("%d", &A);
    score[A - 1] += 1;
  }
  for (long i = 0; i < N; i++) {
    if (K - Q + score[i] <= 0) {
      printf("No\n");
    } else {
      printf("Yes\n");
    }
  }

  return 0;
}

fn solution() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let nkq = lines.next().unwrap().unwrap();
    let mut nkq = nkq.split_whitespace();
    let n: usize = nkq.next().unwrap().parse().unwrap();
    let k: i32 = nkq.next().unwrap().parse().unwrap();
    let q: i32 = nkq.next().unwrap().parse().unwrap();
    let mut a = vec![k - q; n + 1];
    for _ in 0..q {
        let i: usize = lines.next().unwrap().unwrap().parse().unwrap();
        a[i] += 1;
    }
    for &a_i in a.iter().skip(1) {
        if a_i > 0 {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size $$$1\times1$$$, Rainbow Dash has an infinite amount of light blue blocks, Fluttershy has an infinite amount of yellow blocks. The blocks are placed according to the following rule: each newly placed block must touch the built on the previous turns figure by a side (note that the outline borders of the grid are built initially). At each turn, one pony can place any number of blocks of her color according to the game rules.Rainbow and Fluttershy have found out that they can build patterns on the grid of the game that way. They have decided to start with something simple, so they made up their mind to place the blocks to form a chess coloring. Rainbow Dash is well-known for her speed, so she is interested in the minimum number of turns she and Fluttershy need to do to get a chess coloring, covering the whole grid with blocks. Please help her find that number!Since the ponies can play many times on different boards, Rainbow Dash asks you to find the minimum numbers of turns for several grids of the games.The chess coloring in two colors is the one in which each square is neighbor by side only with squares of different colors.

int solution() {
  int test_cases;
  scanf("%d", &test_cases);
  while (test_cases--) {
    int n = 0;
    scanf("%d", &n);
    printf("%d\n", (n / 2) + 1);
  }
}

fn solution() {
    let stdin = std::io::stdin();
    let mut handle = stdin.lock();
    let mut buf = String::new();
    handle.read_line(&mut buf).unwrap();
    let n: usize = buf.trim().parse().unwrap();
    for _q in 0..n {
        buf.clear();
        handle.read_line(&mut buf).unwrap();
        let m: usize = buf.trim().parse().unwrap();
        println!("{}", m / 2 + 1);
    }
}


Score : <var>800</var> points

Problem Statement

Takahashi has received an undirected graph with <var>N</var> vertices, numbered <var>1</var>, <var>2</var>, ..., <var>N</var>.
The edges in this graph are represented by <var>(u_i, v_i)</var>.
There are no self-loops and multiple edges in this graph.

Based on this graph, Takahashi is now constructing a new graph with <var>N^2</var> vertices, where each vertex is labeled with a pair of integers <var>(a, b)</var> (<var>1 \leq a \leq N</var>, <var>1 \leq b \leq N</var>).
The edges in this new graph are generated by the following rule:

Span an edge between vertices <var>(a, b)</var> and <var>(a', b')</var> if and only if both of the following two edges exist in the original graph: an edge between vertices <var>a</var> and <var>a'</var>, and an edge between vertices <var>b</var> and <var>b'</var>.

How many connected components are there in this new graph?

Constraints

<var>2 \leq N \leq 100,000</var>

<var>0 \leq M \leq 200,000</var>

<var>1 \leq u_i < v_i \leq N</var>

There exists no pair of distinct integers <var>i</var> and <var>j</var> such that <var>u_i = u_j</var> and <var>v_i = v_j</var>.

Input

The input is given from Standard Input in the following format:

<var>N</var> <var>M</var>
<var>u_1</var> <var>v_1</var>
<var>u_2</var> <var>v_2</var>
:
<var>u_M</var> <var>v_M</var>

Output

Print the number of the connected components in the graph constructed by Takahashi.

Sample Input 1

3 1
1 2

Sample Output 1

7

The graph constructed by Takahashi is as follows.

Sample Input 2

7 5
1 2
3 4
3 5
4 5
2 6

Sample Output 2

18

int solution() {
  int i;
  int N;
  int M;
  int u;
  int w;
  list *adj[100001] = {};
  list e[400001];
  scanf("%d %d", &N, &M);
  for (i = 0; i < M; i++) {
    scanf("%d %d", &u, &w);
    e[i * 2].v = w;
    e[(i * 2) + 1].v = u;
    e[i * 2].next = adj[u];
    e[(i * 2) + 1].next = adj[w];
    adj[u] = &(e[i * 2]);
    adj[w] = &(e[(i * 2) + 1]);
  }

  int iso = 0;
  int bip = 0;
  int nonbip = 0;
  int flag[100001] = {};
  int q[100001];
  int head;
  int tail;
  int tmp;
  list *p;
  for (i = 1; i <= N; i++) {
    if (flag[i] != 0) {
      continue;
    }

    flag[i] = 1;
    if (adj[i] == NULL) {
      iso++;
      continue;
    }

    q[0] = i;
    for (head = 0, tail = 1, tmp = 0; head < tail; head++) {
      u = q[head];
      for (p = adj[u]; p != NULL; p = p->next) {
        w = p->v;
        if (flag[w] == 0) {
          flag[w] = -flag[u];
          q[tail++] = w;
        } else if (flag[w] == flag[u]) {
          tmp = 1;
        }
      }
    }
    if (tmp != 0) {
      nonbip++;
    } else {
      bip++;
    }
  }

  printf("%lld\n", ((long long)iso * (N * 2 - iso)) +
                       ((long long)(bip + nonbip) * (bip + nonbip)) +
                       ((long long)bip * bip));
  fflush(stdout);
  return 0;
}

fn solution() {
    input!(n: usize, m: usize, uv: [(usize1, usize1); m]);
    let mut graph = vec![vec![]; n];
    for &(u, v) in uv.iter() {
        graph[u].push(v);
        graph[v].push(u);
    }

    let mut q = VecDeque::new();
    let mut vis = vec![0; n];
    let mut components = vec![];
    for i in 0..n {
        if vis[i] != 0 {
            continue;
        }
        let mut is_bipartite = true;
        let mut c = vec![];
        q.push_back(i);
        vis[i] = 1;
        c.push(i);
        while let Some(v) = q.pop_front() {
            for &next in graph[v].iter() {
                if vis[next] != 0 {
                    if vis[next] == vis[v] {
                        is_bipartite = false;
                    }
                    continue;
                }
                vis[next] = if vis[v] == 1 { 2 } else { 1 };
                q.push_back(next);
                c.push(next);
            }
        }

        components.push((c, is_bipartite));
    }

    let mut cnt_one = 0;
    let mut cnt_bipartite = 0;
    let mut cnt_other = 0;
    for &(ref c, is_bipartite) in components.iter() {
        if c.len() == 1 {
            cnt_one += 1;
        } else if is_bipartite {
            cnt_bipartite += 1;
        } else {
            cnt_other += 1;
        }
    }

    let mut ans = 0;
    ans += cnt_one * n * 2 - cnt_one * cnt_one;
    ans += cnt_bipartite * 2;
    ans += cnt_other;
    ans += cnt_bipartite * (cnt_bipartite - 1) * 2;
    ans += cnt_other * (cnt_other - 1);
    ans += cnt_other * cnt_bipartite * 2;
    println!("{}", ans);
}


Score : <var>100</var> points

Problem Statement

In the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.

In Taknese, the plural form of a noun is spelled based on the following rules:

If a noun's singular form does not end with s, append s to the end of the singular form.

If a noun's singular form ends with s, append es to the end of the singular form.

You are given the singular form <var>S</var> of a Taknese noun. Output its plural form.

Constraints

<var>S</var> is a string of length <var>1</var> between <var>1000</var>, inclusive.

<var>S</var> contains only lowercase English letters.

Input

Input is given from Standard Input in the following format:

<var>S</var>

Output

Print the plural form of the given Taknese word.

Sample Input 1

apple

Sample Output 1

apples

apple ends with e, so its plural form is apples.

Sample Input 2

bus

Sample Output 2

buses

bus ends with s, so its plural form is buses.

Sample Input 3

box

Sample Output 3

boxs

fn solution() {
    let mut word = String::new();
    stdin().read_line(&mut word).unwrap();

    if word.trim().ends_with("s") {
        println!("{}es", word.trim());
    } else {
        println!("{}s", word.trim());
    }
}


Kana was just an ordinary high school girl before a talent scout discovered her. Then, she became an idol. But different from the stereotype, she is also a gameholic. One day Kana gets interested in a new adventure game called Dragon Quest. In this game, her quest is to beat a dragon. The dragon has a hit point of $$$x$$$ initially. When its hit point goes to $$$0$$$ or under $$$0$$$, it will be defeated. In order to defeat the dragon, Kana can cast the two following types of spells.  Void Absorption Assume that the dragon's current hit point is $$$h$$$, after casting this spell its hit point will become $$$\left\lfloor \frac{h}{2} \right\rfloor + 10$$$. Here $$$\left\lfloor \frac{h}{2} \right\rfloor$$$ denotes $$$h$$$ divided by two, rounded down. Lightning Strike This spell will decrease the dragon's hit point by $$$10$$$. Assume that the dragon's current hit point is $$$h$$$, after casting this spell its hit point will be lowered to $$$h-10$$$.Due to some reasons Kana can only cast no more than $$$n$$$ Void Absorptions and $$$m$$$ Lightning Strikes. She can cast the spells in any order and doesn't have to cast all the spells. Kana isn't good at math, so you are going to help her to find out whether it is possible to defeat the dragon.

int solution() {
  int k;
  scanf("%d", &k);
  int b[k];
  int a[k];
  int c[k];

  for (int i = 0; i < k; i++) {
    int sum = 0;
    int flag = 0;
    scanf("%d", &a[i]);
    scanf("%d", &b[i]);
    scanf("%d", &c[i]);

    if (c[i] == 0) {
      printf("NO\n");
      continue;
    }
    if (c[i] == 1 && a[i] > 10) {
      printf("NO\n");
      continue;
    }
    sum = sum + c[i] * 10;
    if (a[i] <= sum) {
      printf("YES\n");
      continue;
    }
    for (int j = 0; j < b[i]; j++) {
      sum = sum - 10;
      sum = sum * 2 + 1;
      if (a[i] <= sum) {
        printf("YES\n");
        flag = 1;
        break;
      }
    }
    if (flag == 1) {
      continue;
    }

    if (a[i] > sum) {
      printf("NO\n");
    } else {
      printf("YES\n");
    }
  }
}

fn solution() {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let test: i64 = str.trim().parse().unwrap();
    for _ in 0..test {
        str.clear();
        let _ = stdin().read_line(&mut str).unwrap();
        let mut iter = str.split_whitespace();
        let mut health: i64 = iter.next().unwrap().parse().unwrap();
        let void: i64 = iter.next().unwrap().parse().unwrap();
        let lightning: i64 = iter.next().unwrap().parse().unwrap();
        for _ in 0..void {
            health = if health < 20 { health } else { health / 2 + 10 };
        }
        if health > 10 * lightning {
            println!("NO");
        } else {
            println!("YES");
        }
    }
}


This is a simplified version of the problem B2. Perhaps you should read the problem B2 before you start solving B1.Paul and Mary have a favorite string $$$s$$$ which consists of lowercase letters of the Latin alphabet. They want to paint it using pieces of chalk of two colors: red and green. Let's call a coloring of a string wonderful if the following conditions are met:  each letter of the string is either painted in exactly one color (red or green) or isn't painted;  each two letters which are painted in the same color are different;  the number of letters painted in red is equal to the number of letters painted in green;  the number of painted letters of this coloring is maximum among all colorings of the string which meet the first three conditions. E. g. consider a string $$$s$$$ equal to "kzaaa". One of the wonderful colorings of the string is shown in the figure.    The example of a wonderful coloring of the string "kzaaa". Paul and Mary want to learn by themselves how to find a wonderful coloring of the string. But they are very young, so they need a hint. Help them find $$$k$$$ — the number of red (or green, these numbers are equal) letters in a wonderful coloring.

fn solution() {
    let (i, o) = (io::stdin(), io::stdout());
    let mut o = bw::new(o.lock());
    for l in i.lock().lines().skip(1) {
        let mut h = std::collections::HashMap::new();
        for c in l.unwrap().chars() {
            h.entry(c).and_modify(|e| *e = 2).or_insert(1);
        }
        writeln!(o, "{}", h.values().sum::<i32>() / 2).ok();
    }
}


There is a $$$n \times m$$$ grid. You are standing at cell $$$(1, 1)$$$ and your goal is to finish at cell $$$(n, m)$$$.You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell $$$(x, y)$$$. You can:   move right to the cell $$$(x, y + 1)$$$ — it costs $$$x$$$ burles;  move down to the cell $$$(x + 1, y)$$$ — it costs $$$y$$$ burles. Can you reach cell $$$(n, m)$$$ spending exactly $$$k$$$ burles?

int solution() {
  int t;
  scanf("%d", &t);

  char *yes_str = "YES\n";
  char *no_str = "NO\n";

  char *yesOrNo_pStr[t];

  for (int i = 0; i < t; i++) {
    int n;
    int m;
    int k;
    scanf("%d%d%d", &n, &m, &k);

    yesOrNo_pStr[i] = no_str;
    if (n * m - 1 == k) {
      yesOrNo_pStr[i] = yes_str;
    }
  }
  for (int i = 0; i < t; i++) {
    printf("%s", yesOrNo_pStr[i]);
  }
}

fn solution() {
    let (i, o) = (io::stdin(), io::stdout());
    let mut o = bw::new(o.lock());
    for l in i.lock().lines().skip(1) {
        if let [n, m, k] = l
            .unwrap()
            .split(' ')
            .map(|w| w.parse::<u32>().unwrap())
            .collect::<Vec<_>>()[..]
        {
            writeln!(o, "{}", if n * m - 1 == k { "YES" } else { "NO" }).ok();
        }
    }
}


Score: <var>400</var> points

Problem statement

We have an <var>H \times W</var> grid whose squares are painted black or white. The square at the <var>i</var>-th row from the top and the <var>j</var>-th column from the left is denoted as <var>(i, j)</var>.

Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square <var>(1, 1)</var>. The player repeatedly moves Kenus up, down, left or right by one square. The game is completed when Kenus reaches square <var>(H, W)</var> passing only white squares.

Before Snuke starts the game, he can change the color of some of the white squares to black. However, he cannot change the color of square <var>(1, 1)</var> and <var>(H, W)</var>. Also, changes of color must all be carried out before the beginning of the game.

When the game is completed, Snuke's score will be the number of times he changed the color of a square before the beginning of the game. Find the maximum possible score that Snuke can achieve, or print <var>-1</var> if the game cannot be completed, that is, Kenus can never reach square <var>(H, W)</var> regardless of how Snuke changes the color of the squares.

The color of the squares are given to you as characters <var>s_{i, j}</var>. If square <var>(i, j)</var> is initially painted by white, <var>s_{i, j}</var> is .; if square <var>(i, j)</var> is initially painted by black, <var>s_{i, j}</var> is #.

Constraints

<var>H</var> is an integer between <var>2</var> and <var>50</var> (inclusive).

<var>W</var> is an integer between <var>2</var> and <var>50</var> (inclusive).

<var>s_{i, j}</var> is . or # <var>(1 \leq i \leq H, 1 \leq j \leq W)</var>.

<var>s_{1, 1}</var> and <var>s_{H, W}</var> are ..

Input

Input is given from Standard Input in the following format:

<var>H</var> <var>W</var>
<var>s_{1, 1}s_{1, 2}s_{1, 3} ... s_{1, W}</var>
<var>s_{2, 1}s_{2, 2}s_{2, 3} ... s_{2, W}</var>
 <var>:</var>   <var>:</var>
<var>s_{H, 1}s_{H, 2}s_{H, 3} ... s_{H, W}</var>

Output

Print the maximum possible score that Snuke can achieve, or print <var>-1</var> if the game cannot be completed.

Sample Input 1

3 3
..#
#..
...

Sample Output 1

2

The score <var>2</var> can be achieved by changing the color of squares as follows:

Sample Input 2

10 37
.....................................
...#...####...####..###...###...###..
..#.#..#...#.##....#...#.#...#.#...#.
..#.#..#...#.#.....#...#.#...#.#...#.
.#...#.#..##.#.....#...#.#.###.#.###.
.#####.####..#.....#...#..##....##...
.#...#.#...#.#.....#...#.#...#.#...#.
.#...#.#...#.##....#...#.#...#.#...#.
.#...#.####...####..###...###...###..
.....................................

Sample Output 2

209

fn solution() {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    let mut iter = input.split_whitespace();
    let h: usize = iter.next().unwrap().parse().unwrap();
    let w: usize = iter.next().unwrap().parse().unwrap();
    use std::iter::FromIterator;
    let f: Vec<&[u8]> = Vec::from_iter(iter.map(|s| s.as_bytes()));
    let mut c: usize = 0;
    for i in 0..h {
        for j in 0..w {
            if f[i][j] == 46 {
                c += 1;
            }
        }
    }
    let inf = 100000;
    let mut d: Vec<Vec<usize>> = vec![vec![inf; w]; h];
    use std::collections::VecDeque;
    let mut q: VecDeque<(usize, usize)> = VecDeque::new();
    d[0][0] = 1;
    q.push_back((0, 0));
    while !q.is_empty() {
        let (x, y) = q.pop_front().unwrap();
        let dist = d[x][y] + 1;
        let mut push = |x: usize, y: usize, dist: usize| {
            if f[x][y] == 46 && d[x][y] > dist {
                q.push_back((x, y));
                d[x][y] = dist;
            }
        };
        if y + 1 < w {
            push(x, y + 1, dist);
        }
        if x + 1 < h {
            push(x + 1, y, dist);
        }
        if 0 < y {
            push(x, y - 1, dist);
        }
        if 0 < x {
            push(x - 1, y, dist);
        }
    }
    if d[h - 1][w - 1] == inf {
        println!("-1")
    } else {
        println!("{}", c - d[h - 1][w - 1])
    }
}


Eshag has an array $$$a$$$ consisting of $$$n$$$ integers.Eshag can perform the following operation any number of times: choose some subsequence of $$$a$$$ and delete every element from it which is strictly larger than $$$AVG$$$, where $$$AVG$$$ is the average of the numbers in the chosen subsequence.For example, if $$$a = [1 , 4 , 3 , 2 , 4]$$$ and Eshag applies the operation to the subsequence containing $$$a_1$$$, $$$a_2$$$, $$$a_4$$$ and $$$a_5$$$, then he will delete those of these $$$4$$$ elements which are larger than $$$\frac{a_1+a_2+a_4+a_5}{4} = \frac{11}{4}$$$, so after the operation, the array $$$a$$$ will become $$$a = [1 , 3 , 2]$$$.Your task is to find the maximum number of elements Eshag can delete from the array $$$a$$$ by applying the operation described above some number (maybe, zero) times.A sequence $$$b$$$ is a subsequence of an array $$$c$$$ if $$$b$$$ can be obtained from $$$c$$$ by deletion of several (possibly, zero or all) elements.

int solution() {
  int t = 0;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    int n = 0;
    scanf("%d", &n);
    int a[n + 1];
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[j]);
    }
    a[n] = a[n - 1];
    int flag = 1;
    for (int j = 0; j < n; j++) {
      if (a[j] != a[j + 1]) {

        flag = 0;
        break;
      }
    }

    if (flag == 1) {
      printf("0\n");
    } else {

      for (int j = 0; j < n - 1; j++) {
        if (a[j] > a[j + 1]) {
          int temp = a[j];
          a[j] = a[j + 1];
          a[j + 1] = temp;
          j = -1;
        }
      }
      int count = 0;

      for (int j = 0; j < n; j++) {
        if (a[j] == a[0]) {
          count++;
        }
      }
      printf("%d\n", n - count);
    }
  }
  return 0;
}

fn solution() {
    let (i, o) = (io::stdin(), io::stdout());
    let mut o = bw::new(o.lock());
    for l in i.lock().lines().skip(2).step_by(2) {
        let (l, c, _) = l
            .unwrap()
            .split(' ')
            .map(|w| w.parse::<u32>().unwrap())
            .fold((0, 0, u32::MAX), |(l, c, m), x| {
                if x == m {
                    (l + 1, c + 1, m)
                } else if x < m {
                    (l + 1, 1, x)
                } else {
                    (l + 1, c, m)
                }
            });
        writeln!(o, "{}", l - c).ok();
    }
}


One day, Ahmed_Hossam went to Hemose and said "Let's solve a gym contest!". Hemose didn't want to do that, as he was playing Valorant, so he came up with a problem and told it to Ahmed to distract him. Sadly, Ahmed can't solve it... Could you help him?There is an Agent in Valorant, and he has $$$n$$$ weapons. The $$$i$$$-th weapon has a damage value $$$a_i$$$, and the Agent will face an enemy whose health value is $$$H$$$.The Agent will perform one or more moves until the enemy dies.In one move, he will choose a weapon and decrease the enemy's health by its damage value. The enemy will die when his health will become less than or equal to $$$0$$$. However, not everything is so easy: the Agent can't choose the same weapon for $$$2$$$ times in a row.What is the minimum number of times that the Agent will need to use the weapons to kill the enemy?

int solution() {
  long long int t;
  scanf("%lld", &t);
  while (t--) {
    long long int n;
    long long int h;

    long long int b = 0;
    long long int c = 0;
    scanf("%lld %lld", &n, &h);
    long long int a[n];
    for (long long int i = 0; i < n; i++) {
      scanf("%lld", &a[i]);
      if (a[i] > c) {
        if (a[i] > b) {
          c = b;
          b = a[i];
        } else {
          c = a[i];
        }
      }
    }
    if (h % (b + c) == 0) {
      printf("%lld\n", 2 * (h / (c + b)));
    } else if (h % (b + c) <= b) {
      printf("%lld\n", (2 * (h / (c + b))) + 1);
    } else {
      printf("%lld\n", (2 * (h / (c + b))) + 2);
    }
  }
  return 0;
}

fn solution() {
    let stdin = stdin();
    let mut string = String::new();
    stdin.read_line(&mut string).unwrap();
    for _ in 0..string.trim().parse::<usize>().unwrap() {
        string.clear();
        stdin.read_line(&mut string).unwrap();
        let enemy = string
            .split_ascii_whitespace()
            .last()
            .unwrap()
            .parse::<u64>()
            .unwrap();

        string.clear();
        stdin.read_line(&mut string).unwrap();

        let mut max = 0;
        let mut sec_max = 0;
        string
            .split_ascii_whitespace()
            .map(|f| {
                let n = f.parse::<u64>().unwrap();
                if n > max {
                    sec_max = max;
                    max = n
                } else {
                    sec_max = sec_max.max(n)
                }
            })
            .count();
        let base = enemy / (max + sec_max);

        let other = {
            if enemy != base * (max + sec_max) {
                let rest = enemy - base * (max + sec_max);
                if rest > max {
                    2
                } else {
                    1
                }
            } else {
                0
            }
        };
        println!("{}", base * 2 + other);
    }
}


You are given a binary string of length $$$n$$$ (i. e. a string consisting of $$$n$$$ characters '0' and '1').In one move you can swap two adjacent characters of the string. What is the lexicographically minimum possible string you can obtain from the given one if you can perform no more than $$$k$$$ moves? It is possible that you do not perform any moves at all.Note that you can swap the same pair of adjacent characters with indices $$$i$$$ and $$$i+1$$$ arbitrary (possibly, zero) number of times. Each such swap is considered a separate move.You have to answer $$$q$$$ independent test cases.

int solution() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long int n;
    long long int k;
    long long int c = 0;
    scanf("%lld%lld", &n, &k);
    char s[1000000] = {'\0'};
    int f = 0;
    scanf("%s", s);
    for (long long int i = 0; i < n; i++) {
      if (s[i] == '0' && f == 0) {
        if (k - i + c >= 0) {
          k = k - i + c;
        } else {
          c = i - k;
          f = 1;
        }
        s[i] = '1';
        s[c] = '0';
        c++;
      }
    }
    printf("%s\n", s);
  }
}

fn solution() {
    let stdin = stdin();
    let stdout = stdout();
    let mut input_line = String::new();
    stdin.read_line(&mut input_line).unwrap();
    let q = input_line.trim().parse::<i64>().unwrap();
    let mut b_string = String::new();

    for _ in 0..q {
        input_line.clear();
        stdin.read_line(&mut input_line).unwrap();
        let splited = input_line.split_whitespace().collect::<Vec<_>>();
        let n = splited[0].parse::<usize>().unwrap();
        let mut k = splited[1].parse::<i64>().unwrap();
        b_string.clear();
        stdin.read_line(&mut b_string).unwrap();
        let b_string = unsafe { b_string.as_mut_vec() };

        let mut last_nonzero = None;
        for idx in 0..n {
            if k <= 0 {
                break;
            };
            if b_string[idx] == b'0' {
                if let Some(l_nonzero) = last_nonzero {
                    let swap = std::cmp::min(k, (idx - l_nonzero) as i64);
                    k -= swap;
                    b_string[idx - swap as usize] = b'0';
                    b_string[idx] = b'1';
                    last_nonzero = Some(l_nonzero + 1);
                };
            } else if last_nonzero.is_none() {
                last_nonzero = Some(idx);
            }
        }
        stdout.lock().write(b_string).unwrap();
    }
}


A non-empty digit string is diverse if the number of occurrences of each character in it doesn't exceed the number of distinct characters in it.For example:   string "7" is diverse because 7 appears in it $$$1$$$ time and the number of distinct characters in it is $$$1$$$;  string "77" is not diverse because 7 appears in it $$$2$$$ times and the number of distinct characters in it is $$$1$$$;  string "1010" is diverse because both 0 and 1 appear in it $$$2$$$ times and the number of distinct characters in it is $$$2$$$;  string "6668" is not diverse because 6 appears in it $$$3$$$ times and the number of distinct characters in it is $$$2$$$. You are given a string $$$s$$$ of length $$$n$$$, consisting of only digits $$$0$$$ to $$$9$$$. Find how many of its $$$\frac{n(n+1)}{2}$$$ substrings are diverse.A string $$$a$$$ is a substring of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.Note that if the same diverse string appears in $$$s$$$ multiple times, each occurrence should be counted independently. For example, there are two diverse substrings in "77" both equal to "7", so the answer for the string "77" is $$$2$$$.

fn solution() {
    let mut buf = BufWriter::new(io::stdout().lock());
    io::stdin()
        .lines()
        .skip(2)
        .step_by(2)
        .flatten()
        .for_each(|s| {
            let t = s.as_bytes();
            let mut ans = 0usize;
            for i in 0..s.len() {
                let mut a = [0usize; 10];
                let mut cnt = 0usize;
                let mut m = 0usize;
                for &e in t.iter().skip(i) {
                    let d = usize::from(e.wrapping_sub(b'0'));
                    if a.get(d) == Some(&0) {
                        cnt = cnt.wrapping_add(1);
                    }
                    if let Some(f) = a.get_mut(d) {
                        *f = f.wrapping_add(1);
                        m = m.max(*f);
                    }
                    if m <= cnt {
                        ans = ans.wrapping_add(1);
                    }
                    if m >= 11 {
                        break;
                    }
                }
            }
            writeln!(buf, "{ans}").ok();
        });
}


Another Codeforces Round has just finished! It has gathered $$$n$$$ participants, and according to the results, the expected rating change of participant $$$i$$$ is $$$a_i$$$. These rating changes are perfectly balanced — their sum is equal to $$$0$$$.Unfortunately, due to minor technical glitches, the round is declared semi-rated. It means that all rating changes must be divided by two.There are two conditions though:   For each participant $$$i$$$, their modified rating change $$$b_i$$$ must be integer, and as close to $$$\frac{a_i}{2}$$$ as possible. It means that either $$$b_i = \lfloor \frac{a_i}{2} \rfloor$$$ or $$$b_i = \lceil \frac{a_i}{2} \rceil$$$. In particular, if $$$a_i$$$ is even, $$$b_i = \frac{a_i}{2}$$$. Here $$$\lfloor x \rfloor$$$ denotes rounding down to the largest integer not greater than $$$x$$$, and $$$\lceil x \rceil$$$ denotes rounding up to the smallest integer not smaller than $$$x$$$.  The modified rating changes must be perfectly balanced — their sum must be equal to $$$0$$$. Can you help with that?

int solution() {
  int i = 0;
  scanf("%d", &i);
  int ar[i];
  int ar2[i];
  int l = 0;
  while (l < i) {
    scanf("%d", &ar[l]);
    l++;
  }
  while (l >= 0) {
    ar2[l] = ar[l];
    ar[l] = ar[l] / 2;
    l--;
  }
  l = 0;
  while (l < i) {
    int k = ar2[l] % 2;
    int j = 0;
    int m = 0;
    while (j < i) {
      m = ar[j] + m;
      j++;
    }

    if (m == 0) {
      break;
    }
    if (k < 0) {
      ar[l] = ar[l] - 1;
    } else if (k > 0) {
      ar[l] = ar[l] + 1;
    }

    l++;
  }
  l = 0;
  while (l < i) {
    printf("%d\n", ar[l]);
    l++;
  }
  return (0);
}

fn solution() -> io::Result<()> {
    let stdin = io::stdin();
    let mut stdin = stdin.lock();
    let mut buf = String::new();

    stdin.read_line(&mut buf)?;

    let n: usize = buf.trim().parse().unwrap();

    let mut a = vec![0; n];
    for i in 0..n {
        buf.clear();
        stdin.read_line(&mut buf)?;
        a[i] = buf.trim().parse::<i32>().unwrap();
    }

    let mut n_odd = 0;
    a.iter().for_each(|ai| {
        if ai % 2 != 0 {
            n_odd += 1
        }
    });
    assert!(n_odd % 2 == 0);

    n_odd /= 2;

    let mut b = vec![0; n];
    for i in 0..n {
        if a[i] % 2 == 0 {
            b[i] = a[i] / 2;
        } else {
            b[i] = (a[i] - (a[i] % 2 + 2) % 2) / 2;
            if n_odd > 0 {
                n_odd -= 1;
                b[i] += 1;
            }
        }
    }

    let mut sum = 0;
    b.iter().for_each(|bi| sum += bi);

    assert_eq!(sum, 0);

    b.iter().for_each(|bi| println!("{}", bi));

    Ok(())
}


Score : <var>500</var> points

Problem Statement

We have <var>N</var> logs of lengths <var>A_1,A_2,\cdots A_N</var>.

We can cut these logs at most <var>K</var> times in total. When a log of length <var>L</var> is cut at a point whose distance from an end of the log is <var>t</var> <var>(0<t<L)</var>, it becomes two logs of lengths <var>t</var> and <var>L-t</var>.

Find the shortest possible length of the longest log after at most <var>K</var> cuts, and print it after rounding up to an integer.

Constraints

<var>1 \leq N \leq 2 \times 10^5</var>

<var>0 \leq K \leq 10^9</var>

<var>1 \leq A_i \leq 10^9</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>K</var>
<var>A_1</var> <var>A_2</var> <var>\cdots</var> <var>A_N</var>

Output

Print an integer representing the answer.

Sample Input 1

2 3
7 9

Sample Output 1

4

First, we will cut the log of length <var>7</var> at a point whose distance from an end of the log is <var>3.5</var>, resulting in two logs of length <var>3.5</var> each.

Next, we will cut the log of length <var>9</var> at a point whose distance from an end of the log is <var>3</var>, resulting in two logs of length <var>3</var> and <var>6</var>.

Lastly, we will cut the log of length <var>6</var> at a point whose distance from an end of the log is <var>3.3</var>, resulting in two logs of length <var>3.3</var> and <var>2.7</var>.

In this case, the longest length of a log will be <var>3.5</var>, which is the shortest possible result. After rounding up to an integer, the output should be <var>4</var>.

Sample Input 2

3 0
3 4 5

Sample Output 2

5

Sample Input 3

10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202

Sample Output 3

292638192

int solution(void) {

  long n;
  long k;
  scanf("%ld %ld", &n, &k);
  long a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  long ng = 0;
  long ok = 1000000000;
  long center;
  long cut;
  while (ng + 1 < ok) {
    center = (ng + ok) / 2;
    cut = 0;
    for (long i = 0; i < n; i++) {
      cut += (a[i] + center - 1) / center - 1;
    }
    if (cut <= k) {
      ok = center;
    } else {
      ng = center;
    }
  }
  printf("%ld\n", ok);

  return 0;
}

fn solution() {
    let (n, k): (usize, i64) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    let a: Vec<i64> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let iter = buf.split_whitespace();
        iter.map(|x| x.parse().unwrap()).collect()
    };

    let mut left = 0;
    let mut right = 1_000_000_000;
    while right - left > 1 {
        let mid = (left + right) / 2;
        let mut sum = 0;
        for i in 0..n {
            sum += (a[i] + mid - 1) / mid - 1;
        }
        if sum <= k {
            right = mid;
        } else {
            left = mid;
        }
    }
    println!("{}", right);
}


You are given two integers $$$a$$$ and $$$b$$$.In one move, you can choose some integer $$$k$$$ from $$$1$$$ to $$$10$$$ and add it to $$$a$$$ or subtract it from $$$a$$$. In other words, you choose an integer $$$k \in [1; 10]$$$ and perform $$$a := a + k$$$ or $$$a := a - k$$$. You may use different values of $$$k$$$ in different moves.Your task is to find the minimum number of moves required to obtain $$$b$$$ from $$$a$$$.You have to answer $$$t$$$ independent test cases.

int solution() {
  int t;
  int a;
  int b;
  scanf("%d", &t);

  for (int i = 0; i < t; i++) {
    int diff = 0;
    int quo = 0;
    int rem = 0;
    int moves = 0;
    scanf("%d %d", &a, &b);
    diff = abs(a - b);
    quo = diff / 10;
    rem = diff % 10;
    if (diff != 0 && rem != 0) {
      moves = quo + 1;
    }

    else {
      moves = quo;
    }
    printf("%d\n", moves);
  }
}

fn solution() {
    let mut st = String::new();
    io::stdin().read_line(&mut st).expect("1");
    let t: usize = st.trim().parse().expect("2");
    let mut ans = Vec::with_capacity(t);
    for _ in 0..t {
        let mut ab = String::new();
        io::stdin().read_line(&mut ab).expect("3");
        let mut c = ab.split_whitespace();
        let a: i64 = match c.next() {
            Some(e) => e.trim().parse().expect("4"),
            None => 0,
        };
        let b: i64 = match c.next() {
            Some(e) => e.trim().parse().expect("4"),
            None => 0,
        };
        ans.push(((a - b).abs() + 9) / 10)
    }
    println!(
        "{}",
        ans.iter()
            .map(|v| v.to_string())
            .collect::<Vec<_>>()
            .join("\n")
    )
}


(Please read problem A first. The maximum score you can get by solving this problem B is 1, which will have almost no effect on your ranking.)

Beginner's Guide

Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to check your understanding of the problem specification. Moreover, the source code of the score calculator can often be reused for solving the problem or debugging your solution. So it is worthwhile to write a score calculator unless it is very complicated.

Problem Statement

You will be given a contest schedule for <var>D</var> days.
For each <var>d=1,2,\ldots,D</var>, calculate the satisfaction at the end of day <var>d</var>.

Input

Input is given from Standard Input in the form of the input of Problem A followed by the output of Problem A.

<var>D</var>
<var>c_1</var> <var>c_2</var> <var>\cdots</var> <var>c_{26}</var>
<var>s_{1,1}</var> <var>s_{1,2}</var> <var>\cdots</var> <var>s_{1,26}</var>
<var>\vdots</var>
<var>s_{D,1}</var> <var>s_{D,2}</var> <var>\cdots</var> <var>s_{D,26}</var>
<var>t_1</var>
<var>t_2</var>
<var>\vdots</var>
<var>t_D</var>

The constraints and generation methods for the input part are the same as those for Problem A.

For each <var>d</var>, <var>t_d</var> is an integer satisfying <var>1\leq t_d \leq 26</var>, and your program is expected to work correctly for any value that meets the constraints.

Output

Let <var>v_d</var> be the satisfaction at the end of day <var>d</var>.
Print <var>D</var> integers <var>v_d</var> to Standard Output in the following format:

<var>v_1</var>
<var>v_2</var>
<var>\vdots</var>
<var>v_D</var>

Sample Input 1

5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13

Sample Output 1

18398
35037
51140
65837
79325

Note that this example is a small one for checking the problem specification. It does not satisfy the constraint <var>D=365</var> and is never actually given as a test case.

Next Step

We can build a solution (schedule) for this problem in the order of day 1, day 2, and so on. And for every partial solution we have built, we can calculate the goodness (satisfaction) by using the above score calculator. So we can construct the following algorithm: for each <var>d=1,2,\ldots,D</var>, we select the contest type that maximizes the satisfaction at the end of day <var>d</var>. You may have already encountered this kind of "greedy algorithms" in algorithm contests such as ABC. Greedy algorithms can guarantee the optimality for several problems, but unfortunately, it doesn't ensure optimality for this problem. However, even if it does not ensure optimality, we can still obtain a reasonable solution in many cases. Let's go back to Problem A and implement the greedy algorithm by utilizing the score calculator you just implemented!

Greedy methods can be applied to a variety of problems, are easy to implement, and often run relatively fast compared to other methods. Greedy is often the most powerful method when we need to process huge inputs.
We can further improve the score by changing the greedy selection criteria (evaluation function), keeping multiple candidates instead of focusing on one best partial solution (beam search), or using the output of greedy algorithms as an initial solution of other methods.
For more information, please refer to the editorial that will be published after the contest.

int solution(void) {

  int d;
  scanf("%d", &d);
  long c[26];
  for (int i = 0; i < 26; i++) {
    scanf("%ld", &c[i]);
  }
  long s[d][26];
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      scanf("%ld", &s[i][j]);
    }
  }
  int t[d];
  for (int i = 0; i < d; i++) {
    scanf("%d", &t[i]);
  }
  int last[26];
  for (int i = 0; i < 26; i++) {
    last[i] = -1;
  }
  long score = 0;
  for (int i = 0; i < d; i++) {
    score += s[i][t[i] - 1];
    last[t[i] - 1] = i;
    for (int j = 0; j < 26; j++) {
      if (j == t[i] - 1) {
        continue;
      }
      score -= c[j] * (i - last[j]);
    }
    printf("%ld\n", score);
  }

  return 0;
}

fn solution() {
    let d: usize = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().parse().unwrap()
    };
    let c: Vec<i64> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let iter = buf.split_whitespace();
        iter.map(|x| x.parse().unwrap()).collect()
    };
    let mut s: Vec<Vec<i64>> = Vec::with_capacity(d);
    for _ in 0..d {
        let a: Vec<i64> = {
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            let iter = buf.split_whitespace();
            iter.map(|x| x.parse().unwrap()).collect()
        };
        s.push(a);
    }
    let s = s;

    let mut ans: i64 = 0;
    let mut last: Vec<usize> = vec![0; 26];
    for i in 1..=d {
        let t: usize = {
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            buf.trim_end().parse::<usize>().unwrap() - 1
        };
        ans += s[i - 1][t];
        last[t] = i;
        for j in 0..26 {
            ans -= c[j] * ((i - last[j]) as i64);
        }
        println!("{}", ans);
    }
}


Boboniu likes bit operations. He wants to play a game with you.Boboniu gives you two sequences of non-negative integers $$$a_1,a_2,\ldots,a_n$$$ and $$$b_1,b_2,\ldots,b_m$$$.For each $$$i$$$ ($$$1\le i\le n$$$), you're asked to choose a $$$j$$$ ($$$1\le j\le m$$$) and let $$$c_i=a_i\& b_j$$$, where $$$\&$$$ denotes the bitwise AND operation. Note that you can pick the same $$$j$$$ for different $$$i$$$'s.Find the minimum possible $$$c_1 | c_2 | \ldots | c_n$$$, where $$$|$$$ denotes the bitwise OR operation.

int solution() {
  int n;
  int m;
  int i;
  int j;
  int k;
  int ans = 0;
  scanf("%d%d", &n, &m);
  int a[n];
  int b[m];
  int c[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%d", &b[i]);
  }
  int size = pow(2, 9) - 1;
  int arr[size];
  int arr_index = 0;
  for (i = 0; i <= size; i++) {
    int count = 0;
    for (j = 0; j < n; j++) {
      for (k = 0; k < m; k++) {
        if (((a[j] & b[k]) | i) == i) {
          count++;
          break;
        }
      }
    }
    if (count == n) {
      arr[arr_index] = i;
      arr_index++;
    }
  }
  ans = arr[0];
  printf("%d", ans);
  return 0;
}

fn solution() {
    let (n, m): (usize, usize) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    let a: Vec<usize> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let iter = buf.split_whitespace();
        iter.map(|x| x.parse().unwrap()).collect()
    };

    let b: Vec<usize> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let iter = buf.split_whitespace();
        iter.map(|x| x.parse().unwrap()).collect()
    };

    'outer: for x in 0..(1 << 9) {
        for i in 0..n {
            let mut ng = true;
            for j in 0..m {
                if x | (a[i] & b[j]) == x {
                    ng = false;
                    break;
                }
            }
            if ng {
                continue 'outer;
            }
        }
        println!("{}", x);
        return;
    }
}


Let's call an array $$$a$$$ consisting of $$$n$$$ positive (greater than $$$0$$$) integers beautiful if the following condition is held for every $$$i$$$ from $$$1$$$ to $$$n$$$: either $$$a_i = 1$$$, or at least one of the numbers $$$a_i - 1$$$ and $$$a_i - 2$$$ exists in the array as well.For example:   the array $$$[5, 3, 1]$$$ is beautiful: for $$$a_1$$$, the number $$$a_1 - 2 = 3$$$ exists in the array; for $$$a_2$$$, the number $$$a_2 - 2 = 1$$$ exists in the array; for $$$a_3$$$, the condition $$$a_3 = 1$$$ holds;  the array $$$[1, 2, 2, 2, 2]$$$ is beautiful: for $$$a_1$$$, the condition $$$a_1 = 1$$$ holds; for every other number $$$a_i$$$, the number $$$a_i - 1 = 1$$$ exists in the array;  the array $$$[1, 4]$$$ is not beautiful: for $$$a_2$$$, neither $$$a_2 - 2 = 2$$$ nor $$$a_2 - 1 = 3$$$ exists in the array, and $$$a_2 \ne 1$$$;  the array $$$[2]$$$ is not beautiful: for $$$a_1$$$, neither $$$a_1 - 1 = 1$$$ nor $$$a_1 - 2 = 0$$$ exists in the array, and $$$a_1 \ne 1$$$;  the array $$$[2, 1, 3]$$$ is beautiful: for $$$a_1$$$, the number $$$a_1 - 1 = 1$$$ exists in the array; for $$$a_2$$$, the condition $$$a_2 = 1$$$ holds; for $$$a_3$$$, the number $$$a_3 - 2 = 1$$$ exists in the array. You are given a positive integer $$$s$$$. Find the minimum possible size of a beautiful array with the sum of elements equal to $$$s$$$.

int solution() {
  int t;
  scanf("%d", &t);
  int output[t];
  for (int i = 0; i < t; i++) {
    int s;
    scanf("%d", &s);
    int j = 1;
    while (s >= j * j) {
      j++;
    }
    output[i] = j - 1;
    if (s - 2 * j + 3 && s - j * j + 2 * j - 1) {
      output[i] += 1;
    }
  }
  for (int i = 0; i < t; i++) {
    printf("%d\n", output[i]);
  }
}

fn solution() {
    let (i, o) = (io::stdin(), io::stdout());
    let mut o = bw::new(o.lock());
    for l in i.lock().lines().skip(1) {
        writeln!(o, "{}", l.unwrap().parse::<f32>().unwrap().sqrt().ceil()).ok();
    }
}