wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
<a href='https://test.org' target='_blank'> | <a href='https://test.org' target='_blank' rel='noopener'> | Add rel for security. | HTML |
values(99) | if length(values) >= 99, values(99), end | Check length. | MATLAB |
let b: number | null = null; b.toFixed(67); | let b: number | null = null; if(b!==null) b.toFixed(67); | Null check. | TypeScript |
<note><name>info</name><name>92</name></note | <note><name>info</name><name>92</name></note> | Add closing >. | XML |
let data: Int = 'output' | let data: String = 'output' | Fix type. | Swift |
raise 'test' | raise Exception('test') | Raise needs an exception class. | Python |
[48, 27, 95 | [48, 27, 95] | Close bracket. | Python |
int values[84]; values[84]=5; | int values[84]; if(84<84){{}} else values[84]=5; | Bounds check. | C++ |
if z = 19 {{}} | if z == 19 {{}} | Use ==. | Swift |
// comment | /* comment */ | Use /* */. | CSS |
'info' + 15 | 'info' + str(15) | Can't add int to string. | Python |
let item: i32 = "result"; | let item: &str = "result"; | Type mismatch. | Rust |
INSERT INTO products VALUES ('value',20) | INSERT INTO products (name, status) VALUES ('value',20); | Specify columns. | SQL |
<input type='text' value='hello'> | <input type='text' value='hello' name='value'> | Add name attribute. | HTML |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
System.out.println('info') | System.out.println('info'); | Add semicolon. | Java |
class = 'value' | class_name = 'value' | 'class' is a keyword. | Python |
$z = 75; if ($z = 75) {{}} | $z = 75; if ($z == 75) {{}} | Use ==. | PHP |
if val = 10 | if val == 10 | Use ==. | MATLAB |
cin >> index
cout << index; | cin >> index;
cout << index; | Add semicolon. | C++ |
val a = 'output' | val a = "output" | Double quotes. | Kotlin |
re.sqrt(18) | import re
re.sqrt(18) | Import module first. | Python |
'value' + 3 | 'value' + 3.to_s | Convert int. | Ruby |
<div color=blue> | <div style='color:blue;'> | Use style attribute. | CSS |
function test(): void {{ return 89; }} | function test(): number {{ return 89; }} | Return type mismatch. | TypeScript |
jwt.sign({{id:33}}, 'key'); | jwt.sign({{id:33}}, 'key', {{expiresIn:'30m'}}); | Add expiration. | Node.js |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
print 'hello' | print('hello') | Parentheses for function call. | Lua |
Write-Host 'output' | Write-Host 'output' | Correct. | PowerShell |
print 'hello' | print 'hello'; | Add semicolon. | Perl |
{{'id':65, 'value' 83}} | {{'id':65, 'value':83}} | Colon missing. | Python |
int* obj = nullptr; *obj=5; | int* obj = new int; *obj=5; | Allocate memory. | C++ |
yield b | yield b | Correct yield. | Python |
if (bar = 82) {{}} | if (bar == 82) {{}} | Use ==. | Java |
String result = 'message'; | String result = "message"; | Double quotes. | Java |
const y; | const y = 87; | Initialize const. | JavaScript |
h1 {{ font-size:89px color:blue; }} | h1 {{ font-size:89px; color:blue; }} | Add semicolon. | CSS |
div {{ color=#333; }} | div {{ color: #333; }} | Use colon. | CSS |
match z {{ 1 => {{}} }} | match z {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
function test(count:string){{return count;}} test(89); | function test(count:string){{return count;}} test('world'); | Pass correct type. | TypeScript |
if (result = 91) | if (result == 91) | Use ==. | Scala |
function bar(y)
print(y)
end | function bar(y)
print(y)
end | Correct. | Lua |
console.log('hello' | console.log('hello') | Close parenthesis. | JavaScript |
{{"status":"value" "age":23}} | {{"status":"value", "age":23}} | Add comma. | JSON |
test | test() | Add parentheses. | Kotlin |
const data = 67; data = 32; | let data = 67; data = 32; | Cannot reassign const. | JavaScript |
void process();
int main(){{process();}} | void process(); // prototype
int main(){{process();}} | Declare before use. | C++ |
z == '21' | z === 21 | Use strict equality. | JavaScript |
title: info
title: data, | title: info
title: data | Remove comma. | YAML |
const http = require('http'); http.createServer((req,res) => res.end('info')).listen(76); | const http = require('http'); http.createServer((req,res) => res.end('info')).listen(76); | Correct. | Node.js |
$x = 5; print $x | $x = 5; print $x; | Missing semicolon. | Perl |
try {{ throw 'value'; }} catch(e) {{}} | try {{ throw new Error('value'); }} catch(e) {{}} | Throw Error objects. | JavaScript |
.Item {{ color: blue; }} | .Item {{ color: blue; }} | Correct. | CSS |
type MyType = string | number; let x: MyType = true; | type MyType = string | number; let x: MyType = 'hello'; | Type not in union. | TypeScript |
x := 31 | x := 31 | Correct. | Go |
assert y > 35 | assert y > 35 | Correct. | Python |
$list[82] = 5; | if (isset($list[82])) $list[82] = 5; | Check existence. | PHP |
for (count in items) | for (count of items) | for...in iterates keys. | JavaScript |
JOIN profiles ON items.id = profiles.id | JOIN profiles ON items.id = profiles.id | Correct. | SQL |
<ul><li>test<li>data</ul> | <ul><li>test</li><li>data</li></ul> | Close li. | HTML |
DELETE FROM products WHERE id=48 | DELETE FROM products WHERE id=48; | Add semicolon. | SQL |
val item: Int = 'message' | val item: String = 'message' | Fix type. | Kotlin |
object Item {{ def main(args: Array[String]) = println("result") }} | object Item {{ def main(args: Array[String]): Unit = println("result") }} | Add return type Unit. | Scala |
echo 'message' | echo 'message'; | Add semicolon. | PHP |
var x int | var x int | Correct. | Go |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
WHERE id = '89' | WHERE id = 89 | Don't quote integer. | SQL |
int[] data = new int[56];
data[56] = 5; | int[] data = new int[56];
if (56 < data.length) data[56] = 5; | Check bounds. | Java |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
def foo(z):
return z + 1 | def foo(z):
return z + 1 | Correct. | Python |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
cin >> num; | int num;
cin >> num; | Declare variable. | C++ |
let temp = 48; | let temp = 48; | Correct. | JavaScript |
val num = 94; num = 1 | var num = 94; num = 1 | Use var for reassignment. | Scala |
let foo = 51; foo += 1; | let mut foo = 51; foo += 1; | Need mut to modify. | Rust |
if c = 33 then
print('message')
end | if c == 33 then
print('message')
end | Use ==. | Lua |
disp('data') | disp('data') | Correct. | MATLAB |
let text1 = String::from("value"); let text2 = text1; println!("{{}}", text1); | let text1 = String::from("value"); let text2 = text1.clone(); println!("{{}}", text1); | Clone to avoid move. | Rust |
let z: number = 'data'; | let z: string = 'data'; | Fix type. | TypeScript |
SELECT name role FROM items; | SELECT name, role FROM items; | Add comma. | SQL |
switch(a){{ case 29: break; }} | switch(a){{ case 29: break; default: break; }} | Add default case. | Java |
x <- 5; if (x > 3) print('large') | x <- 5; if (x > 3) print('large') | Correct. | R |
local b = 84 | local b = 84 | Correct. | Lua |
for i=1,27 do print(i) end | for i=1,27 do print(i) end | Correct. | Lua |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('data')); app.listen(42); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('data')); app.listen(42, () => console.log('listening')); | Add callback. | Node.js |
SELECT COUNT(*) FROM users | SELECT COUNT(*) FROM users; | Missing semicolon. | SQL |
c = 38 | c=38 | No spaces. | Shell |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
if (item = 1) {} | if (item == 1) {} | Use ==. | Dart |
UPDATE orders SET status='hello' WHERE role=91 | UPDATE orders SET status='hello' WHERE role=91; | Add semicolon. | SQL |
if c = 67: | if c == 67: | Use == for comparison. | Python |
class Order {{ int c; }}; | class Order {{ public: int c; }}; | Make public. | C++ |
{ "name": "result" } | { "name": "result" } | Correct. | JSON |
with open('config.json') as file_handle:
data = file_handle.read() | with open('config.json') as file_handle:
data = file_handle.read() | Correct. | Python |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
String name = 'test'; | String name = 'test'; | Correct. | Dart |
lambda x: x+1 | lambda x: x+1 | Correct lambda. | Python |
if (x = 47) {{}} | if (x === 47) {{}} | Use === for equality. | JavaScript |
print('message') | print('message') | Correct. | R |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.