Language: C++

#include<bits/stdc++.h>
using namespace;
int main (void)
{
  vector<int> v;
  int n;
  for (int i = 0; i < n; ++i)
  {
    int x;
    cin>>x;
    v.push_back(x);
  }
  int m = *max_element(v.begin(),v.end());
  int sm = 0;
  bool done = false;
  for (int i = 0; i < n; ++i )
    {
     if(v[i] == m && !done)
       {
          sum+=v[i];
          done = true;
       }
    else sum += v[i];
   }
cout<<sum;
	
}

Compiler output:
a.cc:2:16: error: expected identifier before ';' token
    2 | using namespace;
      |                ^
a.cc: In function 'int main()':
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<int> v;
      |   ^~~~~~
a.cc:5:3: 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,
                 from a.cc:1:
/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:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> v;
      |          ^~~
a.cc:10:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |     cin>>x;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:11:5: error: 'v' was not declared in this scope
   11 |     v.push_back(x);
      |     ^
a.cc:13:24: error: 'v' was not declared in this scope
   13 |   int m = *max_element(v.begin(),v.end());
      |                        ^
a.cc:13:12: error: 'max_element' was not declared in this scope; did you mean 'std::max_element'?
   13 |   int m = *max_element(v.begin(),v.end());
      |            ^~~~~~~~~~~
      |            std::max_element
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:528:1: note: 'std::max_element' declared here
  528 | max_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
      | ^~~~~~~~~~~
a.cc:20:11: error: 'sum' was not declared in this scope; did you mean 'sm'?
   20 |           sum+=v[i];
      |           ^~~
      |           sm
a.cc:23:10: error: 'sum' was not declared in this scope; did you mean 'sm'?
   23 |     else sum += v[i];
      |          ^~~
      |          sm
a.cc:25:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   25 | cout<<sum;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:25:7: error: 'sum' was not declared in this scope; did you mean 'sm'?
   25 | cout<<sum;
      |       ^~~
      |       sm