code: def eval_problems(problems, verbose, ks=1):
      reliability_guard(psutil.virtual_memory().total / 1)
  
      def eval_problem(problem):
          globals = {"print_stack": [], "__name__": "__main__"}
          globals = overload_builtin_print(globals)
  
          test_success = False
          test_msg = ""
          print_output = ""
          std_out = ""
  
          try:
              with time_limit(20):
                  completions = problem["completions"]
                  gold_output = problem["gold_output"]
  
                  completions_with_print = try_rewrite_ast_with_print(
                      completions
                  )
  
                  success, std_out = do_exec(
                      code=completions_with_print, globals=globals
                  )
                  print_output = globals["print_stack"][-1]["args"][0]
                  test_success = check_equivalence(
                      print_output, gold_output
                  )
  
          except TimeoutException:
              test_msg = "Timed out"
              test_success = False
          except Exception as e:
              test_msg = str(e)
              test_success = False
  
          return test_success, test_msg, print_output, std_out
  
      n_total = 0
      n_success = 0
      pass_stats = {(p["id"], p["test_id"]): [] for p in problems}
  
      for i, problem in enumerate(problems):
          test_success, test_msg, sys_output, std_out = eval_problem(
              problem
          )
  
          n_total += 1
          n_success += 1 if test_success else 0
          pass_stats[problem["id"], problem["test_id"]].append(
              1 if test_success else 0
          )
  
          if verbose:
              print("=" * 40)
              print(
                  f'{i}/{len(problems)} {problem["id"]} -> {test_success} ({test_msg}) [{std_out}]'
              )
              print("-" * 40)
              print(f'{problem["gold_output"]}')
              print(f"{sys_output}")
              print("-" * 40)
              print(f'{problem["completions"]}')
              print("-" * 40)
              print(
                  f'{try_rewrite_ast_with_print(problem["completions"])}'
              )
              print()
          else:
              print(
                  f'{i}/{len(problems)} {problem["id"]} -> {test_success} ({test_msg}) [{sys_output}=={problem["gold_output"]}] [{std_out}]'
              )
  
      print("\nOverall stats")
      print(f"n_total={n_total} n_success={n_success}")
      print("-" * 40)
  
      pids = sorted(set(p[0] for p in pass_stats))
      for pid in pids:
          test_cases = [v for k, v in pass_stats.items() if k[0] == pid]
          print(
              f"{pid:15s}: {sum([i for t in test_cases for i in t]):3d} : {sum([len(t) for t in test_cases])}"
          )
  
imports: import argparse
  import contextlib
  import glob
  import json
  import os
  import random
  import signal
  from time import time
  import numpy
  import platform
  import faulthandler
  import psutil
label_desc: Use image node_id 17 for calling a global function with example usage: eval_problems(problems, verbose, ks) and returns: test_success,  test_msg,  print_output,  std_out