Language: C++

#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef __int64 ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
struct edge{int a,b;};
edge e[50];

mat mul(mat&A,mat&B){
	mat C(A.size(),vec(B[0].size()));
	for(int i=0;i<A.size();i++){
		for(int k=0;k<B.size();k++){
			for(int j=0;j<B[0].size();j++){
				C[i][j]=(C[i][j]+A[i][k]*B[k][j]);
				if(C[i][j]>1)C[i][j]=1;
			}
		}
	}
	return C;
}

mat pow(mat A,ll n){
	mat B(A.size(),vec(A.size()));
	for(int i=0;i<A.size();i++)B[i][i]=1;
	int f=1;
	while(n){
		if(n&1)B=mul(B,A);
		A=mul(A,A);
		if(f)for(int i=0;i<A.size();i++)A[i][i]=0;
		f=0;
		n>>=1;
	}
	return B;
}

int N,M,Z;

int main(){
	while(cin>>N>>M>>Z){
		if(!N)return 0;
		mat A(M*2+1,vec(M*2+1));
		int s,d;
		for(int i=0;i<M;i++)cin>>e[i].a>>e[i].b;
		for(int i=0;i<M;i++){
			if(e[i].a==1)A[0][2*i+1]=1;
			if(e[i].b==1)A[0][2*i+2]=1;
		}
		for(int i=0;i<M;i++)for(int j=0;j<M;j++){
			if(e[i].b==e[j].a&&e[i].a!=e[j].b)A[2*i+1][2*j+1]=1;
			if(e[i].b==e[j].b&&e[i].a!=e[j].a)A[2*i+1][2*j+2]=1;
			if(e[i].a==e[j].a&&e[i].b!=e[j].b)A[2*i+2][2*j+1]=1;
			if(e[i].a==e[j].b&&e[i].b!=e[j].a)A[2*i+2][2*j+2]=1;
		}
		//for(int i=0;i<=M*2;i++){for(int j=0;j<=M*2;j++)cout<<A[i][j]<<" ";cout<<endl;}
		A=pow(A,Z);
		//for(int i=0;i<=M*2;i++){for(int j=0;j<=M*2;j++)cout<<A[i][j]<<" ";cout<<endl;}
		int f=0;
		for(int i=1;i<=M*2;i++)if(A[0][i]&&(i%2&&e[i/2].b==N||i%2==0&&e[i/2-1].a==N))f=1;
		if(f)cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
}

Compiler output:
a.cc:16:9: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | typedef __int64 ll;
      |         ^~~~~~~
      |         __int64_t
a.cc:17:16: error: 'll' was not declared in this scope
   17 | typedef vector<ll> vec;
      |                ^~
a.cc:17:18: error: template argument 1 is invalid
   17 | typedef vector<ll> vec;
      |                  ^
a.cc:17:18: error: template argument 2 is invalid
a.cc: In function 'mat mul(mat&, mat&)':
a.cc:23:33: error: request for member 'size' in '(& B)->std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   23 |         mat C(A.size(),vec(B[0].size()));
      |                                 ^~~~
a.cc:26:44: error: request for member 'size' in '(& B)->std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   26 |                         for(int j=0;j<B[0].size();j++){
      |                                            ^~~~
a.cc:27:37: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   27 |                                 C[i][j]=(C[i][j]+A[i][k]*B[k][j]);
      |                                     ^
a.cc:27:46: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   27 |                                 C[i][j]=(C[i][j]+A[i][k]*B[k][j]);
      |                                              ^
a.cc:27:54: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   27 |                                 C[i][j]=(C[i][j]+A[i][k]*B[k][j]);
      |                                                      ^
a.cc:27:62: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   27 |                                 C[i][j]=(C[i][j]+A[i][k]*B[k][j]);
      |                                                              ^
a.cc:28:40: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   28 |                                 if(C[i][j]>1)C[i][j]=1;
      |                                        ^
a.cc:28:50: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   28 |                                 if(C[i][j]>1)C[i][j]=1;
      |                                                  ^
a.cc: At global scope:
a.cc:35:15: error: 'll' has not been declared
   35 | mat pow(mat A,ll n){
      |               ^~
a.cc: In function 'mat pow(mat, int)':
a.cc:37:40: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   37 |         for(int i=0;i<A.size();i++)B[i][i]=1;
      |                                        ^
a.cc:42:53: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   42 |                 if(f)for(int i=0;i<A.size();i++)A[i][i]=0;
      |                                                     ^
a.cc: In function 'int main()':
a.cc:58:42: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   58 |                         if(e[i].a==1)A[0][2*i+1]=1;
      |                                          ^
a.cc:59:42: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   59 |                         if(e[i].b==1)A[0][2*i+2]=1;
      |                                          ^
a.cc:62:67: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   62 |                         if(e[i].b==e[j].a&&e[i].a!=e[j].b)A[2*i+1][2*j+1]=1;
      |                                                                   ^
a.cc:63:67: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   63 |                         if(e[i].b==e[j].b&&e[i].a!=e[j].a)A[2*i+1][2*j+2]=1;
      |                                                                   ^
a.cc:64:67: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   64 |                         if(e[i].a==e[j].a&&e[i].b!=e[j].b)A[2*i+2][2*j+1]=1;
      |                                                                   ^
a.cc:65:67: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   65 |                         if(e[i].a==e[j].b&&e[i].b!=e[j].a)A[2*i+2][2*j+2]=1;
      |                                                                   ^
a.cc:71:47: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   71 |                 for(int i=1;i<=M*2;i++)if(A[0][i]&&(i%2&&e[i/2].b==N||i%2==0&&e[i/2-1].a==N))f=1;
      |                                               ^