Given $N$ cow IDs in a line, find the longest contiguous group whose ID sum is a multiple of $7$, and print its length (number of cows). If no such group exists, print $0$.
Input
Line 1: $N$ ($1 \le N \le 50000$). Next $N$ lines: an ID each ($0 \le \text{ID} \le 10^6$).
Output
Print the length of the longest valid contiguous group.
Example 1
Input
7 3 5 1 6 2 14 10
Output
5
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.