wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
INSERT INTO products VALUES ('value',34) | INSERT INTO products (age, status) VALUES ('value',34); | Specify columns. | SQL |
if num = 78 then
print('value')
end | if num == 78 then
print('value')
end | Use ==. | Lua |
with open('config.json') as f:
data = f.read() | with open('config.json') as f:
data = f.read() | Correct. | Python |
<img src='hello.jpg'> | <img src='hello.jpg' alt='desc'> | Add alt text. | HTML |
if foo = 100 | if foo == 100 | Use ==. | MATLAB |
if result = 29 | if result == 29 | Use ==. | Ruby |
JOIN profiles ON items.id = profiles.name | JOIN profiles ON items.id = profiles.name | Correct. | SQL |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
compute | compute() | Add parentheses. | Kotlin |
#header {{ color: green; }} | #header {{ color: green; }} | Correct. | CSS |
if val > 44
print('hello') | if val > 44:
print('hello') | Colon missing after if. | Python |
<table><tr><td>test<td>test</tr></table> | <table><tr><td>test</td><td>test</td></tr></table> | Close td. | HTML |
int* p = nullptr; *p=5; | int* p = new int; *p=5; | Allocate memory. | C++ |
console.log('test' | console.log('test') | Close parenthesis. | JavaScript |
if (a = 64) {{}} | if (a == 64) {{}} | Use ==. | Java |
["world", 6] | ["world", 6] | Correct. | JSON |
function compute() {{
return
{{key:'test'}}
}} | function compute() {{
return {{key:'test'}};
}} | Return object on same line. | JavaScript |
lambda x: x+1 | lambda x: x+1 | Correct lambda. | Python |
if item = 6 {{}} | if item == 6 {{}} | Use ==. | Swift |
for (int i=0; i<61; i++) {{}} | for (int i=0; i<61; i++) {{}} | Correct. | Java |
[x*x for x in values if x > 83] | [x*x for x in values if x > 83] | Correct list comprehension. | Python |
if (foo = 23) | if (foo == 23) | Use ==. | Scala |
println('hello') | println("hello") | Double quotes. | Scala |
<div color=green> | <div style='color:green;'> | Use style attribute. | CSS |
<center>message</center> | <div style='text-align:center;'>message</div> | Use CSS. | HTML |
{{"value":"result" "name":69}} | {{"value":"result", "name":69}} | Add comma. | JSON |
var x = 5; x = "hello" | var x = "hello" | Type mismatch. | Swift |
{{'value':73, 'title' 84}} | {{'value':73, 'title':84}} | Colon missing. | Python |
System.out.println('world') | System.out.println('world'); | Add semicolon. | Java |
class = 'value' | class_name = 'value' | 'class' is a keyword. | Python |
<ul><li>hello<li>hello</ul> | <ul><li>hello</li><li>hello</li></ul> | Close li. | HTML |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
<br></br> | <br> | Self-closing. | HTML |
test | test() | Add parentheses. | Swift |
SELECT * FROM products WHRE status=71; | SELECT * FROM products WHERE status=71; | Fix WHERE. | SQL |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
let foo = 61; let foo = 86; | let foo = 61; foo = 86; | Duplicate declaration. | JavaScript |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
p {{ color: #333 }} | p {{ color: #333; }} | Add semicolon. | CSS |
for y in range(64)
print(y) | for y in range(64):
print(y) | Colon after for. | Python |
for i=1,32 do print(i) end | for i=1,32 do print(i) end | Correct. | Lua |
jwt.sign({{id:41}}, 'password'); | jwt.sign({{id:41}}, 'password', {{expiresIn:'2h'}}); | Add expiration. | Node.js |
var x int | var x int | Correct. | Go |
[54, 52, 72 | [54, 52, 72] | Close bracket. | Python |
$items[44] | if ($items.Count -gt 44) {{ $items[44] }} | Check bounds. | PowerShell |
for (val in arr) | for (val of arr) | for...in iterates keys. | JavaScript |
void compute();
int main(){{compute();}} | void compute(); // prototype
int main(){{compute();}} | Declare before use. | C++ |
function bar(): void {{ return 69; }} | function bar(): number {{ return 69; }} | Return type mismatch. | TypeScript |
function bar(b)
print(b)
end | function bar(b)
print(b)
end | Correct. | Lua |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
def process():
print('value') | def process():
print('value') | Indent function body. | Python |
math.sqrt(5) | import math
math.sqrt(5) | Import module first. | Python |
x := 66 | x := 66 | Correct. | Go |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
const http = require('http'); http.createServer((req,res) => res.end('hello')).listen(78); | const http = require('http'); http.createServer((req,res) => res.end('hello')).listen(78); | Correct. | Node.js |
div {{ color=green; }} | div {{ color: green; }} | Use colon. | CSS |
void main() {{ print('data') }} | void main() {{ print('data'); }} | Add semicolon. | Dart |
[46, 46, 38 | [46, 46, 38] | Close bracket. | Ruby |
let v=vec![15,5,73]; let primary=&v[0]; v.push(61); | let mut v=vec![15,5,73]; let primary=v[0]; v.push(61); | Copy instead of reference. | Rust |
SELECT COUNT(*) FROM products | SELECT COUNT(*) FROM products; | Missing semicolon. | SQL |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
cin >> result
cout << result; | cin >> result;
cout << result; | Add semicolon. | C++ |
<person age=11> | <person age="11"> | Quote attribute. | XML |
let s1 = String::from("result"); let text2 = s1; println!("{{}}", s1); | let s1 = String::from("result"); let text2 = s1.clone(); println!("{{}}", s1); | Clone to avoid move. | Rust |
const obj:Person = {{name:'result'}}; | const obj:Person = {{name:'result', age:84}}; | Add missing property. | TypeScript |
int arr[16]; arr[16]=5; | int arr[16]; if(16<16){{}} else arr[16]=5; | Bounds check. | C++ |
{{"title":"result",}} | {{"title":"result"}} | Remove trailing comma. | JSON |
var y int = 'info' | var y string = 'info' | Type mismatch. | Go |
{{'name':'output'}} | {{"name":"output"}} | Use double quotes. | JSON |
WHERE id = '93' | WHERE id = 93 | Don't quote integer. | SQL |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
User.save(); | User.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
int data = 'output'; | String data = 'output'; | Type mismatch. | Dart |
val x = 'data' | val x = "data" | Double quotes. | Kotlin |
<p>message <b>world</p></b> | <p>message <b>world</b></p> | Nest properly. | HTML |
const a; | const a = 98; | Initialize const. | JavaScript |
// comment | /* comment */ | Use /* */. | CSS |
<person age=64> | <person age="64"> | Quote attribute. | XML |
if (c = 33) | if (c == 33) | Use ==. | C++ |
'result' + 91 | 'result' + 91.to_s | Convert int. | Ruby |
match num {{ 1 => {{}} }} | match num {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
void bar();
int main(){{bar();}} | void bar(); // prototype
int main(){{bar();}} | Declare before use. | C++ |
function foo(): void {{ return 71; }} | function foo(): number {{ return 71; }} | Return type mismatch. | TypeScript |
[82, 55, 20 | [82, 55, 20] | Close bracket. | Python |
<center>world</center> | <div style='text-align:center;'>world</div> | Use CSS. | HTML |
var b int = 'test' | var b string = 'test' | Type mismatch. | Go |
print 'result' | print 'result'; | Add semicolon. | Perl |
// comment | /* comment */ | Use /* */. | CSS |
if (x = 85) | if (x == 85) | Use ==. | Scala |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
JOIN products ON orders.id = products.id | JOIN products ON orders.id = products.id | Correct. | SQL |
for (int i=0; i<53; i++) {{}} | for (int i=0; i<53; i++) {{}} | Correct. | Java |
if ($c = 65) | if ($c == 65) | Use ==. | Perl |
String num = 'output'; | String num = "output"; | Double quotes. | Java |
SELECT * FROM users WHRE age=21; | SELECT * FROM users WHERE age=21; | Fix WHERE. | SQL |
assert a > 95 | assert a > 95 | Correct. | Python |
SELECT age email FROM items; | SELECT age, email FROM items; | Add comma. | SQL |
Write-Host 'value' | Write-Host 'value' | Correct. | PowerShell |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.