C-to-Rust migration is an active agenda, but no dataset pairs the two languages at the level of whole solutions to a shared problem. We present CRUSTPairs, 1857 C/Rust implementation pairs drawn from competitive programming archives, normalised, deduplicated, and stratified into difficulty tiers by zero-shot cross-language embedding similarity, with perrecord provenance and licensing. Cross-language retrieval is hard on this data, and harder than a single baseline would suggest: TF-IDF over shared identifiers reaches MRR 0.21 and so beats a pretrained code model at 0.19, which on the hardest quarter of the data scores 1.7x chance. Finetuning reaches 0.79, and lifts that hardest quarter 10x. Renaming every user identifier settles what is being learned: the finetuned models keep 96-97% of their accuracy without them, while the pretrained model keeps 66% - less than the lexical baseline does - and on structurally divergent pairs the finetuned models are better without identifiers than with them.
Figures & tables
Dataset
Languages
Paired
Rust
CodeNet [ 6 ]
55
no
no
POJ-104 [ 7 ]
1
n/a
no
xCodeEval [ 8 ]
17
yes
no
XLCoST [ 3 ]
7
yes
no
CoST [ 4 ]
7
yes
no
AVATAR [ 5 ]
2
yes
no
TABLE I: Cross-language code corpora. CRUSTPairs is the only one pairing C with Rust at solution granularity. Language counts are as reported by each corpus.
Field
Values
problem_id
0001 – 1886 , inherited
origin
codenet (839), xcodeeval (1018)
license
SPDX expression; follows origin
problem_description
upstream statement, verbatim; _format is html (839) or text (1018)
c_code , rust_code
entry points renamed solution
difficulty
easy (465), medium (928), hard (464); _score is the raw similarity
TABLE II: Schema. One JSON object per line of dataset.jsonl ; all fields are strings except difficulty_score .
Mean
Median
p90
Max
C, characters
616
516
1046
16460
Rust, characters
851
749
1424
4888
Statement, chars
1459
1231
2717
7368
C, lines
33.6
Rust, lines
31.4
TABLE III: Size of the two sides and of the problem statements, in characters. The C maximum is a single 16460-character outlier; the next longest is 4649.
Source
Easy
Medium
Hard
Total
CodeNet (AtCoder)
241
408
190
839
xCodeEval (Codeforces)
224
520
274
1018
Total
465
928
464
1857
TABLE IV: Composition by source and difficulty tier.
Model
MRR
MRR@10
R@1
R@5
R@10
Chance
0.031
0.016
0.005
0.027
0.053
Lexical TF-IDF
0.206
0.191
0.128
0.273
0.353
UniXcoder, zero-shot
0.189
0.170
0.134
0.203
0.283
UniXcoder + LoRA
0.724
0.720
0.624
0.836
0.913
UniXcoder, full
0.792
0.791
0.706
0.909
0.952
TABLE V: Cross-language retrieval on the 187-pair test set.
Model
Easy
Medium
Hard
Ret.
Lexical TF-IDF
.446 → .355
.144 → .094
.089 → .080
76%
UniXcoder zero-shot
.328 → .276
.186 → .084
.053 → .048
66%
UniXcoder + LoRA
.957 → .941
.776 → .688
.388 → .429
96%
UniXcoder, full
.979 → .951
.821 → .756
.550 → .611
97%
TABLE VI: MRR by difficulty tier, with identifiers kept → renamed. Every tier is scored against the same 187-candidate pool; only the queries are partitioned. Ret. is the anonymised overall MRR as a fraction of the normal one.
Model
Tier
MRR
MRR@10
R@1
R@5
Lexical
easy
0.446
0.439
0.319
0.596
medium
0.144
0.122
0.075
0.183
hard
0.089
0.077
0.043
0.128
Zero-shot
easy
0.328
0.313
0.234
0.383
medium
0.186
0.164
0.140
0.194
hard
0.053
0.040
0.021
0.043
TABLE VII: Test-split metrics by difficulty tier, identifiers kept. LoRA is the mean over four seeds.
Model
CodeNet (84)
xCodeEval (103)
Lexical TF-IDF
0.266
0.158
UniXcoder, zero-shot
0.217
0.165
UniXcoder + LoRA
0.770
0.687
UniXcoder, full
0.814
0.775
TABLE VIII: Test-split MRR by source, identifiers kept. The two portions have slightly different tier mixes; reweighting accounts for 35% of the LoRA gap and 57% of the smaller full-finetune one.
Code translation converts programs between languages, frameworks, and representations while aiming to preserve behavior and sometimes improve safety or performance.