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>
 
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 main(){
	int a,b,count;
	bool f=false;
	while(true){
	    cin>>a>>b;
		count=0;
		if(a==0&&b==0)
			break;
		if(f==true)
		    cout<<endl;
		f=true;
		bool h=false;
		for(int i=a;i<=b;i++){
			bool t=false;
			if(i%4==0)
				t=true;
			if(i%100==0)
				t=false;
			if(i%400==0)
				t=true;
			if(t==true){
				cout<<i<<endl;
				h=true;
			}
		}
		if(h==false)
			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;
  
  while(1) {
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    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;
    cout << endl;
  }
}

C++: #include <stdio.h>

void uruu(int a, int b);

int main(void)
{
    int a;
    int b;
    scanf("%d %d", &a, &b);
    while (a != 0 || b != 0) {
        uruu(a, b);
        printf("\n");
        scanf("%d %d", &a, &b);
    }
    return 0;
}


void uruu(int a, int b)
{
    int count = 0;
    for (int year = a; year <= b; ++year) {
        if (year % 4 == 0) {
            if (year % 100 != 0) {
                printf("%d\n", year);
                ++count;
            } else {
                if (year % 400 == 0) {
                    printf("%d\n", year);
                    ++count;
                }
            }
        }   
    }
    if (count == 0) {
        printf("NA\n");
    }
}

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

int main(){
	int a,b;

	while(true){
		vector<int> leap;
		cin>>a>>b;
		if(a==0&&b==0) break;
		for(int i=a;i<=b;i++){
			if( i%400==0 || (i%4==0 && i%100!=0)) leap.push_back(i);
		}

		if(leap.size()==0){
			cout<<"NA"<<endl;
		}
		else{
			for(int i=0;i<leap.size();i++){
				cout<<leap[i]<<endl;
			}
		}

		cout<<endl;
	}
	return 0;
}

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

int main(void)
{
  bool flag = false;
  while (true)
  {
    vector<int> result;
    int a, b;
    cin >> a >> b;
    if (a==0 and b==0) break;
    if (flag) cout << endl;
    flag = true;
    for (int i = a; i <= b; ++i)
    {
      if ((i % 4 == 0 and i % 100 != 0) or i % 400 == 0)
      {
        result.push_back(i);
      }
    }
    if (result.empty())
    {
      cout << "NA" << endl;
    }
    else
    {
      for (int year : result)
      {
        cout << year << endl;
      }
    }
  }
  return 0;
}

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

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

int main(){
  int a, b;
  bool first = true;
  while(std::cin >> a >> b, a){
    if(first)std::cout << std::endl;
    first = false;
    bool flag = false;
    for (int i = a; i <= b; i++) {
      if(isUruu(i)){
        std::cout << i << std::endl;
        flag = true;
      }
    }
    if(flag == false)std::cout << "NA" << std::endl;
  }
  return 0;
}

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

int main()
{
	vector<int> a;
	for(int i=1;i<4000;i++)
	{
		if(i%100==0)continue;
		if(i%4==0)a.push_back(i);
	}
	int A,B;
	bool f=false;
	while(cin>>A>>B&&A&&B)
	{
		if(f)cout<<endl;
		f=true;
		bool flag=true;
		for(int i=0;i<a.size();i++)
		{
			if(A<=a[i]&&a[i]<=B)
			{
				flag=false;
				cout<<a[i]<<endl;
			}
			
		}
		if(flag)cout<<"NA"<<endl;
	}
	
}

C++: #include <stdio.h>

void leap_year(int start, int end)
{
    int y = 0;
    for (int x = start; x <= end; ++x) {
        if (x % 4 == 0 && (x % 100 != 0 || x % 400 == 0)) {
            printf("%d\n", x);
            ++y;
        }
    }
    if (y == 0) {
        printf("NA\n");
    }
}
        
int main(void)
{
    while (1) {
        int start, end;
        scanf("%d %d", &start, &end);
        if (start == 0 && end == 0) {
            break;
        } else {
            leap_year(start, end);
            printf("\n");
        }
    }
    return 0;
}

C++: #include <iostream>

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

}

int flag = 0;

void printUruyear(int year_begin, int year_end)
{

    if(flag == 1){
        std::cout << std::endl;
    }
    flag = 1;

    int count_year = 0;

    // kono for loop no jyouken-siki ha "=" hituyou
    for (int i = year_begin; i <= year_end; i++) {
        
        if (judgeUruyear(i)) {

            count_year += 1;
            std::cout << i << std::endl;
        }    
    }

    if (count_year == 0) { 
        std::cout << "NA" << std::endl;
    }
    
}

int main()
{
    int year_begin, year_end;

    while (true) {

        std::cin >> year_begin >> year_end;

        if (year_begin == 0 && year_end == 0) {
            break;
        }

        printUruyear(year_begin, year_end);
    }
    
    return 0;
}

C++: #include <iostream>

int leap_year(int year)
{
	if ( year % 4 == 0) {
		if ( year % 100 == 0) {
			if ( year % 400 == 0) {
				return 0;
			} 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 = a; j <= b; j++) {
				if (leap_year(j) == 0) {
					i++;
				} else {
					std::cout << j << std::endl;
				}
			}
			if ( i == a - b + 1) {
				std::cout << "NA" << std::endl;
			}
		}
		std::cout << std::endl;
	}
	
	return 0;
}

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