Just wanted to share this after watching many submissions for Ezzat and Two Subsequences TLEing because they used doubles.
Use
string s;
cin >> s;
double x = stod(s);
instead of
double x;
cin >> x;
Found this trick hidden in algo-lib template after we were wondering why https://codeforces.net/contest/1557/submission/125408355 is so fast even after using doubles.
In this problem you can also read the input as int and then cast it to double.