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;
int main() {
	int a,b;
	while(cin >> a >> b){
		if((a & b) == 0) break;
		int cnt = 0;
		for(int i = a; i <= b; i++){
			if((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
				cout << i << endl;
				cnt++;
			}
		}
		if(cnt == 0) cout << "NA" << endl;
		cout << "" << endl;
	}
}

C++: #include <iostream>

bool judgeUruyear(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;
    }

}

int flag = 0;

void printUruyear(int year_begin, int year_end)
{

    // saisyo ni kuu-gyou ga aruto okorareru
    if (flag == 1){
        std::cout << std::endl;
    }
    flag = 1;

    int count_year = 0;

    // kono for loop no jyouken-siki ha "=" hituyou
    for (int i = year_begin; i <= year_end; i++) {
        
        if (judgeUruyear(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 (true) {

        std::cin >> year_begin >> year_end;

        if (year_begin == 0 && year_end == 0) {
            break;
        }

        printUruyear(year_begin, year_end);
    }
    
    return 0;
}

// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=1877346#1

C++: #include<iostream>
using namespace std;
int main(){
  int a,b;
  bool fi=true;
  while(cin >> a >> b,a||b){
    if(!fi)cout << endl;
    fi=false;
    bool f=false;
    for(int i=a;i<=b;i++){
      if(i%400==0) {
	cout << i << endl;
	f=true;
      }else if(i%100==0) {
      }else if(i%4==0){
	cout << i << endl;
	f=true;
      }
    }
    if(!f) cout << "NA" << endl;
  }
}

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

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

int main(){
  int a, b, n=0;
  while(true){
    bool flag=true;
    cin>>a>>b;
    if(a==0&&b==0)break;
    if(n!=0)cout<<endl;
    for(int i=a; i<=b; i++){
      if(judge(i)){cout<<i<<endl; flag=false;}
    }
    if(flag)cout<<"NA"<<endl;
    n++;
  }
  return 0;
}

C++: #include <iostream>
bool isLeapYear(int year)
{
    return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}

int main()
{
    int from, to;
    bool found;//???????????´????????£???????????????
    while (true) {
        std::cin >> from >> to;
        if (from == 0 && to == 0) {
            break;
        }
        found = false;
        for (int y = from; y <= to; y++) {
            if (isLeapYear(y)) {
                std::cout << y << std::endl;
                found = true;
            }
        }
        if (!found) {
            std::cout << "NA" << std::endl;
        }
        std::cout << std::endl;
    }
}

C++: #include <stdio.h>

void print_na(int a, int b);
void leap_year(int a, int b);

int main(void)
{
    printf("\n");
    int a, b;
    scanf("%d %d", &a, &b);
    while ( a != 0 || b != 0) {
        printf("\n");
        print_na(a, b);
        leap_year(a, b);
        printf("\n");
        scanf("%d %d", &a, &b);
    }
    printf("\n");
    return 0;
}

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

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

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;
	}
	return;
}

int main() {
	int a,b;
	int cou = 0;

	while (1) {
		scanf("%d%d", &a, &b);
		if (a == 0 && b == 0) {
			break;
		} else {
			if (cou != 0) {
				cout << endl;
			}
			uru(a,b);
			cou = 1;
		}
	}
	return 0;
}

C++: #include <stdio.h>

int main(void)
{
	int i,a,b;
	bool year [3001]={0},s=0;
	
	for(i=1; i<3000; i++){
		if(i % 4 == 0){
			year[i] = 1;
		}
	}
	
	for(i=100; i<3000; i+=100){
		year[i] = 0;
	}
	for(i=400; i<3000; i+=400){
		year[i] = 1;
	}
	while(1){
		bool flag=0;
		scanf("%d %d", &a, &b);
		if(a==0){
			break;
		}
		if(s==1)puts("");
		s=1;
		for(i=a;i<=b;i++){
			if(year[i] == 1){
				printf("%d\n",i);
				flag=1;
			}
		}
		if(flag==0)printf("NA\n");
	}
	
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

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

int main(void){

	int cnt = 0;
	while( true ) {
		
		int a, b;
		bool flg = false;
		cin >> a >> b;
		if( !( a|b ) ) break;
		if( cnt > 0 ) cout << endl;
		for( int i = a; i <= b; i++ ) {
			bool b = isLeapYear( i );
			flg |= b;
			if( b ) cout << i << endl;
		}
		if( !flg ) cout << "NA" << endl;
		cnt ++;
	}

    return 0;
}

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

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

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

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

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

    flag=0;

    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;

}