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>
using namespace std;

int main(){
	int year[3001];
	for(int i=0;i<3001;i++){
		if(i%4==0){
			year[i]=1;
			if(i%100==0){
				year[i]=0;
			}
			if(i%400==0){
				year[i]=1;
			}
		}
	}
	int a,b;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){
			break;
		}
		int cnt=0;
		for(int j=a;j<=b;j++){
			if(year[j]==1){
				cout<<j<<endl;
				cnt++;
			}
		}
		if(cnt==0)cout<<"NA"<<endl;
	}
	return 0;
}

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

int start, end;
int ans[800], count;

int main(){
	while(cin >> start >> end, start || end){
		count = 0;
		for(; start <= end; start++){
			if(start % 4 == 0){
				if(start % 100 == 0){
					if(start % 400 == 0){
						ans[count] = start;
						count++;
					}
				}
				ans[count] = start;
				count++;
			}
		}
		if(count == 0) cout << "NA" << endl;
		else{
			for(int i=0; i < count; i++){
				cout << ans[i] << endl;
			}
		}
		cout << endl;
	}
}

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

void printLeapYear(int, int);
bool judgeLeapYear(int);

int main(void)
{
    int start_year, end_year;
    bool first_data = true;
    
    while (true) {
        scanf("%d%d", &start_year, &end_year);
        
        if (start_year == 0 && end_year == 0) {
            break;
        }
        
        if(first_data) {
            first_data = false;
        } else {
            printf("\n");
        }
        printLeapYear(start_year, end_year);

    }
    
    return 0;
}

void printLeapYear(int start_year, int end_year)
{
    bool exist_leap_year = false;
    
    for (int year = start_year; year <= end_year; year++) {
        if (judgeLeapYear(year)) {
            exist_leap_year = true;
            printf("%d\n", year);
        }
    }

    if(!exist_leap_year) {
        printf("NA\n");
    }
}

bool judgeLeapYear(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;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
  int a, b, k = 0;
  while(cin >> a >> b, a||b){
    if(k > 0 and (a or b)) cout << endl;
    int t = 0;
    ++k;
    for(int i = a; i <= b; ++i){
      if(i%4) continue;
      if((not (i%100)) and i%400) continue;
      ++t;
      cout << i << endl;
    }
    if(not t) cout << "NA" << endl;
  }
}

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

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

C++: #include <iostream>

using namespace std;

void solve()
{
	int a, b;
	bool firstFlag = true;
	while(cin >> a >> b, a || b)
	{
		if(!firstFlag)
		{
			cout << endl;
		}
		firstFlag = false;
		int count = 0;
		for(int i = a; i <= b; ++i)
		{
			if(i % 4 == 0)
			{
				if(i % 100 == 0 && i % 400 == 0)
				{
					cout << i << endl;
					++count;
				}
				else if(i % 100 != 0)
				{
					cout << i << endl;
					++count;
				}
			}
		}
		if(count == 0)
		{
			cout << "NA" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <stdio.h>

int hantei(int year);
//???????????´????????????????????????????????????

int main(void)
{
	int year[2];
	int NA;
	for(;;) {
		scanf("%d %d", &year[0], &year[1]);
		if(year[0] == 0 && year[1] == 0) {
			break;
		}
		NA = 0;
		for(int i = year[0]; i <= year[1]; i++) {
			if(hantei(i) == 1) {
			printf("%d\n", i);
			NA++;
			}
		}
		if(NA == 0) {
			printf("NA\n");
		}
	}
	return 0;
}

int hantei(int year)
{
	if(year % 400 == 0) {
		return 1;
	}else if(year % 100 == 0) {
		return 0;
	}else if(year % 4 == 0) {
		return 1;
	}else{
		return 0;
	}
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<cstdio>
#include<cmath>
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
	int a,b;
	bool h=true;
	while(cin>>a>>b,a|b){
		if(!h)cout<<endl;
		h=false;
		int co=0;
		loop(i,a,b+1){
			if(i%4!=0||(i%100==0&&i%400!=0));
			else{cout<<i<<endl;co++;}
		}
		if(!co)cout<<"NA"<<endl;
	}	
}

C++: #include <stdio.h>

int main(void)
{
	int a, b, y, counter;
	while(1){
		counter = 0;
		scanf("%d %d", &a, &b);
		if (a == 0&& b == 0){
			break;
		}
		y = a;
		//printf("%d\n", a);
		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");
		}else{
			printf("\n");
		}
	}

	return 0;
}

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

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;
    }
    cout << endl;
}

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