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(void){
    int a, b;
    for(int i=0; i < 55; i++){
      cin >> a >> b;
      if(a==0 && b==0){
          break;
      }
      if(i != 0){
          cout << endl;
      }
      if(a%4 == 0){
          if(a+4 <= b){
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                  if(a%400 != 0 && a%100 == 0){
                    a += 4;
                  }else{
                  cout << a << endl;
                  a+=4;
                  }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 1){
          if(a+3 <= b){
              a += 3;
              int c;
              c= b-a;
              for(int j=0; j <= c/4 ; j++){
                if(a%400 != 0 && a%100 == 0){
                    a+=4;
                }else{
                cout << a << endl;
                a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 2){
          if(a+2 <= b){
              a += 2;
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                if(a%400 != 0 && a%100 == 0){
                    a+=4;
                }else{
                cout << a << endl;
                a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 3){
          if(a+1 <= b){
              a += 1;
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                if(a%400 != 0 && a%100 == 0){
                    a+=4;
                }else{
                cout << a << endl;
                a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
    }
}

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

int main()
{
    int a,b;

    while(cin >> a >> b , a || b)
    {
        bool NAflag = true;

        for(int i=a; i<=b; i++){
            if(i%4 == 0 && (i%100 != 0 || i%400 == 0)){
                cout << i << endl;
                NAflag = false;
            }
        }
        if(NAflag){
            cout << "NA" << endl;
        }

        cout << endl;
    }

    return 0;
}

C++: #include <stdio.h>

int isLeap(int y){
	if (y%4) return 0;
	if (y%100) return 1;
	if (y%400) return 0;
	return 1;
}

int main(void){
	int y1, y2;
	
	while (scanf("%d%d",&y1, &y2),y1){
		int isNA = 1;
		for (int i=y1; i<=y2; i++){
			if (isLeap(i)){
				printf("%d\n", i);
				isNA=0;
			}
		}
		if (isNA) puts("NA");
		puts("");
	}
	printf("\b\b");
	return 0;
}

C++: #include <iostream>

using namespace std;

bool isLeap(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;
	bool f;
	while(true){
		f = false;
		cin >> a >> b ;
		if(a == 0 && b == 0) return 0;
		for (int i = a; i < b + 1; i++){
			if(isLeap(i)) {
				cout << i << endl;
				f = true;
			}
		}
		if(!f) cout << "NA" << endl;
		cout << endl;
	}
	return 0;
}

C++: #include <stdio.h>

void uruu(int a, int b);

int main(void)
{
    int a;
    int b;
    scanf("%d %d", &a, &b);
    while (a != 0 || b != 0) {
        uruu(a, b);

        scanf("%d %d", &a, &b);
    }
    return 0;
}


void uruu(int a, int b)
{
    int count = 0;
    for (int year = a; year <= b; ++year) {
        if (year % 4 == 0) {
            if (year % 100 != 0) {
                printf("%d\n", year);
                ++count;
            } else {
                if (year % 400 == 0) {
                    printf("%d\n", year);
                    ++count;
                }
            }
        }   
    }
    if (count == 0) {
        printf("NA\n");
    }
}

C++: #include <stdio.h>

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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int fiyear,finyear,co=0;
    while(cin>>fiyear>>finyear&&fiyear!=0&&finyear!=0){
        for(int i=0;(fiyear+i)<finyear;i++){
            if((fiyear+i)%4==0){
                co=1;
                if((fiyear+i)%100!=0||(fiyear+i)%400==0)cout<<fiyear+i<<endl;
            }
        }
        if(co==0)cout<<"NA"<<endl;
        cout<<endl;
    }
}

C++: #include <iostream>

using namespace std;

void solve()
{
	int a, b;
	bool firstFlag = true;
	while(cin >> a >> b)
	{
		if(a == 0 && b == 0)
		{
			break;
		}
		if(!firstFlag)
		{
			cout << endl;
		}
		bool existFlag = false;
		for(int i = a; i <= b; ++i)
		{
			if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0)
			{
				cout << i << endl;
				existFlag = true;
			}
		}
		if(!existFlag)
		{
			cout << "NA" << endl;
		}
		firstFlag = false;
	}
}

int main()
{
	solve();
	return(0);
}

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

int judge(int n){
  int flg = 0;
  if(n%4 == 0) flg = 1;
  
  if(flg == 1 && n%400==0) flg = 2;

  if(flg == 2){
    if(n%100 == 0) return 0;
    return 1;
  }
  else if(flg == 1) 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 Print(int a,int b)
{
	int n=0;

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

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

	if (n == 0) {
		printf("NA\n");
	}

	printf("\n");

	return 1;
}

int main(void)
{
	while (1) {
		int a, b;
		scanf("%d %d", &a, &b);

		if (Print(a, b) == 0) {
			break;
		}
	}

	return 0;
}