Language: C++

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
#define ll __int64
ll a[20];
ll vis[20];
ll n,k;
ll output;
void Dfs(ll u)
{
    if(u==n+1)
    {
        ll b[20];
        ll cnt=0;
        ll pre=a[1];
        for(ll i=1;i<=n;i++)if(vis[i]==1)cnt++;
        for(ll i=1;i<=n;i++)b[i]=a[i];
        if(cnt==k)
        {
            ll sum=0;
            for(ll i=2;i<=n;i++)
            {
                if(vis[i]==1)
                {
                    if(b[i]>pre)pre=b[i];
                    else
                    {
                        sum+=pre+1-b[i];
                        b[i]=pre+1;
                        pre=b[i];
                    }
                }
            }
            ll look=1;
            for(ll i=2;i<=n;i++)
            {
                ll flag=0;
                for(ll j=1;j<i;j++)
                {
                    if(b[j]>b[i])flag=1;
                }
                if(flag==0)look++;
            }
            if(look==k)
            {
                output=min(output,sum);
            }
        }
        return ;
    }
    vis[u]=1;
    Dfs(u+1);
    if(u!=1)
    {
        vis[u]=0;
        Dfs(u+1);
    }
}
int main()
{
    while(~scanf("%I64d%I64d",&n,&k))
    {
        output=10000000000000000;
        memset(vis,0,sizeof(vis));
        for(ll i=1;i<=n;i++)scanf("%I64d",&a[i]);
        Dfs(1);
        printf("%I64d\n",output);
    }
}


Compiler output:
a.cc:5:12: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 | #define ll __int64
      |            ^~~~~~~
a.cc:6:1: note: in expansion of macro 'll'
    6 | ll a[20];
      | ^~
a.cc:5:12: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 | #define ll __int64
      |            ^~~~~~~
a.cc:7:1: note: in expansion of macro 'll'
    7 | ll vis[20];
      | ^~
a.cc:5:12: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 | #define ll __int64
      |            ^~~~~~~
a.cc:8:1: note: in expansion of macro 'll'
    8 | ll n,k;
      | ^~
a.cc:5:12: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 | #define ll __int64
      |            ^~~~~~~
a.cc:9:1: note: in expansion of macro 'll'
    9 | ll output;
      | ^~
a.cc:10:6: error: variable or field 'Dfs' declared void
   10 | void Dfs(ll u)
      |      ^~~
a.cc:5:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    5 | #define ll __int64
      |            ^~~~~~~
a.cc:10:10: note: in expansion of macro 'll'
   10 | void Dfs(ll u)
      |          ^~
a.cc: In function 'int main()':
a.cc:62:32: error: 'n' was not declared in this scope
   62 |     while(~scanf("%I64d%I64d",&n,&k))
      |                                ^
a.cc:62:35: error: 'k' was not declared in this scope
   62 |     while(~scanf("%I64d%I64d",&n,&k))
      |                                   ^
a.cc:64:9: error: 'output' was not declared in this scope
   64 |         output=10000000000000000;
      |         ^~~~~~
a.cc:65:16: error: 'vis' was not declared in this scope
   65 |         memset(vis,0,sizeof(vis));
      |                ^~~
a.cc:5:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    5 | #define ll __int64
      |            ^~~~~~~
a.cc:66:13: note: in expansion of macro 'll'
   66 |         for(ll i=1;i<=n;i++)scanf("%I64d",&a[i]);
      |             ^~
a.cc:66:20: error: 'i' was not declared in this scope
   66 |         for(ll i=1;i<=n;i++)scanf("%I64d",&a[i]);
      |                    ^
a.cc:66:44: error: 'a' was not declared in this scope
   66 |         for(ll i=1;i<=n;i++)scanf("%I64d",&a[i]);
      |                                            ^
a.cc:67:9: error: 'Dfs' was not declared in this scope; did you mean 'ffs'?
   67 |         Dfs(1);
      |         ^~~
      |         ffs