Editorial for kim left for vin problem asked in COW (MNIT).

Please provide solution for this problem asked in COW conducted by MNIT(JAIPUR).

Link to Solution: VK Cup 2017 Round 1 and CF Round 405 — Editorial - Codeforces ,In the link 771D is the solution .