Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)

	for stdin.Scan() {
		n, _ := strconv.Atoi(stdin.Text())
		if n == 0 {
			break
		}
		sales := make(map[string]int)
		existed := make(map[string]bool)
		order := make([]string, 4000)
		flg := false
		for i := 0; i < n; i++ {
			stdin.Scan()
			l := strings.Split(stdin.Text(), " ")
			e := l[0]
			p, _ := strconv.Atoi(l[1])
			q, _ := strconv.Atoi(l[2])
			sales[e] += p * q
			if !existed[e] {
				order = append(order, e)
				existed[e] = true
			}
		}
		for _, v := range order {
			if sales[v] >= 1000000 {
				fmt.Println(v)
				flg = true
			}
		}
		if flg == false {
			fmt.Println("NA")
		}
	}
}

C++: #include <stdio.h>

#define MAX 4000

int main(void){
	int i,dataset,snum,flag;
	long long total[MAX],unitcost,amount;
	while( 1 ){

		for(i=0;i<MAX;i++){
			total[i]=0;
		}

		scanf("%d",&dataset);
		if( dataset == 0 ){break;}

		else for(i=0;i<dataset;i++){
			scanf("%d %lld %lld",&snum,&unitcost,&amount);
			total[snum]+=unitcost*amount;
		}
		

		flag=0;
		for(i=0;i<MAX;i++){
                        if( total[i] >= 1000000 ){
				flag=1;
				printf("%d\n",i);
			}
		}
		if( dataset!=0 && flag==0 ){
			printf("NA\n");
		}
	}
}

C++: #include <iostream>
using namespace std;
typedef unsigned long long lli;

int main(void){
	int a,b,c;
	int n;
	while(cin>>n,n){
		lli m[4001];
		bool f=false;
		for(int i=0;i<=4000;i++)m[i]=0;
		while(n--){
			cin>>a>>b>>c;
			m[a]+=b*c;
			if(m[a]>=1000000)f=true;
		}
		if(f){
			for(int i=0;i<=4000;i++){
				if(m[i]>=1000000)cout<<i<<endl;
			}
		}else{
			cout<<"NA"<<endl;
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std ;

main(){
	int n,num,p,m,j ;
	bool t ;
	while( cin >> n , n ){
		int E[4010] = {} ;
		vector<int> V ;
		for( int i=0 ; i<n ; i++ ){
			cin >> num >> p >> m ;
			if( E[num] < 1000000 ) E[num] += p * m ;
			
			t = true ;
			for( int j=0 ; j<V.size() ; j++ ){
				if( V[j] == num ){
					t = false ;
					break ;
				}
			}
			if( t ) V.push_back( num ) ;
		}
		
		t = false ;
		for( int i=0 ; i<V.size() ; i++ ){
			if( E[V[i]] >= 1000000 ){
				cout << V[i] << endl ;
				t = true ;
			}
		}
		if( !t ) cout << "NA" << endl ;
	}
}

C++: #include <iostream>
#include <cstring>
using namespace std;

int main(){
	long long int n,i,j,tmp,mx,price[4000][2],a,b,c;
	bool flag;
	while(cin >> n && n){
		flag = false;
		mx = 0;
		memset(price,'\0',sizeof(price));
		for(i = 0;i < n;++i){
			cin >> a >> b >> c;
			for(j = 0;j < mx;++j){
				if(price[j][0] == a){
					tmp = j;
					flag = true;
				}
			}
			if(flag) price[tmp][1] += (b * c);
			else {
				price[mx][1] += (b * c);
				price[mx][0] = a;
				++mx;
			}
			flag = false;
		}
		flag = false;
		for(i = 0;i < mx;++i){
			if(price[i][1] >= 1000000){
				cout << price[i][0] << endl;
				flag = true;
			}
		}
		if(flag == false) cout << "NA" << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	if(a > b){
		cout << "a > b" << endl;
	}else if(a < b){
		cout << "a < b" << endl;
	}else{
		cout << "a == b" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>

using ull = unsigned long long;
const unsigned bound = 1000000;
 

void solve(unsigned n);

int main()
{
	using namespace std;
	unsigned n = 0;
	cin >> n;

	while (n != 0)
	{
		solve(n);
		cin >> n;
	}
	
}

void solve(unsigned n)
{
	using namespace std;
	map<int, ull> records;

	for (int i = 0; i < n; i++)
	{
		int id = 0;
		unsigned price = 0, amount = 0;
		cin >> id >> price >> amount;

		if (records.find(id) == records.end())
			records[id] = ull(price) * ull(amount);
		else
			records[id] += ull(price) * ull(amount);
	}

	vector<int> idList;
	for (auto man : records)
	{
		if (man.second >= bound)
			idList.push_back(man.first);
	}

	if (!idList.empty())
	{
		for (int id : idList)
			cout << id << endl;
	}
	else
	{
		cout << "NA" << endl;
	}
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	ll u[4010];
	bool flag;
	vector<int> v;
	while(1)
	{
		for(int i=0;i<4010;i++)
		{
			u[i]=0;
		}
		flag=true;
		int n;
		cin >> n;
		if(n==0)break;
		v.clear();
		for(int i=0;i<n;i++)
		{
			int x;
			ll y,z;
			cin >> x >> y >> z;
			if(!(u[x]))
			{
				v.pb(x);
			}
			u[x]+=y*z;
		}
		for(int i=0;i<v.size();i++)
		{
			if(u[v[i]]>=1000000)
			{
				flag=false;
				cout << v[i] << endl;
			}
		}
		if(flag)
		{
			cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <map>

using namespace std;

int main() {
	int num;
	int LINE = 1000000;

	while(cin>>num, num){
		map<int, long long> employees;
		map<int, long long>::iterator itr;
		employees.clear();
		bool flg = false;
		for(int i=0; i<num; i++){
			int id =0, q=0, p=0;
			cin>>id>>q>>p;
			employees[id] += (q*p);
		}
		for(itr = employees.begin(); itr != employees.end(); itr++){
			if(itr->second >= LINE){
				cout<<itr->first<<endl;
				flg = true;
			}
		}
		if(!flg){
			cout<<"NA"<<endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,c;
  while(cin>>n,n){
    int a[10000]={0},c=0,b[n],p,o,u;
    rep(i,n){
      cin>>p>>o>>u;
      a[p]+=o*u;
    }
    rep(i,4001){
      if(a[i]>=1000000){cout<<i<<endl;c++;}
    }
    if(!c)cout<<"NA"<<endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int n;
    while( cin >> n, n ){
        vector< int > ls(4001, 0);
        bool NA = true;
        for(int i = 0; i < n; i++){
            int a, b, c;
            cin >> a >> b >> c;
            if( ls[a] >= 0 ){
                ls[a] += b*c;
                if( ls[a] >= 1000000){
                    cout << a << endl;
                    NA = false;
                    ls[a] = -1;
                }
            }
        }
        if( NA ) cout << "NA" << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <map>
#include <algorithm>
using namespace std;

typedef unsigned long long int ull;

map<int,ull> mp;

int main() {
  int n;
  
  while(cin>>n, n) {
    mp.clear();
    
    for(int i=0; i<n; i++) {
      int a;
      ull b, c;
      cin >> a >> b >> c;
      mp[a] += b * c;
    }
    bool isExist = false;
    for(map<int, ull>::iterator it = mp.begin(); it!=mp.end(); it++) {
      if( it->second >= 1000000 ) {
	isExist = true;
	cout << it->first << endl;
      }
    }
    if( !isExist ) cout << "NA" << endl;
  }
  
  return 0;
}

C++: #include <stdio.h>

int main()
{
	int n;

	while (1) {
		int x = 0, emp[4000] = {};

		scanf("%d", &n);
		if(n == 0) break;

		for (int i = 0; i < n; i++) {
			int e, p, q;
			scanf("%d %d %d", &e, &p, &q);

			emp[e] += p*q;

			if(emp[e] >= 1000000) {printf("%d\n", e); x = 1;}
		}

		if (x != 1) printf("NA\n");
	}

	return 0;
}