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>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<vector>
#include<cstdio>
#include<climits>
#include<cfloat>
#include<cstring>
#define foreach(t,p,tit) for(t::iterator tit=p.begin();tit!=p.end();++tit)
#define rforeach(t,p) for(t::reverse_iterator it=p.rbegin();it!=p.rend();++it)
#define all(p) p.begin(),p.end()
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
char uru[3100]={};

#define MAX 3000
int main()
{
    memset(uru,0,sizeof(uru));
    rep(i,MAX+1)if(i%4==0)uru[i]=1;
    rep(i,MAX+1)if(i%100==0)uru[i]=0;
    rep(i,MAX+1)if(i%400==0)uru[i]=1;

    int a,b,f=0,na=1;
    while(cin>>a>>b)
    {
        na = 1;
        if(a==0&&b==0)break;
        if(f){cout<<endl;f=0;}
        for(int i=a;i<=b;i++)if(uru[i]){cout << i << endl; na = 0;}
        
        if(na)cout << "NA"<<endl;

        f=1;
    }
    //cout<<endl;
    
    return 0;
}

C++: #include <stdio.h>


void uru(int year);

int j;

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

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

C++: #include <stdio.h>

int leap_year(int, int);

int main(void)
{
	int a, b;
	while (1) {
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0) 
			break;
		leap_year(a, b);
	}
	return 0;
}

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

C++: #include <stdio.h>
int main(){

  int a,b,c,i;

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

  while(1){

  c=0;
  if(a == 0) break;

  for(i = a; i <= b; i++){

    if(i%4 == 0){

      if(i%100 != 0){

        printf("%d\n",i);
        c++;

      }

      else if(i%400 == 0){

        printf("%d\n",i);
        c++;

      }

    }

  }

  if(c == 0) printf("NA\n");

  scanf("%d %d",&a,&b);
  if(a == 0) break;

  printf("\n");

  }

  return 0;

}

C++: #include <stdio.h>

int j = 0;

void uru(int year);

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

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

C++: #include <iostream>

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

C++: #include<stdio.h>
int main(){
	int s,l,i,j=0,k=0,m=0,flag=0,ans[3000]={0};
	
	while(scanf("%d %d",&s,&l)!=EOF){
		if(s==0 && l==0)break;
		printf("\n");
		for(i=s;i<=l;i++){
			if(i%4==0){
				if(i%100!=0 || i%400==0){
				printf("%d\n",i);
				flag=1;
				}
			}
		}
	
		if(flag==0)printf("NA\n");
		flag=0;
	}
return 0;
}

C++: #include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    if((start_year != 0) || (end_year != 0)) {
        for(int i = start_year; i <= end_year; ++i) {
            if(i % 400 != 0) {
                if((i % 100 != 0) && (i % 4 == 0)) {
                    printf("%d\n", i);
                } else {
                    printf("NA");
            } else {
                printf("%d\n", i);
            }
        }
    }
}

int main(void)
{
    int start_year, end_year;
    scanf("%d %d", &start_year, &end_year);
    Leap_Year(start_year, end_year);
    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;
        int number = 0;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        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 == 0) {
            printf("NA\n");
        }  
        number++;     
    }
    return 0;        
}

C++: #include <iostream>



bool judge(int year);

int main() 
{
	int start, end;
	
	while (true) {
		int check = 0;
		std::cin >> start >> end;
		
		std::cout << std::endl;
		
		if (start == 0 && end == 0) {
			break;
		}
		
		for (int i = start; i <= end; i++) {
			if (judge(i)) {
				std::cout << i << std::endl;
				check = 1;
			}
		}
		
		if (check == 0) {
			std::cout << "NA" << std::endl;
		}
		
		std::cout << std::endl;
	}
	return 0;
}


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