Two days ago, I solved quite a few problems linked from the guide. However, no matter what I upload (same program from two days ago, boilerplate program to write to the output file, even a file filled with invalid characters, etc), this is what I see:
Here is the problem:
https://usaco.org/index.php?page=viewproblem2&cpid=572
Here is my functional code:
import sys
sys.stdin = open("bcount.in", "r")
sys.stdout = open("bcount.out", "w")
n, k = map(int, input().split())
line = [input() for _ in range(n)]
queries = [tuple(map(int, input().split())) for _ in range(k)]
dl = [[0], [0], [0]] # derivative, 1-indexed
for l in line:
dl[0].append(dl[0][-1])
dl[1].append(dl[1][-1])
dl[2].append(dl[2][-1])
if l == "1":
dl[0][-1] += 1
elif l == "2":
dl[1][-1] += 1
else:
dl[2][-1] += 1
#print(dl)
for q in queries:
ans = []
for i in range(3):
ans.append(dl[i][q[1]]-dl[i][q[0]-1])
print(ans[0], ans[1], ans[2])
Is anyone else having the same error?