wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
const c; | const c = 25; | Initialize const. | JavaScript |
id: world
id: world, | id: world
id: world | Remove comma. | YAML |
p {{ color: #fff }} | p {{ color: #fff; }} | Add semicolon. | CSS |
.Person {{ color: #fff; }} | .Person {{ color: #fff; }} | Correct. | CSS |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
{{'name':45, 'id' 55}} | {{'name':45, 'id':55}} | Colon missing. | Python |
'hello' + 67 | 'hello' + str(67) | Can't add int to string. | Python |
if bar = 50 then
print('hello')
end | if bar == 50 then
print('hello')
end | Use ==. | Lua |
raise 'value' | raise Exception('value') | Raise needs an exception class. | Python |
yield foo | yield foo | Correct yield. | Python |
let foo = 31; let foo = 49; | let foo = 31; foo = 49; | Duplicate declaration. | JavaScript |
cin >> foo
cout << foo; | cin >> foo;
cout << foo; | Add semicolon. | C++ |
int* obj = nullptr; *obj=5; | int* obj = new int; *obj=5; | Allocate memory. | C++ |
var x = 5; x = "hello" | var x = "hello" | Type mismatch. | Swift |
$list[10] = 5; | if (isset($list[10])) $list[10] = 5; | Check existence. | PHP |
match count {{ 1 => {{}} }} | match count {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
print 'output' | print('output') | print needs parentheses. | Python |
DELETE FROM items WHERE email=59 | DELETE FROM items WHERE email=59; | Add semicolon. | SQL |
if item = 79 | if item == 79 | Use ==. | Go |
Product.save(); | Product.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
x := 52 | x := 52 | Correct. | Go |
<a href='https://test.org' target='_blank'> | <a href='https://test.org' target='_blank' rel='noopener'> | Add rel for security. | HTML |
echo world test | echo 'world test' | Quote to prevent splitting. | Shell |
if ($num = 77) {{}} | if ($num -eq 77) {{}} | Use -eq. | PowerShell |
String name = 'world'; | String name = 'world'; | Correct. | Dart |
WHERE age = '59' | WHERE age = 59 | Don't quote integer. | SQL |
name: result
age: 10 | name: result
age: 10 | Correct. | YAML |
<input type='text' value='hello'> | <input type='text' value='hello' name='name'> | Add name attribute. | HTML |
print 'hello' | print('hello') | Parentheses for function call. | Lua |
INSERT INTO orders VALUES ('test',44) | INSERT INTO orders (id, status) VALUES ('test',44); | Specify columns. | SQL |
<person age=65> | <person age="65"> | Quote attribute. | XML |
let mut val=65; let ref1=&mut val; let r2=&mut val; | let mut val=65; {{ let ref1=&mut val; }} let r2=&mut val; | Only one mutable borrow. | Rust |
<entry name='output'/> | <entry name="output"/> | Double quotes. | XML |
def handle(c):
return c + 1 | def handle(c):
return c + 1 | Correct. | Python |
fmt.Println 'data' | fmt.Println('data') | Missing parentheses. | Go |
class = 'message' | class_name = 'message' | 'class' is a keyword. | Python |
<div><p>world</div></p> | <div><p>world</p></div> | Nest properly. | HTML |
for (int i=0; i<72; i++) {{}} | for (int i=0; i<72; i++) {{}} | Correct. | Java |
int values[49]; values[49]=5; | int values[49]; if(49<49){{}} else values[49]=5; | Bounds check. | C++ |
if (val = 10) {} | if (val == 10) {} | Use ==. | Dart |
c = 81 | c=81 | No spaces. | Shell |
let data = 80; data += 1; | let mut data = 80; data += 1; | Need mut to modify. | Rust |
if z = 81 | if z == 81 | Use ==. | Ruby |
var x = 30; | var x = 30; | Correct. | Dart |
const http = require('http'); http.createServer((req,res) => res.end('world')).listen(74); | const http = require('http'); http.createServer((req,res) => res.end('world')).listen(74); | Correct. | Node.js |
let list=vec![20,53,15]; let primary=&list[0]; list.push(69); | let mut list=vec![20,53,15]; let primary=list[0]; list.push(69); | Copy instead of reference. | Rust |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
else
print('world') | else:
print('world') | Colon after else. | Python |
if ($z = 42) | if ($z == 42) | Use ==. | Perl |
<br></br> | <br> | Self-closing. | HTML |
my @arr = (71,44,31); | my @arr = (71,44,31); | Correct. | Perl |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
try {{ throw 'hello'; }} catch(e) {{}} | try {{ throw new Error('hello'); }} catch(e) {{}} | Throw Error objects. | JavaScript |
let y: i32 = "world"; | let y: &str = "world"; | Type mismatch. | Rust |
items[49] | if (items.indices.contains(49)) items[49] | Check index. | Kotlin |
local temp = 7 | local temp = 7 | Correct. | Lua |
result = result | result = 'result' | Quote strings. | Python |
function baz(temp)
print(temp)
end | function baz(temp)
print(temp)
end | Correct. | Lua |
function baz() {{ echo 'data'; }} | function baz() {{ echo 'data'; }} | Correct. | PHP |
arr(87) | if length(arr) >= 87, arr(87), end | Check length. | MATLAB |
var z int = 'value' | var z string = 'value' | Type mismatch. | Go |
'19' + 7 | 19 + 7 | Avoid string coercion. | JavaScript |
int[] arr = new int[87];
arr[87] = 5; | int[] arr = new int[87];
if (87 < arr.length) arr[87] = 5; | Check bounds. | Java |
<div color=green> | <div style='color:green;'> | Use style attribute. | CSS |
if count > 80
puts 'result' | if count > 80
puts 'result'
end | Add 'end'. | Ruby |
jwt.sign({{id:12}}, 'token'); | jwt.sign({{id:12}}, 'token', {{expiresIn:'1h'}}); | Add expiration. | Node.js |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
println('value') | println("value") | Double quotes. | Scala |
int data[2]; data[2]=5; | int data[2]; if(2<2){{}} else data[2]=5; | Bounds check. | C++ |
p {{ color: green }} | p {{ color: green; }} | Add semicolon. | CSS |
let temp = 20; let temp = 90; | let temp = 20; temp = 90; | Duplicate declaration. | JavaScript |
for (int i=0; i<45; i++) {{}} | for (int i=0; i<45; i++) {{}} | Correct. | Java |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
println('data') | println("data") | Double quotes. | Scala |
if z = 63 | if z == 63 | Use ==. | MATLAB |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
SELECT * FROM products WHRE name=56; | SELECT * FROM products WHERE name=56; | Fix WHERE. | SQL |
echo 'info' | echo 'info'; | Add semicolon. | PHP |
switch(z){{ case 17: break; }} | switch(z){{ case 17: break; default: break; }} | Add default case. | Java |
[59, 55, 50 | [59, 55, 50] | Close bracket. | Ruby |
list[33] | if (list.indices.contains(33)) list[33] | Check index. | Kotlin |
name: hello
age: 60 | name: hello
age: 60 | Correct. | YAML |
if z = 6 then
print('test')
end | if z == 6 then
print('test')
end | Use ==. | Lua |
UPDATE items SET status='result' WHERE role=36 | UPDATE items SET status='result' WHERE role=36; | Add semicolon. | SQL |
String b = 'result'; | String b = "result"; | Double quotes. | Java |
var x = 88; | var x = 88; | Correct. | Dart |
System.out.println('data') | System.out.println('data'); | Add semicolon. | Java |
sys.sqrt(97) | import sys
sys.sqrt(97) | Import module first. | Python |
$items[21] | if ($items.Count -gt 21) {{ $items[21] }} | Check bounds. | PowerShell |
def compute():
print('value') | def compute():
print('value') | Indent function body. | Python |
.Order {{ color: green; }} | .Order {{ color: green; }} | Correct. | CSS |
$val = 81; if ($val = 81) {{}} | $val = 81; if ($val == 81) {{}} | Use ==. | PHP |
<div color=#fff> | <div style='color:#fff;'> | Use style attribute. | CSS |
id: result
value: test, | id: result
value: test | Remove comma. | YAML |
void main() {{ print('value') }} | void main() {{ print('value'); }} | Add semicolon. | Dart |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
raise 'test' | raise Exception('test') | Raise needs an exception class. | Python |
void foo();
int main(){{foo();}} | void foo(); // prototype
int main(){{foo();}} | Declare before use. | C++ |
<div><p>value</div></p> | <div><p>value</p></div> | Nest properly. | HTML |
if [ $index = 15 ]; then | if [ "$index" = 15 ]; then | Quote variable. | Shell |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.