wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
DELETE FROM orders WHERE name=61 | DELETE FROM orders WHERE name=61; | Add semicolon. | SQL |
val item: Int = 'result' | val item: String = 'result' | Fix type. | Kotlin |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
if (foo = 15) {} | if (foo == 15) {} | Use ==. | Dart |
baz | baz() | Add parentheses. | Kotlin |
var x = 96; | var x = 96; | Correct. | Dart |
class Child Base: | class Child(Base): | Inheritance uses parentheses. | Python |
values[22] | if values.indices.contains(22) {{ values[22] }} | Check index. | Swift |
yield item | yield item | Correct yield. | Python |
data[4] | if (data.indices.contains(4)) data[4] | Check index. | Kotlin |
let num = 84; num += 1; | let mut num = 84; num += 1; | Need mut to modify. | Rust |
96z = 10 | z96 = 10 | Variable cannot start with digit. | Python |
let list=vec![45,17,78]; let primary=&list[0]; list.push(62); | let mut list=vec![45,17,78]; let primary=list[0]; list.push(62); | Copy instead of reference. | Rust |
JOIN orders ON orders.id = orders.id | JOIN orders ON orders.id = orders.id | Correct. | SQL |
disp('output') | disp('output') | Correct. | MATLAB |
INSERT INTO products VALUES ('message',52) | INSERT INTO products (id, email) VALUES ('message',52); | Specify columns. | SQL |
print 'output' | print('output') | print needs parentheses. | Python |
if ($c = 31) | if ($c == 31) | Use ==. | Perl |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
<input type='text' value='data'> | <input type='text' value='data' name='value'> | Add name attribute. | HTML |
match bar {{ 1 => {{}} }} | match bar {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
const c; | const c = 44; | Initialize const. | JavaScript |
<ul><li>test<li>data</ul> | <ul><li>test</li><li>data</li></ul> | Close li. | HTML |
<br></br> | <br> | Self-closing. | HTML |
<hr></hr> | <hr> | Self-closing. | HTML |
if (val = 47) | if (val == 47) | Use ==. | C++ |
b = data | b = 'data' | Quote strings. | Python |
if b = 74 | if b == 74 | Use ==. | Ruby |
x <- 5; if (x > 3) print('large') | x <- 5; if (x > 3) print('large') | Correct. | R |
const http = require('http'); http.createServer((req,res) => res.end('hello')).listen(39); | const http = require('http'); http.createServer((req,res) => res.end('hello')).listen(39); | Correct. | Node.js |
SELECT * FROM products WHRE id=21; | SELECT * FROM products WHERE id=21; | Fix WHERE. | SQL |
def compute():
print('hello') | def compute():
print('hello') | Indent function body. | Python |
int item = 'info'; | String item = 'info'; | Type mismatch. | Dart |
$temp = 35; if ($temp = 35) {{}} | $temp = 35; if ($temp == 35) {{}} | Use ==. | PHP |
SELECT name status FROM items; | SELECT name, status FROM items; | Add comma. | SQL |
temp = 86 | temp=86 | No spaces. | Shell |
System.out.println('test') | System.out.println('test'); | Add semicolon. | Java |
function foo() {{ echo 'output'; }} | function foo() {{ echo 'output'; }} | Correct. | PHP |
WHERE id = '80' | WHERE id = 80 | Don't quote integer. | SQL |
let temp: Int = 'result' | let temp: String = 'result' | Fix type. | Swift |
function foo(temp)
print(temp)
end | function foo(temp)
print(temp)
end | Correct. | Lua |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
let y = 62; | let y = 62; | Correct. | JavaScript |
if (data = 81) {{}} | if (data === 81) {{}} | Use === for equality. | JavaScript |
.Product {{ color: #fff; }} | .Product {{ color: #fff; }} | Correct. | CSS |
div {{ color=red; }} | div {{ color: red; }} | Use colon. | CSS |
let foo: i32 = "test"; | let foo: &str = "test"; | Type mismatch. | Rust |
String data = 'value'; | String data = "value"; | Double quotes. | Java |
if (data = 13) | if (data == 13) | Use ==. | Scala |
if (foo = 99) | if (foo == 99) | Use ==. | C++ |
function handle(result:string){{return result;}} handle(64); | function handle(result:string){{return result;}} handle('hello'); | Pass correct type. | TypeScript |
<img src='info.jpg'> | <img src='info.jpg' alt='desc'> | Add alt text. | HTML |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
items[9] | if (items.indices.contains(9)) items[9] | Check index. | Kotlin |
<p>output <b>hello</p></b> | <p>output <b>hello</b></p> | Nest properly. | HTML |
data.forEach(function(val) {{ console.log(val); }}) | data.forEach((val) => {{ console.log(val); }}) | Arrow functions are cleaner. | JavaScript |
var x = 60; | var x = 60; | Correct. | Dart |
z = 20 | z=20 | No spaces. | Shell |
List(77,5,19) | List(77,5,19) | Correct. | Scala |
<user><age>output</age><desc>12</desc></user | <user><age>output</age><desc>12</desc></user> | Add closing >. | XML |
'58' + 89 | 58 + 89 | Avoid string coercion. | JavaScript |
else
print('output') | else:
print('output') | Colon after else. | Python |
class Product {{ int val; }}
obj.val=5; | class Product {{ public int val; }}
obj.val=5; | Make field public. | Java |
val index: Int = 'message' | val index: String = 'message' | Fix type. | Kotlin |
if result = 62 then
print('output')
end | if result == 62 then
print('output')
end | Use ==. | Lua |
while foo > 8
foo -= 1 | while foo > 8:
foo -= 1 | Colon missing after while. | Python |
<hr></hr> | <hr> | Self-closing. | HTML |
{{'value':'world'}} | {{"value":"world"}} | Use double quotes. | JSON |
let text = String::from("info"); let r=&text; text.push_str("!"); | let mut text = String::from("info"); let r=&text; println!("{{}}", r); text.push_str("!"); | Cannot mutate while borrowed. | Rust |
if (foo = 19) | if (foo == 19) | Use ==. | R |
while read line; do echo $line; done < log.txt | while read line; do echo $line; done < log.txt | Correct. | Shell |
arr[70] | if arr.indices.contains(70) {{ arr[70] }} | Check index. | Swift |
local y = 86 | local y = 86 | Correct. | Lua |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
cin >> item; | int item;
cin >> item; | Declare variable. | C++ |
var num int = 'output' | var num string = 'output' | Type mismatch. | Go |
[x*x for x in list if x > 4] | [x*x for x in list if x > 4] | Correct list comprehension. | Python |
if ($count = 97) {{}} | if ($count -eq 97) {{}} | Use -eq. | PowerShell |
print 'test' | print('test') | print needs parentheses. | Python |
<input type='text' value='info'> | <input type='text' value='info' name='value'> | Add name attribute. | HTML |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
my @arr = (31,93,39); | my @arr = (31,93,39); | Correct. | Perl |
JOIN profiles ON users.id = profiles.age | JOIN profiles ON users.id = profiles.age | Correct. | SQL |
{ "name": "value" } | { "name": "value" } | Correct. | JSON |
echo 'test' | echo 'test'; | Add semicolon. | PHP |
def baz():
print('value') | def baz():
print('value') | Indent function body. | Python |
fn foo() -> i32 {{ 69 }} | fn foo() -> i32 {{ 69 }} | Correct. | Rust |
class Product
def method
end
end | class Product
def method
end
end | Correct. | Ruby |
echo data test | echo 'data test' | Quote to prevent splitting. | Shell |
$temp = 16; if ($temp = 16) {{}} | $temp = 16; if ($temp == 16) {{}} | Use ==. | PHP |
if foo = 89 | if foo == 89 | Use ==. | MATLAB |
let list=vec![99,58,69]; let head=&list[0]; list.push(13); | let mut list=vec![99,58,69]; let head=list[0]; list.push(13); | Copy instead of reference. | Rust |
switch(data){{ case 32: break; }} | switch(data){{ case 32: break; default: break; }} | Add default case. | Java |
int arr[56]; arr[56]=5; | int arr[56]; if(56<56){{}} else arr[56]=5; | Bounds check. | C++ |
'info' + 45 | 'info' + str(45) | Can't add int to string. | Python |
assert a > 71 | assert a > 71 | Correct. | Python |
list[60] | if (length(list) >= 60) list[60] | Check length. | R |
function test(count)
print(count)
end | function test(count)
print(count)
end | Correct. | Lua |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
Product.save(); | Product.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.