JinNian0072 commited on
Commit
ca286d7
·
verified ·
1 Parent(s): 4c62fb2

Replace hash-only indices with actual-input standard testcase tables

Browse files

Self-contained Python and Java Parquet rows preserve actual stdin/output bytes, 1800 pair associations, testcase order and repeated entries. Remove obsolete indices, blob archives and readers from current release. Base code and labels unchanged.

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitignore +0 -3
  2. README.md +53 -115
  3. SHA256SUMS.txt +0 -14
  4. base_hashes.json +0 -5
  5. build_input_bundle.py +0 -300
  6. python/cases.zip → data/java/test-00000.parquet +2 -2
  7. python/problems.jsonl → data/java/test-00001.parquet +2 -2
  8. java/cases.zip → data/java/test-00002.parquet +2 -2
  9. data/java/test-00003.parquet +3 -0
  10. data/java/test-00004.parquet +3 -0
  11. data/java/test-00005.parquet +3 -0
  12. data/java/test-00006.parquet +3 -0
  13. data/java/test-00007.parquet +3 -0
  14. data/java/test-00008.parquet +3 -0
  15. data/java/test-00009.parquet +3 -0
  16. data/java/test-00010.parquet +3 -0
  17. data/java/test-00011.parquet +3 -0
  18. data/java/test-00012.parquet +3 -0
  19. data/java/test-00013.parquet +3 -0
  20. data/java/test-00014.parquet +3 -0
  21. data/java/test-00015.parquet +3 -0
  22. data/java/test-00016.parquet +3 -0
  23. data/java/test-00017.parquet +3 -0
  24. data/java/test-00018.parquet +3 -0
  25. data/java/test-00019.parquet +3 -0
  26. data/java/test-00020.parquet +3 -0
  27. data/java/test-00021.parquet +3 -0
  28. data/java/test-00022.parquet +3 -0
  29. data/java/test-00023.parquet +3 -0
  30. data/java/test-00024.parquet +3 -0
  31. data/java/test-00025.parquet +3 -0
  32. data/java/test-00026.parquet +3 -0
  33. data/java/test-00027.parquet +3 -0
  34. data/java/test-00028.parquet +3 -0
  35. data/java/test-00029.parquet +3 -0
  36. data/java/test-00030.parquet +3 -0
  37. data/java/test-00031.parquet +3 -0
  38. data/java/test-00032.parquet +3 -0
  39. data/java/test-00033.parquet +3 -0
  40. data/java/test-00034.parquet +3 -0
  41. data/java/test-00035.parquet +3 -0
  42. data/java/test-00036.parquet +3 -0
  43. data/java/test-00037.parquet +3 -0
  44. data/java/test-00038.parquet +3 -0
  45. data/java/test-00039.parquet +3 -0
  46. data/java/test-00040.parquet +3 -0
  47. data/java/test-00041.parquet +3 -0
  48. data/java/test-00042.parquet +3 -0
  49. data/java/test-00043.parquet +3 -0
  50. data/java/test-00044.parquet +3 -0
.gitignore DELETED
@@ -1,3 +0,0 @@
1
- __pycache__/
2
- *.pyc
3
- *.download.json
 
 
 
 
README.md CHANGED
@@ -1,143 +1,81 @@
1
  ---
2
- pretty_name: CODEEFFIJUDGE Archived Inputs
3
  language:
4
  - en
5
  tags:
6
  - code
7
  - reproducibility
8
- - archived-inputs
9
  configs:
10
- - config_name: python_pairs
11
  data_files:
12
  - split: test
13
- path: python/pair_inputs.jsonl
14
- - config_name: java_pairs
15
  data_files:
16
  - split: test
17
- path: java/pair_inputs.jsonl
18
  ---
19
 
20
- # Independent archived input dataset
21
 
22
- This companion dataset supplies saved Python and Java stdin bytes for the current
23
- three-language, 2700-pair benchmark. It does not modify or duplicate the benchmark
24
- code files or historical labels in `../dataset/test/`.
25
 
26
- The manifest binds all references to the exact current base-file hashes. Inputs
27
- are shared at problem level; identical input/output bytes are stored only once
28
- per language in ZIP archives. Duplicate testcase entries and their original
29
- order are retained, so storage deduplication does not silently change workload
30
- weights. Line endings, Unicode, empty outputs and NUL bytes are not normalized.
31
 
32
- ## Files
33
 
34
- ```text
35
- dataset_inputs/
36
- manifest.json # counts, byte hashes, base identities and limits
37
- SHA256SUMS.txt # generated artifact checksums
38
- python/
39
- pair_inputs.jsonl # 900 references bound to both candidates' hashes
40
- problems.jsonl # 304 problem records and ordered testcase metadata
41
- cases.zip # deduplicated exact input and saved output bytes
42
- java/
43
- pair_inputs.jsonl # 900 references bound to both candidates' hashes
44
- problems.jsonl # 294 problem records and ordered testcase metadata
45
- cases.zip # deduplicated exact input bytes
46
- ```
47
-
48
- Python has 31,387 archived input entries, with saved output files. Java has
49
- 13,581 archived input entries. Java's archived generated cases have no saved
50
- expected answers: these remain `null`, not invented answers or empty strings.
51
- C++ inputs are **not included** in this companion package.
52
-
53
- These are input-pool entry counts, not counts of distinct bytes or fully valid
54
- testcases. The original archives include inputs that require constraint checks.
55
- Saved Python expected outputs are not all independently certified. Availability
56
- of a checker is not evidence that an output was checked successfully.
57
-
58
- ## Read or export inputs
59
-
60
- Python 3.8+ and the standard library are sufficient; no server path, SSH
61
- connection or third-party package is required after downloading the companion
62
- dataset and matching base files.
63
-
64
- From this directory:
65
-
66
- ```powershell
67
- python load_inputs.py --language python --pair-id python_5151
68
- python load_inputs.py --language java --row-index 0
69
- python load_inputs.py --language python --pair-id python_5151 --output-dir exported_5151
70
- python verify_input_bundle.py
71
- python verify_input_bundle.py --language python
72
- python test_input_bundle.py
73
- ```
74
 
75
- The export command refuses an existing output directory. It writes exact
76
- `.input.txt` and available `.expected.txt` bytes, plus an export manifest. It
77
- does not run the candidates, score answers, or measure performance.
 
 
78
 
79
- For a separate directory layout, pass `--root` and `--base-dir`. Pair lookup is
80
- bound to row index, pair/problem IDs, both candidate-code hashes, and the ordered
81
- problem record. A mismatching benchmark snapshot is refused.
82
-
83
- The companion repository does not include candidate code. Download the three
84
- matching base files separately, keeping the filenames in `manifest.json`.
85
- `--base-dir` should point directly to the directory containing those files.
86
- Summary lookup needs metadata and the matching base file; reading or exporting
87
- actual stdin bytes additionally requires that language's `cases.zip`.
88
-
89
- Programmatic access avoids extracting entire archives:
90
 
91
  ```python
92
- from load_inputs import InputDataset
93
 
94
- with InputDataset() as dataset:
95
- pair, reference, problem = dataset.pair("python", pair_id="python_5151")
96
- for case in dataset.iter_cases("python", pair_id="python_5151"):
97
- stdin_bytes = case["input"]
98
- expected_bytes = case["expected"] # bytes, or None if unavailable
99
- # Send the same stdin_bytes to both candidates in your own runner.
100
  ```
101
 
102
- Each blob is checked by SHA-256 when read. `verify_input_bundle.py` additionally
103
- checks all metadata/archive hashes, every pair association, testcase order,
104
- every unique blob, counts, and the unchanged base snapshots.
105
-
106
- The two languages can be downloaded separately. A Python-only download needs
107
- the root manifest, the `python/` directory, the reader/verifier scripts and the
108
- matching Python base file. Use `--language python` to avoid requiring the Java
109
- archive; the equivalent Java-only option is `--language java`.
110
-
111
- For storage planning, `python/cases.zip` is 10,157,708 bytes and
112
- `java/cases.zip` is 2,207,893,821 bytes (about 2.21 GB or 2.06 GiB). Java's
113
- archived input entries total 7,516,791,461 bytes before storage deduplication
114
- and compression. Full extraction is unnecessary for pair-level access.
115
-
116
- ## What this package does not certify
117
-
118
- The package is an archived input dataset, **not a reconstruction of every
119
- historical measured common-testcase subset**. Every pair explicitly retains
120
- `historical_measurement_subset_proven: false`. No input is marked as universally
121
- valid, and no saved answer is upgraded to a trusted correctness oracle.
122
-
123
- Before new correctness or performance experiments, validate constraints and
124
- checkers, freeze the exact selected input hashes, and record exclusions and
125
- per-testcase measurements. Do not silently use the whole input pool as if it
126
- were the historical workload, or rewrite the original performance labels.
127
 
128
- This update does not change sampling membership or require speedup-stratum
129
- reporting. It also does not change the original metric or its measurement scope.
 
130
 
131
- ## Packaging provenance
132
 
133
- `build_input_bundle.py` reads the existing recovery inventories and archived
134
- bytes. It refuses an existing output directory and verifies inventory hashes,
135
- Java source-record/file hashes, current pair membership, and base hashes before
136
- and after packaging. The manifest retains source-inventory hashes, but no
137
- private source paths, account names, credentials or solution-source copies.
138
 
139
- The original private source archives are needed only to rebuild this package,
140
- not to use its delivered inputs. Rebuilding the package is distinct from
141
- regenerating the historical inputs from generators. ZIP timestamps are fixed;
142
- compression-library versions are recorded, while input-byte hashes are the
143
- portable reproducibility identity.
 
1
  ---
2
+ pretty_name: CODEEFFIJUDGE Archived Testcases
3
  language:
4
  - en
5
  tags:
6
  - code
7
  - reproducibility
8
+ - testcases
9
  configs:
10
+ - config_name: python
11
  data_files:
12
  - split: test
13
+ path: data/python/test-*.parquet
14
+ - config_name: java
15
  data_files:
16
  - split: test
17
+ path: data/java/test-*.parquet
18
  ---
19
 
20
+ # Archived testcases with actual inputs
21
 
22
+ Each row contains an actual saved stdin input, not a hash or an archive pointer.
23
+ Parquet is a standard tabular dataset format readable with Hugging Face Datasets,
24
+ PyArrow or pandas. Select the `python` or `java` configuration to view cases.
25
 
26
+ Python: **31,387 rows / 304 problems / 900 associated pairs**.
27
+ Java: **13,581 rows / 294 problems / 900 associated pairs**.
28
+ C++ testcases are not included. The separate 2700-pair code benchmark is unchanged.
 
 
29
 
30
+ ## Columns
31
 
32
+ | Column | Meaning |
33
+ | --- | --- |
34
+ | `language` | Python or Java |
35
+ | `problem_id` | Problem associated with this testcase |
36
+ | `pair_ids` | All benchmark pairs sharing this problem's input pool |
37
+ | `case_index` | Zero-based position in that problem's saved input pool |
38
+ | `input` | Actual stdin text, including original whitespace and line endings |
39
+ | `output` | Saved expected-output text; `null` means unavailable, not empty |
40
+ | `input_encoding` | `utf-8`, or `base64` only for non-UTF-8 bytes |
41
+ | `output_encoding` | Same encoding rule; `null` for unavailable outputs |
42
+ | `input_validity` | Original constraint-validation status, not upgraded by conversion |
43
+ | `output_correctness` | Original expected-output certification status |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
+ One row is one original testcase entry. Inputs shared by multiple pairs are not
46
+ copied into separate large rows for every pair. To obtain a pair's inputs, select
47
+ rows whose `pair_ids` contains that ID and order them by `case_index`. Repeated
48
+ entries within a problem are retained at different indices; do not deduplicate
49
+ them silently when reproducing a workload.
50
 
51
+ For a downloaded local dataset directory:
 
 
 
 
 
 
 
 
 
 
52
 
53
  ```python
54
+ from datasets import load_dataset
55
 
56
+ cases = load_dataset("parquet", data_files="data/python/test-*.parquet", split="train")
57
+ pair_cases = cases.filter(lambda row: "python_14212" in row["pair_ids"])
58
+ pair_cases = pair_cases.sort("case_index")
59
+ print(pair_cases[0]["input"])
 
 
60
  ```
61
 
62
+ When loading from the Hub, use this repository's ID with configuration `python`
63
+ or `java` and split `test`. Streaming avoids downloading the entire Java dataset.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
+ For execution, use `row["input"].encode("utf-8")` when the encoding is `utf-8`,
66
+ otherwise `base64.b64decode(row["input"])`. Apply the same rule to non-null
67
+ outputs. This reconstructs the original bytes without newline normalization.
68
 
69
+ ## Scope and limitations
70
 
71
+ These are recovered archived input pools, **not certified reconstructions of
72
+ the exact historical measured subsets**. Constraint validity and saved Python
73
+ outputs are not all independently certified. Every Java output remains `null`:
74
+ no answers have been invented. Availability is not a new correctness or runtime
75
+ label certification.
76
 
77
+ Before new experiments, validate input constraints and correctness checks,
78
+ freeze the exact selected cases, and record per-testcase measurements. Conversion
79
+ preserves every input byte, available output byte, problem/pair association,
80
+ testcase index and validation flag. It does not execute candidates or change
81
+ the original code benchmark's labels.
SHA256SUMS.txt DELETED
@@ -1,14 +0,0 @@
1
- 0724ca147960b340736e373db43758d5d555e37862272fc4e86cc5fb6ce6c5a4 java/cases.zip
2
- c87b540311dd3d26f98058dd9f01fb8699ef67769da21193f361f9f8f40e8541 java/pair_inputs.jsonl
3
- ca251c492b1b50008624552bf2162a46157c147aed59287c7d0ab2cc2635cd18 java/problems.jsonl
4
- b23fcabc874076a49d1f0b15b24f8518cb92a5bef5007409e1fa2226e5e4afc7 python/cases.zip
5
- a263759e30db29659c90c522a46c8c69e5ecaa414a49fe161ae6fd2c2be05d0f python/pair_inputs.jsonl
6
- 800c1d34ee6da87579c949d2e87fe31a87f0f8f69dae6570cd0b80a9196d1e37 python/problems.jsonl
7
- 73292d92d6a1593de4c6636dbd68b259cc77772c4ab347913eb5d0cdfddb689d manifest.json
8
- 4f7004390354c53f9fde69cc0f1551527012192b87189210901be094cfd28fca .gitignore
9
- 4c24e6a6b253a83340276563a520f1964c83b3a56d3f4f3f008eb2a682608a4d base_hashes.json
10
- de4d68f28c79f9cde08989454c7a20d0fac20bc35f372b08d0bbde502e289167 build_input_bundle.py
11
- 39b813f229a21649f8818e594ed38b0366ea78326e6c0bb8a632264d32de421c load_inputs.py
12
- 1c071efc5a9b6e2b018c84434964a33b35cdbb155bb41cbebc4228f10fd0e80a verify_input_bundle.py
13
- 39df8559d31d2403e4c5cbb60f60375ca53645f2c25f0a6b2fb62e3bcf0d1040 test_input_bundle.py
14
- 6b0345dc50598ea5a5f187418adf445a4e9f48f63d1ba4658b93732accd0b75e README.md
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
base_hashes.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "cpp": "9f063767155f7bdebd703ad298bab03119c560f1e12ed324274435a979ed8975",
3
- "python": "1af10e60b2b00c0280e7f8ac064bdb7d9a7ce82f41bc79efef2ba63cf6d5e1d7",
4
- "java": "cb2eb30933c5c42ac8cd54e556f660304b7fe7077b9f468eae8636fbd4f8e028"
5
- }
 
 
 
 
 
 
build_input_bundle.py DELETED
@@ -1,300 +0,0 @@
1
- """Package existing archived inputs without changing benchmark code or labels.
2
-
3
- The source-recovery inventory is private. Only portable identifiers, bytes and
4
- hashes are exported; absolute source paths never enter the delivered package.
5
- Requires Python 3.8+ and the standard library only.
6
- """
7
- import argparse
8
- from collections import Counter, defaultdict
9
- import hashlib
10
- import json
11
- from pathlib import Path
12
- import platform
13
- import time
14
- import zipfile
15
- import zlib
16
-
17
-
18
- CANONICAL = {
19
- 'cpp': 'cpp_seed42_sanitized.jsonl',
20
- 'python': 'python_seed42_sanitized.jsonl',
21
- 'java': 'java_seed42_sanitized_process.jsonl',
22
- }
23
-
24
-
25
- def sha(data):
26
- return hashlib.sha256(data).hexdigest()
27
-
28
-
29
- def file_sha(path):
30
- h = hashlib.sha256()
31
- with Path(path).open('rb') as stream:
32
- for block in iter(lambda: stream.read(4 * 1024**2), b''):
33
- h.update(block)
34
- return h.hexdigest()
35
-
36
-
37
- def dump(row):
38
- return json.dumps(row, ensure_ascii=False, sort_keys=True, separators=(',', ':'))
39
-
40
-
41
- def write_json(path, row):
42
- with Path(path).open('w', encoding='utf-8', newline='\n') as stream:
43
- stream.write(json.dumps(row, ensure_ascii=False, indent=2) + '\n')
44
-
45
-
46
- def write_jsonl(path, rows):
47
- with Path(path).open('w', encoding='utf-8', newline='\n') as stream:
48
- for row in rows:
49
- stream.write(dump(row) + '\n')
50
-
51
-
52
- class BlobWriter:
53
- """Deduplicate bytes; repeated testcase entries and order are NOT removed."""
54
- def __init__(self, path):
55
- self.zip = zipfile.ZipFile(path, 'x', compression=zipfile.ZIP_DEFLATED,
56
- compresslevel=3, allowZip64=True)
57
- self.known = {}
58
- self.unique_bytes = 0
59
-
60
- def put(self, data):
61
- digest = sha(data)
62
- member = 'blobs/' + digest + '.bin'
63
- if digest not in self.known:
64
- info = zipfile.ZipInfo(member, date_time=(1980, 1, 1, 0, 0, 0))
65
- info.create_system = 3
66
- info.external_attr = 0o100644 << 16
67
- self.zip.writestr(info, data, compress_type=zipfile.ZIP_DEFLATED,
68
- compresslevel=3)
69
- self.known[digest] = len(data)
70
- self.unique_bytes += len(data)
71
- elif self.known[digest] != len(data):
72
- raise ValueError('SHA-256 collision or inconsistent blob length')
73
- return {'sha256': digest, 'bytes': len(data), 'member': member}
74
-
75
- def close(self):
76
- self.zip.close()
77
-
78
-
79
- def make_case(language, problem_id, ordinal, data, expected, origin, writer):
80
- identifier = sha(('%s:%s:%d:' % (language, problem_id, ordinal)).encode() + data)[:24]
81
- return {
82
- 'case_id': language + '_' + identifier,
83
- 'ordinal': ordinal,
84
- 'input': writer.put(data),
85
- 'expected': None if expected is None else writer.put(expected),
86
- 'contains_nul': b'\x00' in data,
87
- 'origin': origin,
88
- 'input_validity': 'not_certified',
89
- 'expected_correctness': 'not_certified' if expected is not None else 'not_available',
90
- }
91
-
92
-
93
- def package_python(rows, inventory, output):
94
- directory = output / 'python'
95
- directory.mkdir()
96
- writer = BlobWriter(directory / 'cases.zip')
97
- problems = []
98
- try:
99
- for number, pid in enumerate(sorted({str(r['problem_id']) for r in rows}), 1):
100
- saved = inventory.get(pid)
101
- if not saved:
102
- raise ValueError('No archived Python inputs for ' + pid)
103
- cases = []
104
- for ordinal, entry in enumerate(saved):
105
- path = Path(entry['path'])
106
- data = path.read_bytes()
107
- if sha(data) != entry['input_sha256'] or len(data) != entry['bytes']:
108
- raise ValueError('Python input inventory mismatch: ' + pid)
109
- expected = None
110
- if entry['expected_path']:
111
- expected = Path(entry['expected_path']).read_bytes()
112
- if sha(expected) != entry['expected_sha256']:
113
- raise ValueError('Python output inventory mismatch: ' + pid)
114
- group = path.parent.parent.name
115
- if group not in {'public_test_cases', 'generated_test_cases'}:
116
- raise ValueError('Unexpected Python source group')
117
- cases.append(make_case('python', pid, ordinal, data, expected,
118
- {'collection': group, 'entry_name': path.name}, writer))
119
- problems.append({'language': 'python', 'problem_id': pid,
120
- 'input_pool_kind': 'archived_public_and_generated_inputs',
121
- 'historical_measurement_subset_proven': False, 'cases': cases})
122
- if number % 50 == 0:
123
- print('Python packaged %d problems' % number, flush=True)
124
- finally:
125
- writer.close()
126
- return finish_language('python', rows, problems, output, writer)
127
-
128
-
129
- def package_java(rows, inventory, recovery, output):
130
- directory = output / 'java'
131
- directory.mkdir()
132
- writer = BlobWriter(directory / 'cases.zip')
133
- wanted = {str(r['problem_id']) for r in rows}
134
- lookup = defaultdict(dict)
135
- source_expected = {r['path']: r['sha256'] for r in recovery['source_files']}
136
- for pid in sorted(wanted):
137
- entries = inventory.get(pid, [])
138
- if len(entries) != 1:
139
- raise ValueError('Expected one unambiguous archived Java record for ' + pid)
140
- entry = entries[0]
141
- key = (entry['path'], entry['line'])
142
- if entry['line'] in lookup[entry['path']]:
143
- raise ValueError('Conflicting Java source-record reference')
144
- lookup[entry['path']][entry['line']] = (pid, entry)
145
- problems = []
146
- started = time.monotonic()
147
- try:
148
- for source_number, (source_name, required) in enumerate(sorted(lookup.items()), 1):
149
- digest = hashlib.sha256()
150
- found = set()
151
- with Path(source_name).open('rb') as stream:
152
- for line_number, raw in enumerate(stream, 1):
153
- digest.update(raw)
154
- if line_number not in required:
155
- continue
156
- pid, meta = required[line_number]
157
- if sha(raw) != meta['record_sha256']:
158
- raise ValueError('Java source record changed: ' + pid)
159
- record = json.loads(raw)
160
- if str(record['problem_id']) != pid:
161
- raise ValueError('Java source problem mismatch')
162
- saved = record.get('testcases', [])
163
- if len(saved) != len(meta['cases']):
164
- raise ValueError('Java testcase count changed: ' + pid)
165
- cases = []
166
- for ordinal, (case, old) in enumerate(zip(saved, meta['cases'])):
167
- data_value = case.get('input') if isinstance(case, dict) else case
168
- if not isinstance(data_value, str):
169
- raise ValueError('Java input is not a stored stdin string')
170
- data = data_value.encode('utf-8')
171
- if old['index'] != ordinal or sha(data) != old['input_sha256'] or len(data) != old['input_bytes']:
172
- raise ValueError('Java input inventory mismatch: ' + pid)
173
- value = case.get('expected') if isinstance(case, dict) else None
174
- if (value is not None) != old['expected_available']:
175
- raise ValueError('Java expected-output availability changed')
176
- if value is not None and not isinstance(value, str):
177
- raise ValueError('Unexpected Java expected-output type')
178
- expected = None if value is None else value.encode('utf-8')
179
- cases.append(make_case('java', pid, ordinal, data, expected,
180
- {'collection': 'adapted_java_testcases', 'index': ordinal}, writer))
181
- problems.append({'language': 'java', 'problem_id': pid,
182
- 'input_pool_kind': 'archived_adapted_testcases',
183
- 'source_record': {'file': Path(source_name).name,
184
- 'line': line_number, 'sha256': meta['record_sha256']},
185
- 'historical_measurement_subset_proven': False, 'cases': cases})
186
- found.add(line_number)
187
- del record, saved, raw
188
- if len(problems) % 20 == 0:
189
- print('Java packaged %d/%d problems; %.1fs' % (len(problems), len(wanted), time.monotonic() - started), flush=True)
190
- if found != set(required):
191
- raise ValueError('Missing archived Java source records')
192
- if digest.hexdigest() != source_expected[source_name]:
193
- raise ValueError('Java source-file checksum changed')
194
- print('Java source %d/%d complete' % (source_number, len(lookup)), flush=True)
195
- finally:
196
- writer.close()
197
- if len(problems) != len(wanted):
198
- raise ValueError('Incomplete Java problem coverage')
199
- return finish_language('java', rows, problems, output, writer)
200
-
201
-
202
- def finish_language(language, rows, problems, output, writer):
203
- directory = output / language
204
- problems.sort(key=lambda r: r['problem_id'])
205
- write_jsonl(directory / 'problems.jsonl', problems)
206
- problem_index = {r['problem_id']: r for r in problems}
207
- pair_refs = []
208
- for index, row in enumerate(rows):
209
- pid = str(row['problem_id'])
210
- problem = problem_index[pid]
211
- pair_refs.append({'language': language, 'base_row_index': index,
212
- 'pair_id': row['pair_id'], 'problem_id': pid,
213
- 'slow_code_sha256': sha(row['slow_code'].encode('utf-8')),
214
- 'fast_code_sha256': sha(row['fast_code'].encode('utf-8')),
215
- 'problem_record_sha256': sha(dump(problem).encode('utf-8')),
216
- 'case_ids': [c['case_id'] for c in problem['cases']],
217
- 'input_count': len(problem['cases']),
218
- 'historical_measurement_subset_proven': False,
219
- 'usage': 'new_validation_or_measurement_not_historical_label_replay'})
220
- write_jsonl(directory / 'pair_inputs.jsonl', pair_refs)
221
- cases = [c for p in problems for c in p['cases']]
222
- return {'pairs': len(rows), 'problems': len(problems), 'archived_case_entries': len(cases),
223
- 'case_entries_with_expected': sum(c['expected'] is not None for c in cases),
224
- 'input_bytes_before_deduplication': sum(c['input']['bytes'] for c in cases),
225
- 'unique_input_blobs': len({c['input']['sha256'] for c in cases}),
226
- 'unique_all_blobs': len(writer.known), 'unique_all_blob_bytes': writer.unique_bytes,
227
- 'compressed_archive_bytes': (directory / 'cases.zip').stat().st_size,
228
- 'problem_case_count_distribution': dict(sorted(Counter(len(p['cases']) for p in problems).items())),
229
- 'pair_case_count_distribution': dict(sorted(Counter(r['input_count'] for r in pair_refs).items())),
230
- 'missing_input_pairs': 0, 'historical_measurement_subset_proven': False}
231
-
232
-
233
- def load_base(path):
234
- raw = path.read_bytes()
235
- rows = [json.loads(line) for line in raw.splitlines() if line.strip()]
236
- if len(rows) != 900:
237
- raise ValueError('Expected 900 pairs: ' + path.name)
238
- return rows, sha(raw)
239
-
240
-
241
- def build(args):
242
- if args.output_dir.exists():
243
- raise ValueError('Refuse to overwrite an existing input bundle directory')
244
- paths = {'cpp': args.cpp_base, 'python': args.python_base, 'java': args.java_base}
245
- bases = {lang: load_base(path) for lang, path in paths.items()}
246
- if args.expected_hashes:
247
- expected = json.loads(args.expected_hashes.read_text(encoding='utf-8'))
248
- for lang in paths:
249
- if bases[lang][1] != expected[lang]:
250
- raise ValueError('Unexpected base snapshot hash: ' + lang)
251
- recovery = json.loads((args.recovery_dir / 'recovery_1800.json').read_text(encoding='utf-8'))
252
- for lang in ('python', 'java'):
253
- old = {(str(r['problem_id']), str(r['pair_id'])) for r in recovery['records'] if r['language'] == lang}
254
- new = {(str(r['problem_id']), str(r['pair_id'])) for r in bases[lang][0]}
255
- if new != old:
256
- raise ValueError('Input inventory and base pair memberships differ')
257
- pools = json.loads((args.recovery_dir / 'pool_inventory.json').read_text(encoding='utf-8'))
258
- java = json.loads((args.recovery_dir / 'java_input_inventory.json').read_text(encoding='utf-8'))
259
- args.output_dir.mkdir(parents=True)
260
- stats = {'python': package_python(bases['python'][0], pools, args.output_dir),
261
- 'java': package_java(bases['java'][0], java, recovery, args.output_dir)}
262
- for lang, path in paths.items():
263
- if file_sha(path) != bases[lang][1]:
264
- raise ValueError('Base data changed during packaging')
265
- artifacts = sorted(p for p in args.output_dir.rglob('*') if p.is_file())
266
- manifest = {'schema_version': 1, 'bundle_kind': 'independent_archived_stdin_input_dataset',
267
- 'status': 'archived_input_bytes_verified_NOT_final_measurement_workloads',
268
- 'base_pairs': 2700, 'input_coverage_pairs': 1800,
269
- 'cpp_inputs_included': False, 'base_code_and_labels_modified': False,
270
- 'historical_measurement_subset_proven': False,
271
- 'input_constraints_fully_certified': False, 'expected_outputs_fully_certified': False,
272
- 'base_datasets': {lang: {'file': CANONICAL[lang], 'sha256': bases[lang][1], 'pairs': 900} for lang in paths},
273
- 'languages': stats,
274
- 'artifact_sha256': {p.relative_to(args.output_dir).as_posix(): file_sha(p) for p in artifacts},
275
- 'storage': {'format': 'ZIP_DEFLATED', 'compression_level': 3,
276
- 'deduplication': 'SHA256 byte blobs; original testcase entries/order retained',
277
- 'zip_timestamp': '1980-01-01T00:00:00', 'normalization': 'none'},
278
- 'build_environment': {'python': platform.python_version(), 'zlib': zlib.ZLIB_VERSION},
279
- 'source_inventory_sha256': {name: file_sha(args.recovery_dir / name) for name in
280
- ('recovery_1800.json', 'pool_inventory.json', 'java_input_inventory.json')}}
281
- write_json(args.output_dir / 'manifest.json', manifest)
282
- with (args.output_dir / 'SHA256SUMS.txt').open('w', encoding='utf-8', newline='\n') as stream:
283
- for name, digest in sorted(manifest['artifact_sha256'].items()):
284
- stream.write(digest + ' ' + name + '\n')
285
- stream.write(file_sha(args.output_dir / 'manifest.json') + ' manifest.json\n')
286
- print('COMPLETE ' + dump(stats), flush=True)
287
-
288
-
289
- def main():
290
- parser = argparse.ArgumentParser(description=__doc__)
291
- for lang in ('cpp', 'python', 'java'):
292
- parser.add_argument('--' + lang + '-base', type=Path, required=True)
293
- parser.add_argument('--recovery-dir', type=Path, required=True)
294
- parser.add_argument('--expected-hashes', type=Path)
295
- parser.add_argument('--output-dir', type=Path, required=True)
296
- build(parser.parse_args())
297
-
298
-
299
- if __name__ == '__main__':
300
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
python/cases.zip → data/java/test-00000.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b23fcabc874076a49d1f0b15b24f8518cb92a5bef5007409e1fa2226e5e4afc7
3
- size 10157708
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8db077a550d478e0ae3dd7f7d65df75e37ac6f2edc38858645250e75758b4ab5
3
+ size 10940589
python/problems.jsonl → data/java/test-00001.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:800c1d34ee6da87579c949d2e87fe31a87f0f8f69dae6570cd0b80a9196d1e37
3
- size 18715583
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8583a3313abf695e9971ac9e40fb139fe182c8990cf9ec9e5046ef273fd86faf
3
+ size 39975690
java/cases.zip → data/java/test-00002.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0724ca147960b340736e373db43758d5d555e37862272fc4e86cc5fb6ce6c5a4
3
- size 2207893821
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97a4e2a9737178c269b99a31b82127c0f184a8c29130711a02d9f24f47008962
3
+ size 52858700
data/java/test-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7745e32ea8b0f1778c6875dfa7f77dc2eb182f83270bedd3db467c5f861d0f23
3
+ size 22804787
data/java/test-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4915dc7b455cb64bba1eb3a59ec3f2dc8541e2c7622e6b60d1f0559ff4545471
3
+ size 33388229
data/java/test-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27d543924f0cbc259eae2f62e53e68bf46152142c0c6972faa1aca74686731d6
3
+ size 50325870
data/java/test-00006.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8b72f1ec57a9fe9b3f6e222d7d090357a31cc7b42819c2cc8b82eef04bde308
3
+ size 51130842
data/java/test-00007.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:488572a52609a149c52ce06b04811c624b22fa9250395fb387fb951e6d83fd0d
3
+ size 44973227
data/java/test-00008.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10250c7e001207ce58fcce79d52e3e56ea9022a264ad1bc3fcf2deb63effbea5
3
+ size 37619017
data/java/test-00009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:55c7b5bf751a75d0bed896cd6444125d80c27309b3f618056d18b84fed8a1ffc
3
+ size 44945141
data/java/test-00010.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2277e5c40ffa77fec4f82f44141da0d2fb5559ab2a16338f801be7650a2b039
3
+ size 43194974
data/java/test-00011.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d53b420b3179751e371003c37b9a48b6e54052cf0f75ef253b872c6b40b516a
3
+ size 32898510
data/java/test-00012.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b2dc76ed9c6caab629d13653f7a591a826865396194a4974041b5f1334d3918
3
+ size 25838865
data/java/test-00013.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db4b9eab11e36caac644468e5987fe5af2bb69e533b6a152a7063a9877ff7fe4
3
+ size 37740086
data/java/test-00014.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:578f432cf41a01e0891e6e48c21794732747d2038a2d430f40e25966c2ad344b
3
+ size 42698600
data/java/test-00015.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adbc0557dd7d685ce61ef181bd023ae33b10cee60ad78746042ab22101e63b7f
3
+ size 48532099
data/java/test-00016.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33e2c7054452ee3c5df01b6592f03b9e09a19d3cb01c643b3cabcbef3e5dce82
3
+ size 60605587
data/java/test-00017.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36b0e685162e94039c572b31ad29d4b82b12b9de7f194e84aa0db8dfc02937ba
3
+ size 47339597
data/java/test-00018.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9fa30072b96e94cd3a51417dd19918a90ce40fc356c7ad9dc80d50d62a179da0
3
+ size 47897598
data/java/test-00019.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8163abcf469f38982e1cd6f989f537665b4eda3749e8d643d00e76c92db73a3
3
+ size 44655640
data/java/test-00020.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:895ad7a6209a9a9f64ab9397c73bcd31ac62973c7ced47597143138ca40d5435
3
+ size 44899660
data/java/test-00021.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce732ee944abb10676f096ac48944dc41a7eb833464df2ba09cb492183f68bdb
3
+ size 45005684
data/java/test-00022.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2809e74d614efa2062b7c26ca459a4cc2bd524d43cb1ec16dff1fdf146f3dabf
3
+ size 51275762
data/java/test-00023.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1cb0d27a053aaf4827b523799e5f242b9d4fd939f36f9eed61ad44027d60b263
3
+ size 46276794
data/java/test-00024.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c48a4b52d9e384dcce4746891798b0e29481480770cd0f872123612c2f190016
3
+ size 49838271
data/java/test-00025.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5905592194763307e4190a24740111b75e1082c097457f928d38b500d4b2c1f2
3
+ size 38230283
data/java/test-00026.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e746fbfe58094bfa294375cd23e2dfd932c6598d6220b0cb36abe5a75b916b0
3
+ size 37785685
data/java/test-00027.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:569baec3b6f8b8c385159e82c677a8a9f09453eca55e8f8fb47c1e9e0e74f6b0
3
+ size 48828297
data/java/test-00028.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0fe580e68f921ae68fd8a218aa292fc7d46e4defa1dac5d4b5fa47ae6916a7c
3
+ size 62810511
data/java/test-00029.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:679bdeae0239e59f52724f7c00bc79f203b84ec914a303e8b339024caf82f087
3
+ size 44320430
data/java/test-00030.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90b686fbd9ea822aa2697e9e6f3cc8a8020b3c6835569fee1b74ab8792cf4bd8
3
+ size 46687656
data/java/test-00031.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8bf36c36ea6c1a4ce41eebb60e00b0ccc7037ea6fb57def9a9991b9e8033ba23
3
+ size 20528144
data/java/test-00032.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea9eab7dc3519db484c9a932f38999a5762365c2f276d3ad95a8751f2b0095fb
3
+ size 16947130
data/java/test-00033.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8cc57dab1eb7a3c8de0b777a2b3086e47840e5288d97dc089717fb070abcab18
3
+ size 16722936
data/java/test-00034.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7abfa1f572e6018f460ce714aa93ea6cd92678a17476169cccc18d6d584dee43
3
+ size 53041681
data/java/test-00035.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:caedb9053d656618e62010d17451bf81d659832c9908cb5b996f7017d1694bfc
3
+ size 35189303
data/java/test-00036.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d13a7751bd611490295238dbfff682dff5dab4d9bf2df985512cc281915a4e2b
3
+ size 34142916
data/java/test-00037.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cba81877d40572b0a186de470b5c6e224f0679653af67f01005d6661753719f8
3
+ size 40828839
data/java/test-00038.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:425b2fd5950fb5488a8ed4aa6d1fff212b6e5fde1fa7ac3fa47d08cda2ae0290
3
+ size 65912766
data/java/test-00039.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75b0810e2164a66a91c6766b7261e8a295ac31a038ca3fc3ece759e983aaf8ca
3
+ size 47621687
data/java/test-00040.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e134aeb6f04fe990fabc5ff280dbff5681e5bef7b1a4871f27b4e68cead990d6
3
+ size 53378167
data/java/test-00041.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51d88eef6a742caf4342eda91096fc401ff368ce6af0a5276cf33a412f341a11
3
+ size 48517839
data/java/test-00042.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d86a0e6aa093edd0e0247b94608cd932ea764898dd5647ffaaab5beb49f41a2
3
+ size 17106703
data/java/test-00043.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eed694690532b93a35d5e266af7f63570c4303323db2991fa935ed5c48639bce
3
+ size 56049669
data/java/test-00044.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c15b948bbdc3caf4fb885e6f4c3d7ae3da0896d726fb9032c68dbbc0fa2afe3c
3
+ size 63768233