Language: C++

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . ___
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         佛祖保佑       永无BUG
*/
//use readint!
#include<map>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<cmath>
#include<stdio.h>
#include<fstream>
#include<assert.h>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<string.h>
#define mp make_pair
using namespace std;
const int INF=1e9;
inline int pt(int a[],int l,int r){
	int p,i,j;
	p=a[l];
	i=l;
	j=r+1;
	for(;;){
		while(a[++i]<p) if(i>=r) break;
		while(a[--j]>p) if(j<=l) break;
		if(i>=j) break;
		else swap(a[i],a[j]);
	}
	if(j==l) return j;
	swap(a[l],a[j]);
	return j;
}
inline void q_sort(int a[],int l,int r){
	int q;
	if(r>l){
		q=pt(a,l,r);
		q_sort(a,l,q-1);
		q_sort(a,q+1,r);
	}
}
inline int readint(){
    int x=0;
    int f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=getchar();
	if(ch=='-'){
		f=-1;
		ch=getchar();
	}
    while(ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
long long a[200005];
long long n;
map<long long,long long> mli;
int main(){
//	freopen("eee.d","r",stdin);
	long long i,j;
	cin>>n;
	for(i=1;i<=n;i++) cin>>a[i];
	for(i=2;i<=n;i++) a[i]=a[i]+a[i-1]; 
//	for(i=1;i<=n;i++) cout<<a[i]<<' ';
//	cout<<endl;
	mli[0]++;
	for(i=1;i<=n;i++){
		mli[a[i]]++;mli
//		cout<<a[i]<<" "<<[a[i]]<<endl;
	}
	long long ans=0;
	for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:32: error: expected ';' before '}' token
   93 |                 mli[a[i]]++;mli
      |                                ^
      |                                ;
   94 | //              cout<<a[i]<<" "<<[a[i]]<<endl;
   95 |         }
      |         ~                       
a.cc:97:54: error: conversion from '_Rb_tree_iterator<pair<[...],long long int>>' to non-scalar type '_Rb_tree_iterator<pair<[...],int>>' requested
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                             ~~~~~~~~~^~
a.cc:97:59: error: no match for 'operator!=' (operand types are 'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} and 'std::map<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'})
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                         ~~^~~~~~~~~~~
      |                                                         |          |
      |                                                         |          _Rb_tree_iterator<pair<[...],long long int>>
      |                                                         _Rb_tree_iterator<pair<[...],int>>
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/bits/stl_tree.h:63,
                 from /usr/include/c++/14/map:62,
                 from a.cc:24:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1052 |     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::pair<_T1, _T2>'
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                                     ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  455 |     operator!=(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>'
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                                     ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  500 |     operator!=(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>'
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                                     ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1686 |     operator!=(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>'
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                                     ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1753 |     operator!=(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>'
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                                     ^
In file included from /usr/include/c++/14/bits/stl_tree.h:64:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_Tp1>&, const allocator<_T2>&)'
  243 |     operator!=(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::allocator<_Tp1>'
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                                     ^
In file included from /usr/include/c++/14/bits/stl_map.h:63,
                 from /usr/include/c++/14/map:63:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_Args1 ...>&, const tuple<_Elements ...>&)'
 2613 |     operator!=(const tuple<_TElements...>& __t,
      |     ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::tuple<_Args1 ...>'
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                                     ^
/usr/include/c++/14/bits/stl_map.h:1557:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
 1557 |     operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1557:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<const long long int, int> >, std::less<long long int>, std::allocator<std::pair<const long long int, int> > >::iterator'} is not derived from 'const std::map<_Key, _Tp, _Compare, _Allocator>'
   97 |         for(map<long long,int>::iterator it=mli.begin();it!=mli.end();it++) ans+=(it->second*(it->second-1))/2;
      |                                                                     ^
In file included from /usr/include/c++/14/map:64:
/usr/include/c++/14/bits/stl_multimap.h:1179:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)'
 1179 |     operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_multimap.h:1179:5: note:   template argument deduction/substitution failed:
a.cc:97:69: note:   'std::map<long long int, int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, int>, std::_Select1st<std::pair<c