B. Heaters ( Codeforces Round #515 (Div. 3) )

NoSuchKey