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 <stdio.h>
#include <stdbool.h>

void leapyear (int year1, int year2)
{
    int i;
    int j = 0; 
    for (i = year1; i <= year2; ++i) {
        if (i % 4 == 0) {
            if (i % 100 != 0) {
                printf("%d\n", i);
                ++j;
            } else if (i % 400 == 0) {
                printf("%d\n", i);
                ++j;
            } 
        }
    }
    if (j == 0) {
        printf("NA\n");
    }
    printf("\n");
}

int main(void)
{
    while (true) {
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        leapyear(year1, year2);
    }
    return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

int a, b;

inline bool isLeap(int y)
{
  if(!(y % 400)) return true;
  if(!(y % 100)) return false;
  if(!(y % 4))   return true;
  return false;
}

int main()
{
  cin >> a >> b;

  while(a && b){
    int res = 0;
    bool flag = false;
    rrep(i, a, b) if(isLeap(i)){
      flag = true;
      cout << i << endl;
    }
    if(!flag) cout << "NA" << endl;
    if((cin >> a >> b) && a && b) cout << endl;
  }

  return 0;
}

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

C++: #include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int a, b;
	bool first = true;
	while (cin >> a >> b, a) {
		if (!first) cout << endl;
		first = false;
		bool na = true;
		range (i, a, b + 1) {
			if (i % 4 == 0) {
				if (i % 400 == 0) {
					na = false;
					cout << i << endl;
				}
				else if (i % 100 != 0) {
					na = false;
					cout << i << endl;
				}
			}
		}
		if (na) cout << "NA" << endl;
	}
	return 0;
}

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

bool is_leap_year(int y);

int get_leap_years(int leap_years_list[1000], int year_begin, int year_end);

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 leap_years_count[1000], int year_begin, int year_end)
{
    int k = 0;
    for (int n = year_begin; n <= year_end ; n++) {
      if ( is_leap_year(n) == false ) {
        //false の時何も処理しない                                                                                                                                                   
      } else {
        leap_years_count[k] = n;  //k番目のメモリに閏年の年を入力する                                                                                                                
        k++;
      }
    }
    return k;  //使ったメモリの数を返す                                                                                                                                              
}

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

int main(){
	int a,b;
	int line =0;
	while(++line){
		cin >> a >> b;
		if(a==0 && b==0) break;
		int count=0;
		if(line > 1) cout << "\n";
		for(int i=a; i < b; i++){
			if(i % 4==0 && i % 100 !=0 || i % 400 ==0){
				cout << i << "\n";
				count++;
			} 
		}
		if(count ==0) cout << "NA\n";
	}

	return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;


int main()
{



    while(true){
            int a,n,i,k=0;
   cin>>a>>n;
if(a==0 && n==0) break;
if(a>n) swap(a,n);
    for(i=a;i<=n;i++)
        if(((i%400==0) || (i%100 !=0)) && ( i%4==0))
        {
            printf("%d\n",i); ++k;

        }
    if(k==0) printf("NA\n");
    printf("\n");
    }

}