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 <iostream>
using namespace std;
int main(void){
    int a, b;
    for(int i=0; i < 55; i++){
      cin >> a >> b;
      if(a==0 && b==0){
          break;
      }
      if(a%4 == 0){
          if(a+4 <= b){
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                  if(a%400 != 0 && a%100 == 0){
                      continue;
                  }
                  cout << a << endl;
                  a+=4;
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 1){
          if(a+3 <= b){
              a += 3;
              int c;
              c= b-a;
              for(int j=0; j <= c/4 ; j++){
                if(a%400 != 0 && a%100 == 0){
                      continue;
                }
                cout << a << endl;
                a+=4;
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 2){
          if(a+2 <= b){
              a += 2;
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                if(a%400 != 0 && a%100 == 0){
                      continue;
                }
                cout << a << endl;
                a+=4;
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 3){
          if(a+1 <= b){
              a += 1;
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                if(a%400 != 0 && a%100 == 0){
                      continue;
                }
                cout << a << endl;
                a+=4;
              }
          }else{
              cout << "NA" << endl;
          }

      }
      cout << endl;
    }
}

C++: #include<stdio.h>
 
int main(){
	int a, b, i, count = 0;
	while(scanf("%d %d", &a, &b) != 0){
		if(a == 0 || b == 0) break;
		for(i = a; i <= b; i++){
			if(i % 400 == 0){
				printf("%d\n", i);
				count = 1;
			}else if(i % 100 == 0) continue;
			else if(i % 4 == 0){
				printf("%d\n", i);
				count = 1;
			}
		}
		if(count == 0) printf("NA\n");
	}
	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>

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,count=0;
    while (cin>>a>>b) {
        if (a==0&&b==0) {
            break;
        } else {
            int flag=0;
            count++;
            if (count!=1) {
                cout<<endl;
            }
            for (int i=a;i<=b;i++) {
                if ( (i%4==0)&&(i%100!=0) ) {
                    cout<<i<<endl;
                    flag=1;
                } else if ( (i%100==0)&&(i%400==0) ) {
                    cout<<i<<endl;
                    flag=1;
                }
            }
            if (flag==0) {
                cout<<"NA"<<endl;
            }
        }
    }
}

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;
	}
	cout << endl << endl;
	return;
}

int main() {
	int a,b;

	while (cin >> a >> b) {
		if (a == 0 && b == 0) {
			break;
		} else {
			uru(a,b);
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdbool.h>
 
bool is_leap_year(int y);
int  get_leap_years(int list[], int begin, int end);
 
int main(void)
{
    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]);
            }
        }
 
    }
}

int  get_leap_years(int list[], int begin, int end)
{
    int i;
    for (int year = begin; year <= end; year++) {
    if (is_leap_year(year)) {
    
i++;
    }
    }
    return 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;
    }
}

C++: 
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if( a == 0 && b == 0) break;
			LinkedList<Integer> ans = new LinkedList<Integer>();
			for(int i=a;i<=b;i++) {
				if(i%400 == 0) ans.add(i);
				else if(i%100 != 0 && i%4 == 0) ans.add(i);
			}
			if(ans.isEmpty()) System.out.println("NA");
			else {
				for(int i:ans) {
					System.out.println(i);
				}
			}
			System.out.println();
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

C++: #include <stdio.h>

int leapyear(int y){
    if((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)return 1;
        else return 0;
}

int main(void){
    int a,b,count;
    while(scanf("%d %d",&a,&b) != EOF && ( a != 0 || b != 0)){
        count=0;
        for(int y = a;y <= b;y++){
            if(leapyear(y) == 1){
                printf("%d\n",y);
                count++;
            }
        }
        if(count == 0)printf("NA\n");
        printf("\n");
    }
    return 0;
}