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>

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

void print_uruyear(int year_begin, int year_end)
{
    int count_year;
    for(int i = year_begin; i < year_end; i++) {
        if (judge_uruyear(i)) {
            std::cout << i << std::endl;
        }
        if(count_year == 0) {
            std::cout << "NA" << std::endl;
        }
    }
}

int main()
{
    int year_begin, year_end;
    std::cin >> year_begin >> year_end;

    while(year_begin != 0 || year_end != 0) {
        
        print_uruyear(year_begin, year_end);

    }
    
    return 0;
}

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

C++: #include <stdio.h>
	
int uruu(int first, int end)
{
	for (int i = first; i < end + 1; i++) {
		if (i % 400 != 0 && i % 100 == 0 && i - first <= 3 && end - i <= 3) {
			printf("NA\n");		
		}
		if ((end - first) % 4 == 1 && end - first <= 2) {
			printf("NA\n");
		}
		if ((end - first) % 4 == 2 && end - first <= 1) {
			printf("NA\n");
		}
		if (i % 400 == 0) {
			printf("%d\n", i);
		} else if (i % 100 == 0) {
			i = i + 3;
		}else if (i % 4 == 0) {
			printf("%d\n", i);
		}
	}
}
	
int main(void)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
}

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

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag,ini=0;

  while(1) {

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

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

    flag=0;

    if(ini==1) puts("");
    else ini=1;

    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<iostream>
using namespace std;
int main(){
	int a,b;
	int num = 0;
	while(1){
	
	cin >> a >> b; 
	if(num !=0) cout << endl;
	if(a ==0 && b == 0) return 0;
	int k = 0;
	
	for(int i = a ;i<=b;i++){
		if(i % 100 == 0){
			if(i % 400 == 0){
			cout << i << endl; k++;
			}
		} else if(i % 4 == 0){
		cout << i << endl; k++;
			}
		}
		
		if(k ==0) cout << "NA" << endl ;
		num++;		
		
		}
	
	}

C++: #include <stdio.h>

int leap_year(int first_year, int last_year);

int main(void)
{
    int first_year, last_year;
    static int dataset_number = 0; 
    scanf("%d %d", &first_year, &last_year);
    while (1) {
        if (first_year == 0 && last_year == 0) {
            break;
        } else {
            if (dataset_number != 0) {
                printf("\n");
            }
            leap_year(first_year, last_year);
            scanf("%d %d", &first_year, &last_year);
        ++dataset_number;
        }
    }
    return 0;
}

int leap_year(int first_year, int last_year)
{
    int count = 0;
    for (int year = first_year; year <= last_year; ++year) {
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
           printf("%d\n", year);
        } else {
            ++count;
        }
    }
    if (count == last_year - first_year + 1) {
        printf("NA\n");
    }
    return 0;
}

C++: 
#include<bits/stdc++.h>

using namespace std;

int main(){
  bool hoge = false;
  while(1)
    {
  int a,b;
  cin>>a>>b;
    if(a==0)break;
    if(!hoge)puts("");
    hoge = true;
  vector<int> ans;

  for(int i=min(a,b);i<=max(a,b);i++){
    if(i%400 == 0 || (i%100!=0 && i%4==0)){
      ans.push_back(i);
    }
  }


  if(ans.size()!=0)
    {
      for(auto i:ans){
	cout<<i<<endl;
      }
    }
  else{
    puts("NA");
  }
    }
}

C++: //13
#include<iostream>

using namespace std;

int main(){
  bool suc=false;
  for(int a,b;cin>>a>>b,a|b;){
    if(suc){
      cout<<endl;
    }
    suc=true;
    bool out=false;
    for(;a<=b;a++){
      if(a%400==0 || (a%4==0&&a%100)){
	cout<<a<<endl;
	out=true;
      }
    }
    if(!out){
      cout<<"NA"<<endl;
    }
  }
  return 0;
}

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

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


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

int main(){
    int a,b;
    bool f = false;
    while( cin>>a>>b ){
        if(a==0&&b==0)break;
        if(f)cout<<endl;
        else f=true;
        
        int c=0;
        for(int i=a;i<=b;i++){
            if( isLeap(i) ){
                c++;
                cout<<i<<endl;
            }
        }
        if(c==0)cout<<"NA"<<endl;
    }
}

C++: #include <iostream>

bool judge_uruyear(int year)
{

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

}

void print_uruyear(int year_begin, int year_end)
{

    int count_year = 0;

    for(int i = year_begin; i < year_end; i++) {
        if (judge_uruyear(i)) {
            count_year += 1;
            std::cout << i << std::endl;
        }    
    }

    if(count_year == 0) {
        std::cout << "NA" << std::endl;
    }

}

int main()
{

    int year_begin, year_end;

    while(year_begin != 0 || year_end != 0) {
        
        std::cin >> year_begin >> year_end;
        print_uruyear(year_begin, year_end);

    }
    
    return 0;
}