Language: C++

#include <iostream>#include <vector>
#include <utility>
using namespace std;
int n;
vector<int> arr[100001];
const int MOD = 1e9+7;
pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
{
    for (auto adj : arr[vertex])
    {
        if (adj != parent)
        {
            pair<int, int> temp = DFS_tree(dp, adj, vertex);
            if (dp[vertex].first == -1 && dp[vertex].second == -1)
            {
                dp[vertex].first = (temp.first + temp.second)%MOD;
                dp[vertex].second = temp.first%MOD;
            }
            else
            {
                dp[vertex].first = (dp[vertex].first%MOD * (temp.first + temp.second)%MOD)%MOD;
                dp[vertex].second = (dp[vertex].second%MOD * temp.first%MOD)%MOD;
            }
        }
    }
    if (dp[vertex].first == -1 && dp[vertex].second == -1){
      return make_pair(1,1);
    } 
    return dp[vertex];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    vector<pair<int, int>> dp(n + 1);

    for (int i = 0; i < n - 1; ++i)
    {
        int x;
        int y;
        cin >> x >> y;
        arr[x].push_back(y);
        arr[y].push_back(x);
    }
    for (auto &x : dp)
    {
        x.first = -1;
        x.second = -1;
    }
    dp[1] = DFS_tree(dp, 1, -1);
    cout << (dp[1].first + dp[1].second)%MOD << endl;
    return 0;
}

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>#include <vector>
      |                    ^
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<int> arr[100001];
      | ^~~~~~
a.cc:7:25: error: 'vector' was not declared in this scope
    7 | pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
      |                         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <utility>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:7:45: error: expected primary-expression before '>' token
    7 | pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
      |                                             ^~
a.cc:7:49: error: 'dp' was not declared in this scope
    7 | pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
      |                                                 ^~
a.cc:7:53: error: expected primary-expression before 'int'
    7 | pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
      |                                                     ^~~
a.cc:7:65: error: expected primary-expression before 'int'
    7 | pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
      |                                                                 ^~~
a.cc:8:1: error: expected ',' or ';' before '{' token
    8 | {
      | ^
a.cc: In function 'int main()':
a.cc:37:5: error: 'vector' was not declared in this scope
   37 |     vector<pair<int, int>> dp(n + 1);
      |     ^~~~~~
a.cc:37:5: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:37:25: error: expected primary-expression before '>' token
   37 |     vector<pair<int, int>> dp(n + 1);
      |                         ^~
a.cc:37:28: error: 'dp' was not declared in this scope
   37 |     vector<pair<int, int>> dp(n + 1);
      |                            ^~
a.cc:44:9: error: 'arr' was not declared in this scope
   44 |         arr[x].push_back(y);
      |         ^~~