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>

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

int main(void)
{ 
    while (true) {
        int x, y;
        bool exist = false;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        for (int i = x;i <= y; ++i) {
            bool flag = judge(i)
	    if (flag == true) {
                printf("%d\n", i);
                exist = true;
            } 
        }
        if (exist == 0) {
            printf("NA\n");
        }
        printf("\n");
    }   
    return 0;        
}

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

bool isLeapYear(int y);
int main(){
  int a,b;
  vector<int> A,B;
  while(1){
    cin>>a>>b;
    if(a<0||b<0||a>b||a>3000||b>3000)
      return 1;
    if(a==0&&b==0)
      break;
    A.push_back(a),B.push_back(b);

  }
  for( int i=0;i<A.size();i++ ){
    int leapnum=0;
    for( int j=A[i];j<=B[i];j++ ){
      if(isLeapYear(j)){
	leapnum++;
	cout<<j<<endl;
      }
    }
    if(!leapnum){
      cout<<"NA"<<endl;
    }
    if( i!=A.size()-1 )cout<<endl;
  }
  return 0;
}

bool isLeapYear(int y){
  if(!(y%4)&&(y%100))
    return true;
  if( !(y%400) )
    return true;
  return false;
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;

int a, b;

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

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int fiyear,finyear,co=0;
    while(cin>>fiyear>>finyear&&fiyear!=0&&finyear!=0){
        for(int i=fiyear;i<=finyear;i++){
            if(i%4==0){
                co=1;
                if(i%100!=0||i%400==0)cout<<i<<endl;
            }
        }
        if(co==0)cout<<"NA"<<endl;
        cout<<endl;
        co=0;
    }
}

C++: #include <iostream>

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

int main()
{
	int a, b;
	
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			int i = 0;
			for (int j = 0; a + j <= b; j++) {
				if (leapyear(a + j) == 0) {
					i++;
				} else {
					std::cout << a + j << std::endl;
				}
			}
			if ( i = a - b + 1) {
				std::cout << "NA" << std::endl;
			}
			
			std::cout << std::endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>

bool inputValCheck(int input_n1, input_n2);
void printLeapYear(int start_y, int end_y);
bool isLeapYear(int year);


int main()
{
    int start_year, end_year;
    std::cin >> start_year >> end_year;
    if (inputValCheck(start_year, end_year)) {
        printLeapYear(start_year, end_year);
    }
    return 0;
}

bool inputValCheck(int input_n1, int input_n2);
{
    if (input_n1 <= 0 || input_n1 > input_n2 || input_n2 >= 1000) {
        return false;
    }
    return true;
}


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

void printLeapYear(int start_y, int end_y)
{
    bool is_leap_year = false;
    for (int i = start_y; i <= end_y; i++) {
        if (isLeapYear(i) == true) {
            std::cout << i << std::endl;
        }
    }
}

C++: #include <stdio.h>
	
void uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	int first, end;
	while (1) {
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			printf("\n");
			uruu(first, end);
		}
	}
	printf("\n");
	return 0;
}

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

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

using namespace std;

void uru(int c, int d) {
	int counter = 0;

	for (int i = c; i <= d; i++) {
		if (i % 4 == 0) {
			if (i % 100 == 0) {
				if (i % 400 == 0) {
					cout << i << endl;
					counter++;
				} 
			} else {
				cout << i << endl;
				counter++;
			}
		}
	}
	if (counter == 0) {
		cout << "NA" << endl;
	}

	return;
}

int main() {
	int a,b;

	while (cin >> a >> b) {
		if (a == 0 && b == 0) {
			break;
		} else {
			uru(a,b);
		}
		cout << 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<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;
	while(cin>>a>>b,a|b){
		int co=0;
		loop(i,a,b){
			if(i%4!=0||(i%100==0&&i%400!=0));
			else{cout<<i<<endl;co++;}
		}
		if(!co)cout<<"NA"<<endl;
	}	
}