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 <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>

#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to, weight;

	bool operator < (const Edge& obj) const {
		return weight < obj.weight;
	}
	bool operator > (const Edge& obj) const {
		return weight > obj.weight;
	}
};

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //????????\??£??????????????¨ y?????\??£?????????????????????
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //x??¨y????????????????????\??£??????????????????????????????
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int arr[100001];
void Eratosthenes(int N) {//N?????§????´???°??¨
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = i * 2; j <= N; j += i) {
				arr[j] = 0;
			}
		}
	}
}

int main()
{
	while (1) {

	int a, b;
	cin >> a >> b;

	if (a == 0 && b == 0) break;
	bool f = false;
	rep(i, a, b + 1) {
		if ((i % 4) == 0 && i % 100) f = 1, cout << i << endl;
		else if ((i % 400) == 0) f = 1, cout << i << endl;
	}
	cout << (f ? "" : "NA") << endl;
	}
	return 0;
}

C++: #include<stdio.h>

void leap_year(int start_year, int end_year);

int main(void)
{
 int start_year;
 int end_year;
   int i = 0;
   while(1){
   scanf("%d %d", &start_year, &end_year);
   if (start_year == 0 && end_year == 0) {
     break;
  } else {
    if ( i == 1) {
      printf("\n");
  }
    leap_year(start_year, end_year);
    i = 1
   }
   }
   return 0;
}

void leap_year(int start_year, int end_year)
{
 int n = 0;
 int year = start_year;
   while (year <= end_year){
     if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)){
     printf("%d\n", year);
     n++;
   }
     year++;
 }
 if (n == 0){
   printf("NA\n");
  }
}

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

int z;

int leap(int year){
	if(year % 400 == 0){
		cout << year << endl;
		z++;
	}
	else if (year % 4 == 0){
		if(year % 100 != 0){
			cout << year << endl;
			z++;
		}
	}
	return 0;
}

int main(){
	int a, b;
	z = -1;
	cin >> a >> b;
	if (a == 0 && b == 0) { return 0; }
	for (int i = a; i <= b; i++) {
		leap(i);
	}
	if (z == -1) {
		cout << "NA" << endl;
	}
	while(cin >> a >> b){
		z = -1;
		if (a == 0 && b == 0) { break; }
		cout << endl;
		for ( int i = a;i<=b;i++){
			leap(i);
		}
		if (z == -1){
			cout << "NA" << endl;
		}
	}
	return 0;
}

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

using namespace std;

#define loop(i, a, b) for(int i = a; i < b; i++)

int main()
{
  int a, b, c = 0;
  
  while(1) {
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    cout << endl;
    int cnt = 0;
    loop(i, a, b + 1) {
      if(i % 400 == 0) { cout << i << endl; cnt++; }
      else if(i % 100 && i % 4 == 0) { cout << i << endl; cnt++; }
    }
    if (!cnt)  cout << "NA" << endl << endl;

  }
}

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

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

using namespace std;

int main(){
  int n,m;
  vector<int> vec;

  scanf("%d%d", &n, &m);

  while(1){
    vec.clear();

    for(int i=n;i<=m;i++){
      if(!(i%400)) vec.push_back(i);
      else if((i%100) && !(i%4)) vec.push_back(i);
    }

    vector<int>::iterator it;
    for(it=vec.begin();it!=vec.end();it++){
      printf("%d\n", *it);
    }

    if(vec.size() == 0) puts("NA");

    scanf("%d%d", &n, &m);
    if(n==0&&m==0) break;
    else puts("");
  }
}

C++: #include <iostream>



bool judge(int year);

int main() 
{
	int start, end;
	
	while (true) {
		int check = 0;
		std::cin >> start >> end;
		
		std::cout << std::endl;
		
		if (start == 0 && end == 0) {
			break;
		}
		
		for (int i = start; i <= end; i++) {
			if (judge(i)) {
				std::cout << i << std::endl;
				check = 1;
			}
		}
		
		if (check == ) {
			std::cout << "NA" << std::endl;
		}
		
	}
	return 0;
}


bool judge(int year){
	if ((year % 4 == 0 && !(year % 100 == 0)) || year % 400 == 0) {
		return true;
	} else {
		return false;
	}
}

C++: #include <stdio.h>

void leap_year(int x, int y)
{
    while (x <= y) {
        if (((x % 4 == 0) && (x % 100 != 0)) || (x % 400 == 0)) {
            printf("%d\n", x);
        }
        x += 1;
    }    
}

int main(void)
{
    int x, y;
    scanf("%d %d", &x, &y);
    while(!(x == 0 && y == 0)) {
        leap_year(x, y);
        printf("\n");
        scanf("%d %d", &x, &y);
    }
    return 0;
}