Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func isLeapYear(y int) bool {
	return (y%4 == 0 && y%100 > 0) || (y%4 == 0 && y%400 == 0)
}

func cntLeap(y []int) {
	cnt := 0

	for i := y[0]; i <= y[1]; i++ {
		if isLeapYear(i) {
			cnt++
			fmt.Println(i)
		}
	}

	if cnt == 0 {
		fmt.Println("NA")
	}
}

func main() {
	num := 0

	for sc.Scan() {
		y := Sliceconvtoi()

		if y[0] == 0 && y[1] == 0 {
			break
		}

		if num > 0 {
			fmt.Println()
		}

		cntLeap(y)
		num++
	}

}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  while(true){
    if(!a&&!b)break;
    a--;
    if (b/4-a/4-b/100+a/100+b/400-a/400){
      for(int i=a/4*4+4;i<b+1;i+=4)
	if(i%100)cout<<i<<endl;
	else if(!(i%400))cout<<i<<endl;
    }
    else{
      cout<<"NA"<<endl;
    }
    cin>>a>>b;
    if(!a&&!b)break;
    cout<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int x[10000], y[10000][10000], a, b, cnt2;

void uruu(int s) {
	for (int i = 0; i < s; i++) {
		if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) {
			x[i] = 1;
		}
	}
}

void hantei(int start, int end) {
	int cnt = 0;
	for (int i = start; i <= end; i++) {
		if (x[i]) { cout << i << endl; cnt++; }
	}
	if (!cnt) { cout << "NA" << endl; }
}

int main() {
	uruu(10000);
	while (true) {
		cin >> a >> b;
		if (cnt2) { cout << endl; }
		cnt2++;
		hantei(a, b);
	}
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

#define INF (int)1e09

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;

template <typename T> using Vec = vector<T>; // c++11
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

int check (int year) {
    bool ret;
    if (year % 400 == 0) {
        ret = true; 
    } else if (year % 100 == 0) {
        ret = false; 
    } else if (year % 4 == 0) {
        ret = true; 
    } else {
        ret = false; 
    }
    return ret;
}

int main(void) {
    bool start = false;
    while (1) {
        int a;
        int b;
        cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        } else if (start) {
            cout << endl;
        }
        bool exist = false;
        for (int i = a; i <= b; i++) {
            if (check(i) == true) {
                cout << i << endl;
                exist = true;
            }
        }
        if (exist == false) {
            cout << "NA" << endl;
        }
        start = true;
    }
    return 0;
}

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

int main() {
  int a, b;
  bool stF = false;

  while( cin >> a >> b && (a|b) ) {
    if( stF ) cout << endl;
    stF = true;
    map<int, bool> mp;
    for( int i=a; i<=b; i++ ) {
      if( ( i % 4 == 0 && i % 100 != 0 ) || ( i % 400 == 0 ) ) 
	mp[i] = true;
    }
  
    if( mp.size() ) {
      for( map<int, bool>::iterator it = mp.begin(); it != mp.end(); it++ ) {
	cout << it->first << endl;
      }
    }
    else {
      cout << "NA" << endl;
    }
  }
  
  return 0;
}

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

int i,j,k;
int a,b,ans;

int main(){
	scanf("%d %d",&a,&b);
	while(a!=0 && b!=0){
		printf("\n");
		ans=0;
		for(i=a;i<=b;i++){
			if(i%4==0){
				if(i%100!=0)printf("%d\n",i),ans++;
				else if(i%400==0)printf("%d\n",i),ans++;
				i+=3;
			}
		}
		if(ans==0)printf("NA\n");
		
		scanf("%d %d",&a,&b);
	}
	
	return 0;
}

C++: #include <stdio.h>
int main(void)
 {
     int a, b;
     while (1) {
         int c = 0;
         scanf("%d %d", &a, &b);
         if (a == 0 && b == 0) {
             break;
         }
         for (int i = a; b >= i; ++i) {
             if (i % 4 == 0) {
                 if (i % 100 == 0) {
                     if (i % 400 == 0) {
                         printf("%d\n", i);
                         c = 1;
                     }
                 } else {
                     printf("%d\n", i);
                     c = 1;
                 } 
             }
         }
         if (c == 0) {
             printf("NA\n");
         }
         printf("\n");
     }
     return 0;
 }

C++: #include<iostream>

using namespace std;


int main(){
  int a,b,i,j;
  cin >> a >> b;
  cout << endl;
  while(a!=0 || b!=0){
    j=0;
    for(i=1;i<=3000;i++){
      if(i>=a && i<=b && i%4==0){
	if( (i%100==0 && i%400==0)  || i%100!=0 ){
	  j++;
	  cout << i << endl;
	}
      }
    }
    if(j==0){
      cout << "NA" <<endl;
    }
    
    cin >> a >> b;
    cout << endl;
  } 

}

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


main(){
	bool first = true;
	for(int a,b;cin>>a>>b,0<a&&0<b;){

		if(!first){
			puts("");
		}

		first = false;

		int cnt=0;
		for(int year=a; year<=b; ++year){
			if( year%400==0 || (year%100!=0&&year%4==0) ){
				cout<<year<<endl;
				cnt++;
			}
		}
		if(cnt==0){
			puts("NA");
		}
	}
}

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

bool is_leap_year(int y);

int get_leap_years(int* a, int b, int c);

int main()
{
    int leap_years_list[1000]; //A.D. 0 - A.D. 3000 の間に閏年は高々1000個しかない

    bool first_set = true; //一つ目のセットの前にだけは改行を入れてはいけないので

    while (true) {
        int year_begin, year_end;

        //読み込み
        scanf("%d %d", &year_begin, &year_end);

        //終了判定
        if (year_begin == 0 && year_end == 0) {
            break;
        }

        //閏年を計算する
        int leap_years_count = get_leap_years(leap_years_list, year_begin, year_end);

        //セットとセットの間には空行を入れる
        if (first_set) {
            first_set = false;
        } else {
            putchar('\n'); //putcharは一文字だけ出力する関数です
        }

        //閏年を出力
        if (leap_years_count == 0) {
            puts("NA"); //putsは与えられた文字列を出力した後改行する関数です
        } else {
            for (int i = 0; i < leap_years_count; i++) {
                printf("%d\n", leap_years_list[i]);
            }
        }
        
    }
}

bool is_leap_year(int y)
{
    if (y % 400 == 0) {
        return true; 
    } else if (y % 100 == 0) {
        return false;
    } else {
        return y % 4 == 0;
    }
}

int get_leap_years(int* a, int b, int c)
{
    int s;
    for (int i = 0; b <= c; ++i) {        
        if (is_leap_year(b) == true) {
        a[i] = b;
        ++s;
        }
        ++b;
    }
    return s;
}

C++: #include <iostream>

using namespace std;

int main(void)
{
	int in1,in2;

	while(cin >> in1 >> in2, in1 | in2){
		int c = 0;
		for(int i = in1; i <= in2; i++){
			if(i % 4 == 0 && ( (i % 100 > 0 || i % 400 == 0) ) ){
				cout << i << endl;
				c++;
			}
		}
		if(c == 0)
			cout << "NA" << endl;


	}

	return 0;
}

C++: #include <iostream>
using namespace std;
#define p(dis) cout << dis << endl

int func(int a, int b){
	int f = 1;
	for(int i = a;i <= b;i++){
		if(i % 4 == 0){
			if(i % 100 == 0){
				if(i % 400 == 0)p(i), f = 0;
				continue;
			}
			p(i), f = 0;
		}
	}
	return f;
}

int main(){
	int a, b, f = 0;
	while(cin >> a >> b, a+b){
		if(f)cout << endl;f = 1;
		if(func(a, b))cout << "NA" <<endl;
		cout << endl;
	}
	return 0;
}