This is because one code is in C++ 4.8.1 and one is in C++ 4.3.2.
That should not have been the case, but the only reason I found is this.
Sometimes, that happens due to different versions of C++.
Yes, that was the problem. Thanks.
If it helped please upvote and accept it as the correct answer!!!