#K42912. Count Valid Products

    ID: 27193 Type: Default 1000ms 256MiB

Count Valid Products

Count Valid Products

You are given N products, each of which is evaluated by Q binary quality checks. A product is considered valid if it passes at least P checks. In other words, if a product's checks are represented as binary values a1, a2, ..., aQ, then the product is valid if \(\sum_{i=1}^{Q}a_i \ge P\). Your task is to count the number of valid products.

Input: The first line contains three space-separated integers \(N\), \(Q\), and \(P\). The following N lines each contain Q integers (each either 0 or 1) representing the results of the binary quality checks for each product.

Output: Print a single integer denoting the number of valid products.

inputFormat

The input is given via standard input (stdin) and has the following format:

N Q P
a11 a12 ... a1Q
a21 a22 ... a2Q
...
aN1 aN2 ... aNQ

Where:

  • N is the number of products.
  • Q is the number of quality checks per product.
  • P is the minimum number of passing checks required for a product to be considered valid.

outputFormat

The output should be printed to standard output (stdout) and is a single integer representing the number of valid products.

## sample
3 4 3
1 0 1 1
0 0 1 1
1 1 1 1
2