I run my program using valgrind like this:
valgrind --leak-check=full ./a.out < in0.txt > out0.txt
and get the following output: