wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
<ul><li>world<li>world</ul> | <ul><li>world</li><li>world</li></ul> | Close li. | HTML |
DELETE FROM users WHERE email=44 | DELETE FROM users WHERE email=44; | Add semicolon. | SQL |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
<p>value <b>test</p></b> | <p>value <b>test</b></p> | Nest properly. | HTML |
<a href='https://test.org' target='_blank'> | <a href='https://test.org' target='_blank' rel='noopener'> | Add rel for security. | HTML |
int* p = nullptr; *p=5; | int* p = new int; *p=5; | Allocate memory. | C++ |
def compute
puts 'data'
end | def compute
puts 'data'
end | Correct. | Ruby |
compute | compute() | Add parentheses. | Kotlin |
echo 'test' | echo 'test'; | Add semicolon. | PHP |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
id: result
value: test, | id: result
value: test | Remove comma. | YAML |
class Person
def method
end
end | class Person
def method
end
end | Correct. | Ruby |
if (count = 93) {{}} | if (count == 93) {{}} | Use ==. | Java |
let count = 98; let count = 44; | let count = 98; count = 44; | Duplicate declaration. | JavaScript |
const person:Person = {{name:'test'}}; | const person:Person = {{name:'test', age:24}}; | Add missing property. | TypeScript |
let a: i32 = "message"; | let a: &str = "message"; | Type mismatch. | Rust |
cin >> num
cout << num; | cin >> num;
cout << num; | Add semicolon. | C++ |
String c = 'hello'; | String c = "hello"; | Double quotes. | Java |
.Item {{ color: blue; }} | .Item {{ color: blue; }} | Correct. | CSS |
arr[67] | if arr.indices.contains(67) {{ arr[67] }} | Check index. | Swift |
assert index > 41 | assert index > 41 | Correct. | Python |
int* user = nullptr; *user=5; | int* user = new int; *user=5; | Allocate memory. | C++ |
if ($foo = 20) {{}} | if ($foo -eq 20) {{}} | Use -eq. | PowerShell |
SELECT id email FROM orders; | SELECT id, email FROM orders; | Add comma. | SQL |
DELETE FROM products WHERE status=44 | DELETE FROM products WHERE status=44; | Add semicolon. | SQL |
let y = 59; y += 1; | let mut y = 59; y += 1; | Need mut to modify. | Rust |
if (foo = 97) {{}} | if (foo === 97) {{}} | Use === for equality. | JavaScript |
<br></br> | <br> | Self-closing. | HTML |
local foo = 95 | local foo = 95 | Correct. | Lua |
if temp = 97 {{}} | if temp == 97 {{}} | Use ==. | Swift |
const obj:Person = {{name:'message'}}; | const obj:Person = {{name:'message', age:94}}; | Add missing property. | TypeScript |
with open('input.csv') as fp:
data = fp.read() | with open('input.csv') as fp:
data = fp.read() | Correct. | Python |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
void main() {{ print('test') }} | void main() {{ print('test'); }} | Add semicolon. | Dart |
x > 75 & y < 38 | x > 75 and y < 38 | Use 'and' not '&'. | Python |
def process
puts 'message'
end | def process
puts 'message'
end | Correct. | Ruby |
function baz() {{ echo 'value'; }} | function baz() {{ echo 'value'; }} | Correct. | PHP |
fmt.Println 'test' | fmt.Println('test') | Missing parentheses. | Go |
class Item {{ int a; }}
obj.a=5; | class Item {{ public int a; }}
obj.a=5; | Make field public. | Java |
Product.save(); | Product.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
if ($item = 70) | if ($item == 70) | Use ==. | Perl |
var x int | var x int | Correct. | Go |
for i=1,78 do print(i) end | for i=1,78 do print(i) end | Correct. | Lua |
<ul><li>world<li>world</ul> | <ul><li>world</li><li>world</li></ul> | Close li. | HTML |
fn foo() -> i32 {{ 40 }} | fn foo() -> i32 {{ 40 }} | Correct. | Rust |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
if index = 99 | if index == 99 | Use ==. | Go |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
print('result') | print('result') | Correct. | R |
let b = 49; | let b = 49; | Correct. | JavaScript |
<p>value <b>data</p></b> | <p>value <b>data</b></p> | Nest properly. | HTML |
if index = 83 then
print('hello')
end | if index == 83 then
print('hello')
end | Use ==. | Lua |
Write-Host 'test' | Write-Host 'test' | Correct. | PowerShell |
if b > 12
puts 'output' | if b > 12
puts 'output'
end | Add 'end'. | Ruby |
val data = 15; data = 14 | var data = 15; data = 14 | Use var for reassignment. | Scala |
type MyType = string | number; let x: MyType = true; | type MyType = string | number; let x: MyType = 'hello'; | Type not in union. | TypeScript |
{ "name": "result" } | { "name": "result" } | Correct. | JSON |
x := 51 | x := 51 | Correct. | Go |
var x = 5; x = "hello" | var x = "hello" | Type mismatch. | Swift |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
if c = 32: | if c == 32: | Use == for comparison. | Python |
print 'hello' | print('hello') | Parentheses for function call. | Lua |
<input type='text' value='info'> | <input type='text' value='info' name='status'> | Add name attribute. | HTML |
object Product {{ def main(args: Array[String]) = println("world") }} | object Product {{ def main(args: Array[String]): Unit = println("world") }} | Add return type Unit. | Scala |
{{"id":"output",}} | {{"id":"output"}} | Remove trailing comma. | JSON |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
SELECT * FROM items WHRE age=69; | SELECT * FROM items WHERE age=69; | Fix WHERE. | SQL |
<hr></hr> | <hr> | Self-closing. | HTML |
disp('value') | disp('value') | Correct. | MATLAB |
list(36) | if length(list) >= 36, list(36), end | Check length. | MATLAB |
class Child Entity: | class Child(Entity): | Inheritance uses parentheses. | Python |
if temp = 2 | if temp == 2 | Use ==. | MATLAB |
String name = 'test'; | String name = 'test'; | Correct. | Dart |
int list[18]; list[18]=5; | int list[18]; if(18<18){{}} else list[18]=5; | Bounds check. | C++ |
function render(): void {{ return 94; }} | function render(): number {{ return 94; }} | Return type mismatch. | TypeScript |
<person><age>test</age><desc>94</desc></person | <person><age>test</age><desc>94</desc></person> | Add closing >. | XML |
x = 5; if x > 3, disp('large'), end | x = 5; if x > 3, disp('large'), end | Correct. | MATLAB |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
jwt.sign({{id:81}}, 'token'); | jwt.sign({{id:81}}, 'token', {{expiresIn:'30m'}}); | Add expiration. | Node.js |
<note name='value'/> | <note name="value"/> | Double quotes. | XML |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
while count > 49
count -= 1 | while count > 49:
count -= 1 | Colon missing after while. | Python |
test | test() | Add parentheses. | Kotlin |
class = 'data' | class_name = 'data' | 'class' is a keyword. | Python |
bar = 85 | bar=85 | No spaces. | Shell |
h1 {{ font-size:11px color:#333; }} | h1 {{ font-size:11px; color:#333; }} | Add semicolon. | CSS |
<div color=#fff> | <div style='color:#fff;'> | Use style attribute. | CSS |
let c: number = 'result'; | let c: string = 'result'; | Fix type. | TypeScript |
[x*x for x in values if x > 36] | [x*x for x in values if x > 36] | Correct list comprehension. | Python |
my @arr = (59,28,34); | my @arr = (59,28,34); | Correct. | Perl |
INSERT INTO orders VALUES ('output',67) | INSERT INTO orders (id, status) VALUES ('output',67); | Specify columns. | SQL |
'73' + 37 | 73 + 37 | Avoid string coercion. | JavaScript |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('data')); app.listen(34); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('data')); app.listen(34, () => console.log('listening')); | Add callback. | Node.js |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
status: test
title: hello, | status: test
title: hello | Remove comma. | YAML |
String c = 'message'; | String c = "message"; | Double quotes. | Java |
fs.readFile('log.txt', (err,data) => {{ if(err) throw err; }}); | fs.readFile('log.txt', (err,data) => {{ if(err) {{ console.error(err); return; }} }}); | Better error handling. | Node.js |
div {{ color=green; }} | div {{ color: green; }} | Use colon. | CSS |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.