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<bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,us,ue,loop=0;
    while(cin>>a>>b&&a!=0&&b!=0){
        if(loop!=0) cout<<endl;
        for(int i=0;i<8;i++){
            if(((a+i)%4==0&&(a+i)%100!=0)||(a+i)%400==0){
                us=a+i;
                break;
            }
        }
        for(int j=0;j<8;j++){
            if(((b-j)%4==0&&(b-j)%100!=0)||(b-j)%400==0){
                ue=b-j;
                break;
            }
        }
        if(us>=ue) cout<<"NA"<<endl;
        else{
            for(int k=us;k<=ue;k+=4){
                if((k%4==0&&k%100!=0)||k%400==0){
                    cout<<k<<endl;
                } 
            }
        }
    loop++;    
    }
}

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

inline bool is_leapyear(unsigned int y){
    return (y & 3) == 0 && (y % 100 != 0 || (y / 100 & 3) == 0);
}

void solve(int a, int b){
    bool flag = false;
    for(int i = a; i <= b; i++){
        if(is_leapyear(i)){
            printf("%d\n", i);
            flag = true;
        }
    }
    if(!flag) puts("NA");
    puts("");
}

int main(){
    int a, b;
    while(cin >> a >> b){
        if(a == 0 && b == 0) break;
        solve(a, b);
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>

using namespace std;

class Solver{
public:
	static void solve() {
		int a, b;
		cin >> a >> b;
		vector<string> res;

		while (a != 0 && b != 0) {
			int cnt = 0;
			for (int i = a; i <= b; i++) {
				if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
					res.push_back(std::to_string(i));
					cnt++;
				}
			}
			if (cnt == 0)res.push_back("NA");
			cin >> a >> b;
			if (a != 0 && b != 0)res.push_back("");
		}

		for (int i = 0; i < res.size(); i++)cout << res[i] << endl;
	}
};

int main() {
	Solver::solve();
}

C++: #include <iostream>

int leap_year(int y) {
    if( y % 400 == 0) {
        return 1;/*Leap Year*/
    } else if (y % 100 == 0 && y % 400 != 0) {
        return 0;/*Not Leap Year*/
    } else if (y % 4 == 0 && y % 100 != 0) {
        return 1;
    } else {
        return 0;
    }
}
int main()
{
    int a, b;
    int n =0;/*output kaisuu - 1*/
    while (true) {
        std::cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        } else {
            if (n >0) {
                std::cout << std::endl;/*2 kaime ikou no output de kuugyou*/
            }
            int sum = 0;
            for (int k = a; k <= b; k++) {
                sum = sum + leap_year(k);
            }
            if (sum == 0 /*Subete Leap Year de nai*/) {
                std::cout << "NA" << std::endl;
            } else {
                for (int i =a; i <= b; i++) {
                    if (leap_year(i) == 1) {
                        std::cout << i << std::endl;
                    }
                }
            }
        }
    n++;
    }
    return 0;
}

C++: #include <iostream>

int LeapYear (int x);
int main()
{
    int a,b;
    std::cin >> a >> b;
    while (true) {
        int n = 0;
        if (a == 0 && b == 0) {
	        break;
        } else {
            for (int i = a; i <= b; i++) {
                if (LeapYear (i) == 1) {
                    std::cout << i <<std::endl;
                    n++; //kokode "n" ni kasan sareru to sita de NA ga denakunaru
            }				
        }
        if (n == 0) {
            std::cout << "NA" << std::endl;
        }
        std::cin >> a >> b;
        }
    }
    return 0;
}

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

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

int lpyrJudge(int x, int y);

int main(void)
{
    int sta, fin;
    while (true) {
        scanf("%d %d", &sta, &fin);
        if (sta == 0 && fin == 0) {
            break;
        } else {
            lpyrJudge(sta, fin);
            printf("\n");
        }
    }
    return 0;
}

int lpyrJudge(int x, int y)
{
    int minmod4x;   //x??\??????????°????4????????°
    if (x % 4 == 0){
        minmod4x = x;
    } else {
        minmod4x = x - x % 4 + 4;
    }
    if (y - minmod4x < 4) {
        printf("NA\n");
    } else {
        for (int i = minmod4x; i <= y; i = i + 4) {
            if (i % 100 == 0) {
                if(i % 400 == 0) {
                    printf("%d\n", i);
                } else {    //??????????????????????????????
                }
            } else {
              printf("%d\n", i);
            }
        }
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	int a,b;

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

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

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

		if(!c) 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;
	return;
}

int main() {
	int a,b;

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

C++: #include <iostream>
#include <cstdio>
int main(){
	int a, b;
	while(scanf("%d%d", &a, &b), a && b){
		int c = 0;
		for(;a++<=b;){
			if(a % 4 == 0){
				if(a % 100){
					if(a % 400 == 0)c++, printf("%d\n", a);
				}
				else c++, printf("%d\n", a);
			}
		}
		if(!c)puts("NA\n");
	}
}

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

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

C++: #include <stdio.h>

int main(){

	int a,b;
	int i;
	int answer;
	int count;

	while(1){
		count = 0;

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

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

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

	return 0;
}