added C code for the SAMER problem