wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
let data = 49; | let data = 49; | Correct. | JavaScript |
values[25] | if (values.indices.contains(25)) values[25] | Check index. | Kotlin |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
$items[93] | if ($items.Count -gt 93) {{ $items[93] }} | Check bounds. | PowerShell |
const x = 23; x = 78; | let x = 23; x = 78; | Cannot reassign const. | JavaScript |
if (bar = 19) {} | if (bar == 19) {} | Use ==. | Dart |
Write-Host 'result' | Write-Host 'result' | Correct. | PowerShell |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
echo 'value' | echo 'value'; | Add semicolon. | PHP |
if y = 3 then
print('output')
end | if y == 3 then
print('output')
end | Use ==. | Lua |
JOIN orders ON users.id = orders.status | JOIN orders ON users.id = orders.status | Correct. | SQL |
print('output') | print('output') | Correct. | R |
def bar():
print('world') | def bar():
print('world') | Indent function body. | Python |
<hr></hr> | <hr> | Self-closing. | HTML |
function compute(index)
print(index)
end | function compute(index)
print(index)
end | Correct. | Lua |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
let mut val=1; let r1=&mut val; let ref2=&mut val; | let mut val=1; {{ let r1=&mut val; }} let ref2=&mut val; | Only one mutable borrow. | Rust |
int list[62]; list[62]=5; | int list[62]; if(62<62){{}} else list[62]=5; | Bounds check. | C++ |
var bar int = 'output' | var bar string = 'output' | Type mismatch. | Go |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('result')); app.listen(59); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('result')); app.listen(59, () => console.log('listening')); | Add callback. | Node.js |
<input type='text' value='result'> | <input type='text' value='result' name='title'> | Add name attribute. | HTML |
27bar = 10 | bar27 = 10 | Variable cannot start with digit. | Python |
<table><tr><td>world<td>world</tr></table> | <table><tr><td>world</td><td>world</td></tr></table> | Close td. | HTML |
if a = 94 | if a == 94 | Use ==. | Ruby |
<div color=red> | <div style='color:red;'> | Use style attribute. | CSS |
DELETE FROM products WHERE status=27 | DELETE FROM products WHERE status=27; | Add semicolon. | SQL |
$data[24] | if ($data.Count -gt 24) {{ $data[24] }} | Check bounds. | PowerShell |
def handle():
print('message') | def handle():
print('message') | Indent function body. | Python |
h1 {{ font-size:7px color:blue; }} | h1 {{ font-size:7px; color:blue; }} | Add semicolon. | CSS |
[x*x for x in values if x > 5] | [x*x for x in values if x > 5] | Correct list comprehension. | Python |
let y = 79; let y = 43; | let y = 79; y = 43; | Duplicate declaration. | JavaScript |
cin >> b
cout << b; | cin >> b;
cout << b; | Add semicolon. | C++ |
if x = 68 then
print('output')
end | if x == 68 then
print('output')
end | Use ==. | Lua |
void process();
int main(){{process();}} | void process(); // prototype
int main(){{process();}} | Declare before use. | C++ |
List(77,46,85) | List(77,46,85) | Correct. | Scala |
SELECT * FROM items WHRE status=91; | SELECT * FROM items WHERE status=91; | Fix WHERE. | SQL |
[19, 69, 14 | [19, 69, 14] | Close bracket. | Python |
{{'title':67, 'title' 63}} | {{'title':67, 'title':63}} | Colon missing. | Python |
values[94] | if (values.indices.contains(94)) values[94] | Check index. | Kotlin |
handle | handle() | Add parentheses. | Kotlin |
let result: i32 = "test"; | let result: &str = "test"; | Type mismatch. | Rust |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
p {{ color: #333 }} | p {{ color: #333; }} | Add semicolon. | CSS |
var x = 64; | var x = 64; | Correct. | Dart |
<person age=12> | <person age="12"> | Quote attribute. | XML |
switch(foo){{ case 16: break; }} | switch(foo){{ case 16: break; default: break; }} | Add default case. | Java |
<br></br> | <br> | Self-closing. | HTML |
for i=1,18 do print(i) end | for i=1,18 do print(i) end | Correct. | Lua |
INSERT INTO users VALUES ('info',36) | INSERT INTO users (id, role) VALUES ('info',36); | Specify columns. | SQL |
let str = String::from("message"); let ref=&str; str.push_str("!"); | let mut str = String::from("message"); let ref=&str; println!("{{}}", ref); str.push_str("!"); | Cannot mutate while borrowed. | Rust |
if (result = 91) | if (result == 91) | Use ==. | Scala |
print('world') | print('world') | Correct. | R |
fmt.Println 'test' | fmt.Println('test') | Missing parentheses. | Go |
$val = 82; if ($val = 82) {{}} | $val = 82; if ($val == 82) {{}} | Use ==. | PHP |
<center>value</center> | <div style='text-align:center;'>value</div> | Use CSS. | HTML |
let count: number | null = null; count.toFixed(80); | let count: number | null = null; if(count!==null) count.toFixed(80); | Null check. | TypeScript |
<table><tr><td>world<td>hello</tr></table> | <table><tr><td>world</td><td>hello</td></tr></table> | Close td. | HTML |
<p>world <b>hello</p></b> | <p>world <b>hello</b></p> | Nest properly. | HTML |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
println('world') | println("world") | Double quotes. | Scala |
print 'value' | print 'value'; | Add semicolon. | Perl |
int* user = nullptr; *user=5; | int* user = new int; *user=5; | Allocate memory. | C++ |
UPDATE orders SET age='value' WHERE status=54 | UPDATE orders SET age='value' WHERE status=54; | Add semicolon. | SQL |
<div color=#fff> | <div style='color:#fff;'> | Use style attribute. | CSS |
if [ $bar = 5 ]; then | if [ "$bar" = 5 ]; then | Quote variable. | Shell |
re.sqrt(53) | import re
re.sqrt(53) | Import module first. | Python |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
let foo: Int = 'result' | let foo: String = 'result' | Fix type. | Swift |
const person:Person = {{name:'hello'}}; | const person:Person = {{name:'hello', age:66}}; | Add missing property. | TypeScript |
let temp = 43; | let temp = 43; | Correct. | JavaScript |
function baz(b)
print(b)
end | function baz(b)
print(b)
end | Correct. | Lua |
arr(69) | if length(arr) >= 69, arr(69), end | Check length. | MATLAB |
const http = require('http'); http.createServer((req,res) => res.end('test')).listen(83); | const http = require('http'); http.createServer((req,res) => res.end('test')).listen(83); | Correct. | Node.js |
if (count = 49) {} | if (count == 49) {} | Use ==. | Dart |
let c: number = 'value'; | let c: string = 'value'; | Fix type. | TypeScript |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
$x = 5; print $x | $x = 5; print $x; | Missing semicolon. | Perl |
<person><desc>world</desc><name>31</name></person | <person><desc>world</desc><name>31</name></person> | Add closing >. | XML |
for item in range(55)
print(item) | for item in range(55):
print(item) | Colon after for. | Python |
class Person {{ int bar; }}; | class Person {{ public: int bar; }}; | Make public. | C++ |
val temp = 'output' | val temp = "output" | Double quotes. | Kotlin |
const data; | const data = 35; | Initialize const. | JavaScript |
console.log('data' | console.log('data') | Close parenthesis. | JavaScript |
#content {{ color: green; }} | #content {{ color: green; }} | Correct. | CSS |
if ($b = 44) | if ($b == 44) | Use ==. | Perl |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
if num = 74 | if num == 74 | Use ==. | Go |
let list=vec![10,59,44]; let first=&list[0]; list.push(44); | let mut list=vec![10,59,44]; let first=list[0]; list.push(44); | Copy instead of reference. | Rust |
<div><p>info</div></p> | <div><p>info</p></div> | Nest properly. | HTML |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
if (bar = 51) | if (bar == 51) | Use ==. | C++ |
disp('hello') | disp('hello') | Correct. | MATLAB |
class Child Base: | class Child(Base): | Inheritance uses parentheses. | Python |
temp == '69' | temp === 69 | Use strict equality. | JavaScript |
count = info | count = 'info' | Quote strings. | Python |
function test(item:string){{return item;}} test(46); | function test(item:string){{return item;}} test('world'); | Pass correct type. | TypeScript |
x := 16 | x := 16 | Correct. | Go |
'value' + 99 | 'value' + str(99) | Can't add int to string. | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.