Your code runs in 0.89 seconds on C++14 and in 1.02 seconds on C++17. This amount of difference is not surprising, and is in no way evidence that C++17 is slower in general. There are definitely many codes which run slightly faster in C++17 than in C++14.
I checked your submissions for both c++14 & 17. As of now both are AC. Did you changed the links? Also the c++17 submission is faster in given link. for c++14 - 0.89secs while c++17 - 0.39secs. I am reading this on 2 May like after 3 months past the original post. How does the submission status is changed I dont understand. ;(