Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <cassert>

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> P;

int num;
const int N = 1010;
map<string, int> G[N];
int par[N];
int file[N];

bool f;
const string index = "index.html";

vector<string> path;
int dfs(int id, int i, bool create){
	if (id < 0) return -1;
	if (i == path.size()){
		if (file[id]) return id;
		return !f && G[id].count(index) && file[G[id][index]] ? G[id][index] : -1;
	}
	if (file[id]) return -1;
	if (path[i] == ".") return dfs(id, i + 1, create);
	if (path[i] == "..") return dfs(par[id], i + 1, create);
	if (G[id].count(path[i])){
		return dfs(G[id][path[i]], i + 1, create);
	}
	else{
		if (create){
			G[id][path[i]] = num;
			file[num] = i == path.size()-1; // dir or file
			par[num++] = id;
			return dfs(G[id][path[i]], i + 1, create);
		}
		else {
			return -1;
		}
	}
}

vector<string> parse(string s){
	rep(i, s.size()){
		if (s[i] == '/') s[i] = ' ';
	}
	stringstream ss(s);
	vector<string> res;
	while (ss >> s) res.push_back(s);
	return res;
}

int main(){
	ios::sync_with_stdio(false);

	int n, m;
	while (cin >> n >> m, n){
		num = 1;
		rep(i, N) G[i].clear();
		rep(i, N) par[i] = -1;

		rep(i, n){
			string s;
			cin >> s;
			path = parse(s);
			dfs(0, 0, true);
		}
		rep(i, m){
			string s, t;
			cin >> s >> t;

			f = false;
			if (s.back() == '/') s += index, f = true;
			path = parse(s);
			int a = dfs(0, 0, false);

			f = false;
			if (t.back() == '/') t += index;
			path = parse(t);
			int b = dfs(0, 0, false);
			if (a < 0 || b < 0) cout << "not found" << endl;
			else if (a != b) cout << "no" << endl;
			else cout << "yes" << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc:48:14: error: 'const std::string index' redeclared as different kind of entity
   48 | const string index = "index.html";
      |              ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from a.cc:6:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int dfs(int, int, bool)':
a.cc:55:41: error: no matching function for call to 'std::map<std::__cxx11::basic_string<char>, int>::count(<unresolved overloaded function type>)'
   55 |                 return !f && G[id].count(index) && file[G[id][index]] ? G[id][index] : -1;
      |                              ~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/map:63,
                 from a.cc:12:
/usr/include/c++/14/bits/stl_map.h:1270:9: note: candidate: 'template<class _Kt> decltype (((const std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_count_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::count(const _Kt&) const [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]'
 1270 |         count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x))
      |         ^~~~~
/usr/include/c++/14/bits/stl_map.h:1270:9: note:   template argument deduction/substitution failed:
a.cc:55:41: note:   couldn't deduce template parameter '_Kt'
   55 |                 return !f && G[id].count(index) && file[G[id][index]] ? G[id][index] : -1;
      |                              ~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_map.h:1264:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::size_type std::map<_Key, _Tp, _Compare, _Alloc>::count(const key_type&) const [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; size_type = long unsigned int; key_type = std::__cxx11::basic_string<char>]'
 1264 |       count(const key_type& __x) const
      |       ^~~~~
/usr/include/c++/14/bits/stl_map.h:1264:29: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
 1264 |       count(const key_type& __x) const
      |             ~~~~~~~~~~~~~~~~^~~
a.cc:55:62: error: no match for 'operator[]' (operand types are 'std::map<std::__cxx11::basic_string<char>, int>' and '<unresolved overloaded function type>')
   55 |                 return !f && G[id].count(index) && file[G[id][index]] ? G[id][index] : -1;
      |                                                              ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:34: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  504 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:29: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::map<std::__cxx11::basic_string<char>, int>::key_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
  524 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
a.cc:55:78: error: no match for 'operator[]' (operand types are 'std::map<std::__cxx11::basic_string<char>, int>' and '<unresolved overloaded function type>')
   55 |                 return !f && G[id].count(index) && file[G[id][index]] ? G[id][index] : -1;
      |                                                                              ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:34: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  504 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:29: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::map<std::__cxx11::basic_string<char>, int>::key_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
  524 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:106:48: error: no match for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<unresolved overloaded function type>')
  106 |                         if (s.back() == '/') s += index, f = true;
      |                                              ~~^~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1424:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1424 |         operator+=(const _Tp& __svt)
      |         ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1424:9: note:   template argument deduction/substitution failed:
a.cc:106:51: note:   couldn't deduce template parameter '_Tp'
  106 |                         if (s.back() == '/') s += index, f = true;
      |                                                   ^~~~~
/usr/include/c++/14/bits/basic_string.h:1377:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1377 |       operator+=(const basic_string& __str)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1377:38: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const std::__cxx11::basic_string<char>&'
 1377 |       operator+=(const basic_string& __str)
      |                  ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1387:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1387 |       operator+=(const _CharT* __s)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1387:32: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const char*'
 1387 |       operator+=(const _CharT* __s)
      |                  ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1397:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1397 |       operator+=(_CharT __c)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1397:25: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'char'
 1397 |       operator+=(_CharT __c)
      |                  ~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1411:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator