usaco: beads implementation in ansic, O(n^2)

TODO: in C++11 try to make it O(n)

Signed-off-by: Rohit Yadav <bhaisaab@baagi.org>