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>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
 
int main()
{
	int a,b;	
	while(1){
		cin>>a>>b;
		if(a==0 && b==0) return 0;
		if(a%4!=0) a=a-(a%4)+4;
		if((a%100==0)&&(a%400!=0)) a+=4;

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

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

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

	while (scanf("%d%d", &a, &b), a){
		if (first){
			printf("\n");
		}

		first = true;

		bool check = true;
		for (int i = a; i <= b; i++){
			if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)){
				printf("%d\n", i);
				check = false;
			}
		}

		if (check){
			printf("NA\n");
		}
	}

	return (0);
}

C++: #include <stdio.h>

int Print(int a,int b)
{
	int n=0;

	if (a == 0 && b == 0) {
		return 0;
	}

	for (int i = a; i <= b; i++) {
		if (i % 4 == 0) {
			if (i % 100 == 0) {
				if (i % 400 == 0) {
					printf("%d\n", i);
					n++;
				}
			}
			else
			{
				printf("%d\n", i);
				n++;
			}
		}
	}

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

	return 1;
}

int main(void)
{
	while (1) {
		int a, b;
		scanf("%d %d", &a, &b);

		if (Print(a, b) == 0) {
			break;
		}

		printf("\n");
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

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

    while (cin >> a >> b, a || b) {
        int ans = 0;

        if (flag)
            cout << endl;
        for ( ; a < b; a++) {
            if (a % 4 == 0 && (a % 100 != 0 || a % 400 == 0)) {
                cout << a << endl;
                ans++;
            }
        }
        if (ans == 0)
            cout << "NA" << endl;
        flag = true;
    }
    
    return 0;
}

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

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

    scanf("%d %d",&a,&b);

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

    flag=0;

    for(i=a;i<=b;i++) {
      
      if((i%4==0 && i%100!=0) || i%400==0) {
        if(flag==0) {
           printf("%d",i);
           break;
        }
	else {printf("\n%d",i);
	flag=1;
        }
      }

    }

    if(flag==0) printf("NA\n");

    printf("\n");
  }

  printf("\n");

  return 0;

}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define INF 100000000
typedef long long ll;

int main(void) {
    int a, b;
    cin >> a >> b;
    while (1) {
//        if (a == 0 && b == 0) break;
        int flag = 0;
        for (int i = a; i <= b; i++) {
            if (i % 400 == 0) {
                cout << i << endl;
                flag = 1;
            } else if (i % 100 == 0) {
                /* do nothing */
            } else if (i % 4 == 0) {
                cout << i << endl;
                flag = 1;
            }
        }
        if (flag == 0) cout << "NA" << endl;
        cin >> a >> b;
        if (a == 0 && b == 0) break;
        cout << endl;
    }
    return 0;
}

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;
	int b;
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			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;
					}
				}
			}
			std::cout << std::endl;
		}
	}
	return 0;
}

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(void)
{
    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 i = 0;
    for (int year = b; year <= c; ++year){
        if (is_leap_year(year)) {
            a[i] = year;
            ++i;
        }
    }
    return i;
}

C++: #include <stdio.h>

int leap_year(int first_year, int last_year);

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

int leap_year(int first_year, int last_year)
{
    int count = 0;
    for (int year = first_year; year <= last_year; ++year) {
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
           printf("%d\n", year);
        } else {
            ++count;
        }
    }
    if (count == last_year - first_year + 1) {
        printf("NA\n");
    }
    printf("\n");
}

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