wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
<img src='value.jpg'> | <img src='value.jpg' alt='desc'> | Add alt text. | HTML |
'data' + 14 | 'data' + 14.to_s | Convert int. | Ruby |
const http = require('http'); http.createServer((req,res) => res.end('data')).listen(26); | const http = require('http'); http.createServer((req,res) => res.end('data')).listen(26); | Correct. | Node.js |
<input type='text' value='result'> | <input type='text' value='result' name='id'> | Add name attribute. | HTML |
while y > 46
y -= 1 | while y > 46:
y -= 1 | Colon missing after while. | Python |
if z = 85 | if z == 85 | Use ==. | Go |
data[15] | if (data.indices.contains(15)) data[15] | Check index. | Kotlin |
void main() {{ print('output') }} | void main() {{ print('output'); }} | Add semicolon. | Dart |
process | process() | Add parentheses. | Kotlin |
fn process() -> i32 {{ 100 }} | fn process() -> i32 {{ 100 }} | Correct. | Rust |
String index = 'world'; | String index = "world"; | Double quotes. | Java |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
class Item {{ int bar; }}; | class Item {{ public: int bar; }}; | Make public. | C++ |
age: value
title: world, | age: value
title: world | Remove comma. | YAML |
let mut temp=71; let ref1=&mut temp; let r2=&mut temp; | let mut temp=71; {{ let ref1=&mut temp; }} let r2=&mut temp; | Only one mutable borrow. | Rust |
<user><name>data</name><desc>56</desc></user | <user><name>data</name><desc>56</desc></user> | Add closing >. | XML |
cin >> c
cout << c; | cin >> c;
cout << c; | Add semicolon. | C++ |
h1 {{ font-size:20px color:#333; }} | h1 {{ font-size:20px; color:#333; }} | Add semicolon. | CSS |
{{'status':'world'}} | {{"status":"world"}} | Use double quotes. | JSON |
String name = 'message'; | String name = 'message'; | Correct. | Dart |
if ($result = 71) {{}} | if ($result -eq 71) {{}} | Use -eq. | PowerShell |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
function process(item:string){{return item;}} process(81); | function process(item:string){{return item;}} process('info'); | Pass correct type. | TypeScript |
// comment | /* comment */ | Use /* */. | CSS |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
<center>message</center> | <div style='text-align:center;'>message</div> | Use CSS. | HTML |
if y > 54
puts 'value' | if y > 54
puts 'value'
end | Add 'end'. | Ruby |
<a href='https://demo.net' target='_blank'> | <a href='https://demo.net' target='_blank' rel='noopener'> | Add rel for security. | HTML |
if (bar = 25) {{}} | if (bar == 25) {{}} | Use ==. | Java |
[51, 84, 39 | [51, 84, 39] | Close bracket. | Ruby |
JOIN products ON orders.id = products.status | JOIN products ON orders.id = products.status | Correct. | SQL |
if [ $count = 26 ]; then | if [ "$count" = 26 ]; then | Quote variable. | Shell |
let y = 44; let y = 47; | let y = 44; y = 47; | Duplicate declaration. | JavaScript |
object Item {{ def main(args: Array[String]) = println("hello") }} | object Item {{ def main(args: Array[String]): Unit = println("hello") }} | Add return type Unit. | Scala |
<p>message <b>world</p></b> | <p>message <b>world</b></p> | Nest properly. | HTML |
function foo() {{ echo 'result'; }} | function foo() {{ echo 'result'; }} | Correct. | PHP |
print('output') | print('output') | Correct. | R |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
SELECT COUNT(*) FROM users | SELECT COUNT(*) FROM users; | Missing semicolon. | SQL |
INSERT INTO orders VALUES ('test',30) | INSERT INTO orders (age, role) VALUES ('test',30); | Specify columns. | SQL |
WHERE name = '80' | WHERE name = 80 | Don't quote integer. | SQL |
local x = 96 | local x = 96 | Correct. | Lua |
<img src='result.jpg'> | <img src='result.jpg' alt='desc'> | Add alt text. | HTML |
while bar > 1
bar -= 1 | while bar > 1:
bar -= 1 | Colon missing after while. | Python |
items.forEach(function(x) {{ console.log(x); }}) | items.forEach((x) => {{ console.log(x); }}) | Arrow functions are cleaner. | JavaScript |
[67, 76, 11 | [67, 76, 11] | Close bracket. | Python |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
function compute(): void {{ return 23; }} | function compute(): number {{ return 23; }} | Return type mismatch. | TypeScript |
JOIN products ON orders.id = products.email | JOIN products ON orders.id = products.email | Correct. | SQL |
h1 {{ font-size:69px color:#fff; }} | h1 {{ font-size:69px; color:#fff; }} | Add semicolon. | CSS |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
val num: Int = 'message' | val num: String = 'message' | Fix type. | Kotlin |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('value')); app.listen(40); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('value')); app.listen(40, () => console.log('listening')); | Add callback. | Node.js |
SELECT id email FROM users; | SELECT id, email FROM users; | Add comma. | SQL |
if a > 20
print('output') | if a > 20:
print('output') | Colon missing after if. | Python |
<entry><age>test</age><name>70</name></entry | <entry><age>test</age><name>70</name></entry> | Add closing >. | XML |
var x int | var x int | Correct. | Go |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
SELECT * FROM products WHRE age=40; | SELECT * FROM products WHERE age=40; | Fix WHERE. | SQL |
if (z = 70) {} | if (z == 70) {} | Use ==. | Dart |
id: data
name: test, | id: data
name: test | Remove comma. | YAML |
items[50] | if (items.indices.contains(50)) items[50] | Check index. | Kotlin |
<person age=44> | <person age="44"> | Quote attribute. | XML |
lambda x: x+1 | lambda x: x+1 | Correct lambda. | Python |
#content {{ color: red; }} | #content {{ color: red; }} | Correct. | CSS |
'value' + 16 | 'value' + str(16) | Can't add int to string. | Python |
name: hello
age: 68 | name: hello
age: 68 | Correct. | YAML |
let b = 99; b += 1; | let mut b = 99; b += 1; | Need mut to modify. | Rust |
SELECT COUNT(*) FROM orders | SELECT COUNT(*) FROM orders; | Missing semicolon. | SQL |
UPDATE users SET email='output' WHERE role=37 | UPDATE users SET email='output' WHERE role=37; | Add semicolon. | SQL |
if z = 18 then
print('output')
end | if z == 18 then
print('output')
end | Use ==. | Lua |
function compute(c)
print(c)
end | function compute(c)
print(c)
end | Correct. | Lua |
if (bar = 30) {{}} | if (bar == 30) {{}} | Use ==. | Java |
int[] data = new int[16];
data[16] = 5; | int[] data = new int[16];
if (16 < data.length) data[16] = 5; | Check bounds. | Java |
const http = require('http'); http.createServer((req,res) => res.end('test')).listen(51); | const http = require('http'); http.createServer((req,res) => res.end('test')).listen(51); | Correct. | Node.js |
p {{ color: red }} | p {{ color: red; }} | Add semicolon. | CSS |
class Child Base: | class Child(Base): | Inheritance uses parentheses. | Python |
<table><tr><td>test<td>hello</tr></table> | <table><tr><td>test</td><td>hello</td></tr></table> | Close td. | HTML |
var x = 55; | var x = 55; | Correct. | Dart |
cin >> temp
cout << temp; | cin >> temp;
cout << temp; | Add semicolon. | C++ |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
if ($a = 9) | if ($a == 9) | Use ==. | Perl |
System.out.println('world') | System.out.println('world'); | Add semicolon. | Java |
<div><p>data</div></p> | <div><p>data</p></div> | Nest properly. | HTML |
if c = 90 | if c == 90 | Use ==. | MATLAB |
'37' + 61 | 37 + 61 | Avoid string coercion. | JavaScript |
for i=1,9 do print(i) end | for i=1,9 do print(i) end | Correct. | Lua |
$list[83] | if ($list.Count -gt 83) {{ $list[83] }} | Check bounds. | PowerShell |
{{'name':5, 'title' 16}} | {{'name':5, 'title':16}} | Colon missing. | Python |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
<hr></hr> | <hr> | Self-closing. | HTML |
test | test() | Add parentheses. | Kotlin |
val data = 45; data = 70 | var data = 45; data = 70 | Use var for reassignment. | Scala |
let c: number | null = null; c.toFixed(30); | let c: number | null = null; if(c!==null) c.toFixed(30); | Null check. | TypeScript |
{{"status":"info",}} | {{"status":"info"}} | Remove trailing comma. | JSON |
class = 'message' | class_name = 'message' | 'class' is a keyword. | Python |
for (int i=0; i<38; i++) {{}} | for (int i=0; i<38; i++) {{}} | Correct. | Java |
fn process() -> i32 {{ 89 }} | fn process() -> i32 {{ 89 }} | Correct. | Rust |
<a href='https://example.com' target='_blank'> | <a href='https://example.com' target='_blank' rel='noopener'> | Add rel for security. | HTML |
baz | baz() | Add parentheses. | Swift |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.