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 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);
        printf("\n");
        scanf("%d %d", &a, &b);
    }
    if (a == 0 && b == 0) {
        printf("\n");
    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 <bits/stdc++.h>
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 <stdio.h>
#include <iostream>
#include <algorithm>

int n;

using namespace std;


int main(){
    int a,b;
    bool first = true;
    while(cin>>a>>b){
        if(a==0&&b==0)break;
        else  if(first){
            first=false;
        }else{
            cout<<endl;
        }
        
        bool flag=true;
        
        for(int i=a; i<=b; i++){
            if(i%400==0){
                cout<<i<<endl;
                flag=false;
            }else if(i%100==0){
                
            }else if( i%4==0){
                cout<<i<<endl;
                flag=false;
            }
        }
        
        if(flag)cout<<"NA"<<endl;
       
    }
}

C++: #include<stdio.h>

void leap(int x, int y)
{
    int count = 0;

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

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

int main(void)
{
    int num1, num2;

    scanf("%d %d", &num1, &num2);

    while ((num1 != 0) || (num2 != 0)) {
        leap(num1, num2);

        scanf("%d %d", &num1, &num2);
    }

    return 0;
}

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

int main(){
	int a,b,count=0;
	while(1){
		cin>>a>>b;
		while(a<=b){
			if(a==0 && b==0){
			break;
			}
			if(a%4==0){
				if(a%100==0){
					if(a%400==0){
						cout<<a<<endl;
						count++;
					}
				}else{
					cout<<a<<endl;
					count++;
				}
			}
			a++;
		}
		if(count==0){
			if(a==0 && b==0){
				break;
			}else{
				cout<<"NA"<<endl;
			}
		}
		cout<<endl;
		count=0;
	}
	return 0;
}

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

int main(){
	int a,b;
	int line =0;
	int count=0;
	while(cin >> a >> b){
		if(a==0 && b==0) break;
		if(line !=0) cout << "\n"; line++; 
		for(int i=a; i < b; i++){
			if(i % 4==0 && i % 100 !=0 || i % 400 ==0){
				cout << i << "\n";
				count++;
			} 
		}
		if(count==0) cout << "NA\n";
		int count=0;
	}

	return 0;
}

C++: #include<stdio.h>
/*与えられた期間の間のうるう年をすべて出力*/
void leap_year(int year1, int year2);

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

void leap_year(int year1, int year2)
{   
    static int c = 0;/*二回目のデータ以降空行を開けるようにする*/
    ++c;
    if (c != 1){
        printf("\n");
    }
    int limit = 0; /*もしも、うるう年がなかった時に使う*/
    for (int i = year1; i <= year2; ++i){ /*i は年を表す*/     
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
            printf("%d\n", i);
        }else{
            ++limit;
        }
    }
    if (limit == (year2 - year1 + 1)){/*うるう年がない場合*/
        printf("NA\n");
    }
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define rep(i, n) for(int i=0;i<n;i++)
#define FOR(i, j, n) for(int i=j;i<n;i++)
using namespace std;

int main() {
    int first = 0;
    int start = 0, end = 0;
    while(1) {
        cin >> start >> end;
        if (first) {
            cout << endl;
        }
            first = 1;
        if (!start && !end) return 0;

        bool flag = false;
        for(int i = start; i <= end; i++) {
            if (i % 4  == 0 && (i % 100 != 0 || i % 400 == 0)) {
                flag = true;
                cout << i << endl;
            }
        }
        if (!flag) {
            cout << "NA" << endl;
        }
    }
}

C++: #include <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (first == end) {
			printf("NA\n");
			count =count + 1;
		}
		if (i % 400 != 0 && i % 100 == 0 && i - first <= 3 && end - i <= 3) {
			printf("NA\n");
			count = count + 1;		
		}
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
}

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

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