vector<long long> readStream(InStream& in, TResult pe) { vector<long long> result; for (int testCase = 1; !in.seekEof(); testCase++) { string caseStr = in.readToken(); if (caseStr != "Case") quitf(pe, "Expected 'Case' but found '%s' [test case %d]", compress(caseStr).c_str(), testCase); string numExpStr; stringstream ss; ss << testCase; ss >> numExpStr; numExpStr += ":"; string numStr = in.readToken(); if (numExpStr != numStr) quitf(pe, "Expected '%s' but found '%s' [test case %d]", compress(numExpStr).c_str(), compress(numStr).c_str(), testCase); result.push_back(in.readLong()); } return result; }