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;
const int 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:15:9: error: reference to 'size' is ambiguous
   15 | 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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc:15:22: error: reference to 'size' is ambiguous
   15 | 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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc:16:24: error: reference to 'size' is ambiguous
   16 | 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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc:16:32: error: reference to 'size' is ambiguous
   16 | 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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc: In function 'void init(int)':
a.cc:29:19: error: 'fac' was not declared in this scope
   29 |         for(int i=fac[0]=1; i<=n; ++i) fac[i]=1ll*fac[i-1]*i%mod;
      |                   ^~~
a.cc:30:9: error: 'ifac' was not declared in this scope
   30 |         ifac[n]=qpow(fac[n],mod-2);
      |         ^~~~
a.cc:30:22: error: 'fac' was not declared in this scope
   30 |         ifac[n]=qpow(fac[n],mod-2);
      |                      ^~~
a.cc: In function 'int main(int, const char**)':
a.cc:36:24: error: reference to 'size' is ambiguous
   36 |         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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc: In lambda function:
a.cc:38:21: error: 'fac' was not declared in this scope
   38 |         {return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;};
      |                     ^~~
a.cc:38:28: error: 'ifac' was not declared in this scope
   38 |         {return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;};
      |                            ^~~~
a.cc: In function 'int main(int, const char**)':
a.cc:42:19: error: 'dp' was not declared in this scope; did you mean 'dup'?
   42 |                 ++dp[size-a[i]][size-b[i]];
      |                   ^~
      |                   dup
a.cc:42:22: error: reference to 'size' is ambiguous
   42 |                 ++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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc:42:33: error: reference to 'size' is ambiguous
   42 |                 ++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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc:44:25: error: reference to 'size' is ambiguous
   44 |         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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc:45:33: error: reference to 'size' is ambiguous
   45 |                 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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc:46:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   46 |                         dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%mod;
      |                         ^~
      |                         dup
a.cc:49:26: error: 'dp' was not declared in this scope; did you mean 'dup'?
   49 |                 ans=(ans+dp[size+a[i]][size+b[i]])%mod;
      |                          ^~
      |                          dup
a.cc:49:29: error: reference to 'size' is ambiguous
   49 |                 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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~
a.cc:49:40: error: reference to 'size' is ambiguous
   49 |                 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:14:11: note:                 'const int size'
   14 | const int size=2001;
      |           ^~~~