ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 249 ms):
# ======= author: kuanhungchen.com | created: 05/02/23 08:33:06 CST ======= #
from sys            import stdin,  stderr, stdout, setrecursionlimit
from bisect         import bisect_left, bisect_right
from collections    import defaultdict, deque, Counter
from itertools      import accumulate, combinations, permutations, product
from functools      import lru_cache, cmp_to_key, reduce
from heapq          import heapify, heappush, heappop, heappushpop, heapreplace
# from pypyjit        import set_param
# set_param("max_unroll_recursion=-1")
# setrecursionlimit(300005)
orda  = 97
ordA  = 65
INF   = 1 << 60
MOD   = 1000000007
MOD2  = 998244353
input = lambda: stdin.readline().rstrip("\r\n")
linen = lambda cf_: "[L" + str(cf_.f_back.f_lineno) + "] "
dbg   = lambda *A, **M: stderr.write("\033[91m" + \
        M.get("sep", " ").join(map(str, A)) + M.get("end", "\n") + "\033[0m")
# ============================ START OF MY CODE ============================ #

def solve(_tc):
    s = input()
    n = len(s)
    dp = [set() for _ in range(n)]
    x = int(s[0])
    while x <= 9:
        dp[0].add(x % 9)
        if x == 0 or x == 1: break
        x *= x
    for i in range(1, n):
        x = int(s[i])
        xs = []
        while x <= 9:
            xs.append(x)
            if x == 0 or x == 1: break
            x *= x
        st = set()
        for d in dp[i - 1]:
            for x in xs:
                st.add((d + x) % 9)
        dp[i] = st
    if 0 in dp[-1]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    _tcs = int(input())
    for _tc in range(1, vars().get("_tcs", 1) + 1):
        dbg("=== Case {} ===".format(str(_tc).rjust(2)))
        solve(_tc)


Solution 2 (runtime: 202 ms):
import sys
import math
import collections
import statistics
import bisect

input = sys.stdin.readline

############ ---- Input Functions ---- ############
##---1) inp — For taking integer inputs.
def inp():
    return (int(input()))

##2) inlt — For taking List inputs.
def inlt():
    return (list(map(int, input().split())))

#3) insr — For taking string inputs. Actually it returns a List of Characters,
# instead of a string, which is easier to use in Python, because in Python,
# Strings are Immutable.
def insr():
    s = input()
    return (list(s[:len(s) - 1]))

#4) invr — For taking space seperated integer variable inputs.
def invr():
    return list(map(int, input().split()))

for iii in range(int(input())):
    a = insr()
    sum = 0
    num2 = 0
    num3 = 0
    for i in a:
        sum += int(i)
        if i == '2':
            num2 += 1
        elif i == '3':
            num3 += 1
    if sum % 9 == 0:
        print("yes")
        continue
    res = 0
    for x in range(min(num2+1, 10)):
        if res == 0:
            for y in range(min(num3+1, 10)):
                if (sum + 2*x + 6*y) % 9 == 0:
                    print("yes")
                    res = 1
                    break
        else:
            break
    if res == 0:
        print("no")
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 249 ms):
# ======= author: kuanhungchen.com | created: 05/02/23 08:33:06 CST ======= #
from sys            import stdin,  stderr, stdout, setrecursionlimit
from bisect         import bisect_left, bisect_right
from collections    import defaultdict, deque, Counter
from itertools      import accumulate, combinations, permutations, product
from functools      import lru_cache, cmp_to_key, reduce
from heapq          import heapify, heappush, heappop, heappushpop, heapreplace
# from pypyjit        import set_param
# set_param("max_unroll_recursion=-1")
# setrecursionlimit(300005)
orda  = 97
ordA  = 65
INF   = 1 << 60
MOD   = 1000000007
MOD2  = 998244353
input = lambda: stdin.readline().rstrip("\r\n")
linen = lambda cf_: "[L" + str(cf_.f_back.f_lineno) + "] "
dbg   = lambda *A, **M: stderr.write("\033[91m" + \
        M.get("sep", " ").join(map(str, A)) + M.get("end", "\n") + "\033[0m")
# ============================ START OF MY CODE ============================ #

def solve(_tc):
    s = input()
    n = len(s)
    dp = [set() for _ in range(n)]
    x = int(s[0])
    while x <= 9:
        dp[0].add(x % 9)
        if x == 0 or x == 1: break
        x *= x
    for i in range(1, n):
        x = int(s[i])
        xs = []
        while x <= 9:
            xs.append(x)
            if x == 0 or x == 1: break
            x *= x
        st = set()
        for d in dp[i - 1]:
            for x in xs:
                st.add((d + x) % 9)
        dp[i] = st
    if 0 in dp[-1]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    _tcs = int(input())
    for _tc in range(1, vars().get("_tcs", 1) + 1):
        dbg("=== Case {} ===".format(str(_tc).rjust(2)))
        solve(_tc)


Solution 2 (runtime: 249 ms):
t=int(input())
for z in range(t):
    n=[int(i) for i in list(input())]
    a=[0,0]
    num=sum(n)
    a[0]=n.count(2)
    a[1]=n.count(3)
    flag=False
    for i in range(min(10,a[0]+1)):
        if not flag:
            for j in range(min(10,a[1]+1)):
                if (num+2*i+6*j)%9==0:
                    print('YES')
                    flag=True
                    break
        else:
            break
    if not flag:
        print('NO')
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 249 ms):
# ======= author: kuanhungchen.com | created: 05/02/23 08:33:06 CST ======= #
from sys            import stdin,  stderr, stdout, setrecursionlimit
from bisect         import bisect_left, bisect_right
from collections    import defaultdict, deque, Counter
from itertools      import accumulate, combinations, permutations, product
from functools      import lru_cache, cmp_to_key, reduce
from heapq          import heapify, heappush, heappop, heappushpop, heapreplace
# from pypyjit        import set_param
# set_param("max_unroll_recursion=-1")
# setrecursionlimit(300005)
orda  = 97
ordA  = 65
INF   = 1 << 60
MOD   = 1000000007
MOD2  = 998244353
input = lambda: stdin.readline().rstrip("\r\n")
linen = lambda cf_: "[L" + str(cf_.f_back.f_lineno) + "] "
dbg   = lambda *A, **M: stderr.write("\033[91m" + \
        M.get("sep", " ").join(map(str, A)) + M.get("end", "\n") + "\033[0m")
# ============================ START OF MY CODE ============================ #

def solve(_tc):
    s = input()
    n = len(s)
    dp = [set() for _ in range(n)]
    x = int(s[0])
    while x <= 9:
        dp[0].add(x % 9)
        if x == 0 or x == 1: break
        x *= x
    for i in range(1, n):
        x = int(s[i])
        xs = []
        while x <= 9:
            xs.append(x)
            if x == 0 or x == 1: break
            x *= x
        st = set()
        for d in dp[i - 1]:
            for x in xs:
                st.add((d + x) % 9)
        dp[i] = st
    if 0 in dp[-1]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    _tcs = int(input())
    for _tc in range(1, vars().get("_tcs", 1) + 1):
        dbg("=== Case {} ===".format(str(_tc).rjust(2)))
        solve(_tc)


Solution 2 (runtime: 437 ms):
t = int(input())
for i in range(t):
    s = [int(x) for x in list(input())]
    sm = sum(s)
    sm %= 9
    cnt2 = s.count(2)
    cnt3 = s.count(3)
    flag = False
    for j in range(min(10, cnt2+1)):
        if flag:
            break
        for k in range(min(10, cnt3+1)):
            if (sm + j * 2 + k * 6) % 9 == 0:
                print('Yes')
                flag = True
                break
    if not flag:
        print('No')
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 249 ms):
# ======= author: kuanhungchen.com | created: 05/02/23 08:33:06 CST ======= #
from sys            import stdin,  stderr, stdout, setrecursionlimit
from bisect         import bisect_left, bisect_right
from collections    import defaultdict, deque, Counter
from itertools      import accumulate, combinations, permutations, product
from functools      import lru_cache, cmp_to_key, reduce
from heapq          import heapify, heappush, heappop, heappushpop, heapreplace
# from pypyjit        import set_param
# set_param("max_unroll_recursion=-1")
# setrecursionlimit(300005)
orda  = 97
ordA  = 65
INF   = 1 << 60
MOD   = 1000000007
MOD2  = 998244353
input = lambda: stdin.readline().rstrip("\r\n")
linen = lambda cf_: "[L" + str(cf_.f_back.f_lineno) + "] "
dbg   = lambda *A, **M: stderr.write("\033[91m" + \
        M.get("sep", " ").join(map(str, A)) + M.get("end", "\n") + "\033[0m")
# ============================ START OF MY CODE ============================ #

def solve(_tc):
    s = input()
    n = len(s)
    dp = [set() for _ in range(n)]
    x = int(s[0])
    while x <= 9:
        dp[0].add(x % 9)
        if x == 0 or x == 1: break
        x *= x
    for i in range(1, n):
        x = int(s[i])
        xs = []
        while x <= 9:
            xs.append(x)
            if x == 0 or x == 1: break
            x *= x
        st = set()
        for d in dp[i - 1]:
            for x in xs:
                st.add((d + x) % 9)
        dp[i] = st
    if 0 in dp[-1]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    _tcs = int(input())
    for _tc in range(1, vars().get("_tcs", 1) + 1):
        dbg("=== Case {} ===".format(str(_tc).rjust(2)))
        solve(_tc)


Solution 2 (runtime: 186 ms):
def sol() -> bool:
    s = str(input())

    numTwos = 0
    numThrees = 0
    sum = 0

    for c in s:
        x = int(c)
        # print(x)
        if x == 2:
            numTwos += 1
        if x == 3:
            numThrees += 1
        sum += x
    
    m = min(8, numTwos)
    n = min(3, numThrees)

    for j in range(m+1):
        for k in range(n+1):
            # print(sum + j * 2 + k * 6)
            if (sum + j * 2 + k * 6) % 9 == 0:
                return True
    
    return False

t = int(input())

for i in range(t):
    print("YES") if sol() else print("NO")
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 249 ms):
# ======= author: kuanhungchen.com | created: 05/02/23 08:33:06 CST ======= #
from sys            import stdin,  stderr, stdout, setrecursionlimit
from bisect         import bisect_left, bisect_right
from collections    import defaultdict, deque, Counter
from itertools      import accumulate, combinations, permutations, product
from functools      import lru_cache, cmp_to_key, reduce
from heapq          import heapify, heappush, heappop, heappushpop, heapreplace
# from pypyjit        import set_param
# set_param("max_unroll_recursion=-1")
# setrecursionlimit(300005)
orda  = 97
ordA  = 65
INF   = 1 << 60
MOD   = 1000000007
MOD2  = 998244353
input = lambda: stdin.readline().rstrip("\r\n")
linen = lambda cf_: "[L" + str(cf_.f_back.f_lineno) + "] "
dbg   = lambda *A, **M: stderr.write("\033[91m" + \
        M.get("sep", " ").join(map(str, A)) + M.get("end", "\n") + "\033[0m")
# ============================ START OF MY CODE ============================ #

def solve(_tc):
    s = input()
    n = len(s)
    dp = [set() for _ in range(n)]
    x = int(s[0])
    while x <= 9:
        dp[0].add(x % 9)
        if x == 0 or x == 1: break
        x *= x
    for i in range(1, n):
        x = int(s[i])
        xs = []
        while x <= 9:
            xs.append(x)
            if x == 0 or x == 1: break
            x *= x
        st = set()
        for d in dp[i - 1]:
            for x in xs:
                st.add((d + x) % 9)
        dp[i] = st
    if 0 in dp[-1]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    _tcs = int(input())
    for _tc in range(1, vars().get("_tcs", 1) + 1):
        dbg("=== Case {} ===".format(str(_tc).rjust(2)))
        solve(_tc)


Solution 2 (runtime: 156 ms):
import sys

input = sys.stdin.readline





for _ in range(int(input())):

    s = input()[:-1]

    a, b = 0, 0

    c = 0

    for i in s:

        if i == '2':

            a += 1

        elif i == '3':

            b += 1

        c += int(i)

    c %= 9

    ew = 0

    for i in range(min(10, b+1)):

        for j in range(min(10, a+1)):

            if (c + 6*i + 2*j) % 9 == 0:

                ew = 1

                break

        if ew:

            break

    print(['NO','YES'][ew])
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 249 ms):
# ======= author: kuanhungchen.com | created: 05/02/23 08:33:06 CST ======= #
from sys            import stdin,  stderr, stdout, setrecursionlimit
from bisect         import bisect_left, bisect_right
from collections    import defaultdict, deque, Counter
from itertools      import accumulate, combinations, permutations, product
from functools      import lru_cache, cmp_to_key, reduce
from heapq          import heapify, heappush, heappop, heappushpop, heapreplace
# from pypyjit        import set_param
# set_param("max_unroll_recursion=-1")
# setrecursionlimit(300005)
orda  = 97
ordA  = 65
INF   = 1 << 60
MOD   = 1000000007
MOD2  = 998244353
input = lambda: stdin.readline().rstrip("\r\n")
linen = lambda cf_: "[L" + str(cf_.f_back.f_lineno) + "] "
dbg   = lambda *A, **M: stderr.write("\033[91m" + \
        M.get("sep", " ").join(map(str, A)) + M.get("end", "\n") + "\033[0m")
# ============================ START OF MY CODE ============================ #

def solve(_tc):
    s = input()
    n = len(s)
    dp = [set() for _ in range(n)]
    x = int(s[0])
    while x <= 9:
        dp[0].add(x % 9)
        if x == 0 or x == 1: break
        x *= x
    for i in range(1, n):
        x = int(s[i])
        xs = []
        while x <= 9:
            xs.append(x)
            if x == 0 or x == 1: break
            x *= x
        st = set()
        for d in dp[i - 1]:
            for x in xs:
                st.add((d + x) % 9)
        dp[i] = st
    if 0 in dp[-1]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    _tcs = int(input())
    for _tc in range(1, vars().get("_tcs", 1) + 1):
        dbg("=== Case {} ===".format(str(_tc).rjust(2)))
        solve(_tc)


Solution 2 (runtime: 186 ms):
import sys, math

from functools import cmp_to_key

from operator import itemgetter

from bisect import bisect_left, bisect_right

from collections import Counter, defaultdict, deque



input = sys.stdin.readline



def iinp(): return (int(input()))

def linp(): return (list(map(int, input().split())))

def sinp(): return (input().strip())

def minp(): return (map(int, input().split()))

def debug(*args):

    print("DEBUG:", *args, file=sys.stderr)





def solve():

	# n = iinp()

	s = sinp()

	Sum = sum([int(num) for num in s])

	count_2 = s.count('2')

	count_3 = s.count('3')

	if Sum%9==0:

		print("YES")

		return

	target = (9 - Sum%9)%9 

	for i in range(count_3+1):

		new_target = (target - 6*i)%9

		if new_target<0:

			new_target +=9

		requied = (5*new_target)%9

		if requied<=count_2:

			print("YES")

			return

		

	print('NO')

		



def main():

	t = 1

	t = int(input())

	for i in range(t):

		solve()

	

if __name__ == "__main__":

	main()
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 249 ms):
# ======= author: kuanhungchen.com | created: 05/02/23 08:33:06 CST ======= #
from sys            import stdin,  stderr, stdout, setrecursionlimit
from bisect         import bisect_left, bisect_right
from collections    import defaultdict, deque, Counter
from itertools      import accumulate, combinations, permutations, product
from functools      import lru_cache, cmp_to_key, reduce
from heapq          import heapify, heappush, heappop, heappushpop, heapreplace
# from pypyjit        import set_param
# set_param("max_unroll_recursion=-1")
# setrecursionlimit(300005)
orda  = 97
ordA  = 65
INF   = 1 << 60
MOD   = 1000000007
MOD2  = 998244353
input = lambda: stdin.readline().rstrip("\r\n")
linen = lambda cf_: "[L" + str(cf_.f_back.f_lineno) + "] "
dbg   = lambda *A, **M: stderr.write("\033[91m" + \
        M.get("sep", " ").join(map(str, A)) + M.get("end", "\n") + "\033[0m")
# ============================ START OF MY CODE ============================ #

def solve(_tc):
    s = input()
    n = len(s)
    dp = [set() for _ in range(n)]
    x = int(s[0])
    while x <= 9:
        dp[0].add(x % 9)
        if x == 0 or x == 1: break
        x *= x
    for i in range(1, n):
        x = int(s[i])
        xs = []
        while x <= 9:
            xs.append(x)
            if x == 0 or x == 1: break
            x *= x
        st = set()
        for d in dp[i - 1]:
            for x in xs:
                st.add((d + x) % 9)
        dp[i] = st
    if 0 in dp[-1]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    _tcs = int(input())
    for _tc in range(1, vars().get("_tcs", 1) + 1):
        dbg("=== Case {} ===".format(str(_tc).rjust(2)))
        solve(_tc)


Solution 2 (runtime: 93 ms):
import sys



def is_interesting(n):

    S = 0

    count_2 = 0

    count_3 = 0



    # Compute sum of digits and count of 2s and 3s

    for digit in n:

        d = int(digit)

        S += d

        if d == 2:

            count_2 += 1

        elif d == 3:

            count_3 += 1



    # Compute R = (9 - S % 9) % 9

    R = (9 - (S % 9)) % 9

    for i in range(count_3+1):

        new_R = (R - 6*i)%9

        if new_R<0:

            new_R +=9

        mmi = (new_R*5)%9

        if mmi <= count_2:

            return 'YES'

    return 'NO'



# Fast input handling

input = sys.stdin.read

data = input().split()

t = int(data[0])

results = []



for i in range(1, t + 1):

    n = data[i]

    results.append(is_interesting(n))



# Output results efficiently

sys.stdout.write("\n".join(results) + "\n")
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 249 ms):
# ======= author: kuanhungchen.com | created: 05/02/23 08:33:06 CST ======= #
from sys            import stdin,  stderr, stdout, setrecursionlimit
from bisect         import bisect_left, bisect_right
from collections    import defaultdict, deque, Counter
from itertools      import accumulate, combinations, permutations, product
from functools      import lru_cache, cmp_to_key, reduce
from heapq          import heapify, heappush, heappop, heappushpop, heapreplace
# from pypyjit        import set_param
# set_param("max_unroll_recursion=-1")
# setrecursionlimit(300005)
orda  = 97
ordA  = 65
INF   = 1 << 60
MOD   = 1000000007
MOD2  = 998244353
input = lambda: stdin.readline().rstrip("\r\n")
linen = lambda cf_: "[L" + str(cf_.f_back.f_lineno) + "] "
dbg   = lambda *A, **M: stderr.write("\033[91m" + \
        M.get("sep", " ").join(map(str, A)) + M.get("end", "\n") + "\033[0m")
# ============================ START OF MY CODE ============================ #

def solve(_tc):
    s = input()
    n = len(s)
    dp = [set() for _ in range(n)]
    x = int(s[0])
    while x <= 9:
        dp[0].add(x % 9)
        if x == 0 or x == 1: break
        x *= x
    for i in range(1, n):
        x = int(s[i])
        xs = []
        while x <= 9:
            xs.append(x)
            if x == 0 or x == 1: break
            x *= x
        st = set()
        for d in dp[i - 1]:
            for x in xs:
                st.add((d + x) % 9)
        dp[i] = st
    if 0 in dp[-1]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    _tcs = int(input())
    for _tc in range(1, vars().get("_tcs", 1) + 1):
        dbg("=== Case {} ===".format(str(_tc).rjust(2)))
        solve(_tc)


Solution 2 (runtime: 203 ms):
t = int(input())

for _ in range(t):

    s = list(map(int, input().strip()))

    x = sum(s)

    twos = 0

    threes = 0

    for i in s:

        if i == 2:

            twos += 1

        elif i == 3:

            threes += 1

        if twos > 8 and threes > 8:

            break



    ans = 'NO'



    for i in range(twos + 1):

        for j in range(threes + 1):

            if (2 * i + 6 * j + x) % 9 == 0:

                ans = 'YES'

                break 

    

    print(ans)
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 108 ms):
def function(num: str):
    number_sum, two_count, three_count = 0, 0, 0
    for c in num:
        number_sum += ord(c) - ord('0')
        if c == '2':
            two_count += 1
        if c == '3':
            three_count += 1
    difference_needed = (9 - (number_sum % 9)) % 9
    yes = False
    for i in range(min(9, two_count + 1)): #where is the proof of this
        for j in range(min(9, three_count + 1)):
            if (2 * i + 6 * j) % 9 == difference_needed:
                yes = True
    if yes:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        num = input()
        function(num)


Solution 2 (runtime: 249 ms):
for t in range(int(input())):
    s = input()
    sm = 0
    for i in s:
        sm += int(i)

    mod = sm%9

    if mod==0:
        print('YES')
    
    else:
        count2 = 0
        count3 = 0
        for char in s:
            if char=='2':
                count2 += 1
            elif char=='3':
                count3 += 1

        if mod==1:
            if count2>=4 or (count2>=1 and count3>=1):
                print('YES')
            else:
                print('NO')

        elif mod==2:
            if (count2>=2 and count3>=2) or (count2>=5 and count3>=1) or (count2>=8):
                print('YES')
            else:
                print("NO")

        elif mod==3:
            if (count3>=1) or (count2>=3):
                print('YES')
            else:
                print("NO")

        elif mod==4:
            if (count2>=4 and count3>=1) or (count2>=1 and count3>=2) or (count2>=7):
                print('YES')
            else:
                print("NO")

        elif mod==5:
            if (count2>=2):
                print('YES')
            else:
                print("NO")

        elif mod==6:
            if (count2>=6) or (count2>=3 and count3>=1) or (count3>=2):
                print('YES')
            else:
                print("NO")

        elif mod==7:
            if (count2>=1):
                print('YES')
            else:
                print("NO")

        elif mod==8:
            if (count2>=5) or (count2>=2 and count3>=1):
                print('YES')
            else:
                print("NO")
Problem: 2050C - Uninteresting Number
Language: python

Solution 1 (runtime: 108 ms):
def function(num: str):
    number_sum, two_count, three_count = 0, 0, 0
    for c in num:
        number_sum += ord(c) - ord('0')
        if c == '2':
            two_count += 1
        if c == '3':
            three_count += 1
    difference_needed = (9 - (number_sum % 9)) % 9
    yes = False
    for i in range(min(9, two_count + 1)): #where is the proof of this
        for j in range(min(9, three_count + 1)):
            if (2 * i + 6 * j) % 9 == difference_needed:
                yes = True
    if yes:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        num = input()
        function(num)


Solution 2 (runtime: 343 ms):
import sys

input_data = sys.stdin.read().strip()

lines = input_data.splitlines()
lines.pop(0)

inp=[]
ans=[]
k=0
for line in lines:
   inp.append(int(line))
    
def get_digits(number):
    return [int(digit) for digit in str(abs(number))]

def count(dig):
    three = 0
    two = 0
    for d in dig:
        if d == 2:
            two += 1
        if d == 3:
            three += 1
    return two, three

for num in inp:
    nta = (num % 9)
    digits = get_digits(num)
    q2, q3 = count(digits)
    i, j = 0, 0
    f = 0
    while i <= q3:
        while j <= q2:
            if (nta + 6*i + 2*j) % 9 == 0:
                ans.append("YES")
                f = 1
                break
            j += 1
        if f == 1:
            break
        j = 0
        i += 1
    if f == 0:
        ans.append("NO")
            
for a in ans:
    print(a)