Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define all(a) a.begin(),a.end()
using namespace std;
const ll M=1e9+7;
int n;
int a[200005];
ll ans=0;
ll prev[200005]={0};

int main(void){
	cin>>n;
	REP(i,n){
		cin>>a[i];
		prev[i+1]=prev[i]+a[i];
	}
//	REP(i,n+1)cout<<prev[i]<<' ';
//	cout<<endl;
	REP(i,n-1){
		ans=(ans+a[i]*(prev[n]-prev[i+1])%M)%M;
//		cout<<i<<':'<<a[i]<<' '<<prev[n]<<' '<<prev[i+1]<<endl;
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: reference to 'prev' is ambiguous
   26 |                 prev[i+1]=prev[i]+a[i];
      |                 ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:20:4: note:                 'long long int prev [200005]'
   20 | ll prev[200005]={0};
      |    ^~~~
a.cc:26:27: error: reference to 'prev' is ambiguous
   26 |                 prev[i+1]=prev[i]+a[i];
      |                           ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:20:4: note:                 'long long int prev [200005]'
   20 | ll prev[200005]={0};
      |    ^~~~
a.cc:31:32: error: reference to 'prev' is ambiguous
   31 |                 ans=(ans+a[i]*(prev[n]-prev[i+1])%M)%M;
      |                                ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:20:4: note:                 'long long int prev [200005]'
   20 | ll prev[200005]={0};
      |    ^~~~
a.cc:31:40: error: reference to 'prev' is ambiguous
   31 |                 ans=(ans+a[i]*(prev[n]-prev[i+1])%M)%M;
      |                                        ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:20:4: note:                 'long long int prev [200005]'
   20 | ll prev[200005]={0};
      |    ^~~~