I am getting runtime error in this problem link: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=752
code: http://ideone.com/TFRDTu
it says "terminate called after throwing an instance of 'std::length_error' what(): vector::_M_fill_insert"
What does it mean and how to solve it TIA