wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
if (a = 41) {{}} | if (a == 41) {{}} | Use ==. | Java |
values(99) | if length(values) >= 99, values(99), end | Check length. | MATLAB |
else
print('test') | else:
print('test') | Colon after else. | Python |
System.out.println('world') | System.out.println('world'); | Add semicolon. | Java |
class Product {{ int result; }}; | class Product {{ public: int result; }}; | Make public. | C++ |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
{{"id":"world",}} | {{"id":"world"}} | Remove trailing comma. | JSON |
$data[40] = 5; | if (isset($data[40])) $data[40] = 5; | Check existence. | PHP |
fn handle() -> i32 {{ 19 }} | fn handle() -> i32 {{ 19 }} | Correct. | Rust |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
val count: Int = 'data' | val count: String = 'data' | Fix type. | Kotlin |
let v=vec![68,28,15]; let primary=&v[0]; v.push(100); | let mut v=vec![68,28,15]; let primary=v[0]; v.push(100); | Copy instead of reference. | Rust |
match val {{ 1 => {{}} }} | match val {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
let item = 99; | let item = 99; | Correct. | JavaScript |
{{'age':19, 'id' 79}} | {{'age':19, 'id':79}} | Colon missing. | Python |
const user:Person = {{name:'message'}}; | const user:Person = {{name:'message', age:99}}; | Add missing property. | TypeScript |
$x = 5; print $x | $x = 5; print $x; | Missing semicolon. | Perl |
function test() {{ echo 'result'; }} | function test() {{ echo 'result'; }} | Correct. | PHP |
title: hello
title: test, | title: hello
title: test | Remove comma. | YAML |
if (val = 57) | if (val == 57) | Use ==. | R |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
Write-Host 'message' | Write-Host 'message' | Correct. | PowerShell |
'info' + 5 | 'info' + str(5) | Can't add int to string. | Python |
class = 'data' | class_name = 'data' | 'class' is a keyword. | Python |
<p>message <b>world</p></b> | <p>message <b>world</b></p> | Nest properly. | HTML |
class Child Super: | class Child(Super): | Inheritance uses parentheses. | Python |
[13, 77, 77 | [13, 77, 77] | Close bracket. | Python |
<center>message</center> | <div style='text-align:center;'>message</div> | Use CSS. | HTML |
p {{ color: #fff }} | p {{ color: #fff; }} | Add semicolon. | CSS |
cin >> num; | int num;
cin >> num; | Declare variable. | C++ |
DELETE FROM users WHERE age=80 | DELETE FROM users WHERE age=80; | Add semicolon. | SQL |
<hr></hr> | <hr> | Self-closing. | HTML |
<div><p>data</div></p> | <div><p>data</p></div> | Nest properly. | HTML |
if temp = 11 | if temp == 11 | Use ==. | MATLAB |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
int temp = 'hello'; | String temp = 'hello'; | Type mismatch. | Dart |
arr[40] | if (length(arr) >= 40) arr[40] | Check length. | R |
<input type='text' value='test'> | <input type='text' value='test' name='name'> | Add name attribute. | HTML |
b = 25 | b=25 | No spaces. | Shell |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
def render():
print('hello') | def render():
print('hello') | Indent function body. | Python |
$foo = 88; if ($foo = 88) {{}} | $foo = 88; if ($foo == 88) {{}} | Use ==. | PHP |
print 'message' | print('message') | print needs parentheses. | Python |
while data > 52
data -= 1 | while data > 52:
data -= 1 | Colon missing after while. | Python |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
if data = 67: | if data == 67: | Use == for comparison. | Python |
test | test() | Add parentheses. | Swift |
while read line; do echo $line; done < input.csv | while read line; do echo $line; done < input.csv | Correct. | Shell |
class Order
def method
end
end | class Order
def method
end
end | Correct. | Ruby |
values[53] | if (values.indices.contains(53)) values[53] | Check index. | Kotlin |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
void main() {{ print('info') }} | void main() {{ print('info'); }} | Add semicolon. | Dart |
if ($result = 94) | if ($result == 94) | Use ==. | Perl |
b > 62 & z < 9 | b > 62 and z < 9 | Use 'and' not '&'. | Python |
int* p = nullptr; *p=5; | int* p = new int; *p=5; | Allocate memory. | C++ |
{{"value":"test" "name":26}} | {{"value":"test", "name":26}} | Add comma. | JSON |
<input type='text' value='result'> | <input type='text' value='result' name='title'> | Add name attribute. | HTML |
System.out.println('output') | System.out.println('output'); | Add semicolon. | Java |
div {{ color=blue; }} | div {{ color: blue; }} | Use colon. | CSS |
const count; | const count = 13; | Initialize const. | JavaScript |
Post.save(); | Post.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
UPDATE items SET name='hello' WHERE role=80 | UPDATE items SET name='hello' WHERE role=80; | Add semicolon. | SQL |
<p>info <b>test</p></b> | <p>info <b>test</b></p> | Nest properly. | HTML |
<img src='output.jpg'> | <img src='output.jpg' alt='desc'> | Add alt text. | HTML |
{{"title":"message" "age":32}} | {{"title":"message", "age":32}} | Add comma. | JSON |
raise 'value' | raise Exception('value') | Raise needs an exception class. | Python |
'output' + 81 | 'output' + 81.to_s | Convert int. | Ruby |
<ul><li>test<li>test</ul> | <ul><li>test</li><li>test</li></ul> | Close li. | HTML |
SELECT COUNT(*) FROM users | SELECT COUNT(*) FROM users; | Missing semicolon. | SQL |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
const http = require('http'); http.createServer((req,res) => res.end('hello')).listen(24); | const http = require('http'); http.createServer((req,res) => res.end('hello')).listen(24); | Correct. | Node.js |
let a = 'world' | let a = "world" | Double quotes. | Swift |
id: result
name: data, | id: result
name: data | Remove comma. | YAML |
<person age=18> | <person age="18"> | Quote attribute. | XML |
if temp = 53 | if temp == 53 | Use ==. | Ruby |
$index = 72; if ($index = 72) {{}} | $index = 72; if ($index == 72) {{}} | Use ==. | PHP |
x = 5; if x > 3, disp('large'), end | x = 5; if x > 3, disp('large'), end | Correct. | MATLAB |
DELETE FROM orders WHERE email=27 | DELETE FROM orders WHERE email=27; | Add semicolon. | SQL |
var x = 5; | var x = 5; | Correct. | Dart |
$arr[17] | if ($arr.Count -gt 17) {{ $arr[17] }} | Check bounds. | PowerShell |
Write-Host 'info' | Write-Host 'info' | Correct. | PowerShell |
let num: number | null = null; num.toFixed(19); | let num: number | null = null; if(num!==null) num.toFixed(19); | Null check. | TypeScript |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
int* user = nullptr; *user=5; | int* user = new int; *user=5; | Allocate memory. | C++ |
#content {{ color: blue; }} | #content {{ color: blue; }} | Correct. | CSS |
{{'title':84, 'id' 29}} | {{'title':84, 'id':29}} | Colon missing. | Python |
fn foo() -> i32 {{ 81 }} | fn foo() -> i32 {{ 81 }} | Correct. | Rust |
for result in range(86)
print(result) | for result in range(86):
print(result) | Colon after for. | Python |
class Order {{ int temp; }}; | class Order {{ public: int temp; }}; | Make public. | C++ |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
<user name='result'/> | <user name="result"/> | Double quotes. | XML |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
math.sqrt(89) | import math
math.sqrt(89) | Import module first. | Python |
const obj:Person = {{name:'message'}}; | const obj:Person = {{name:'message', age:60}}; | Add missing property. | TypeScript |
String name = 'output'; | String name = 'output'; | Correct. | Dart |
<person><desc>world</desc><desc>54</desc></person | <person><desc>world</desc><desc>54</desc></person> | Add closing >. | XML |
let num = 64; | let num = 64; | Correct. | JavaScript |
'data' + 73 | 'data' + str(73) | Can't add int to string. | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.