[tutorial:919A]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797612) (C++ version)↵
↵
[tutorial:919B]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797624) (C++ version)↵
↵
[Code](http://codeforces.me/contest/919/submission/34797628) (Python version)↵
↵
[tutorial:919C]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797644) (C++ version)↵
↵
[Code](http://codeforces.me/contest/919/submission/34797654) (Python version)↵
↵
[tutorial:919D]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797673) (C++ version)↵
↵
[tutorial:919E]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797680) (C++ version)↵
↵
[tutorial:919F]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797700) (My stupid solution: C++ version)↵
↵
[Code](http://codeforces.me/contest/919/submission/34797694) ([user:demon1999,2018-02-01]'s fast solution: C++11 version)↵
↵
**UPD1:** Note that the editorial of problem E is modified with some correction. Sorry for that inconvenience.↵
↵
**UPD2:** The editorial is complete now. Hope you find it useful. :P↵
↵
**UPD3:** It's seems that all bonus questions can be found in the comments. :) Don't hesitate to give them an upvote. :P↵
↵
**UPD4:** The editorial is updated.
↵
[Code](http://codeforces.me/contest/919/submission/34797612) (C++ version)↵
↵
[tutorial:919B]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797624) (C++ version)↵
↵
[Code](http://codeforces.me/contest/919/submission/34797628) (Python version)↵
↵
[tutorial:919C]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797644) (C++ version)↵
↵
[Code](http://codeforces.me/contest/919/submission/34797654) (Python version)↵
↵
[tutorial:919D]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797673) (C++ version)↵
↵
[tutorial:919E]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797680) (C++ version)↵
↵
[tutorial:919F]↵
↵
[Code](http://codeforces.me/contest/919/submission/34797700) (My stupid solution: C++ version)↵
↵
[Code](http://codeforces.me/contest/919/submission/34797694) ([user:demon1999,2018-02-01]'s fast solution: C++11 version)↵
↵
**UPD1:** Note that the editorial of problem E is modified with some correction. Sorry for that inconvenience.↵
↵
**UPD2:** The editorial is complete now. Hope you find it useful. :P↵
↵
**UPD3:** It's seems that all bonus questions can be found in the comments. :) Don't hesitate to give them an upvote. :P↵
↵
**UPD4:** The editorial is updated.