Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# D
N = int(input())
X_list = [0]*N
Y_list = [0]*N

res_flag = 1

r = -1
for i in range(N):
    X, Y = map(int, input().split())
    if r >= 0:
        if r != (X+Y)%2:
            res_flag = -1
    else:
        r = (X+Y)%2
    X_list[i] = X
    Y_list[i] = Y
    
if res_flag == -1:
    print(-1)
else:
    if r == 0:
        print(22)
        print("1 1 2 2 3 3 4 4 5 5 1 1 2 2 3 3 4 4 5 5 1 1")
    else:
        print(23)
        print("1 1 2 2 3 3 4 4 5 5 1 1 2 2 3 3 4 4 5 5 1 1 1")        
        for i in range(N):
            m_list = list("LRLRLRLRLRDUDUDUDUDULR")
            X = X_list[i]
            Y = Y_list[i]
            
            if r != 0:
                if X >= 0:
                    X -= 1
                    m_list_add = ["R"]
                else:
                    X += 1
                    m_list_add = ["L"]
            else:
                m_list_add = []
            if X % 2 == 1:
                if X > 0:
                    m_list[20] = "R"
                    X -= 1
                else:
                    X += 1
                if Y > 0:
                    m_list[21] = "U"
                    Y -= 1
                else:
                    m_list[21] = "D"
                    Y += 1
            if X > 0:
                m_list[X - 2] = "R"
            elif X < 0:
                m_list[-X - 1] = "L"
            if Y > 0:
                m_list[Y + 8] = "U"
            elif Y < 0:
                m_list[-Y + 9] = "D"
            print("".join(m_list + m_list_add))

Fixed submission:
# D
N = int(input())
X_list = [0]*N
Y_list = [0]*N

res_flag = 1

r = -1
for i in range(N):
    X, Y = map(int, input().split())
    if r >= 0:
        if r != (X+Y)%2:
            res_flag = -1
    else:
        r = (X+Y)%2
    X_list[i] = X
    Y_list[i] = Y
    
if res_flag == -1:
    print(-1)
else:
    if r == 0:
        print(32)
        print(" ".join([str(2**i) for i in range(30, -1, -1)]+["1"]))
        X_add = 1
        m_list_add = ["L"]
    else:
        print(31)
        print(" ".join([str(2**i) for i in range(30, -1, -1)]))
        X_add = 0
        m_list_add = []
    for n in range(N):
        X = X_list[n] + X_add
        Y = Y_list[n]
        
        S = X + Y
        T = X - Y
        m_list = []
        for i in range(30, -1, -1):
            if S < 0 and T < 0:
                m_list.append("L")
                S += 2**i
                T += 2**i
            elif S < 0 and T > 0:
                m_list.append("D")
                S += 2**i
                T -= 2**i
            elif S > 0 and T > 0:
                m_list.append("R")
                S -= 2**i
                T -= 2**i
            elif S > 0 and T < 0:
                m_list.append("U")
                S -= 2**i
                T += 2**i
            else:
                print("?")
        if S != 0 or T != 0:
            print("?")
        
        print("".join(m_list + m_list_add))
Buggy python submission (verdict: Time Limit Exceeded):
# E
s = list(input())
N = len(s)
res = True
if s[0] == "0" or s[N-1] == "1":
    res = False
for i in range(N-1):
    if s[i] != s[N-2-i]:
        res = False
if res == False:
    print(-1)
else:
    k = 1
    for i in range(N-1):
        if s[i] == "1":
            while k < i+1:
                print(str(k)+" "+str(i+1))
                k += 1
        while k < N:
            print(str(k)+" "+str(N))

Fixed submission:
# E
s = list(input())
N = len(s)
res = True
if s[0] == "0" or s[N-1] == "1":
    res = False
for i in range(N-1):
    if s[i] != s[N-2-i]:
        res = False
if res == False:
    print(-1)
else:
    k = 1
    for i in range(N-1):
        if s[i] == "1":
            while k < i+1:
                print(str(k)+" "+str(i+1))
                k += 1
    while k < N:
        print(str(k)+" "+str(N))
        k += 1
Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
x_list = list(map(int, input().split()))
x_cumsum = [0]*N

cum = 0
for i in range(N):
    cum += x_list[i]
    x_cumsum[i] = cum
    
res = cum*5 + 2*N*X
for n in range(1, N):
    res_temp = (N+n)*X
    
    for i in range(N // n):
        if i == 0:
            c = 5
        else:
            c = 2*i+3
        if N-1-(i+1)*n == -1:
            res_temp += c * x_cumsum[N-1-i*n]
        else:
            res_temp += c * (x_cumsum[N-1-i*n] - x_cumsum[N-1-(i+1)*n])
    i = N // n
    c = 2*i+3
    if N % n != 0:
        res_temp += c * x_cumsum[N % n - 1]
    res = min(res, res_temp)
    
print(res)

Fixed submission:
N, X = map(int, input().split())
x_list = list(map(int, input().split()))
x_cumsum = [0]*N

cum = 0
for i in range(N):
    cum += x_list[i]
    x_cumsum[i] = cum
    
res = cum*5 + 2*N*X
for n in range(1, N):
    res_temp = (N+n)*X
    
    for i in range(N // n):
        if i == 0:
            c = 5
        else:
            c = 2*i+3
        if N-1-(i+1)*n == -1:
            res_temp += c * x_cumsum[N-1-i*n]
        else:
            res_temp += c * (x_cumsum[N-1-i*n] - x_cumsum[N-1-(i+1)*n])
    i = N // n
    c = 2*i+3
    if N % n != 0:
        res_temp += c * x_cumsum[N % n - 1]
    res = min(res, res_temp)
    
print(res)
Buggy python submission (verdict: Runtime Error):
# C
N, K = map(int, input().split())
x_list = list(map(int, input().split()))

zero_cnt = 0
posi_ind = N+1
nega_ind = -1
# minus
for i in range(N):
    if x_list[i] == 0:
        zero_cnt = 1
        nega_ind = i-1
    elif x_list[i] > 0:
        posi_ind = i
        if zero_cnt == 0:
            nega_ind = i-1
        break
if zero_cnt == 1:
    K -= 1
res = 10**13
if K == 0:
    res = 0
for i in range(1, min(nega_ind+1, K)+1):
    p = x_list[posi_ind+(K-i-1)]
    n = -x_list[nega_ind - i + 1]
    r = min(2*p+n, 2*n+p)
    res = min(res, r)
l = posi_ind+(K-1)
if l < N:
    r = x_list[l]
    res = min(res, r)
print(res)

Fixed submission:
# C
N, K = map(int, input().split())
x_list = list(map(int, input().split()))

zero_cnt = 0
posi_ind = N
nega_ind = -1

# minus
for i in range(N):
    if x_list[i] == 0:
        zero_cnt = 1
        nega_ind = i-1
    elif x_list[i] > 0:
        posi_ind = i
        if zero_cnt == 0:
            nega_ind = i-1
        break
if zero_cnt == 1:
    K -= 1

if x_list[N-1] < 0:
    nega_ind = N-1
    
nega_seq = list(reversed(x_list[:(nega_ind+1)]))
posi_seq = x_list[posi_ind:]

res = 10**13
if K == 0:
    res = 0
else:
    for i in range(1, min(len(posi_seq)+1, K)):
        if K-i-1 >= len(nega_seq) or K-i-1 < 0:
            continue
        p = posi_seq[i-1]
        n = -nega_seq[K-i-1]
        r = min(2*p+n, 2*n+p)
        res = min(res, r)
    if len(posi_seq) >= K:
        r = posi_seq[K-1]
        res = min(res, r)
    if len(nega_seq) >= K:
        r = -nega_seq[K-1]
        res = min(res, r)
print(res)
Buggy python submission (verdict: Runtime Error):
# D
N, M = map(int, input().split())
A_list = list(map(int, input().split()))

mod_dict = dict()

sum_k = 0
for a in A_list:
    sum_k += a
    r = sum_k % M
    if r not in mod_dict.keys():
        mod_dict[r] = 1
    else:
        mod_dict[r] += 1

res = 0
sum_k = 0

r = 0

for a in A_list:
    res += mod_dict[r]    
    sum_k += a
    r = sum_k % M
    mod_dict[r] -= 1
    
    
print(res)

Fixed submission:
# D
N, M = map(int, input().split())
A_list = list(map(int, input().split()))

mod_dict = dict()
mod_dict[0] = 0
sum_k = 0
for a in A_list:
    sum_k += a
    r = sum_k % M
    if r not in mod_dict.keys():
        mod_dict[r] = 1
    else:
        mod_dict[r] += 1

res = 0
sum_k = 0

r = 0

for a in A_list:
    res += mod_dict[r]    
    sum_k += a
    r = sum_k % M
    mod_dict[r] -= 1
    
    
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
# C
N = int(input())
S = list(input())
S1 = S[:N]
S2 = S[2*N-1:N-1:-1]

dict_1 = dict()

res = 0

for i in range(2**N):
    sb = bin(2**N+i)
    red = "".join([S1[j] for j in range(N) if sb[j+3]=="0"])
    blue = "".join([S1[j] for j in range(N) if sb[j+3]=="1"])
    sss = red+"|"+blue
    if sss not in dict_1.keys():
        dict_1[sss] = 1
    else:
        dict_1[sss] += 1
        
for i in range(2**N):
    sb = bin(2**N+i)
    red = "".join([S2[j] for j in range(N) if sb[j+3]=="0"])
    blue = "".join([S2[j] for j in range(N) if sb[j+3]=="1"])
    sss = red+"|"+blue
    res += dict_1.get(sss, 0)
print(res)

Fixed submission:
# C
N = int(input())
S = list(input())
S1 = S[:N]
S2 = S[2*N-1:N-1:-1]

dict_1 = dict()
q_list = [""]*(2**N)
res = 0

for i in range(2**N):
    sb = bin(2**N+i)[3:]
    red = []
    blue = []
    red2 = []
    blue2 = []
    for j in range(N):
        if sb[j]=="0":
            red.append(S1[j])
            red2.append(S2[j])
        else:
            blue.append(S1[j])
            blue2.append(S2[j])
    sss = "".join(red+["|"]+blue)
    sss2 = "".join(red2+["|"]+blue2)
    if sss not in dict_1.keys():
        dict_1[sss] = 1
    else:
        dict_1[sss] += 1
    q_list[i] = sss2
for q in q_list:
    res += dict_1.get(q, 0)
print(res)
Buggy python submission (verdict: Runtime Error):
# D
import numpy as np

N, C = map(int, input().split())

C_cost_mat = np.zeros((C, C), dtype="int32")
now_mat = np.zeros((3, C), dtype="int32")

for i in range(C):
    c_list = list(map(int, input().split()))
    for j in range(C):
        C_cost_mat[i][j] = c_list[j]
        
for i in range(N):
    c_list = list(map(int, input().split()))
    for j in range(N):
        now_mat[(i + j + 2) % 3, c_list[j] - 1] += 1
        
res_mat = np.matmul(now_mat, C_cost_mat)

res = 3000
for i1 in range(C):
    for i2 in range(C):
        for i3 in range(C):
            if i1 != i2 and i2 != i3 and i3 != i1:
                res = min(res, res_mat[0, i1] + res_mat[1, i2] + res_mat[2, i3])
print(res)

Fixed submission:
# D
import numpy as np

N, C = map(int, input().split())

C_cost_mat = np.zeros((C, C), dtype="int32")
now_mat = np.zeros((3, C), dtype="int32")

for i in range(C):
    c_list = list(map(int, input().split()))
    for j in range(C):
        C_cost_mat[i][j] = c_list[j]
        
for i in range(N):
    c_list = list(map(int, input().split()))
    for j in range(N):
        now_mat[(i + j + 2) % 3, c_list[j] - 1] += 1
        
res_mat = np.dot(now_mat, C_cost_mat)

res = 1000*N*N
for i1 in range(C):
    for i2 in range(C):
        for i3 in range(C):
            if i1 != i2 and i2 != i3 and i3 != i1:
                res = min(res, res_mat[0, i1] + res_mat[1, i2] + res_mat[2, i3])
print(res)

Buggy python submission (verdict: Runtime Error):
# D
import numpy as np

N, C = map(int, input().split())

C_cost_mat = np.zeros((C, C), dtype="int32")
now_mat = np.zeros((3, C), dtype="int32")

for i in range(C):
    c_list = list(map(int, input().split()))
    for j in range(C):
        C_cost_mat[i][j] = c_list[j]
        
for i in range(N):
    c_list = list(map(int, input().split()))
    for j in range(N):
        now_mat[(i + j + 2) % 3, c_list[j] - 1] += 1
        
res_mat = now_mat @ C_cost_mat

res = 3000
for i1 in range(C):
    for i2 in range(C):
        for i3 in range(C):
            if i1 != i2 and i2 != i3 and i3 != i1:
                res = min(res, res_mat[0, i1] + res_mat[1, i2] + res_mat[2, i3])
print(res)

Fixed submission:
# D
import numpy as np

N, C = map(int, input().split())

C_cost_mat = np.zeros((C, C), dtype="int32")
now_mat = np.zeros((3, C), dtype="int32")

for i in range(C):
    c_list = list(map(int, input().split()))
    for j in range(C):
        C_cost_mat[i][j] = c_list[j]
        
for i in range(N):
    c_list = list(map(int, input().split()))
    for j in range(N):
        now_mat[(i + j + 2) % 3, c_list[j] - 1] += 1
        
res_mat = np.dot(now_mat, C_cost_mat)

res = 1000*N*N
for i1 in range(C):
    for i2 in range(C):
        for i3 in range(C):
            if i1 != i2 and i2 != i3 and i3 != i1:
                res = min(res, res_mat[0, i1] + res_mat[1, i2] + res_mat[2, i3])
print(res)
Buggy python submission (verdict: Runtime Error):
# B
N, A, B, K = map(int, input().split())

LARGE = 998244353
INVS = [0]*(N+1)
for i in range(1, N+1):
    INVS[i] = pow(i, LARGE-2, LARGE)
NCKL = [1]*(N+1)
for i in range(1, N+1):
    NCKL[i] = (NCKL[i-1] * (N+1-i) * INVS[i]) % LARGE

res = 0
for i in range(N+1):
    if (K - A*i) % B == 0:
        j = (K - A*i) // B
        res += (NCKL[i] * NCKL[j]) % LARGE
print(res % LARGE)

Fixed submission:
# B
N, A, B, K = map(int, input().split())

LARGE = 998244353
INVS = [0]*(N+1)
for i in range(1, N+1):
    INVS[i] = pow(i, LARGE-2, LARGE)
NCKL = [1]*(N+1)
for i in range(1, N+1):
    NCKL[i] = (NCKL[i-1] * (N+1-i) * INVS[i]) % LARGE

res = 0
for i in range(N+1):
    if (K - A*i) % B == 0:
        j = (K - A*i) // B
        if j >= 0 and j <= N:
            res += (NCKL[i] * NCKL[j]) % LARGE
print(res % LARGE)
Buggy python submission (verdict: Runtime Error):
# E
from heapq import heappush, heappop
import numpy as np

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

A_args = np.argsort(A)

nodeid = np.ones(N).astype("int32")
canput = np.ones(N)
nodeid_dict = dict()
nodeid_dict[1] = [0, N]

# initial output
res = A[A_args[Q-1]] - A[A_args[0]]

ind_del = 0

for i in range(N):
    
    nid = A_args[i]
    
    # update nodeid
    ndid = nodeid[nid]
    nodeid[nid] = 0
    left, right = nodeid_dict[ndid]
    nodeid[(nid+1):right] = i+2
    nodeid_dict[nid] = [left, nid]
    nodeid_dict[i+2] = [nid+1, right]

    # update canput
    canput[nid] = 0
    
    canput[left:nid] = 0
    h = []
    for j in range(left, nid):
        heappush(h, (-A[j], j))
    while len(h) >= K:
        _, j = heappop(h)
        canput[j] = 1
    
    canput[(nid+1):right] = 0
    h = []
    for j in range(nid+1, right):
        heappush(h, (-A[j], j))
    while len(h) >= K:
        _, j = heappop(h)
        canput[j] = 1
    
    # break
    if canput.sum() <= Q:
        break
        
    # calculate
    q = 0
    qmin = 10**9
    qmax = 1
    for i in range(N):
        if canput[A_args[i]] == 1:
            q += 1
            qmin = min(A[A_args[i]], qmin)
            qmax = max(A[A_args[i]], qmax)
            if q == Q:
                r = qmax - qmin
                break
    res = min(res, r)
print(res)

Fixed submission:
# C
N = int(input())
S = list(input())


res = 0
for i in range(1, N):
    if S[i] == "E":
        res += 1
res_min = res
for i in range(1, N):
    if S[i-1] == "W":
        res += 1
    if S[i] == "E":
        res -= 1
    res_min = min(res, res_min)
print(res_min)
Buggy python submission (verdict: Time Limit Exceeded):
# D
N = int(input())
A = list(map(int, input().split()))


counts = [0] * 20

res = 0
left = 0
right = 0

r = bin(A[right])
for i in range(len(r)-2):
    counts[i] += int(r[-(i+1)])

while left < N and right < N:
    if max(counts) >= 2:
        r = bin(A[left])
        for i in range(len(r)-2):
            counts[i] -= int(r[-(i+1)])
        left += 1
    else:
        res += right - left + 1
        # print(left, right)
        right += 1
        if right < N:
            r = bin(A[right])
            for i in range(len(r)-2):
                counts[i] += int(r[-(i+1)])

print(res)

Fixed submission:
# D
N = int(input())
A = list(map(int, input().split()))

counts = [0] * 20

res = 0
left = 0
right = 0

r = bin(A[right])
for i in range(len(r)-2):
    counts[i] += int(r[-(i+1)])

while left < N and right < N:
    if max(counts) >= 2:
        r = bin(A[left])
        for i in range(len(r)-2):
            counts[i] -= int(r[-(i+1)])
        left += 1
    else:
        res += right - left + 1
        # print(left, right)
        right += 1
        if right < N:
            r = bin(A[right])
            for i in range(len(r)-2):
                counts[i] += int(r[-(i+1)])

print(res)
Buggy python submission (verdict: Runtime Error):
# D
import math
Q = int(input())
A_list = []
B_list = []
for _ in range(Q):
    A, B = map(int, input().split())
    A_list.append(min(A, B))
    B_list.append(max(A, B))
    
for i in range(Q):
    A = A_list[i]
    B = B_list[i]
        
    if A == B:
        print(A+B-2)
        continue
        
    R = int(math.sqrt(A*B-1))
    Q = (A*B-1) // R
    
    if Q <= R+1:
        add = min(Q - A - 1, B - R - 1)    
    elif (Q - R)**2 - 4*(A*B-Q*R) > 0:
        add = int(((Q - R) - math.sqrt((Q - R)**2 - 4*(A*B-Q*R))) / 2)
        if (R + add)*(Q-add) == A*B:
            add -= 1
    else:
        add = 0
    print((A-1) + R + add)
    

Fixed submission:
# C
ABC = sorted(list(map(int, input().split())))

res = 0

res += ABC[2] - ABC[1]
ABC[0] += ABC[2] - ABC[1]
ABC[1] = ABC[2]

if (ABC[2] - ABC[0]) % 2 == 0:
    res += (ABC[2] - ABC[0]) // 2
else:
    res += (ABC[2] - ABC[0]) // 2 + 2
    
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
# C
import sys

N = int(input())
left = 0
right = N-1
ans_left = ''
ans_right = ''

cnt = 0

print(0)
cnt += 1
s = input()
ans_left = s

if s != "Vacant":
    print(N-1)
    cnt += 1
    s = input()
    ans_right = s


    
while s != "Vacant" and cnt < 20:
    
    # find which is unusual
    mid = (left + right) // 2
    print(m)
    cnt += 1
    s = input()
    
    m = (mid - left) % 2
    if m == 0:
        if ans_left != s:
            right = mid
            ans_right = s
        else:
            left = mid
            ans_left = s
    else:
        if ans_left == s:
            right = mid
            ans_right = s
        else:
            left = mid
            ans_left = s
    

Fixed submission:
# C
import sys

N = int(input())
left = 0
right = N-1
ans_left = ''
ans_right = ''

cnt = 0

print(0)
cnt += 1
s = input()
ans_left = s

if s != "Vacant":
    print(N-1)
    cnt += 1
    s = input()
    ans_right = s


    
while s != "Vacant" and cnt < 20:
    
    # find which is unusual
    mid = (left + right) // 2
    print(mid)
    cnt += 1
    s = input()
    
    m = (mid - left) % 2
    if m == 0:
        if ans_left != s:
            right = mid
            ans_right = s
        else:
            left = mid
            ans_left = s
    else:
        if ans_left == s:
            right = mid
            ans_right = s
        else:
            left = mid
            ans_left = s
Buggy python submission (verdict: Runtime Error):
# E
N = int(input())
P_list = list(map(int, input().split()))
X_list = list(map(int, input().split()))

# graph
child_list = [[] for _ in range(N+1)]
for i in range(2, N+1):
    child_list[P_list[i-2]].append(i)

# from root
# minimize local total weight

color1 = [0]+X_list
color2 = [0]*(N+1)

# solve knapsack
def solve_knapsack(L, M):
    min_acc = sum([min(color1[j], color2[j]) for j in L])
    if min_acc > M:
        return -1
    else:
        add_can = M - min_acc
        add_set = set([0])
        for j in L:
            add_j = max(color1[j], color2[j]) - min(color1[j], color2[j])
            add_set_ = set(add_set)
            for s in add_set:
                if s + add_j <= add_can:
                    add_set_.add(s + add_j)
            add_set = add_set_
        
        total = sum([color1[j]+color2[j] for j in L])
        return total - max(add_set)

res = "POSSIBLE"

for i in range(N, 0, -1):
    if len(child_list[i]) == 0:
        pass
    elif len(child_list[i]) == 1:
        j = child_list[i][0]
        if min(color1[j], color2[j]) > X_list[i-1]:
            res = "IMPOSSIBLE"
            break
        elif max(color1[j], color2[j]) > X_list[i-1]:
            color2[i] = max(color1[j], color2[j])
        else:
            color2[i] = min(color1[j], color2[j])
    else:
        c2 = solve_knapsack(child_list[i], X_list[i-1])
        if c2 < 0:
            res = "IMPOSSIBLE"
            break
        else:
            color2[j] = c2
    
print(res)

Fixed submission:
# E
N = int(input())
P_list = list(map(int, input().split()))
X_list = list(map(int, input().split()))

# graph
child_list = [[] for _ in range(N+1)]
for i in range(2, N+1):
    child_list[P_list[i-2]].append(i)

# from root
# minimize local total weight

color1 = [0]+X_list
color2 = [0]*(N+1)

# solve knapsack
def solve_knapsack(L, M):
    min_acc = sum([min(color1[j], color2[j]) for j in L])
    if min_acc > M:
        return -1
    else:
        add_can = M - min_acc
        add_set = set([0])
        for j in L:
            add_j = max(color1[j], color2[j]) - min(color1[j], color2[j])
            add_set_ = set(add_set)
            for s in add_set:
                if s + add_j <= add_can:
                    add_set_.add(s + add_j)
            add_set = add_set_
        
        total = sum([color1[j]+color2[j] for j in L])
        return total - max(add_set) - min_acc

res = "POSSIBLE"

for i in range(N, 0, -1):
    if len(child_list[i]) == 0:
        pass
    elif len(child_list[i]) == 1:
        j = child_list[i][0]
        if min(color1[j], color2[j]) > X_list[i-1]:
            res = "IMPOSSIBLE"
            break
        elif max(color1[j], color2[j]) > X_list[i-1]:
            color2[i] = max(color1[j], color2[j])
        else:
            color2[i] = min(color1[j], color2[j])
    else:
        c2 = solve_knapsack(child_list[i], X_list[i-1])
        if c2 < 0:
            res = "IMPOSSIBLE"
            break
        else:
            color2[i] = c2
    
print(res)
Buggy python submission (verdict: Runtime Error):
# E
from collections import Counter

N = int(input())
xy_list = [list(map(int, input().split())) for _ in range(N)]

M = 998244353

res = pow(2, N, M)
# 0 points
res -= 1
# 1 points
res -= N

# all lines
line_cnt = [0]*(N+1)

for i in range(N):
    xi, yi = xy_list[i]
    angle_list = []
    for j in range(N):
        xj, yj = xy_list[j]
        if xj != xi:
            angle_list.append((yj-yi)/(xj-xi))
        elif yj != xj:
            angle_list.append(10000.0)
        
    # count points in same line
    cnt_i = Counter(angle_list)
    for k in cnt_i.values():
        line_cnt[k+1] += 1

for i in range(2, N+1):
    cnt = line_cnt[i] // i
    res -= cnt*(pow(2, i, M)-i-1)

res = res % M
print(res)

Fixed submission:
# E
from collections import Counter

N = int(input())
xy_list = [list(map(int, input().split())) for _ in range(N)]

M = 998244353

res = pow(2, N, M)
# 0 points
res -= 1
# 1 points
res -= N

# all lines
line_cnt = [0]*(N+1)

for i in range(N):
    xi, yi = xy_list[i]
    angle_list = []
    for j in range(N):
        xj, yj = xy_list[j]
        if xj != xi:
            angle_list.append((yj-yi)/(xj-xi))
        elif yj != yi:
            angle_list.append(10000.0)
        
    # count points in same line
    cnt_i = Counter(angle_list)
    for k in cnt_i.values():
        line_cnt[k+1] += 1

for i in range(2, N+1):
    cnt = line_cnt[i] // i
    res -= cnt*(pow(2, i, M)-i-1)

res = res % M
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
# E
N = int(input())
xy_list = [list(map(int, input().split())) for _ in range(N)]

M = 998244353

res = pow(2, N, M)
# 0 points
res -= 1
# 1 points
res -= N

# all lines
for i in range(N):
    xi, yi = xy_list[i]
    for j in range(i+1, N):
        xj, yj = xy_list[j]
        # count points in same line
        cnt = 0
        valid = 1
        for k in range(N):
            xk, yk = xy_list[k]
            if ((xk-xi)*(xk-xj) + (yk-yi)*(yk-yj))**2 == ((xk-xi)**2 + (yk-yi)**2)*((xk-xj)**2 + (yk-yj)**2):
                if k < j and k != i:
                    valid = 0
                else:
                    cnt += 1
        if cnt > 0 and valid == 1:
            # print(i, j, cnt)
            res -= (pow(2, cnt, M)-cnt-1)

res = res % M
print(res)

Fixed submission:
# E
from collections import Counter

N = int(input())
xy_list = [list(map(int, input().split())) for _ in range(N)]

M = 998244353

res = pow(2, N, M)
# 0 points
res -= 1
# 1 points
res -= N

# all lines
line_cnt = [0]*(N+1)

for i in range(N):
    xi, yi = xy_list[i]
    angle_list = []
    for j in range(N):
        xj, yj = xy_list[j]
        if xj != xi:
            angle_list.append((yj-yi)/(xj-xi))
        elif yj != yi:
            angle_list.append(10000.0)
        
    # count points in same line
    cnt_i = Counter(angle_list)
    for k in cnt_i.values():
        line_cnt[k+1] += 1

for i in range(2, N+1):
    cnt = line_cnt[i] // i
    res -= cnt*(pow(2, i, M)-i-1)

res = res % M
print(res)