<commit_before>#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <float.h>
#include <string.h>
#include <math.h>

#include "assignment.h"


int main(int argc, const char **argv)
{
  double *M, t, cost, answer;
  size_t *result;
  size_t i, j, n;
  long fpos;
  long type;
  int quiet = 0, ok = 0, argi = 1;
  const char *test_file, *answer_file;
  char answer_name[16];
  FILE *tf, *af;

  if (argc > 1)
  {
    if (strcmp(argv[argi], "-q") == 0)
    {
      quiet = 1;
      ++argi;
    }
    if (argc >= argi + 2)
    {
      test_file = argv[argi];
      answer_file = argv[argi+1];
      ok = 1;
    }
  }

  if (!ok)
  {
    fprintf(stderr, "Usage: %s [-q] <test file> <answer file>\n", argv[0]);
    exit(1);
  }

  tf = fopen(test_file, "r");
  if (!tf)
  {
    fprintf(stderr, "Error: Couldn't open test case file '%s'\n", test_file);
    exit(1);
  }

  if (fscanf(tf, "%zu", &n) == 0)
  {
    fprintf(stderr, "Error: Couldn't read problem size in file '%s'\n", test_file);
    exit(1);
  }

  M = calloc(n * n, sizeof(double));
  result = malloc(2 * n * sizeof(size_t));

  if (!quiet) fprintf(stdout, "Reading %zu x %zu\n", n, n);

  fpos = ftell(tf);
  type = fscanf(tf, "%zu %zu %lf%*[ ]%*[\n] %zu", &i, &j, &t, &i);
  fseek(tf, fpos, SEEK_SET);

  if (type == 3)
  {
    for (i = 0; i < n; ++i)
      for (j = 0; j < n; ++j)
        if (fscanf(tf, "%lf", M + i * n + j) == EOF)
        {<commit_msg>be nice to c++ in the test harness too<commit_after>#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <float.h>
#include <string.h>
#include <math.h>

#include "assignment.h"


int main(int argc, const char **argv)
{
  double *M, t, cost, answer;
  size_t *result;
  size_t i, j, n;
  long fpos;
  long type;
  int quiet = 0, ok = 0, argi = 1;
  const char *test_file, *answer_file;
  char answer_name[16];
  FILE *tf, *af;

  if (argc > 1)
  {
    if (strcmp(argv[argi], "-q") == 0)
    {
      quiet = 1;
      ++argi;
    }
    if (argc >= argi + 2)
    {
      test_file = argv[argi];
      answer_file = argv[argi+1];
      ok = 1;
    }
  }

  if (!ok)
  {
    fprintf(stderr, "Usage: %s [-q] <test file> <answer file>\n", argv[0]);
    exit(1);
  }

  tf = fopen(test_file, "r");
  if (!tf)
  {
    fprintf(stderr, "Error: Couldn't open test case file '%s'\n", test_file);
    exit(1);
  }

  if (fscanf(tf, "%zu", &n) == 0)
  {
    fprintf(stderr, "Error: Couldn't read problem size in file '%s'\n", test_file);
    exit(1);
  }

  M = (double*)calloc(n * n, sizeof(double));
  result = (size_t*)malloc(2 * n * sizeof(size_t));

  if (!quiet) fprintf(stdout, "Reading %zu x %zu\n", n, n);

  fpos = ftell(tf);
  type = fscanf(tf, "%zu %zu %lf%*[ ]%*[\n] %zu", &i, &j, &t, &i);
  fseek(tf, fpos, SEEK_SET);

  if (type == 3)
  {
    for (i = 0; i < n; ++i)
      for (j = 0; j < n; ++j)
        if (fscanf(tf, "%lf", M + i * n + j) == EOF)
        {
{'fraction_non_alphanumeric': 0.20654044750430292, 'fraction_numerical': 0.013769363166953529, 'mean_word_length': 2.5744157441574416, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4842232', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1261, 'n_words': 348}