Just to explain a bit more what the program does. In the first for loop, the program is opening 155 files, named from file0.txt to file154.txt (and writes a header line "File number #", this is not really needed, this was just a debugging mean of checking that the program does actually write correctly in all 155 files).
Then I read sequentially the input data file; for each line, I look for the locus and divide its value by 1000000 (integer division), which returns a range between 0 and 154. This range is then used to choose into which output file to print the current line.
Then there is a final for loop to close all the files.