Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}

		sales := make([]int, 4000)
		members := make([]int, 0)
		memberCheck := make(map[int]bool)

		for i := 0; i < n; i++ {
			scanner.Scan()
			input := strings.Split(scanner.Text(), " ")
			e, _ := strconv.Atoi(input[0])
			p, _ := strconv.Atoi(input[1])
			q, _ := strconv.Atoi(input[2])

			if e >= 1 && e <= 4000 && memberCheck[e] == false {
				members = append(members, e)
				memberCheck[e] = true
			}
			sales[e-1] += p * q
		}

		emptyFlag := true
		for _, v := range members {
			if sales[v-1] >= 1000000 {
				fmt.Println(v)
				emptyFlag = false
			}
		}

		if emptyFlag == true {
			fmt.Println("NA")
		}
	}
}

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

int main(){
	int n, id;
	long long int a, b;

	while( cin >> n , n ){
		map<int,long long int> employees;
		vector<int> vc;
		bool flag = true;
		
		for(int i=0 ; i<n ; ++i ){
			cin >> id >> a >> b;
			if( !employees[id] ) vc.push_back( id );
			employees[id] += a * b;	
		}
		for(int i=0 ; i<vc.size() ; ++i ){
			if( employees[ vc[i] ] >= 1000000 ){
				cout << vc[i] << endl;
				flag = false;
			}
		}
		if( flag ){
			cout << "NA" << endl;
		}
	}
}

C++: #include<iostream>
#include<cstring>
using namespace std;
long long int sales[4010];

int main()
{
    int n;
    while(cin>>n)
    {
        if(n==0)break;
    
        memset(sales,0,sizeof(sales));
        int num,tanka,kazu;

        for(int i=0;i<n;i++)
        {
            cin>>num>>tanka>>kazu;
            sales[num] += tanka*kazu;
        }
        int na = 0;
        for(int i=1;i<4001;i++)
        {
            if(sales[i]>=1000000)
            {
                na = 1;
                cout<< i<<endl;
            }
    
        }
        if(na==0)cout<< "NA"<<endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct shain{
	int id;
	int uriage;
	struct shain *next;
}shine;

shine *makeNewNode(int id,int tanka,int uriage){
	shine *newNode;
	newNode=(shine *)malloc(sizeof(shine));
	
	newNode->id=id;
	newNode->uriage=uriage*tanka;
	newNode->next=NULL;
	return (newNode);
}

int main(){
	int count=0,counter;
	while(1){
		scanf("%d",&counter);
		if(counter==0){
			break;
		}
		count=0;
		shine *newNode;
		shine *nowNode;
		shine *firstNode=NULL;
		while(counter>count){
			int a,b,c;
			scanf("%d %d %d",&a,&b,&c);
			newNode=makeNewNode(a,b,c);
			if(firstNode==NULL){
				firstNode=newNode;
				nowNode=newNode;
			}else{
				nowNode=firstNode;
				while(nowNode->id!=newNode->id&&nowNode->next!=NULL){
					nowNode=nowNode->next;
				}
				
				if(nowNode->id==newNode->id){
					nowNode->uriage+=newNode->uriage;
				}else{
					nowNode->next=newNode;
				}
			}
			count++;
		}
		nowNode=firstNode;
		int flag=1;
		while(nowNode!=NULL){
			if(nowNode->uriage>=1000000){
				printf("%d\n",nowNode->id);
				flag=0;
			}
			nowNode=nowNode->next;
		}
		if(flag){
			printf("NA\n");
		}
	}
	return 0;
}

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;
}