This file is generated for E2E parsing.
Document ID: o584ffzhk0g-mfruaoia
This document contains a variety of concise, self-contained code examples across multiple programming languages, demonstrating common patterns, data structures, I/O, and control flow to exercise parsing in a realistic yet compact way.
Each example includes a short description followed by a fenced code block.
Where helpful, examples may include brief variations in syntax or structure so the parser encounters a wider range of constructs across different ecosystems.
This snippet demonstrates summing the numbers in an array using JavaScript's reduce. It showcases a concise, functional approach.
const nums = [1, 2, 3, 4, 5];
const total = nums.reduce((acc, n) => acc + n, 0);
console.log(total);
SQL query that groups by name and orders by count descending.
SELECT name, COUNT(*) AS c
FROM users
GROUP BY name
ORDER BY c DESC;
Demonstrates Kotlin data classes and the copy method. Encourages immutable-style updates.
data class User(val id:Int, val name:String, val active:Boolean)
fun main(){
val u1 = User(1, "Ada", true)
val u2 = u1.copy(active = false)
println(u2)
}