Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def main():
    N = int(input())
    A = list(map(int, input().split()))

    res = {}
    for a in A:
        for divisor in divisors(a):
            if divisor not in res:
                res[divisor] = 1
            else:
                res[divisor] += 1

    print(max([key for key, value in res.items() if value == N or value == N - 1]))


if __name__ == '__main__':
    main()

Fixed submission:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def main():
    N = int(input())
    A = list(map(int, input().split()))

    L = [0]
    R = [0]
    for i in range(N):
        L.append(gcd(L[i], A[i]))
        R.append(gcd(R[i], A[N-i-1]))

    R.reverse()
    M = [gcd(L[i], R[i+1]) for i in range(N)]
    print(max(M))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S = input()
nums = []
now = 1
cnt = 0
for i in range(N):
    if S[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0:
    nums.append(cnt)
if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * K + 1
ans = 0
for i in range(0, len(nums), 2):
    tmp = 0

    left = i
    right = min(i + add, len(nums))
    for j in range(left, right):
        tmp += nums[j]
    ans = max(tmp, ans)
print(ans)

Fixed submission:
N, K = map(int, input().split())
S = input()
nums = []
now = 1
cnt = 0
for i in range(N):
    if S[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0:
    nums.append(cnt)
if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * K + 1
ans = 0
left = 0
right = 0
tmp = 0
for i in range(0, len(nums), 2):

    next_left = i
    next_right = min(i + add, len(nums))

    while next_left > left:
        tmp -= nums[left]
        left += 1

    while next_right > right:
        tmp += nums[right]
        right += 1

    ans = max(ans, tmp)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S = input()
nums = []
now = 1
cnt = 0
for i in range(N):
    if S[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0:
    nums.append(cnt)
if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * K + 1
ans = 0
for i in range(0, len(nums), 2):
    tmp = 0

    left = i
    right = min(i + add, len(nums))
    for j in range(left, right):
        tmp += nums[j]
    ans = max(tmp, ans)
print(ans)

Fixed submission:
N, K = map(int, input().split())
S = input()
nums = []
now = 1
cnt = 0
for i in range(N):
    if S[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0:
    nums.append(cnt)
if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * K + 1
ans = 0
left = 0
right = 0
tmp = 0
for i in range(0, len(nums), 2):

    next_left = i
    next_right = min(i + add, len(nums))

    while next_left > left:
        tmp -= nums[left]
        left += 1

    while next_right > right:
        tmp += nums[right]
        right += 1

    ans = max(ans, tmp)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
E = []
for a in A:
    for b in B:
        E.append(a + b)
E.sort(reverse=True)
E = E[:K]
ans = []
for e in E:
    for c in C:
        ans.append(e + c)
ans.sort(reverse=True)
ans = ans[:K]
for x in ans:
    print(x)

Fixed submission:
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
E = []
for a in A:
    for b in B:
        E.append(a + b)
E.sort(reverse=True)
E = E[:K]
ans = []
for e in E:
    for c in C:
        ans.append(e + c)
ans.sort(reverse=True)
ans = ans[:K]
for x in ans:
    print(x)
Buggy python submission (verdict: Runtime Error):
def main():
    S = input()

    acgt = []
    flag = False
    count = 0
    for s in S:
        if s == "A" or s == "C" or s == "G" or s == "T":
            if flag:
                count += 1
            else:
                flag = True
                count = 1
        else:
            acgt.append(count)
            flag = False
            count = 0

    print(max(acgt))


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    S = input()

    acgt = []
    flag = False
    count = 0
    for s in S:
        if s == "A" or s == "C" or s == "G" or s == "T":
            if flag:
                count += 1
            else:
                flag = True
                count = 1
        else:
            acgt.append(count)
            flag = False
            count = 0

    if count > 0:
        acgt.append(count)
        
    print(max(acgt))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, Q = list(map(int, input().split()))
    S = input()
    L, R = [], []
    for i in range(Q):
        l, r = list(map(int, input().split()))
        L.append(l)
        R.append(r)

    for l, r in zip(L, R):
        print(S[l-1:r].count("AC"))


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N, Q = map(int, input().split())
    S = input()

    t = [0] * (N + 1)
    for i in range(N):
        t[i + 1] = t[i] + (1 if S[i:i + 2] == "AC" else 0)
    for i in range(Q):
        l, r = map(int, input().split())
        print(t[r - 1] - t[l - 1])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
A, B = tuple(map(int, input().split()))
res = A
for i in range(A+1, B+1):
    res = res ^ i
print(res)

Fixed submission:
def xor(n):
    ans = None
    if (n + 1) % 2 == 0:
        if ((n + 1) // 2) % 2 == 0:
            ans = 0
        else:
            ans = 1
    else:
        if ((n +  1) // 2) % 2 == 0:
            ans = 0 ^ n
        else:
            ans = 1 ^ n
    return ans

A, B = tuple(map(int, input().split()))
print(xor(A-1) ^ xor(B))
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

if N == 1:
    print(A[0])
else:
    res = math.gcd(A[0], A[1])
    for i in range(2, N):
        res = math.gcd(res, A[i])
    print(res)

Fixed submission:
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

N = int(input())
A = list(map(int, input().split()))

if N == 1:
    print(A[0])
else:
    res = gcd(A[0], A[1])
    for i in range(2, N):
        res = gcd(res, A[i])
    print(res)
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
wt, vt = [], []
for _ in range(N):
    w, v = map(int, input().split())
    wt.append(w)
    vt.append(v)

dp = [[0] * (W + 5) for _ in range(100)]

for i in range(N):
    for j in range(W + 1):
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
        if 0 <= j - wt[i]:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - wt[i]] + vt[i])
# print(dp)
print(dp[N][W])

Fixed submission:
N, W = map(int, input().split())
wt, vt = [], []
for _ in range(N):
    w, v = map(int, input().split())
    wt.append(w)
    vt.append(v)

dp = [[0] * (W + 5) for _ in range(105)]

for i in range(N):
    for j in range(W + 1):
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
        if 0 <= j - wt[i]:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - wt[i]] + vt[i])
# print(dp)
print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
n = len(s)
m = len(t)
dp = [[""] * (m + 5) for _ in range(n + 5)]
for i in range(n):
    for j in range(m):
        if len(dp[i + 1][j]) < len(dp[i][j]):
            dp[i + 1][j] = dp[i][j]
        if len(dp[i][j + 1]) < len(dp[i][j]):
            dp[i][j + 1] = dp[i][j]
        if s[i] == t[j]:
            dp[i + 1][j + 1] = dp[i][j] + s[i]
# print(dp)
ans = ""
for i in range(n + 1):
    for j in range(m + 1):
        if len(ans) < len(dp[i][j]):
            ans = dp[i][j]
print(ans)

Fixed submission:
s = input()
t = input()
n = len(s)
m = len(t)
dp = [[0] * 3100 for _ in range(3100)]
for i in range(n):
    for j in range(m):
        if s[i] == t[j]:
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1)
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j])
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1])

# print(dp)
ans = ""
i, j = n, m
while i > 0 and j > 0:
    if dp[i][j] == dp[i - 1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j - 1]:
        j -= 1
    else:
        ans = s[i - 1] + ans
        i -= 1
        j -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
n = len(s)
m = len(t)
dp = [[""] * (m + 5) for _ in range(n + 5)]
for i in range(n):
    for j in range(m):
        if len(dp[i + 1][j]) < len(dp[i][j]):
            dp[i + 1][j] = dp[i][j]
        if len(dp[i][j + 1]) < len(dp[i][j]):
            dp[i][j + 1] = dp[i][j]
        if s[i] == t[j]:
            dp[i + 1][j + 1] = dp[i][j] + s[i]
# print(dp)
ans = ""
for i in range(n + 1):
    for j in range(m + 1):
        if len(ans) < len(dp[i][j]):
            ans = dp[i][j]
print(ans)

Fixed submission:
s = input()
t = input()
n = len(s)
m = len(t)
dp = [[0] * 3100 for _ in range(3100)]
for i in range(n):
    for j in range(m):
        if s[i] == t[j]:
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1)
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j])
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1])

# print(dp)
ans = ""
i, j = n, m
while i > 0 and j > 0:
    if dp[i][j] == dp[i - 1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j - 1]:
        j -= 1
    else:
        ans = s[i - 1] + ans
        i -= 1
        j -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = [c for c in input()]
ans = 0
while True:
    flag = False
    for i in range(len(S)-1):
        if S[i] == "B" and S[i+1] == "W":
            ans += 1
            flag = True
            S[i] = "W"
            S[i+1] = "B"
    if not flag:
        break
print(ans)


Fixed submission:
S = [c for c in input()]
ans = 0
black = 0
for i in range(len(S)):
    if S[i] == "W":
        ans += black
    else:
        black += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = []
for i in range(N):
    H.append(int(input()))

H = sorted(H)
min_diff = float('inf')
for i in range(N-K+1):
    trees = H[i:i+K]
    diff = trees[-1] - trees[0]
    if diff < min_diff:
        min_diff = diff
print(min_diff)


Fixed submission:
N, K = map(int, input().split())
H = []
for i in range(N):
    H.append(int(input()))

H = sorted(H)
min_diff = float('inf')
for i in range(0, N-K+1):
    diff = H[i+K-1] - H[i]
    if diff < min_diff:
        min_diff = diff
print(min_diff)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
X = list(map(int, input().split()))
ans = float('inf')
for l in range(0, N-K+1):
    for r in range(l+K-1, N):
        ans = min(ans, abs(X[l]) + abs(X[l] - X[r]))
        ans = min(ans, abs(X[r]) + abs(X[l] - X[r]))
print(ans)

Fixed submission:
N, K = map(int, input().split())
X = list(map(int, input().split()))
ans = float('inf')
for l in range(0, N-K+1):
    r = l + K - 1
    ans = min(ans, min(abs(X[l]), abs(X[r])) + abs(X[l] - X[r]))
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N = int(input())
A = list(map(int, input().split()))
res = A[0]
for i in range(1, N):
    res = lcm(res, A[i])
res = res - 1
ans = 0
for a in A:
    ans += (res % a)
print(ans)

Fixed submission:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def lcm(x, y):
    return (x * y) // gcd(x, y)


N = int(input())
A = list(map(int, input().split()))
res = A[0]
for i in range(1, N):
    res = lcm(res, A[i])
res = res - 1
ans = 0
for a in A:
    ans += (res % a)
print(ans)
Buggy python submission (verdict: Runtime Error):
D, N = map(int, input().split())
X = [i * (100 ** D) for i in range(1, 100)]
print(X[N-1])

Fixed submission:
def calc(x):
    ret = 0
    while x % 100 == 0:
        x /= 100
        ret += 1
    return ret

D, N = map(int, input().split())
cnt, val = 0, 0
while cnt < N:
    val += 1
    if calc(val) == D:
        cnt += 1
print(val)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
while True:
    flag = False
    for i in range(N):
        if not flag and A[i] % 2 == 0:
            A[i] = A[i] // 2
            flag = True
        else:
            A[i] *= 3
    if flag:
        ans += 1
    else:
        break
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
    while True:
        if A[i] % 2 == 0:
            ans += 1
            A[i] = A[i] // 2
        else:
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = []
for i in range(1, N-1):
    a = set(S[:i])
    b = set(S[i:])
    ans.append(len(a.intersection(b)))
print(max(ans))


Fixed submission:
N = int(input())
S = input()
if N == 2:
    print(len(set(S[0]).intersection(set(S[1]))))
else:
    ans = []
    for i in range(1, N-1):
        a = set(S[:i])
        b = set(S[i:])
        ans.append(len(a.intersection(b)))
    print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
count_e = [0] * N
count_w = [0] * N
for i in range(N):
    if S[i] == "E":
        count_e[i] = 1
    else:
        count_w[i] = 1
ans = float('inf')
for i in range(N):
    ans = min(ans, sum(count_w[:i]) + sum(count_e[i:]))
print(ans)

Fixed submission:
N = int(input())
S = input()
count_e = [0] * N
count_w = [0] * N
for i in range(N-1):
    if S[i] == "W":
        count_w[i+1] = count_w[i] + 1
    else:
        count_w[i+1] = count_w[i]

    if S[N-i-1] == "E":
        count_e[i+1] = count_e[i] + 1
    else:
        count_e[i+1] = count_e[i]

count_e = count_e[::-1]
ans = float('inf')
for i in range(N):
    ans = min(ans, count_w[i] + count_e[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def get_char_ngram(n, s):
    char_gram = [''.join(s[i:i+n]) for i in range(len(s)-n+1)]
    return char_gram

s = input()
K = int(input())
res = set()
for i in range(1, len(s)+1):
    tmp = set(get_char_ngram(i, s))
    res = res.union(tmp)
res = sorted(list(res))
print(res[K-1])

Fixed submission:
def get_char_ngram(n, s):
    char_gram = [''.join(s[i:i+n]) for i in range(len(s)-n+1)]
    return char_gram

s = input()
K = int(input())
res = set()
for i in range(1, K+1):
    tmp = set(get_char_ngram(i, s))
    res = res.union(tmp)
res = sorted(list(res))
print(res[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
import math
import itertools

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
A = list(map(int, input().split()))
max_val = float('-inf')
max_comb = None
for c in itertools.combinations(A, 2):
    # print(c)
    if c[0] < c[1]:
        tmp = (c[1], c[0])
    else:
        tmp = c
    comb_val = comb(tmp[0], tmp[1])

    # print(comb_val)
    if max_val < comb_val:
        max_val = comb_val
        max_comb = tmp
print(*max_comb)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
max_val = max(A)
half = max_val // 2
r = None
diff = float('inf')
for a in A:
    d = abs(half - a)
    if d < diff and a != max_val:
        diff = d
        r = a
print(max_val, r)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = list(map(int, input().split()))
X = [x for x in range(A, B+1)]
sorted_ans = list(sorted(set(X[:K] + X[-K:])))
for x in sorted_ans:
    print(x)

Fixed submission:
A, B, K = list(map(int, input().split()))
ans = set()
for i in range(K):
    if A <= A+i <= B:
        ans.add(A+i)
    if A <= B-i <= B:
        ans.add(B-i)
for x in sorted(ans):
    print(x)
Buggy python submission (verdict: Runtime Error):
dy = [0, 0, 1, -1]
dx = [1, -1, 0, 0]


def bfs(start, goal):
    q = [[start]]
    while len(q) > 0:
        path = q.pop(0)
        n = path[len(path) - 1]
        if n == goal:
            return path
        else:
            for sy, sx in zip(dy, dx):
                py = n[0] + sy
                px = n[1] + sx
                if py < 0 or H <= py:
                    continue
                if px < 0 or W <= px:
                    continue
                if S[py][px] == "#":
                    continue
                if visited[py][px]:
                    continue
                visited[py][px] = True
                x = (py, px)
                if x not in path:
                    new_path = path[:]
                    new_path.append(x)
                    q.append(new_path)

H, W = map(int, input().split())
S = []
for i in range(H):
    S.append([c for c in input()])
# print(S)
visited = [[False for _ in range(W)] for _ in range(H)]
start = (0, 0)
goal = (H-1, W-1)
ans = bfs(start, goal)
# print(ans)
counter = 0
for i in range(H):
    for j in range(W):
        if (i, j) in ans:
            continue
        if S[i][j] == ".":
            counter += 1
print(counter)


Fixed submission:
dy = [0, 0, 1, -1]
dx = [1, -1, 0, 0]


def bfs(start, goal):
    q = [[start]]
    while len(q) > 0:
        path = q.pop(0)
        n = path[len(path) - 1]
        if n == goal:
            return path
        else:
            for sy, sx in zip(dy, dx):
                py = n[0] + sy
                px = n[1] + sx
                if py < 0 or H <= py:
                    continue
                if px < 0 or W <= px:
                    continue
                if S[py][px] == "#":
                    continue
                if visited[py][px]:
                    continue
                visited[py][px] = True
                x = (py, px)
                if x not in path:
                    new_path = path[:]
                    new_path.append(x)
                    q.append(new_path)
    return None


H, W = map(int, input().split())
S = []
for i in range(H):
    S.append([c for c in input()])
# print(S)
visited = [[False for _ in range(W)] for _ in range(H)]
start = (0, 0)
goal = (H-1, W-1)
ans = bfs(start, goal)
if ans is None:
    print(-1)
    exit()
# print(ans)
counter = 0
for i in range(H):
    for j in range(W):
        if (i, j) in ans:
            continue
        if S[i][j] == ".":
            counter += 1
print(counter)
Buggy python submission (verdict: Runtime Error):
def is_even(int_num):
    if int_num % 2 == 0:
        return True
    else:
        return False


def main():
    # start = time.time()
    a, b = int(input()), int(input())
    if is_even(a * b):
        print("Even")
    else:
        print("Odd")

    # print((time.time() - start) * 1000.0)

 main()


Fixed submission:
def is_even(int_num):
    if int_num % 2 == 0:
        return True
    else:
        return False


def main():
    # start = time.time()
    inputs = input().split()
    a, b = int(inputs[0]), int(inputs[1])
    if is_even(a * b):
        print("Even")
    else:
        print("Odd")

    # print((time.time() - start) * 1000.0)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def is_even(int_num):
    if int_num % 2 == 0:
        return True
    else:
        return False


def main():
    # start = time.time()
    a, b = int(input()), int(input())
    if is_even(a * b):
        print("Even")
    else:
        print("Odd")

    # print((time.time() - start) * 1000.0)

if __name__ == "__main__":
    main()

Fixed submission:
def is_even(int_num):
    if int_num % 2 == 0:
        return True
    else:
        return False


def main():
    # start = time.time()
    inputs = input().split()
    a, b = int(inputs[0]), int(inputs[1])
    if is_even(a * b):
        print("Even")
    else:
        print("Odd")

    # print((time.time() - start) * 1000.0)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C, S, F = [], [], []
for _ in range(N-1):
    c, s, f = tuple(map(int, input().split()))
    C.append(c)
    S.append(s)
    F.append(f)

for i in range(N-1):
    total_time = 0
    for j, (c, s, f) in enumerate(zip(C[i:], S[i:], F[i:])):
        if j == 0:
            total_time += (c + s)
        else:
            while total_time < s:
                total_time += 1
            while total_time % f != 0:
                total_time += 1
            total_time += c
    print(total_time)
print(0)


Fixed submission:
N = int(input())
C, S, F = [], [], []
for _ in range(N-1):
    c, s, f = tuple(map(int, input().split()))
    C.append(c)
    S.append(s)
    F.append(f)

for i in range(N-1):
    total_time = 0
    for j, (c, s, f) in enumerate(zip(C[i:], S[i:], F[i:])):
        if j == 0:
            total_time += (c + s)
        else:
            if total_time < s:
                total_time = s
            if total_time % f != 0:
                total_time += f - total_time % f
            total_time += c
    print(total_time)
print(0)
Buggy python submission (verdict: Runtime Error):
N, C = map(int, input().split())
MAX_N = (10 ** 5 + 1)
X = [0] * MAX_N
for _ in range(N):
    s, t, c = map(int, input().split())
    X[s] += 1
    X[t+1] -= 1
# print(X)
ans = [0] * MAX_N
for i in range(MAX_N - 1):
    ans[i + 1] = ans[i] + X[i]
# print(ans)
print(max(ans))

Fixed submission:
N, C = map(int, input().split())
MAX_N = (10 ** 5 + 5)
X = [[0] * MAX_N for _ in range(C)]

for _ in range(N):
    s, t, c = map(int, input().split())
    c -= 1
    X[c][s] += 1
    X[c][t + 1] -= 1
# print(X)
res = [[0] * MAX_N for _ in range(C)]
for c in range(C):
    for i in range(MAX_N - 1):
        res[c][i + 1] = res[c][i] + X[c][i]
# print(ans)
ans = 0
for i in range(MAX_N - 1):
    count = 0
    for c in range(C):
        if 0 < res[c][i]:
            count += 1
    ans = max(ans, count)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
count = 0
for t in T:
    if t in D:
        D.remove(t)
        count += 1
if count == M:
    print("YES")
else:
    print("NO")

Fixed submission:
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
d_dict = {}
for d in D:
    if d not in d_dict:
        d_dict[d] = 0
    d_dict[d] += 1

count = 0
for t in T:
    if t in d_dict and d_dict[t] > 0:
        d_dict[t] -= 1
        count += 1
if count == M:
    print("YES")
else:
    print("NO")