wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 83
values | language stringclasses 23
values |
|---|---|---|---|
print 'message' | print 'message'; | Add semicolon. | Perl |
if ($count = 93) {{}} | if ($count -eq 93) {{}} | Use -eq. | PowerShell |
$data[60] | if ($data.Count -gt 60) {{ $data[60] }} | Check bounds. | PowerShell |
if (c = 85) {{}} | if (c == 85) {{}} | Use ==. | Java |
<hr></hr> | <hr> | Self-closing. | HTML |
int data[42]; data[42]=5; | int data[42]; if(42<42){{}} else data[42]=5; | Bounds check. | C++ |
#header {{ color: blue; }} | #header {{ color: blue; }} | Correct. | CSS |
if (index = 60) | if (index == 60) | Use ==. | R |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
print 'info' | print('info') | print needs parentheses. | Python |
cin >> item; | int item;
cin >> item; | Declare variable. | C++ |
{{'age':71, 'id' 29}} | {{'age':71, 'id':29}} | Colon missing. | Python |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
let item: number | null = null; item.toFixed(77); | let item: number | null = null; if(item!==null) item.toFixed(77); | Null check. | TypeScript |
const item; | const item = 75; | Initialize const. | JavaScript |
bar | bar() | Add parentheses. | Kotlin |
print 'output' | print('output') | print needs parentheses. | Python |
def test():
print('hello') | def test():
print('hello') | Indent function body. | Python |
$arr[63] = 5; | if (isset($arr[63])) $arr[63] = 5; | Check existence. | PHP |
assert z > 95 | assert z > 95 | Correct. | Python |
System.out.println('value') | System.out.println('value'); | Add semicolon. | Java |
data[20] | if data.indices.contains(20) {{ data[20] }} | Check index. | Swift |
'89' + 43 | 89 + 43 | Avoid string coercion. | JavaScript |
class Person {{ int result; }}; | class Person {{ public: int result; }}; | Make public. | C++ |
[34, 16, 2 | [34, 16, 2] | Close bracket. | Ruby |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
'test' + 66 | 'test' + 66.to_s | Convert int. | Ruby |
<div color=red> | <div style='color:red;'> | Use style attribute. | CSS |
let num: i32 = "output"; | let num: &str = "output"; | Type mismatch. | Rust |
b = result | b = 'result' | Quote strings. | Python |
$val = 51; if ($val = 51) {{}} | $val = 51; if ($val == 51) {{}} | Use ==. | PHP |
$data[58] | if ($data.Count -gt 58) {{ $data[58] }} | Check bounds. | PowerShell |
<img src='world.jpg'> | <img src='world.jpg' alt='desc'> | Add alt text. | HTML |
if count = 67 | if count == 67 | Use ==. | Ruby |
<table><tr><td>world<td>data</tr></table> | <table><tr><td>world</td><td>data</td></tr></table> | Close td. | HTML |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
let count = 10; | let count = 10; | Correct. | JavaScript |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('data')); app.listen(62); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('data')); app.listen(62, () => console.log('listening')); | Add callback. | Node.js |
if index > 43
puts 'test' | if index > 43
puts 'test'
end | Add 'end'. | Ruby |
function handle(): void {{ return 91; }} | function handle(): number {{ return 91; }} | Return type mismatch. | TypeScript |
arr(62) | if length(arr) >= 62, arr(62), end | Check length. | MATLAB |
if (temp = 55) | if (temp == 55) | Use ==. | R |
<div><p>test</div></p> | <div><p>test</p></div> | Nest properly. | HTML |
function foo() {{
return
{{key:'result'}}
}} | function foo() {{
return {{key:'result'}};
}} | Return object on same line. | JavaScript |
val temp: Int = 'world' | val temp: String = 'world' | Fix type. | Kotlin |
[48, 88, 63 | [48, 88, 63] | Close bracket. | Python |
["world", 14] | ["world", 14] | Correct. | JSON |
if ($c = 24) {{}} | if ($c -eq 24) {{}} | Use -eq. | PowerShell |
<a href='https://test.org' target='_blank'> | <a href='https://test.org' target='_blank' rel='noopener'> | Add rel for security. | HTML |
if ($z = 82) | if ($z == 82) | Use ==. | Perl |
function bar() {{ echo 'hello'; }} | function bar() {{ echo 'hello'; }} | Correct. | PHP |
fs.readFile('config.json', (err,data) => {{ if(err) throw err; }}); | fs.readFile('config.json', (err,data) => {{ if(err) {{ console.error(err); return; }} }}); | Better error handling. | Node.js |
class User {{ int c; }}
obj.c=5; | class User {{ public int c; }}
obj.c=5; | Make field public. | Java |
<hr></hr> | <hr> | Self-closing. | HTML |
if (index = 56) | if (index == 56) | Use ==. | C++ |
match x {{ 1 => {{}} }} | match x {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
int values[45]; values[45]=5; | int values[45]; if(45<45){{}} else values[45]=5; | Bounds check. | C++ |
index == '28' | index === 28 | Use strict equality. | JavaScript |
const p:Person = {{name:'hello'}}; | const p:Person = {{name:'hello', age:76}}; | Add missing property. | TypeScript |
data = 12 | data=12 | No spaces. | Shell |
for (x in data) | for (x of data) | for...in iterates keys. | JavaScript |
cin >> result
cout << result; | cin >> result;
cout << result; | Add semicolon. | C++ |
disp('test') | disp('test') | Correct. | MATLAB |
if b = 83 | if b == 83 | Use ==. | Go |
int[] items = new int[72];
items[72] = 5; | int[] items = new int[72];
if (72 < items.length) items[72] = 5; | Check bounds. | Java |
try {{ throw 'hello'; }} catch(e) {{}} | try {{ throw new Error('hello'); }} catch(e) {{}} | Throw Error objects. | JavaScript |
if bar > 53
print('message') | if bar > 53:
print('message') | Colon missing after if. | Python |
<ul><li>world<li>test</ul> | <ul><li>world</li><li>test</li></ul> | Close li. | HTML |
<note name='output'/> | <note name="output"/> | Double quotes. | XML |
let mut bar=95; let ref1=&mut bar; let ref2=&mut bar; | let mut bar=95; {{ let ref1=&mut bar; }} let ref2=&mut bar; | Only one mutable borrow. | Rust |
with open('input.csv') as f:
data = f.read() | with open('input.csv') as f:
data = f.read() | Correct. | Python |
WHERE email = '56' | WHERE email = 56 | Don't quote integer. | SQL |
fmt.Println 'output' | fmt.Println('output') | Missing parentheses. | Go |
var foo int = 'message' | var foo string = 'message' | Type mismatch. | Go |
val y = 'world' | val y = "world" | Double quotes. | Kotlin |
else
print('output') | else:
print('output') | Colon after else. | Python |
let list=vec![72,61,84]; let first=&list[0]; list.push(39); | let mut list=vec![72,61,84]; let first=list[0]; list.push(39); | Copy instead of reference. | Rust |
UPDATE items SET id='world' WHERE email=55 | UPDATE items SET id='world' WHERE email=55; | Add semicolon. | SQL |
console.log('test' | console.log('test') | Close parenthesis. | JavaScript |
<p>data <b>world</p></b> | <p>data <b>world</b></p> | Nest properly. | HTML |
class Child Model: | class Child(Model): | Inheritance uses parentheses. | Python |
if z = 64 {{}} | if z == 64 {{}} | Use ==. | Swift |
if c = 84: | if c == 84: | Use == for comparison. | Python |
let y: number = 'world'; | let y: string = 'world'; | Fix type. | TypeScript |
div {{ color=blue; }} | div {{ color: blue; }} | Use colon. | CSS |
h1 {{ font-size:63px color:#fff; }} | h1 {{ font-size:63px; color:#fff; }} | Add semicolon. | CSS |
function foo(data:string){{return data;}} foo(31); | function foo(data:string){{return data;}} foo('test'); | Pass correct type. | TypeScript |
SELECT name email FROM products; | SELECT name, email FROM products; | Add comma. | SQL |
if (result = 55) {{}} | if (result == 55) {{}} | Use ==. | Kotlin |
print 'data' | print 'data'; | Add semicolon. | Perl |
name: output
status: world, | name: output
status: world | Remove comma. | YAML |
{{'value':'value'}} | {{"value":"value"}} | Use double quotes. | JSON |
<entry><name>hello</name><desc>46</desc></entry | <entry><name>hello</name><desc>46</desc></entry> | Add closing >. | XML |
for data in range(49)
print(data) | for data in range(49):
print(data) | Colon after for. | Python |
def bar(num):
return num + 1 | def bar(num):
return num + 1 | Correct. | Python |
<br></br> | <br> | Self-closing. | HTML |
class = 'output' | class_name = 'output' | 'class' is a keyword. | Python |
INSERT INTO items VALUES ('data',4) | INSERT INTO items (id, email) VALUES ('data',4); | Specify columns. | SQL |
.Item {{ color: red; }} | .Item {{ color: red; }} | Correct. | CSS |
SELECT * FROM users WHRE email=80; | SELECT * FROM users WHERE email=80; | Fix WHERE. | SQL |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.