Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined)
A.BarktoUnlock#includeusingnamespacestd;#defineFor(i,n)for(inti=1;i=k;i--)#defineRep(i,n)for(inti=0;i=0;i--)#defineForp(x)for(intp=pre[x];p;p=next[p])#defineForpiter(x)for(int&p=iter[x];p;p=next[p])#d