fork download
  1. /*
  2. ****
  3. AUTHOR :- @soham01
  4. ****
  5. */
  6. #include "bits/stdc++.h"
  7. using namespace std;
  8. int main()
  9. {
  10. ios_base::sync_with_stdio(false);
  11. cin.tie(NULL);
  12. cout.tie(NULL);
  13. long long int n,k,m,s=0,c=0,i,j,f=0;
  14. cin>>n>>k>>m;
  15. long long int arr[n-1];
  16. for(i=0;i<n-1;i++)
  17. {
  18. cin>>arr[i];
  19. s+=arr[i];
  20. }
  21. c=(m*n)-s;
  22. cout<<c<<endl;
  23. if(s/n>=m)cout<<"0"<<endl;
  24. else if(c>k)cout<<"-1"<<endl;
  25. else cout<<c<<endl;
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 4408KB
stdin
5 10 7
8 10 3 6
stdout
8
8