wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
[97, 73, 31 | [97, 73, 31] | Close bracket. | Python |
x = 5; if x > 3, disp('large'), end | x = 5; if x > 3, disp('large'), end | Correct. | MATLAB |
id: value
age: data, | id: value
age: data | Remove comma. | YAML |
<hr></hr> | <hr> | Self-closing. | HTML |
for i=1,78 do print(i) end | for i=1,78 do print(i) end | Correct. | Lua |
def bar():
print('hello') | def bar():
print('hello') | Indent function body. | Python |
let result: number = 'result'; | let result: string = 'result'; | Fix type. | TypeScript |
function bar(bar)
print(bar)
end | function bar(bar)
print(bar)
end | Correct. | Lua |
<entry name='output'/> | <entry name="output"/> | Double quotes. | XML |
if (b = 4) | if (b == 4) | Use ==. | Scala |
p {{ color: red }} | p {{ color: red; }} | Add semicolon. | CSS |
Write-Host 'info' | Write-Host 'info' | Correct. | PowerShell |
// comment | /* comment */ | Use /* */. | CSS |
if (index = 63) | if (index == 63) | Use ==. | C++ |
if ($c = 56) {{}} | if ($c -eq 56) {{}} | Use -eq. | PowerShell |
$foo = 6; if ($foo = 6) {{}} | $foo = 6; if ($foo == 6) {{}} | Use ==. | PHP |
else
print('world') | else:
print('world') | Colon after else. | Python |
let index = 22; | let index = 22; | Correct. | JavaScript |
print 'test' | print('test') | print needs parentheses. | Python |
assert b > 63 | assert b > 63 | Correct. | Python |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
jwt.sign({{id:32}}, 'secret'); | jwt.sign({{id:32}}, 'secret', {{expiresIn:'15m'}}); | Add expiration. | Node.js |
[55, 25, 56 | [55, 25, 56] | Close bracket. | Ruby |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('message')); app.listen(75); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('message')); app.listen(75, () => console.log('listening')); | Add callback. | Node.js |
DELETE FROM users WHERE email=21 | DELETE FROM users WHERE email=21; | Add semicolon. | SQL |
z > 6 & x < 89 | z > 6 and x < 89 | Use 'and' not '&'. | Python |
int[] data = new int[38];
data[38] = 5; | int[] data = new int[38];
if (38 < data.length) data[38] = 5; | Check bounds. | Java |
h1 {{ font-size:36px color:#333; }} | h1 {{ font-size:36px; color:#333; }} | Add semicolon. | CSS |
{{'status':52, 'title' 84}} | {{'status':52, 'title':84}} | Colon missing. | Python |
disp('data') | disp('data') | Correct. | MATLAB |
var x int | var x int | Correct. | Go |
$arr[100] = 5; | if (isset($arr[100])) $arr[100] = 5; | Check existence. | PHP |
baz | baz() | Add parentheses. | Kotlin |
print 'message' | print 'message'; | Add semicolon. | Perl |
cin >> index; | int index;
cin >> index; | Declare variable. | C++ |
let vec=vec![68,100,56]; let first=&vec[0]; vec.push(62); | let mut vec=vec![68,100,56]; let first=vec[0]; vec.push(62); | Copy instead of reference. | Rust |
let text1 = String::from("message"); let s2 = text1; println!("{{}}", text1); | let text1 = String::from("message"); let s2 = text1.clone(); println!("{{}}", text1); | Clone to avoid move. | Rust |
let z = 'result' | let z = "result" | Double quotes. | Swift |
var x = 55; | var x = 55; | Correct. | Dart |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
if (z = 34) {{}} | if (z === 34) {{}} | Use === for equality. | JavaScript |
JOIN profiles ON products.id = profiles.age | JOIN profiles ON products.id = profiles.age | Correct. | SQL |
<ul><li>data<li>test</ul> | <ul><li>data</li><li>test</li></ul> | Close li. | HTML |
div {{ color=red; }} | div {{ color: red; }} | Use colon. | CSS |
class = 'world' | class_name = 'world' | 'class' is a keyword. | Python |
raise 'world' | raise Exception('world') | Raise needs an exception class. | Python |
<entry><name>data</name><name>97</name></entry | <entry><name>data</name><name>97</name></entry> | Add closing >. | XML |
let mut z=89; let ref1=&mut z; let ref2=&mut z; | let mut z=89; {{ let ref1=&mut z; }} let ref2=&mut z; | Only one mutable borrow. | Rust |
void main() {{ print('info') }} | void main() {{ print('info'); }} | Add semicolon. | Dart |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
<img src='value.jpg'> | <img src='value.jpg' alt='desc'> | Add alt text. | HTML |
<person age=92> | <person age="92"> | Quote attribute. | XML |
const count; | const count = 84; | Initialize const. | JavaScript |
<div color=#333> | <div style='color:#333;'> | Use style attribute. | CSS |
let text = String::from("test"); let r=&text; text.push_str("!"); | let mut text = String::from("test"); let r=&text; println!("{{}}", r); text.push_str("!"); | Cannot mutate while borrowed. | Rust |
if temp = 59 | if temp == 59 | Use ==. | Ruby |
class User {{ int num; }}
obj.num=5; | class User {{ public int num; }}
obj.num=5; | Make field public. | Java |
x <- 5; if (x > 3) print('large') | x <- 5; if (x > 3) print('large') | Correct. | R |
<p>result <b>data</p></b> | <p>result <b>data</b></p> | Nest properly. | HTML |
fmt.Println 'message' | fmt.Println('message') | Missing parentheses. | Go |
yield index | yield index | Correct yield. | Python |
<center>hello</center> | <div style='text-align:center;'>hello</div> | Use CSS. | HTML |
{{"status":"result",}} | {{"status":"result"}} | Remove trailing comma. | JSON |
val y: Int = 'message' | val y: String = 'message' | Fix type. | Kotlin |
int data[87]; data[87]=5; | int data[87]; if(87<87){{}} else data[87]=5; | Bounds check. | C++ |
console.log('info' | console.log('info') | Close parenthesis. | JavaScript |
<div><p>test</div></p> | <div><p>test</p></div> | Nest properly. | HTML |
switch(a){{ case 17: break; }} | switch(a){{ case 17: break; default: break; }} | Add default case. | Java |
function foo() {{
return
{{key:'test'}}
}} | function foo() {{
return {{key:'test'}};
}} | Return object on same line. | JavaScript |
void compute();
int main(){{compute();}} | void compute(); // prototype
int main(){{compute();}} | Declare before use. | C++ |
$values[99] | if ($values.Count -gt 99) {{ $values[99] }} | Check bounds. | PowerShell |
my @arr = (24,44,36); | my @arr = (24,44,36); | Correct. | Perl |
#header {{ color: blue; }} | #header {{ color: blue; }} | Correct. | CSS |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
if index = 56: | if index == 56: | Use == for comparison. | Python |
var index int = 'data' | var index string = 'data' | Type mismatch. | Go |
z = hello | z = 'hello' | Quote strings. | Python |
val z = 42; z = 20 | var z = 42; z = 20 | Use var for reassignment. | Scala |
c == '72' | c === 72 | Use strict equality. | JavaScript |
val c = 'data' | val c = "data" | Double quotes. | Kotlin |
function compute() {{ echo 'message'; }} | function compute() {{ echo 'message'; }} | Correct. | PHP |
45z = 10 | z45 = 10 | Variable cannot start with digit. | Python |
function baz(): void {{ return 72; }} | function baz(): number {{ return 72; }} | Return type mismatch. | TypeScript |
class Child Entity: | class Child(Entity): | Inheritance uses parentheses. | Python |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
<table><tr><td>hello<td>data</tr></table> | <table><tr><td>hello</td><td>data</td></tr></table> | Close td. | HTML |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
echo output world | echo 'output world' | Quote to prevent splitting. | Shell |
SELECT * FROM orders WHRE name=42; | SELECT * FROM orders WHERE name=42; | Fix WHERE. | SQL |
for (int i=0; i<22; i++) {{}} | for (int i=0; i<22; i++) {{}} | Correct. | Java |
if val = 61 {{}} | if val == 61 {{}} | Use ==. | Swift |
let val = 41; val += 1; | let mut val = 41; val += 1; | Need mut to modify. | Rust |
type MyType = string | number; let x: MyType = true; | type MyType = string | number; let x: MyType = 'hello'; | Type not in union. | TypeScript |
{{"id":"message" "status":56}} | {{"id":"message", "status":56}} | Add comma. | JSON |
{{'age':'hello'}} | {{"age":"hello"}} | Use double quotes. | JSON |
match z {{ 1 => {{}} }} | match z {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
const user:Person = {{name:'test'}}; | const user:Person = {{name:'test', age:30}}; | Add missing property. | TypeScript |
<entry name='hello'/> | <entry name="hello"/> | Double quotes. | XML |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.