#include <iostream>
#include <vector>
int main(){
static const int Target = 2014;
std::vector<std::pair<int, int>> vec;
std::size_t Val = 0;
int T = (Target / 5 * 3);
for (int i = 0; i < T; i++){
Val = 0;
for (int j = i; j < T; j++){
Val += j;
if (Val == Target) vec.push_back(std::make_pair(i, j));
if (Val>Target)break;
}
}
std::cout << "I found " << vec.size() << " count!!" << std::endl;
for (auto& o : vec){
std::cout << o.first << " to " << o.second << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKaW50IG1haW4oKXsKCglzdGF0aWMgY29uc3QgaW50IFRhcmdldCA9IDIwMTQ7CglzdGQ6OnZlY3RvcjxzdGQ6OnBhaXI8aW50LCBpbnQ+PiB2ZWM7CglzdGQ6OnNpemVfdCBWYWwgPSAwOwoJaW50IFQgPSAoVGFyZ2V0IC8gNSAqIDMpOwoKCWZvciAoaW50IGkgPSAwOyBpIDwgVDsgaSsrKXsKCQlWYWwgPSAwOwoJCWZvciAoaW50IGogPSBpOyBqIDwgVDsgaisrKXsKCQkJVmFsICs9IGo7CgkJCWlmIChWYWwgPT0gVGFyZ2V0KSB2ZWMucHVzaF9iYWNrKHN0ZDo6bWFrZV9wYWlyKGksIGopKTsKCQkJaWYgKFZhbD5UYXJnZXQpYnJlYWs7CgkJfQoJfQoKCXN0ZDo6Y291dCA8PCAiSSBmb3VuZCAiIDw8IHZlYy5zaXplKCkgPDwgIiBjb3VudCEhIiA8PCBzdGQ6OmVuZGw7CgoJZm9yIChhdXRvJiBvIDogdmVjKXsKCQlzdGQ6OmNvdXQgPDwgby5maXJzdCA8PCAiIHRvICIgPDwgby5zZWNvbmQgPDwgc3RkOjplbmRsOwoJfQoKCXJldHVybiAwOwp9