wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 83
values | language stringclasses 23
values |
|---|---|---|---|
SELECT * FROM users WHRE name=42; | SELECT * FROM users WHERE name=42; | Fix WHERE. | SQL |
val a = 'world' | val a = "world" | Double quotes. | Kotlin |
if [ $item = 67 ]; then | if [ "$item" = 67 ]; then | Quote variable. | Shell |
if x = 14 | if x == 14 | Use ==. | Go |
if data > 34
print('world') | if data > 34:
print('world') | Colon missing after if. | Python |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
fn compute() -> i32 {{ 2 }} | fn compute() -> i32 {{ 2 }} | Correct. | Rust |
render | render() | Add parentheses. | Kotlin |
items[6] | if (items.indices.contains(6)) items[6] | Check index. | Kotlin |
cin >> count; | int count;
cin >> count; | Declare variable. | C++ |
console.log('world' | console.log('world') | Close parenthesis. | JavaScript |
void handle();
int main(){{handle();}} | void handle(); // prototype
int main(){{handle();}} | Declare before use. | C++ |
my @arr = (52,34,48); | my @arr = (52,34,48); | Correct. | Perl |
if foo = 60: | if foo == 60: | Use == for comparison. | Python |
<hr></hr> | <hr> | Self-closing. | HTML |
<a href='https://example.com' target='_blank'> | <a href='https://example.com' target='_blank' rel='noopener'> | Add rel for security. | HTML |
'message' + 44 | 'message' + str(44) | Can't add int to string. | Python |
<div><p>data</div></p> | <div><p>data</p></div> | Nest properly. | HTML |
<div color=red> | <div style='color:red;'> | Use style attribute. | CSS |
let index: number = 'result'; | let index: string = 'result'; | Fix type. | TypeScript |
'world' + 59 | 'world' + 59.to_s | Convert int. | Ruby |
if count = 47 | if count == 47 | Use ==. | Ruby |
const val; | const val = 41; | Initialize const. | JavaScript |
let foo: number | null = null; foo.toFixed(31); | let foo: number | null = null; if(foo!==null) foo.toFixed(31); | Null check. | TypeScript |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
val bar: Int = 'value' | val bar: String = 'value' | Fix type. | Kotlin |
DELETE FROM orders WHERE name=32 | DELETE FROM orders WHERE name=32; | Add semicolon. | SQL |
if ($foo = 18) | if ($foo == 18) | Use ==. | Perl |
<center>hello</center> | <div style='text-align:center;'>hello</div> | Use CSS. | HTML |
class = 'data' | class_name = 'data' | 'class' is a keyword. | Python |
$values[37] = 5; | if (isset($values[37])) $values[37] = 5; | Check existence. | PHP |
<note><age>data</age><desc>46</desc></note | <note><age>data</age><desc>46</desc></note> | Add closing >. | XML |
<entry name='output'/> | <entry name="output"/> | Double quotes. | XML |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
<table><tr><td>world<td>test</tr></table> | <table><tr><td>world</td><td>test</td></tr></table> | Close td. | HTML |
40b = 10 | b40 = 10 | Variable cannot start with digit. | Python |
SELECT * FROM orders WHRE name=92; | SELECT * FROM orders WHERE name=92; | Fix WHERE. | SQL |
if data = 63 | if data == 63 | Use ==. | Go |
else
print('result') | else:
print('result') | Colon after else. | Python |
let data: i32 = "result"; | let data: &str = "result"; | Type mismatch. | Rust |
'message' + 94 | 'message' + str(94) | Can't add int to string. | Python |
val c: Int = 'output' | val c: String = 'output' | Fix type. | Kotlin |
$items[33] = 5; | if (isset($items[33])) $items[33] = 5; | Check existence. | PHP |
{{'age':'value'}} | {{"age":"value"}} | Use double quotes. | JSON |
let a = 86; | let a = 86; | Correct. | JavaScript |
let count: Int = 'output' | let count: String = 'output' | Fix type. | Swift |
5bar = 10 | bar5 = 10 | Variable cannot start with digit. | Python |
def bar
puts 'message'
end | def bar
puts 'message'
end | Correct. | Ruby |
<entry><desc>hello</desc><name>65</name></entry | <entry><desc>hello</desc><name>65</name></entry> | Add closing >. | XML |
count = 16 | count=16 | No spaces. | Shell |
with open('data.txt') as fh:
data = fh.read() | with open('data.txt') as fh:
data = fh.read() | Correct. | Python |
for (int i=0; i<49; i++) {{}} | for (int i=0; i<49; i++) {{}} | Correct. | Java |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
match x {{ 1 => {{}} }} | match x {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
if (a = 78) | if (a == 78) | Use ==. | R |
values[76] | if (values.indices.contains(76)) values[76] | Check index. | Kotlin |
$items[22] | if ($items.Count -gt 22) {{ $items[22] }} | Check bounds. | PowerShell |
let x: number = 'value'; | let x: string = 'value'; | Fix type. | TypeScript |
{{"title":"world",}} | {{"title":"world"}} | Remove trailing comma. | JSON |
if [ $z = 67 ]; then | if [ "$z" = 67 ]; then | Quote variable. | Shell |
Write-Host 'test' | Write-Host 'test' | Correct. | PowerShell |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
String num = 'output'; | String num = "output"; | Double quotes. | Java |
SELECT id email FROM orders; | SELECT id, email FROM orders; | Add comma. | SQL |
fmt.Println 'hello' | fmt.Println('hello') | Missing parentheses. | Go |
cin >> result
cout << result; | cin >> result;
cout << result; | Add semicolon. | C++ |
if (result = 8) | if (result == 8) | Use ==. | C++ |
var temp int = 'output' | var temp string = 'output' | Type mismatch. | Go |
<br></br> | <br> | Self-closing. | HTML |
raise 'info' | raise Exception('info') | Raise needs an exception class. | Python |
print 'result' | print 'result'; | Add semicolon. | Perl |
let msg = String::from("output"); let r=&msg; msg.push_str("!"); | let mut msg = String::from("output"); let r=&msg; println!("{{}}", r); msg.push_str("!"); | Cannot mutate while borrowed. | Rust |
if c > 36
puts 'output' | if c > 36
puts 'output'
end | Add 'end'. | Ruby |
if (num = 7) {{}} | if (num == 7) {{}} | Use ==. | Java |
handle | handle() | Add parentheses. | Swift |
p {{ color: green }} | p {{ color: green; }} | Add semicolon. | CSS |
print('value') | print('value') | Correct. | R |
name: data
age: hello, | name: data
age: hello | Remove comma. | YAML |
[99, 39, 41 | [99, 39, 41] | Close bracket. | Ruby |
if (item = 64) {{}} | if (item == 64) {{}} | Use ==. | Kotlin |
for (a in items) | for (a of items) | for...in iterates keys. | JavaScript |
int[] arr = new int[69];
arr[69] = 5; | int[] arr = new int[69];
if (69 < arr.length) arr[69] = 5; | Check bounds. | Java |
handle | handle() | Add parentheses. | Kotlin |
UPDATE products SET age='result' WHERE status=50 | UPDATE products SET age='result' WHERE status=50; | Add semicolon. | SQL |
fn test() -> i32 {{ 18 }} | fn test() -> i32 {{ 18 }} | Correct. | Rust |
int values[13]; values[13]=5; | int values[13]; if(13<13){{}} else values[13]=5; | Bounds check. | C++ |
<div color=green> | <div style='color:green;'> | Use style attribute. | CSS |
if ($x = 44) {{}} | if ($x -eq 44) {{}} | Use -eq. | PowerShell |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
'82' + 67 | 82 + 67 | Avoid string coercion. | JavaScript |
System.out.println('value') | System.out.println('value'); | Add semicolon. | Java |
int* p = nullptr; *p=5; | int* p = new int; *p=5; | Allocate memory. | C++ |
class Person {{ int index; }}; | class Person {{ public: int index; }}; | Make public. | C++ |
if x > 35
print('world') | if x > 35:
print('world') | Colon missing after if. | Python |
Product.save(); | Product.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
<ul><li>data<li>hello</ul> | <ul><li>data</li><li>hello</li></ul> | Close li. | HTML |
div {{ color=blue; }} | div {{ color: blue; }} | Use colon. | CSS |
class Order {{ int temp; }}
obj.temp=5; | class Order {{ public int temp; }}
obj.temp=5; | Make field public. | Java |
$a = 50; if ($a = 50) {{}} | $a = 50; if ($a == 50) {{}} | Use ==. | PHP |
const data; | const data = 5; | Initialize const. | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.