Language: C++

/*
 * Package: StandardCodeLibrary.Core
 * */
//蠑戊ソ帛クク逕ィ逧?、エ譁?サカ蟷カ菴ソ逕ィstd蜷榊ュ礼ゥコ髣エ
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <utility>
#include <vector>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <climits>
using namespace std;

//逕ィ莠主?蟆台サ」遐??逧?ョ?//#define lp for(;;)
//#define repf(i,a,b) for (int i=(a);i<(b);++i)
//#define rrepf(i,a,b) for (int i=(a)-1;i>=(b);--i)
//#define rep(i,n) repf(i,0,n)
//#define rrep(i,n) rrepf(i,n,0)
//#define ft(i,a,b) for (int i=(a);i<=(b);++i)
//#define fdt(i,a,b) for (int i=(a);i>=(b);--i)
//#define for_nonempty_subsets(subset,set) for (int subset=set;subset;subset=(subset-1)&(set))
//#define for_in_charset(i,charset) for (cstr i=(charset);*i;i++)
//#define while while
//#define return return
//#define fl(x,y) memset((x),char(y),sizeof(x))
//#define clr(x) fl(x,char(0))
//#define cpy(x,y) memcpy(x,y,sizeof(x))
//#define sf scanf
//#define pf printf
//#define vec vector
//#define pr pair
//#define que queue
//#define prq priority_queue
//#define itr iterator
//#define x first
//#define y second
//#define pb push_back
//#define mp make_pair
//#define ins insert
//#define ers erase
//#define lb lower_bound
//#define ub upper_bound
//#define rnk order_of_key
//#define sel find_by_order
//#define sz(x) (int((x).size()))
//#define all(x) (x).begin(),(x).end()
//#define srt(x) sort(all(x))
//#define uniq(x) srt(x),(x).erase(unique(all(x)),(x).end())
//#define rev(x) reverse(all(x))
//#define shf(x) random_shuffle(all(x))
//#define nxtp(x) next_permutation(all(x))

//隹?ッ慕嶌蜈ウ逧?ョ?//#ifndef DEBUG
//#define prt(x) (cerr)
//#define asrtWA(s) do if(!(s))exit(0);while(0)
//#define asrtTLE(s) do if(!(s))while(1);while(0)
//#define asrtMLE(s) do if(!(s))while(new int);while(0)
//#define asrtOLE(s) do if(!(s))while(1)puts("OLE");while(0)
//#define asrtRE(s) do if(!(s))*(int*)0=0;while(0)
//#define runtime() (cerr)
//#define input(in) freopen(in,"r",stdin)
//#define output(out) freopen(out,"w",stdout)
//#else
//#define prt(x) cerr<<"隨ャ"<<__LINE__<<"陦圭t: "<<#x"\t="<<(x)<<endl
//#define asrtWA(s) do if(!(s))cerr<<"assert("#s")"<<endl;while(0)
//#define asrtTLE(s) do if(!(s))cerr<<"assert("#s")"<<endl;while(0)
//#define asrtMLE(s) do if(!(s))cerr<<"assert("#s")"<<endl;while(0)
//#define asrtOLE(s) do if(!(s))cerr<<"assert("#s")"<<endl;while(0)
//#define asrtRE(s) do if(!(s))cerr<<"assert("#s")"<<endl;while(0)
//#define runtime() cerr<<"Used: "<<db(clock())/CLOCKS_PER_SEC<<"s"<<endl
//#define input(in)
//#define output(out)
//#endif

//蟶ク逕ィ謨ー謐ョ邀サ蝙?typedef long long int lli;
typedef double db;
typedef const char* cstr;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<str> vs;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<db,db> pdd;
typedef map<int,int> mii;
typedef map<str,int> msi;
typedef map<char,int> mci;
typedef set<int> si;
typedef set<str> ss;
typedef queue<int> qi;
typedef vector<pii> vpii;
typedef vector<pdd> vpdd;

//蟶ク逕ィ蟶ク驥?int逧?怙螟ァ蛟シ;lli逧?怙螟ァ蛟シ;db逧?ッッ蟾ョ逶ク蜈ウ蟶ク謨ー;谺ァ諡牙クク謨ー;蝨?捉邇?遘サ蜉ィ蜷鷹?;蜿匁ィ。菴ソ逕ィ逧?勁謨ー
int oo=(~0u)>>1;
lli ooll=(~0ull)>>1;
db inf=1e+10;
db eps=1e-10;
db gam=0.5772156649015328606;
db pi=acos(-1.0);
int dx[]={1,0,-1,0,1,-1,-1,1,0};
int dy[]={0,1,0,-1,1,1,-1,-1,0};
int MOD=1000000007;

//蟶ク逕ィ蜃ス謨ー:譛?、ァ譛?ー丞?譖エ譁ー;謨ー蟄ヲ逶ク蜈ウ蜃ス謨ー;霎灘?蜥瑚セ灘?;譬醍憾謨ー扈?蟷カ譟・髮?蜿ッ蜷亥ケカ蝣?
template<typename type>inline bool cmax(type& a,const type& b){return a<b?a=b,true:false;}
template<typename type>inline bool cmin(type& a,const type& b){return b<a?a=b,true:false;}

//蛻晏ァ句喧
struct Initializer
{
//#ifndef DEBUG
	Initializer(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
//#else
//	~Initializer(){runtime();}
//#endif
}initializer;
//
////髱樊?蜃?//#define feach(e,s) for (__typeof__((s).begin()) e=(s).begin();e!=(s).end();++e)
//#include <ext/rope>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/tag_and_trait.hpp>
//using __gnu_cxx::rope;
//template<typename key,typename value>class ext_map:public __gnu_pbds::tree<key,value,less<key>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>{};
//#define ctz __builtin_ctz
//#define clz __builtin_clz
//#define bc __builtin_popcount

const int MAXV=1000;
const int MAXE=1000000;
typedef struct struct_edge* edge;
struct struct_edge{int v;edge n;}pool[MAXE];
edge top;
int V;
edge adj[MAXV];
void build_graph(int v)
{
	top=pool,memset(adj,0,sizeof adj);
	V=v;//轤ケ謨ー
	//add_edge(u,v);
}
void add_edge(int u,int v)
{
	top->v=v,top->n=adj[u],adj[u]=top++;
}
int ord;
int dfn[MAXV];
int low[MAXV];
int stks;
int stk[MAXV];
bool ins[MAXV];
int cnt;
int bl[MAXV];
void dfs(int u)
{
	dfn[u]=low[u]=++ord;
	ins[stk[stks++]=u]=true;
	for (edge i=adj[u];i;i=i->n)
		if (!dfn[i->v]) dfs(i->v),cmin(low[u],low[i->v]);
		else if (ins[i->v]) cmin(low[u],dfn[i->v]);
	if (dfn[u]==low[u])
	{
		int v;
		do ins[v=stk[--stks]]=false,bl[v]=cnt;
		while(v!=u);
		cnt++;
	}
}
void tarjan()
{
	ord=0,memset(dfn,0,sizeof dfn),cnt=0;
	for(int i=0;i<V;i++) if (!dfn[i]) dfs(i);
}

int main()
{
	int n,m;
	cin>>n>>m;
	build_graph(n);
	for(int i=0;i<m;i++)
	{
		int s,d;
		cin>>s>>d,--s,--d;
		add_edge(s,d);
	}
	tarjan();
	vvi adj(cnt);
	vvi radj(cnt);
	for(int i=0;i<V;i++) for (edge e=::adj[i];e;e=e->n) if (bl[i]!=bl[e->v]) adj[bl[i]].push_back(bl[e->v]);
	for(int i=0;i<cnt;i++) sort(adj[i].begin(),adj[i].end()),unique(adj[i].begin(),adj[i].end());
	vi id(cnt);
	for(int i=0;i<cnt;i++) for (int j=0;j<adj[i].size();j++) id[adj[i][j]]++;
	qi q;
	vector<pll> f(n);
	for(int i=0;i<cnt;i++) if (id[i]==0) q.push(i),f[i]=make_pair(1,1);
	lli ans=1;
	while(q.size())
	{
		int u=q.front();
		q.pop();
		if (!adj[u].size()) ans=(ans*(f[u].first+f[u].second))%MOD;
		for(int i=0;i<adj[u].size();i++)
		{
			int v=adj[u][i];
			radj[v].push_back(u);
			if ((--id[v])==0)
			{
				q.push(v);
				f[v]=make_pair(1,1);
				for (int j=0;j<radj[v].size();j++)
				{
					int w=radj[v][j];
					f[v].first*=f[w].first+f[w].second;
					f[v].second*=f[w].second;
					f[v].first%=MOD;
					f[v].second%=MOD;
				}
			}
		}
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc:102:14: error: 'lli' was not declared in this scope
  102 | typedef pair<lli,lli> pll;
      |              ^~~
a.cc:102:18: error: 'lli' was not declared in this scope
  102 | typedef pair<lli,lli> pll;
      |                  ^~~
a.cc:102:21: error: template argument 1 is invalid
  102 | typedef pair<lli,lli> pll;
      |                     ^
a.cc:102:21: error: template argument 2 is invalid
a.cc:115:1: error: 'lli' does not name a type
  115 | lli ooll=(~0ull)>>1;
      | ^~~
a.cc: In function 'int main()':
a.cc:215:70: error: cannot convert 'std::pair<int, int>' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment
  215 |         for(int i=0;i<cnt;i++) if (id[i]==0) q.push(i),f[i]=make_pair(1,1);
      |                                                             ~~~~~~~~~^~~~~
      |                                                                      |
      |                                                                      std::pair<int, int>
a.cc:216:9: error: 'lli' was not declared in this scope
  216 |         lli ans=1;
      |         ^~~
a.cc:221:37: error: 'ans' was not declared in this scope; did you mean 'ins'?
  221 |                 if (!adj[u].size()) ans=(ans*(f[u].first+f[u].second))%MOD;
      |                                     ^~~
      |                                     ins
a.cc:221:52: error: request for member 'first' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)u))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  221 |                 if (!adj[u].size()) ans=(ans*(f[u].first+f[u].second))%MOD;
      |                                                    ^~~~~
a.cc:221:63: error: request for member 'second' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)u))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  221 |                 if (!adj[u].size()) ans=(ans*(f[u].first+f[u].second))%MOD;
      |                                                               ^~~~~~
a.cc:229:47: error: cannot convert 'std::pair<int, int>' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment
  229 |                                 f[v]=make_pair(1,1);
      |                                      ~~~~~~~~~^~~~~
      |                                               |
      |                                               std::pair<int, int>
a.cc:233:46: error: request for member 'first' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)v))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  233 |                                         f[v].first*=f[w].first+f[w].second;
      |                                              ^~~~~
a.cc:233:58: error: request for member 'first' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)w))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  233 |                                         f[v].first*=f[w].first+f[w].second;
      |                                                          ^~~~~
a.cc:233:69: error: request for member 'second' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)w))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  233 |                                         f[v].first*=f[w].first+f[w].second;
      |                                                                     ^~~~~~
a.cc:234:46: error: request for member 'second' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)v))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  234 |                                         f[v].second*=f[w].second;
      |                                              ^~~~~~
a.cc:234:59: error: request for member 'second' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)w))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  234 |                                         f[v].second*=f[w].second;
      |                                                           ^~~~~~
a.cc:235:46: error: request for member 'first' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)v))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  235 |                                         f[v].first%=MOD;
      |                                              ^~~~~
a.cc:236:46: error: request for member 'second' in 'f.std::vector<int>::operator[](((std::vector<int>::size_type)v))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  236 |                                         f[v].second%=MOD;
      |                                              ^~~~~~
a.cc:241:15: error: 'ans' was not declared in this scope; did you mean 'ins'?
  241 |         cout<<ans<<endl;
      |               ^~~
      |               ins