#include<iostream>
#include<fstream>
#include<string>
using namespace std;
void output_message (int points, string message) {
    cout << points << endl ;
    cerr << message << endl ;
    exit(0);
}
int main (int argc, char** argv) {
    ifstream inp,ans,out;
    if (argc<4) output_message(0,"The checker needs input file, correct output and contestant output!");
    inp.open(argv[1]);
    if (inp.is_open()==false) output_message(0,"Could not open input file!");
    inp.close();
    ans.open(argv[2]);
    if (ans.is_open()==false) output_message(0,"Could not open correct output file!");
    ans.close();
    out.open(argv[3]);
    if (out.is_open()==false) output_message(0,"Could not open contestant output file!");

    int verdict;
    if (!(out >> verdict)) output_message(0,"Violation of the protocol for communication");
    if ((verdict!=0)&&(verdict!=1)) output_message(0,"Unexpected error - call the jury!");
    if (verdict==1) output_message(1,"OK!");
    char tmp;
    out.get(tmp);
    string reason;
    if (!getline(out,reason)) output_message(0,"Unexpected error - call the jury!");
    output_message(0,reason);
    return 0;
}
