Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> G[100010];
int n,k,ans;
void dfs(v,p){
  if(p!=0){
    int a=k-1;
  }else{
    int a=k-2;
  }
  for(auto e:G[v]){
    if(e==p)continue;
    dfs(e,v);
  }
  for(auto e:G[v]){
    if(e==p)continue;
    ans=(ans*a)%1000000007;
    a--;
  }
}
int main(){
  cin>>n>>k;
  for(int i=0;i<n;i++){
    int a,b;cin>>a>>b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  ans=k;
  dfs(1,0);
  cout<<ans<<endl;
}

Compiler output:
a.cc:5:6: error: variable or field 'dfs' declared void
    5 | void dfs(v,p){
      |      ^~~
a.cc:5:10: error: 'v' was not declared in this scope
    5 | void dfs(v,p){
      |          ^
a.cc:5:12: error: 'p' was not declared in this scope
    5 | void dfs(v,p){
      |            ^
a.cc: In function 'int main()':
a.cc:25:19: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   25 |     G[a].push_back(b);
      |     ~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:26:19: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   26 |     G[b].push_back(a);
      |     ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:29:3: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   29 |   dfs(1,0);
      |   ^~~
      |   ffs