Language: C

#include <stdio.h>
#include <stdlib.h>
#define MOD 1000000007

long answer;

typedef struct Node {
  int id;
  int c;
  struct Node **child;
  struct Node *parent;
}Node;

long PP(long a,long b){
  long result = 1;
  for(long i = a ; i > a-b ; i--){
    result *= i;
    result = result % MOD;
  }
  return result;
}

void focus(Node current, int k){
  long color;
  if(current.parent == NULL){
    color = k - 1;
  }else{
    color = k - 2;
  }
  long children = current.c;
  long position = PP(color,children);
  answer = (answer * position) % MOD;
  if(children == 0) return;
  for(int i=1 ; i<=children ; i++){
    focus(*(current.child[i]),k);
  }
}

int main(){
  int n,k;
  scanf("%d %d",&n,&k);
  Node node = (Node *)malloc(sizeof(Node)*n);
  for(int i=1;i<=n;i++){
    node[i].id = i;
    node[i].c = 0;
    node[i].child = (Node *)malloc(sizeof(Node)*n);
    node[i].parent = NULL;
  }
  int a,b,tmp;
  for(int i=1;i<n;i++){
    scanf("%d %d\n",&a,&b);
    if(node[b].parent == NULL){
      node[b].parent = &node[a];
      node[a].c += 1;
      tmp = node[a].c;
      node[a].child[tmp] = &node[b];
    }else{
      node[a].parent = &node[b];
      node[b].c += 1;
      tmp = node[b].c += 1;
      node[b].child[tmp] = &node[a];
    }
  }
  int root;
  for(int i=1;i<=n;i++){
    if(node[i].parent == NULL){
      //printf("node %d\n",i);
      root = i;
    }
  }
  answer = k;
  focus(node[root],k);
  printf("%ld\n",answer % MOD);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:42:15: error: invalid initializer
   42 |   Node node = (Node *)malloc(sizeof(Node)*n);
      |               ^
main.c:44:9: error: subscripted value is neither array nor pointer nor vector
   44 |     node[i].id = i;
      |         ^
main.c:45:9: error: subscripted value is neither array nor pointer nor vector
   45 |     node[i].c = 0;
      |         ^
main.c:46:9: error: subscripted value is neither array nor pointer nor vector
   46 |     node[i].child = (Node *)malloc(sizeof(Node)*n);
      |         ^
main.c:47:9: error: subscripted value is neither array nor pointer nor vector
   47 |     node[i].parent = NULL;
      |         ^
main.c:52:12: error: subscripted value is neither array nor pointer nor vector
   52 |     if(node[b].parent == NULL){
      |            ^
main.c:53:11: error: subscripted value is neither array nor pointer nor vector
   53 |       node[b].parent = &node[a];
      |           ^
main.c:53:29: error: subscripted value is neither array nor pointer nor vector
   53 |       node[b].parent = &node[a];
      |                             ^
main.c:54:11: error: subscripted value is neither array nor pointer nor vector
   54 |       node[a].c += 1;
      |           ^
main.c:55:17: error: subscripted value is neither array nor pointer nor vector
   55 |       tmp = node[a].c;
      |                 ^
main.c:56:11: error: subscripted value is neither array nor pointer nor vector
   56 |       node[a].child[tmp] = &node[b];
      |           ^
main.c:56:33: error: subscripted value is neither array nor pointer nor vector
   56 |       node[a].child[tmp] = &node[b];
      |                                 ^
main.c:58:11: error: subscripted value is neither array nor pointer nor vector
   58 |       node[a].parent = &node[b];
      |           ^
main.c:58:29: error: subscripted value is neither array nor pointer nor vector
   58 |       node[a].parent = &node[b];
      |                             ^
main.c:59:11: error: subscripted value is neither array nor pointer nor vector
   59 |       node[b].c += 1;
      |           ^
main.c:60:17: error: subscripted value is neither array nor pointer nor vector
   60 |       tmp = node[b].c += 1;
      |                 ^
main.c:61:11: error: subscripted value is neither array nor pointer nor vector
   61 |       node[b].child[tmp] = &node[a];
      |           ^
main.c:61:33: error: subscripted value is neither array nor pointer nor vector
   61 |       node[b].child[tmp] = &node[a];
      |                                 ^
main.c:66:12: error: subscripted value is neither array nor pointer nor vector
   66 |     if(node[i].parent == NULL){
      |            ^
main.c:72:13: error: subscripted value is neither array nor pointer nor vector
   72 |   focus(node[root],k);
      |             ^