Title: Leap Years

Create a program that outputs all leap years between the years AD a and b. The conditions for a leap year are as follows: 0 < a ≤ b < 3,000. If there are no leap years within the given period, output "NA".

Conditions for a leap year:
- The year is divisible by 4.
- However, years divisible by 100 are not leap years.
- Years divisible by 400 are leap years.

Input:
Multiple datasets are provided in the following format:
a b
When both a and b are 0, the input ends. The number of datasets does not exceed 50.

Output:
For each dataset, output the years or "NA". Insert one empty line between datasets.

Sample Input:
2001 2010
2005 2005
2001 2010
0 0

Output for the Sample Input:
2004
2008

NA

2004
2008

# Buggy version:
# -*- coding: utf-8 -*-
while True:
    a, b = map(int, input().split())

    if a == 0 and b == 0:
        break

    found = False
    for y in range(a, b + 1):
        if y % 4 == 0 and (y % 100 != 0 or y % 400 == 0):
            if y != a:
                print()
            found = True
            print(y)
    if not found:
        print('NA')

# Fixed version:
# -*- coding: utf-8 -*-
i = 0
while True:
    a, b = map(int, input().split())

    if a == 0 and b == 0:
        break
    elif i != 0:
        print()

    found = False
    for y in range(a, b + 1):
        if y % 4 == 0 and (y % 100 != 0 or y % 400 == 0):
            found = True
            print(y)
    if not found:
        print('NA')
        
    i += 1

# Buggy version:
num = 0
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break
    for i in range(a,b + 1):
        if i % 400 == 0:
            print(i)
            num += 1
        elif i % 100 == 0:
            continue
        elif i % 4 == 0:
            print(i)
            num += 1
    if num == 0:
        print("NA")
    print()

# Fixed version:
jun = 0
while True:
    num = 0
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break
    if jun > 0:
        print()
    for i in range(a,b + 1):
        if i % 400 == 0:
            print(i)
            num += 1
        elif i % 100 == 0:
            continue
        elif i % 4 == 0:
            print(i)
            num += 1
    if num == 0:
        print("NA")
    jun += 1

# Buggy version:
from calendar import isleap

while True:
    a, b = map(int, input().split())
    if a == 0:
        break
    ans = [i for i in range(a, b+1) if isleap(i)]
    print("\n".join(map(str, ans)) if len(ans) else "NA")

# Fixed version:
from calendar import isleap

flag = False
while True:
    a, b = map(int, input().split())
    if a == 0:
        break
    if flag:
        print()
    flag = True
    ans = [i for i in range(a, b+1) if isleap(i)]
    print("\n".join(map(str, ans)) if len(ans) else "NA")

# Buggy version:
b=0
for e in iter(input,'0 0'):
 if b:print();b=1
 s,t=map(int,e.split())
 u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0]
 if u:
  for y in u:print(y)
 else:print('NA')


# Fixed version:
b=0
for e in iter(input,'0 0'):
 if b:print()
 b=1
 s,t=map(int,e.split())
 u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0]
 if u:
  for y in u:print(y)
 else:print('NA')

# Buggy version:
b=0
for e in iter(input,'0 0'):
 if b:print()
 b=u=1
 s,t=map(int,e.split())
 for y in range(s,t+1):((y%4==0)*(y%100!=0)or y%400==0)and print(y);u=0
 if u:print('NA')


# Fixed version:
b=0
for e in iter(input,'0 0'):
 if b:print()
 b=u=1
 s,t=map(int,e.split())
 for y in range(s,t+1):
  if y%4==0 and y%100!=0 or y%400==0:print(y);u=0
 if u:print('NA')

# Buggy version:
p=print
b=0
for e in iter(input,'0 0'):
 if b:p()
 b=f=1;s,t=map(int,e.split())
 for y in range(s,t+1):
  if(y%4==0)*(y%100)or y%400==0:p(y);f=0
 if u:p('NA')


# Fixed version:
p=print
b=1
for e in iter(input,'0 0'):
 b or p()
 b=f=0;s,t=map(int,e.split())
 for y in range(s,t+1):
  if(y%4==0)*(y%100)or y%400==0:p(y);f=1
 f or p('NA')

# Buggy version:
while True:
    a, b = map(int, input().split())

    if a == 0 and b == 0:
        break
    
    found = False
    for y in range(a, b + 1):
        if y % 4 == 0 and (y % 100 != 0 or y % 400 == 0):
            found = True
            print(y)
    if not found:
        print('NA')

# Fixed version:
first = True
while True:
    a, b = map(int, input().split())
    if a == b == 0: break

    if not first: print()
    first = False

    count = 0
    for y in range(a, b + 1):
        if y % 400 == 0 or y % 4 == 0 and y % 100 != 0:
            count += 1
            print(y)
    if count == 0: print('NA')