Language: C++

#include <bits/stdc++.h>
using namespace std;

inline int read()
{
	int x=0,f=1,c=getchar();
	while(c<48) c=='-'&&(f=-1),c=getchar();
	while(c>47) x=x*10+c-'0',c=getchar();
	return x*f;
}

const int MAXN = 200005;
const int mod=1e9+7,size=2001;
int fac[size*5],ifac[size*5];
int a[MAXN],b[MAXN],dp[size*5][size*5];
int n,ans;

inline int qpow(int x,int k)
{
	int res=1;
	for(int i=k; i; i>>=1,x=1ll*x*x%mod)
		if(i&1) res=1ll*res*x%mod;
	return res;
}

inline void init(int n)
{
	for(int i=fac[0]=1; i<=n; ++i) fac[i]=1ll*fac[i-1]*i%mod;
	ifac[n]=qpow(fac[n],mod-2);
	for(int i=n; i; --i) ifac[i-1]=1ll*ifac[i]*i%mod;
}

int main(int argc, char const *argv[])
{
	n=read(); init(size<<2);
	auto cbt=[](int n,int m)
	{return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;};
	for(int i=1; i<=n; ++i)
	{
		a[i]=read(),b[i]=read();
		++dp[size-a[i]][size-b[i]];
	}
	for(int i=1; i<=size<<1; ++i)
		for(int j=1; j<=size<<1; ++j)
			dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%mod;
	for(int i=1; i<=n; ++i)
	{
		ans=(ans+dp[size+a[i]][size+b[i]])%mod;
		ans=(ans-cbt(a[i]+a[i]+b[i]+b[i],a[i]+a[i])+mod)%mod;
	}
	printf("%lld\n",1ll*ans*qpow(2,mod-2)%mod);
	return 0;
}

Compiler output:
a.cc:14:9: error: reference to 'size' is ambiguous
   14 | int fac[size*5],ifac[size*5];
      |         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc:14:22: error: reference to 'size' is ambiguous
   14 | int fac[size*5],ifac[size*5];
      |                      ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc:15:24: error: reference to 'size' is ambiguous
   15 | int a[MAXN],b[MAXN],dp[size*5][size*5];
      |                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc:15:32: error: reference to 'size' is ambiguous
   15 | int a[MAXN],b[MAXN],dp[size*5][size*5];
      |                                ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc: In function 'void init(int)':
a.cc:28:19: error: 'fac' was not declared in this scope
   28 |         for(int i=fac[0]=1; i<=n; ++i) fac[i]=1ll*fac[i-1]*i%mod;
      |                   ^~~
a.cc:29:9: error: 'ifac' was not declared in this scope
   29 |         ifac[n]=qpow(fac[n],mod-2);
      |         ^~~~
a.cc:29:22: error: 'fac' was not declared in this scope
   29 |         ifac[n]=qpow(fac[n],mod-2);
      |                      ^~~
a.cc: In function 'int main(int, const char**)':
a.cc:35:24: error: reference to 'size' is ambiguous
   35 |         n=read(); init(size<<2);
      |                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc: In lambda function:
a.cc:37:21: error: 'fac' was not declared in this scope
   37 |         {return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;};
      |                     ^~~
a.cc:37:28: error: 'ifac' was not declared in this scope
   37 |         {return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;};
      |                            ^~~~
a.cc: In function 'int main(int, const char**)':
a.cc:41:19: error: 'dp' was not declared in this scope; did you mean 'dup'?
   41 |                 ++dp[size-a[i]][size-b[i]];
      |                   ^~
      |                   dup
a.cc:41:22: error: reference to 'size' is ambiguous
   41 |                 ++dp[size-a[i]][size-b[i]];
      |                      ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc:41:33: error: reference to 'size' is ambiguous
   41 |                 ++dp[size-a[i]][size-b[i]];
      |                                 ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc:43:25: error: reference to 'size' is ambiguous
   43 |         for(int i=1; i<=size<<1; ++i)
      |                         ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc:44:33: error: reference to 'size' is ambiguous
   44 |                 for(int j=1; j<=size<<1; ++j)
      |                                 ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc:45:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   45 |                         dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%mod;
      |                         ^~
      |                         dup
a.cc:48:26: error: 'dp' was not declared in this scope; did you mean 'dup'?
   48 |                 ans=(ans+dp[size+a[i]][size+b[i]])%mod;
      |                          ^~
      |                          dup
a.cc:48:29: error: reference to 'size' is ambiguous
   48 |                 ans=(ans+dp[size+a[i]][size+b[i]])%mod;
      |                             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~
a.cc:48:40: error: reference to 'size' is ambiguous
   48 |                 ans=(ans+dp[size+a[i]][size+b[i]])%mod;
      |                                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: '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:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:13:21: note:                 'const int size'
   13 | const int mod=1e9+7,size=2001;
      |                     ^~~~