Language: C++

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var num = int.Parse(input[0]);
        var countNum = int.Parse(input[1]);

        var tree = new List<int[]>();
        var list = new List<int>();

        var nums = new int[num];

        for(var i = 0; i < num - 1 ; i++)
        {
            var n = Console.ReadLine().Split(' ');
            var a = int.Parse(n[0]);
            var b = int.Parse(n[1]);

            tree.Add(new int[2] { a, b });
        }

        for (int i = 0; i < countNum; i++)
        {
            var n = Console.ReadLine().Split(' ');
            var a = int.Parse(n[0]);
            var b = int.Parse(n[1]);

            nums[a - 1] += b;
        }


        foreach(var item in tree)
        {
            nums[item[1] - 1] += nums[item[0] - 1];
        }
        foreach (var item in nums)
        {
            Console.WriteLine(item);
        }
        Console.ReadKey();
    }
}



Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:7:22: error: 'string' has not been declared
    7 |     static void Main(string[] args)
      |                      ^~~~~~
a.cc:7:31: error: expected ',' or '...' before 'args'
    7 |     static void Main(string[] args)
      |                               ^~~~
a.cc:47:2: error: expected ';' after class definition
   47 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main(int*)':
a.cc:9:9: error: 'var' was not declared in this scope
    9 |         var input = Console.ReadLine().Split(' ');
      |         ^~~
a.cc:10:13: error: expected ';' before 'num'
   10 |         var num = int.Parse(input[0]);
      |             ^~~
a.cc:11:13: error: expected ';' before 'countNum'
   11 |         var countNum = int.Parse(input[1]);
      |             ^~~~~~~~
a.cc:13:13: error: expected ';' before 'tree'
   13 |         var tree = new List<int[]>();
      |             ^~~~
a.cc:14:13: error: expected ';' before 'list'
   14 |         var list = new List<int>();
      |             ^~~~
a.cc:16:13: error: expected ';' before 'nums'
   16 |         var nums = new int[num];
      |             ^~~~
a.cc:18:17: error: expected ';' before 'i'
   18 |         for(var i = 0; i < num - 1 ; i++)
      |                 ^
a.cc:18:24: error: 'i' was not declared in this scope
   18 |         for(var i = 0; i < num - 1 ; i++)
      |                        ^
a.cc:18:28: error: 'num' was not declared in this scope; did you mean 'enum'?
   18 |         for(var i = 0; i < num - 1 ; i++)
      |                            ^~~
      |                            enum
a.cc:20:17: error: expected ';' before 'n'
   20 |             var n = Console.ReadLine().Split(' ');
      |                 ^
a.cc:21:17: error: expected ';' before 'a'
   21 |             var a = int.Parse(n[0]);
      |                 ^
a.cc:22:17: error: expected ';' before 'b'
   22 |             var b = int.Parse(n[1]);
      |                 ^
a.cc:24:13: error: 'tree' was not declared in this scope
   24 |             tree.Add(new int[2] { a, b });
      |             ^~~~
a.cc:24:35: error: 'a' was not declared in this scope
   24 |             tree.Add(new int[2] { a, b });
      |                                   ^
a.cc:24:38: error: 'b' was not declared in this scope
   24 |             tree.Add(new int[2] { a, b });
      |                                      ^
a.cc:27:29: error: 'countNum' was not declared in this scope
   27 |         for (int i = 0; i < countNum; i++)
      |                             ^~~~~~~~
a.cc:29:17: error: expected ';' before 'n'
   29 |             var n = Console.ReadLine().Split(' ');
      |                 ^
a.cc:30:17: error: expected ';' before 'a'
   30 |             var a = int.Parse(n[0]);
      |                 ^
a.cc:31:17: error: expected ';' before 'b'
   31 |             var b = int.Parse(n[1]);
      |                 ^
a.cc:33:13: error: 'nums' was not declared in this scope
   33 |             nums[a - 1] += b;
      |             ^~~~
a.cc:33:18: error: 'a' was not declared in this scope
   33 |             nums[a - 1] += b;
      |                  ^
a.cc:33:28: error: 'b' was not declared in this scope
   33 |             nums[a - 1] += b;
      |                            ^
a.cc:37:21: error: expected ')' before 'item'
   37 |         foreach(var item in tree)
      |                     ^~~~
a.cc:37:16: note: to match this '('
   37 |         foreach(var item in tree)
      |                ^
a.cc:37:9: error: 'foreach' was not declared in this scope
   37 |         foreach(var item in tree)
      |         ^~~~~~~
a.cc:41:22: error: expected ')' before 'item'
   41 |         foreach (var item in nums)
      |                      ^~~~
a.cc:41:17: note: to match this '('
   41 |         foreach (var item in nums)
      |                 ^
a.cc:45:9: error: 'Console' was not declared in this scope
   45 |         Console.ReadKey();
      |         ^~~~~~~