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;
}
int a[100005];
int n;
int main(){
	int i,j;
	n=readint();
	for(i=1;i<=n;i++) a[i]=readint();
	for(i=2;i<=n;i++) a[i]+=a[i-1];
	long long ans=0;
	for(i=1;i<=n;i++){
		for(j=i;j<=n;j++){
			if(a[j]-a[i-1]==0) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}
/*
                   _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;
}
int a[100005];
int n;
int main(){
	int i,j;
	cin>>n;
	for(i=1;i<=n;i++) cin>>a[i];
	for(i=2;i<=n;i++) a[i]+=a[i-1];
	long long ans=0;
	for(i=1;i<=n;i++){
		for(j=i;j<=n;j++){
			if(a[j]==a[i-1]) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:136:11: error: redefinition of 'const int INF'
  136 | const int INF=1e9;
      |           ^~~
a.cc:41:11: note: 'const int INF' previously defined here
   41 | const int INF=1e9;
      |           ^~~
a.cc:137:12: error: redefinition of 'int pt(int*, int, int)'
  137 | inline int pt(int a[],int l,int r){
      |            ^~
a.cc:42:12: note: 'int pt(int*, int, int)' previously defined here
   42 | inline int pt(int a[],int l,int r){
      |            ^~
a.cc:152:13: error: redefinition of 'void q_sort(int*, int, int)'
  152 | inline void q_sort(int a[],int l,int r){
      |             ^~~~~~
a.cc:57:13: note: 'void q_sort(int*, int, int)' previously defined here
   57 | inline void q_sort(int a[],int l,int r){
      |             ^~~~~~
a.cc:160:12: error: redefinition of 'int readint()'
  160 | inline int readint(){
      |            ^~~~~~~
a.cc:65:12: note: 'int readint()' previously defined here
   65 | inline int readint(){
      |            ^~~~~~~
a.cc:175:5: error: redefinition of 'int a [100005]'
  175 | int a[100005];
      |     ^
a.cc:80:5: note: 'int a [100005]' previously declared here
   80 | int a[100005];
      |     ^
a.cc:176:5: error: redefinition of 'int n'
  176 | int n;
      |     ^
a.cc:81:5: note: 'int n' previously declared here
   81 | int n;
      |     ^
a.cc:177:5: error: redefinition of 'int main()'
  177 | int main(){
      |     ^~~~
a.cc:82:5: note: 'int main()' previously defined here
   82 | int main(){
      |     ^~~~