Language: C++

#include <iostream>
#include <vector>
#include <tuple>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <functional>
#include <cstdint>
#define REP(i, n) for(ll i = 0; i < n; i++)

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s, s1;
  int k, l;
  cin >> k;
  cin >> s;
  l = s.length();

  if (l <= k){
    cout << s << endl;
  } else {
    s1 = s.substr(0,k) + "...";
    cout << s1 << endl;
  }

}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   17 |   cin.tie(0);
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:18:3: error: 'ios' has not been declared
   18 |   ios::sync_with_stdio(false);
      |   ^~~
a.cc:20:3: error: 'string' was not declared in this scope
   20 |   string s, s1;
      |   ^~~~~~
a.cc:20:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:23:10: error: 's' was not declared in this scope
   23 |   cin >> s;
      |          ^
a.cc:27:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |     cout << s << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:27:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   27 |     cout << s << endl;
      |                  ^~~~
      |                  std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:29:5: error: 's1' was not declared in this scope; did you mean 'y1'?
   29 |     s1 = s.substr(0,k) + "...";
      |     ^~
      |     y1
a.cc:30:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   30 |     cout << s1 << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:30:19: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   30 |     cout << s1 << endl;
      |                   ^~~~
      |                   std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~