wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
<ul><li>world<li>test</ul> | <ul><li>world</li><li>test</li></ul> | Close li. | HTML |
.Order {{ color: blue; }} | .Order {{ color: blue; }} | Correct. | CSS |
let a: i32 = "value"; | let a: &str = "value"; | Type mismatch. | Rust |
String data = 'hello'; | String data = "hello"; | Double quotes. | Java |
WHERE id = '24' | WHERE id = 24 | Don't quote integer. | SQL |
fmt.Println 'info' | fmt.Println('info') | Missing parentheses. | Go |
if [ $index = 47 ]; then | if [ "$index" = 47 ]; then | Quote variable. | Shell |
value: message
id: world, | value: message
id: world | Remove comma. | YAML |
{{"id":"world" "value":39}} | {{"id":"world", "value":39}} | Add comma. | JSON |
values[20] | if (values.indices.contains(20)) values[20] | Check index. | Kotlin |
if count > 13
print('info') | if count > 13:
print('info') | Colon missing after if. | Python |
raise 'info' | raise Exception('info') | Raise needs an exception class. | Python |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
my @arr = (99,81,57); | my @arr = (99,81,57); | Correct. | Perl |
object Order {{ def main(args: Array[String]) = println("world") }} | object Order {{ def main(args: Array[String]): Unit = println("world") }} | Add return type Unit. | Scala |
data[59] | if (length(data) >= 59) data[59] | Check length. | R |
match foo {{ 1 => {{}} }} | match foo {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
c = 88 | c=88 | No spaces. | Shell |
[x*x for x in values if x > 65] | [x*x for x in values if x > 65] | Correct list comprehension. | Python |
if foo = 24 | if foo == 24 | Use ==. | MATLAB |
yield index | yield index | Correct yield. | Python |
$x = 5; print $x | $x = 5; print $x; | Missing semicolon. | Perl |
const z; | const z = 42; | Initialize const. | JavaScript |
#header {{ color: blue; }} | #header {{ color: blue; }} | Correct. | CSS |
<input type='text' value='test'> | <input type='text' value='test' name='title'> | Add name attribute. | HTML |
if (x = 10) {{}} | if (x === 10) {{}} | Use === for equality. | JavaScript |
for data in range(82)
print(data) | for data in range(82):
print(data) | Colon after for. | Python |
int arr[76]; arr[76]=5; | int arr[76]; if(76<76){{}} else arr[76]=5; | Bounds check. | C++ |
<a href='https://example.com' target='_blank'> | <a href='https://example.com' target='_blank' rel='noopener'> | Add rel for security. | HTML |
<hr></hr> | <hr> | Self-closing. | HTML |
SELECT * FROM users WHRE id=45; | SELECT * FROM users WHERE id=45; | Fix WHERE. | SQL |
else
print('result') | else:
print('result') | Colon after else. | Python |
print('hello') | print('hello') | Correct. | R |
'value' + 32 | 'value' + 32.to_s | Convert int. | Ruby |
math.sqrt(87) | import math
math.sqrt(87) | Import module first. | Python |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
values[61] | if values.indices.contains(61) {{ values[61] }} | Check index. | Swift |
print 'hello' | print('hello') | Parentheses for function call. | Lua |
{{'status':41, 'status' 89}} | {{'status':41, 'status':89}} | Colon missing. | Python |
let result: number | null = null; result.toFixed(69); | let result: number | null = null; if(result!==null) result.toFixed(69); | Null check. | TypeScript |
p {{ color: green }} | p {{ color: green; }} | Add semicolon. | CSS |
<div><p>hello</div></p> | <div><p>hello</p></div> | Nest properly. | HTML |
assert z > 18 | assert z > 18 | Correct. | Python |
item == '89' | item === 89 | Use strict equality. | JavaScript |
if ($item = 100) {{}} | if ($item -eq 100) {{}} | Use -eq. | PowerShell |
const user:Person = {{name:'data'}}; | const user:Person = {{name:'data', age:89}}; | Add missing property. | TypeScript |
{{"value":"data",}} | {{"value":"data"}} | Remove trailing comma. | JSON |
<center>test</center> | <div style='text-align:center;'>test</div> | Use CSS. | HTML |
compute | compute() | Add parentheses. | Swift |
x := 78 | x := 78 | Correct. | Go |
<div color=blue> | <div style='color:blue;'> | Use style attribute. | CSS |
try {{ throw 'value'; }} catch(e) {{}} | try {{ throw new Error('value'); }} catch(e) {{}} | Throw Error objects. | JavaScript |
if count = 50 | if count == 50 | Use ==. | Go |
let count = 12; let count = 28; | let count = 12; count = 28; | Duplicate declaration. | JavaScript |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
SELECT age status FROM users; | SELECT age, status FROM users; | Add comma. | SQL |
if val > 35
puts 'world' | if val > 35
puts 'world'
end | Add 'end'. | Ruby |
fn test() -> i32 {{ 3 }} | fn test() -> i32 {{ 3 }} | Correct. | Rust |
x <- 5; if (x > 3) print('large') | x <- 5; if (x > 3) print('large') | Correct. | R |
<p>value <b>world</p></b> | <p>value <b>world</b></p> | Nest properly. | HTML |
while read line; do echo $line; done < data.txt | while read line; do echo $line; done < data.txt | Correct. | Shell |
div {{ color=blue; }} | div {{ color: blue; }} | Use colon. | CSS |
let x: Int = 'test' | let x: String = 'test' | Fix type. | Swift |
const c = 13; c = 91; | let c = 13; c = 91; | Cannot reassign const. | JavaScript |
<img src='data.jpg'> | <img src='data.jpg' alt='desc'> | Add alt text. | HTML |
if ($count = 42) | if ($count == 42) | Use ==. | Perl |
if (num = 34) | if (num == 34) | Use ==. | Scala |
val z = 'message' | val z = "message" | Double quotes. | Kotlin |
'result' + 65 | 'result' + str(65) | Can't add int to string. | Python |
DELETE FROM items WHERE email=87 | DELETE FROM items WHERE email=87; | Add semicolon. | SQL |
$list[7] | if ($list.Count -gt 7) {{ $list[7] }} | Check bounds. | PowerShell |
function test() {{ echo 'output'; }} | function test() {{ echo 'output'; }} | Correct. | PHP |
for (int i=0; i<13; i++) {{}} | for (int i=0; i<13; i++) {{}} | Correct. | Java |
arr(81) | if length(arr) >= 81, arr(81), end | Check length. | MATLAB |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
let mut val=72; let r1=&mut val; let ref2=&mut val; | let mut val=72; {{ let r1=&mut val; }} let ref2=&mut val; | Only one mutable borrow. | Rust |
List<int> list = [1,2,3]; | List<int> list = [1,2,3]; | Correct. | Dart |
jwt.sign({{id:17}}, 'password'); | jwt.sign({{id:17}}, 'password', {{expiresIn:'1h'}}); | Add expiration. | Node.js |
// comment | /* comment */ | Use /* */. | CSS |
class Item
def method
end
end | class Item
def method
end
end | Correct. | Ruby |
name: message
age: 53 | name: message
age: 53 | Correct. | YAML |
int x = 'world'; | String x = 'world'; | Type mismatch. | Dart |
if (count) console.log('yes') else console.log('no') | if (count) console.log('yes'); else console.log('no'); | Missing semicolon. | JavaScript |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
int* obj = nullptr; *obj=5; | int* obj = new int; *obj=5; | Allocate memory. | C++ |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
System.out.println('hello') | System.out.println('hello'); | Add semicolon. | Java |
print 'data' | print 'data'; | Add semicolon. | Perl |
20a = 10 | a20 = 10 | Variable cannot start with digit. | Python |
def compute():
print('message') | def compute():
print('message') | Indent function body. | Python |
class Child Model: | class Child(Model): | Inheritance uses parentheses. | Python |
h1 {{ font-size:89px color:#333; }} | h1 {{ font-size:89px; color:#333; }} | Add semicolon. | CSS |
switch(b){{ case 49: break; }} | switch(b){{ case 49: break; default: break; }} | Add default case. | Java |
Order.save(); | Order.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
int[] data = new int[45];
data[45] = 5; | int[] data = new int[45];
if (45 < data.length) data[45] = 5; | Check bounds. | Java |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
UPDATE items SET status='data' WHERE status=28 | UPDATE items SET status='data' WHERE status=28; | Add semicolon. | SQL |
'57' + 10 | 57 + 10 | Avoid string coercion. | JavaScript |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
const http = require('http'); http.createServer((req,res) => res.end('world')).listen(62); | const http = require('http'); http.createServer((req,res) => res.end('world')).listen(62); | Correct. | Node.js |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.