I have just submitted my solutions to 691D - Swaps in Permutation from Educational Codeforces Round 14. They are 19226396, 19226642 and 19226815.
Test #2 is
1 1
1
1 1
I ran my solutions on my machine, compiled with standard command line (g++.exe -static -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE -lm -s -x c++ -Wl,--stack=268435456 -O2 -o D.exe D.cpp
). They all output 1. However, they all got RTE on Codeforces online judging system.
Is there a bug on Codeforces or are my solutions wrong?
I am getting a segmentation fault while running your first submission on Test #2. Please check your program for memory corruption.
I don't think my algorithm is wrong because I reran all of my submissions on both Ubuntu and Windows but found nothing wrong.