#include <bits/stdc++.h>
using namespace std;
constexpr int mod = 1e9 + 7, maxn = 2e6;
int N, M, p[1 << 10], buf[maxn];
template <bool t> struct line {
int *v;
int operator[](int y) const;
};
template <> int line<0>::operator[](int y) const { return v[y]; }
template <> int line<1>::operator[](int y) const { return v[M * y]; }
What is this operator thing? Is it a function? If it is then why does it have square brackets and "const" after it? Also do these template things mean? I'm assuming that it executes one of them depending on the value of t ( true or false )'