Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
vector<int>v;
map<string, int>m;
int gcd( int a,int b)
{
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);

}
void prime()
{
    bool p[201];
    for (int i=1;i<=200;i++) p[i]=true;
    for (int i=2;i*i<=200;i++)
    {
        if (p[i])
        {
            for (int j=2;i*j<=200;j++)
                p[i*j]=false;
        }
    }
    p[1]= false;
    for (int i=1;i<=200;i++)
    {
        if(p[i])
            v.push_back(i);
    }
    for (int i=0;i<v.size();i++)
    {
        for (int j=i+1;j<v.size();j++)
            m[i*j]++;
    }
    return ;
        
    
    
}
void f()
{
    ll x, y;
    x= 0 ,y=1;
    v.push_back(0);
    v.push_back(1);
    while (x<10000000)
    {
        ll t= x%10;
        x=y%10;
        y=t+y%10;
        cout <<y<<endl;
        v.push_back(y);
    }
}
void solve()
{
   int n; cin>>n;
   int a[n];
   for (int i=0;i<n;i++)
   {
       cin>>a[i];
       s+=a[i];
   }
   sort(a, a+n);
   s-a[0];
   cout <<s<<endl;
   return ;
}
int main()
{
    int t; t=1 ;while (t--)
    {
       solve();
       return 0;
    }
}


Compiler output:
a.cc: In function 'void prime()':
a.cc:35:14: error: no match for 'operator[]' (operand types are 'std::map<std::__cxx11::basic_string<char>, int>' and 'int')
   35 |             m[i*j]++;
      |              ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:34: note:   no known conversion for argument 1 from 'int' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  504 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:29: note:   no known conversion for argument 1 from 'int' to 'std::map<std::__cxx11::basic_string<char>, int>::key_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
  524 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
a.cc: In function 'void solve()':
a.cc:64:8: error: 's' was not declared in this scope
   64 |        s+=a[i];
      |        ^
a.cc:67:4: error: 's' was not declared in this scope
   67 |    s-a[0];
      |    ^