Language: C++

++.h>
using namespace std;

using LL = long long;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

double ex(LL p) { return (double)(p + 1) / 2; }

void solve(long long N, long long K, std::vector<long long> p) {
  // solver code

  double ans = 0;

  vector<double> vec(N);
  vec[0] = ex(p[0]);

  for (int i = 1; i < N; i++) {
    vec[i] = vec[i - 1] + ex(p[i]);
  }

  double tmp = vec[K - 1];
  for (int i = 0; i < N - K; i++) {
    tmp = vec[i + K] - vec[i];
    ans = max(ans, tmp);
  }

  cout << fixed << setprecision(10);
  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> p(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &p[i]);
  }
  solve(N, K, std::move(p));
  return 0;
}

Compiler output:
a.cc:1:1: error: expected unqualified-id before '++' token
    1 | ++.h>
      | ^~
a.cc:9:38: error: 'std::vector' has not been declared
    9 | void solve(long long N, long long K, std::vector<long long> p) {
      |                                      ^~~
a.cc:9:49: error: expected ',' or '...' before '<' token
    9 | void solve(long long N, long long K, std::vector<long long> p) {
      |                                                 ^
a.cc: In function 'void solve(long long int, long long int, int)':
a.cc:14:3: error: 'vector' was not declared in this scope
   14 |   vector<double> vec(N);
      |   ^~~~~~
a.cc:14:10: error: expected primary-expression before 'double'
   14 |   vector<double> vec(N);
      |          ^~~~~~
a.cc:15:3: error: 'vec' was not declared in this scope
   15 |   vec[0] = ex(p[0]);
      |   ^~~
a.cc:15:15: error: 'p' was not declared in this scope
   15 |   vec[0] = ex(p[0]);
      |               ^
a.cc:24:11: error: 'max' was not declared in this scope
   24 |     ans = max(ans, tmp);
      |           ^~~
a.cc:27:3: error: 'cout' was not declared in this scope
   27 |   cout << fixed << setprecision(10);
      |   ^~~~
a.cc:27:11: error: 'fixed' was not declared in this scope
   27 |   cout << fixed << setprecision(10);
      |           ^~~~~
a.cc:27:20: error: 'setprecision' was not declared in this scope
   27 |   cout << fixed << setprecision(10);
      |                    ^~~~~~~~~~~~
a.cc:28:18: error: 'endl' was not declared in this scope
   28 |   cout << ans << endl;
      |                  ^~~~
a.cc: In function 'int main()':
a.cc:33:3: error: 'scanf' was not declared in this scope
   33 |   scanf("%lld", &N);
      |   ^~~~~
a.cc:36:8: error: 'vector' is not a member of 'std'
   36 |   std::vector<long long> p(N);
      |        ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | ++.h>
a.cc:36:15: error: expected primary-expression before 'long'
   36 |   std::vector<long long> p(N);
      |               ^~~~
a.cc:38:20: error: 'p' was not declared in this scope
   38 |     scanf("%lld", &p[i]);
      |                    ^
a.cc:40:20: error: 'move' is not a member of 'std'
   40 |   solve(N, K, std::move(p));
      |                    ^~~~
a.cc:1:1: note: 'std::move' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
  +++ |+#include <utility>
    1 | ++.h>
a.cc:40:25: error: 'p' was not declared in this scope
   40 |   solve(N, K, std::move(p));
      |                         ^