Language: C++

#include<bits/stdc++.h>
using namespace std;]
typedef long long ll;
int main(){
    ll n,k;cin>>n>>k;
    vector<ll>a(n);
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    vector<ll>y(10000);
    ll j=0;
    for(int i=1;i<sum+1;i++){
        if(sum%i){
            y[j]=i;
            j++;
        }
    }
    ll ans=1;
    for(int i=0;y[i];i++){
        ll s=y[i];
        priority_queue<ll>pq;
        ll ss=0;
        for(int j=0;j<n;j++){
            ss+=a[i]%ss;
            pq.push(ss%sum);
        }
        ll cnt=ss;
        for(int j=0;j<ss/sum;j++){
            cnt+=sum-2*pq.top();
            pq.pop();
        }
        if(cnt<=2*k){
            ans=i;
        }
    }
    cout<<i<<endl;
}

Compiler output:
a.cc:2:21: error: expected unqualified-id before ']' token
    2 | using namespace std;]
      |                     ^
a.cc: In function 'int main()':
a.cc:5:5: error: 'll' was not declared in this scope
    5 |     ll n,k;cin>>n>>k;
      |     ^~
a.cc:5:17: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |     ll n,k;cin>>n>>k;
      |                 ^
      |                 yn
a.cc:5:20: error: 'k' was not declared in this scope
    5 |     ll n,k;cin>>n>>k;
      |                    ^
a.cc:6:14: error: template argument 2 is invalid
    6 |     vector<ll>a(n);
      |              ^
a.cc:7:7: error: expected ';' before 'sum'
    7 |     ll sum=0;
      |       ^~~~
      |       ;
a.cc:9:15: error: invalid types 'int[int]' for array subscript
    9 |         cin>>a[i];
      |               ^
a.cc:10:9: error: 'sum' was not declared in this scope
   10 |         sum+=a[i];
      |         ^~~
a.cc:10:15: error: invalid types 'int[int]' for array subscript
   10 |         sum+=a[i];
      |               ^
a.cc:12:14: error: template argument 2 is invalid
   12 |     vector<ll>y(10000);
      |              ^
a.cc:13:7: error: expected ';' before 'j'
   13 |     ll j=0;
      |       ^~
      |       ;
a.cc:14:19: error: 'sum' was not declared in this scope
   14 |     for(int i=1;i<sum+1;i++){
      |                   ^~~
a.cc:16:15: error: 'j' was not declared in this scope
   16 |             y[j]=i;
      |               ^
a.cc:20:7: error: expected ';' before 'ans'
   20 |     ll ans=1;
      |       ^~~~
      |       ;
a.cc:21:18: error: invalid types 'int[int]' for array subscript
   21 |     for(int i=0;y[i];i++){
      |                  ^
a.cc:22:11: error: expected ';' before 's'
   22 |         ll s=y[i];
      |           ^~
      |           ;
a.cc:23:26: error: template argument 2 is invalid
   23 |         priority_queue<ll>pq;
      |                          ^
a.cc:23:26: error: template argument 3 is invalid
a.cc:24:11: error: expected ';' before 'ss'
   24 |         ll ss=0;
      |           ^~~
      |           ;
a.cc:26:13: error: 'ss' was not declared in this scope
   26 |             ss+=a[i]%ss;
      |             ^~
a.cc:26:18: error: invalid types 'int[int]' for array subscript
   26 |             ss+=a[i]%ss;
      |                  ^
a.cc:27:16: error: request for member 'push' in 'pq', which is of non-class type 'int'
   27 |             pq.push(ss%sum);
      |                ^~~~
a.cc:27:24: error: 'sum' was not declared in this scope
   27 |             pq.push(ss%sum);
      |                        ^~~
a.cc:29:11: error: expected ';' before 'cnt'
   29 |         ll cnt=ss;
      |           ^~~~
      |           ;
a.cc:30:23: error: 'ss' was not declared in this scope
   30 |         for(int j=0;j<ss/sum;j++){
      |                       ^~
a.cc:30:26: error: 'sum' was not declared in this scope
   30 |         for(int j=0;j<ss/sum;j++){
      |                          ^~~
a.cc:31:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   31 |             cnt+=sum-2*pq.top();
      |             ^~~
      |             int
a.cc:31:27: error: request for member 'top' in 'pq', which is of non-class type 'int'
   31 |             cnt+=sum-2*pq.top();
      |                           ^~~
a.cc:32:16: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   32 |             pq.pop();
      |                ^~~
a.cc:34:12: error: 'cnt' was not declared in this scope; did you mean 'int'?
   34 |         if(cnt<=2*k){
      |            ^~~
      |            int
a.cc:35:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |             ans=i;
      |             ^~~
      |             abs
a.cc:38:11: error: 'i' was not declared in this scope
   38 |     cout<<i<<endl;
      |           ^