> For the complete documentation index, see [llms.txt](https://xmc.gitbook.io/xmc-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xmc.gitbook.io/xmc-documentation/overview/import-external-data/xmc-format.md).

# XMC Format

The XMC format represents the totality of XMC's own formats to represent data on the filesystem.

## Graders

A grader, in the XMC format, is a source code file with the filename of the form `gradername.ext`, where `gradername` is the unique name of the grader, and `ext` is the programming language-specific file extension.

### Example

The following file is a grader named `simplegrader` written in C:

`simplegrader.c`:

```c
#include <stdio.h>

int main() {
    printf("This grader is pretty dumb\n");

    return 0;
}
```

## Datasets

A dataset is represented as a directory whose filename is the unique name of the dataset, in which there is a `dataset.yaml` file that contains dataset metadata,  and a directory named `testcases` which contains the test files of the dataset.

The `testcases` directory holds for each test case two files: an input file, for example `test1.in`, and an output file, `test1.out`. The format of the filename is `test#.in`/`test#.ok`, where `#` is the number of the test case. The case numbering must start from 1 and they all must be consecutive.

The `dataset.yaml` file has the following structure:

```yaml
description: Some dataset description
grader_name: example_grader
memory_limit: 1024
time_limit: 1.23s
```

The `dataset.yaml` file must be a valid YAML file. The memory limit is expressed in bytes as an integer and the time limit is a string that follows Go's library function [`time.ParseDuration`](https://golang.org/pkg/time/#ParseDuration). In short, it is a sequence of integers each with an optional fraction and a unit suffix. Unit suffixes are "ns", "us", "ms", "s", "m", "h".

### Example

The following dataset is named `permutations_easy`.

```
permutations_easy
├── dataset.yaml
└── testcases
    ├── test10.in
    ├── test10.ok
    ├── test1.in
    ├── test1.ok
    ├── test2.in
    ├── test2.ok
    ├── test3.in
    ├── test3.ok
    ├── test4.in
    ├── test4.ok
    ├── test5.in
    ├── test5.ok
    ├── test6.in
    ├── test6.ok
    ├── test7.in
    ├── test7.ok
    ├── test8.in
    ├── test8.ok
    ├── test9.in
    └── test9.ok

1 directory, 21 files
```

`dataset.yaml`:

```yaml
description: Easy difficulty tests for permutation problem.
grader_name: basic_grader
memory_limit: 8192
time_limit: 0.45s
```

## Tasks

A task is a directory with its filename being the unique name of the task. The directory contains only a `task.yaml` file that contains the details of the task.

The `task.yaml` has the following structure:

```yaml
description: Some task description
dataset_name: example_dataset
input_file: problem.in
output_file: problem.out
task_list_name: some_task_list
```

The file must be a valid YAML file. The input file and output file can be set to `stdin` and `stdout` respectively.

### Example

The following task is named `addition`.

```
addition
└── task.yaml

0 directories, 1 file
```

`task.yaml`:

```yaml
description: Simple addition
dataset_name: addition.1
input_file: addition.in
output_file: addition.out
task_list_name: archive
```
