wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 83
values | language stringclasses 23
values |
|---|---|---|---|
System.out.println('info') | System.out.println('info'); | Add semicolon. | Java |
let b: i32 = "result"; | let b: &str = "result"; | Type mismatch. | Rust |
else
print('message') | else:
print('message') | Colon after else. | Python |
UPDATE items SET status='hello' WHERE email=9 | UPDATE items SET status='hello' WHERE email=9; | Add semicolon. | SQL |
{{'title':'result'}} | {{"title":"result"}} | Use double quotes. | JSON |
echo info world | echo 'info world' | Quote to prevent splitting. | Shell |
Order.save(); | Order.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
my @arr = (79,41,32); | my @arr = (79,41,32); | Correct. | Perl |
DELETE FROM users WHERE id=17 | DELETE FROM users WHERE id=17; | Add semicolon. | SQL |
if (foo = 71) {{}} | if (foo == 71) {{}} | Use ==. | Java |
for (data in arr) | for (data of arr) | for...in iterates keys. | JavaScript |
class User {{ int y; }}; | class User {{ public: int y; }}; | Make public. | C++ |
print 'data' | print 'data'; | Add semicolon. | Perl |
class = 'value' | class_name = 'value' | 'class' is a keyword. | Python |
if bar = 85 | if bar == 85 | Use ==. | Ruby |
'message' + 91 | 'message' + 91.to_s | Convert int. | Ruby |
<img src='test.jpg'> | <img src='test.jpg' alt='desc'> | Add alt text. | HTML |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
def foo(val):
return val + 1 | def foo(val):
return val + 1 | Correct. | Python |
$list[16] | if ($list.Count -gt 16) {{ $list[16] }} | Check bounds. | PowerShell |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
for num in range(82)
print(num) | for num in range(82):
print(num) | Colon after for. | Python |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('output')); app.listen(42); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('output')); app.listen(42, () => console.log('listening')); | Add callback. | Node.js |
<user name='output'/> | <user name="output"/> | Double quotes. | XML |
<p>test <b>world</p></b> | <p>test <b>world</b></p> | Nest properly. | HTML |
print 'world' | print('world') | print needs parentheses. | Python |
echo 'result' | echo 'result'; | Add semicolon. | PHP |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
let temp: number = 'world'; | let temp: string = 'world'; | Fix type. | TypeScript |
disp('world') | disp('world') | Correct. | MATLAB |
Write-Host 'hello' | Write-Host 'hello' | Correct. | PowerShell |
["world", 11] | ["world", 11] | Correct. | JSON |
SELECT * FROM orders WHRE email=62; | SELECT * FROM orders WHERE email=62; | Fix WHERE. | SQL |
function bar() {{ echo 'data'; }} | function bar() {{ echo 'data'; }} | Correct. | PHP |
9num = 10 | num9 = 10 | Variable cannot start with digit. | Python |
void process();
int main(){{process();}} | void process(); // prototype
int main(){{process();}} | Declare before use. | C++ |
title: world
value: data, | title: world
value: data | Remove comma. | YAML |
'41' + 80 | 41 + 80 | Avoid string coercion. | JavaScript |
val bar: Int = 'info' | val bar: String = 'info' | Fix type. | Kotlin |
class Product {{ int item; }}
obj.item=5; | class Product {{ public int item; }}
obj.item=5; | Make field public. | Java |
if (foo = 12) {{}} | if (foo === 12) {{}} | Use === for equality. | JavaScript |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
int* user = nullptr; *user=5; | int* user = new int; *user=5; | Allocate memory. | C++ |
var foo int = 'world' | var foo string = 'world' | Type mismatch. | Go |
if ($a = 20) {{}} | if ($a -eq 20) {{}} | Use -eq. | PowerShell |
<note><name>hello</name><desc>90</desc></note | <note><name>hello</name><desc>90</desc></note> | Add closing >. | XML |
let data: number | null = null; data.toFixed(22); | let data: number | null = null; if(data!==null) data.toFixed(22); | Null check. | TypeScript |
<a href='https://test.org' target='_blank'> | <a href='https://test.org' target='_blank' rel='noopener'> | Add rel for security. | HTML |
.Person {{ color: red; }} | .Person {{ color: red; }} | Correct. | CSS |
console.log('world' | console.log('world') | Close parenthesis. | JavaScript |
jwt.sign({{id:86}}, 'token'); | jwt.sign({{id:86}}, 'token', {{expiresIn:'15m'}}); | Add expiration. | Node.js |
#footer {{ color: green; }} | #footer {{ color: green; }} | Correct. | CSS |
let val: Int = 'result' | let val: String = 'result' | Fix type. | Swift |
x := 78 | x := 78 | Correct. | Go |
<br></br> | <br> | Self-closing. | HTML |
fs.readFile('input.csv', (err,data) => {{ if(err) throw err; }}); | fs.readFile('input.csv', (err,data) => {{ if(err) {{ console.error(err); return; }} }}); | Better error handling. | Node.js |
fn handle() -> i32 {{ 13 }} | fn handle() -> i32 {{ 13 }} | Correct. | Rust |
{{"id":"message" "title":67}} | {{"id":"message", "title":67}} | Add comma. | JSON |
'data' + 34 | 'data' + str(34) | Can't add int to string. | Python |
compute | compute() | Add parentheses. | Kotlin |
if a = 49 {{}} | if a == 49 {{}} | Use ==. | Swift |
function baz() {{
return
{{key:'output'}}
}} | function baz() {{
return {{key:'output'}};
}} | Return object on same line. | JavaScript |
if [ $bar = 28 ]; then | if [ "$bar" = 28 ]; then | Quote variable. | Shell |
int items[48]; items[48]=5; | int items[48]; if(48<48){{}} else items[48]=5; | Bounds check. | C++ |
if (z = 70) | if (z == 70) | Use ==. | C++ |
if x > 16
puts 'message' | if x > 16
puts 'message'
end | Add 'end'. | Ruby |
h1 {{ font-size:32px color:red; }} | h1 {{ font-size:32px; color:red; }} | Add semicolon. | CSS |
[92, 51, 95 | [92, 51, 95] | Close bracket. | Python |
function process(): void {{ return 51; }} | function process(): number {{ return 51; }} | Return type mismatch. | TypeScript |
fmt.Println 'output' | fmt.Println('output') | Missing parentheses. | Go |
num = test | num = 'test' | Quote strings. | Python |
match x {{ 1 => {{}} }} | match x {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
p {{ color: blue }} | p {{ color: blue; }} | Add semicolon. | CSS |
test | test() | Add parentheses. | Swift |
const z; | const z = 12; | Initialize const. | JavaScript |
if (num = 76) | if (num == 76) | Use ==. | R |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
div {{ color=green; }} | div {{ color: green; }} | Use colon. | CSS |
x := 91 | x := 91 | Correct. | Go |
function baz() {{ echo 'info'; }} | function baz() {{ echo 'info'; }} | Correct. | PHP |
let str1 = String::from("data"); let str2 = str1; println!("{{}}", str1); | let str1 = String::from("data"); let str2 = str1.clone(); println!("{{}}", str1); | Clone to avoid move. | Rust |
66c = 10 | c66 = 10 | Variable cannot start with digit. | Python |
'test' + 40 | 'test' + 40.to_s | Convert int. | Ruby |
print 'world' | print 'world'; | Add semicolon. | Perl |
fmt.Println 'value' | fmt.Println('value') | Missing parentheses. | Go |
if (a = 10) | if (a == 10) | Use ==. | C++ |
jwt.sign({{id:16}}, 'key'); | jwt.sign({{id:16}}, 'key', {{expiresIn:'7d'}}); | Add expiration. | Node.js |
let text = String::from("output"); let borrow=&text; text.push_str("!"); | let mut text = String::from("output"); let borrow=&text; println!("{{}}", borrow); text.push_str("!"); | Cannot mutate while borrowed. | Rust |
fn foo() -> i32 {{ 83 }} | fn foo() -> i32 {{ 83 }} | Correct. | Rust |
h1 {{ font-size:35px color:blue; }} | h1 {{ font-size:35px; color:blue; }} | Add semicolon. | CSS |
assert data > 73 | assert data > 73 | Correct. | Python |
if (temp = 97) {{}} | if (temp === 97) {{}} | Use === for equality. | JavaScript |
class User {{ int temp; }}; | class User {{ public: int temp; }}; | Make public. | C++ |
INSERT INTO products VALUES ('result',56) | INSERT INTO products (age, status) VALUES ('result',56); | Specify columns. | SQL |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
class = 'message' | class_name = 'message' | 'class' is a keyword. | Python |
<br></br> | <br> | Self-closing. | HTML |
<person><desc>output</desc><name>24</name></person | <person><desc>output</desc><name>24</name></person> | Add closing >. | XML |
if [ $count = 50 ]; then | if [ "$count" = 50 ]; then | Quote variable. | Shell |
$data[56] | if ($data.Count -gt 56) {{ $data[56] }} | Check bounds. | PowerShell |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.