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>

void uru(int year);

int main(void)
{
    int a, b;
    int year;
    int j;
    while (true) {
    scanf("%d %d", &a, &b);
    if (a == 0 && b == 0) {
        break;
    } else {
        for (year = a; year < b; ++year) {
            uru(year);
        }
    } else if (j == 0) {
        printf("NA\n");
    }
    return 0;
}

void uru(int year)
{
    int j = 0;
    int R4, R100, R400;
    R4 = year % 4;
    R100 = year % 100;
    R400 = year % 400;
    if (R4 == 0 && R100 != 0) {
        printf("%d\n", year);
        ++j;
    } else if (R400 == 0) {
        printf("%d\n", year);
        ++j;
    }
}

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

int judge(int n){
  if(n%4 == 0){
    //if(n%400 == 0) return 1;
   // else if(n%100 == 0) return 0;
    return 1; 
   }
  return 0;
}

int main(){
  int f,e;

  while(1){
    int cnt = 0;
    cin >> f >> e;
    if(f == 0 && e == 0) break;

    for(int i = f ; i <= e ; i++){
      if(judge(i)){
        cout << i << endl;
        cnt++;
      }
    }
    if(cnt == 0) cout << "NA" << endl;
    cout << endl;
  }

  return 0;
}

C++: #include <stdio.h>

int leap_year(int first_year, int last_year);

int main(void)
{
    int first_year, last_year;
    scanf("%d %d", &first_year, &last_year);
    if (first_year != 0 || last_year != 0) {
        leap_year(first_year, last_year);
    }
    return 0;
}

int leap_year(int first_year, int last_year)
{
    static 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");
    }
    printf("\n");
}

C++: #include<iostream>
using namespace std;
int main(){

  int a,b,cnt; 

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

C++: #include <cstdio>
using namespace std;
int main(){
    int a, b, sum, idx = 0;
    for (; ;) {
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0) break;
        if (idx) printf("\n");
        if (a % 4 != 0) {
            while (1) { a++; if (a % 4 == 0) break; }
        }
        sum = 0;
        for (int i = a; i <= b; i+=4) {
            if (i % 100 == 0 && i % 400 != 0) continue;
            printf("%d\n", i);
            sum++;
        }
        if (sum == 0) printf("NA\n");
        idx++;
    }

    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int i,a,b,w,x,flg;
	scanf("%d %d",&a,&b);
	while(!(a==0 && b==0)){
		flg=0;
		for(i=a;i<=b;i++){
			if(a%4==0){
				if(a%100!=0){
					printf("%d\n",a);
					flg=1;
				}
			}
			else if(a%400==0){
				printf("%d\n",a);
				flg=1;
			}
		}
		if(flg==0){
			printf("NA\n");
		}
		scanf("%d %d",&a,&b);
		printf("\n");
	}
	return 0;
}

C++: #include <iostream>

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

int main()
{
	int a, b;
	
	while (true) {
		std::cin >> a >> b;
		std::cout << std::endl;
		if (a == 0 && b == 0) {
			std::cout << std::endl;
			return 0;
		} else {
			int i = 0;
			for (int j = a; j <= b; j++) {
				if (leap_year(j) == 0) {
					i++;
				} else {
					std::cout << j << std::endl;
				}
			}
			if ( i == a - b + 1) {
				std::cout << "NA" << std::endl;
			}
		}
	}
}

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

bool isLeapYear(int y){
    return ( y%4 == 0 && ( y%100 != 0 || y%400 == 0 ) )? true : false ;
}

int main(){
	int a,b;
	bool flag, iniFlag = true;
	
	while( cin >> a >> b , a || b ){
		flag = true;
		if( iniFlag == false ){
			cout << endl;
			
		}else{
			iniFlag = false;
		}	

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

C++: #include <iostream>

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

int main()
{
	int a, b;
	
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			int i = 0;
			for (int j = 0; a + j <= b; j++) {
				if (leap_year(a + j) == 0) {
					i++;
				} else {
					std::cout << a + j << std::endl;
				}
			}
			if ( i == a - b + 1) {
				std::cout << "NA" << std::endl;
			}
			std::cout << std::endl;
		}
	}
	
	return 0;
}

C++: #include <stdio.h>
 int main(void)
 {
     int a, b;
     while (1) {
         int c = 0;
         scanf("%d %d", &a, &b);
          if (a == 0 && b == 0) {
             break;
         }
         for (int i = a; b >= i; ++i) {
             if (i % 4 == 0) {
                 if (i % 100 == 0) {
                     if (i % 400 == 0) {
                         printf("%d\n", i);
                         c = 1;
                     }
                 } else {
                     printf("%d\n", i);
                     c = 1;
                 } 
             }
         }
         if (c == 0) {
             printf("NA\n");
         }
     }
     return 0;
 }

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

C++: #include <stdio.h>

void leap_year(int year);
int leap_year_judge(int year_a, int year_b);

int main(void)
{
	int year_a, year_b, exist;
	while (1) {
		scanf("%d %d", &year_a, &year_b);
		exist = leap_year_judge(year_a, year_b);
		if (year_a == 0 && year_b == 0){
			break;
		} else if (exist == 1){
			for (int i = year_a; i <= year_b; i++) {
				leap_year(i);
			}
		} else {
			printf("NA\n");
		}
		printf("\n");
	}
	return 0;
}

void leap_year(int year)
{
	if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
		printf("%d\n", year);
	} 
}

int leap_year_judge(int year_a, int year_b)
{
	int judge = 0;
	for (int i = year_a; i <= year_b; i++) {
		if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
			judge = 1;
		} 
	}
	return judge;
}

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

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