The Blocks Problem from UVa Online Judge (101) implemented in C++ (without classes)