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>
   
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;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	bool f = true;
	while(1){
	int a,b;
	cin>>a>>b;
	if(a==0)break;
	if(f){
		f = false;
	}else{
		cout<<endl;
	}
	vector<int> ans;
	for(int i=a;i<=b;i++){
		if(i%400==0){
			ans.push_back(i);
		}else if(i%100==0){

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

	}
	return 0;
}

C++: #include <stdio.h>

void leap_year(int year);
int leap_year_judge(int year_a, int year_b);

int main(void)
{
	int year_a, year_b, exist;
	int i = 0;
	while (1) {
		scanf("%d %d", &year_a, &year_b);
		exist = leap_year_judge(year_a, year_b);
		if (year_a == 0 && year_b == 0) {
			break;
		} else if (exist == 1) {
			if (i !=0) {
			printf("\n");
			}
			for (int i = year_a; i <= year_b; i++) {
				leap_year(i);
			}
		} else {
			if (i !=0) {
			printf("\n");
			}
			printf("NA\n");
		}
		i++;
		
	}
	return 0;
}

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

int leap_year_judge(int year_a, int year_b)
{
	int judge = 0;
	for (int i = year_a; i <= year_b; i++) {
		if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
			judge = 1;
		}
	}
	return judge;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
	int a,b;
	bool s = true;
	while(1){
		cin >> a >> b;
		if(a*b==0) break;
		if(s) s = false;
		else cout << endl;
		bool n = true;
		for(int i=a;i<=b;i++){
			bool c = false;
			if(i%400==0) c = true;
			else if(i%100==0);
			else if(i%4==0) c = true;
			if(c) cout << i << endl;
			if(c) n = false;
		}
		if(n) cout << "NA" << endl;
	}
}

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;
	
	for(int i = a;;i++){
		if(i % 4 == 0){
		a = i; break;
		}
	}
	for(int i = a ;i<=b;){
		
		if(i % 100 == 0){
			if(i % 400 == 0){
			cout << i << endl; k++;
			}
		} else if(i % 4 == 0){
		cout << i << endl; k++;
		
		}
		i+=4;
		}
		if(k ==0) cout << "NA" << endl ;
		cout << endl;		
		}

C++: #include <stdio.h>

void print_na(int a, int b);
void leap_year(int a, int b);

int main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);
    if ( a != 0 || b != 0) {
        print_na(a, b);
        leap_year(a, b);
    }
    return 0;
}

void print_na(int a, int b)
{
    for (int i = a; i <= b; i++) {
        if ((i % 4 == 0 && !(i % 100 == 0)) || i % 400 == 0) {
            return;
        }
    }
    printf("NA\n");
}

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

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

#define INF (int)1e09

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;

template <typename T> using Vec = vector<T>; // c++11
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

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

int main(void) {
    while (1) {
        int a;
        int b;
        cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        }
        bool exist = false;
        for (int i = a; i <= b; i++) {
            if (check(i) == true) {
                cout << i << endl;
                exist = true;
            }
        }
        if (exist == false) {
            cout << "NA" << endl;
        }
        cout << endl;
    }
    return 0;
}

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

int main()
{
	int a,b,i,flag;
	cin>>a>>b;
	flag = 0;
	while(b!=0){
		for(i=a;i<=b;i++){
			if(i%400==0){
				cout<<i<<"\n";
				flag=1;
			}
			else if(i%4==0 && i%100!=0){
				cout<<i<<"\n";
				flag = 1;
			}
		}
	     if(flag !=1)
			 cout<<"NA\n";
		cout<<"\n";
		cin>>a>>b;
		flag = 0;
	}

	return 0;
}

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

int get_leap_years(int* leap_years_list, int year_begin, int year_end);

bool is_leap_year(int y);

int main(void)
{
    int leap_years_list[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');
        }        
        if (leap_years_count == 0) {
            puts("NA"); 
        } else {
            for (int i = 0; i < leap_years_count; i++) {
                printf("%d\n", leap_years_list[i]);
            }
        }
    }
}

int get_leap_years(int leap_years_list[1000], int year_begin, int year_end)
{
    int leap_year_count = 0;
    for (int year = year_begin; year <= year_end; ++year) {
        if (is_leap_year(year) == true) {
            leap_years_list[leap_year_count] = year;
            ++leap_year_count;
        }
    }
    return leap_year_count;
}

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

C++: #include<iostream>
int main(){for(int a,b,c;std::cin>>a>>b,a||b;){c=0;for(;a<=b;a++)if(!(a%400)||!(a%4)&&(a%100))c++,std::cout<<a<<'\n';if(!c)std::cout<<"NA\n";puts("\n");}}