Language: C++

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

struct ST_STR
{
    ST_STR( const std::string& a ):m_string(a){};
    std::string m_string;
};

bool cmp(const ST_STR &a, const ST_STR &b)
{
    return a.m_string.compare(b.m_string)<0;
}

int main(int argc, char* argv[])
{
    char str[5001]={0};
    scanf("%s", str);
    long len=strlen(str);
    
    long k;
    scanf("%ld", &k);

    vector<ST_STR> vv;

    long i;
    for(i=0; i<len; i++) {
        char tmp[6]={0};
        long k;
        for(k=0; k<5; k++) {
            if(i+k<len) {
                tmp[k]=str[i+k];
                vv.push_back( ST_STR(string(tmp)) );
            }
        }
    }
    sort(vv.begin(), vv.end(), cmp);

    long count=0;
    for(i=0; i<(long)vv.size(); i++) {
        if(i==0 || (vv[i-1].m_string.compare(vv[i].m_string)!=0)) {
            count++;
            if(count==k)
                break;
        }
    }
    printf("%s\n", vv[i].m_string.c_str());

    return 0;
}


Compiler output:
a.cc:18:24: error: 'string' in namespace 'std' does not name a type
   18 |     ST_STR( const std::string& a ):m_string(a){};
      |                        ^~~~~~
a.cc:8:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    7 | #include <set>
  +++ |+#include <string>
    8 | #pragma warning(disable:4996)
a.cc:19:10: error: 'string' in namespace 'std' does not name a type
   19 |     std::string m_string;
      |          ^~~~~~
a.cc:19:5: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
   19 |     std::string m_string;
      |     ^~~
a.cc: In constructor 'ST_STR::ST_STR(const int&)':
a.cc:18:36: error: class 'ST_STR' does not have any field named 'm_string'
   18 |     ST_STR( const std::string& a ):m_string(a){};
      |                                    ^~~~~~~~
a.cc: In function 'bool cmp(const ST_STR&, const ST_STR&)':
a.cc:24:14: error: 'const struct ST_STR' has no member named 'm_string'
   24 |     return a.m_string.compare(b.m_string)<0;
      |              ^~~~~~~~
a.cc:24:33: error: 'const struct ST_STR' has no member named 'm_string'
   24 |     return a.m_string.compare(b.m_string)<0;
      |                                 ^~~~~~~~
a.cc: In function 'int main(int, char**)':
a.cc:45:38: error: 'string' was not declared in this scope
   45 |                 vv.push_back( ST_STR(string(tmp)) );
      |                                      ^~~~~~
a.cc:45:38: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:53:29: error: '__gnu_cxx::__alloc_traits<std::allocator<ST_STR>, ST_STR>::value_type' {aka 'struct ST_STR'} has no member named 'm_string'
   53 |         if(i==0 || (vv[i-1].m_string.compare(vv[i].m_string)!=0)) {
      |                             ^~~~~~~~
a.cc:53:52: error: '__gnu_cxx::__alloc_traits<std::allocator<ST_STR>, ST_STR>::value_type' {aka 'struct ST_STR'} has no member named 'm_string'
   53 |         if(i==0 || (vv[i-1].m_string.compare(vv[i].m_string)!=0)) {
      |                                                    ^~~~~~~~
a.cc:59:26: error: '__gnu_cxx::__alloc_traits<std::allocator<ST_STR>, ST_STR>::value_type' {aka 'struct ST_STR'} has no member named 'm_string'
   59 |     printf("%s\n", vv[i].m_string.c_str());
      |                          ^~~~~~~~