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 <vector>
 
 
void judging(int x, int y)  //start,end
{
    int count = 0;  //count the number of non-leap-year
    for (int j = x; j <= y; j++) {
        if (j % 400 == 0) {
            std::cout << j << std::endl;
        } else if (j % 100 == 0) {
            count++;
        } else if (j % 4 == 0) {
            std::cout << j << std::endl;
        } else {
            count++;
        }
    }
    if (count == y - x + 1) {
        std::cout << "NA" << std::endl;
    }
    return;
}
 
 
int main()
{
    std::vector<std::pair<int, int>> year(100);  //start,end(size of vector is temporary)
    int size = 0;                                //current array subscript
    std::cin >> year[size].first >> year[size].second;
    while (year[size].first != 0 || year[size].second != 0) {
        size++;
        std::cin >> year[size].first >> year[size].second;
    }
    for (int i = 0; i < size - 1; i++) {
        judging(year[i].first, year[i].second);
        std::cout << std::endl;
    }
    judging(year[size - 1].first, year[size - 1].second);
    return 0;
}

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

bool isLeap(int y){
  return y % 4 == 0 && (y % 400 == 0 || y % 100 != 0);
}

int main(){
  int a, b;

  for(int SET = 1; cin >> a >> b, a || b; SET++){
    if(SET != 1){
      cout << endl;
    }

    bool ansFlg = false;

    for(int i = a; i <= b; i++){
      if(isLeap(i)){
        ansFlg = true;
        cout << i << endl;
      }
    }

    if(!ansFlg){
      cout << "NA" << endl;
    }
  }
}

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 <iostream>
#include <stdio.h>

using namespace std;

int main(void){

    int a,b;
    int f;

    scanf("%d %d",&a,&b);
    while (true) {



        f = 0;

        for (int i = 0; i < (b-a+1) ; i++) {
            if ((a+i)%4 == 0) {
                if ((a+i)%100 == 0) {
                    if ((a+i)%400 == 0) {
                        cout << a+i << endl;
                        f = 1;
                    }
                    //no
                }
                else {
                    cout << a+i << endl;
                    f = 1;
                }
            }
            else {
                //no
            }


        }

        if (f == 0) {
            cout << "NA" << endl;
        }
                                                                                 
        scanf("%d %d",&a,&b);
        if (a == 0 && b == 0) {
            return 0;
        }
        cout << endl;

    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a,b;
    int f = 0;
    int ans[2000] = {0};
    int cnt = 0;
    int j = 0;
    for(;;){
        cin >> a >> b;
        if(a == 0 && b == 0)break;
        for(int i = a; i <= b; i++){
            if(i%4 == 0 && i%100 != 0){cnt++;ans[j] = i;j++;}
            else if(i%400 == 0){cnt++;ans[j] = i;j++;}
        }
        if(cnt == 0)printf("NA\n");
        else {
            for(int i = 0;i < j; i++)printf("%d\n",ans[i]);
            j = 0;
            cnt = 0;
        }
        printf("\n");

    }
    return 0;
}

C++: #include <stdio.h>

int count_number(void);

int main(void)
{
    while (1) {
        int a;
        int b;
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0) {
            break;
        } else {
            int count = 0;
            for (int i=a; i++; i<=b) {
                if (((i % 4) == 0) && ((i % 100) != 0) && ((i % 400) == 0)) {
                    printf("%d\n", i);
                    count++;
                }
            }
            if (count == 0){
                printf("NA\n\n");
            } else {
                printf("\n");
            }
        }
    }
}

C++: #include <cstdio>

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

int testcase_ends(bool first) {
  int a, b;
  scanf("%d %d", &a, &b);
  if (a == 0 && b == 0) return 1;

  if (!first) puts("");

  bool na = true;
  for (int i = a; i <= b; ++i)
    if (is_uruu(i)) {
      printf("%d\n", i);
      na = false;
    }

  if (na) puts("NA");
  return 0;
}

int main() {
  bool first = true;
  while (!testcase_ends(first)) {
    first = false;
  }
}

C++: #include <stdio.h>
void leapmaker(int start, int end);
int main(void){
    int Year1 = -1, Year2 = -1;
    while(1)
    {
        if(!(Year1 == -1 && Year2 == -1))
        {
            printf("\n");
        }
        scanf("%d %d", &Year1, &Year2);
        if (Year1 == 0 && Year2 == 0)
        {
            break;
        }
        leapmaker(Year1, Year2);
    }
    return 0;
}
void leapmaker(int start, int end){
    int naflag = 1;
    for(int i = start - start % 4; i <= end; i += 4){
        if (i >= start) if (i % 100 == 0)
        {
            if (i % 400 == 0)
            {
                printf("%d\n", i);
                naflag = 0;
            }
        } else {
            naflag = 0;
            printf("%d\n", i);
        }
    }
    if (naflag == 1)
    {
        printf("NA\n");
    }
}

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>

void leap_year(int x, int y)
{
    while (x <= y) {
        if (((x % 4 == 0) && (x % 100 != 0)) || (x % 400 == 0)) {
            printf("%d\n", x);
        }
        x += 1;
    }    
}

int main(void)
{
    int x, y;
    scanf("%d %d", &x, &y);
    while(!(x == 0 && y == 0)) {
        leap_year(x, y);
        printf("\n");
        scanf("%d %d", &x, &y);
    }
    return 0;
}