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>
 
int lpyrJudge(int x, int y);
 
int main(void)
{
    int sta, fin;
    while (true) {
        scanf("%d %d", &sta, &fin);
        if (sta == 0 && fin == 0) {
            break;
        } else {
            lpyrJudge(sta, fin);
        }
    }
    return 0;
}
 
int lpyrJudge(int x, int y)
{
    int minmod4x;   //x??\???????????°????4?????????°
    if (x % 4 == 0){
        minmod4x = x;
    } else {
        minmod4x = x - x % 4 + 4;
    }
    if (y - minmod4x < 4) {
        printf("NA\n");
    } else {
        int firstline = 0;
        for (int i = minmod4x; i <= y; i = i + 4) {
            if (firstline =! 0) {
                printf("\n");
            }
            if (i % 100 == 0) {
                if(i % 400 == 0) {
                    printf("%d\n", i);
                } else {    //??????????????????????????????
                }
            } else {
                printf("%d\n", i);
            }
            firstline++;
        }
    }
    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;
    cout << "" << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int a, b;
bool isLeap(int year) {
    return((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}

void solve() {
    bool f = false;
    for(int r = a; r <= b; r++) {
        if(isLeap(r)){f = true; cout << r << endl;}
    }
    if(!f) {
        cout << "NA" << endl;
    }
    putchar('\n');
}

int main(void) {
    while(cin >> a >> b, a != 0 && b != 0) {
        solve();
    }
    return(0);
}

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

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

C++: #include<stdio.h>

void leap_year(int a, int b);

int main(void)
{
    while (1){
        int a, b;
        scanf("%d %d", &a, &b);
        if (a == 0 && b ==0) {
            break;
        } else {
            leap_year(a, b);
        }
    }
    return 0;
}

void leap_year(int a, int b)
{
    for(int i = a; i <= b; i++){
        int j = i;
        if (i - j / 400 * 400 == 0) { //iが４００の倍数の時
            printf("%d\n", i);
            j = i;
        } else if (!(i - j / 100 * 100 == 0)) { //iが100の倍数のでないとき
            int j = i;  
            if ( i - j / 4 * 4 == 0) {//iが四の倍数のとき
                printf("%d\n", i);
            }
        }
    }
}

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

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

int main()
{
    do {
        int start;
        int end;

        std::cin >> start;
        std::cin >> end;

        if (start == 0 && end == 0) {
            break;
        }

        if (start >= end) {
            std::cout << "NA" << std::endl;
        }

        for (int i = start; i <= end; i++) {
            if (isLeapYear(i) == true) {
                std::cout << i << std::endl;
            }
        }

        std::cout << std::endl;

    } while (true);
}

C++: #include <iostream>


int leap_year(int y) {
	if( y % 400 == 0) {
		return 1;
	} else if (y % 100 == 0 && y % 400 != 0) {
		return 0;
	} else if (y % 4 == 0 && y % 100 != 0) {
		return 1;
	} else {
		return 0;
	}
}
int main()
{
	int a, b;
	int n = 0;
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			if (n >0) {
				std::cout << std::endl;
			}
			int sum = 0;
			for (int k = a; k <= b; k++) {
				sum = sum + leap_year(k);
			}
			if (sum == 0) {
				std::cout << "NA" << std::endl;
			} else {
			    for (int i =a; i <= b; i++) {
					if (leap_year(i) == 1) {
						std::cout << i << std::endl;
					}
				}
			}
		}
	n++;
	}
	return 0;
}

C++: #include<stdio.h>
int miny,maxy;
int cou=0;

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

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

#define NMAX 1000000

using namespace std;

int main(void){

	int a,b;
	bool f;
	bool f2=false;

	while(1){
		cin>>a>>b;
		if(a==0&&b==0) break;
		if(f) cout<<endl;
		f2=true;
		f=false;
		for(int i=a;i<=b;i++){
			if(i%4==0){
				if(i%100!=0||i%400==0){
					cout<<i<<endl;
					f=true;
				}
			}
		}
		if(!f) cout<<"NA"<<endl;
	}

	return 0;
}

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

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

int main(void){
	int f,t;
	bool k=false;
	while(1){
		bool u=false;
		cin >> f >> t;
		if(f==0 && t==0)break;
		if(k)cout << endl;
		for(int i=f;i<=t;i++){
			if(uruu(i)){
				u=true;
				cout << i << endl;
			}
		}
		if(!u)cout << "NA" << endl;
		k=true;
	}
    return 0;
}