criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long int INF = 1000000000000000000;
int main(){
    int N, K;
    cin >> N >> K;
    long long int a[N];
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }


    long long int ans = INF;
    if(K <= 1) ans = 0;
    for (int bit = 0; bit < (1 << (N-1)); bit++)
    {
        int v = 0;
        long long int t = a[0];
        long long int sum = 0;
        for (int i = 1; i < N; i++)
        {
            if(bit & (1 << (i-1))){
                if( t - a[i]  > -1ll){
                    sum += t - a[i] + 1ll;
                    t++;
                    v++;
                }
                else{
                    t = a[i];
                    v++;
            }
        }
        if(v >= K) ans = min(ans, sum);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

lli bitCnt(lli now){
	lli cnt=0;
	while(now>0){
		cnt += (now%2);
		now/=2;
	}
	return cnt;
}

signed main(){

	lli n,k;
	cin>>n>>k;

	vector<lli> a(n);
	REP(i,0,n)cin>>a[i];

	vector<lli> amaxh(n+1);
	REP(i,0,n)amaxh[i+1] = max(a[i],amaxh[i]);
	lli ans = INF;

	for(lli b=0;b<(1LL<<(n));b++){
		if(bitCnt(b)!=k)continue;

		lli nowh=0,tmp=0;
		REP(i,0,n){
			if(bit&(1LL<<i)==0)continue;
			nowh=max(nowh,amaxh[i]);
			if(nowh>=a[i]){
				tmp += nowh-a[i]+1;
				nowh++;
			}
			else{
				nowh = a[i];
			}
		}
		ans = min(ans,tmp);
	}
	cout<<ans<<endl;


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:28: error: 'bit' was not declared in this scope
   41 |                         if(bit&(1LL<<i)==0)continue;
      |                            ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll inf = 1e18;

int main() {
   int n, k;
   cin >> n >> k;
   vector<int> a(n);
   rep(i,n) cin >> a[i];
   ll ans = inf;
   rep(i,1<<n) {
      ll t = 0;
      int flag = 0;
      if (i & 1 != 1) continue;
      if (__builtin_popcount(i) != k) continue;
      ll tmp = a[0];
      for (int j = 1; j < n; j++) {
         if (i>>j & 1) {
            tmp = max(a[j],tmp+1);
            t += tmp-a[j];
         }
      }
      ans = min(ans,t);
   }
   cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, ll)'
   22 |             tmp = max(a[j],tmp+1);
      |                   ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:22:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   22 |             tmp = max(a[j],tmp+1);
      |                   ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:22:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   22 |             tmp = max(a[j],tmp+1);
      |                   ~~~^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main(){
  ll N, K;
  cin >> N >> K;
  vll a(N), aa(N);
  vll highest(N), highestt(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
    if(i == 0) highest.at(0) = a.at(0);
    else if(a.at(i) > highest.at(i-1)) highest.at(i) = a.at(i);
    else highest.at(i) = highest.at(i-1);
  }
  aa = a; highestt = highest;


  ll result = INF;
  for(int tmp = 0; tmp < (1 << (N-1)); tmp++){
    bitset<14> bit(tmp);
    if(bit.count() !=  K-1) continue;
    a = aa; highest = highestt;
    ll sum = 0;
    for(int i = 0; i < N-1; i++){
      if(bit.test(i)){ //i+1番目がみえる
        if(a.at(i+1) <= highest.at(i)){
          sum += (highest.at(i) + 1LL - a.at(i+1));
          a.at(i+1) = highest.at(i) + 1LL;
        }
        highest.at(i+1) = max(a.at(i+1), highest.at(i))
      }
    }
    chmin(result, sum);
  }
  cout << result << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:56: error: expected ';' before '}' token
   42 |         highest.at(i+1) = max(a.at(i+1), highest.at(i))
      |                                                        ^
      |                                                        ;
   43 |       }
      |       ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  int N, K; cin >> N >> K;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  ll ans = 1e11;
  for(int i = 0; i < (1 << (N - 1)); i++){
    bitset<16> bit(i);
    if(bit.count() != K - 1) continue;
    ll ans1 = 0;
    ll bound = a[0];
    for(int j = 0; j < N - 1; j++){
      if(bit[j]){
        if(bound >= a[j + 1]){
          ans1 += bound - a[j + 1] + 1;
          bound++;
        }
        bound = max(bound, a[j + 1]);
      }
    }
    ans = min(ans, ans1);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   23 |         bound = max(bound, a[j + 1]);
      |                 ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:23:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   23 |         bound = max(bound, a[j + 1]);
      |                 ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:23:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   23 |         bound = max(bound, a[j + 1]);
      |                 ~~~^~~~~~~~~~~~~~~~~
Language: C++

/*
    Problem 14
    https://atcoder.jp/contests/s8pc-4/tasks/s8pc_4_b
*/
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>

using namespace std;
/* typedef */
typedef long long ll;
/* constant */
const int MAX = 15;
const ll INF = 1e18;
/* global variables */
/* function */
/* main */
int main(){
    int N, K, upper;
    ll ans, tmp, pre;
    cin >> N >> K;
    if (K == 1) {
        cout << 0 << '\n';
        return 0;
    }
    vector<ll> building(N);
    for (int i = 0; i < N; i++) cin >> building[i];

    upper = pow(2, N);
    ans = INF;
    for (int b = 0; b < upper; b++) {
        bitset<MAX> bs(b);
        vector<int> v(MAX, 0);
        if (bs.count() != K-1) continue;
        for (int i = 0; i < N; i++)
            if ((bs >> i)[0]) v[i] = 1;
        tmp = 0;
        pre = building[v[0]];
        for (int i = 0; i < N-1; i++) {
            if (v[i]) {
                if (pre >= building[i+1]) {
                    tmp += pre - building[i+1] + 1;
                    pre++;
            }
            pre = max(pre, building[i]);
        }
        ans = min(ans, tmp);
    }
    cout << ans << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:2: error: expected '}' at end of input
   63 | }
      |  ^
a.cc:31:11: note: to match this '{'
   31 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000

int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  long long ans = INF;
  for (int i = 0; i < N; ++i)
  {
    cin >> a.at(i);
  }
  for (int i = 0; i < 1 << N; ++i)
  {
    if (__builtin_popcountll(i) != K)
    {
      continue;
    }
    long long ans_i = 0, max_hight = 0;
    for (int j = 0; j < N; ++j)
    {
      if (1 << (N - j - 1) & i)
      {
        if (max_hight >= a.at(j))
        {
          ans_i += max_hight - a.at(j) + 1;
          max_hight += 1;
        }
      }
      max_hight = max(max_hight,a.at(j));
    }
    bitset<15> bs(i);
    cout << bs << endl;
    cout << ans_i << endl;
    ans = min(ans, ans_i);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:22: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   32 |       max_hight = max(max_hight,a.at(j));
      |                   ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:32:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   32 |       max_hight = max(max_hight,a.at(j));
      |                   ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:32:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |       max_hight = max(max_hight,a.at(j));
      |                   ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long int N,K,m=0,M,w;bool x=true;cin>>N>>K;vector<int>a(N);
  for(int i=0;i<N;i++)cin>>a.at(i);
  for(long int i=0;i<(1<<16);i++){
    bitset<16>p(i);
    if(p.test(N-1))break;
    w=a.at(0),M=0;
    if(p.count()==K-1){
      for(int j=1;j<N;j++){
        if(p.test(j-1)){
          w=max(w+1,a.at(j));
          M+=w-a.at(j);
        }
      }
      if(x)m=M;
      m=min(m,M);
      x=false;
    }
  }
  cout<<m<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: no matching function for call to 'max(long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   13 |           w=max(w+1,a.at(j));
      |             ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:13:16: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   13 |           w=max(w+1,a.at(j));
      |             ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:13:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   13 |           w=max(w+1,a.at(j));
      |             ~~~^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,m,M,w;cin>>N>>K;vector<int>a(N);
  for(int i=0;i<N;i++)cin>>a.at(i);
  for(int i=0;i<(1<<15);i++){
    bitset<16>p(i);
    if(p.test(N))break;
    w=a.at(0),M=0;
    if(p.count()==K){
      if(int j=0;j<N;j++){
        w=max(w+1,a.at(j));
        if(p.test(j))M+=w-a.at(j);
      }
    }
    if(i==0)m=M;
    else m=min(m,M);
  }
  cout<<m<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: expected ')' before ';' token
   11 |       if(int j=0;j<N;j++){
      |         ~           ^
      |                     )
a.cc:11:22: error: 'j' was not declared in this scope
   11 |       if(int j=0;j<N;j++){
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,m,M,w;cin>>N>>K;vector<int>a(N);
  for(int i=0;i<N;i++)cin>>a.at(i);
  for(int i=0;i<(1<<15);i++){
    bitset<16>p(i);
    if(p.test(N))break;
    w=a.at(0),M=0;
    if(p.count()==K){
      if(int j=0;j<N;j++){
        w=max(w+1,a.at(j));
        if(p.test(j))M+=w-a.at(j);
      }
    }
  }
  cout<<m<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: expected ')' before ';' token
   11 |       if(int j=0;j<N;j++){
      |         ~           ^
      |                     )
a.cc:11:22: error: 'j' was not declared in this scope
   11 |       if(int j=0;j<N;j++){
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  
  int tall = 0;
  int c = 0;
  int ans = 0;
  
  for(int i = 0; i < n; i++){
    
    tall = max(tall, a[i]);
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  vector<long long> A(n);for(int i = 0; n > i; i++)cin>>A[i];
  long long ans = 0;
  for(int bit = 0; (1<<(n-1)) > bit; bit++){
    if(__builtin_popcount(bit)+1 != k)continue;
    long long he = A[0];
    long long tmp = 0;
    for(int i = 0; n > i; i++){
      if(bit & (1<<i)){
        if(he < A[i+1]){
          he = A[i+1];
        }else{
          he++;
          tmp =ht-A[i+1];
        }
      }
    }
    ans = min(ans,tmp);
  }
  cout << ans << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: 'ht' was not declared in this scope; did you mean 'he'?
   18 |           tmp =ht-A[i+1];
      |                ^~
      |                he
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  for(int i = 0; n > i; i++){
    vector<int> A(n);
  }
  int ans = -1;
  for(int bit = 0; (1<<n) > bit; bit++){
    if(__builtin_popcount(bit) != k)continue;
    int nya = -1;
    int tmp = 0;
    for(int i = 0; n > i; i++){
      if(bit & (1<<i)){
        if(nya == -1){
          nya = A[i];
        }else{
          if(nya < A[i]){
            nya = A[i];
          }else{
            nya++;
            tmp += nya-A[i];
          }
        }
      }
    }
    if(ans == -1)ans = tmp;
    else ans = min(ans,tmp);
    
  }
  cout << ans << endl;
}
        
    

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'A' was not declared in this scope
   17 |           nya = A[i];
      |                 ^
a.cc:19:20: error: 'A' was not declared in this scope
   19 |           if(nya < A[i]){
      |                    ^
Language: C++

// #include <bits/stdc++.h>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<map>
#include<set>
#include<vector>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<string>
#include<tuple>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}

inline void solve(void){
  long N,K;
  in(N,K);
  vector<cpp_int>a(N);
  rep(i,N)in(a[i]);
  cpp_int ans=numeric_limits<mp::cpp_int>::max();
  for(int i=0;i<1<<N;i++){
    if(__builtin_popcount(i)<(int)K)continue;
    cpp_int now,cost=0;
    bool is_first=true;
    rep(j,N){
      if(i>>j&1){
        if(is_first){
          if(a[0]>=a[j]&&j!=0){
            now=a[0]+1;
            cost+=a[0]-a[j]+1;
          }else{
            now=a[j];
          }
          is_first=false;
        }else{
          if(a[j]<=now){
            cost+=now-a[j]+1;
            now++;
          }else now=a[j];
        }
      }
    }
    chmin(ans,cost);
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc:16:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   16 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

// #include <bits/stdc++.h>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<map>
#include<set>
#include<vector>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<string>
#include<tuple>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}

inline void solve(void){
  long N,K;
  in(N,K);
  vector<cpp_int>a(N);
  rep(i,N)in(a[i]);
  cpp_int ans=1e300;
  for(int i=0;i<1<<N;i++){
    if(__builtin_popcount(i)<(int)K)continue;
    cpp_int now,cost=0;
    bool is_first=true;
    rep(j,N){
      if(i>>j&1){
        if(is_first){
          if(a[0]>=a[j]&&j!=0){
            now=a[0]+1;
            cost+=a[0]-a[j]+1;
          }else{
            now=a[j];
          }
          is_first=false;
        }else{
          if(a[j]<=now){
            cost+=now-a[j]+1;
            now++;
          }else now=a[j];
        }
      }
    }
    chmin(ans,cost);
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc:16:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   16 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;

long h[20][20], dp[20][20];
int main() {
	int N, K, a[20]; cin >> N >> K;
	for(int i=0; i<N; ++i) cin >> a[i];
	h[0][0]=h[0][1]=a[0];
	for(int i=1; i<N; ++i){
	    h[i][0]=max(h[i-1][0], a[i]);
	    for(int j=1; j<i+2; ++j){
	        if(a[i]>h[i-1][j-1]){
	            h[i][j]=a[i];
	            dp[i][j]=dp[i-1][j-1];
	        }
	        else{
	            bool flag=false;
	            if(j<=i){
	                if(dp[i-1][j]<dp[i-1][j-1]+h[i-1][j-1]-a[i]) flag=true;
	            }
	            if(flag){
	                h[i][j]=h[i-1][j];
	                dp[i][j]=dp[i-1][j];
	            }
	            else{
	                h[i][j]=h[i-1][j-1]+1;
	                dp[i][j]=dp[i-1][j-1]+h[i][j]-a[i];
	            }
	        }
	    }
	}
	cout << dp[N-1][K] << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: no matching function for call to 'max(long int&, int&)'
   10 |             h[i][0]=max(h[i-1][0], a[i]);
      |                     ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:10:24: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   10 |             h[i][0]=max(h[i-1][0], a[i]);
      |                     ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

#define pb push_back

const int LLINF = 1LL << 60;

signed main()
{
  int N, K;
  int A[25];
  int dp[25][25];
  
  cin >> N >> K;
  Rep(i, N) cin >> A[i];
  
  int sample = A[0];
  
  fill_n(*dp, 25 * 25, LLINF);
  dp[0][0] = 0;
  
  Rep(i, K - 1) {
    Rep(j, N - 1) {
      if(dp[i][j] == LLINF) continue;
      Reps(k, j + 1, N) {
	dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + max(0, (i + 1 + sample) - A[k]));
      }
    }
  }
  
  int minv = LLINF;
  Rep(i, N) {
    minv = min(minv, dp[K - 1][i]);
  }

  cout << minv << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:56: error: no matching function for call to 'max(int, long long int)'
   29 |         dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + max(0, (i + 1 + sample) - A[k]));
      |                                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:29:56: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   29 |         dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + max(0, (i + 1 + sample) - A[k]));
      |                                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:56: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   29 |         dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + max(0, (i + 1 + sample) - A[k]));
      |                                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <vector>
#include <string.h>
#include<iostream>
#include<set>
#include<map>
#include<unordered_map>
#include<string.h>
#include<algorithm>
#include <stdlib.h>
#include<queue>
using namespace std;

typedef long long ll;


int main(){
//    vector<int>b(5);
//    int n=248832;
//    for(int j=0;j<5;j++){
//        b[j]=((int)(248831/pow(12,j)))%12;
//        //cout<<i<<" "<<j<<" "<<" "<<((int)(i/pow(12,j)))%12<<" "<<b[j]<<endl;
//        cout<<b[j]<<" ";
//    }
//    cout<<endl;
    ll n,k;
    cin>>n>>k;
    vector<ll>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll cur=1;
    ll last=a[0];
    ll need=0;
    for(int i=1;i<n;i++){
        if(a[i]>last){
            last=a[i];
            cur++;
        } else {
            last++;
            need+=last-a[i];
        }
    }
    if(n==k){
        cout<<need<<endl;
        return 0;
    }
    ll mi=100000000;
    vector<int>b(n);
    for(int i=0;i<248832;i++){
       // cout<<"i: "<<i<<endl;
        bool ok=true;
        for(int j=0;j<n;j++){
            b[j]=((int)(i/pow(12,j)))%12;
        }
        ll mieru=1;
        ll last=b[0];
        if(b[0]<a[0])ok=false;
        for(int i=1;i<n;i++){
            if(b[i]>last){
                last=b[i];
                mieru++;
            }
            if(b[i]<a[i]){
                ok=false;
            }
        }
        if(!ok)continue;
        if(mieru<k)continue;
        //cout<<mieru<<endl;
        ll cur=b[0]-a[0];
        for(int i=1;i<n;i++){
            cur+=b[i]-a[i];
        }
        mi=min(mi,cur);
    }
    cout<<mi<<endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:27: error: 'pow' was not declared in this scope
   53 |             b[j]=((int)(i/pow(12,j)))%12;
      |                           ^~~
Language: C++

#include <iostream>
using namespace std;

#define int long long

int bitcount(int a){
	int r = 0;
	while(a){
		a -= a & -a;
		r++;
	}
	return r;
}

signed main(){
	int n, k;
	cin >> n >> k;
	int a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	int ans = 1e9 + 7;
	for(int i = 0; i < 1 << n; i++){
		if(bitcount(i) < k) continue;
		int tmp = 0, p = -1;
		for(int j = 0; j < n; j++){
			if(i >> j & 1){
				if(p == -1) p = a[j] + 1;
				else{
					tmp += max(0, p - a[j]);
					p = max(p + 1, a[j] + 1);
				}
			}else p = max(p, a[j] + 1);
		}
		ans = min(ans, tmp);
		next:;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:51: error: no matching function for call to 'max(int, long long int)'
   28 |                                         tmp += max(0, p - a[j]);
      |                                                ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:28:51: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |                                         tmp += max(0, p - a[j]);
      |                                                ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include<iostream>
#include <algorithm>
#include <string.h>
#include <vector>
using namespace std;
int N,K;
const long long INF=100000000000LL;
long long a[20];
long long reg(int n,int k,long long t){
	if(k==K)return 0;
	if(n==N)return INF;
	if(a[n]>t)return reg(n+1,k+1,a[n]);
	long long was=INF;
	was=min(was,t+1-a[n]+reg(n+1,k+1,t+1));
	was=min(was,reg(n+1,k,t));
	//cout<<n<<" "<<k<<" "<<t<<" "<<was<<endl;
	return was;
}
int main(){
	memset(dp,-1,sizeof(dp));
	cin>>N>>K;
	for(int i=0;i<N;++i){
		cin>>a[i];
	}
	cout<<reg(1,1,a[0])<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: 'dp' was not declared in this scope
   20 |         memset(dp,-1,sizeof(dp));
      |                ^~
Language: C++

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/dsu>
using namespace atcoder;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000000000000

long long get(int h,int m,vector<int> x){
	vector<string> S(h,string(7,'0'));
	rep(i,7*h){
		if(binary_search(x.begin(),x.end(),i%m)){
			S[i/7][i%7]='1';
		}
	}
	dsu D(h*7);
	
	rep(i,h){
		rep(j,7){
			if(i!=h-1){
				if(S[i][j]=='0'&&S[i+1][j]=='0'){
					D.merge(i*7+j,(i+1)*7+j);
				}
			}
			if(j!=6){
				if(S[i][j]=='0'&&S[i][j+1]=='0'){
					D.merge(i*7+j,i*7+j+1);
				}
			}
		}
	}
	long long ret = 0LL;
	rep(i,h){
		rep(j,7){
			if(S[i][j]=='1')continue;
			if(D.leader(i*7+j)==i*7+j)ret++;
		}
	}
	return ret;
	
}

int main(){
	
	long long n,m,q;
	cin>>n>>m>>q;
	vector<int> a(q);
	rep(i,q)cin>>a[i];
	
	long long ans = 0LL;
	if(n<=m){
		ans = get(n,m,a);
	}
	else{
		ans = get(m,m,a);
		n -= m;
		ans += n/m * (get(2*m,m,a)-get(m,m,a));
		n %= m;
		ans += get(m+n,m,a) - get(m,m,a);
	}
	cout<<ans<<endl;
	
    return 0;
}



Compiler output:
a.cc:3:10: fatal error: atcoder/dsu: No such file or directory
    3 | #include <atcoder/dsu>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

ll gcd(ll a, ll b) {
    if (b > a) swap(a, b);
    while (b) {
        ll t = a % b;
        a = b;
        b = t;
    }
    return a;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

int dy[] = {1, 0, -1, 0};
int dx[] = {0, -1, 0, 1};

ll n, m, q;
ll h;
int used[101010][7] = {};
int cal[101010][7] = {};
int used2[2][7] = {};
int cal2[2][7] = {};

void dfs(int y, int x) {
    used[y][x] = 1;
    rep(i,4) {
        if (y + dy[i] >= 0 && y + dy[i] < h && x + dx[i] >= 0 && x + dx[i] < 7 && !used[y + dy[i]][x + dx[i]] && !cal[y + dy[i]][x + dx[i]]) {
            dfs(y + dy[i], x + dx[i]);
        }
    }
}

void dfs2(int y, int x) {
    used2[y][x] = 1;
    rep(i,4) {
        if (y + dy[i] >= 0 && y + dy[i] < 2 && x + dx[i] >= 0 && x + dx[i] < 7 && !used2[y + dy[i]][x + dx[i]] && !cal2[y + dy[i]][x + dx[i]]) {
            dfs2(y + dy[i], x + dx[i]);
        }
    }
}

void solve() {
    cin >> n >> m >> q;
    h = lcm(7, m) / 7;
    rep(i,q) {
        ll a;
        cin >> a;
        for (ll j = a; j < 7 * h; j += m) {
            if (cal[j/7][j%7]) break;
            cal[j/7][j%7] = 1;
        }
    }
    ll cnt = 0;
    rep(i,h) {
        rep(j,7) {
            if (!used[i][j] && !cal[i][j]) {
                dfs(i, j);
                cnt++;
            }
        }
    }
    rep(i,7) cal2[0][i] = cal[h-1][i];
    rep(i,7) cal2[1][i] = cal[0][i];
    ll cnt2 = 0;
    rep(i,2) {
        rep(j,7) {
            if (!used2[i][j] && !cal2[i][j]) {
                dfs2(i, j);
                cnt2++;
            }
        }
    }
    ll cnt3 = 0;
    if (!cal2[0][0]) cnt3++;
    REP(i,1,7) if (cal2[0][i-1] && !cal2[0][i]) cnt3++;
    if (!cal2[1][0]) cnt3++;
    REP(i,1,7) if (cal2[1][i-1] && !cal2[1][i]) cnt3++;
    cnt2 = cnt3 - cnt2;
    ll ans = (n / h) * cnt - (n / h - 1) * cnt2
    cout << ans << endl;
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:93:5: error: expected ',' or ';' before 'cout'
   93 |     cout << ans << endl;
      |     ^~~~
Language: C++

#include<map>
#include<string>
#include<iostream>
#include<set>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
//#define scanf scanf_s
#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pub push_back
using namespace std;
typedef long long int llint;
const llint one = 1;
const llint big = (one<<30);
const llint mod=1000000007;


int main(void){
	llint N,M,q,i,j,a,ansa,ansb,ok=0,ans;
	queue<llint> que;
	vector<llint> nuru;
	set<llint> siro;
	scanf("%lld %lld %lld",&N,&M,&q);
	for(i=0;i<q;i++){
		scanf("%lld",&a);
		nuru.pub(a);
	}
	sort(nuru.begin(),nuru.end());
	if(M%7!=0){ M*=7;ok=1; }
	for(i=0;i<M;i++){
		for(j=0;j<1+ok*6;j++){
			if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M); }
		}
	}
	ansa=0;
	while(siro.size()!=0){
		que.push(*siro.begin());
		while(!que.empty()){
			a=que.front();
			que.pop();
			if(a-7>=0&&siro.find(a-7)!=siro.end()){ que.push(a-7); }
			if(a+7<M&&siro.find(a+7)!=siro.end()){ que.push(a+7); }
			if(a%7!=0&&siro.find(a-1)!=siro.end()){ que.push(a-1); }
			if(a%7!=6&&siro.find(a+1)!=siro.end()){ que.push(a+1); }
			siro.erase(a);
		}
		ansa++;
	}

	for(i=0;i<M;i++){
		for(j=0;j<1+ok*6;j++){
			if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
		}
		for(j=0;j<1+ok*6;j++){
			if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7+M); }
		}
	}
	ansb=0;
	while(siro.size()!=0){
		que.push(*siro.begin());
		while(!que.empty()){
			a=que.front();
			que.pop();
			if(a-7>=0&&siro.find(a-7)!=siro.end()){ que.push(a-7); }
			if(a+7<2*M&&siro.find(a+7)!=siro.end()){ que.push(a+7); }
			if(a%7!=0&&siro.find(a-1)!=siro.end()){ que.push(a-1); }
			if(a%7!=6&&siro.find(a+1)!=siro.end()){ que.push(a+1); }
			siro.erase(a);
		}
		ansb++;
	}
	ans=(ansb-ansa)*N*7/M+(2*ansa-ansb);
	printf("%lld\n",ans);
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'queue' was not declared in this scope
   25 |         queue<llint> que;
      |         ^~~~~
a.cc:10:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    9 | #include<functional>
  +++ |+#include <queue>
   10 | //#define scanf scanf_s
a.cc:25:20: error: expected primary-expression before '>' token
   25 |         queue<llint> que;
      |                    ^
a.cc:25:22: error: 'que' was not declared in this scope
   25 |         queue<llint> que;
      |                      ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
long n;int m,q,a[1<<17];
bool f[7][1<<17];
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
void bfs(int x,int y,long _n)
{
	queue<pair<int,int> >P;
	f[x][y]=true;
	P.push(make_pair(x,y));
	while(!P.empty())
	{
		pair<int,int>p=P.front();P.pop();
		for(int r=0;r<4;r++)
		{
			int tx=p.first+dx[r],ty=p.second+dy[r];
			if(tx<0||ty<0||tx>=7||ty>=_n||f[tx][ty])continue;
			f[tx][ty]=true;
			P.push(make_pair(tx,ty));
		}
	}
}
main()
{
	cin>>n>>m>>q;
	for(int i=0;i<q;i++)
	{
		cin>>a[i];
	}
	if(n<=100000)
	{
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<n;j++)
			{
				int b=(j*7+i)%m;
				if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
			}
		}
		long ans=0;
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<n;j++)
			{
				if(!f[i][j])
				{
					ans++;
					bfs(i,j,n);
				}
			}
		}
		cout<<ans<<endl;
	}
	else if(m%7==0)
	{
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<m/7*2;j++)
			{
				int b=(j*7+i)%m;
				if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
			}
		}
		long count1=0;
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<m/7*2;j++)
			{
				if(!f[i][j])
				{
					count1++;
					bfs(i,j,m/7*2);
				}
			}
		}
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<m/7*3;j++)
			{
				f[i][j]=false;
				int b=(j*7+i)%m;
				if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
			}
		}
		long count2=0;
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<m/7*3;j++)
			{
				if(!f[i][j])
				{
					count2++;
					bfs(i,j,m/7*3);
				}
			}
		}
		long kousa=count2-count1;
		long syokou=count1-kousa*2;
		cout<<syokou+kousa*(n/(m/7))<<endl;
	}
	else
	{
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<m;j++)
			{
				int b=(j*7+i)%m;
				if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
			}
		}
		long count1=0;
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<m;j++)
			{
				if(!f[i][j])
				{
					count1++;
					bfs(i,j,m);
				}
			}
		}
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<2*m;j++)
			{
				f[i][j]=false;
				int b=(j*7+i)%m;
				if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
			}
		}
		long count2=0;
		for(int i=0;i<7;i++)
		{
			for(int j=0;j<2*m;j++)
			{
				if(!f[i][j])
				{
					count2++;
					bfs(i,j,2*m);
				}
			}
		}
		long kousa=(count2-count1)/7;s
		long syokou=count1-kousa*7;
		cout<<syokou+kousa*n<<endl;
	}
}

Compiler output:
a.cc:25:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   25 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:146:46: error: 's' was not declared in this scope
  146 |                 long kousa=(count2-count1)/7;s
      |                                              ^
a.cc:148:23: error: 'syokou' was not declared in this scope
  148 |                 cout<<syokou+kousa*n<<endl;
      |                       ^~~~~~
Language: C++

3.666666666666667
2.250000000000000
3.666666666666667
2.833333333333333
2.555555555555555
2.666666666666667
4.333333333333333
2.666666666666667
5.333333333333333
2.500000000000000
2.500000000000000
5.000000000000000


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 3.666666666666667
      | ^~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector <int> g[150100];
map <pair <int, int> , double> mp;
double dfs(int v, int p = -1, double t = 1)
{
    if(mp[make_pair(v, p)] != 0)
        return mp[make_pair(v, p)] * t;
    double ans = 0;
    int k = g[v].size();
    if(p != -1)
        k--;
    for(int i = 0; i < g[v].size(); ++i)
    {
        if(g[v][i] != p)
            ans += dfs(g[v][i], v, 1.0 / k) + 1.0 / k;
    }
    mp[make_pair(v, p)] = ans;
    return ans * t;
}
int main()
{
    int n, i, x, y;

    scanf("%d", &n)

    for(i = 1; i < n; ++i)
    {
        scanf("%d %d", &x, &y);
        g[x].push_back(y);
        g[y].push_back(x);
    }
    for(i = 1; i <= n; ++i)
        cout << fixed << setprecision(12) << dfs(i) << endl;

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:20: error: expected ';' before 'for'
   25 |     scanf("%d", &n)
      |                    ^
      |                    ;
   26 | 
   27 |     for(i = 1; i < n; ++i)
      |     ~~~             
a.cc:27:26: error: expected ';' before ')' token
   27 |     for(i = 1; i < n; ++i)
      |                          ^
      |                          ;