Language: C++

#include <bits/stdc++.h>
#include<iomanip>
std::cout<<std::fixed<<std::setprecision(10)
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
int INF = 1e9 + 1;
int MOD = 1e9+7;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
signed main(){
    int n,k;
     double an,ans;
    cin >> n >> k;
    vector<double> a(n);
    REP(i,n)cin >> a[i];
    SORT(a);
    REP(i,k){
       REP(j,a[n-i-1]+1){
        an += j;
       }
       an /= a[n-i-1];
      ans += an;
      an=0;
    }
    printf("%d",ans);
}

Compiler output:
a.cc:3:6: error: 'cout' in namespace 'std' does not name a type
    3 | std::cout<<std::fixed<<std::setprecision(10)
      |      ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc: In constructor 'initon::initon()':
a.cc:18:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   18 |         cin.tie(0);
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:19:9: error: 'ios' has not been declared
   19 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc: In function 'int main()':
a.cc:25:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   25 |     cin >> n >> k;
      |     ^~~
      |     std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:26:5: error: 'vector' was not declared in this scope
   26 |     vector<double> a(n);
      |     ^~~~~~
a.cc:26:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:26:12: error: expected primary-expression before 'double'
   26 |     vector<double> a(n);
      |            ^~~~~~
a.cc:27:20: error: 'a' was not declared in this scope
   27 |     REP(i,n)cin >> a[i];
      |                    ^
a.cc:28:10: error: 'a' was not declared in this scope; did you mean 'an'?
   28 |     SORT(a);
      |          ^
a.cc:8:22: note: in definition of macro 'SORT'
    8 | #define SORT(x) sort(x.begin(), x.end())
      |                      ^
a.cc:8:17: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    8 | #define SORT(x) sort(x.begin(), x.end())
      |                 ^~~~
a.cc:28:5: note: in expansion of macro 'SORT'
   28 |     SORT(a);
      |     ^~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~