"File Missing" error regardless of what I submit

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?

1 Like

As a workaround, I have created a bash script to grade tests automatically:

#! /usr/bin/env bash
program=$1; for i in $(seq 1 $(ls -l *.in | wc -l)); do echo Test \#${i}; diff -q <(timeout 4 time cat $i.in | python3 $program || echo Timeout) $i.out; done

It’s not pretty, but it gets the job done:

# Download test cases into the current WD
bash usaco.sh bcount.py

Is it just this problem or all problems involving file I/O?

1 Like