Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    n, q = map(int, input().split())
    s = list(map(int, input().split()))
    cnt = []
    rcnt = []
    for i in range(1, n + 1):
        x = len(set(s[:i]))
        cnt.append(x)
    for i in range(n - 1, -1, -1):
        x = len(set(s[i:]))
        rcnt.append(x)
    rcnt = rcnt[::-1]
    for _ in range(q):
        l, r = map(int, input().split())
        if r == l:
            print(1)
            continue
        l, r = l - 1, r - 1
        y = cnt[l - 1] if l >= 1 else 0
        z = rcnt[r] if r < n - 1 else 0
        print(min(r - l + 1, max(cnt[r] - y, rcnt[l - 1] - z)))

solve()


Fixed submission:
def solve():
    import sys
    input = sys.stdin.readline

    class BIT:
        def __init__(self, n):
            self.n = n
            self.data = [0] * n

        def sum(self, i):
            s = 0
            while i > 0:
                s += self.data[i - 1]
                i &= i - 1
            return s

        def update(self, i, x):
            while i < self.n:
                self.data[i] += x
                i |= i + 1

    n, q = map(int, input().split())
    c = list(map(int, input().split()))
    odr_r = [[] for _ in range(n + 1)]
    for i in range(q):
        l, r = map(int, input().split())
        odr_r[r].append((l - 1, i))

    b = BIT(n)
    diff = 0
    ans = [-1] * q
    last = [-1] * (n + 1)

    for i, v in enumerate(c):
        if last[v] != -1:
            b.update(last[v], -1)
        else:
            diff += 1

        b.update(i, 1)
        last[v] = i

        for l, j in odr_r[i + 1]:
            ans[j] = diff - b.sum(l)
    print("\n".join(map(str, ans)))
    return


solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    n, q = map(int, input().split())
    s = list(map(int, input().split()))
    for _ in range(q):
        l, r = map(int, input().split())
        l, r = l - 1, r - 1
        x = len(set(s[l:r + 1]))
        print(x)

solve()


Fixed submission:
def solve():
    import sys
    input = sys.stdin.readline

    class BIT:
        def __init__(self, n):
            self.n = n
            self.data = [0] * n

        def sum(self, i):
            s = 0
            while i > 0:
                s += self.data[i - 1]
                i &= i - 1
            return s

        def update(self, i, x):
            while i < self.n:
                self.data[i] += x
                i |= i + 1

    n, q = map(int, input().split())
    c = list(map(int, input().split()))
    odr_r = [[] for _ in range(n + 1)]
    for i in range(q):
        l, r = map(int, input().split())
        odr_r[r].append((l - 1, i))

    b = BIT(n)
    diff = 0
    ans = [-1] * q
    last = [-1] * (n + 1)

    for i, v in enumerate(c):
        if last[v] != -1:
            b.update(last[v], -1)
        else:
            diff += 1

        b.update(i, 1)
        last[v] = i

        for l, j in odr_r[i + 1]:
            ans[j] = diff - b.sum(l)
    print("\n".join(map(str, ans)))
    return


solve()
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    tmp = 1
    for i in range(k):
        tmp *= A[i]

    for j in range(k + 1, n + 1):
        x = tmp * 1
        tmp //= A[j - k - 1]
        tmp *= A[j - 1]
        if tmp > x:
            print("Yes")
        else:
            print("No")


solve()


Fixed submission:
def solve():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))

    for j in range(k + 1, n + 1):
        if A[j - k - 1] < A[j - 1]:
            print("Yes")
        else:
            print("No")


solve()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
A = np.array(list(map(int, input().split())))
q = int(input())

for i in range(q):
    a, b = map(int, input().split())
    A = np.where(A == a, b, A)
    print(A.sum())



Fixed submission:
n = int(input())
A = list(map(int, input().split()))
q = int(input())

S = sum(A)
dp = [0] * 100001
for a in A:
    dp[a] += 1


for i in range(q):
    a, b = map(int, input().split())
    dp[b] += dp[a]
    S = S + (b - a) * dp[a]
    print(S)
    dp[a] = 0
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = set(map(int, input().split()))
#print(A)

def fctr(m):
    pf = {}
    for i in range(2, int(m ** 0.5) + 1):
        while not m % i:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1:
        pf[m] = 1
    return pf.keys()

cnt = 0
for a in A:
    for k in fctr(a):
        flg = True
        b = A - set([a])
        if not b:
            flg = False
            break
        elif k in b:
            flg = False
            break
    if flg:
        cnt += 1
print(cnt)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
A.sort()
#print(A)
m = max(A)
dp = [0] * (m + 1)

for a in A:
    if dp[a] >= 1:
        dp[a] += 1
    for i in range(2 * a, m + 1, a):
        dp[i] += 2
    dp[a] += 1
print(dp.count(1))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))


def calc_imos(arr):
    imos = [0] * (N + 1)
    for i, a in enumerate(arr):
        l = max(0, i - a)
        r = min(N - 1, i + a)
        imos[l] += 1
        imos[r + 1] -= 1
    imos = list(accumulate(imos))
    return imos[:-1]


for k in range(min(50, K)):
    A = calc_imos(A)
print(*A, sep=' ')

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(min(k, 50)):
    b = [0] * (n + 1)
    for j in range(n):
        l = max(0, j - a[j])
        r = min(n - 1, j + a[j])
        b[l] += 1
        b[r + 1] -= 1
    for m in range(n):
        b[m + 1] += b[m]
    a = b[:-1]
print(*a)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(min(k, 50)):
    b = [0] * (n + 1)
    for j in range(n):
        l = max(0, j - a[j])
        r = min(n - 1, j + a[j])
        b[l] += 1
        b[r + 1] -= 1
    a = np.cumsum(b)[:-1]
print(*a)


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(min(k, 50)):
    b = [0] * (n + 1)
    for j in range(n):
        l = max(0, j - a[j])
        r = min(n - 1, j + a[j])
        b[l] += 1
        b[r + 1] -= 1
    for m in range(n):
        b[m + 1] += b[m]
    a = b[:-1]
print(*a)
Buggy python submission (verdict: Time Limit Exceeded):
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    s = input()
    p1 = []
    p0 = []
    for i, ss in enumerate(s):
        p1.append(a[i]) if ss == "1" else p0.append(a[i])
    p11 = set()
    p00 = set()
    
    def make_set(data, ans):
        res = 0
        for i in range(1 << len(data)):
            for j in range(len(data)):
                if (i >> j) & 1 == 1:
                    res ^= data[j]
                ans.add(res)

    make_set(p1, p11)
    make_set(p0, p00)
    print(0 if p00 == p11 else 1)


Fixed submission:
# ref https://black-thunder.hatenablog.com/entry/20200610/1591774050

def solve():
    base = []
    for a, s in zip(A[::-1], map(int, S[::-1])):
        x = a
        for b in base:
            x = min(x, x ^ b)
        if x:
            if s ^ 1:
                base.append(x)
            else:
                return 1
    return 0


t = int(input())
for _ in range(t):
    n = int(input())
    A = list(map(int, input().split()))
    S = input()
    print(solve())
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = list(map(int, input().split()))
res = 1
for i in lis:
    res *= i
print(res if res <= 10**18 else -1)


Fixed submission:
n = int(input())
lis = list(map(int, input().split()))

if 0 in lis:
    print(0)
    exit()

res = 1
for i in lis:
    if res > 10**18:
        print(-1)
        exit()
    else:
        res *= i
print(res if res <= 10**18 else -1)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
n = int(input())
lis = list(map(int,input().split()))
num = reduce(lambda x,y: x * y, lis)
print(num if num <= 10**18 else -1)


Fixed submission:
n = int(input())
lis = list(map(int, input().split()))

if 0 in lis:
    print(0)
    exit()

res = 1
for i in lis:
    if res > 10**18:
        print(-1)
        exit()
    else:
        res *= i
print(res if res <= 10**18 else -1)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
par = [i for i in range(n)]
rank = [1] * n
root = [[] for i in range(m)]
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])  # 経路圧縮
        return par[x]

def same(x, y):
    return find(x) == find(y)

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    if rank[x] < rank[y]:
        rank[y] += rank[x]
        par[x] = y
    else:
        rank[x] += rank[y]
        par[y] = x


for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    unite(a, b)
    root[a].append(b)
    root[b].append(a)

flg = True
for i in range(1, n - 1):
    if not same(0,i):
        flg = False

if not flg:
    print("No")
    exit()
else:
    print("Yes")
    for i in range(1, n):
        print(min(root[i])+1)
        

Fixed submission:
from collections import deque


def main():
    n, m = map(int, input().split())
    g = [[] for _ in range(n)]

    for _ in range(m):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        g[a].append(b)
        g[b].append(a)

    q = deque([0])
    chk = [False] * n
    res = [0] * n

    while q:
        x = q.popleft()
        for y in g[x]:
            if chk[y]:
                continue
            chk[y] = True
            res[y] = x
            q.append(y)
    print("Yes")
    for i in res[1:]:
        print(i + 1)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
lis = list(map(lambda z: int(z) - 1, map(int, input().split())))

s = [0]
res = [0]

while lis[res[-1]] not in s:
    res.append(lis[res[-1]])
    s.append(res[-1])

x, y = res.index(lis[res[-1]]), len(res)

if m < y:
    print(res[m] + 1)
else:
    mm = (m - x) % (y - x)
    print(res[mm + x] + 1)


Fixed submission:
n, m = map(int, input().split())
lis = list(map(lambda z: int(z) - 1, map(int, input().split())))

s = {0}
res = [0]

while lis[res[-1]] not in s:
    res.append(lis[res[-1]])
    s.add(res[-1])

x, y = res.index(lis[res[-1]]), len(res)

if m < y:
    print(res[m] + 1)
else:
    mm = (m - x) % (y - x)
    print(res[mm + x] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

n, m, k = map(int,input().split())
modi = 998244353


def ncr(a, b):
    if b == 0:
        return 1
    else:
        num = reduce(lambda x, y: x * y % modi, range(a, a-b, -1))
        den = reduce(lambda x, y: x * y % modi, range(1, b+1))
        return num * pow(den, modi - 2, modi) % modi


res = 0
for i in range(k + 1):
    res += m % modi * pow(m - 1, n - i - 1, modi) * ncr(n - 1, i)
    res %= modi
print(res)


Fixed submission:
lim = 200001
n, m, k = map(int, input().split())
modi = 998244353

fa = [1] * (lim + 1)
fa_inv = [1] * (lim + 1)

for i in range(lim):
    fa[i+1] = fa[i] * (i+1) % modi

fa_inv[-1] = pow(fa[-1], modi - 2, modi)
for i in range(lim - 1, 0, -1):
    fa_inv[i] = fa_inv[i+1] * (i+1) % modi


def ncr(a, b):
    if a < b:
        return 0
    else:
        return fa[a] * fa_inv[b] % modi * fa_inv[a - b] % modi


prt = [1] * (n + 1)
for i in range(n):
    prt[i+1] = prt[i] * (m - 1) % modi

res = 0
for i in range(k + 1):
    res += m * prt[n - i - 1] * ncr(n - 1, i) % modi
    res %= modi
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    lis = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        for j in range(max(i,lis[i]), n):
            if lis[i] + lis[j] == j - i:
                ans += 1
    print(ans)
if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter

n = int(input())
lis = list(map(int, input().split()))

L = []
R = []
for i, j in enumerate(lis):
    L.append(i+j)
for i, j in enumerate(lis):
    R.append(i-j)
    
ref = dict(Counter(R))
ans = 0
for i in L:
    ans += ref.get(i, 0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    lis = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        for j in range(i, n):
            if lis[i] + lis[j] == j - i:
                ans += 1
    print(ans)
if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter

n = int(input())
lis = list(map(int, input().split()))

L = []
R = []
for i, j in enumerate(lis):
    L.append(i+j)
for i, j in enumerate(lis):
    R.append(i-j)
    
ref = dict(Counter(R))
ans = 0
for i in L:
    ans += ref.get(i, 0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
l = len(n)

if l < 4:
    print(0)
    exit()

mody = 2019
cnt = 0
for i in range(l-3):
    x = int(n[i:i+4])
    x %= mody
    if x == 0:
        cnt += 1
    for j in range(i + 4, l):
        x = 10 * x + int(n[j])
        x %= mody
        if x == 0:
            cnt += 1
print(cnt)

Fixed submission:
from collections import Counter
S = list(map(int, input()))
P = 2019

def solve(S,P):
    S = S[::-1]
    T = [0] * len(S)
    T[0] = S[0] % P
    power = 1
    for i in range(1, len(S)):
        power *= 10
        power %= P
        T[i] = T[i-1] + power * S[i]
        T[i] %= P
    counter = Counter(T)
    return sum(x * (x - 1) // 2 for x in counter.values()) + counter[0]
print(solve(S,P))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def main():
    n = input()
    l = len(n)
    mody = 2019
    cnt = 0
    for i in range(l - 3):
        x = int(n[i:i + 4])
        x %= mody
        if x == 0:
            cnt += 1
        for j in range(i + 4, l):
            x = 10 * x + int(n[j])
            x %= mody
            if x == 0:
                cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
S = list(map(int, input()))
P = 2019

def solve(S,P):
    S = S[::-1]
    T = [0] * len(S)
    T[0] = S[0] % P
    power = 1
    for i in range(1, len(S)):
        power *= 10
        power %= P
        T[i] = T[i-1] + power * S[i]
        T[i] %= P
    counter = Counter(T)
    return sum(x * (x - 1) // 2 for x in counter.values()) + counter[0]
print(solve(S,P))

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
l = len(n)
cnt = 0
for i in range(l-3):
    for j in range(i+4, l+1):
        x = int(n[i:j])
        if x % 2019 == 0:
            cnt += 1
print(cnt)

Fixed submission:
from collections import Counter
S = list(map(int, input()))
P = 2019

def solve(S,P):
    S = S[::-1]
    T = [0] * len(S)
    T[0] = S[0] % P
    power = 1
    for i in range(1, len(S)):
        power *= 10
        power %= P
        T[i] = T[i-1] + power * S[i]
        T[i] %= P
    counter = Counter(T)
    return sum(x * (x - 1) // 2 for x in counter.values()) + counter[0]
print(solve(S,P))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = list(map(int, input().split()))
for i in range(n):
    print(lis.count(i+1))


Fixed submission:
n = int(input())
lis = list(map(int, input().split()))
dic = {}
for i in lis:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] =1
for i in range(1, n + 1):
    print(dic.get(i, 0))
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10 ** 9 + 7
def main():
    n, k = map(int,input().split())
    lis = [i for i in range(n + 1)]
    res = 0
    for i in range(k, n + 2):
        res += (sum(lis[-i:]) - sum(lis[:i]) + 1)
        res %= mod
    print(res)
if __name__ == '__main__':
    main()


Fixed submission:
mod = 10 ** 9 + 7
def main():
    n, k = map(int,input().split())
    res = 0
    for i in range(k, n + 2):
        mis = i *(i-1)//2
        mas = n*(n+1)//2 - (n-i)*(n-i+1)//2
        res += mas - mis +1
        res %= mod
    print(res)
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a, b, c = int(input().split())
print(c, a, b, sep=" ")

Fixed submission:
a, b, c = map(int, input().split())
print(c, a, b)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

lunlun = []

def main():
    n = int(input())
    for i in range(3234566667):
        flag = True
        if len(str(i)) == 1:
            lunlun.append(i)
        else:
            for a in range(1, len(str(i))):
                if len(lunlun) > n:
                    print(lunlun[n])
                    exit()
                elif abs(int(str(i)[a - 1]) - int(str(i)[a])) >= 2:
                    flag = False
                    break
            if flag:
                lunlun.append(i)

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline
import itertools

lunlun = [[] for i in range(11)]

def main():
    n = int(input())
    for i in range(100):
        flag = True
        l = len(str(i))
        if l == 1:
            lunlun[l - 1].append(i)
        else:
            for a in range(1, len(str(i))):
                if abs(int(str(i)[a - 1]) - int(str(i)[a])) >= 2:
                    flag = False
                    break
            if flag:
                lunlun[l - 1].append(i)
            else:
                continue
    for j in range(1, 9):
        for a in lunlun[j]:
            for b in range(10):
                if abs(int(str(a)[-1]) - b) < 2:
                    lunlun[j+1].append(int(str(a)+str(b)))
    lunlun2 = list(itertools.chain.from_iterable(lunlun))
    print(lunlun2[n])

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import numpy
def main():
    a, b, c = map(int, input().split())
    k = numpy.sqrt(a/c)
    l = numpy.sqrt(b/c)
    if 1 > k + l:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    a, b, c = map(int, input().split())
    if c - a - b <= 0:
        print("No")
    elif 4 * a * b < (c - a - b) ** 2:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 7)
readline = sys.stdin.readline


def main():
    n,m = map(int, readline().split())
    val = str(readline().strip())
    ans = 0
    for i in range(n):
        for j in range(i,n):
            if int(val[i:j+1]) % m == 0:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()
    

Fixed submission:
from collections import Counter

N, P = map(int, input().split())
S = list(map(int, input()))

def solve_2(S):
    ind = (i for i, x in enumerate(S, 1) if x % 2 == 0)
    return sum(ind)

def solve_5(S):
    ind = (i for i, x in enumerate(S, 1) if x % 5 == 0)
    return sum(ind)

def solve(S,P):
    if P == 2:
        return solve_2(S)
    if P == 5:
        return solve_5(S)
    S = S[::-1]
    T = [0] * len(S)
    T[0] = S[0] % P
    power = 1
    for i in range(1, len(S)):
        power *= 10
        power %= P
        T[i] = T[i-1] + power * S[i]
        T[i] %= P
    counter = Counter(T)
    return sum(x * (x - 1) // 2 for x in counter.values()) + counter[0]


print(solve(S,P))
Buggy python submission (verdict: Runtime Error):
def main():
    n,m = map(int, input().split())
    ans = [0] * n
    chg = [0] * n
    flg = 0
    for i in range(m):
        j,k = map(int, input().split())
        if chg[j-1] == 1 and ans[j-1] != k:
            flg = -1
        elif ans[j-1] == 0:
            ans[j-1] = k
            chg[j-1] = 1
    if flg == -1:
        print(flg)
    elif ans[0] == 0:
        print(-1)
    else:
        print(ans[0],ans[1],ans[2],sep="")

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n,m = map(int, input().split())
    ans = [0] * n
    chg = [0] * n
    flg = 0
    for i in range(m):
        j,k = map(int, input().split())
        if chg[j-1] == 1 and ans[j-1] != k:
            flg = -1
        elif ans[j-1] == 0:
            ans[j-1] = k
            chg[j-1] = 1
    if flg == -1:
        print(flg)
    elif len(ans) >= 2 and ans[0] == 0:
        if chg[0] == 0:
            ans[0] = 1
            if n == 3:
                print(ans[0], ans[1], ans[2], sep="")
            elif n == 2:
                print(ans[0], ans[1], sep="")
        else:
            print(-1)
    else:
        if n == 3:
            print(ans[0],ans[1],ans[2],sep="")
        elif n == 2:
            print(ans[0],ans[1],sep="")
        else:
            print(ans[0])


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n,m = map(int, input().split())
    ans = [0] * n
    flg = 0
    for i in range(m):
        j,k = map(int, input().split())
        if ans[j-1] == 0:
            ans[j-1] = k
        elif ans[j-1] != 0 and ans[j-1] != k:
            flg = -1
    if flg == -1:
        print(flg)
    elif ans[0] == 0:
        print(-1)
    else:
        print(ans[0],ans[1],ans[2],sep="")

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n,m = map(int, input().split())
    ans = [0] * n
    chg = [0] * n
    flg = 0
    for i in range(m):
        j,k = map(int, input().split())
        if chg[j-1] == 1 and ans[j-1] != k:
            flg = -1
        elif ans[j-1] == 0:
            ans[j-1] = k
            chg[j-1] = 1
    if flg == -1:
        print(flg)
    elif len(ans) >= 2 and ans[0] == 0:
        if chg[0] == 0:
            ans[0] = 1
            if n == 3:
                print(ans[0], ans[1], ans[2], sep="")
            elif n == 2:
                print(ans[0], ans[1], sep="")
        else:
            print(-1)
    else:
        if n == 3:
            print(ans[0],ans[1],ans[2],sep="")
        elif n == 2:
            print(ans[0],ans[1],sep="")
        else:
            print(ans[0])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))

for i in lis:
    if i % 2 == 0:
        if i%3 == 0 or i%5 == 0:
            A = 0
        else:
            A = 1
            print("DENIED")
            break
if A == 0:
    print("APPROVED")


Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
ans = [0]

for i in lis:
    if i % 2 == 0:
        if i%3 != 0 and i%5 != 0:
            ans[0]=1
            break
if ans[0] == 0:
    print("APPROVED")
else:
    print("DENIED")