You have an axis-aligned rectangle room with width $$$W$$$ and height $$$H$$$, so the lower left corner is in point $$$(0, 0)$$$ and the upper right corner is in $$$(W, H)$$$.There is a rectangular table standing in this room. The sides of the table are parallel to the walls, the lower left corner is in $$$(x_1, y_1)$$$, and the upper right corner in $$$(x_2, y_2)$$$.You want to place another rectangular table in this room with width $$$w$$$ and height $$$h$$$ with the width of the table parallel to the width of the room.The problem is that sometimes there is not enough space to place the second table without intersecting with the first one (there are no problems with tables touching, though).You can't rotate any of the tables, but you can move the first table inside the room.   Example of how you may move the first table. What is the minimum distance you should move the first table to free enough space for the second one?

int solution() {
  int test;
  scanf("%d", &test);
  float ans[test];
  for (int i = 0; i < test; i++) {
    int W;
    int H;
    int x1;
    int y1;
    int x2;
    int y2;
    int w;
    int h;
    scanf("%d%d%d%d%d%d%d%d", &W, &H, &x1, &y1, &x2, &y2, &w, &h);
    ans[i] = 100000000;
    if (W >= w + x2 - x1) {
      if (w - x1 <= 0 || x2 - W + w <= 0) {
        ans[i] = 0;
        continue;
      }
      if (ans[i] > w - x1) {
        ans[i] = w - x1;
      }
      if (ans[i] > x2 - W + w) {
        ans[i] = x2 - W + w;
      }
    }
    if (H >= h + y2 - y1) {
      if (h - y1 <= 0 || y2 - H + h <= 0) {
        ans[i] = 0;
        continue;
      }
      if (ans[i] > h - y1) {
        ans[i] = h - y1;
      }
      if (ans[i] > y2 - H + h) {
        ans[i] = y2 - H + h;
      }
    }
    if (W < w + x2 - x1 && H < h + y2 - y1) {
      ans[i] = -1;
    }
  }
  for (int i = 0; i < test; i++) {
    if (ans[i] == -1) {
      printf("%.0f\n", ans[i]);
      continue;
    }
    printf("%.9f\n", ans[i]);
  }
}

fn solution() {
    let mut t = String::new();
    io::stdin().read_line(&mut t).unwrap();
    let t: usize = t.trim().parse().unwrap();

    let mut line = String::new();
    for _t in 0..t {
        line.clear();
        io::stdin().read_line(&mut line).unwrap();
        let mut rw_rh = line.split_whitespace();
        let room_width: i64 = rw_rh.next().unwrap().parse().unwrap();
        let room_height: i64 = rw_rh.next().unwrap().parse().unwrap();

        line.clear();
        io::stdin().read_line(&mut line).unwrap();
        let mut ft = line.split_whitespace();
        let left_x: i64 = ft.next().unwrap().parse().unwrap();
        let bottom_y: i64 = ft.next().unwrap().parse().unwrap();
        let right_x: i64 = ft.next().unwrap().parse().unwrap();
        let top_y: i64 = ft.next().unwrap().parse().unwrap();
        let first_table_height = top_y - bottom_y;
        let first_table_width = right_x - left_x;

        line.clear();
        io::stdin().read_line(&mut line).unwrap();
        let mut st = line.split_whitespace();
        let table_width: i64 = st.next().unwrap().parse().unwrap();
        let table_height: i64 = st.next().unwrap().parse().unwrap();

        let mut min_distance: i64 = i64::MAX;
        let mut calc_min_distance = |dist| {
            if dist <= 0 {
                min_distance = 0;
            } else {
                min_distance = std::cmp::min(min_distance, dist);
            }
        };

        if table_height + first_table_height <= room_height {
            {
                let max_y = room_height - table_height;
                let dist = top_y - max_y;
                calc_min_distance(dist);
            }

            {
                let min_y = table_height;
                let dist = min_y - bottom_y;
                calc_min_distance(dist);
            }
        }

        if table_width + first_table_width <= room_width {
            {
                let max_x = room_width - table_width;
                let dist = right_x - max_x;
                calc_min_distance(dist);
            }

            {
                let min_x = table_width;
                let dist = min_x - left_x;
                calc_min_distance(dist);
            }
        }

        if min_distance == i64::MAX {
            println!("-1");
        } else {
            println!("{}", min_distance);
        }
    }
}


A/B Problem

Write a program which reads two integers <var>a</var> and <var>b</var>, and calculates the following values:

<var>a</var> ÷ <var>b</var>:  <var>d</var> (in integer)

remainder of <var>a</var> ÷ <var>b</var>:  <var>r</var> (in integer)

<var>a</var> ÷ <var>b</var>:  <var>f</var> (in real number)

Input

Two integers <var>a</var> and <var>b</var> are given in a line.

Output

Print <var>d</var>, <var>r</var> and <var>f</var> separated by a space in a line. For <var>f</var>, the output should not contain an absolute error greater than 10-5.

Constraints

 1 ≤ <var>a</var>, <var>b</var> ≤ 109

Sample Input 1

3 2

Sample Output 1

1 1 1.50000

int solution() {
  double x;
  double y;
  scanf("%lf %lf", &x, &y);
  printf("%.0lf %.0lf %.5lf\n", floor(x / y), x - (y * (int)(x / y)), x / y);
  return 0;
}

fn solution() {
    let scan = std::io::stdin();
    let mut line = String::new();
    let _ = scan.read_line(&mut line);
    let vec: Vec<&str> = line.split_whitespace().collect();
    let a: u32 = vec[0].parse().unwrap_or(0);
    let b: u32 = vec[1].parse().unwrap_or(0);
    println!("{} {} {:.5}", &(a / b), &(a % b), &(a as f64 / b as f64));
}


You are given an array $$$a$$$ consisting of $$$n$$$ ($$$n \ge 3$$$) positive integers. It is known that in this array, all the numbers except one are the same (for example, in the array $$$[4, 11, 4, 4]$$$ all numbers except one are equal to $$$4$$$).Print the index of the element that does not equal others. The numbers in the array are numbered from one.

fn solution() -> Result<(), Box<dyn Error>> {
    let stdin = std::io::stdin();
    let mut input = stdin.lock();

    let stdout = std::io::stdout();
    let mut output = stdout.lock();

    let mut buffer = String::with_capacity(32);

    input.read_line(&mut buffer)?;
    let tests = buffer.trim().parse::<u32>()?;

    for _ in 0..tests {
        buffer.clear();
        input.read_line(&mut buffer)?;

        buffer.clear();
        input.read_line(&mut buffer)?;

        let (mut c1, mut i1, mut v1) = (0_i32, 0, "");
        let (mut c2, mut i2, mut v2) = (0_i32, 0, "");

        for (idx, n) in buffer.split_ascii_whitespace().enumerate() {
            if n == v1 {
                c1 += 1;
            } else if n == v2 {
                c2 += 1;
            } else if c1 == 0 {
                c1 = 1;
                i1 = idx;
                v1 = n;
            } else if c2 == 0 {
                c2 = 1;
                i2 = idx;
                v2 = n;
            } else {
                c1 -= 1;
                c2 -= 1;
            }

            if c1 != 0 && c2 != 0 && c1.sub(c2).abs() >= 1 {
                let to_print = if c1 > c2 { i2 } else { i1 } + 1;
                writeln!(output, "{}", to_print)?;
                break;
            }
        }
    }

    Ok(())
}


Score : <var>300</var> points

Problem Statement

You are given a sequence of positive integers of length <var>N</var>, <var>a = (a_1, a_2, ..., a_N)</var>.
Your objective is to remove some of the elements in <var>a</var> so that <var>a</var> will be a good sequence.

Here, an sequence <var>b</var> is a good sequence when the following condition holds true:

For each element <var>x</var> in <var>b</var>, the value <var>x</var> occurs exactly <var>x</var> times in <var>b</var>.

For example, <var>(3, 3, 3)</var>, <var>(4, 2, 4, 1, 4, 2, 4)</var> and <var>()</var> (an empty sequence) are good sequences, while <var>(3, 3, 3, 3)</var> and <var>(2, 4, 1, 4, 2)</var> are not.

Find the minimum number of elements that needs to be removed so that <var>a</var> will be a good sequence.

Constraints

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

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

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

Input

Input is given from Standard Input in the following format:

<var>N</var>
<var>a_1</var> <var>a_2</var> <var>...</var> <var>a_N</var>

Output

Print the minimum number of elements that needs to be removed so that <var>a</var> will be a good sequence.

Sample Input 1

4
3 3 3 3

Sample Output 1

1

We can, for example, remove one occurrence of <var>3</var>. Then, <var>(3, 3, 3)</var> is a good sequence.

Sample Input 2

5
2 4 1 4 2

Sample Output 2

2

We can, for example, remove two occurrences of <var>4</var>. Then, <var>(2, 1, 2)</var> is a good sequence.

Sample Input 3

6
1 2 2 3 3 3

Sample Output 3

0

Sample Input 4

1
1000000000

Sample Output 4

1

Remove one occurrence of <var>10^9</var>. Then, <var>()</var> is a good sequence.

Sample Input 5

8
2 7 1 8 2 8 1 8

Sample Output 5

5

fn solution() {
    let si = io::stdin();
    let mut si = si.lock();
    si.read_until(b'\n', &mut Vec::new()).unwrap();
    println!(
        "{}",
        si.split(b' ')
            .map(|r| String::from_utf8(r.unwrap())
                .unwrap()
                .trim_end()
                .parse::<u32>()
                .unwrap())
            .fold(HashMap::new(), |mut map, a| {
                *map.entry(a).or_insert(0) += 1;
                map
            })
            .iter()
            .fold(0, |acc, (&a, &n)| acc + if n < a { n } else { n - a })
    );
}


Score : <var>500</var> points

Problem Statement

You are given two integer sequences <var>S</var> and <var>T</var> of length <var>N</var> and <var>M</var>, respectively, both consisting of integers between <var>1</var> and <var>10^5</var> (inclusive).

In how many pairs of a subsequence of <var>S</var> and a subsequence of <var>T</var> do the two subsequences are the same in content?

Here the subsequence of <var>A</var> is a sequence obtained by removing zero or more elements from <var>A</var> and concatenating the remaining elements without changing the order.

For both <var>S</var> and <var>T</var>, we distinguish two subsequences if the sets of the indices of the removed elements are different, even if the subsequences are the same in content.

Since the answer can be tremendous, print the number modulo <var>10^9+7</var>.

Constraints

<var>1 \leq N, M \leq 2 \times 10^3</var>

The length of <var>S</var> is <var>N</var>.

The length of <var>T</var> is <var>M</var>.

<var>1 \leq S_i, T_i \leq 10^5</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>N</var> <var>M</var>
<var>S_1</var> <var>S_2</var> <var>...</var> <var>S_{N-1}</var> <var>S_{N}</var>
<var>T_1</var> <var>T_2</var> <var>...</var> <var>T_{M-1}</var> <var>T_{M}</var>

Output

Print the number of pairs of a subsequence of <var>S</var> and a subsequence of <var>T</var> such that the subsequences are the same in content, modulo <var>10^9+7</var>.

Sample Input 1

2 2
1 3
3 1

Sample Output 1

3

<var>S</var> has four subsequences: <var>(), (1), (3), (1, 3)</var>.

<var>T</var> has four subsequences: <var>(), (3), (1), (3, 1)</var>.

There are <var>1 \times 1</var> pair of subsequences in which the subsequences are both <var>()</var>, <var>1 \times 1</var> pair of subsequences in which the subsequences are both <var>(1)</var>, and <var>1 \times 1</var> pair of subsequences in which the subsequences are both <var>(3)</var>, for a total of three pairs.

Sample Input 2

2 2
1 1
1 1

Sample Output 2

6

<var>S</var> has four subsequences: <var>(), (1), (1), (1, 1)</var>.

<var>T</var> has four subsequences: <var>(), (1), (1), (1, 1)</var>.

There are <var>1 \times 1</var> pair of subsequences in which the subsequences are both <var>()</var>, <var>2 \times 2</var> pairs of subsequences in which the subsequences are both <var>(1)</var>, and <var>1 \times 1</var> pair of subsequences in which the subsequences are both <var>(1,1)</var>, for a total of six pairs.
Note again that we distinguish two subsequences if the sets of the indices of the removed elements are different, even if the subsequences are the same in content.

Sample Input 3

4 4
3 4 5 6
3 4 5 6

Sample Output 3

16

Sample Input 4

10 9
9 6 5 7 5 9 8 5 6 7
8 6 8 5 5 7 9 9 7

Sample Output 4

191

Sample Input 5

20 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Sample Output 5

846527861

Be sure to print the number modulo <var>10^9+7</var>.


Score: <var>100</var> points

Problem Statement

M-kun is a competitor in AtCoder, whose highest rating is <var>X</var>.

In this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from <var>400</var> through <var>1999</var>, the following kyus are given:

From <var>400</var> through <var>599</var>: <var>8</var>-kyu

From <var>600</var> through <var>799</var>: <var>7</var>-kyu

From <var>800</var> through <var>999</var>: <var>6</var>-kyu

From <var>1000</var> through <var>1199</var>: <var>5</var>-kyu

From <var>1200</var> through <var>1399</var>: <var>4</var>-kyu

From <var>1400</var> through <var>1599</var>: <var>3</var>-kyu

From <var>1600</var> through <var>1799</var>: <var>2</var>-kyu

From <var>1800</var> through <var>1999</var>: <var>1</var>-kyu

What kyu does M-kun have?

Constraints

<var>400 \leq X \leq 1999</var>

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

Input

Input is given from Standard Input in the following format:

<var>X</var>

Output

Print the kyu M-kun has, as an integer.
For example, if he has <var>8</var>-kyu, print 8.

Sample Input 1

725

Sample Output 1

7

M-kun's highest rating is <var>725</var>, which corresponds to <var>7</var>-kyu.

Thus, 7 is the correct output.

Sample Input 2

1600

Sample Output 2

2

M-kun's highest rating is <var>1600</var>, which corresponds to <var>2</var>-kyu.

Thus, 2 is the correct output.


Score : <var>100</var> points

Problem Statement

There are three airports A, B and C, and flights between each pair of airports in both directions.

A one-way flight between airports A and B takes <var>P</var> hours, a one-way flight between airports B and C takes <var>Q</var> hours, and a one-way flight between airports C and A takes <var>R</var> hours.

Consider a route where we start at one of the airports, fly to another airport and then fly to the other airport.

What is the minimum possible sum of the flight times?

Constraints

<var>1 \leq P,Q,R \leq 100</var>

All values in input are integers.

Input

Input is given from Standard Input in the following format:

<var>P</var> <var>Q</var> <var>R</var>

Output

Print the minimum possible sum of the flight times.

Sample Input 1

1 3 4

Sample Output 1

4

The sum of the flight times in the route A <var>\rightarrow</var> B <var>\rightarrow</var> C: <var>1 + 3 = 4</var> hours

The sum of the flight times in the route A <var>\rightarrow</var> C <var>\rightarrow</var> C: <var>4 + 3 = 7</var> hours

The sum of the flight times in the route B <var>\rightarrow</var> A <var>\rightarrow</var> C: <var>1 + 4 = 5</var> hours

The sum of the flight times in the route B <var>\rightarrow</var> C <var>\rightarrow</var> A: <var>3 + 4 = 7</var> hours

The sum of the flight times in the route C <var>\rightarrow</var> A <var>\rightarrow</var> B: <var>4 + 1 = 5</var> hours

The sum of the flight times in the route C <var>\rightarrow</var> B <var>\rightarrow</var> A: <var>3 + 1 = 4</var> hours

The minimum of these is <var>4</var> hours.

Sample Input 2

3 2 3

Sample Output 2

5

int solution() {
  int a = 0;
  int b = 0;
  int c = 0;
  int menor = 0;
  scanf("%d%d%d", &a, &b, &c);
  if (c >= a && c >= b) {
    menor = a + b;
  } else if (a >= c && a >= b) {
    menor = c + b;
  } else if (b >= a && b >= c) {
    menor = a + c;
  }

  printf("%d\n", menor);

  return 0;
}

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


Being stuck at home, Ray became extremely bored. To pass time, he asks Lord Omkar to use his time bending power: Infinity Clock! However, Lord Omkar will only listen to mortals who can solve the following problem:You are given an array $$$a$$$ of $$$n$$$ integers. You are also given an integer $$$k$$$. Lord Omkar wants you to do $$$k$$$ operations with this array.Define one operation as the following:   Set $$$d$$$ to be the maximum value of your array.  For every $$$i$$$ from $$$1$$$ to $$$n$$$, replace $$$a_{i}$$$ with $$$d-a_{i}$$$. The goal is to predict the contents in the array after $$$k$$$ operations. Please help Ray determine what the final sequence will look like!

int solution() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    int n;
    long long k;
    scanf("%d %lld", &n, &k);
    int a[n];
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[j]);
    }

    int max = a[0];
    int min = a[0];
    for (int j = 1; j < n; j++) {
      if (max < a[j]) {
        max = a[j];
      }
      if (min > a[j]) {
        min = a[j];
      }
    }

    if (k & 1) {
      for (int j = 0; j < n; j++) {
        printf("%d ", max - a[j]);
      }
    } else {
      for (int j = 0; j < n; j++) {
        printf("%d ", a[j] - min);
      }
    }
    printf("\n");
  }
  return 0;
}

fn solution() {
    let reader = BufReader::new(stdin());
    let mut lines = reader.lines();
    let cases: usize = lines.next().unwrap().unwrap().parse().unwrap();
    let mut lines_take = lines.take(cases << 1);
    for _ in 0..cases {
        let info = lines_take.next().unwrap().unwrap();
        let mut info_sp = info.split_ascii_whitespace();
        let _n: usize = info_sp.next().unwrap().parse().unwrap();
        let mut k: u64 = info_sp.next().unwrap().parse().unwrap();
        let line = lines_take.next().unwrap().unwrap();
        let line_sp = line.split_ascii_whitespace();
        let mut arr: Vec<i64> = line_sp.map(|x| x.parse::<i64>().unwrap()).collect();
        let mut new_arr = arr.clone();
        arr.sort();
        let mut min = *arr.first().unwrap();
        if k % 2 == 1 {
            let max = *new_arr.iter().max().unwrap();
            for x in new_arr.iter_mut() {
                *x = max - *x;
            }
            k -= 1;
            min = 0;
        }

        if k == 0 {
            let mut iter = new_arr.iter();
            print!("{}", iter.next().unwrap());
            for x in iter {
                print!(" {}", x);
            }
            println!();
        } else {
            let mut iter = new_arr.iter();
            print!("{}", iter.next().unwrap() - min);
            for x in iter {
                print!(" {}", x - min);
            }
            println!();
        }
    }
}


Score : <var>400</var> points

Problem Statement

For a positive integer <var>X</var>, let <var>f(X)</var> be the number of positive divisors of <var>X</var>.

Given a positive integer <var>N</var>, find <var>\sum_{K=1}^N K\times f(K)</var>.

Constraints

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

Input

Input is given from Standard Input in the following format:

<var>N</var>

Output

Print the value <var>\sum_{K=1}^N K\times f(K)</var>.

Sample Input 1

4

Sample Output 1

23

We have <var>f(1)=1</var>, <var>f(2)=2</var>, <var>f(3)=2</var>, and <var>f(4)=3</var>, so the answer is <var>1\times 1 + 2\times 2 + 3\times 2 + 4\times 3 =23</var>.

Sample Input 2

100

Sample Output 2

26879

Sample Input 3

10000000

Sample Output 3

838627288460105

Watch out for overflows.

int solution(void) {
  long int n;
  scanf("%ld", &n);
  long int ans = 0;
  for (int i = 1; i <= n; i++) {
    long int now = n / i;
    ans += (now + 1) * now / 2 * i;
  }
  printf("%ld\n", ans);

  return 0;
}


Min, Max and Sum

Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.

Input

  In the first line, an integer $n$ is given. In the next line, $n$ integers $a_i$ are given in a line.

Output

  Print the minimum value, maximum value and sum in a line. Put a single space between the values.

Constraints

$0 < n \leq 10000$

$-1000000 \leq a_i \leq 1000000$

Sample Input

5
10 1 5 4 17

Sample Output

1 17 37

int solution(void) {
  int n = 0;
  int a = 0;
  int maximum = -1000000;
  int minimum = 1000000;
  long sum = 0;

  scanf("%d", &n);

  while (scanf("%d", &a) != EOF) {
    sum += a;
    if (a >= maximum) {
      maximum = a;
    }
    if (a <= minimum) {
      minimum = a;
    }
  }

  printf("%d %d %ld\n", minimum, maximum, sum);
}

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

    let _ = stdin.read_line(&mut buf);
    buf.clear();

    let _ = stdin.read_line(&mut buf);
    let vec: Vec<i64> = buf
        .split_whitespace()
        .map(|x| i64::from_str(x).unwrap())
        .collect();

    println!(
        "{} {} {}",
        vec.iter().min().unwrap(),
        vec.iter().max().unwrap(),
        vec.iter().sum::<i64>()
    );
}


After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum number of cars will the children need if all members of each group should ride in the same taxi (but one taxi can take more than one group)?

int solution() {

  long long int n;
  long long int count = 0;
  long long int a = 0;
  long long int b = 0;
  long long int c = 0;
  scanf("%lld", &n);
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
  }
  for (int i = 0; i < n; i++) {
    if (arr[i] == 4) {
      count++;
    }
    if (arr[i] == 3) {
      a++;
    }
    if (arr[i] == 1) {
      b++;
    }
    if (arr[i] == 2) {
      c++;
    }
  }
  count = count + a;
  if (b > a) {
    b = b - a;
    if (c % 2 == 0 && b % 4 == 0) {
      count = count + c / 2 + b / 4;
    } else if (c % 2 == 0 && b % 4 != 0) {
      count = count + c / 2 + b / 4 + 1;
    } else if (b <= 2 && c % 2 != 0) {
      count = count + c / 2 + c % 2;
    } else if ((b - 2) % 4 == 0 && b > 2 && c % 2 != 0) {
      count = count + c / 2 + c % 2 + (b - 2) / 4;
    } else {
      count = count + c / 2 + c % 2 + (b - 2) / 4 + 1;
    }
  } else {
    count = count + c / 2 + c % 2;
  }

  printf("%lld", count);

  return 0;
}

fn solution() {
    let mut _buffer = String::new();
    io::stdin()
        .read_line(&mut _buffer)
        .expect("failed to read input");
    let mut buffer = String::new();
    io::stdin()
        .read_line(&mut buffer)
        .expect("failed to read input");
    let nums = buffer
        .split_whitespace()
        .map(|n| n.parse::<usize>().unwrap())
        .collect::<Vec<usize>>();
    let mut num_groups = [0; 4];
    for i in nums {
        num_groups[i - 1] += 1;
    }
    let min13 = if num_groups[0] < num_groups[2] {
        num_groups[0]
    } else {
        num_groups[2]
    };
    let mut count = num_groups[3] + num_groups[1] / 2 + min13;
    num_groups[0] -= min13;
    num_groups[1] %= 2;
    num_groups[2] -= min13;
    if num_groups[0] != 0 {
        count += num_groups[0] / 4;
        num_groups[0] %= 4;

        if num_groups[1] != 0 {
            count += 1;
            num_groups[0] -= if num_groups[0] >= 2 { 2 } else { num_groups[0] };
        }

        if num_groups[0] != 0 {
            count += 1;
        }
    } else {
        if num_groups[1] != 0 {
            count += 1;
        }
        count += num_groups[2];
    }
    println!("{}", count);
}