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;

bool is_uruu (int y) {
    if (y % 4 == 0 and (y % 100 != 0 or y % 400 == 0)) return true;
    return false;
}

int main ()
{
    int a, b;
    bool f = false;
    while (cin >> a >> b, (a or b)) {
        if (f) cout << endl;
        f = true;
        bool flag = true;
        while (a <= b) {
            if (is_uruu(a)) {
                cout << a << endl;
                flag = false;
            }
            a++;
        }

        if (flag) cout << "NA" <<endl;
    }

    return 0;
}

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

C++: #include <stdio.h>

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

int main(void)
{
    int year, from, until, num_leap_year;
    while (1) {
        num_leap_year = 0;
        scanf("%d %d", &from, &until);
        if (from == 0 && until == 0) {
            break;
        }
        for (year = from; year <= until; year++) {
            if (isLeapYear(year) == true) {
                num_leap_year++;
                printf("%d\n", year);
            }
        }
        if (num_leap_year == 0) {
            printf("NA\n");
        }
        printf("\n");
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){

  int a,b,c=0;

  while(true){
    
    cin>>a>>b;
    if(a==0&&b==0) break;
    if(c!=0)cout<<endl;


    vector<int> leaps;
    if(a==b){
      if(a%400==0){
        cout<<a<<endl;
        leaps.emplace_back(a);
      } else if(a%100==0) continue;
      else if(a%4==0){
        cout<<a<<endl;
        leaps.emplace_back(a);
      }
    }
    a = 4 - a%4 + a;

    for(int i=a;i<=b;i+=4){
      if(i%400==0){
        cout<<i<<endl;
        leaps.emplace_back(i);
      }else if(i%100==0){
        continue;
      }else{
        cout<<i<<endl;
        leaps.emplace_back(i);
      }
    }

    if(leaps.size()==0) cout<<"NA"<<endl;
    ++c;

  }

  return EXIT_SUCCESS;
}

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

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

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

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

int main(){
	int a, b, count;

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

		count = 0;
		for (int i = a; i <= b; ++i){
			if (isLeapYear(i)){
				++count;
				cout << i << endl;
			}
		}
		if (count == 0)
			cout << "NA" << endl;

		cout << endl;
	}



	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b,count;
	bool f=false;
	while(true){
		if(f==true)
			cout<<endl;
		f=true;
	    cin>>a>>b;
		count=0;
		if(a==0&&b==0)
			break;
		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 <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");
}

int main(){
    int a, b;
    bool flag = false;
    while(cin >> a >> b){
        if(a == 0 && b == 0) break;
        if(flag) puts("");
        solve(a, b);
        flag = true;
    }
    return 0;
}

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

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

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

using namespace std;

int main(void)
{
  int a, b;
  vector <int> hoge, leap;

  while (1) {
    cin  >> a >> b;
    if (a == 0 && b == 0)
      break;
    hoge.push_back(a);
    hoge.push_back(b);
  }
  for (int i = 0; i < hoge.size(); i += 2) {
    for (int j = hoge[i]; j <= hoge[i+1]; j++)
      if (j % 400 == 0 || (j % 100 && j % 4 == 0))
        leap.push_back(j);
    if (!leap.empty()) {
      for (int j = 0; j < leap.size(); j++)
        cout << leap[j] << '\n';
      leap.erase(leap.begin(), leap.end());
    } else {
      cout << "NA" << '\n';
    }
    cout << '\n';
  }
  return 0;
}

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

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

int main(void)
{ 
    while (true) {
        int x, y;
        bool exist = false;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        int number = 0;
        for (int i = x;i <= y; ++i) {
            if (number != 0) {
                   printf("\n");
            }
            bool flag = judge(i);
	    if (flag == true) {
                printf("%d\n", i);
                exist = true;
            }
        }
        if (exist == false) {
            printf("NA\n");
        }  
        number++;     
    }
    return 0;        
}