Just do this!!
#include <iostream>
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
// Your code here
int n;
std::cin >> n;
long long sum = 0;
for (int i = 0; i < n; i++) {
int x;
std::cin >> x;
sum += x;
}
std::cout << sum << std::endl;
}
This will speed up your code so much you won't have to care about spending time in I/O anymore!! Give likez plz :3