Language: C++

#include<iostream>
#include<map>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N + 1);
  for (int i = 0; i < A, size() ; i++)
  {
    cin >> A[i];
  }
  
  map<int int> m;
  vector<int> SUM(N + 1);
  SUM[0] = 0;
  for (int i = 0; i < N; i++)
  {
    SUM[i + 1] = (SUM[i] + A[i]) % M;
  }
  
  long long ans = 0;
  
  for (int i = 0; i < SUM.size(); i++)
  {
    ans += m[SUM[i]];
    m[SUM[i]]++;
  }
  
  cout << ans << endl;
  
}
    
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> A(N + 1);
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<map>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> A(N + 1);
      |          ^~~
a.cc:9:23: error: 'A' was not declared in this scope
    9 |   for (int i = 0; i < A, size() ; i++)
      |                       ^
a.cc:9:30: error: no matching function for call to 'size()'
    9 |   for (int i = 0; i < A, size() ; i++)
      |                          ~~~~^~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note:   candidate expects 1 argument, 0 provided
a.cc:14:7: error: two or more data types in declaration of 'type name'
   14 |   map<int int> m;
      |       ^~~
a.cc:14:14: error: wrong number of template arguments (1, should be at least 2)
   14 |   map<int int> m;
      |              ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:15:10: error: expected primary-expression before 'int'
   15 |   vector<int> SUM(N + 1);
      |          ^~~
a.cc:16:3: error: 'SUM' was not declared in this scope
   16 |   SUM[0] = 0;
      |   ^~~
a.cc:19:28: error: 'A' was not declared in this scope
   19 |     SUM[i + 1] = (SUM[i] + A[i]) % M;
      |                            ^
a.cc: At global scope:
a.cc:34:3: error: expected declaration before '}' token
   34 |   }
      |   ^