buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k | change_count int64 0 100 |
|---|---|---|---|---|---|
#include <stdio.h>
int main() {
int x, y, d, tmp;
scanf("%d %d", &x, &y);
if (x < y) {
tmp = x;
x = y;
y = tmp;
}
while (y > 0) {
d = x % y;
x = y;
y = d;
}
printf("%d\n", y);
return 0;
}
| #include <stdio.h>
int main() {
int x, y, d, tmp;
scanf("%d %d", &x, &y);
if (x < y) {
tmp = x;
x = y;
y = tmp;
}
while (y > 0) {
d = x % y;
x = y;
y = d;
}
printf("%d\n", x);
return 0;
}
| [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 0 | 85 | 2 |
#include <stdio.h>
int main() {
int x, y, r;
scanf("%d%d", &x, &y);
if (x < y) {
r = x;
x = y;
y = r;
}
while (r != 0) {
r = x % y;
x = y;
y = r;
}
printf("%d\n", x);
return 0;
}
| #include <stdio.h>
int main() {
int x, y, r = 1;
scanf("%d%d", &x, &y);
if (x < y) {
r = x;
x = y;
y = r;
}
while (r != 0) {
r = x % y;
x = y;
y = r;
}
printf("%d\n", x);
return 0;
}
| [["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 0 | 83 | 2 |
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func gcd(x, y int) {
if x == 0 || y == 0 {
fmt.Println(0)
return
} else if x == 1 || y == 1 {
fmt.Println(1)
return
} else if x > y && x%y == 0 {
fmt.Println(y)
return
} else if y > x && y%x == 0 {
fmt.Println(x)
return
} else {
if x > y ... | package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func gcd(x, y int) {
if x == 0 || y == 0 {
fmt.Println(0)
return
} else if x == 1 || y == 1 {
fmt.Println(1)
return
} else if x >= y && x%y == 0 {
fmt.Println(y)
return
} else if y > x && y%x == 0 {
fmt.Println(x)
return
} else {
if x > y... | [["-", 75, 57, 75, 57, 15, 16, 31, 16, 17, 47], ["+", 75, 57, 75, 57, 15, 16, 31, 16, 17, 20]] | 7 | 249 | 2 |
package main
import "fmt"
func main(){
var x, y int
fmt.Scan(&x, &y)
ans := gcd(x, y)
fmt.Println(ans)
}
func gcd(x, y int)(ret int){
if x<=y{
gcd(y, x)
}
for 0<y{
x, y = y, x%y
}
return x
}
| package main
import "fmt"
func main(){
var x, y int
fmt.Scan(&x, &y)
ans := gcd(x, y)
fmt.Println(ans)
}
func gcd(x, y int)(ret int){
if x<y{
gcd(y, x)
}
for 0<y{
x, y = y, x%y
}
return x
}
| [["-", 0, 435, 8, 196, 0, 57, 15, 16, 17, 19], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 18]] | 7 | 97 | 2 |
package main
import (
"fmt"
)
func min(a, b int) int{
if a < b {
return a
} else {
return b
}
}
func abs(a, b int) int{
if a < b {
return b-a;
} else {
return a-b;
}
}
func main(){
var x, y int
fmt.Scanln(&x, &y)
for ; x==y; {
z := abs(... | package main
import (
"fmt"
)
func min(a, b int) int{
if a < b {
return a
} else {
return b
}
}
func abs(a, b int) int{
if a < b {
return b-a;
} else {
return a-b;
}
}
func main(){
var x, y int
fmt.Scanln(&x, &y)
for{
if x == y {
... | [["-", 0, 435, 8, 196, 0, 7, 0, 430, 0, 35], ["+", 0, 435, 8, 196, 0, 7, 8, 196, 0, 45], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 165], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 0, 435, 8, 196, 0, 7, 8, 196, 0, 165], ["-", 0,... | 7 | 133 | 10 |
const config = {
input : '/dev/stdin',
newline : '\n'
};
const line =
require('fs').readFileSync(config.input, 'utf-8').split(config.newline);
const isPrime = n => {
if (n < 2)
return false;
if (n === 2)
return true;
for (let i = 2; i * i <= n; i++) {
if (n % i === 0)
return false;
}... | const config = {
input : '/dev/stdin',
newline : '\n'
};
const line =
require('fs').readFileSync(config.input, 'utf-8').split(config.newline);
const isPrime = n => {
if (n < 2)
return false;
if (n === 2)
return true;
for (let i = 2; i * i <= n; i++) {
if (n % i === 0)
return false;
}... | [["+", 500, 2, 63, 558, 500, 2, 3, 3, 0, 21], ["+", 500, 2, 3, 3, 0, 16, 31, 558, 500, 22], ["+", 500, 2, 3, 3, 0, 16, 31, 558, 0, 131], ["+", 500, 2, 3, 3, 0, 16, 31, 558, 559, 560], ["+", 63, 558, 500, 2, 3, 3, 0, 16, 17, 33], ["+", 63, 558, 500, 2, 3, 3, 0, 16, 12, 555]] | 2 | 152 | 6 |
<?php
$n = trim(fgets(STDIN));
$a = array();
while ($n--) {
$a[] = trim(fgets(STDIN));
}
echo sosu($a) . "\n";
function sosu($a) {
$cnt = 0;
foreach ($a as $v) {
if ($v == 2) {
$cnt++;
continu;
}
if ($v < 2 || $v % 2 == 0) {
continue;
}
$flg = false;
$p = ceil(sqrt($v));
f... | <?php
$n = trim(fgets(STDIN));
$a = array();
while ($n--) {
$a[] = trim(fgets(STDIN));
}
echo sosu($a) . "\n";
function sosu($a) {
$cnt = 0;
foreach ($a as $v) {
if ($v == 2) {
$cnt++;
continue;
}
if ($v < 2 || $v % 2 == 0) {
continue;
}
$flg = false;
$p = ceil(sqrt($v));
... | [["-", 8, 9, 0, 57, 8, 9, 0, 1, 0, 141], ["+", 8, 9, 0, 57, 8, 9, 0, 116, 0, 117]] | 6 | 176 | 2 |
<?php
$count = trim(fgets(STDIN));
$out = 0;
for ($i = 0; $i < $count; $i++) {
$n = trim(fgets(STDIN));
$out = $out + isprime($n);
}
print($out);
function isprime($n) {
if ($n == 2) {
return 1;
} else if ($n % 2 == 0) {
return 0;
} else {
$x = gmp_intval(gmp_sqrt($n));
for ($i = 3; $x >= $i; $i+=2) {
... | <?php
$count = trim(fgets(STDIN));
$out = 0;
for ($i = 0; $i < $count; $i++) {
$n = trim(fgets(STDIN));
$out = $out + isprime($n);
}
print($out);
function isprime($n) {
if ($n == 2) {
return 1;
} else if ($n % 2 == 0) {
return 0;
} else {
$x = floor(sqrt($n));
for ($i = 3; $x >= $i; $i+=2) {
if ($n ... | [["-", 8, 9, 0, 1, 0, 11, 12, 613, 63, 141], ["+", 8, 9, 0, 1, 0, 11, 12, 613, 63, 141], ["-", 12, 613, 3, 3, 0, 28, 0, 613, 63, 141], ["+", 12, 613, 3, 3, 0, 28, 0, 613, 63, 141]] | 6 | 156 | 4 |
<?php
$n=trim(fgets(STDIN));
$c=0;
for($i=0;$i<$n;$i++){
if(trim(fgets(STDIN))) ++$c;
}
print $c;
function isPn($n){
if($n<2) return 0;
if($n==2) return 1;
if($n%2==0) return 0;
$max=floor(sqrt($n));
for($i=3;$i<=$max;$i++) if($n%$i==0) return 0;
return 1;
}
?> | <?php
$n=trim(fgets(STDIN));
$c=0;
for($i=0;$i<$n;$i++){
if(isPn(trim(fgets(STDIN)))) ++$c;
}
print $c;
function isPn($n){
if($n<2) return 0;
if($n==2) return 1;
if($n%2==0) return 0;
$max=floor(sqrt($n));
for($i=3;$i<=$max;$i+=2) if($n%$i==0) return 0;
return 1;
}
?> | [["+", 0, 9, 0, 57, 15, 23, 0, 613, 63, 141], ["+", 0, 57, 15, 23, 0, 613, 3, 3, 0, 24], ["+", 3, 3, 0, 28, 0, 613, 3, 3, 0, 25], ["-", 0, 14, 8, 9, 0, 7, 0, 27, 0, 29], ["+", 0, 14, 8, 9, 0, 7, 0, 564, 17, 107], ["+", 0, 14, 8, 9, 0, 7, 0, 564, 12, 612]] | 6 | 140 | 6 |
import java.util.*;
public class Main {
static boolean isPrime(int x) {
if (x == 2)
return true;
if (x < 2 || x % 2 == 0)
return false;
int i = 3;
while (i < Math.sqrt(x)) {
if (x % i == 0)
return false;
i += 2;
}
return true;
}
public static void main(Str... | import java.util.*;
public class Main {
static boolean isPrime(int x) {
if (x == 2)
return true;
if (x < 2 || x % 2 == 0)
return false;
int i = 3;
while (i <= Math.sqrt(x)) {
if (x % i == 0)
return false;
i += 2;
}
return true;
}
public static void main(St... | [["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 17, 19]] | 3 | 162 | 2 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] numbers = new int[n];
for (int i = 0; i < n; i++) {
numbers[i] = sc.nextInt();
}
System.out.println(count(numbers, n));
sc.close()... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] numbers = new int[n];
for (int i = 0; i < n; i++) {
numbers[i] = sc.nextInt();
}
System.out.println(count(numbers, n));
sc.close()... | [["-", 75, 57, 75, 196, 0, 7, 15, 16, 17, 18], ["+", 75, 57, 75, 196, 0, 7, 15, 16, 17, 19]] | 3 | 244 | 2 |
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
int num = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
class Inner {
boolean inner(int x) {
if (x == 2)... | import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
int num = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
class Inner {
boolean inner(int x) {
if (x == 2)... | [["+", 0, 195, 8, 196, 0, 57, 75, 57, 0, 95], ["+", 8, 196, 0, 57, 75, 57, 75, 196, 0, 45], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 12, 499], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 499], ["+", 8, 196, 0, 57, 75, 57, 75, 196, 0, 46]] | 3 | 207 | 5 |
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
try {
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
final int n = Integer.parseInt(reader.readLine());
final int[] list = new i... | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
try {
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
final int n = Integer.parseInt(reader.readLine());
final int[] list = new i... | [["-", 51, 74, 51, 492, 3, 4, 0, 16, 31, 499], ["-", 51, 74, 51, 492, 3, 4, 0, 16, 17, 85], ["-", 51, 74, 51, 492, 3, 4, 0, 16, 12, 499], ["+", 49, 200, 51, 74, 51, 492, 3, 4, 0, 515], ["-", 75, 57, 75, 196, 0, 7, 15, 16, 17, 18], ["+", 75, 57, 75, 196, 0, 7, 15, 16, 17, 19]] | 3 | 299 | 6 |
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int count = 0;
for (int i = 0; i < n; i++) {
if (isPrime(stdIn.nextInt()))
count++;
}
System.out.println(count);
}
static boolean isPri... | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int count = 0;
for (int i = 0; i < n; i++) {
if (isPrime(stdIn.nextInt()))
count++;
}
System.out.println(count);
}
static boolean isPri... | [["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 195, 8, 196, 0, 7, 26, 11, 17, 107], ["-", 0, 195, 8, 196, 0, 7, 26, 11, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 26, 27, 0, 29]] | 3 | 136 | 5 |
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
// Scanner sc = new Scanner(new File("test_1.txt"));
// Scanner sc = new Scanner(new File("t... | import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
// Scanner sc = new Scanner(new File("test_1.txt"));
// Scanner sc = new Scanner(new File("t... | [["-", 0, 514, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 514, 8, 196, 0, 7, 15, 16, 17, 19]] | 3 | 174 | 2 |
import java.io.InputStream;
import java.util.Scanner;
public class Main {
private static boolean isPrime(int x) {
if (x == 1) {
return false;
}
if (x == 2) {
return true;
}
if (x % 2 == 0) {
return false;
}
for (int i = 3; i < Math.sqrt(x); i++) {
if (x % i == 0) ... | import java.io.InputStream;
import java.util.Scanner;
public class Main {
private static boolean isPrime(int x) {
// Eratosthenes sieve
if (x == 1) {
return false;
}
if (x == 2) {
return true;
}
if (x % 2 == 0) {
return false;
}
for (int i = 3; i < Math.sqrt(x) + ... | [["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]] | 3 | 207 | 2 |
import java.util.Scanner;
public final class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int count = 0;
for (int i = 0; i < n; i++) {
if (isPrime(i))
count++;
}
System.out.println(count);
}
static boolean i... | import java.util.Scanner;
public final class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int count = 0;
for (int i = 0; i < n; i++) {
if (isPrime(scan.nextInt()))
count++;
}
System.out.println(count);
}
sta... | [["-", 0, 57, 15, 15, 0, 492, 3, 4, 0, 22], ["+", 15, 15, 0, 492, 3, 4, 0, 492, 500, 22], ["+", 15, 15, 0, 492, 3, 4, 0, 492, 0, 131], ["+", 15, 15, 0, 492, 3, 4, 0, 492, 141, 22], ["+", 0, 492, 3, 4, 0, 492, 3, 4, 0, 24], ["+", 0, 492, 3, 4, 0, 492, 3, 4, 0, 25]] | 3 | 135 | 6 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] e = new int[n];
for (int i = 0; i < n; i++)
e[i] = scan.nextInt();
int r = 0;
for (int i = 0; i < n; i++)
if (isPrime(e[i]... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] e = new int[n];
for (int i = 0; i < n; i++)
e[i] = scan.nextInt();
int r = 0;
for (int i = 0; i < n; i++)
if (isPrime(e[i]... | [["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]] | 3 | 182 | 2 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int flag, num, cnt = 0;
for (int i = 0; i < n; i++) {
flag = 0;
num = sc.nextInt();
if (num % 2 == 0 && num != 2) {
flag = 1;
... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int flag, num, cnt = 0;
for (int i = 0; i < n; i++) {
flag = 0;
num = sc.nextInt();
if (num % 2 == 0 && num != 2) {
flag = 1;
... | [["-", 8, 196, 0, 7, 15, 16, 31, 16, 17, 18], ["+", 8, 196, 0, 7, 15, 16, 31, 16, 17, 19]] | 3 | 161 | 2 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int primeCnt = 0... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int primeCnt = 0... | [["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 195, 8, 196, 0, 7, 26, 27, 0, 29], ["+", 0, 195, 8, 196, 0, 7, 26, 11, 17, 107], ["+", 0, 195, 8, 196, 0, 7, 26, 11, 12, 499]] | 3 | 192 | 5 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.nextLine());
int cnt = 0;
for (int i = 0; i < n; i++) {
int a = Integer.parseInt(scan.nextLine());
if (isPrime(a)) {
cnt++;
... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.nextLine());
int cnt = 0;
for (int i = 0; i < n; i++) {
int a = Integer.parseInt(scan.nextLine());
if (isPrime(a)) {
cnt++;
... | [["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 195, 8, 196, 0, 7, 26, 11, 17, 107], ["-", 0, 195, 8, 196, 0, 7, 26, 11, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 26, 27, 0, 29]] | 3 | 177 | 5 |
def geta(n=0)
return $stdin.gets.to_i if n==0
ar = []
n.times do
ar << $stdin.gets.chomp.split
end
return ar.flatten(1) if n<=1
return ar
end
@ar = geta(1).map(&:to_i)
y,x = @ar.sort
rems = []
while (rem=x%y)>0
rems << rem
x = y
y = rem
end
p rems.min
| def geta(n=0)
return $stdin.gets.to_i if n==0
ar = []
n.times do
ar << $stdin.gets.chomp.split
end
return ar.flatten(1) if n<=1
return ar
end
@ar = geta(1).map(&:to_i)
y,x = @ar.sort
rems = [y]
while (rem=x%y)>0
rems << rem
x = y
y = rem
end
p rems.min
| [["+", 36, 36, 0, 493, 0, 662, 12, 516, 0, 22]] | 4 | 96 | 1 |
def gcd(x, y)
return x if y.zero?
gcd(y, x % y) if x >= y
end
x, y = gets.split.map(&:to_i)
puts gcd(x, y) | def gcd(x, y)
return x if y.zero?
gcd(y, x % y) if x >= y
end
x, y = gets.split.map(&:to_i).minmax.reverse
puts gcd(x, y) | [["+", 0, 493, 0, 662, 12, 652, 486, 652, 17, 131], ["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]] | 4 | 46 | 4 |
a, b = gets.strip.split(' ').map(&:to_i)
if a < b
x = b
b = a
a = b
end
while b != 0 && b <= a
mod = a % b
a = b
b = mod
end
puts a | a, b = gets.strip.split(' ').map(&:to_i)
if a < b
x = b
b = a
a = x
end
while b != 0 && b <= a
mod = a % b
a = b
b = mod
end
puts a | [["-", 0, 493, 0, 121, 64, 749, 0, 662, 12, 22], ["+", 0, 493, 0, 121, 64, 749, 0, 662, 12, 22]] | 4 | 56 | 2 |
x,y = gets,split.map(&:to_i)
def gcd(m,n)
if n == 0
m
else
gcd(n,m % n)
end
end
puts x < y ? gcd(x,y) : gcd(y,x) | x,y = gets.split.map(&:to_i)
def gcd(m,n)
if n == 0
m
else
gcd(n,m % n)
end
end
puts x < y ? gcd(x,y) : gcd(y,x) | [["-", 36, 36, 0, 493, 0, 662, 12, 762, 0, 21], ["+", 0, 493, 0, 662, 12, 652, 486, 652, 17, 131]] | 4 | 54 | 2 |
def gcd(x, y)
return x if y < 2;
x, y = y, x if( y > x )
return gcd(y, x%y)
end
x, y = gets.split.map(&:to_i)
printf "%d\n", gcd(x, y) | def gcd(x, y)
return x if y < 1;
x, y = y, x if( y > x )
return gcd(y, x%y)
end
x, y = gets.split.map(&:to_i)
printf "%d\n", gcd(x, y) | [["-", 0, 735, 8, 736, 0, 751, 15, 738, 12, 612], ["+", 0, 735, 8, 736, 0, 751, 15, 738, 12, 612]] | 4 | 62 | 2 |
array = gets.chomp.split(" ").map(&:to_i)
max = array.max
min = array.min
gcf = min
while true do
sur = max % min
if sur == 0
return
else
max = min
min = sur
end
end
puts min.to_s | array = gets.chomp.split(" ").map(&:to_i)
max = array.max
min = array.min
gcf = min
while true do
sur = max % min
if sur == 0
break
else
max = min
min = sur
end
end
puts min.to_s | [["-", 8, 170, 0, 121, 64, 749, 0, 38, 0, 38], ["+", 8, 170, 0, 121, 64, 749, 0, 94, 0, 94]] | 4 | 57 | 2 |
a, b = map(int, input().split())
c = []
if a > b:
a, b = b, a
if b%a == 0:
print(a)
else:
while True:
for i in range(a):
x = i + 2
print(a, x)
if a%x == 0:
if b%x == 0:
c.append(x)
a = a//x
... | a, b = map(int, input().split())
c = []
if a > b:
a, b = b, a
if b%a == 0:
print(a)
else:
while True:
for i in range(a):
x = i + 2
#print(a, x)
if a%x == 0:
if b%x == 0:
c.append(x)
a = a//x
... | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 167 | 6 |
a, b = map(int, input().split())
c = []
if a > b:
a, b = b, a
if b%a == 0:
print(a)
else:
while True:
for i in range(a):
x = i + 2
print(a, x)
if a%x == 0:
if b%x == 0:
c.append(x)
a = a//x
... | a, b = map(int, input().split())
c = []
if a > b:
a, b = b, a
if b%a == 0:
print(a)
else:
while True:
for i in range(a):
x = i + 2
if a%x == 0:
if b%x == 0:
c.append(x)
a = a//x
b = b//x
... | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 167 | 6 |
def gcd(a, b):
c = max([a, b])
d = min([a, b])
if c % d == 0:
return d
else:
gcd(d, c % d)
nums = input().split()
print(gcd(int(nums[0]), int(nums[1])))
| def gcd(a, b):
c = max([a, b])
d = min([a, b])
if c % d == 0:
return d
else:
return gcd(d, c % d)
nums = input().split()
print(gcd(int(nums[0]), int(nums[1])))
| [["+", 0, 57, 75, 76, 8, 196, 0, 37, 0, 38]] | 5 | 77 | 1 |
import sys
def div(x, y):
if x % y == 0:
print(y)
else:
div(y, x%y)
line = sys.stdin.readline()
x, y = line.split(" ")
x = int(x)
y = int(y)
if x > y:
x, y = y, x
if x == y:
divide = x
else:
div(x, y) | import sys
def div(x, y):
if x % y == 0:
print(y)
else:
div(y, x%y)
line = sys.stdin.readline()
x, y = line.split(" ")
x = int(x)
y = int(y)
if x < y:
x, y = y, x
if x == y:
print(x)
else:
div(x, y) | [["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 92 | 7 |
def geta(n=0)
return $stdin.gets.to_i if n==0
ar = []
n.times do
ar << $stdin.gets.chomp.split
end
return ar.flatten(1) if n<=1
return ar
end
def insert(idx)
return if idx-1<0
0.step(idx-1) do |i|
if @ar[i] > @ar[idx]
n = @ar.delete_at(idx)
@ar.insert( i, n)
return
end
... |
def geta(n=0)
return $stdin.gets.to_i if n==0
ar = []
n.times do
ar << $stdin.gets.chomp.split
end
return ar.flatten(1) if n<=1
return ar
end
def insert(idx)
return if idx-1<0
0.step(idx-1) do |i|
if @ar[i] > @ar[idx]
n = @ar.delete_at(idx)
@ar.insert( i, n)
return
end
... | [["-", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 0, 493, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 67], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["+", 0, 493, 0, 662, 12, 652, 3, 4, 0, 25]] | 4 | 138 | 6 |
class AOJ
def initialize
n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
1.upto(n-1) do |i|
j = i
v = a[j]
while j > 0 && v < a[j-1]
j -= 1
end
a.delete_at(i)
a.insert(j, v)
puts a.join(' ')
end
end
end
AOJ.new | class AOJ
def initialize
n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
0.upto(n-1) do |i|
j = i
v = a[j]
while j > 0 && v < a[j-1]
j -= 1
end
a.delete_at(i)
a.insert(j, v)
puts a.join(' ')
end
end
end
AOJ.new | [["-", 8, 736, 0, 735, 8, 736, 0, 652, 486, 612], ["+", 8, 736, 0, 735, 8, 736, 0, 652, 486, 612]] | 4 | 96 | 2 |
n = gets.toi
a = gets.split.map(&:to_i)
puts a * ' '
(1..n-1).each do |i|
j = i
while j>=1 && a[j]<a[j-1]
a[j-1], a[j] = a[j], a[j-1]
j -= 1
end
puts a * ' '
end
| n = gets.to_i
a = gets.split.map(&:to_i)
puts a * ' '
(1..n-1).each do |i|
j = i
while j>=1 && a[j]<a[j-1]
a[j-1], a[j] = a[j], a[j-1]
j -= 1
end
puts a * ' '
end
| [["-", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]] | 4 | 88 | 2 |
counts = 1
size = 0
array = []
def print_array(array)
str = ""
array.each{|s|
str = str + "\s" + s.to_s
}
puts str.strip!
end
loop{
if counts == 1 then
size = gets.to_i
else
array = gets.split("\s")
end
counts = counts + 1
if counts > 2 then
break
end
}
for i in 1..si... | counts = 1
size = 0
array = []
def print_array(array)
str = ""
array.each{|s|
str = str + "\s" + s.to_s
}
puts str.strip!
end
loop{
if counts == 1 then
size = gets.to_i
else
array = gets.split("\s")
end
counts = counts + 1
if counts > 2 then
break
end
}
for i in... | [["+", 15, 739, 0, 738, 12, 738, 31, 652, 17, 131], ["+", 15, 739, 0, 738, 12, 738, 31, 652, 735, 22]] | 4 | 150 | 2 |
n = STDIN.gets.chomp
a = STDIN.gets.chomp.split(' ').map {|num| num.to_i}
def insertion_sort a, n
i = 1
while i <= (n - 1) do
v = a[i]
j = i - 1
while (j >= 0) and (a[j] > v) do
a[j + 1] = a[j]
j -= 1
end
a[j + 1] = v
puts a.join ' '
i += 1
end
end
insertion_sort a, n.to... | n = STDIN.gets.chomp
a = STDIN.gets.chomp.split(' ').map {|num| num.to_i}
def insertion_sort a, n
puts a.join ' '
i = 1
while i <= (n - 1) do
v = a[i]
j = i - 1
while (j >= 0) and (a[j] > v) do
a[j + 1] = a[j]
j -= 1
end
a[j + 1] = v
puts a.join ' '
i += 1
end
end
inse... | [["+", 0, 493, 0, 735, 8, 736, 0, 652, 735, 22], ["+", 8, 736, 0, 652, 3, 4, 0, 652, 486, 22], ["+", 8, 736, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 8, 736, 0, 652, 3, 4, 0, 652, 735, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 4 | 116 | 7 |
n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)[0..n]
n.times do |i|
v = a[i]
j = i-1
while j >= 0 && a[j] > v
a[j+1] = a[j]
j-=1
end
a[j+1] = v
p a.join(' ')
end | n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)[0..n]
n.times do |i|
v = a[i]
j = i-1
while j >= 0 && a[j] > v
a[j+1] = a[j]
j-=1
end
a[j+1] = v
puts a.join(' ')
end | [["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22]] | 4 | 92 | 2 |
n = gets.to_i
array = gets.chomp.split(' ').map(&:to_i)
p array.join(' ')
for i in 1..(n-1) do
v = array[i]
j = i - 1
while j >= 0 && array[j] > v
array[j+1] = array[j]
j -= 1
array[j+1] = v
end
p array.join(' ')
end | n = gets.to_i
array = gets.chomp.split(' ').map(&:to_i)
puts array.join(' ')
for i in 1..(n-1) do
v = array[i]
j = i - 1
while j >= 0 && array[j] > v
array[j+1] = array[j]
j -= 1
array[j+1] = v
end
puts array.join(' ')
end | [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 0, 493, 0, 88, 8, 170, 0, 652, 735, 22], ["+", 0, 493, 0, 88, 8, 170, 0, 652, 735, 22]] | 4 | 98 | 6 |
n = gets.to_i
array = gets.chomp.split(' ').map(&:to_i)
p array.join(' ')
for i in 1..(n-1) do
v = array[i]
j = i - 1
while j >= 0 && array[j] > v
array[j+1] = array[j]
j -= 1
array[j+1] = v
end
p array.join(' ')
end | n = gets.to_i
array = gets.chomp.split(' ').map(&:to_i)
puts array.join(' ')
for i in 1..(n-1) do
v = array[i]
j = i - 1
while j >= 0 && array[j] > v
array[j+1] = array[j]
j -= 1
end
array[j+1] = v
puts array.join(' ')
end | [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 0, 88, 8, 170, 0, 89, 8, 170, 0, 444], ["-", 0, 88, 8, 170, 0, 89, 8, 170, 0, 444], ["-", 0, 493, 0, 88, 8, 170, 0, 652, 735, 22], ["+", 0, 493, 0, 88, 8, 170, 0, 652, 735, 22]] | 4 | 98 | 6 |
n = get.strip.to_i
array = gets.split.map(&:to_i)
puts array.join(' ')
for i in 1..n-1 do
key = array[i]
j = i
while j > 0&& array[j-1] > key do
array[j] = array[j-1]
j -= 1
end
array[j] = key
puts array.join(' ')
end | n = gets.strip.to_i
array = gets.split.map(&:to_i)
puts array.join(' ')
for i in 1..n-1 do
key = array[i]
j = i
while j > 0 && array[j-1] > key do
array[j] = array[j-1]
j -= 1
end
array[j] = key
puts array.join(' ')
end | [["-", 0, 493, 0, 662, 12, 652, 486, 652, 486, 22], ["+", 0, 493, 0, 662, 12, 652, 486, 652, 486, 22]] | 4 | 90 | 2 |
n = gets.to_i
arr = gets.chomp.split.map(&:to_i)
def puts_arr(arr)
puts arr.join(' ')
end
def insertionSort(arr, n)
1.upto(n-1) do |i|
v = arr[i]
j = i-1
while j>=0 && arr[j] > v
arr[j+1] = arr[j]
j -= 1
end
arr[j+1] = v
puts_arr(arr)
end
end
insertionSort(arr, n) | n = gets.to_i
arr = gets.chomp.split.map(&:to_i)
def puts_arr(arr)
puts arr.join(' ')
end
def insertionSort(arr, n)
1.upto(n-1) do |i|
v = arr[i]
j = i-1
while j>=0 && arr[j] > v
arr[j+1] = arr[j]
j -= 1
end
arr[j+1] = v
puts_arr(arr)
end
end
puts_arr(arr)
insertionSort(arr,... | [["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 24], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 25]] | 4 | 109 | 4 |
n = gets.to_i
a = gets.split.map(&:to_i)
def insertionSort(a,n)
for k in 0..n-2
print "#{a[k]} "
end
print a[n-1]
for i in 1..n-1
v = a[i]
j = i-1
while j >= 0 && a[j] > v
a[j+1] = a[j]
j -= 1
a[j+1] = v
end
for k in 0..n-2
print "#{a[k]} "
end
print ... | n = gets.to_i
a = gets.split.map(&:to_i)
def insertionSort(a,n)
for k in 0..n-2
print "#{a[k]} "
end
puts a[n-1]
for i in 1..n-1
v = a[i]
j = i-1
while j >= 0 && a[j] > v
a[j+1] = a[j]
j -= 1
a[j+1] = v
end
for k in 0..n-2
print "#{a[k]} "
end
puts a[n-1]
... | [["-", 0, 493, 0, 735, 8, 736, 0, 652, 735, 22], ["+", 0, 493, 0, 735, 8, 736, 0, 652, 735, 22], ["-", 8, 736, 0, 88, 8, 170, 0, 652, 735, 22], ["+", 8, 736, 0, 88, 8, 170, 0, 652, 735, 22]] | 4 | 136 | 4 |
n = gets.chomp.to_i
ary = gets.split(" ").map(&:to_i)
i = 1
p ary.join(" ")
while i < n
v = ary[i]
j = i - 1
while j >= 0 && ary[j] > v
ary[j + 1] = ary[j]
j -= 1
end
ary[j + 1] = v
p ary.join(" ")
i += 1
end | n = gets.chomp.to_i
ary = gets.split(" ").map(&:to_i)
i = 1
puts ary.join(" ")
while i < n
v = ary[i]
j = i - 1
while j >= 0 && ary[j] > v
ary[j + 1] = ary[j]
j -= 1
end
ary[j + 1] = v
puts ary.join(" ")
i += 1
end | [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22]] | 4 | 97 | 4 |
N = gets.strip.to_i
A = gets.split.map(&:to_i)
res = Array.new
res << A.join(' ') + "\n"
for i in 1..(N-1)
key = A[i]
j = i - 1
while j >= 0 and A[j] > key
A[j+1] = A[j]
j =- 1
end
A[j+1] = key
res << A.join(' ') + "\n"
end
print res.join | N = gets.strip.to_i
A = gets.split.map(&:to_i)
res = Array.new
res << A.join(' ') + "\n"
for i in 1..(N-1)
key = A[i]
j = i - 1
while j >= 0 and A[j] > key
A[j+1] = A[j]
j -= 1
end
A[j+1] = key
res << A.join(' ') + "\n"
end
print res.join | [["-", 8, 170, 0, 89, 8, 170, 0, 662, 0, 32], ["-", 0, 89, 8, 170, 0, 662, 12, 748, 17, 33], ["+", 8, 170, 0, 89, 8, 170, 0, 755, 17, 110]] | 4 | 112 | 3 |
input = []
while (n = gets.to_i) != 0 do
input = gets.split.map(&:to_i)
end
for i in 1..input.size - 1 do
v = input[i]
j = i - 1
while j >= 0 && input[j] > v do
input[j+1] = input[j]
j -= 1
input[j+1] = v
end
puts input*" "
end
| input = []
while (n = gets.to_i) != 0 do
input = gets.split.map(&:to_i)
end
puts input*" "
for i in 1..input.size - 1 do
v = input[i]
j = i - 1
while j >= 0 && input[j] > v do
input[j+1] = input[j]
j -= 1
input[j+1] = v
end
puts input*" "
end
| [["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 31, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 17, 48], ["+", 0, 652, 3, 4, 0, 738, 12, 557, 0, 62], ["+", 0, 652, 3, 4, 0, 738, 12, 557, 0, 6]] | 4 | 91 | 6 |
def intersection_sort(arr, n)
for i in 1..(n-1)
v = arr[i]
j = i-1
while j >= 0 and arr[j] > v
arr[j+1] = arr[j]
j = j - 1
end
arr[j+1] = v
p arr.join(' ')
end
end
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i).shift(n)
p arr.join(' ')
intersection_sort(arr, n)
| def intersection_sort(arr, n)
for i in 1..(n-1)
v = arr[i]
j = i-1
while j >= 0 and arr[j] > v
arr[j+1] = arr[j]
j = j - 1
end
arr[j+1] = v
puts arr.join(' ')
end
end
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i).shift(n)
puts arr.join(' ')
intersection_sort(arr, ... | [["-", 8, 736, 0, 88, 8, 170, 0, 652, 735, 22], ["+", 8, 736, 0, 88, 8, 170, 0, 652, 735, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]] | 4 | 120 | 4 |
gets
ar = gets.split.map(&:to_i)
n = ar.size
putout = ->{puts ar.join(" ")}
putout.(ar)
1.upto(n - 1) do |i|
v = ar[i]
j = i - 1
while j >= 0 and ar[j] > v
ar[j + 1] = ar[j]
j -= 1
end
ar[j + 1] = v
putout.(ar)
end
| gets
ar = gets.split.map(&:to_i)
n = ar.size
putout = ->{puts ar.join(" ")}
putout.()
1.upto(n - 1) do |i|
v = ar[i]
j = i - 1
while j >= 0 and ar[j] > v
ar[j + 1] = ar[j]
j -= 1
end
ar[j + 1] = v
putout.()
end
| [["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22], ["-", 196, 737, 8, 736, 0, 652, 3, 4, 0, 22]] | 4 | 99 | 2 |
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
a.each.with_index do |key, i|
next if i.zero?
j = i - 1
while j >= 0 && a[j] > key
a[j+1] = a[j]
j -= 1
end
a[j+1] = key
puts a.join(' ')
end | n = gets.to_i
a = gets.chomp.split.map(&:to_i)
a.each.with_index do |key, i|
j = i - 1
while j >= 0 && a[j] > key
a[j+1] = a[j]
j -= 1
end
a[j+1] = key
puts a.join(' ')
end | [["-", 196, 737, 8, 736, 0, 751, 8, 746, 0, 746], ["-", 0, 652, 196, 737, 8, 736, 0, 751, 0, 121], ["-", 196, 737, 8, 736, 0, 751, 15, 652, 486, 22], ["-", 196, 737, 8, 736, 0, 751, 15, 652, 17, 131], ["-", 196, 737, 8, 736, 0, 751, 15, 652, 735, 22]] | 4 | 83 | 5 |
length=int(input())
firstArray=input()
listForArray=list(map(int,firstArray.split()))
listForPrint=[firstArray]
def insertionSort(list,length):
index=1
while index<length:
if listForArray[index]<listForArray[index-1]:
for index2 in range(0,index):
if listForArray[index2-1]<l... | length=int(input())
firstArray=input()
listForArray=list(map(int,firstArray.split()))
listForPrint=[firstArray]
def insertionSort(list,length):
index=1
while index<length:
if listForArray[index]<=listForArray[index-1]:
for index2 in range(0,index):
if listForArray[index2-1]... | [["-", 0, 52, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 19], ["-", 0, 57, 15, 679, 31, 679, 31, 666, 667, 18], ["+", 0, 57, 15, 679, 31, 679, 31, 666, 667, 19], ["-", 0, 57, 15, 679, 31, 679, 12, 666, 667, 18], ["+", 0, 57, 15, 679, 31, 679, 12, 666, 667, 19], ["-", 0, 57, 15, 679, 12,... | 5 | 201 | 8 |
def main():
n = int(input())
Mtx = list(map(int, input().split()))
for i in range(1,n):
for j in range(i,0,-1):
if Mtx[j] < Mtx[j-1]:
Mtx[j-1], Mtx[j] = Mtx[j], Mtx[j-1]
# print(i, j, sep=', ')
showMtx(Mtx)
def showMtx(Mtx):
... | def main():
n = int(input())
Mtx = list(map(int, input().split()))
showMtx(Mtx)
for i in range(1,n):
for j in range(i,0,-1):
if Mtx[j] < Mtx[j-1]:
Mtx[j-1], Mtx[j] = Mtx[j], Mtx[j-1]
# print(i, j, sep=', ')
showMtx(Mtx)
def s... | [["+", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 159 | 4 |
input()
myarr = list(map(int, input().split()))
for i in range(1, len(myarr)):
for j in range(i, 0,-1):
if myarr[j] < myarr[j-1]:
t = myarr[j]
myarr[j] = myarr[j-1]
myarr[j-1] = t
else:
break
print(" ".join(map(str, myarr)))
| input()
myarr = list(map(int, input().split()))
for i in range(len(myarr)):
for j in range(i, 0,-1):
if myarr[j] < myarr[j-1]:
t = myarr[j]
myarr[j] = myarr[j-1]
myarr[j-1] = t
else:
break
print(" ".join(map(str, myarr)))
| [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]] | 5 | 103 | 2 |
def main():
N = int(input())
A = list(map(int,input().split()))
insertionSort(A, N)
def insertionSort(A, N):
for i in range(1,N):
v = A[i]
j = i - 1
while j>= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(*A)
if __name__ == '__mai... | def main():
N = int(input())
A = list(map(int,input().split()))
insertionSort(A, N)
def insertionSort(A, N):
print(*A)
for i in range(1,N):
v = A[i]
j = i - 1
while j>= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(*A)
if __na... | [["+", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 114 | 5 |
n = int(input())
A = list(map(int, input().split()))
print(A)
for i in range(1, n):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
| n = int(input())
A = list(map(int, input().split()))
print(*A)
for i in range(1, n):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
| [["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]] | 5 | 89 | 1 |
N = int(input().rstrip())
A = list(map(int, input().rstrip().split()))
def insertion_sort(A, N):
for i in range(1, N):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j -= 1
A[j+1] = key
string = list(map(str, A))
print(' '.jo... | N = int(input().rstrip())
A = list(map(int, input().rstrip().split()))
def insertion_sort(A, N):
for i in range(N):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j -= 1
A[j+1] = key
string = list(map(str, A))
print(' '.join(... | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]] | 5 | 124 | 2 |
# -*- Coding: utf-8 -*-
def trace(A, N):
for i in range(int(N)-1):
print(A[i], end=' ')
print(A[int(N)-1])
def insertionSort(A, N):
for i in range(1, int(N)):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
... | # -*- Coding: utf-8 -*-
def trace(A, N):
for i in range(int(N)-1):
print(A[i], end=' ')
print(A[int(N)-1])
def insertionSort(A, N):
for i in range(1, int(N)):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
... | [["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 154 | 6 |
N = int(input())
A = list(map(int,input().split()))
def sort(N,A):
for i in range(1,N):
v = A[i]
j = i-1
while(j >= 0 and A[j] > v):
A[j+1] = A[j]
j -= 1
A[j+1] = v
pr(A)
def pr(list):
n = len(list)
for i in range(n):
if i < n-1:
... | N = int(input())
A = list(map(int,input().split()))
def sort(N,A):
for i in range(N):
v = A[i]
j = i-1
while(j >= 0 and A[j] > v):
A[j+1] = A[j]
j -= 1
A[j+1] = v
pr(A)
def pr(list):
n = len(list)
for i in range(n):
if i < n-1:
... | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]] | 5 | 155 | 2 |
def show(nums):
for i in range(len(nums)):
if i !=len(nums)-1:
print(nums[i],end=' ')
else:
print(nums[i])
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
v=nums[i]
j=i-1
while (j>=0 and nums[j]>v):
nums[j+1]=nums[j]
... | def show(nums):
for i in range(len(nums)):
if i !=len(nums)-1:
print(nums[i],end=' ')
else:
print(nums[i])
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
v=nums[i]
j=i-1
while (j>=0 and nums[j]>v):
nums[j+1]=nums[j]
... | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22]] | 5 | 139 | 2 |
n = int(input())
a = list(map(int,input().split()))
for i in range(1,n):
print(a)
j = i -1
v = a[i]
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j -= 1
a[j+1] = v
print(a)
| n = int(input())
a = list(map(int,input().split()))
for i in range(1,n):
print(*a)
j = i -1
v = a[i]
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j -= 1
a[j+1] = v
print(*a)
| [["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]] | 5 | 88 | 2 |
def insertionSort(A,N):
for i in range(0,N):
v = A[i]
j = i -1
while j>=0 and A[j] > v :
A[j+1] = A[j]
j-=1
A[j+1] = v
print(A)
N = int(input())
A = input().split()
A = list(map(int,A))
insertionSort(A,N)
| def insertionSort(A,N):
for i in range(0,N):
v = A[i]
j = i -1
while j>=0 and A[j] > v :
A[j+1] = A[j]
j-=1
A[j+1] = v
print(*A, sep=" ")
N = int(input())
A = input().split()
A = list(map(int,A))
insertionSort(A,N)
| [["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655]] | 5 | 101 | 7 |
n = input()
A = list(map(int, input().split()))
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j -= 1
A[j+1] = key
print(*A) | n = input()
A = list(map(int, input().split()))
print(*A)
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j -= 1
A[j+1] = key
print(*A) | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 85 | 5 |
def trace( nums ):
output = []
for num in nums:
output.append( str( num ) )
output.append( " " )
output.pop( )
print(( "".join( output ) ))
n = int( input( ) )
nums = [ int( val ) for val in input( ).split( " " ) ]
trace( nums )
for i in range( 1, len( nums )-1 ):
key = nums[i]
j = i - 1
while 0 <= j and ... | def trace( nums ):
output = []
for num in nums:
output.append( str( num ) )
output.append( " " )
output.pop( )
print(( "".join( output ) ))
n = int( input( ) )
nums = [ int( val ) for val in input( ).split( " " ) ]
trace( nums )
for i in range( 1, len( nums ) ):
key = nums[i]
j = i - 1
while 0 <= j and ke... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 146 | 2 |
#!/usr/bin/env python
def InsertSort(N,A):
for i in range(1,N):
v=A[i]
j=i-1
while j>=0 and A[j]>v:
A[j+1]=A[j]
j-=1
A[j+1]=v
print(*A)
if __name__ == "__main__":
N=int(input())
arr=list(map(int,input().split()))
InsertSort(N,arr) | #!/usr/bin/env python
def InsertSort(N,A):
for i in range(1,N):
v=A[i]
j=i-1
while j>=0 and A[j]>v:
A[j+1]=A[j]
j-=1
A[j+1]=v
print(*A)
if __name__ == "__main__":
N=int(input())
arr=list(map(int,input().split()))
print(*arr)
InsertSo... | [["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 107 | 5 |
n = int(input())
a = list(map(int, input().split()))
for i in range(1, len(a)):
# print(''.join(map(str, a)))
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j + 1] = a[j]
j -= 1
a[j + 1] = v
print(*a) | n = int(input())
a = list(map(int, input().split()))
for i in range(1, len(a)):
print(*a)
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j + 1] = a[j]
j -= 1
a[j + 1] = v
print(*a) | [["+", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 89 | 5 |
n=int(input())
A=list(map(int,input().split()))
for i in range(1,n):
print(" ".join(map(int,A)))
j=i-1
while A[j]<A[j-1] and j>0:
(A[j],A[j-1])=(A[j-1],A[j])
j=j-1
else:
print(" ".join(map(int,A))) | n=int(input())
A=list(map(int,input().split()))
for i in range(1,n):
print(" ".join(map(str,A)))
j=i
while A[j]<A[j-1] and j>0:
(A[j],A[j-1])=(A[j-1],A[j])
j=j-1
else:
print(" ".join(map(str,A))) | [["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 123 | 6 |
import sys
lines = sys.stdin.readlines()
N = lines[0]
A = lines[1].strip().split(" ")
print(" ".join(A))
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j -= 1
A[j+1] = key
print(" ".join(A)) | import sys
lines = sys.stdin.readlines()
N = lines[0]
A = lines[1].strip().split(" ")
print(" ".join(A))
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and int(A[j]) > int(key):
A[j+1] = A[j]
j -= 1
A[j+1] = key
print(" ".join(A)) | [["+", 0, 52, 15, 679, 12, 666, 0, 652, 63, 22], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 24], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 25]] | 5 | 114 | 6 |
N = int(input())
A = input().split(" ")
print(" ".join(A))
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j = j - 1
A[j+1] = v
print(" ".join(A)) | N = int(input())
A = input().split(" ")
print(" ".join(A))
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and int(A[j]) > int(v):
A[j+1] = A[j]
j = j - 1
A[j+1] = v
print(" ".join(A))
| [["+", 0, 52, 15, 679, 12, 666, 0, 652, 63, 22], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 24], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 25]] | 5 | 99 | 6 |
input()
xs = list(map(int, input().split()))
def insertion_sort(xs):
for i in range(1, len(xs)):
v = xs[i]
j = i - 1
while j >= 0 and xs[j] > v:
xs[j + 1] = xs[j]
j -= 1
xs[j + 1] = v
print(*xs)
insertion_sort(xs) | input()
xs = list(map(int, input().split()))
def insertion_sort(xs):
for i in range(1, len(xs)):
v = xs[i]
j = i - 1
while j >= 0 and xs[j] > v:
xs[j + 1] = xs[j]
j -= 1
xs[j + 1] = v
print(*xs)
print(*xs)
insertion_sort(xs) | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 93 | 5 |
import sys
def insertionSort(A, N):
for n in range(N-1):
print (A[n], end=" ")
print(A[N-1])
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j = j - 1
A[j + 1] = v
for n in range(N-1):
... | import sys
def insertionSort(A, N):
for n in range(N-1):
print (A[n], end=" ")
print(A[N-1])
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j = j - 1
A[j + 1] = v
for n in range(N-1):
... | [["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]] | 5 | 184 | 4 |
def insertionsSort(A):
N = len(A)
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
N = int(input())
A = list(map(int, input().split()))
insertionsSort(A) | def insertionsSort(A):
print(*A)
N = len(A)
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
N = int(input())
A = list(map(int, input().split()))
insertionsSort(A) | [["+", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 101 | 5 |
def main():
N = eval(input())
a = list(map(int, input().split()))
print(' '.join(map(str,a)))
for i in range(1,len(a)-1):
v = a[i]
j = i - 1
while (j >= 0) & (a[j] > v):
a[j+1] = a[j]
j -= 1
a[j+1] = v
print(' '.join(map(str,a)))
return... | def main():
N = eval(input())
a = list(map(int, input().split()))
print(' '.join(map(str,a)))
for i in range(1,len(a)):
v = a[i]
j = i - 1
while (j >= 0) & (a[j] > v):
a[j+1] = a[j]
j -= 1
a[j+1] = v
print(' '.join(map(str,a)))
return 0... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 131 | 2 |
def insert(array, index):
value = array[index]
for i in range(index-1, -1, -1):
if array[i] < value:
array[i] = value
break
array[i + 1] = array[i]
else:
array[0] = value
def insertion_sort(array, log=False):
for i in range(len(array)):
insert(arr... | def insert(array, index):
value = array[index]
for i in range(index - 1, -1, -1):
if array[i] < value:
array[i+1] = value
break
array[i + 1] = array[i]
else:
array[0] = value
def insertion_sort(array, log=False):
for i in range(len(array)):
insert... | [["+", 0, 1, 0, 662, 31, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 12, 612]] | 5 | 137 | 2 |
N = int(input())
a = [int(x) for x in input().split()]
for i in range(N):
v = a[i]
j = i-1
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j-=1
a[j+1]=v
print(a) | N = int(input())
a = [int(x) for x in input().split()]
for i in range(N):
v = a[i]
j = i-1
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j-=1
a[j+1]=v
print(*a) | [["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]] | 5 | 83 | 1 |
#!/usr/bin/python
import sys
def main():
length = int(raw_input())
elements = list(map(int, raw_input().split()))
print(" ".join(str(i) for i in elements))
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted... | #!/usr/bin/python
import sys
def main():
length = int(input())
elements = list(map(int, input().split()))
print(" ".join(str(i) for i in elements))
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted_list):
... | [["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]] | 5 | 172 | 5 |
n = int(input())
A = input().split(' ')
print(" ".join(A))
for i in range(1, n):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(" ".join(A)) | n = int(input())
A = input().split(' ')
#for i in range(n):
# A[i] = int(A[i])
print(" ".join(A))
for i in range(1, n):
v = A[i]
j = i - 1
while j >= 0 and int(A[j]) > int(v):
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(" ".join(A)) | [["+", 0, 52, 15, 679, 12, 666, 0, 652, 63, 22], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 24], ["+", 15, 679, 12, 666, 0, 652, 3, 4, 0, 25]] | 5 | 97 | 14 |
N = int(input())
l = list(map(int, input().split()))
print(*l)
for i in range(N):
t = l[i]
j = i-1
while j >= 0 and l[j] > t:
l[j+1], l[j] = l[j], l[j+1]
j -= 1
print(*l) | N = int(input())
l = list(map(int, input().split()))
for i in range(N):
t = l[i]
j = i-1
while j >= 0 and l[j] > t:
l[j+1], l[j] = l[j], l[j+1]
j -= 1
print(*l) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 92 | 5 |
def insertion_sort(A):
for i in range(1, len(A)):
v = A[i]
j = i - 1
print(*A)
while j >= 0 and A[j] > v:
A[j+1] = A[j]
A[j] = v
j -= j
return A
n = input()
A = [int(x) for x in input().split()]
print(*insertion_sort(A))
| def insertion_sort(A):
for i in range(1, len(A)):
v = A[i]
j = i - 1
print(*A)
while j >= 0 and A[j] > v:
A[j+1] = A[j]
A[j] = v
j -= 1
return A
n = input()
A = [int(x) for x in input().split()]
print(*insertion_sort(A))
| [["-", 0, 52, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612]] | 5 | 100 | 2 |
n = int(input())
lst = list(map(int,input().split()))
def pri(lst):
for i in range(len(lst)-1):
print(lst[i],end=" ")
print(lst[-1])
for i in range(1,n):
v = lst[i]
j = i-1
while True:
if j < 0:
lst[0] = v
break
if lst[j] > v:
lst[j+1] =... | n = int(input())
lst = list(map(int,input().split()))
def pri(lst):
for i in range(len(lst)-1):
print(lst[i],end=" ")
print(lst[-1])
pri(lst)
for i in range(1,n):
v = lst[i]
j = i-1
while True:
if j < 0:
lst[0] = v
break
if lst[j] > v:
ls... | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 138 | 4 |
# encoding: utf-8
from __future__ import print_function
class Solution:
"""
@param prices: Given an integer array
@return: Maximum profit
"""
@staticmethod
def insertion_sort():
# write your code here
array_length = int(input())
unsorted_array = [int(x) for x in input... | #!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
class Solution:
"""
@param prices: Given an integer array
@return: Maximum profit
"""
@staticmethod
def insertion_sort():
# write your code here
array_length = int(input())
unsorted_array = ... | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]] | 5 | 133 | 2 |
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A&lang=jp
#?????\????????????????£?
#?¨?????????????????????????????????±?????????
def insertion_sort(target_list, n_list):
for focus_index in range(1, n_list):
print(*target_list)
target = target_list[focus_index]
if tar... | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A&lang=jp
#?????\????????????????£?
#?¨?????????????????????????????????±?????????
def insertion_sort(target_list, n_list):
for focus_index in range(1, n_list):
print(*target_list)
target = target_list[focus_index]
if tar... | [["+", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 63, 661, 0, 48], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 130 | 4 |
N=eval(input())
A=list(map(int,input().split()))
for i in range(N-1):
for k in range(N-1):
print(A[k], end=' ')
print(A[N-1])
v=A[i+1]
j=i
while j>=0 and A[j] >v:
A[j+1]=A[j]
j=j-1
A[j+1]=v
print("")
for m in range(N-1):
print(str(A[m]), end=' ')
print(A[N-1]) | N=eval(input())
A=list(map(int,input().split()))
for i in range(N-1):
for k in range(N-1):
print(A[k], end=' ')
print(A[N-1])
v=A[i+1]
j=i
while j>=0 and A[j] >v:
A[j+1]=A[j]
j=j-1
A[j+1]=v
for m in range(N-1):
print(str(A[m]), end=' ')
print(A[N-1]) | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 154 | 5 |
# ??\?????????
N = int(input())
A = list(map(int, input().split()))
# ?????\?????????
def insertion_sort(A, N):
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
print(*A)
print(insert... | # ??\?????????
N = int(input())
A = list(map(int, input().split()))
# ?????\?????????
def insertion_sort(A, N):
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
print(*A)
insertion_so... | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 109 | 3 |
#include <bits/stdc++.h>
using namespace std;
bool isprime(int x) {
if (x == 2)
return true;
if (x < 2 || x % 2 == 0)
return false;
for (int i = 3; i * i < x; i += 2) {
if (x % i == 0)
return false;
}
return true;
}
int main() {
int n, x;
int cnt = 0;
cin >> n;
for (int i = 0; i... | #include <bits/stdc++.h>
using namespace std;
bool isprime(int x) {
if (x == 2)
return true;
if (x < 2 || x % 2 == 0)
return false;
for (int i = 3; i * i <= x; i += 2) {
if (x % i == 0)
return false;
}
return true;
}
int main() {
int n, x;
int cnt = 0;
cin >> n;
for (int i = 0; ... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 130 | 2 |
#include <cmath>
#include <ctype.h>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main(void) {
int n, a, b, count, c, w;
double d;
n = 0;
b = 0;
cin >> n;
// cout<<"n="<<n<<endl;
count = 0;
for (a = 0; a < n; a++) {
cin >> b;
d = b;
... |
#include <cmath>
#include <ctype.h>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main(void) {
int n, a, b, count, c, w;
double d;
n = 0;
b = 0;
cin >> n;
// cout<<"n="<<n<<endl;
count = 0;
for (a = 0; a < n; a++) {
cin >> b;
d = b;
... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 20]] | 1 | 173 | 2 |
#include <cmath>
#include <cstdio>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
int isPrime(int m) {
if (m == 2)
return true;
if (m <= 1)
return false;
if (m % 2 == 0)
return false;
int i = 3;
while (i < sqrt(m)) {
if (m % i == 0)
return false;
i++;
}
return true;
}
in... | #include <cmath>
#include <cstdio>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
int isPrime(int m) {
if (m == 2)
return true;
if (m <= 1)
return false;
if (m % 2 == 0)
return false;
int i = 3;
while (i <= sqrt(m)) {
if (m % i == 0)
return false;
i++;
}
return true;
}
i... | [["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]] | 1 | 147 | 2 |
#include <iostream>
static bool is_prime(long n) {
static long p[10000] = {2l};
static int ip = 1;
for (int i = 0; i < ip; ++i) {
if (n == p[i]) {
return true;
}
}
if (n % 2l == 0l) {
return false;
}
for (long i = 3l; i * i < n; i += 2l) {
if (n % i == 0l) {
return false;
}... | #include <iostream>
static bool is_prime(long n) {
static long p[10000] = {2l};
static int ip = 1;
for (int i = 0; i < ip; ++i) {
if (n == p[i]) {
return true;
}
}
if (n % 2l == 0l) {
return false;
}
for (long i = 3l; i * i <= n; i += 2l) {
if (n % i == 0l) {
return false;
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 169 | 2 |
#include <cmath>
#include <iostream>
using namespace std;
bool is_prime(int x) {
if (x == 2) {
return true;
} else if (x < 2 || x % 2 == 0) {
return false;
}
for (int i = 3; i < sqrt(x); i += 2) {
if (x % i == 0) {
return false;
}
}
return true;
}
int main() {
int n;
cin >> n;
... | #include <cmath>
#include <iostream>
using namespace std;
bool is_prime(int x) {
if (x == 2) {
return true;
} else if (x < 2 || x % 2 == 0) {
return false;
}
for (int i = 3; i <= sqrt(x); i += 2) {
if (x % i == 0) {
return false;
}
}
return true;
}
int main() {
int n;
cin >> n;
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 140 | 2 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
bool isprime(int x) {
if (x == 2) {
return true;
} else if (x % 2 == 0) {
return false;
}
int i = 3;
while (i <= sqrt(x)) {
if (x % i == 0) {
return false;
}
i = i + 2;
return true;
... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
bool isprime(int x) {
if (x == 2) {
return true;
} else if (x % 2 == 0) {
return false;
}
int i = 3;
while (i <= sqrt(x)) {
if (x % i == 0) {
return false;
break;
}
i = i + 2;
}
... | [["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]] | 1 | 174 | 4 |
#include <cmath>
#include <iostream>
using namespace std;
bool sosu(int n) {
if (n < 2)
return false; // 2以下除く
else if (n == 2)
return true; // 2は素数
else if (n % 2 == 0)
return false; //偶数除く
int root = sqrt(n);
for (int i = 3; i < root; i += 2) { //奇数で割る
if (n % i == 0)
return false;
... | #include <cmath>
#include <iostream>
using namespace std;
bool sosu(int n) {
if (n < 2)
return false; // 2以下除く
else if (n == 2)
return true; // 2は素数
else if (n % 2 == 0)
return false; //偶数除く
int root = sqrt(n);
for (int i = 3; i <= root; i += 2) { //奇数で割る
if (n % i == 0)
return false;
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 149 | 2 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int cnt = 0;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
a = sqrt(a);
for (int j = 2; j < a; j++) {
if (a % j == 0) {
cnt++;
break;
}
}
}
cout << n - cnt << endl;
return 0;
}... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int cnt = 0;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
int t = sqrt(a);
for (int j = 2; j <= t; j++) {
if (a % j == 0) {
cnt++;
break;
}
}
}
cout << n - cnt << endl;
return... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 96 | 7 |
#include <cmath>
#include <iostream>
using namespace std;
int main() {
// def
int n, j, sum = 0;
cin >> n;
int num[n];
for (int i = 0; i < n; i++) {
cin >> num[i];
}
// equation
for (int i = 0; i < n; i++) {
for (j = 2; j < sqrt(num[i]); j++) {
if (num[i] % j == 0) {
break;
... | #include <cmath>
#include <iostream>
using namespace std;
int main() {
// def
int n, j, sum = 0;
cin >> n;
int num[n];
for (int i = 0; i < n; i++) {
cin >> num[i];
}
// equation
for (int i = 0; i < n; i++) {
for (j = 2; j < sqrt(num[i]); j++) {
if (num[i] % j == 0) {
break;
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]] | 1 | 137 | 2 |
#include <cmath>
#include <iostream>
using namespace std;
bool isPrime(int x) {
if (x == 2) {
return true;
}
if (x == 1 || x % 2 == 0) {
return false;
}
for (int i = 3; i < sqrt(x); i++) {
if (x % i == 0) {
return false;
}
}
return true;
}
int main() {
int N;
cin >> N;
int... |
#include <cmath>
#include <iostream>
using namespace std;
bool isPrime(int x) {
if (x == 2) {
return true;
}
if (x == 1 || x % 2 == 0) {
return false;
}
for (int i = 3; i < sqrt(x) + 1; i++) {
if (x % i == 0) {
return false;
}
}
return true;
}
int main() {
int N;
cin >> N;
... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 138 | 2 |
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
bool isprime(int x) {
if (x == 2) {
return true;
}
if (x < 2) {
return false;
}
for (int i = 3; i <= sqrt(x); ++i) {
if (x % i == 0) {
return false;
}
}
return true;
}
int main() {
int n;
cin >> n;
... | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
bool isprime(int x) {
if (x == 2) {
return true;
}
if (x < 2) {
return false;
}
for (int i = 2; i <= sqrt(x); ++i) {
if (x % i == 0) {
return false;
}
}
return true;
}
int main() {
int n;
cin >> n;
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 137 | 2 |
#include <cmath>
#include <iostream>
using namespace std;
int main(void) {
int n;
int a;
int count = 0;
cin >> n;
for (int i = 0; i < n; ++i) {
bool check = true;
cin >> a;
for (int j = 2; j < sqrt(a); ++j) {
if (a % j == 0) {
check = false;
}
}
if (check)
++cou... | #include <cmath>
#include <iostream>
using namespace std;
int main(void) {
int n;
int a;
int count = 0;
cin >> n;
for (int i = 0; i < n; ++i) {
bool check = true;
cin >> a;
for (int j = 2; j <= sqrt(a); ++j) {
if (a % j == 0) {
check = false;
}
}
if (check)
++co... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 104 | 2 |
#include <iostream>
#include <math.h>
#define N 10000
using namespace std;
int isprime(int);
int main() {
int i, n, x, count = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> x;
count += isprime(x);
}
cout << count << endl;
return 0;
}
int isprime(int x) {
if (x == 2)
return 1;
else i... | #include <iostream>
#include <math.h>
#define N 10000
using namespace std;
int isprime(int);
int main() {
int i, n, x, count = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> x;
count += isprime(x);
}
cout << count << endl;
return 0;
}
int isprime(int x) {
if (x == 2)
return 1;
else i... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 140 | 2 |
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
void fnPrimeNumber(const vector<int> &argviNum, int &argiPrimeCnt) {
for (int i = 0; i < argviNum.size(); i++) {
double dSqrt = sqrt((double)argviNum[i]);
int iMaxDivisor = (int)dSqrt;
bool bPrime = true;
for (int iDivisor =... | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
void fnPrimeNumber(const vector<int> &argviNum, int &argiPrimeCnt) {
for (int i = 0; i < argviNum.size(); i++) {
double dSqrt = sqrt((double)argviNum[i]);
int iMaxDivisor = (int)dSqrt;
bool bPrimeNo = true;
for (int iDivisor... | [["-", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 0, 7, 8, 9, 0, 57, 15, 3... | 1 | 184 | 8 |
#include <cmath>
#include <iostream>
using namespace std;
bool checkNotOdd(int n) {
if (n % 2 == 0) {
return false;
} else {
return true;
}
}
bool check(int n) {
for (int i = 2; i < sqrt(n); i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
int main() {
int n;
cin >> n;
... | #include <cmath>
#include <iostream>
using namespace std;
bool checkNotOdd(int n) {
if (n % 2 == 0) {
return false;
} else {
return true;
}
}
bool check(int n) {
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
int main() {
int n;
cin >> n;
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 163 | 2 |
#include <iostream>
#include <vector>
using namespace std;
int squrtInt(int x) {
if (x < 4) {
return 1;
} else {
int i = 2;
while (i < x) {
if (i * i > x) {
return i - 1;
}
i++;
}
}
return 1;
}
bool isPrime(int x) {
if (x == 1 || (x > 2 && x % 2 == 0)) {
return f... | #include <iostream>
#include <vector>
using namespace std;
int squrtInt(int x) {
if (x < 4) {
return 1;
} else {
int i = 2;
while (i < x) {
if (i * i > x) {
return i - 1;
}
i++;
}
}
return 1;
}
bool isPrime(int x) {
if (x == 1 || (x > 2 && x % 2 == 0)) {
return f... | [["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 241 | 2 |
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
bool isPrimeNumber(int Specimen) {
double DividedSqrt = sqrt(Specimen);
for (int i = 2; i < DividedSqrt; ++i) {
if (Specimen % i == 0 && Specimen != 2) {
return false;
}
}
return true;
}
int main() {
int NumberOfIn... | #include <iostream>
#include <math.h>
#include <string>
using namespace std;
bool isPrimeNumber(int Specimen) {
double DividedSqrt = sqrt(Specimen);
for (int i = 2; i <= DividedSqrt; ++i) {
if (Specimen % i == 0 && Specimen != 2) {
return false;
}
}
return true;
}
int main() {
int NumberOfI... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 120 | 4 |
#include <bits/stdc++.h>
using namespace std;
bool Prime(long long n);
main() {
int n;
int cnt = 0;
long long a;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
if (Prime(a)) {
cnt++;
}
}
cout << cnt << endl;
}
bool Prime(long long n) {
if (n == 2) {
return true;
} else if (2 >... | #include <bits/stdc++.h>
using namespace std;
bool Prime(long long n);
main() {
int n;
int cnt = 0;
long long a;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
if (Prime(a)) {
cnt++;
}
}
cout << cnt << endl;
}
bool Prime(long long n) {
if (n == 2) {
return true;
} else if (2 >... | [["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19]] | 1 | 150 | 2 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define rep(n) for (int i = 0; i < (n); i++)
#define pb(n) push_back((n))
// typedef long long ll;
using namespace... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define rep(n) for (int i = 0; i < (n); i++)
#define pb(n) push_back((n))
// typedef long long ll;
using namespace... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 156 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.