original_docstring: Checks the answer of the program using the specified checker.
  
      :param isolate_dir: The path to the isolate directory.
      :param input_path: The path to the input file.
      :param answer_path: The path to the answer file (the correct output).
      :param checker: The checker to use.
      :param time_limit: The time limit (in seconds).
      :param mem_limit: The memory limit (in MB).
      :return: The score that the program got (a float between 0 and 1).
      
docstring: Checks the answer of the program using the specified checker.
docstring_tokens: Checks the answer of the program using the specified checker .
code: def check_results(isolate_dir, input_path: str, answer_path: str, checker: str, time_limit: int, mem_limit: int):
      """Checks the answer of the program using the specified checker.
  
      :param isolate_dir: The path to the isolate directory.
      :param input_path: The path to the input file.
      :param answer_path: The path to the answer file (the correct output).
      :param checker: The checker to use.
      :param time_limit: The time limit (in seconds).
      :param mem_limit: The memory limit (in MB).
      :return: The score that the program got (a float between 0 and 1).
      """
      if checker == 'diff':
          # Diff the results, ignoring whitespace issues and carriage returns
          diff_result = subprocess.run(['diff', '--ignore-trailing-space', '--strip-trailing-cr',
                                        isolate_dir + '/output.out.txt', answer_path], stdout=subprocess.DEVNULL)
          if diff_result.returncode != 0:
              return 0
          else:
              return 1
      elif checker == 'custom':
          # Copy answer file into isolate sandbox
          shutil.copy2(answer_path, isolate_dir + '/answer.ans.txt')
          # Find custom checker
          code_args = None
          if os.path.isfile(isolate_dir + '/checker.cpp'):
              code_args = ['./checker']
          elif os.path.isfile(isolate_dir + '/checker.java'):
              time_limit *= JAVA_TIME_MULTIPLIER
              code_args = ['/usr/lib/jvm/java-14-openjdk-amd64/bin/java',
                           '-Xmx' + str(mem_limit) + 'M', '-Xss' + str(mem_limit // 2) + 'M', 'checker']
          elif os.path.isfile(isolate_dir + '/checker.py'):
              time_limit *= PYTHON_TIME_MULTIPLIER
              code_args = ['/bin/python3', 'checker.new.py']
          process = run_with_isolate(isolate_dir, 'output.out.txt', 'checker.check.txt', 'error.err.txt',
                                     time_limit, mem_limit, code_args + [input_path, 'answer.ans.txt'])
  
          # Was the answer correct?
          if process.returncode != 0:
              # Assume wrong answer since the checker failed
              if DEBUG_LOWEST:
                  log('Checker did not exit correctly, assuming 0 score')
              return 0
  
          # Return the checker's score
          with open(isolate_dir + '/checker.check.txt', 'r') as result:
              raw_line = result.readline()
              score = float(raw_line) if '.' in raw_line else int(raw_line)
              if DEBUG_LOWEST:
                  log('Checker score is ' + str(score))
              return score
      else:
          log_error(str(checker) + ' is not a valid checker!')
code_tokens: def check_results ( isolate_dir , input_path : str , answer_path : str , checker : str , time_limit : int , mem_limit : int ) : if checker == 'diff' : diff_result = subprocess . run ( [ 'diff' , '--ignore-trailing-space' , '--strip-trailing-cr' , isolate_dir + '/output.out.txt' , answer_path ] , stdout = subprocess . DEVNULL ) if diff_result . returncode != 0 : return 0 else : return 1 elif checker == 'custom' : shutil . copy2 ( answer_path , isolate_dir + '/answer.ans.txt' ) code_args = None if os . path . isfile ( isolate_dir + '/checker.cpp' ) : code_args = [ './checker' ] elif os . path . isfile ( isolate_dir + '/checker.java' ) : time_limit *= JAVA_TIME_MULTIPLIER code_args = [ '/usr/lib/jvm/java-14-openjdk-amd64/bin/java' , '-Xmx' + str ( mem_limit ) + 'M' , '-Xss' + str ( mem_limit // 2 ) + 'M' , 'checker' ] elif os . path . isfile ( isolate_dir + '/checker.py' ) : time_limit *= PYTHON_TIME_MULTIPLIER code_args = [ '/bin/python3' , 'checker.new.py' ] process = run_with_isolate ( isolate_dir , 'output.out.txt' , 'checker.check.txt' , 'error.err.txt' , time_limit , mem_limit , code_args + [ input_path , 'answer.ans.txt' ] ) if process . returncode != 0 : if DEBUG_LOWEST : log ( 'Checker did not exit correctly, assuming 0 score' ) return 0 with open ( isolate_dir + '/checker.check.txt' , 'r' ) as result : raw_line = result . readline ( ) score = float ( raw_line ) if '.' in raw_line else int ( raw_line ) if DEBUG_LOWEST : log ( 'Checker score is ' + str ( score ) ) return score else : log_error ( str ( checker ) + ' is not a valid checker!' )
short_docstring: Checks the answer of the program using the specified checker.
short_docstring_tokens: Checks the answer of the program using the specified checker .
comment: """Checks the answer of the program using the specified checker.
  
      :param isolate_dir: The path to the isolate directory.
      :param input_path: The path to the input file.
      :param answer_path: The path to the answer file (the correct output).
      :param checker: The checker to use.
      :param time_limit: The time limit (in seconds).
      :param mem_limit: The memory limit (in MB).
      :return: The score that the program got (a float between 0 and 1).
      """$SEP$# Diff the results, ignoring whitespace issues and carriage returns$SEP$# Copy answer file into isolate sandbox$SEP$# Find custom checker$SEP$# Was the answer correct?$SEP$# Assume wrong answer since the checker failed$SEP$# Return the checker's score