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

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

double p[1010],maxi=0,now=0;
int N,K,cnt=0;

int main(){
    cout << setprecision(12);
    cin>>N>>K;
    int A[N];
    p[0]=0;
    rep(i,N)cin>>A[i];
    repi(i,1,1005)p[i]=p[i-1]+i;
    repi(i,1,1005)p[i]/=i;
    rep(i,N){
        if(i<K){
            now+=p[A[i]];
        }
        else{
           now-=p[A[i-K]]; 
           now+=p[A[i]];
        }
        maxi=max(maxi,now);
    }
    out(maxi);

    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:13: error: 'setprecision' was not declared in this scope
   33 |     cout << setprecision(12);
      |             ^~~~~~~~~~~~
a.cc:14:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
   13 | #include<queue>
  +++ |+#include <iomanip>
   14 | using namespace std;
Language: C++

#include<iostream>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    long long double p[N];
    for(int i=0;i<N;i++)cin>>p[i];
    
    long long double ans=0;
    
    long long double e_sum=0;

    for(int j=0;j<K;j++){
        e_sum += (p[j]+1)/2;
    }
    ans = e_sum;
    
    for(int i=K;i<N;i++){
        e_sum += (p[i]+1)/2;
        e_sum -= (p[i-K]+1)/2;
        if(ans<e_sum){
        	ans=e_sum;
        }
    }
    
    cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'long long' specified with 'double'
    7 |     long long double p[N];
      |          ^~~~
a.cc:10:10: error: 'long long' specified with 'double'
   10 |     long long double ans=0;
      |          ^~~~
a.cc:12:10: error: 'long long' specified with 'double'
   12 |     long long double e_sum=0;
      |          ^~~~
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
  }
  vector<int> s(N - K + 1);
  for (int i = 0; i < K; i++) {
    s.at(0) += p.at(i);
  }
  for (int i = 1, i < N - K + 1; i++) {
    s.at(i) = s.at(i - 1) - p.at(i - 1) + p.at(i + K - 1);
  }
  int M = 0;
  for (int i = 0; i < N - K + 1; i++) {
    if (s.at(i) > M) {
      M = s.at(i);
    }
  }
  double ans;
  ans = (M + K) * 0.5;
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: expected ';' before '<' token
   15 |   for (int i = 1, i < N - K + 1; i++) {
      |                    ^~
      |                    ;
a.cc:15:21: error: expected primary-expression before '<' token
   15 |   for (int i = 1, i < N - K + 1; i++) {
      |                     ^
Language: C++

#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

int main()
{
	long long n, k;
	double ans = 0.0;
	cin >> n >> k;
	long long max;
	vector<long long> a(n),dp(n-k+2);

	dp[0] = 0;

	for (long long i = 0; i < n; i++)
		cin >> a[i];

	for (long long j = 0; j < k; j++)
	{
		dp[1] += a[j];
		max = 1;
	}

	for (long long i = 2; i < dp.size(); i++)
	{
		if (a[i - 2] >= a[i - 2 + k])
			continue;

		for (long long j = 0; j < k; j++)
		{
			dp[i] += a[i-1+j];
		}
		if (dp[max] < dp[i])
		{
			max = i;
		}
	}

	for (long long i = max-1; i < max+k-1; i++)
	{
		ans += (double)(a[i]+1)/ (double)2;
	}

	cout << ans << endl;
}
	}

	for (long long i = max-1; i < max+k-1; i++)
	{
		ans += (double)(a[i]+1)/ (double)2;
	}

	cout << ans << endl;
}

Compiler output:
a.cc:53:9: error: expected declaration before '}' token
   53 |         }
      |         ^
a.cc:55:9: error: expected unqualified-id before 'for'
   55 |         for (long long i = max-1; i < max+k-1; i++)
      |         ^~~
a.cc:55:35: error: 'i' does not name a type
   55 |         for (long long i = max-1; i < max+k-1; i++)
      |                                   ^
a.cc:55:48: error: 'i' does not name a type
   55 |         for (long long i = max-1; i < max+k-1; i++)
      |                                                ^
a.cc:60:9: error: 'cout' does not name a type
   60 |         cout << ans << endl;
      |         ^~~~
a.cc:61:1: error: expected declaration before '}' token
   61 | }
      | ^
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
 
int main()
{
  int n;
  cin >> n >> m;
  vector<double> input(n,0);
  double sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> input.at(i);
    input[i] = (input[i] + 1)/2.0
  }
  
  int max = 0, max_i = 0;
  for (int i = 0; i < n; i++) {
    if(i + m <= n){
      sum = 0;
	  for (int j = 0; j < m; j++) {
        sum += input[i+j];
      }
      if(sum > max) max = sum;
    }
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'm' was not declared in this scope
   10 |   cin >> n >> m;
      |               ^
a.cc:15:34: error: expected ';' before '}' token
   15 |     input[i] = (input[i] + 1)/2.0
      |                                  ^
      |                                  ;
   16 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;

int main(){
    int n,k;
    cin >> n >> k;
    long double p[n];
    rep(i,n) cin >> p[i];
    long double pp[1001];

    ll s[1001];
    s[0]=0;
    for(int i=1;i<1001;i++){
        s[i]=s[i-1]+i;
    }
    for(int i=1;i<1001;i++){
        long double d=i;
        pp[i]=(1/d)*s[i];
    }

    long double ans=0;
    rep(i,k){
        ans+=pp[p[i]];
    }
    long double pre=ans;

    for(int i=k;i<n;i++){
        long double save=0;
        save=pre+pp[p[i]];
        save-=pp[p[i-k]];
        ans=max(ans,save);
        pre=save;
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: invalid types 'long double [1001][long double]' for array subscript
   25 |         ans+=pp[p[i]];
      |                ^
a.cc:31:20: error: invalid types 'long double [1001][long double]' for array subscript
   31 |         save=pre+pp[p[i]];
      |                    ^
a.cc:32:17: error: invalid types 'long double [1001][long double]' for array subscript
   32 |         save-=pp[p[i-k]];
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
int n,k;
int a[200005];
double num=0,tmp;
int main()
{
	cin>>n>>k;
	rep(i,n)
	cin>>a[i];
	rep(i,n-k+1)
	{
		tmp=0;
		rep2(j,i,i+k)
		tmp+=((double)(a[j])+1/2);
		if(tmp>num) num=tmp;
	}
	printf("%.12lf\n",num);
	return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: 'j' was not declared in this scope
   16 |                 rep2(j,i,i+k)
      |                      ^
a.cc:16:17: error: 'rep2' was not declared in this scope; did you mean 'rep'?
   16 |                 rep2(j,i,i+k)
      |                 ^~~~
      |                 rep
Language: C++

#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;

bool comp(const pll &a, const pll &b) {
	return a.first < b.first;
}
std::vector<int> enum_div(int n)//nの約数を列挙
{
	std::vector<int> ret;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i*i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}


template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}
int main()
{
	//priority_queue<int> q;
	string s = {};
	string s1 = {};
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	//ll x[300005] = {};
	long double y[300005] = {};
	ll z[302][302] = {};
	cin >> a;
	cin >> b;
	for (int i = 0; i < a; i++)
	{
		cin >> y[i];
	}
	//sort(y, y + a);
	long double tmp = 0;
	long double tmp2 = 0;
	for (int i = 0; i < b; i++)
	{
		tmp += y[i];
	}
	tmp += b;
	tmp2 = max(tmp2, tmp);
	for (int i = b; i < a; i++)
	{
		tmp -= y[i - b];
		tmp += y[i];
		tmp2 = max(tmp2, tmp);

	}

	cout << tmp2/(long double(2)) << endl;
	//cout << ans << endl;



	//return 0;

	/*cout << c << endl;
	cout << b << endl;*/
	//cout << fixed << setprecision(10) <<tmp << endl;
	//cout<<factorial<10><<endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:23: error: expected primary-expression before 'long'
   73 |         cout << tmp2/(long double(2)) << endl;
      |                       ^~~~
a.cc:73:23: error: expected ')' before 'long'
   73 |         cout << tmp2/(long double(2)) << endl;
      |                      ~^~~~
      |                       )
Language: C++

#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;

bool comp(const pll &a, const pll &b) {
	return a.first < b.first;
}
std::vector<int> enum_div(int n)//nの約数を列挙
{
	std::vector<int> ret;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i*i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}


template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}
int main()
{
	//priority_queue<int> q;
	string s = {};
	string s1 = {};
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	//ll x[300005] = {};
	long double y[300005] = {};
	ll z[302][302] = {};
	cin >> a;
	cin >> b;
	for (int i = 0; i < a; i++)
	{
		cin >> y[i];
	}
	//sort(y, y + a);
	long double tmp = 0;
	long double tmp2 = 0;
	for (int i = 0; i < b; i++)
	{
		tmp += y[i];
	}
	tmp += b;
	tmp2 = max(tmp2, tmp);
	for (int i = b; i < a; i++)
	{
		tmp -= y[i - b];
		tmp += y[i];
		tmp2 = max(tmp2, tmp);

	}

	cout << tmp2/long double(2) << endl;
	//cout << ans << endl;



	//return 0;

	/*cout << c << endl;
	cout << b << endl;*/
	//cout << fixed << setprecision(10) <<tmp << endl;
	//cout<<factorial<10><<endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:22: error: expected primary-expression before 'long'
   73 |         cout << tmp2/long double(2) << endl;
      |                      ^~~~
Language: C++

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

int main() {
  int n, k; cin >> n >> k;
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p.at(i);
  }
  int ind;
  long long out = 0, tmp = 0;
  for(int i = 0; i < k; i++){
    tmp += p.at(i);
  }
  long long out = tmp;
  for(int j = k; j < n; j++){
    sum = tmp - p.at(j - k) + p.at(j);
    if(sum > out) out = sum;
    tmp = sum;
  }
  double e = (double(out) + k) / 2;
  cout << setprecision(10) << e;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: redeclaration of 'long long int out'
   15 |   long long out = tmp;
      |             ^~~
a.cc:11:13: note: 'long long int out' previously declared here
   11 |   long long out = 0, tmp = 0;
      |             ^~~
a.cc:17:5: error: 'sum' was not declared in this scope
   17 |     sum = tmp - p.at(j - k) + p.at(j);
      |     ^~~
Language: C++

#include "iostream"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;

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;
}

template <typename T>
void drop(const T& x) {
  cout << x << endl;
  exit(0);
}

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

  ll N, K;
  cin >> N >> K;
  V<ll> p(N);
  rep(i, N) cin >> p[i];
  V<double> es(N);
  rep(i, N) { es[i] = (p[i] + 1) / 2; }

  double res = 0;
  double current = 0;

  rep(i, N) {
    current += es[i];

    if (i - (K - 1) >= 0) {
      current -= es[i - K];
    }

    chmax(res, current);
  }

  cout << fixed << setprecision(10);
  cout << res << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:20: error: 'setprecision' was not declared in this scope
   61 |   cout << fixed << setprecision(10);
      |                    ^~~~~~~~~~~~
a.cc:4:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    3 | #include "vector"
  +++ |+#include <iomanip>
    4 | #define rep(i, to) for (ll i = 0; i < (to); ++i)
Language: C++

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include <unordered_set>
#include <cassert>
using namespace std;

vector<string> s(100000);
vector<string> bufs(100000);
int h, w;

void block(int i, int j){
    if(!(i < 0 || h <= i || j < 0 || w <= j))
    bufs[i][j] = '#';
}

int search(int i, int j){
    if(i < 0 || h <= i || j < 0 || w <= j) return 401;
    if(bufs[i][j] == 'g') return 0;
    else{
        if(s[i][j] == '#' ||bufs[i][j] == '*') return 401;
        bufs[i][j] = '*';
        int res = 1 + min(search(i+1, j), min(search(i-1, j), min(search(i, j+1), search(i, j-1))));
        return res;
    }
}
int search_(int i, int j, int gi, int gj){
    copy(s.begin(), s.end(), back_inserter(bufs) );
    bufs[gi][gj] = 'g';    
    int a = search(i,j);
    copy(s.begin(), s.end(), back_inserter(bufs) );
    return a;
}


bool if_road(int i, int j){
    if(i < 0 || h <= i || j < 0 || w <= j) return false;
    else if(s[i][j] == '#') return false;
    else return true;
}

bool if_end(int i, int j){
    int che = 0;
    if(if_road(i+1, j)) che ++;
    if(if_road(i-1, j)) che ++;
    if(if_road(i, j+1)) che ++;
    if(if_road(i, j-1)) che ++;

    if(che == 1) return true;
    else return false;
}

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n+10);
    rep(i,n){
        cin >> p[i];
    }
    long long int buf = 0;
    rep(i,k){
        buf += p[i];
    }
    long long int resmax = 0;
    int res = 0;
    rep(i,n-(k-1)){
        if(resmax < buf){
            resmax = buf;
            res = i;
        }
        // resmax = max(resmax, buf);
        buf += p[i+k];
        buf -= p[i];
    }
    long float out = 0;
    rep(i,k){
        out += (p[res+i]+1)/2.0;
    }
    cout << out << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:5: error: 'long' specified with 'float'
   93 |     long float out = 0;
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

set<int> s;
int n, k, sum, a, l;

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> aa;
        s.insert(-x);
    }
    sum = k;
    for(set,int > :: iterator it = s.begin(); i != s.end() && l < k; it++){
        sum += *it;
        l++;
    ]
    cout << sum / 2;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'aa' was not declared in this scope; did you mean 'a'?
   11 |         cin >> aa;
      |                ^~
      |                a
a.cc:12:19: error: 'x' was not declared in this scope
   12 |         s.insert(-x);
      |                   ^
a.cc:15:12: error: expected unqualified-id before ',' token
   15 |     for(set,int > :: iterator it = s.begin(); i != s.end() && l < k; it++){
      |            ^
a.cc:15:13: error: expected unqualified-id before 'int'
   15 |     for(set,int > :: iterator it = s.begin(); i != s.end() && l < k; it++){
      |             ^~~
a.cc:15:13: error: expected ';' before 'int'
   15 |     for(set,int > :: iterator it = s.begin(); i != s.end() && l < k; it++){
      |             ^~~
      |             ;
a.cc:15:17: error: expected unqualified-id before '>' token
   15 |     for(set,int > :: iterator it = s.begin(); i != s.end() && l < k; it++){
      |                 ^
a.cc:15:47: error: 'i' was not declared in this scope
   15 |     for(set,int > :: iterator it = s.begin(); i != s.end() && l < k; it++){
      |                                               ^
a.cc:15:68: error: expected ')' before ';' token
   15 |     for(set,int > :: iterator it = s.begin(); i != s.end() && l < k; it++){
      |        ~                                                           ^
      |                                                                    )
a.cc:15:70: error: 'it' was not declared in this scope; did you mean 'int'?
   15 |     for(set,int > :: iterator it = s.begin(); i != s.end() && l < k; it++){
      |                                                                      ^~
      |                                                                      int
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n,k;
int t[222222];
int r[222222];

int sum_t[222222];
int sum_r[222222];
double sum_d[222222];


int main(){
    cin>>n>>k;
    rep(i,n)cin>>t[i];
    rep(i,n)r[i]=t[i]*(1+t[i])/2;


    int tt=0,rr=0;
    double ss=0.0;

    rep(i,k){
        tt+=t[i],rr+=r[i];
        ss+=(double)r[i]/(double)t[i];
    }

    for(int i=k;i<=n;i++){
        
        ans=max(ss,ans);
        ans-=(double)r[i-k]/(double)t[i-k];
        ans+=(double)r[i]/(double)t[i];
       // sum_r[i]=rr;
        //sum_t[i]=tt;

       // rr+=r[i];
        //rr-=r[i-k];
        //tt+=t[i];
       // tt-=t[i-k];
    }
    printf("%.10lf\n",ans);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 |         ans=max(ss,ans);
      |         ^~~
      |         abs
a.cc:59:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   59 |     printf("%.10lf\n",ans);
      |                       ^~~
      |                       abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int a[200005]; 
int main(){
	int n,i,j;
	double k,sum=0.0,mx=0.0;
	cin>>n>>k;
	for(i=1;i<k;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for(i=k;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
		sum-=a[k-i+1];
		if(sum>mx) mx=sum;
	}
	cout<<fixed<<setprecision(10)<<(mx+k)/2;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: invalid types 'int [200005][double]' for array subscript
   15 |                 sum-=a[k-i+1];
      |                       ^
Language: C++

#include<stdio.h>

int n,k,p;
int exp[200000],sumk,ans;

int main(){
  scanf("%d%d",&n,&k);
  for(int i=0;i<n;i++){
    scanf("%d",&p);
    exp[i]=p+1;
    sumk+=exp[i];
    if(i==k)ans=sumk;
    if(i>k){
      sumk-=exp[i-k];
      if(ans>sumk)ans=sumk;
    }
  }
  printf("%.12f",ans/2LF);
  return 0;
}

Compiler output:
a.cc:4:5: warning: built-in function 'exp' declared as non-function [-Wbuiltin-declaration-mismatch]
    4 | int exp[200000],sumk,ans;
      |     ^~~
a.cc: In function 'int main()':
a.cc:18:22: error: unable to find numeric literal operator 'operator""LF'
   18 |   printf("%.12f",ans/2LF);
      |                      ^~~
Language: C++

int n, k, m, mx, a[200003], he[200003];
double ans, x[200003], sum[200003];
string ss, t;

signed main()
{
	n = gi(), k = gi();
	for (int i = 1; i <= n; i+=1) a[i] = gi(), mx = max(mx, a[i]);
	for (int i = 1; i <= mx; i+=1) he[i] = he[i - 1] + i;
	for (int i = 1; i <= n; i+=1)
	{
		x[i] = 1. * he[a[i]] * (1. / a[i]);
	//	printf("%lld %.5lf %.5lf\n", he[a[i]], 1. / a[i], x[i]);
	}
	for (int i = 1; i <= n; i+=1) 
	{
		sum[i] = sum[i - 1] + x[i];
	}
	ans = 0.0;
	for (int i = 1; i + k - 1 <= n; i+=1)
	{
		double kk = sum[i + k - 1] - sum[i - 1];
		//printf("%.5lf %.5lf\n", sum[i + k - 1], sum[i - 1]);
		if (kk > ans) ans = kk;
		//printf("%.5lf %.5lf\n", kk, ans);
	}
	printf("%.10lf\n", ans);
	return 0;
}


Compiler output:
a.cc:3:1: error: 'string' does not name a type
    3 | string ss, t;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:7:13: error: 'gi' was not declared in this scope
    7 |         n = gi(), k = gi();
      |             ^~
a.cc:8:57: error: 'max' was not declared in this scope; did you mean 'mx'?
    8 |         for (int i = 1; i <= n; i+=1) a[i] = gi(), mx = max(mx, a[i]);
      |                                                         ^~~
      |                                                         mx
a.cc:27:9: error: 'printf' was not declared in this scope
   27 |         printf("%.10lf\n", ans);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int n, k, m, mx, a[200003], he[200003];
Language: C++

#include<stdio.h>

int n,k,p;
int exp[200000],sumk,ans;

int main(){
  scanf("%d%d",&n,&k);
  for(int i=0;i<n;i++){
    scanf("%d",&p);
    exp[i]=p+1;
    sumk+=exp;
    if(i==k)ans=sumk;
    if(i>k){
      sumk-=exp[i-k];
      if(ans>sumk)ans=sumk;
    }
  }
  printf("%.12f",ans/2LD);
  return 0;
}

Compiler output:
a.cc:4:5: warning: built-in function 'exp' declared as non-function [-Wbuiltin-declaration-mismatch]
    4 | int exp[200000],sumk,ans;
      |     ^~~
a.cc: In function 'int main()':
a.cc:11:9: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   11 |     sumk+=exp;
      |     ~~~~^~~~~
      |         |
      |         int*
a.cc:18:22: error: unable to find numeric literal operator 'operator""LD'
   18 |   printf("%.12f",ans/2LD);
      |                      ^~~
Language: C++

#include <bits/stdc++.h>

#define llint long long int

using namespace std;

int main(){
    int N, K;

    cin >> N >> K;

    vector<double> p(N);

    for(int i = 0; i < N; i ++){
        int t;

        cin >> t;

        p[i] = 0.5 * (t + 1);
    }
    long long double sum = 0;

    for(int i = 0; i < K - 1; i ++){
        sum += p[i];
    }
    long long double max = 0;

    for(int i = K - 1; i < N; i ++){
        sum += p[i];

        if(sum > max){
            max = sum;
        }
        sum -= p[i - K + 1];
    }
    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:10: error: 'long long' specified with 'double'
   21 |     long long double sum = 0;
      |          ^~~~
a.cc:26:10: error: 'long long' specified with 'double'
   26 |     long long double max = 0;
      |          ^~~~
Language: C

//by (111110101)2
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
int n,k;
double a[202020],ans,al;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=k;i++)
	{
		ans+=(a[i]+1.0)/2.0;
	}
	int l=1,r=k;
	while(r<=n)
	{
		al=max(al,ans);
		ans-=(a[l]+1.0)/2.0;
		ans+=(a[r+1]+1.0)/2.0;
		l++;
		r++;
	}
	al=max(al,ans);
	cout<<al<<endl;
	return 0;
}

Compiler output:
main.c:2:9: fatal error: iostream: No such file or directory
    2 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,k;
	cin>>n>>k;
	vector<ll> dice(n);
	for (int i = 0; i<n; i++){
		cin>>dice[i];
	}
	ll maxsum = 0;
	ll cursum = 0;
	for (int i = 0; i<k; i++){
		cursum+=dice[i];
	}
	maxsum=cursum;
	for (int i = k; i<n; i++){
		cursum+=dice[i];
		cursum-=dice[i-k];
		maxsum=max(maxsum,cursum);
	}
	//cout<<maxsum<<endl;
	maxsum+=k;
	long long double ans = maxsum;
	ans/=2;
	cout<<setprecision(15)<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:14: error: 'long long' specified with 'double'
   24 |         long long double ans = maxsum;
      |              ^~~~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define int               long long
#define fr                first
#define sc                second
#define vc                vector
#define endl              '\n'
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define LSB(i)            ((i)&-(i))

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve()
{
    int n, k;
    cin >> n >> k;
    int a[n]
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10000);
    double p[n + 1];
    mem0(p);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        double e = a[i] + 1;
        p[i + 1] = (e) / (2);
        //cout << p[i + 1] << " ";
        p[i + 1] += p[i];
    }
    double ans = 0;
    for (int i = 1; i <= n - k + 1; i++)
    {
        ans = max(ans, p[i + k - 1] - p[i - 1]);
    }
    cout << ans << endl;
}
signed main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:35:5: error: expected initializer before 'cout'
   35 |     cout.setf(ios::fixed, ios::floatfield);
      |     ^~~~
a.cc:41:16: error: 'a' was not declared in this scope
   41 |         cin >> a[i];
      |                ^
Language: C++

		if (i >= K) sum -= (double)(1 + P[i - K]) * P[i - K] / 2 / P[i - K];


Compiler output:
a.cc:1:17: error: expected unqualified-id before 'if'
    1 |                 if (i >= K) sum -= (double)(1 + P[i - K]) * P[i - K] / 2 / P[i - K];
      |                 ^~
Language: C++

fun main(args: Array<String>) {
    abc154d()
}

fun abc154d() {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val pList = readLine()!!.split(' ').map { it.toInt() }

    val list = pList.map { 0.5 + it.toDouble() / 2 }

    val cSum = DoubleArray(n + 1)
    for (i in 0 until n) cSum[i + 1] = cSum[i] + list[i]

    var answer = 0.0

    for (i in 0..n - k) {
        answer = Math.max(answer, cSum[i + k] - cSum[i])
    }

    return println(answer)
}


Compiler output:
a.cc:16:15: error: too many decimal points in number
   16 |     for (i in 0..n - k) {
      |               ^~~~
a.cc:1:1: error: 'fun' does not name a type
    1 | fun main(args: Array<String>) {
      | ^~~
a.cc:5:1: error: 'fun' does not name a type
    5 | fun abc154d() {
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#defien rep(i,n) for (int i=0;i<n;i++)

int main() {
  int n,m;cin>>n>>m;
  vector<double> s(n);
  rep(i,n) cin>>s[i];
  sort(s.begin(),s.end());
  double ans=0;
  for (int i=n-m;i<n;i++) {
    ans += (1+s[i])/2;
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc:3:2: error: invalid preprocessing directive #defien; did you mean #define?
    3 | #defien rep(i,n) for (int i=0;i<n;i++)
      |  ^~~~~~
      |  define
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   rep(i,n) cin>>s[i];
      |       ^
a.cc:8:3: error: 'rep' was not declared in this scope
    8 |   rep(i,n) cin>>s[i];
      |   ^~~
Language: C++

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

int main() {
	long long n,m,i,j,k,ans,cur;
	cin >> n >> k;
	vector<long long> a(n);
	
	for(i=0; i<n; i++){
		cin >> p[i];
		p[i]++;
	}
	
	ans=0; cur=0;
	for(i=0; i<k; i++){
		cur+=p[i];
		ans=cur;
	}
	for(i=k; i<n; i++){
		cur=cur-p[i-k]+p[i];
		ans=max(cur,ans);
	}
	cout << double(ans/2.0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'p' was not declared in this scope
   10 |                 cin >> p[i];
      |                        ^
a.cc:16:22: error: 'p' was not declared in this scope
   16 |                 cur+=p[i];
      |                      ^
a.cc:20:25: error: 'p' was not declared in this scope
   20 |                 cur=cur-p[i-k]+p[i];
      |                         ^
Language: C++

#include "stdafx.h"
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define S second
using namespace std;
int x[1000000];
signed main() {
	int a, b, z = 0, ans = 0;
	cin >> a >> b;
	f(i, a) {
		cin >> x[i];
		if (i < b - 1)z += x[i];
	}
	for (int i = b - 1; i < a; i++) {
		z += x[i];
		if (i >= b)z -= x[i - b];
		ans = max(z, ans);
	}
	cout << (ans + b) / 2.0 << endl;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;
const int MAXN = 500005;

int n;
double a[100005];

int main() {
	cin >>n;
	for (int i=0 ; i<n ; i++) {
		int x;
		scanf("%d", &x);
		a[i] = double(x+1)/2;
	}
	double exp = 0;
	double maxx = 0;
	for (int i=0 ; i<k ; i++) {
		exp += a[i];
	}
	maxx = exp;
	for (int i=k ; i<n ; i++) {
		exp-=a[i-k];
		exp+=a[i];
		maxx = max(maxx, exp);
	}
	printf("%.7lf\n", maxx);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: 'k' was not declared in this scope
   28 |         for (int i=0 ; i<k ; i++) {
      |                          ^
a.cc:32:20: error: 'k' was not declared in this scope
   32 |         for (int i=k ; i<n ; i++) {
      |                    ^
Language: C++

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

const long double EPS = 1e-8;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N>>K;
	vector<long long int>v(N);
	for(auto &i:v)cin>>i;
	for(int i=1;i<N;i++)v[i]+=v[i-1];
	long long int ans=v[K-1];
	for(int i=K;i<N;i++){
		ans=max(ans,v[i]-v[i-K]);
	}
	long double box=ans;
	box/=2;
	cout<<setprecision(20)<<box<<endl;
}


Compiler output:
a.cc:33:19: error: conflicting declaration 'const long double EPS'
   33 | const long double EPS = 1e-8;
      |                   ^~~
a.cc:28:18: note: previous declaration as 'constexpr const double EPS'
   28 | constexpr double EPS = 1e-8;
      |                  ^~~
Language: C

#include <iostream>
#include "bits/stdc++.h"
#define ll long long int 
using namespace std;
int dfs(int pos,int n, bool flag,string s,int count,vector<vector<vector<int>>>& dp,int k){
        if(pos >= n) return(count == k);
        if(dp[pos][count][flag] != -1) return dp[pos][count][flag];
        int limit=9;
        if(flag ) limit = s[pos]-'0';
        int res=0;
        for(int i=0;i<=limit;i++){
            if(!flag || i < limit){
                if(i != 0) res+=dfs(pos+1,n,0,s,count+1,dp,k);
                else res+=dfs(pos+1,n,0,s,count,dp,k);
            }
            else{
               if(i != 0) res+=dfs(pos+1,n,1,s,count+1,dp,k);
                else res+=dfs(pos+1,n,1,s,count,dp,k);
            }
        }
        return dp[pos][count][flag]=res;
    }
int main()
{
        int n,k;
        cin >> n >>k;
        string s= to_string(n);
        vector<vector<vector<int>>> dp(s.size(),vector<vector<int>>(162,vector<int>(2,-1)));
        cout<<dfs(0,s.size(),1,s,0,dp,k)<<endl;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++


#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0;i < (n);i++)
using namespace std;
typedef long long ll;

]

int main() {
  ll N, K;
  cin >> N >> K;
  string s = to_string(N);
  ll dp[105][2][4];

  rep(i,105) {
    rep(smaller, 2) {
      rep(k, 2){
        dp[i][smaller][k] = 0;
      }
    }
  }

  dp[0][0][0] = 1;  
  rep(i,s.size()) {
    rep(smaller, 2) {
      rep(k, 4){
        int c_ = s[i] - '0';
        rep(c,10) {
          int i_ = i+1;
          int smaller_ = smaller;
          int k_ = k;

          if( c != 0) {
            k_++;
          }
          if(k_ > K) {
            continue;
          }

          if(smaller_ == 0) {
            if(c_ < c) {
              continue;
            }else if(c < c_) {
              smaller_ = 1;
            }
          }
          dp[i_][smaller_][k_] += dp[i][smaller][k];
        }
      }
    }
  }
  cout << dp[s.size()][0][K] + dp[s.size()][1][K] << endl;
}

Compiler output:
a.cc:7:1: error: expected unqualified-id before ']' token
    7 | ]
      | ^
Language: C++

#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

ll solve(string s,ll k){
  ll n=s.size();
  ll m=0;
  if(k==1){
    m+=(n-1)*9;
    ll b=s[0]-'0';
    m+=b;
  }
  else if(k==2){
    if(n<=1){
      return 0;
    }
    m+=(n-1)*(n-2)/2*9*9;
    ll b=s[0]-'0';
    m+=(b-1)*(n-1)*9;
    ll c=1;
    while(c<n-1){
      if(s[c]!='0')break;
      c++;
    }
    string t=s.substr(c);
    m+=solve(t,1);
  }
  else{
    if(n<=2){
      return 0;
    }
    m+=(n-1)*(n-2)*(n-3)/6*9*9*9;
    ll b=s[0]-'0';
    m+=(b-1)*(n-1)*(n-2)/2*9*9;
    while(c<n-1){
      if(s[c]!='0')break;
      c++;
    }
    string t=s.substr(c);
    m+=solve(t,2);
  }
  return m;
}


int main(){

  string s;
  ll k;
  cin >> s >> k;
  // ll n=s.size();

  // ll m=0;

  // ll a=0;
  // ll b=1;
  // while(a<k){
  //   b*=(n-a);
  //   a++;
  // }
  // while(a>0){
  //   b/=a;
  //   a--;
  // }

  // m+=b*pow(9,k);

  // if(k==1){
  //   ll c=s[0];
  //   m+=c;
  // }
  // else if(k==2){
  //   if(n<=1){
  //     cout << 0 << endl;
  //     return 0;
  //   }
  //   ll c=s[0];
  //   ll d=s[1];
  //   m+=(c-1)*9*(n-1);
  //   m+=9*(n-2)+d;
  // }
  // else{
  //   if(n<=2){
  //     cout << 0 << endl;
  //     return 0;
  //   }
  //   ll c=s[0],d=s[1],e=s[2];
  //   m+=(c-1)*(n-1)*(n-2)/2*9*9;
  //   m+=(d-1);
  // }

  cout << solve(s,k) << endl;



}

Compiler output:
a.cc: In function 'long long int solve(std::string, long long int)':
a.cc:39:11: error: 'c' was not declared in this scope
   39 |     while(c<n-1){
      |           ^
a.cc:43:23: error: 'c' was not declared in this scope
   43 |     string t=s.substr(c);
      |                       ^
Language: C

//
// Created by Bhagirathi Nayak on 16/07/20.
//

#include <bits/stdc++.h>
string num;
int k,l;
int dp[1000000][4][2];

int count(int idx,int cnt_k,int already_smaller){

    //cout<<idx<<" "<<cnt_k<<" "<<already_smaller<<"\n";

    if(cnt_k>k)
        return 0;

    if(idx==l)
        return cnt_k==k;

    if(dp[idx][cnt_k][already_smaller]!=-1)
        return dp[idx][cnt_k][already_smaller];

    int curr_digit = num[idx]-'0';

    int lim = already_smaller == 1 ? 9 : curr_digit;

    int sum = 0;
    for (int digit = 0; digit <= lim; ++digit) {
        sum += count(idx+1,
                digit!=0 ? cnt_k+1:cnt_k,
                digit<curr_digit || already_smaller);
    }

    dp[idx][cnt_k][already_smaller] = sum;
    return sum;
}

int main(){
    cin>>num;
    cin>>k;

    l=num.length();

    for (int i = 0 ; i < 1000000 ; ++i) {
        for (int j = 0; j < 4; ++j) {
            for (int m = 0; m < 2; ++m) {
                dp[i][j][m] = -1;
            }
        }
    }

    cout<<count(0,0,0)<<endl;
    //cout<<count(0,0,1)<<endl;

    return 0;
}



Compiler output:
main.c:5:10: fatal error: bits/stdc++.h: No such file or directory
    5 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

//
// Created by Bhagirathi Nayak on 16/07/20.
//

#include <bits/stdc++.h>

string num;
int k,l;
int dp[1000000][4][2];

int count(int idx,int cnt_k,int already_smaller){

    //cout<<idx<<" "<<cnt_k<<" "<<already_smaller<<"\n";

    if(cnt_k>k)
        return 0;

    if(idx==l)
        return cnt_k==k;

    if(dp[idx][cnt_k][already_smaller]!=-1)
        return dp[idx][cnt_k][already_smaller];

    int curr_digit = num[idx]-'0';

    int lim = already_smaller == 1 ? 9 : curr_digit;

    int sum = 0;
    for (int digit = 0; digit <= lim; ++digit) {
        sum += count(idx+1,
                digit!=0 ? cnt_k+1:cnt_k,
                digit<curr_digit || already_smaller);
    }

    dp[idx][cnt_k][already_smaller] = sum;
    return sum;
}

int main(){
    cin>>num;
    cin>>k;

    l=num.length();

    for (int i = 0 ; i < 1000000 ; ++i) {
        for (int j = 0; j < 4; ++j) {
            for (int m = 0; m < 2; ++m) {
                dp[i][j][m] = -1;
            }
        }
    }

    cout<<count(0,0,0)<<endl;
    //cout<<count(0,0,1)<<endl;

    return 0;
}



Compiler output:
a.cc:7:1: error: 'string' does not name a type; did you mean 'stdin'?
    7 | string num;
      | ^~~~~~
      | stdin
a.cc: In function 'int count(int, int, int)':
a.cc:24:22: error: 'num' was not declared in this scope; did you mean 'enum'?
   24 |     int curr_digit = num[idx]-'0';
      |                      ^~~
      |                      enum
a.cc: In function 'int main()':
a.cc:40:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   40 |     cin>>num;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:5:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:40:10: error: 'num' was not declared in this scope; did you mean 'enum'?
   40 |     cin>>num;
      |          ^~~
      |          enum
a.cc:53:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   53 |     cout<<count(0,0,0)<<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:53:25: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   53 |     cout<<count(0,0,0)<<endl;
      |                         ^~~~
      |                         std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"

const ll MOD = 1000000007;

ll ncr(ll n, ll r){
    if(n < r) return 0ll;
    ll res = 1;
    rep(i, 0, r) res *= (n - i);
    repp(i, 2, r) res /= i;
    return res;
}
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    string s;
    cin >> s;
    int n = s.size();
    int k;
    cin >> k;
    s += '0';

    ll x = n, y = n;
    rep(i, 1, n) if(s[i] != '0'){x = i; break;}
    rep(i, x + 1, n) if(s[i] != '0'){y = i; break;}

    ll res = ncr(n, k);
    rep(i, 0, k) res *= 9;

    if(k == 1) res -= (9 - s[0] + '0');

    if(k == 2){
        if(x == n) res -= (10 - s[0] + '0')*(n-1)*9;
        else
            res -= (9 - s[x] + '0'),
            res -= (x - 1)*9,
            res -= (9 - s[0] + '0')*(n-1)*9;
    }

    if(k == 3){
        if(x == n && y == n) res -= (10 - s[0] +'0')*ncr(n-1, 2)*9*9;
        if(x < n && y == n){
            res -= (n - x - 1)*9,
            res -= (9 - s[x] + '0')*(n - x - 1)*9,
            res -= (x - 1) * (n - x) * 81,
            res -= (9 - s[0] + '0')*ncr(n-1, 2)*81;
        }
        if(x < n && y < n){
            res -= (9 - s[y] + '0'),
            res -= (y - x - 1)*9,
            res -= (9 - s[x] + '0')*(n - x - 1)*9,
            res -= (x - 1)*9*(n - x)*9,
            res -= (9 - s[0] + '0')*ncr(n-1, 2)*9*9;
        }
    }

    ll ans = 0;
    rep(i, 2, n-1) ans += (i*(i-1))/2 * 9 * 9 * 9;
	ans += max(0,(s[0]-'0'-1) * (n-1) * (n-2) / 2 * 9 * 9);
    rep(i, 1, n){
		if(s[i] != '0'){
			ans += max(0,(s[i]-'0'-1) * (n-i-1) * 9);
			ans += max(0,(n-i-1)*(n-i-2) / 2 * 9 * 9);
			for(int j=i+1;j<n;j++){
				if(s[j] != '0'){
					
					ans += s[j]-'0';
					ans += max(0,(n-j-1)*9);
					
					break;
				}
			}
			break;
		}
	}

    // if(k == 3 && x < n && y == n) cout << ans;
    else cout << res;
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:109:5: error: 'else' without a previous 'if'
  109 |     else cout << res;
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    string N;
    int K;
    cin>>N>>K;
    int digit = N.size();
    long ans = 0;
    if (K > digit){
        ans = 0;
    }else{
        if(K == 1){
            ans = (digit-1) * 9 + (N[0] - '0');
        }
        if(K == 2){
            ans = ((digit-1)*(digit-2)/2) * 9 * 9 + (N[0] - '0' - 1) * (digit - 1) * 9 + (N[1] - '0') + (digit - 2) * 9;
        }
        if(K == 3){
            ans = ((digit-1)*(digit-2) * (digit-3)/6) * 9 * 9 * 9 + (N[0] - '0' - 1) * (digit-1)*(digit-2)/2 * 9 * 9 + (N[1] - '0' - 1) * (digit - 2) * 9 +　(N[2] - '0') + (digit - 3) * 9;;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc:28:156: error: extended character 　 is not valid in an identifier
   28 |             ans = ((digit-1)*(digit-2) * (digit-3)/6) * 9 * 9 * 9 + (N[0] - '0' - 1) * (digit-1)*(digit-2)/2 * 9 * 9 + (N[1] - '0' - 1) * (digit - 2) * 9 +　(N[2] - '0') + (digit - 3) * 9;;
      |                                                                                                                                                            ^
a.cc: In function 'int main()':
a.cc:28:156: error: '\U00003000' was not declared in this scope
   28 |             ans = ((digit-1)*(digit-2) * (digit-3)/6) * 9 * 9 * 9 + (N[0] - '0' - 1) * (digit-1)*(digit-2)/2 * 9 * 9 + (N[1] - '0' - 1) * (digit - 2) * 9 +　(N[2] - '0') + (digit - 3) * 9;;
      |                                                                                                                                                            ^~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;

ll choose(ll l, ll r){
  if(l < r || r <= 0) return 0;
  ll ret = 1;
  for(ll i = l; i >= l - r + 1; i--){
    ret *= i;
  }
  for(ll i = r; i >= 1; i--){
    ret /= i;
  }
  return ret;
}

ll func1(string n){
  ll f = n[0] - '0', ans = 0;
  ans += f;
  ans += choose(n.size() - 1, 1) * pow(9, 1);
  return ans;
}

ll func2(string n){
  ll f = n[0] - '0', ans = 0, zn = 0;
  for(int i = 1; i < n.size(); i++){
    ll x = n[i] - '0';
    if(x != 0){
      ans += x;
      ans += choose(n.size() - i - 1, 1 - zn) * pow(9, 1 - zn);
      break;
    }
  }
  ans += (f - 1) * choose(n.size() - 1, 1) * pow(9, 1);
  ans += choose(n.size() - 1, 2) * pow(9, 2);
  return ans;
}

ll func3(string n){
  ll f = n[0] - '0', s, t, ans = 0, cnt = 0, si, zn = 0;
  for(int i = 1; i < n.size(); i++){
    ll x = n[i] - '0';
    if(x != 0){
      cnt++;
      if(cnt == 1){
        s = x;
        si = i;
        zns = zn;
      }
      if(cnt == 2){
        t = x;
        ans += t;
        ans += choose(n.size() - i - 1, 1 - zn) * pow(9, 1 - zn);
        break;
      }
    }
    else zn++;
  }
  ans += (s - 1) * choose(n.size() - si - 1, 1 - zns) * pow(9, 1 - zns);
  ans += choose(n.size() - si - 1, 2 - zns) * pow(9, 2 - zns);
  ans += (f - 1) * choose(n.size() - 1, 2) * pow(9, 2);
  ans += choose(n.size() - 1, 3) * pow(9, 3);
  return ans;
}

void solve(){
  string n; cin >> n;
  int k; cin >> k;
  ll ans;
  if(k == 3) ans = func3(n);
  else if(k == 2) ans = func2(n);
  else ans = func1(n);
  cout << ans << endl;


  return;
}

int main(){
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'll func3(std::string)':
a.cc:52:9: error: 'zns' was not declared in this scope; did you mean 'zn'?
   52 |         zns = zn;
      |         ^~~
      |         zn
a.cc:63:50: error: 'zns' was not declared in this scope; did you mean 'zn'?
   63 |   ans += (s - 1) * choose(n.size() - si - 1, 1 - zns) * pow(9, 1 - zns);
      |                                                  ^~~
      |                                                  zn