[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,98 +2,168 @@
|
||||
id: wiki-2026-0508-google-code-jam-dataset
|
||||
title: Google Code Jam Dataset
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-A3BFE1]
|
||||
aliases: [GCJ Dataset, Code Jam Solutions Corpus, GCJ-297]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
tags: [auto-reinforced]
|
||||
source_trust_level: B
|
||||
confidence_score: 0.85
|
||||
verification_status: applied
|
||||
tags: [dataset, code-llm, benchmark, programming-competition, deduplication]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
github_commit: "[P-Reinforce] Continuous Worker - Google Code Jam Dataset"
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: python
|
||||
framework: huggingface-datasets
|
||||
---
|
||||
|
||||
# [[Google Code Jam Dataset|Google Code Jam Dataset]]
|
||||
# Google Code Jam Dataset
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> Google Code Jam Dataset은 구글의 코딩 대회인 Google Code Jam 참가자들이 작성한 소스 코드 해결책들을 모아놓은 데이터셋입니다 [1]. 대회 특성상 코딩 스타일, 가이드라인, 포맷팅에 대한 제약이 없기 때문에 개발자 각자의 고유한 프로그래밍 스타일이 그대로 반영되어 있습니다 [1]. 이러한 특성과 높은 정답(Ground Truth) 순도 덕분에 기계학습을 활용한 코드 스타일로미트리(Code Stylometry, 작성자 식별) 및 소프트웨어 포렌식 연구에서 가장 인기 있고 널리 사용되는 벤치마크 데이터셋 중 하나입니다 [1], [2], [3].
|
||||
## 매 한 줄
|
||||
> **"매 Google Code Jam 의 매 historical archive — 매 code clone detection / code LLM evaluation 의 standard corpus"**. Google 의 매 annual programming competition (2003-2023) 이 매 retire 되었지만 매 solution corpus 는 매 academic 으로 풍부 — 매 multiple solutions per problem, 매 다양한 언어 — 매 code clone, code translation, code-LM benchmark 의 raw material. 매 가장 많이 인용되는 매 GCJ-297 (Bui et al.) 로 매 297 problem × multiple langs.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
* **데이터셋의 구조적 특성**
|
||||
Google Code Jam Dataset의 가장 큰 장점은 여러 작성자가 **동일한 문제에 대한 해결책(Semantic uniformity)**을 제공한다는 점입니다 [4]. 이는 머신러닝 분류기가 코드의 의미적(Semantic) 내용이 아닌 작성자 간의 '스타일적 차이'만을 온전히 학습하도록 강제할 수 있게 합니다 [4], [5]. 또한 양적으로도 균형 잡힌 구성을 제공하여 데이터의 불균형 문제 없이 일관된 분석이 가능합니다 [4]. 다만 실제 소프트웨어 개발과는 달리, 코딩 대회 특성상 입출력 처리 등에서 재사용되는 보일러플레이트 코드가 다수 포함될 수 있다는 한계도 존재합니다 [6].
|
||||
## 매 핵심
|
||||
|
||||
* **코드 스타일로미트리(작성자 식별) 연구에서의 활용**
|
||||
이 데이터셋은 소스 코드뿐만 아니라 컴파일된 실행 파일의 작성자를 식별하는 연구에도 폭넓게 활용되었습니다 [7], [5].
|
||||
* **소스 코드 분석:** Caliskan-Islam 등은 2008-2014년 대회의 C/C++ 제출물을 활용해 최대 1,600명의 프로그래머를 90% 이상의 정확도로 식별하는 연구를 수행했습니다 [2], [8]. 파이썬 코드를 모은 부분 집합인 *gcjpy* 데이터셋(70명의 작성자, 총 700개 파일)은 AST(추상 구문 트리) 및 CST(구체 구문 트리) 기반의 분류기를 통한 연구나 코드 포맷팅 및 축소(Minification)가 작성자 식별에 미치는 영향을 분석하는 데 사용되었습니다 [1], [4], [9].
|
||||
* **실행 바이너리 분석:** Rosenblum 등과 Caliskan-Islam 등은 C/C++ 데이터셋을 사용하여 프로그래머의 코딩 스타일이 컴파일 과정을 거친 후에도 바이너리(실행 파일)에 보존된다는 것을 입증하는 데 활용했습니다 [7], [10], [5].
|
||||
### 매 dataset 의 특이성
|
||||
- **Same-intent, varied implementations**: 매 단일 problem 에 매 thousands of correct solutions — 매 semantic equivalence 가 ground truth.
|
||||
- **Multi-language**: C++, Java, Python, Go, Kotlin, …
|
||||
- **Difficulty stratification**: Qualification → Round 1/2/3 → World Finals.
|
||||
- **Test cases**: official input/output 이 partial 공개 (sample only) — full hidden.
|
||||
|
||||
* **적대적 환경(Adversarial) 연구**
|
||||
Simko 등은 인간 프로그래머가 다른 사람의 코딩 스타일을 의도적으로 모방하거나 자신의 스타일을 숨기려 할 때 기존의 기계학습 기반 작성자 식별 모델이 얼마나 취약한지를 평가하는 사용자 연구에서 이 데이터셋을 활용했습니다 [11], [12].
|
||||
### 매 main variants
|
||||
1. **GCJ-297** (Bui et al. 2017): 297 problems, ~120k solutions, code clone benchmark.
|
||||
2. **CodeNet** (IBM 2021): 매 GCJ + AIZU — 14M solutions, 4053 problems, 55 langs (superset).
|
||||
3. **MBXP / HumanEval-X**: 매 not GCJ-derived 지만 매 같은 비교 대상 benchmark.
|
||||
4. **APPS**: Codeforces + AtCoder + Code Jam mix — 매 LLM coding benchmark.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** Programming & Language 분야의 자동 자산화 수행.
|
||||
### 매 use cases
|
||||
- **Code clone detection**: 매 Type-1/2/3/4 clone 의 ground truth.
|
||||
- **Code LLM eval**: 매 contamination 위험 매 큼 — 매 Code Jam 매 GitHub 에 publicly indexed.
|
||||
- **Translation**: 매 Java solution → 매 Python solution.
|
||||
- **Style transfer**: 매 verbose vs 매 idiomatic.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** Code Stylometry, Authorship Attribution, Abstract Syntax Tree (AST), [[Concrete Syntax Tree (CST)|Concrete Syntax Tree (CST]]
|
||||
- **Projects/Contexts:** Google Code Jam, Machine Learning for Source Code
|
||||
- **Contradictions/Notes:** 소스에 따르면 Google Code Jam 데이터셋은 높은 순도와 통제된 환경을 제공하여 식별 모델 학습에 매우 적합하지만 [3], 실제 프로덕션 환경의 코드와는 달리 대회 특유의 반복적인 보일러플레이트 코드가 다수 포함되어 있어 실제 현실의 소프트웨어(In the wild)를 대상으로 할 때와는 차이가 발생할 수 있다는 점이 지적됩니다 [6].
|
||||
## 💻 패턴
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-19*
|
||||
### Loading via Hugging Face
|
||||
```python
|
||||
from datasets import load_dataset
|
||||
|
||||
---
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
# CodeNet (largest superset including GCJ)
|
||||
ds = load_dataset("Project-CodeNet/codenet", split="train", streaming=True)
|
||||
for ex in ds.take(3):
|
||||
print(ex["problem_id"], ex["language"], ex["status"], len(ex["code"]))
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Filter for GCJ subset only
|
||||
```python
|
||||
gcj = ds.filter(lambda x: x["dataset_origin"] == "google_code_jam")
|
||||
print(gcj.info.splits)
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Group solutions by problem_id (clone-detection setup)
|
||||
```python
|
||||
from collections import defaultdict
|
||||
buckets = defaultdict(list)
|
||||
for ex in gcj:
|
||||
if ex["status"] == "Accepted":
|
||||
buckets[ex["problem_id"]].append(ex)
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
# Pair within bucket = positive (clone), across bucket = negative
|
||||
positive_pairs = [(a, b) for sols in buckets.values()
|
||||
for a, b in itertools.combinations(sols, 2)]
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Decontamination check (LLM training data)
|
||||
```python
|
||||
import hashlib
|
||||
def near_dup_hash(code: str, k=5) -> set[int]:
|
||||
tokens = code.split()
|
||||
return {hash(' '.join(tokens[i:i+k])) for i in range(len(tokens) - k)}
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
train_hashes = set()
|
||||
for ex in train_corpus:
|
||||
train_hashes |= near_dup_hash(ex["code"])
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
contaminated = [
|
||||
ex for ex in gcj_eval
|
||||
if len(near_dup_hash(ex["code"]) & train_hashes) / max(1, len(near_dup_hash(ex["code"]))) > 0.5
|
||||
]
|
||||
print(f"contamination ratio: {len(contaminated) / len(gcj_eval):.2%}")
|
||||
```
|
||||
|
||||
### Compile + run sandbox (judging on test cases)
|
||||
```python
|
||||
import subprocess, tempfile, pathlib
|
||||
|
||||
def judge(code: str, lang: str, stdin: str, expected: str, timeout=5):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
p = pathlib.Path(d) / ("sol." + {"python": "py", "cpp": "cpp"}[lang])
|
||||
p.write_text(code)
|
||||
if lang == "cpp":
|
||||
subprocess.run(["g++", "-O2", "-std=c++20", str(p), "-o", f"{d}/a"], check=True)
|
||||
cmd = [f"{d}/a"]
|
||||
else:
|
||||
cmd = ["python3", str(p)]
|
||||
try:
|
||||
r = subprocess.run(cmd, input=stdin, capture_output=True, text=True, timeout=timeout)
|
||||
return r.stdout.strip() == expected.strip()
|
||||
except subprocess.TimeoutExpired:
|
||||
return False
|
||||
```
|
||||
|
||||
### Train/eval split for code translation
|
||||
```python
|
||||
import random
|
||||
random.seed(0)
|
||||
problems = list(buckets.keys())
|
||||
random.shuffle(problems)
|
||||
train_pids = set(problems[:int(0.9 * len(problems))])
|
||||
|
||||
train, eval = [], []
|
||||
for pid, sols in buckets.items():
|
||||
java = [s for s in sols if s["language"] == "java"]
|
||||
py = [s for s in sols if s["language"] == "python"]
|
||||
pairs = list(itertools.product(java, py))
|
||||
(train if pid in train_pids else eval).extend(
|
||||
{"src": j["code"], "tgt": p["code"]} for j, p in pairs
|
||||
)
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Code clone benchmark | GCJ-297 (Bui et al.) |
|
||||
| LLM coding eval | APPS or HumanEval (less contaminated) |
|
||||
| Code translation | CodeNet pair-wise |
|
||||
| Style benchmark | GCJ multi-solution per problem |
|
||||
| Live evaluation | NEVER use GCJ alone (contamination) |
|
||||
|
||||
**기본값**: 매 LLM eval — APPS/HumanEval 매 main + GCJ 매 supplementary.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Code Datasets]] · [[Code LLM Benchmarks]]
|
||||
- 변형: [[CodeNet]] · [[APPS Dataset]] · [[HumanEval]]
|
||||
- 응용: [[Code Clone Detection]] · [[Code Translation]] · [[LLM Coding Eval]]
|
||||
- Adjacent: [[Codeforces Dataset]] · [[LeetCode Solutions Corpus]] · [[Decontamination]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 dataset filter pipeline 작성, contamination 검사 design, problem grouping logic.
|
||||
**언제 X**: 매 LLM 자체 평가 — 매 GCJ 가 매 training data 에 포함되어 있을 확률 높음 (contamination).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **GCJ for SOTA LLM eval without dedup**: 매 contamination 으로 매 score inflation.
|
||||
- **Sample IO 만 사용**: 매 wrong-answer 가 매 test-case 통과 가능.
|
||||
- **No timeout in judging**: 매 infinite loop 으로 OOM/hang.
|
||||
- **Mixing accepted + WA**: 매 ground truth 의 정확성 저하.
|
||||
- **Ignoring problem difficulty**: 매 stratified eval 필수.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Bui et al. ICSE 2017, IBM Project CodeNet 2021, Hugging Face Hub).
|
||||
- 신뢰도 B (semi-public, scraped).
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — GCJ corpus + CodeNet usage + decontamination |
|
||||
|
||||
Reference in New Issue
Block a user