Language: C++

using System;
using System.Collections.Generic;
class _0100
{
    public static void Main()
    {
        bool flag;
        string[] data;
        long sum, val;
        Dictionary<string, long> d = new Dictionary<string, long>();
        List<string> sortDKey;
        int n = int.Parse(Console.ReadLine());
        while (n != 0)
        {
            d.Clear();
            flag = false;
            for (int i = 0; i < n; i++)
            {
                data = Console.ReadLine().Split();
                sum = long.Parse(data[1]) * long.Parse(data[2]);
                if (d.TryGetValue(data[0], out val))
                {
                    d.Remove(data[0]);
                    d.Add(data[0], val + sum);
                }
                else d.Add(data[0], sum);
            }
            sortDKey = new List<string>(d.Keys);
            sortDKey.Sort();
            foreach (string k in sortDKey)
            {
                if(d[k] >= 1000000)
                {
                    flag = (!flag) ? true : flag;
                    Console.WriteLine(k);
                }
            }
            if (!flag) Console.WriteLine("NA");
            n = int.Parse(Console.ReadLine());
        }
    }
}

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:5:11: error: expected ':' before 'static'
    5 |     public static void Main()
      |           ^~~~~~~
      |           :
a.cc:42:2: error: expected ';' after class definition
   42 | }
      |  ^
      |  ;
a.cc: In static member function 'static void _0100::Main()':
a.cc:8:9: error: 'string' was not declared in this scope
    8 |         string[] data;
      |         ^~~~~~
a.cc:8:16: error: expected primary-expression before ']' token
    8 |         string[] data;
      |                ^
a.cc:10:9: error: 'Dictionary' was not declared in this scope
   10 |         Dictionary<string, long> d = new Dictionary<string, long>();
      |         ^~~~~~~~~~
a.cc:10:28: error: expected primary-expression before 'long'
   10 |         Dictionary<string, long> d = new Dictionary<string, long>();
      |                            ^~~~
a.cc:11:9: error: 'List' was not declared in this scope
   11 |         List<string> sortDKey;
      |         ^~~~
a.cc:11:22: error: 'sortDKey' was not declared in this scope
   11 |         List<string> sortDKey;
      |                      ^~~~~~~~
a.cc:12:17: error: expected primary-expression before 'int'
   12 |         int n = int.Parse(Console.ReadLine());
      |                 ^~~
a.cc:15:13: error: 'd' was not declared in this scope
   15 |             d.Clear();
      |             ^
a.cc:19:17: error: 'data' was not declared in this scope
   19 |                 data = Console.ReadLine().Split();
      |                 ^~~~
a.cc:19:24: error: 'Console' was not declared in this scope
   19 |                 data = Console.ReadLine().Split();
      |                        ^~~~~~~
a.cc:20:23: error: expected primary-expression before 'long'
   20 |                 sum = long.Parse(data[1]) * long.Parse(data[2]);
      |                       ^~~~
a.cc:21:44: error: 'out' was not declared in this scope
   21 |                 if (d.TryGetValue(data[0], out val))
      |                                            ^~~
a.cc:28:28: error: 'List' does not name a type
   28 |             sortDKey = new List<string>(d.Keys);
      |                            ^~~~
a.cc:30:29: error: expected ')' before 'k'
   30 |             foreach (string k in sortDKey)
      |                             ^
a.cc:30:21: note: to match this '('
   30 |             foreach (string k in sortDKey)
      |                     ^
a.cc:30:13: error: 'foreach' was not declared in this scope
   30 |             foreach (string k in sortDKey)
      |             ^~~~~~~
a.cc:38:24: error: 'Console' was not declared in this scope
   38 |             if (!flag) Console.WriteLine("NA");
      |                        ^~~~~~~
a.cc:39:17: error: expected primary-expression before 'int'
   39 |             n = int.Parse(Console.ReadLine());
      |                 ^~~