Why doesn't fast I/O in python work for me?

Revision en2, by TomaKapec, 2023-08-01 18:20:14

So I found fast I/O for Python and I used it before and it worked and now it doesn't. I don't know why, I tried everything! I use it for this task https://mirror.codeforces.com/contest/1850/problem/G, and here is my code. If anyone can explain why that would be great.

import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
t = int(input())

def solve(n, points):
    d_plus, d_minus, red, stupac = {}, {}, {}, {}
    r=0
    
    for i in points:
        x, y = i
        a, b, c, d = red.get(x, 0), stupac.get(y, 0), d_plus.get(x+y, 0), d_minus.get(x-y, 0) 
        r+=(a+b+c+d)*2; red[x], stupac[y], d_plus[x+y], d_minus[x-y] = a+1, b+1, c+1, d+1;

    return r

for i in range(t):
    n = int(input())
    points = [list(map(int, (input().decode()).split())) for i in range(n)]
    print(solve(n, points))

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English TomaKapec 2023-08-01 21:55:17 163
en2 English TomaKapec 2023-08-01 18:20:14 49
en1 English TomaKapec 2023-08-01 18:18:25 859 Initial revision (published)