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)
{
    if ((start_year != 0) || (end_year != 0)) {
        if (end_year - start_year < 3) {
            if (((start_year % 4) < (end_year % 4)) || ((start_year % 100) > (end_year % 100))) { 
                if ((start_year % 400) < (end_year % 400)) {
                    printf("NA\n\n");
                } else {
                    printf("%d\n\n", start_year + 4 - start_year % 4);
                }
            }
        } else {
            for (int i = start_year; i <= end_year; ++i) {
                if (i % 400 != 0) {
                    if ((i % 100 != 0) && (i % 4 == 0)) {
                        printf("%d\n\n", i);
                    }
                } else {
                    printf("%d\n\n", i);
                }
            }
        }
    }
    scanf("%d %d", &start_year, &end_year);
}

int main(void)
{
    int start_year, end_year;
    scanf("%d %d", &start_year, &end_year);
    Leap_Year(start_year, end_year);
    return 0;
}

C++: #include <iostream>

int main()
{
    int a,b;
    while (true){
        std::cin >> a >> b;
        if (a == 0 && b == 0){
            break;
}       std::cout << (b / 4) - ((a - 1) / 4) - (b / 100) + ((a - 1) / 100) + (b / 400) - ((a - 1) / 400) << std::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<stdio.h>
int main(void)
{
	int a,b,i,c,cnt;
	cnt=0;
	scanf("%d %d",&a,&b);
	while(a!=0&&b!=0){
		c=0;
		for(i=a;i<=b;i++){
			if(i%4==0 && i%100!=0){
				printf("%d\n",i);
				c=1;
			}
			
			else if(i%400==0){
				printf("%d\n",i);
				c=1;
			}
		}
		if(c==0){
			printf("NA\n");
		}
		printf("\n");
		
		/*if(cnt!=0){
				printf("\n");
		}
		cnt++;*/
		scanf("%d %d",&a,&b);
	}
	return 0;
}

C++: #include <stdio.h>

void leap(int a,int b)
{
    int d = 0;
    while(a != 0 && b != 0){
        scanf("%d %d",&a,&b);
        for(int i = a;i <= b;i++){
            if(a == 0 && b == 0){
                ++d;
                break;
            }else if(i % 400 == 0){
                printf("%d\n",i);
                ++d;
            }else if(i % 4 == 0 && i % 100 != 0){
                printf("%d\n",i);
                ++d;
            }
        }
        if(d == 0){
            printf("NA\n");
        }
        printf("\n");
    }
    return;
    
}

int main(void)
{
    int a,b;
    leap(a,b); 
    return 0;
}

C++: #include <stdio.h>

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

int main(void)
{
	int year[2];
	int NA = -1;
	for(;;) {
		scanf("%d %d", &year[0], &year[1]);
		if(NA != -1) {
			printf("\n");
		}
		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>
using namespace std;

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

C++: #include <cstdio>

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

int main(void){
	int a, b, n_data;
	bool flag;//うるう年があるかどうか
	n_data=0;//いくつ目のデータセットか

	while (1) {
		scanf("%d%d", &a, &b);
		if (a == 0 && b == 0) {
			break;
		}

		if (n_data != 0) {//もし最初のデータセットでなければ
			printf("\n");
		}

		flag = false;
		for (int i=a; i <= b; i++) {
			if (judge(i)) {
				printf("%d\n", i);
				flag = true;
			}
		}
		if (!flag) {//もしうるう年がなければ
			printf("NA\n");
		}

		n_data++;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

    int a,b;

    while(1){

        int count = 0;

        cin >> a >> b;
        if(a == 0 && b == 0) break;

        for(int i = a; i <= b; i++){

            if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
                cout << i << endl;
                count++;
            }

        }

        if(count == 0){
            cout << "NA" << endl;
        }

        cout << endl;
    }

    return 0;
}

C++: #include<stdio.h>
/*与えられた期間の間のうるう年をすべて出力*/
void leap_year(int year1, int year2);

int main(void)
{
    while(1){
        int a, b; /*a は year1　, b は year2*/
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0){
            break;
        }else if (a == b){
            printf("NA\n");
            printf("\n");
        }else {
            leap_year(a, b);
        }
    }
    return 0;
}

void leap_year(int year1, int year2)
{   
    int limit = 0; /*もしも、うるう年がなかった時に使う*/
    for(int i = year1; i <= year2; ++i){
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
            printf("%d\n", i);
        }else{
            ++limit;
        }
    }
    if (limit == (year2 - year1 + 1)){/*うるう年がない場合*/
        printf("NA\n");
        printf("\n");
    }else{    /*うるう年がある場合*/
    printf("\n");
    }
}

C++: #include<cstdio>

using namespace std;

int a, b;

int main()
{
    int num = 0;
    while (1)
    {
        scanf("%d %d\n", &a, &b);
        if (a == 0 && b == 0) break;
        if( num )
        {
            printf("\n");
        }
        num++;
        bool Na = 1;
        for (int i = a; i <= b; i++)
        {
            bool out = 1;
            if( i % 4 == 0 )
            {
                if( i % 100 == 0 )
                {
                    if( i % 400 == 0 )
                    {
                        out = 1;
                    }
                    else
                    {
                        out = 0;
                    }
                }
                else
                {
                    out = 1;
                }
            }
            else
            {
                out = 0;
            }
            if( out )
            {
                Na = 0;
                printf( "%d\n", i );
            }
        }
        if (Na)
        {
            printf("NA\n");
        }
    }
    return 0;
}