Language: C++

#include <iostream>
#include <vector>
#include <stdio.h>
#include <string>
#include <sstream>
#include <istream>
#include <numeric>

using namespace std;

int main(){
    int n;
    cin >> n;

    string x;//２行目
    cin >> x;

    vector<int> spot;

    string tmp;//スペースで区切ったxを格納
    int it;//tmpをintに
    while(getline(x,tmp," ")){
        it = stoi(tmp);
        spot.push_back(it);
    }
    int sum = accumulate(spot.begin(),spot.end(),0);

    for(int i=0; i<n; i++){
        sum = sum - spot[i];
        cout << sum << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: no matching function for call to 'getline(std::string&, std::string&, const char [2])'
   22 |     while(getline(x,tmp," ")){
      |           ~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/string:55,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.tcc:907:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
  907 |     getline(basic_istream<_CharT, _Traits>& __in,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:907:5: note:   template argument deduction/substitution failed:
a.cc:22:18: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   22 |     while(getline(x,tmp," ")){
      |           ~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:4117:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 4117 |     getline(basic_istream<_CharT, _Traits>& __is,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4117:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:4125:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
 4125 |     getline(basic_istream<_CharT, _Traits>&& __is,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4125:5: note:   template argument deduction/substitution failed:
a.cc:22:18: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   22 |     while(getline(x,tmp," ")){
      |           ~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4132:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 4132 |     getline(basic_istream<_CharT, _Traits>&& __is,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4132:5: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154:
/usr/include/stdio.h:697:18: note: candidate: '__ssize_t getline(char**, size_t*, FILE*)'
  697 | extern __ssize_t getline (char **__restrict __lineptr,
      |                  ^~~~~~~
/usr/include/stdio.h:697:45: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char**'
  697 | extern __ssize_t getline (char **__restrict __lineptr,
      |                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~