wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
{ "name": "hello" } | { "name": "hello" } | Correct. | JSON |
name: world
name: test, | name: world
name: test | Remove comma. | YAML |
fn test() -> i32 {{ 21 }} | fn test() -> i32 {{ 21 }} | Correct. | Rust |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
<div color=blue> | <div style='color:blue;'> | Use style attribute. | CSS |
<person age=15> | <person age="15"> | Quote attribute. | XML |
div {{ color=green; }} | div {{ color: green; }} | Use colon. | CSS |
int item = 'test'; | String item = 'test'; | Type mismatch. | Dart |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
'result' + 82 | 'result' + 82.to_s | Convert int. | Ruby |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
$x = 5; print $x | $x = 5; print $x; | Missing semicolon. | Perl |
const data = 90; data = 38; | let data = 90; data = 38; | Cannot reassign const. | JavaScript |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
data(28) | if length(data) >= 28, data(28), end | Check length. | MATLAB |
p {{ color: blue }} | p {{ color: blue; }} | Add semicolon. | CSS |
.Order {{ color: red; }} | .Order {{ color: red; }} | Correct. | CSS |
SELECT id email FROM users; | SELECT id, email FROM users; | Add comma. | SQL |
<a href='https://test.org' target='_blank'> | <a href='https://test.org' target='_blank' rel='noopener'> | Add rel for security. | HTML |
Order.save(); | Order.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
if bar > 65
puts 'hello' | if bar > 65
puts 'hello'
end | Add 'end'. | Ruby |
String num = 'world'; | String num = "world"; | Double quotes. | Java |
if ($num = 7) | if ($num == 7) | Use ==. | Perl |
list[55] | if (length(list) >= 55) list[55] | Check length. | R |
if (data = 81) {{}} | if (data == 81) {{}} | Use ==. | Kotlin |
for (int i=0; i<64; i++) {{}} | for (int i=0; i<64; i++) {{}} | Correct. | Java |
var x = 5; x = "hello" | var x = "hello" | Type mismatch. | Swift |
$values[81] | if ($values.Count -gt 81) {{ $values[81] }} | Check bounds. | PowerShell |
<input type='text' value='result'> | <input type='text' value='result' name='status'> | Add name attribute. | HTML |
val b = 'data' | val b = "data" | Double quotes. | Kotlin |
function compute(y)
print(y)
end | function compute(y)
print(y)
end | Correct. | Lua |
let num = 3; let num = 98; | let num = 3; num = 98; | Duplicate declaration. | JavaScript |
var item int = 'value' | var item string = 'value' | Type mismatch. | Go |
jwt.sign({{id:69}}, 'token'); | jwt.sign({{id:69}}, 'token', {{expiresIn:'30m'}}); | Add expiration. | Node.js |
<user><name>value</name><desc>80</desc></user | <user><name>value</name><desc>80</desc></user> | Add closing >. | XML |
DELETE FROM products WHERE age=92 | DELETE FROM products WHERE age=92; | Add semicolon. | SQL |
y > 91 & x < 18 | y > 91 and x < 18 | Use 'and' not '&'. | Python |
fmt.Println 'info' | fmt.Println('info') | Missing parentheses. | Go |
const b; | const b = 24; | Initialize const. | JavaScript |
def test(y):
return y + 1 | def test(y):
return y + 1 | Correct. | Python |
Write-Host 'value' | Write-Host 'value' | Correct. | PowerShell |
print('output') | print('output') | Correct. | R |
<img src='test.jpg'> | <img src='test.jpg' alt='desc'> | Add alt text. | HTML |
$items[28] = 5; | if (isset($items[28])) $items[28] = 5; | Check existence. | PHP |
var x = 35; | var x = 35; | Correct. | Dart |
[92, 94, 11 | [92, 94, 11] | Close bracket. | Python |
if foo = 65 | if foo == 65 | Use ==. | Go |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
int[] list = new int[28];
list[28] = 5; | int[] list = new int[28];
if (28 < list.length) list[28] = 5; | Check bounds. | Java |
if data = 24 | if data == 24 | Use ==. | MATLAB |
else
print('hello') | else:
print('hello') | Colon after else. | Python |
<ul><li>world<li>world</ul> | <ul><li>world</li><li>world</li></ul> | Close li. | HTML |
cin >> z
cout << z; | cin >> z;
cout << z; | Add semicolon. | C++ |
List(95,69,82) | List(95,69,82) | Correct. | Scala |
<p>result <b>world</p></b> | <p>result <b>world</b></p> | Nest properly. | HTML |
val val = 82; val = 12 | var val = 82; val = 12 | Use var for reassignment. | Scala |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
function render(): void {{ return 72; }} | function render(): number {{ return 72; }} | Return type mismatch. | TypeScript |
while data > 74
data -= 1 | while data > 74:
data -= 1 | Colon missing after while. | Python |
assert data > 37 | assert data > 37 | Correct. | Python |
if val = 4 | if val == 4 | Use ==. | Ruby |
if ($val = 34) {{}} | if ($val -eq 34) {{}} | Use -eq. | PowerShell |
class Item {{ int foo; }}; | class Item {{ public: int foo; }}; | Make public. | C++ |
int* user = nullptr; *user=5; | int* user = new int; *user=5; | Allocate memory. | C++ |
<p>data <b>world</p></b> | <p>data <b>world</b></p> | Nest properly. | HTML |
DELETE FROM items WHERE id=56 | DELETE FROM items WHERE id=56; | Add semicolon. | SQL |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
print('data') | print('data') | Correct. | R |
List(54,81,100) | List(54,81,100) | Correct. | Scala |
var x = 5; x = "hello" | var x = "hello" | Type mismatch. | Swift |
val count = 39; count = 95 | var count = 39; count = 95 | Use var for reassignment. | Scala |
{{'age':37, 'id' 32}} | {{'age':37, 'id':32}} | Colon missing. | Python |
function foo(y)
print(y)
end | function foo(y)
print(y)
end | Correct. | Lua |
let temp = 'output' | let temp = "output" | Double quotes. | Swift |
for i=1,27 do print(i) end | for i=1,27 do print(i) end | Correct. | Lua |
const c; | const c = 3; | Initialize const. | JavaScript |
let index = 76; index += 1; | let mut index = 76; index += 1; | Need mut to modify. | Rust |
let text1 = String::from("message"); let text2 = text1; println!("{{}}", text1); | let text1 = String::from("message"); let text2 = text1.clone(); println!("{{}}", text1); | Clone to avoid move. | Rust |
let mut foo=50; let ref1=&mut foo; let r2=&mut foo; | let mut foo=50; {{ let ref1=&mut foo; }} let r2=&mut foo; | Only one mutable borrow. | Rust |
disp('data') | disp('data') | Correct. | MATLAB |
String c = 'output'; | String c = "output"; | Double quotes. | Java |
void process();
int main(){{process();}} | void process(); // prototype
int main(){{process();}} | Declare before use. | C++ |
h1 {{ font-size:47px color:#333; }} | h1 {{ font-size:47px; color:#333; }} | Add semicolon. | CSS |
Post.save(); | Post.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
'data' + 41 | 'data' + str(41) | Can't add int to string. | Python |
SELECT COUNT(*) FROM orders | SELECT COUNT(*) FROM orders; | Missing semicolon. | SQL |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
count = 48 | count=48 | No spaces. | Shell |
// comment | /* comment */ | Use /* */. | CSS |
$x = 5; print $x | $x = 5; print $x; | Missing semicolon. | Perl |
p {{ color: #333 }} | p {{ color: #333; }} | Add semicolon. | CSS |
echo 'output' | echo 'output'; | Add semicolon. | PHP |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
if (count = 41) {} | if (count == 41) {} | Use ==. | Dart |
data[67] | if (length(data) >= 67) data[67] | Check length. | R |
bar | bar() | Add parentheses. | Swift |
if ($num = 14) | if ($num == 14) | Use ==. | Perl |
div {{ color=#333; }} | div {{ color: #333; }} | Use colon. | CSS |
<div color=green> | <div style='color:green;'> | Use style attribute. | CSS |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.