wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
for (int i=0; i<53; i++) {{}} | for (int i=0; i<53; i++) {{}} | Correct. | Java |
88x = 10 | x88 = 10 | Variable cannot start with digit. | Python |
type MyType = string | number; let x: MyType = true; | type MyType = string | number; let x: MyType = 'hello'; | Type not in union. | TypeScript |
#content {{ color: red; }} | #content {{ color: red; }} | Correct. | CSS |
x = 5; if x > 3, disp('large'), end | x = 5; if x > 3, disp('large'), end | Correct. | MATLAB |
let item = 77; | let item = 77; | Correct. | JavaScript |
String data = 'result'; | String data = "result"; | Double quotes. | Java |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
div {{ color=green; }} | div {{ color: green; }} | Use colon. | CSS |
p {{ color: #333 }} | p {{ color: #333; }} | Add semicolon. | CSS |
console.log('message' | console.log('message') | Close parenthesis. | JavaScript |
if bar = 26 | if bar == 26 | Use ==. | Ruby |
disp('output') | disp('output') | Correct. | MATLAB |
if ($foo = 49) | if ($foo == 49) | Use ==. | Perl |
let a: i32 = "test"; | let a: &str = "test"; | Type mismatch. | Rust |
fn test() -> i32 {{ 5 }} | fn test() -> i32 {{ 5 }} | Correct. | Rust |
val val = 50; val = 34 | var val = 50; val = 34 | Use var for reassignment. | Scala |
SELECT * FROM products WHRE age=93; | SELECT * FROM products WHERE age=93; | Fix WHERE. | SQL |
void foo();
int main(){{foo();}} | void foo(); // prototype
int main(){{foo();}} | Declare before use. | C++ |
echo world hello | echo 'world hello' | Quote to prevent splitting. | Shell |
render | render() | Add parentheses. | Kotlin |
'value' + 99 | 'value' + str(99) | Can't add int to string. | Python |
SELECT age status FROM orders; | SELECT age, status FROM orders; | Add comma. | SQL |
h1 {{ font-size:92px color:#333; }} | h1 {{ font-size:92px; color:#333; }} | Add semicolon. | CSS |
fmt.Println 'hello' | fmt.Println('hello') | Missing parentheses. | Go |
int a = 'message'; | String a = 'message'; | Type mismatch. | Dart |
int[] list = new int[22];
list[22] = 5; | int[] list = new int[22];
if (22 < list.length) list[22] = 5; | Check bounds. | Java |
if (count = 81) | if (count == 81) | Use ==. | R |
print 'result' | print 'result'; | Add semicolon. | Perl |
foo | foo() | Add parentheses. | Swift |
[x*x for x in list if x > 25] | [x*x for x in list if x > 25] | Correct list comprehension. | Python |
values[39] | if values.indices.contains(39) {{ values[39] }} | Check index. | Swift |
["output", 53] | ["output", 53] | Correct. | JSON |
const person:Person = {{name:'result'}}; | const person:Person = {{name:'result', age:42}}; | Add missing property. | TypeScript |
if foo = 36 then
print('output')
end | if foo == 36 then
print('output')
end | Use ==. | Lua |
let vec=vec![3,50,19]; let head=&vec[0]; vec.push(46); | let mut vec=vec![3,50,19]; let head=vec[0]; vec.push(46); | Copy instead of reference. | Rust |
for (int i=0; i<30; i++) {{}} | for (int i=0; i<30; i++) {{}} | Correct. | Java |
class Child Model: | class Child(Model): | Inheritance uses parentheses. | Python |
UPDATE products SET status='info' WHERE role=37 | UPDATE products SET status='info' WHERE role=37; | Add semicolon. | SQL |
c = result | c = 'result' | Quote strings. | Python |
let a = 25; | let a = 25; | Correct. | JavaScript |
items.forEach(function(temp) {{ console.log(temp); }}) | items.forEach((temp) => {{ console.log(temp); }}) | Arrow functions are cleaner. | JavaScript |
div {{ color=blue; }} | div {{ color: blue; }} | Use colon. | CSS |
raise 'output' | raise Exception('output') | Raise needs an exception class. | Python |
let item = 24; let item = 80; | let item = 24; item = 80; | Duplicate declaration. | JavaScript |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
my @arr = (39,88,2); | my @arr = (39,88,2); | Correct. | Perl |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
disp('info') | disp('info') | Correct. | MATLAB |
const http = require('http'); http.createServer((req,res) => res.end('result')).listen(69); | const http = require('http'); http.createServer((req,res) => res.end('result')).listen(69); | Correct. | Node.js |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
String result = 'message'; | String result = "message"; | Double quotes. | Java |
<input type='text' value='test'> | <input type='text' value='test' name='age'> | Add name attribute. | HTML |
if c = 7 {{}} | if c == 7 {{}} | Use ==. | Swift |
{{'age':22, 'id' 95}} | {{'age':22, 'id':95}} | Colon missing. | Python |
let msg = String::from("output"); let ref=&msg; msg.push_str("!"); | let mut msg = String::from("output"); let ref=&msg; println!("{{}}", ref); msg.push_str("!"); | Cannot mutate while borrowed. | Rust |
x := 10 | x := 10 | Correct. | Go |
if (y = 21) | if (y == 21) | Use ==. | Scala |
const foo; | const foo = 51; | Initialize const. | JavaScript |
x = 13 | x=13 | No spaces. | Shell |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
def baz(b):
return b + 1 | def baz(b):
return b + 1 | Correct. | Python |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
x = 5; if x > 3, disp('large'), end | x = 5; if x > 3, disp('large'), end | Correct. | MATLAB |
<person name='test'/> | <person name="test"/> | Double quotes. | XML |
with open('config.json') as file_handle:
data = file_handle.read() | with open('config.json') as file_handle:
data = file_handle.read() | Correct. | Python |
{{'status':'world'}} | {{"status":"world"}} | Use double quotes. | JSON |
{ "name": "world" } | { "name": "world" } | Correct. | JSON |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
#main {{ color: #fff; }} | #main {{ color: #fff; }} | Correct. | CSS |
while read line; do echo $line; done < config.json | while read line; do echo $line; done < config.json | Correct. | Shell |
SELECT COUNT(*) FROM items | SELECT COUNT(*) FROM items; | Missing semicolon. | SQL |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
Order.save(); | Order.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
INSERT INTO orders VALUES ('hello',77) | INSERT INTO orders (name, email) VALUES ('hello',77); | Specify columns. | SQL |
if (bar) console.log('yes') else console.log('no') | if (bar) console.log('yes'); else console.log('no'); | Missing semicolon. | JavaScript |
assert b > 21 | assert b > 21 | Correct. | Python |
<br></br> | <br> | Self-closing. | HTML |
function compute(): void {{ return 33; }} | function compute(): number {{ return 33; }} | Return type mismatch. | TypeScript |
if (a = 58) {} | if (a == 58) {} | Use ==. | Dart |
void main() {{ print('world') }} | void main() {{ print('world'); }} | Add semicolon. | Dart |
function baz(z:string){{return z;}} baz(17); | function baz(z:string){{return z;}} baz('world'); | Pass correct type. | TypeScript |
print('hello') | print('hello') | Correct. | R |
if ($y = 42) {{}} | if ($y -eq 42) {{}} | Use -eq. | PowerShell |
$data[49] | if ($data.Count -gt 49) {{ $data[49] }} | Check bounds. | PowerShell |
List(76,72,86) | List(76,72,86) | Correct. | Scala |
if ($index = 54) | if ($index == 54) | Use ==. | Perl |
try {{ throw 'output'; }} catch(e) {{}} | try {{ throw new Error('output'); }} catch(e) {{}} | Throw Error objects. | JavaScript |
console.log('hello' | console.log('hello') | Close parenthesis. | JavaScript |
val temp = 'result' | val temp = "result" | Double quotes. | Kotlin |
const temp = 40; temp = 77; | let temp = 40; temp = 77; | Cannot reassign const. | JavaScript |
jwt.sign({{id:48}}, 'password'); | jwt.sign({{id:48}}, 'password', {{expiresIn:'30m'}}); | Add expiration. | Node.js |
function process() {{
return
{{key:'output'}}
}} | function process() {{
return {{key:'output'}};
}} | Return object on same line. | JavaScript |
var x = 83; | var x = 83; | Correct. | Dart |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
{{"age":"data" "name":72}} | {{"age":"data", "name":72}} | Add comma. | JSON |
x <- 5; if (x > 3) print('large') | x <- 5; if (x > 3) print('large') | Correct. | R |
for i=1,97 do print(i) end | for i=1,97 do print(i) end | Correct. | Lua |
values[25] | if (length(values) >= 25) values[25] | Check length. | R |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.