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 main(void)
{
    int a, b, y, counter;
    while(1){
        counter = 0;
        scanf("%d %d", &a, &b);
        if (a == 0&& b == 0){
            break;
        }
        if (b >= 3000 || a < 0){
            printf("NA");
        }else{
            for (y = a; y < b; y++){
                if (!(y%400)){
                    printf("%d\n", y);
                    counter++;
                }else if((!(y%4)) && y%100){
                    printf("%d\n", y);
                    counter++;
                }
            }
            if (counter == 0){
                printf("NA");
            }
        }
    }
    return 0;
}

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

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

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

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

    scanf("%d %d",&a,&b);

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

    flag=0;

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

    }

    if(flag==0) printf("NA\n");

    printf("\n");
  }

  return 0;

}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>

int main() {
    int a,b;
    while (true) {
        scanf("%d%d", &a, &b);
        if (a == 0&&b == 0) {
            break;
        }
        bool isN = true;
        for (int i=a;i<=b;++i){
            if ((i%4==0)&&((i%100!=0)||(i%400==0))){
                printf("%d\n", i);
                isN = false;
            }
        }
        if (isN) {
            printf("NA\n");
        }
        printf("\n");
    }
    return 0;
}

C++: #include <iostream>


bool judge(int year);

int main() 
{
	int start, end;
	
	while (true) {
		int check = 0;
		std::cin >> start >> end;
		
		if (start == 0 && end == 0) {
			break;
		}
		
		for (int i = start; i <= end; i++) {
			if (judge(i)) {
				std::cout << i << std::endl;
				check = 1;
			}
		}
		
		if (check == 0) {
			std::cout << "NA" << std::endl;
		}
		
		std::cout << std::endl;
	}
	return 0;
}


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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

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

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

bool is_leap_year(int y);

int get_leap_years();

int main()
{
    int leap_years_list[1000]; //A.D. 0 - A.D. 3000 の間に閏年は高々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'); //putcharは一文字だけ出力する関数です
        }

        //閏年を出力
        if (leap_years_count == 0) {
            puts("NA"); //putsは与えられた文字列を出力した後改行する関数です
        } else {
            for (int i = 0; i < leap_years_count; i++) {
                printf("%d\n", leap_years_list[i]);
            }
        }
        
    }
}

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

int get_leap_years(int *leap_years_list, int year_begin, int year_end)
{
    int count = 0;//閏年の個数を数える
    for (int year = year_begin; year <= year_end; year++) {//閏年を配列に代入していく
        if (is_leap_year(year)) {
            leap_years_list[count] = year;
            count++;
        }
    }
    return count;
}

C++: #include<iostream>

using namespace std;


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

    cout << endl;
  } 

}

C++: #include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>
#include <iomanip>

using namespace std;

int main (void)
{
	for (int u = 0; u < 50; u++)
	{
		long n = 0,m = 0;
		cin >> n >> m;
		if (n == 0 && m == 0)
		{
			break;
		}
		long p = 0;

		for (long i = n; i < m + 1; i++)
		{
			if (i % 4 == 0 && i % 100 != 0)
			{
				p += 1;
				cout << i << endl;
			}
			else if (i % 400 == 0 && i % 100 != 0)
			{
				p += 1;
				cout << i << endl;
			}
			else if (i == m && p == 0)
			{
				cout << "NA" << endl;
			}
		}
		cout << endl;
	}
}

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

			}else if(i%4==0){
				cout<<i<<endl;
				x=1;
			}
		}
		if(x==0)cout<<"NA"<<endl;
		x=0;
		num=1;
	}
	return 0;
}

C++: #include <stdio.h>

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

main() {
  int cnt;
  int i,a,b;
  while(scanf("%d %d",&a,&b),a!=0&&b!=0) {
    cnt=0;
    for(i=a;i<=b;i++) {
      if(isLeap(i)) {printf("%d\n",i);cnt++;}
    }
    if(cnt==0) puts("NA");
    puts("");
  }
}

C++: #include <stdio.h>
int main(void)
{
    int start, finish;
    int exist;
    while(1){
        exist = 0;
        scanf("%d %d", &start, &finish);
        if (start == 0 && finish == 0) {
            break;
        }
        for(; start <= finish; start++) {
            if((start % 4 == 0 && start % 100 != 0) || start % 400 == 0) {
            printf("%d\n", start);
            exist = 1;
            }
        }
        if (exist == 0) {
            printf("NA");
        }
    }
    printf("\n");
    return 0;
}