Language: C++

#include<iostream>
#include<algorithm>
include<cstdio>
#include<sstream>
#include<vector>
#include<cmath>
using namespace std;

bool check(int n)
{
  stringstream ss;
  ss << n;
  string s = ss.str();
  string rs(s.rbegin(),s.rend());
  return s == rs;
}

int main()
{
  vector<int> vec;
  for(int i=1;i<=10000;i++)
    if(check(i))
      vec.push_back(i);
      
  int n;
  cin >> n;
  vector<int>::iterator it = lower_bound(vec.begin(),vec.end(),n);
  if(*it == n)
    cout << n << endl;
  else if(abs(*(it-1)-n) == abs((*it)-n))
    cout << *(it-1) << endl;
  else 
    (abs(*(it-1)-n) < abs((*it)-n))?cout << *(it-1) << endl:cout << (*it) << endl;
  return 0;
}

Compiler output:
a.cc:3:1: error: 'include' does not name a type
    3 | include<cstdio>
      | ^~~~~~~
In file included from /usr/include/c++/14/sstream:1238,
                 from a.cc:4:
/usr/include/c++/14/bits/sstream.tcc:46:15: error: template definition of non-template 'typename std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::int_type std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::pbackfail'
   46 |     pbackfail(int_type __c)
      |               ^~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:46:15: error: 'int_type' was not declared in this scope
/usr/include/c++/14/bits/sstream.tcc:80:14: error: template definition of non-template 'typename std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::int_type std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::overflow'
   80 |     overflow(int_type __c)
      |              ^~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:80:14: error: 'int_type' was not declared in this scope
/usr/include/c++/14/bits/sstream.tcc:150:15: error: invalid use of incomplete type 'class std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>'
  150 |     underflow()
      |               ^
In file included from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/iosfwd:98:11: note: declaration of 'class std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>'
   98 |     class basic_stringbuf;
      |           ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:168:13: error: template definition of non-template 'typename std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::seekoff'
  168 |     seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
      |             ^~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:168:13: error: 'off_type' was not declared in this scope; did you mean 'off_t'?
  168 |     seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
      |             ^~~~~~~~
      |             off_t
/usr/include/c++/14/bits/sstream.tcc:168:47: error: expected primary-expression before '__way'
  168 |     seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
      |                                               ^~~~~
/usr/include/c++/14/bits/sstream.tcc:168:73: error: expected primary-expression before '__mode'
  168 |     seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
      |                                                                         ^~~~~~
/usr/include/c++/14/bits/sstream.tcc:216:13: error: template definition of non-template 'typename std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::seekpos'
  216 |     seekpos(pos_type __sp, ios_base::openmode __mode)
      |             ^~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:216:13: error: 'pos_type' was not declared in this scope
/usr/include/c++/14/bits/sstream.tcc:216:47: error: expected primary-expression before '__mode'
  216 |     seekpos(pos_type __sp, ios_base::openmode __mode)
      |                                               ^~~~~~
/usr/include/c++/14/bits/sstream.tcc:245:5: error: variable or field '_M_sync' declared void
  245 |     basic_stringbuf<_CharT, _Traits, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:246:13: error: 'char_type' was not declared in this scope
  246 |     _M_sync(char_type* __base, __size_type __i, __size_type __o)
      |             ^~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:246:24: error: '__base' was not declared in this scope; did you mean 'ios_base'?
  246 |     _M_sync(char_type* __base, __size_type __i, __size_type __o)
      |                        ^~~~~~
      |                        ios_base
/usr/include/c++/14/bits/sstream.tcc:246:32: error: '__size_type' was not declared in this scope; did you mean '__true_type'?
  246 |     _M_sync(char_type* __base, __size_type __i, __size_type __o)
      |                                ^~~~~~~~~~~
      |                                __true_type
/usr/include/c++/14/bits/sstream.tcc:246:49: error: '__size_type' was not declared in this scope; did you mean '__true_type'?
  246 |     _M_sync(char_type* __base, __size_type __i, __size_type __o)
      |                                                 ^~~~~~~~~~~
      |                                                 __true_type
/usr/include/c++/14/bits/sstream.tcc:276:5: error: variable or field '_M_pbump' declared void
  276 |     basic_stringbuf<_CharT, _Traits, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:277:14: error: 'char_type' was not declared in this scope
  277 |     _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off)
      |              ^~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:277:25: error: '__pbeg' was not declared in this scope; did you mean '_S_beg'?
  277 |     _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off)
      |                         ^~~~~~
      |                         _S_beg
/usr/include/c++/14/bits/sstream.tcc:277:33: error: 'char_type' was not declared in this scope
  277 |     _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off)
      |                                 ^~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:277:44: error: '__pend' was not declared in this scope; did you mean '__pad'?
  277 |     _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off)
      |                                            ^~~~~~
      |                                            __pad
/usr/include/c++/14/bits/sstream.tcc:277:52: error: 'off_type' was not declared in this scope; did you mean 'off_t'?
  277 |     _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off)
      |                                                    ^~~~~~~~
      |                                                    off_t
/usr/include/c++/14/bits/sstream.tcc:291:25: error: explicit instantiation of 'class std::__cxx11::basic_stringbuf<char>' before definition of template
  291 |   extern template class basic_stringbuf<char>;
      |                         ^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:292:25: error: explicit instantiation of 'class std::__cxx11::basic_istringstream<char>' before definition of template
  292 |   extern template class basic_istringstream<char>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:293:25: error: explicit instantiation of 'class std::__cxx11::basic_ostringstream<char>' before definition of template
  293 |   extern template class basic_ostringstream<char>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:294:25: error: explicit instantiation of 'class std::__cxx11::basic_stringstream<char>' before definition of template
  294 |   extern template class basic_stringstream<char>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:297:25: error: explicit instantiation of 'class std::__cxx11::basic_stringbuf<wchar_t>' before definition of template
  297 |   extern template class basic_stringbuf<wchar_t>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:298:25: error: explicit instantiation of 'class std::__cxx11::basic_istringstream<wchar_t>' before definition of template
  298 |   extern template class basic_istringstream<wchar_t>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:299:25: error: explicit instantiation of 'class std::__cxx11::basic_ostringstream<wchar_t>' before definition of template
  299 |   extern template class basic_ostringstream<wchar_t>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/sstream.tcc:300:25: error: explicit instantiation of 'class std::__cxx11::basic_stringstream<wchar_t>' before definition of template
  300 |   extern template class basic_stringstream<wchar_t>;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'bool check(int)':
a.cc:11:16: error: aggregate 'std::stringstream ss' has incomplete type and cannot be defined
   11 |   stringstream ss;
      |                ^~