Language: C++

#include <bits/stdc++.h>
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;
    float an,ans;
    cin >> n >> k;
    vector<float> 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;
    }
    cout << ans;
}


Compiler output:
a.cc:2:6: error: 'cout' in namespace 'std' does not name a type
    2 | 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:17:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   17 |         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:18:9: error: 'ios' has not been declared
   18 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc: In function 'int main()':
a.cc:24:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   24 |     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:25:5: error: 'vector' was not declared in this scope
   25 |     vector<float> a(n);
      |     ^~~~~~
a.cc:25: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:25:12: error: expected primary-expression before 'float'
   25 |     vector<float> a(n);
      |            ^~~~~
a.cc:26:20: error: 'a' was not declared in this scope
   26 |     REP(i,n)cin >> a[i];
      |                    ^
a.cc:27:10: error: 'a' was not declared in this scope; did you mean 'an'?
   27 |     SORT(a);
      |          ^
a.cc:7:22: note: in definition of macro 'SORT'
    7 | #define SORT(x) sort(x.begin(), x.end())
      |                      ^
a.cc:7:17: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    7 | #define SORT(x) sort(x.begin(), x.end())
      |                 ^~~~
a.cc:27:5: note: in expansion of macro 'SORT'
   27 |     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);
      | ^~~~
a.cc:36:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   36 |     cout << ans;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~