Submission streams


During the program's runtime, data located in the so-called streams is being consumed and produced. The following streams can be distinguished:

stdin (standard input)

It contains data that is forwarded to the program as input data. In Sphere Engine Compilers, it's possible to specify the contents of this stream individually for each program execution. In the case of Sphere Engine Problems, this stream is used to deliver input data from the test case. In both cases, the program has the ability to read the data.

For example, in C++, input data can be retrieved using the cin stream, which is a part of the iostream library.

#include <iostream>
using namespace std;

int main() {
    int number;
    cin >> number;
    // the "number" variable  contains a number given in input data
    return 0;
}

Important: The stdin stream and command-line arguments are two different methods of passing data to the program. All components of the Sphere Engine service use stdin stream for passing input data. No additional parameters are added to the command-line arguments list.

stdout (standard output)

It contains the so-called output data which the program printed during execution. In both Sphere Engine Compilers and Sphere Engine Problems modules, it's possible to present output data to the end-user after the execution ends. However, in Sphere Engine Problems, output data is usually hidden to ensure confidentiality for test cases. In such cases, the output data is used during the correctness verification process, but the end user has no access to it.

For example, in C++, data can be printed using the cout stream, which is a part of the iostream library.

#include <iostream>
using namespace std;

int main() {
    cout << "This message will be present in the standard output stream";
    return 0;
}

stderr (standard error)

It contains error messages generated by the program during execution. As with the output data, error information may be presented to the end-user after the program execution has completed. Also similarly to the output data, in the Sphere Engine Problems module, the common approach is to keep the content of this stream (at least partially) confidential to protect test cases' data.

This stream can also be used for printing debug messages without the risk of mixing them with output data written to the stdout stream.

For example, in C++, data can be printed to the error stream using the cerr stream, which is a part of the iostream library.

#include <iostream>
using namespace std;

int main() {
    cerr << "This message will be present in the standard error stream";
    return 0;
}

cmpinfo (compilation info)

It contains information about errors and warnings which appeared during the compilation of the program.

Note: The program compilation information is included in this stream only for compiled languages ​​(e.g. C, C ++, Java, Python). For interpreted languages ​​(e.g. PHP, Perl), data about the parsing process and the interpretation of the source code (e.g. information about syntax errors) can be found in the stderr stream.

The following example presents the error that appeared during the compilation of a simple C++ program:

prog.cpp: In function ‘int main()’:
prog.cpp:5:9: error: ‘number’ was not declared in this scope
  cin >> number;
         ^~~~~~