Did you edit your OP...? Don't do that, it just makes it more confusing for other people reading your post, and makes the people who reply to you look like lunatics.
You're compiling in C++98 (i.e. the original standard). Functions like stoi and stod, and "for each" loops were not in the language until C++11 (finalized basically a decade ago at this point).
Are you using the Windows version of g++? Try to enable -std=c++11 to your command-line arguments.
Also, turning on warnings like at least -Wall is suggested.