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>

bool judge_uruyear(int year)
{

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

}

void print_uruyear(int year_begin, int year_end)
{

    int count_year = 0;

    for(int i = year_begin; i < year_end; i++) {
        if (judge_uruyear(i)) {
            count_year += 1;
            std::cout << i << std::endl;
        }    
    }

    if(count_year == 0) {
        std::cout << "NA" << std::endl;
    }

    std::endl(std::cout);

}

int main()
{

    int year_begin, year_end;

    while(true) {
        
        std::cin >> year_begin >> year_end;
        
        if(year_begin == 0 && year_end == 0) {
            break;
        }
        
        print_uruyear(year_begin, year_end);

    }
    
    return 0;
}

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

int main()
{
  int y1, y2;
  while (cin >> y1 >> y2)
  {
    bool na = true;
    if (y1 == 0 && y2 == 0) return 0;
    for (int year = y1; year <= y2; year++)
    {
      if (year % 400 == 0)
      {
        cout << year << endl;
        na = false;
      }
      else if ((year % 4 == 0) && (year % 100 != 0))
      {
        cout << year << endl;
        na = false;
      }
    }
    if (na) cout << "NA" << endl;
    cout << endl;
  }
}

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

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

C++: #include <stdio.h>

int main(void)
{
    int a, b, y, counter, datacount;
    datacount = 0;
    while(1){
        counter = 0;
        scanf("%d %d", &a, &b);
        datacount++;
        if (a == 0&& b == 0){
            break;
        }
        y = a;
        if (datacount != 1)
            {
                printf("\n");
            }
        for (int i = a; i <= b; i++){// y == i
            if (!(y%400)){
                printf("%d\n", y);
                counter++;
            }else if((!(y%4)) && y%100){
                printf("%d\n", y);
                counter++;
            }
            y++;
        }
        if (counter == 0){
            printf("NA\n");
        }
    }
    return 0;
}

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

using namespace std;

bool isLeap(int i);

int main()
{
    int a, b;
    bool flag = false;
    while (cin >> a >> b, a || b) {
        bool fl = false;
        if (flag) {
            puts("");
        } else {
            flag = true;
        }
        for (int i = a; i <= b; i++) {
            if (isLeap(i)) {
                fl = true;
                cout << i << '\n';
            }
        }
        if (!fl) {
            puts("NA");
        }
    }
    return 0;
}

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

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

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

int main(){
    int a, b;
    while (1){
	cin >> a >> b;
	if (a == 0 && b == 0) break;
	vector<int> y;
	for (int i = a; i <= b; i++){
	    if (isLeap(i)) y.push_back(i);
	}
	if (y.empty()) cout << "NA" << endl;
	else for (int i = 0; i < y.size(); i++)
		 cout << y[i] << endl;
	cout << endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;


int main(void) {

  int n, m;
  while(cin >> n >> m){
    if( n == 0||m==0 ) break;
    vector<int> ans;
    for(int i=n; i<=m; i++){
      if( i % 400 == 0) ans.push_back(i);
      else if( i % 100 == 0 ) continue;
      else if( i % 4 == 0 ) ans.push_back(i);
    }
    if( ans.size() == 0 ) cout << "NA" << endl;
    else for(int i=0; i<ans.size(); i++) cout << ans[i] << endl;
    cout << endl;

  }


  return 0;
}


// EOF

C++: #include <iostream>
using namespace std;
int main(){
	int n1,n2;
	bool g = false;
	while(cin >> n1 >> n2){
		if(g) cout << endl;
		g = true;
		if(!(n1&&n2)) break;
		bool f = false;
		for(int year=n1; year<=n2; year++){
			if(year%400==0 || (year%4==0&& year%100!=0) ){
				f = true;
				cout << year << endl;
			}
		}
		if(!f) cout << "NA" << endl;
		
	}
	return 0;
}

C++: #include <stdio.h>

void uruu(int a, int b);

int main(void)
{
    int a;
    int b;
    scanf("%d %d", &a, &b);
    while (a != 0 || b != 0) {
        uruu(a, b);
        printf("\n");
        scanf("%d %d", &a, &b);
    }
    return 0;
}


void uruu(int a, int b)
{
    int count = 0;
    for (int year = a; year <= b; ++year) {
        if (year % 4 == 0) {
            if (year % 100 != 0) {
                printf("%d\n", year);
                ++count;
            } else {
                if (year % 400 == 0) {
                    printf("%d\n", year);
                    ++count;
                }
            }
        }   
    }
    if (count == 0) {
        printf("NA\n");
    }
}

C++: #include<stdio.h>
 
int leap_year(int x);
 
 
int main(void)
{
    int start_year, end_year, counter;
    counter = 0;
    scanf(%d %d, &start_year, &end_year);
    for(int i = start_year; i =< end_year; i++){
        leap_year(i);
        counter += leap_year(i);
    } 
    if( counter = 0){
        printf("NA");
    }
    return 0;
}
 
 
int leap_year(int x)
{
    if(x % 4 = 0){
        printf("%d\n", x);
        return 1;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
/* {{{ */
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()
#define PB push_back
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

inline int in(){int x;std::cin>>x;return x;}

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
/* }}} */

int main(void)
{
  while (1){
    int a, b;
    bool frag = false;

    cin >> a >> b;
    if (a == 0 && b == 0) break;

    for (int i = a; i <= b; i++){
      if (i % 4 == 0 && i % 100 != 0){
        cout << i << endl;
        frag = true;
      }
      if (i % 100 == 0 && i % 400 == 0){
        cout << i << endl;
        frag = true;
      }
    }
    if (!frag) cout << "NA" << endl;
  }

  return 0;
}