---
# System prepended metadata

title: 13801 - Two Knights
tags: [bitwise]

---

# 13801 - Two Knights
>author: Utin
###### tags: `bitwise`

---

## Brief
See the code below

## Solution 0

```c=
#include <stdio.h>
#include <string.h>

int main() {
    int r, c;
    scanf("%d %d", &r, &c);
    int arr[30001];
    int input;
    for (int i = 0; i < r; i++) {
        arr[i] = 0;
        for (int j = 0; j < c; j++) {
            scanf("%d", &input);
            if (input == 1) arr[i] += 1;
            if (j != c-1) arr[i] = arr[i] << 1;
        }
    }

    int answer = 0;
    for (int i = 0; i < c; i++) {
        answer += 1;
        if (i != c-1) answer = answer << 1;
    }

    int number = 0;
    for (int i = 0; i < r-1; i++) {
        for (int j = i+1; j < r; j++) {
            if ((arr[i] | arr[j]) == answer) number += 1;
        }
    }

    printf("%d\n", number);
}
// By Utin
```

## Reference