wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
x <- 5; if (x > 3) print('large') | x <- 5; if (x > 3) print('large') | Correct. | R |
{{'name':'value'}} | {{"name":"value"}} | Use double quotes. | JSON |
local data = 39 | local data = 39 | Correct. | Lua |
data[98] | if (length(data) >= 98) data[98] | Check length. | R |
object Person {{ def main(args: Array[String]) = println("value") }} | object Person {{ def main(args: Array[String]): Unit = println("value") }} | Add return type Unit. | Scala |
if val = 85: | if val == 85: | Use == for comparison. | Python |
if (index = 2) | if (index == 2) | Use ==. | Scala |
[x*x for x in values if x > 17] | [x*x for x in values if x > 17] | Correct list comprehension. | Python |
if (count = 93) | if (count == 93) | Use ==. | C++ |
int foo = 'hello'; | String foo = 'hello'; | Type mismatch. | Dart |
$values[56] | if ($values.Count -gt 56) {{ $values[56] }} | Check bounds. | PowerShell |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
Write-Host 'world' | Write-Host 'world' | Correct. | PowerShell |
def foo
puts 'world'
end | def foo
puts 'world'
end | Correct. | Ruby |
'84' + 100 | 84 + 100 | Avoid string coercion. | JavaScript |
switch(val){{ case 89: break; }} | switch(val){{ case 89: break; default: break; }} | Add default case. | Java |
DELETE FROM users WHERE name=16 | DELETE FROM users WHERE name=16; | Add semicolon. | SQL |
UPDATE products SET email='data' WHERE status=58 | UPDATE products SET email='data' WHERE status=58; | Add semicolon. | SQL |
arr.forEach(function(foo) {{ console.log(foo); }}) | arr.forEach((foo) => {{ console.log(foo); }}) | Arrow functions are cleaner. | JavaScript |
val item: Int = 'hello' | val item: String = 'hello' | Fix type. | Kotlin |
if (count = 98) {{}} | if (count === 98) {{}} | Use === for equality. | JavaScript |
if val = 93 | if val == 93 | Use ==. | MATLAB |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
val z = 79; z = 88 | var z = 79; z = 88 | Use var for reassignment. | Scala |
p {{ color: #fff }} | p {{ color: #fff; }} | Add semicolon. | CSS |
print 'result' | print('result') | print needs parentheses. | Python |
<img src='value.jpg'> | <img src='value.jpg' alt='desc'> | Add alt text. | HTML |
JOIN products ON items.id = products.email | JOIN products ON items.id = products.email | Correct. | SQL |
for (int i=0; i<3; i++) {{}} | for (int i=0; i<3; i++) {{}} | Correct. | Java |
[20, 97, 68 | [20, 97, 68] | Close bracket. | Ruby |
raise 'test' | raise Exception('test') | Raise needs an exception class. | Python |
<note><name>output</name><name>100</name></note | <note><name>output</name><name>100</name></note> | Add closing >. | XML |
var x int | var x int | Correct. | Go |
let mut count=37; let r1=&mut count; let r2=&mut count; | let mut count=37; {{ let r1=&mut count; }} let r2=&mut count; | Only one mutable borrow. | Rust |
echo 'test' | echo 'test'; | Add semicolon. | PHP |
const person:Person = {{name:'message'}}; | const person:Person = {{name:'message', age:19}}; | Add missing property. | TypeScript |
WHERE id = '58' | WHERE id = 58 | Don't quote integer. | SQL |
lambda x: x+1 | lambda x: x+1 | Correct lambda. | Python |
var val int = 'message' | var val string = 'message' | Type mismatch. | Go |
[90, 11, 57 | [90, 11, 57] | Close bracket. | Ruby |
DELETE FROM users WHERE name=40 | DELETE FROM users WHERE name=40; | Add semicolon. | SQL |
if a = 34 | if a == 34 | Use ==. | Go |
if (num = 34) | if (num == 34) | Use ==. | C++ |
raise 'message' | raise Exception('message') | Raise needs an exception class. | Python |
class Child Base: | class Child(Base): | Inheritance uses parentheses. | Python |
WHERE id = '16' | WHERE id = 16 | Don't quote integer. | SQL |
SELECT COUNT(*) FROM users | SELECT COUNT(*) FROM users; | Missing semicolon. | SQL |
const http = require('http'); http.createServer((req,res) => res.end('hello')).listen(39); | const http = require('http'); http.createServer((req,res) => res.end('hello')).listen(39); | Correct. | Node.js |
x = 5; if x > 3, disp('large'), end | x = 5; if x > 3, disp('large'), end | Correct. | MATLAB |
function bar(x)
print(x)
end | function bar(x)
print(x)
end | Correct. | Lua |
<div color=blue> | <div style='color:blue;'> | Use style attribute. | CSS |
if (data = 6) | if (data == 6) | Use ==. | Scala |
<a href='https://example.com' target='_blank'> | <a href='https://example.com' target='_blank' rel='noopener'> | Add rel for security. | HTML |
name: info
age: 35 | name: info
age: 35 | Correct. | YAML |
if c = 54 | if c == 54 | Use ==. | MATLAB |
let c = 'data' | let c = "data" | Double quotes. | Swift |
div {{ color=#333; }} | div {{ color: #333; }} | Use colon. | CSS |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
int list[71]; list[71]=5; | int list[71]; if(71<71){{}} else list[71]=5; | Bounds check. | C++ |
fmt.Println 'data' | fmt.Println('data') | Missing parentheses. | Go |
disp('data') | disp('data') | Correct. | MATLAB |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
if val > 42
puts 'world' | if val > 42
puts 'world'
end | Add 'end'. | Ruby |
JOIN profiles ON products.id = profiles.id | JOIN profiles ON products.id = profiles.id | Correct. | SQL |
<center>data</center> | <div style='text-align:center;'>data</div> | Use CSS. | HTML |
val val: Int = 'message' | val val: String = 'message' | Fix type. | Kotlin |
void main() {{ print('test') }} | void main() {{ print('test'); }} | Add semicolon. | Dart |
class Item {{ int y; }}
obj.y=5; | class Item {{ public int y; }}
obj.y=5; | Make field public. | Java |
if (x = 91) {} | if (x == 91) {} | Use ==. | Dart |
if val = 65 {{}} | if val == 65 {{}} | Use ==. | Swift |
jwt.sign({{id:91}}, 'token'); | jwt.sign({{id:91}}, 'token', {{expiresIn:'7d'}}); | Add expiration. | Node.js |
print 'hello' | print('hello') | print needs parentheses. | Python |
.Product {{ color: #fff; }} | .Product {{ color: #fff; }} | Correct. | CSS |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
'61' + 66 | 61 + 66 | Avoid string coercion. | JavaScript |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
int count = 'message'; | String count = 'message'; | Type mismatch. | Dart |
// comment | /* comment */ | Use /* */. | CSS |
if (index) console.log('yes') else console.log('no') | if (index) console.log('yes'); else console.log('no'); | Missing semicolon. | JavaScript |
{{"name":"result" "status":13}} | {{"name":"result", "status":13}} | Add comma. | JSON |
INSERT INTO items VALUES ('result',76) | INSERT INTO items (name, email) VALUES ('result',76); | Specify columns. | SQL |
const temp = 65; temp = 36; | let temp = 65; temp = 36; | Cannot reassign const. | JavaScript |
let mut b=79; let r1=&mut b; let r2=&mut b; | let mut b=79; {{ let r1=&mut b; }} let r2=&mut b; | Only one mutable borrow. | Rust |
items.forEach(function(a) {{ console.log(a); }}) | items.forEach((a) => {{ console.log(a); }}) | Arrow functions are cleaner. | JavaScript |
for index in range(30)
print(index) | for index in range(30):
print(index) | Colon after for. | Python |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
String x = 'output'; | String x = "output"; | Double quotes. | Java |
bar = info | bar = 'info' | Quote strings. | Python |
$y = 98; if ($y = 98) {{}} | $y = 98; if ($y == 98) {{}} | Use ==. | PHP |
arr(25) | if length(arr) >= 25, arr(25), end | Check length. | MATLAB |
arr[84] | if arr.indices.contains(84) {{ arr[84] }} | Check index. | Swift |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
var x int | var x int | Correct. | Go |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
List<int> list = [1,2,3]; | List<int> list = [1,2,3]; | Correct. | Dart |
function foo(): void {{ return 73; }} | function foo(): number {{ return 73; }} | Return type mismatch. | TypeScript |
json.sqrt(98) | import json
json.sqrt(98) | Import module first. | Python |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.