Helper Programs for Topcoder Problems

Here is the code that I use when doing topcoder. I use the "FileEdit" editor, which copies the topcoder problem into a file in a directory that I specify. Poke around the topcoder web pages and you can learn how to do that. For the options -- here's a screen shot of what mine are.

Now, cd into that directory, and do the following:

UNIX> tar xpfv ~jplank/cs302/tchelpers.tar
q
qprocess.c
qpscript.sh
helpers.h
UNIX> gcc -I/home/plank/include -o qprocess qprocess.c /home/plank/lib/LINUX-X86_64/libfdr.a -lm
UNIX> 
When you first download a program from Topcoder, type q. For example, suppose I have just downloaded the NoEights program (SRM 355, D2, 550). I type q, and it will say:
UNIX> q
NoEights.cpp
UNIX> q
When I do a long listing, I see that it has created some new files:
UNIX> ls -l
-r-------- 1 plank loci  1049 2011-09-02 11:18 backup-NoEights.cpp
-rw-r--r-- 1 plank loci   865 2011-09-02 11:18 desc-NoEights.cpp.html
-rwxrwxrwx 1 plank loci   938 2011-09-02 11:11 helpers.h
-rw-r--r-- 1 plank loci   937 2011-09-02 11:18 junk-desc-backup.txt
-rw-r--r-- 1 plank loci   870 2011-09-02 11:18 junk.html
-rw-r--r-- 1 plank loci   568 2011-09-02 11:18 main.cpp
-rw-r--r-- 1 plank loci   732 2011-09-02 11:18 NoEights.cpp
-rwxr-xr-x 1 plank loci    69 2011-09-02 11:10 q
-rwxr-xr-x 1 plank loci 23969 2011-09-02 11:14 qprocess
-rwxrwxrwx 1 plank loci  6040 2011-09-02 11:12 qprocess.c
-rwxrwxrwx 1 plank loci   526 2010-09-26 13:34 qpscript.sh
UNIX> 
Ignore the junk files. The important files are:

If you call q on a file that you have edited already (let's say you've already worked on the topcoder problem, and you re-download it), it won't work. However, if you have the backup available, what you can do is: Move your intermediate version to another file, copy the backup to its original filename, chmod it to 0644, then call q again. It will complain that it can't write the backup, but that's not a problem. You have your main.cpp, and that's the important thing. Move your intermediate version back and you're ready to go.