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<stdio.h>

int main(){
	int num,age,tanka;
	int i,j,n,temp;
	int sya[4000];
	double uriage[4000];
	
	
	for(;;temp=0){
		for(i=0;i<n;i++)uriage[i]=0;
		scanf("%d", &n);
		if(n==0)break;
		
		for(i=0;i<n;i++){
			scanf("%d%d%d", &num, &tanka, &age);
			
			for(j=0;j<=i;j++){
				if(sya[j]==num){
					uriage[j]+=tanka*age;
					break;
				} else {
					sya[i]=num;
					uriage[i]+=tanka*age;
					break;
				}
			}
		}
		for(i=0;i<n;i++){
			if(uriage[i]>=1000000){
				printf("%d\n",sya[i]);
				temp=1;
			}
		}
		if(temp==0)puts("NA");
	}
	return 0;
}

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

#define ll long long

bool debug = false;

int main(void){
  map<int,ll> m;
  vector<int> order;
  int n;
  long long no,amount,price;

  while(cin >> n){
	bool exist = false;
	if(!n) break;
	for(int i=0;i<n;i++){
	  cin >> no >> amount >> price;
	  if(find(order.begin(), order.end(), no) == order.end()){
		order.push_back(no);
		if(debug) cout << "pushed " << no << endl;
	  }
	  m[no] += (ll)amount*price;
	}
	for(int i=0;i<order.size();i++){
	  if(m[order[i]] >= 1e+6){
		cout << order[i] << endl;
		exist = true;
	  }
	}
	if(!exist) cout << "NA" << endl;
	m.clear();
	order.clear();
  }
}

C++: #include <stdio.h>

#define MAX 4000

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

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

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

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

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

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;
		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);
		}
		if(employees.size()==0){
			cout<<"NA"<<endl;
		}
		for(itr = employees.begin(); itr != employees.end(); itr++){
			if(itr->second >= LINE) cout<<itr->first<<endl;
		}
	}
	return 0;
}

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

int main(){
int n,a;
double b,c;
cin>>n;
for(;n>0;n--){
cin>>a>>b>>c;
b=1000000/b;
if(b>=c)cout<<a<<endl;
if(b<c)cout<<"NA"<<endl;}}

C++: #include<iostream>
using namespace std;
int main()
{
    int n,na,e;
    long long sum[4010];
    long long p,q;
    while(cin >> n,n!=0){
        na = 0;
        for(int i=0;i<=4000;i++) sum[i] = 0;
        for(int i=0;i<n;i++){
            cin >> e >> p >> q;
            if(sum[e] >= 1000000) continue;
            sum[e] += p*q;
            if(sum[e] >= 1000000){
                na = 1;
                cout << e << endl;
            }
        }
        if(na == 0) cout << "NA" << endl;
    }
    return 0;
}

C++: #include <stdio.h>

#define MAX 4000

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

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

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

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

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

C++: #include <stdio.h>
#include <stdbool.h>

int main(void)
{
    int data_num, data_num_update;
    int employee_num[4000] = {};
    long long unit_sale_num[4000] = {};
    long long sale_num[4000] = {};
    
    while ((scanf("%d", &data_num)) != EOF) {
        
        if (data_num == 0) break;
        
        data_num_update = data_num;
        for (int i = 0; i < data_num; ++i) {
            scanf("%d %lld %lld", &employee_num[i], &unit_sale_num[i],  &sale_num[i]);
        }
        
        int data_check = 0;

        while (data_check < data_num - 1) {
            for (int i = data_check + 1; i < data_num; ++i) {
                if (employee_num[data_check] == employee_num[i]) {
                    sale_num[data_check] += sale_num[i];
                    unit_sale_num[data_check] += unit_sale_num[i];
                    data_num_update--;
                }
            }
            data_check++;
        }
        
        bool result_flag = true;
        
        for (int i = 0; i < data_num_update; ++i) {
            if (unit_sale_num[i] * sale_num[i] >= 1000000) {
                printf("%d\n", employee_num[i]);
                result_flag = false;
            }
            
            if (result_flag) {
                printf("NA\n");
                break;
            }
        }
    }

    return 0;
}

C++: #include<stdio.h>

int main()
{
	int i,ryou,bangou[4000],nedan[4000],kazu[4000],check;
	while(1)
	{
		check=0;
		scanf("%d",&ryou);
		if(ryou==0)
			break;
		for(i=0;i<ryou;i++)
		{
			scanf("%d%d%d",&bangou[i],&nedan[i],&kazu[i]);
			{
				if(nedan[i]*kazu[i]>=1000000)
				{
					printf("%d\n",bangou[i]);
					check=1;
				}
			}
		}
		if(check==0)
				printf("NA\n");
	}
}

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

std::vector<std::string> split(const std::string& ref,char c){
std::vector<std::string> res;
size_t current=0, found;
while((found=ref.find_first_of(c,current))!=std::string::npos){
res.push_back(std::string(ref,current,found-current));
current=found+1;
}
res.push_back(std::string(ref,current,ref.size()-current));
return res;
}

int main(void){

int it_num=0;
std::string str;
std::vector<std::string> ref;
std::vector<std::string> res;

std::cin >> str;
if(str!="") it_num=std::stoi(str);
std::cout << str;
while(it_num!=0){
for(int i=0;i<it_num;i++){
std::getline(std::cin,str);
ref=split(str,' ');
if((std::stoi(ref[1])*std::stoi(ref[2]))>=1000000){
res.push_back(ref[0]);
}
}
std::cin >> it_num;
}
for(int j=0;j<res.size();j++){
std::cout << res[j] << std::endl;
}

return 0;
}

C++: #include <map>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    map<int,long long> emps;
    vector<int> ids;
    int id,cost,amount,n;
    while(cin >> n,n){
        bool exist=false;

        for(int i=0;i<n;i++){
            cin >> id >> cost >> amount;
            if(emps.find(id)!=emps.end()){
                emps[id]+=cost*amount;
            }else{
                emps[id]=cost*amount;
                ids.push_back(id);
            }
        }
        for(int i=0;i<ids.size();i++){
            if(emps.at(ids[i])>=1000000){
                cout << ids[i] << endl;
                exist=true;
            }
        }
        if(exist) cout << "NA" << endl;

    }
    return 0;
}