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 <cstdio>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
double x1, y1, x2, y2, x3, y3, xp, yp, r;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
xp = 0;
yp = 0;
double a = y2 - y1, b = y3 - y1, c = y2... | #include <cstdio>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
double x1, y1, x2, y2, x3, y3, xp, yp, r;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
xp = 0;
yp = 0;
double a = y2 - y1, b = y3 - y1, c = y2... | [["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72]] | 1 | 333 | 2 |
/*Filename: aoj0010.cpp
*Author: Mushiyo
*/
#include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;
struct Point {
double x;
double y;
};
double countDist(Point p1, Point p2) {
int xDist = abs(p1.x - p2.x);
int yDist = abs(p1.y - p2.y);
return sqrt(xDist * xDist + yDist * yDist);
}... | /*Filename: aoj0010.cpp
*Author: Mushiyo
*/
#include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;
struct Point {
double x;
double y;
};
double countDist(Point p1, Point p2) {
double xDist = abs(p1.x - p2.x);
double yDist = abs(p1.y - p2.y);
return sqrt(xDist * xDist + yDist * yDi... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 325 | 4 |
#include <cmath>
#include <iostream>
int main() {
int n;
double x1, x2, x3, y1, y2, y3, a, b, c, r;
std::cin >> n;
std::cout.precision(3);
std::cout.setf(std::ios::fixed);
while (n--) {
std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
a = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
b = (x1 - x3... | #include <cmath>
#include <iostream>
int main() {
int n;
double x1, x2, x3, y1, y2, y3, a, b, c, r;
std::cin >> n;
std::cout.precision(3);
std::cout.setf(std::ios::fixed);
while (n--) {
std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
a = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
b = (x1 - x3... | [["-", 31, 23, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 12, 22], ["-", 12, 16, 31, 23, 0, 16, 12, 16, 12, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 22]] | 1 | 310 | 8 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ctype.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#includ... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ctype.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#includ... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 459 | 2 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] array = new int[w];
int swap1, swap2;
byte garbage;
for (int i = 0; i < w; i++)
array[i] = i + 1;
for ... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] array = new int[w];
int swap1, swap2;
byte garbage;
for (int i = 0; i < w; i++)
array[i] = i + 1;
for ... | [["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 499]] | 3 | 209 | 4 |
import java.awt.print.Printable;
import java.util.Scanner;
import javax.sound.midi.SysexMessage;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int amidaArray[] = new int[n];
for (int i = 1; i <= n; i+... | import java.awt.print.Printable;
import java.util.Scanner;
import javax.sound.midi.SysexMessage;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int w = sc.nextInt();
int amidaArray[] = new int[n + 1];
for (int i = 1; i <= n... | [["-", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 49, 200, 51, 227, 497, 505, 0, 16, 17, 72], ["+", 49, 200, 51, 227, 497, 505, 0, 16, 12, 499]] | 3 | 223 | 6 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] line = new int[w];
for (int k = 0; k < w; k++) {
line[k] = k + 1;
}
for (int i = 0; i < n; i++) {
S... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] line = new int[w];
for (int k = 0; k < w; k++) {
line[k] = k + 1;
}
for (int i = 0; i < n; i++) {
S... | [["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22]] | 3 | 215 | 4 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in).useDelimiter(",|\\s*");
int a, b, t, n;
n = cin.nextInt();
int[] num = new int[n];
for (int i = 0; i < n; i++) {
num[i] = i + 1;
}
n = cin.nextInt();
fo... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in).useDelimiter(",|\\s+");
int a, b, t, n;
n = cin.nextInt();
int[] num = new int[n];
for (int i = 0; i < n; i++) {
num[i] = i + 1;
}
n = cin.nextInt();
fo... | [["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491], ["+", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491]] | 3 | 199 | 2 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\r\\n");
int VirticalLines = scan.nextInt();
int hoirizontalLines = scan.nextInt();
int[] lineNumber = new int[VirticalLines + 1];
for (int i = 1... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n");
int VirticalLines = scan.nextInt();
int hoirizontalLines = scan.nextInt();
int[] lineNumber = new int[VirticalLines + 1];
for (int i = 1; i... | [["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491], ["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 44]] | 3 | 186 | 2 |
#include <math.h>
#include <stdio.h>
int main() {
int w, n, a, b, i, te;
int da[100];
scanf("%d", &w);
scanf("%d", &n);
for (i = 1; i <= w; i++)
da[i] = i;
for (i = 1; i <= n; i++) {
scanf("%d %d", &a, &b);
te = da[a];
da[a] = da[b];
da[b] = te;
}
for (i = 0; i < w; i++)
printf(... | #include <math.h>
#include <stdio.h>
int main() {
int w, n, a, b, i, te;
int da[100];
scanf("%d", &w);
scanf("%d", &n);
for (i = 1; i <= w; i++)
da[i] = i;
for (i = 1; i <= n; i++) {
scanf("%d,%d", &a, &b);
te = da[a];
da[a] = da[b];
da[b] = te;
}
for (i = 1; i <= w; i++)
printf... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 150 | 6 |
#include <stdio.h>
int main(void) {
int w, n, bar[30], i, tem, a, b;
scanf("%d\n%d", &w, &n);
for (i = 0; i < 30; i++) {
bar[i] = i + 1;
}
for (i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
a++;
b++;
tem = bar[a];
bar[a] = bar[b];
bar[b] = tem;
}
for (i = 0; i < w; i++) {
... | #include <stdio.h>
int main(void) {
int w, n, bar[30], i, tem, a, b;
scanf("%d\n%d", &w, &n);
for (i = 0; i < 30; i++) {
bar[i] = i + 1;
}
for (i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
a--;
b--;
tem = bar[a];
bar[a] = bar[b];
bar[b] = tem;
}
for (i = 0; i < w; i++) {
... | [["-", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68]] | 0 | 155 | 4 |
#include <stdio.h>
void exchange(int *lottery[100], int x, int y);
int main(void) {
int w, n;
int i;
int x, y;
int lottery[100];
for (i = 1; i <= 100; i++) {
lottery[i - 1] = i;
}
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d, %d", &x, &y);
exchange(lottery, x,... | #include <stdio.h>
void exchange(int *lottery, int x, int y);
int main(void) {
int w, n;
int i;
int x, y;
int lottery[100];
for (i = 1; i <= 100; i++) {
lottery[i - 1] = i;
}
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d, %d", &x, &y);
exchange(lottery, x, y);
... | [["-", 54, 55, 0, 56, 49, 84, 49, 80, 0, 70], ["-", 54, 55, 0, 56, 49, 84, 49, 80, 81, 13], ["-", 54, 55, 0, 56, 49, 84, 49, 80, 0, 73]] | 0 | 215 | 6 |
#include <stdio.h>
int main(void) {
int w, n;
int a, b;
int work;
int num[30];
int i;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < w; i++)
num[i] = i + 1;
for (i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
work = num[a - 1];
num[a - 1] = num[b - 1];
num[b - 1] = work;
}... | #include <stdio.h>
int main(void) {
int w, n;
int a, b;
int work;
int num[30];
int i;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < w; i++)
num[i] = i + 1;
for (i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
work = num[a - 1];
num[a - 1] = num[b - 1];
num[b - 1] = work;
}... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 0 | 162 | 4 |
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int w, n, i, box;
char a[31], b[31], num[31];
scanf("%d%d", &w, &n);
for (i = 1; i <= w; i++)
num[i] = i;
for (i = 1; i <= n; i++) {
scanf("%s,%s", &a[i], &b[i]);
box = num[a[i]];
num[a[i]] = num[b[i]];
num[b[i]] = box;
}
for (i =... | #include <stdio.h>
#include <stdlib.h>
int main(void) {
int w, n, i, box;
int a[31], b[31], num[31];
scanf("%d%d", &w, &n);
for (i = 1; i <= w; i++)
num[i] = i;
for (i = 1; i <= n; i++) {
scanf("%d,%d", &a[i], &b[i]);
box = num[a[i]];
num[a[i]] = num[b[i]];
num[b[i]] = box;
}
for (i = ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 168 | 4 |
#include <stdio.h>
int main(void) {
int w, n;
int x;
int i;
int a, b;
int c[31];
scanf("%d", &w);
for (i = 0; i < w; i++) {
c[i] = i + 1;
}
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d %d", &a, &b);
x = c[a - 1];
c[a - 1] = c[b - 1];
c[b - 1] = x;
}
for (i = 0; i < w;... | #include <stdio.h>
int main(void) {
int w, n;
int x;
int i;
int a, b;
int c[31];
scanf("%d", &w);
for (i = 0; i < w; i++) {
c[i] = i + 1;
}
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
x = c[a - 1];
c[a - 1] = c[b - 1];
c[b - 1] = x;
}
for (i = 0; i < w;... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 166 | 2 |
#include <stdio.h>
int main(void) {
int w, n, i, gl[50], cha1[50], cha2[50];
scanf("%d", &w);
for (i = 1; i <= w; i++) {
gl[i] = i;
}
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d %d", &cha1[i], &cha2[i]);
int t;
t = gl[cha1[i]];
gl[cha1[i]] = gl[cha2[i]];
gl[cha2[i]] = t;
... | #include <stdio.h>
int main(void) {
int w, n, i, gl[50], cha1[50], cha2[50];
scanf("%d", &w);
for (i = 1; i <= w; i++) {
gl[i] = i;
}
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d,%d", &cha1[i], &cha2[i]);
int t;
t = gl[cha1[i]];
gl[cha1[i]] = gl[cha2[i]];
gl[cha2[i]] = t;
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 177 | 2 |
#include <stdio.h>
int main(void) {
int n, w, a, b, array[30];
int i, j, s;
for (i = 0; i < 30; i++)
array[i] = i + 1;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d %d", &a, &b);
s = array[a - 1];
array[a - 1] = array[b - 1];
array[b - 1] = s;
}
for (i = 0... | #include <stdio.h>
int main(void) {
int n, w, a, b, array[30];
int i, s;
for (i = 0; i < 30; i++)
array[i] = i + 1;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d, %d", &a, &b);
s = array[a - 1];
array[a - 1] = array[b - 1];
array[b - 1] = s;
}
for (i = 0; ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 164 | 4 |
#include <stdio.h>
void sort(int *);
int main(void) {
int n, w, a, b;
int array[30];
int i, s;
for (i = 0; i < 30; i++)
array[i] = i + 1;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < n; i++) {
sort(array);
}
for (i = 0; i < w; i++) {
printf("%d\r\n", array[i]);
}
return 0;
}
... | #include <stdio.h>
void sort(int *);
int main(void) {
int n, w, a, b;
int array[30];
int i, s;
for (i = 0; i < 30; i++)
array[i] = i + 1;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < n; i++) {
sort(array);
}
for (i = 0; i < w; i++) {
printf("%d\r\n", array[i]);
}
return 0;
}
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 202 | 2 |
#include <stdio.h>
int main() {
int way, num, result[30];
int a, b, c;
int i;
scanf("%d", &way);
scanf("%d", &num);
for (i = 0; i <= way; i++)
result[i] = i;
for (i = 0; i < num; i++) {
scanf("%d,%d", &a, &b);
c = result[a];
result[b] = result[a];
result[b] = c;
}
for (i = 1; i <... | #include <stdio.h>
int main() {
int way, num, result[30];
int a, b, c;
int i;
scanf("%d", &way);
scanf("%d", &num);
for (i = 0; i <= way; i++)
result[i] = i;
for (i = 0; i < num; i++) {
scanf("%d,%d", &a, &b);
c = result[a];
result[a] = result[b];
result[b] = c;
}
for (i = 1; i <... | [["-", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 69, 71, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 71, 22]] | 0 | 149 | 4 |
#include <stdio.h>
void num_swap(int num[], int x, int y) {
int t;
t = num[x];
num[x] = num[y];
num[y] = t;
}
int main(void) {
int w, n, a, b, i, num[31];
scanf("%d", &w);
scanf("%d", &n);
for (i = 1; i <= w; i++)
num[i] = i;
for (i = 1; i <= n; i++) {
scanf("%d %d", &a, &b);
num_swap... | #include <stdio.h>
void num_swap(int num[], int x, int y) {
int t;
t = num[x];
num[x] = num[y];
num[y] = t;
}
int main(void) {
int w, n, a, b, i, num[31];
scanf("%d", &w);
scanf("%d", &n);
for (i = 1; i <= w; i++)
num[i] = i;
for (i = 1; i <= n; i++) {
scanf("%d, %d", &a, &b);
num_swa... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 174 | 2 |
#include <stdio.h>
int main() {
int w, n, i, a, b, c[30], temp;
scanf("%d", &w);
for (i = 0; i < w; i++) {
c[i] = i + 1;
}
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d %d", &a, &b);
temp = c[a - 1];
c[a - 1] = c[b - 1];
c[b - 1] = temp;
}
for (i = 0; i < w; i++) {
printf(... | #include <stdio.h>
int main() {
int w, n, i, a, b, c[30], temp;
scanf("%d", &w);
for (i = 0; i < w; i++) {
c[i] = i + 1;
}
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
temp = c[a - 1];
c[a - 1] = c[b - 1];
c[b - 1] = temp;
}
for (i = 0; i < w; i++) {
printf(... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 161 | 2 |
#include <stdio.h>
int main(void) {
int n, w, a[100];
int x, y, z = 0, i;
scanf("%d", &n);
scanf("%d", &w);
for (i = 1; i <= n; i++)
a[i] = i;
for (i = 0; i < w; i++) {
scanf("%d%d", &x, &y);
z = a[x];
a[x] = a[y];
a[y] = z;
}
for (i = 1; i <= n; i++)
printf("%d\n", a[i]);
retu... | #include <stdio.h>
int main(void) {
int n, w, a[100];
int x, y, z = 0, i;
scanf("%d", &n);
scanf("%d", &w);
for (i = 1; i <= n; i++)
a[i] = i;
for (i = 0; i < w; i++) {
scanf("%d,%d", &x, &y);
z = a[x];
a[x] = a[y];
a[y] = z;
}
for (i = 1; i <= n; i++)
printf("%d\n", a[i]);
ret... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 153 | 2 |
#include <stdio.h>
int main() {
int w, n, am[30], i, a, b, buf;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < w; i++)
am[i] = i + 1;
for (i = 0; i < n; i++) {
scanf("%d %d", &a, &b);
buf = am[a - 1];
am[a - 1] = am[b - 1];
am[b - 1] = buf;
}
for (i = 0; i < w; i++) {
printf("... | #include <stdio.h>
int main() {
int w, n, am[30], i, a, b, buf;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < w; i++)
am[i] = i + 1;
for (i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
buf = am[a - 1];
am[a - 1] = am[b - 1];
am[b - 1] = buf;
}
for (i = 0; i < w; i++) {
printf("... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 159 | 2 |
#include <stdio.h>
int main() {
int w, n, ans[30];
int c;
int a, b, q;
for (c = 0; c < 30; c++)
ans[c] = c + 1;
scanf("%d%*c", &w);
scanf("%d%*c", &n);
for (c = 0; c < n; c++) {
scanf("%d,%d", &a, &b);
q = ans[a - 1];
ans[a - 1] = ans[b - 1];
ans[b - 1] = q;
}
for (c = 0; c < n + 1... | #include <stdio.h>
int main() {
int w, n, ans[30];
int c;
int a, b, q;
for (c = 0; c < 30; c++)
ans[c] = c + 1;
scanf("%d%*c", &w);
scanf("%d%*c", &n);
for (c = 0; c < n; c++) {
scanf("%d,%d", &a, &b);
q = ans[a - 1];
ans[a - 1] = ans[b - 1];
ans[b - 1] = q;
}
for (c = 0; c < w; c+... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 0 | 161 | 4 |
#include <stdio.h>
int main(void) {
int w, n, dataw[31], i, one, two, j;
for (i = 1; i < 31; i++)
dataw[i] = i;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d,%d", &one, &two);
j = dataw[one];
dataw[one] = dataw[two];
dataw[two] = j;
}
for (i = 0; i <= n; ... | #include <stdio.h>
int main(void) {
int w, n, dataw[31], i, one, two, j;
for (i = 1; i < 31; i++)
dataw[i] = i;
scanf("%d", &w);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d,%d", &one, &two);
j = dataw[one];
dataw[one] = dataw[two];
dataw[two] = j;
}
for (i = 0; i < w; i... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 0 | 150 | 4 |
#include <iostream>
using namespace std;
int main() {
int verticals, horizontals, a, b;
cin >> verticals;
cin >> horizontals;
int res[verticals];
for (int i = 0; i < verticals; i++)
res[i] = i + 1;
for (int i = 0; i < horizontals; i++) {
cin >> a >> b;
int tmp = res[a - 1];
res[a - 1] = r... | #include <iostream>
using namespace std;
int main() {
int verticals, horizontals, a, b;
char comma; // commaを抜くための変数
cin >> verticals;
cin >> horizontals;
int res[verticals];
for (int i = 0; i < verticals; i++)
res[i] = i + 1;
for (int i = 0; i < horizontals; i++) {
cin >> a >> comma >> b;
i... | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 136 | 5 |
#include <stdio.h>
#include <string.h>
int now[30];
int main() {
int w, n;
scanf("%d%d", &w, &n);
for (int i = 0; i < w; i++) {
now[i] = i + 1;
}
for (int i = 0; i < n; i++) {
int a, b;
scanf("%d%d", &a, &b);
int w = now[a - 1];
now[a - 1] = now[b - 1];
now[b - 1] = w;
}
for (int... | #include <stdio.h>
#include <string.h>
int now[30];
int main() {
int w, n;
scanf("%d%d", &w, &n);
for (int i = 0; i < w; i++) {
now[i] = i + 1;
}
for (int i = 0; i < n; i++) {
int a, b;
scanf("%d,%d", &a, &b);
int w = now[a - 1];
now[a - 1] = now[b - 1];
now[b - 1] = w;
}
for (in... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 158 | 2 |
#include <stdio.h>
#define MAX 30
int main(void) {
int w, n, tmp;
int a, b;
int lot[MAX + 1]; // 1-origin
scanf("%d", &w);
scanf("%d", &n);
for (int i = 1; i <= w; i++)
lot[i] = i;
for (int i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
tmp = lot[a];
lot[a] = lot[b];
lot[b] = tmp;
}
... | #include <stdio.h>
#define MAX 30
int main(void) {
int w, n, tmp;
int a, b;
int lot[MAX + 1]; // 1-origin
scanf("%d", &w);
scanf("%d", &n);
for (int i = 1; i <= w; i++)
lot[i] = i;
for (int i = 1; i <= n; i++) {
scanf("%d,%d", &a, &b);
tmp = lot[a];
lot[a] = lot[b];
lot[b] = tmp;
}... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22]] | 1 | 159 | 6 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define rp(a) while (a--)
#define pb push_back
#define mp ... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define rp(a) while (a--)
#define pb push_back
#define mp ... | [["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]] | 1 | 184 | 2 |
#include <iostream>
using namespace std;
int main() {
int w, n;
int num[30] = {0};
int a, b;
cin >> w;
cin >> n;
for (int i = 0; i < w; i++)
num[i] = i + 1;
for (int i = 0; i < n; i++) {
cin >> a >> b;
int tmp = num[a - 1];
num[a - 1] = num[b - 1];
num[b - 1] = tmp;
}
for (... | #include <iostream>
using namespace std;
int main() {
int w, n;
int num[30] = {0};
int a, b;
char c;
cin >> w;
cin >> n;
for (int i = 0; i < w; i++)
num[i] = i + 1;
for (int i = 0; i < n; i++) {
cin >> a >> c >> b;
int tmp = num[a - 1];
num[a - 1] = num[b - 1];
num[b - 1] = tm... | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 146 | 5 |
#define _CRT_SECURE_NO_WARNINGS 1
#include <cstdio>
using namespace std;
int main() {
int W, N, A[31], B[31], C[31];
scanf("%d", W);
scanf("%d", N);
for (int i = 1; i <= N; i++) {
scanf("%d,%d", &(A[i]), &(B[i]));
}
for (int i = 1; i <= W; i++) {
int t = i;
for (int j = 1; j <= N; j++) {
... | #define _CRT_SECURE_NO_WARNINGS 1
#include <cstdio>
using namespace std;
int main() {
int W, N, A[31], B[31], C[31];
scanf("%d", &W);
scanf("%d", &N);
for (int i = 1; i <= N; i++) {
scanf("%d,%d", &(A[i]), &(B[i]));
}
for (int i = 1; i <= W; i++) {
int t = i;
for (int j = 1; j <= N; j++) ... | [["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]] | 1 | 205 | 2 |
main() {
int a[1000003] = {}, b[999999] = {}, n, i, x = 0, c;
for (i = 2; i < 1000000; i++)
a[i] = i;
for (i = 0; i < 1000000; i++)
if (a[i] != 0) {
b[x] = i;
x++;
for (c = i; c < 1000000; c += i)
a[c] = 0;
}
while (scanf("%d", &n) != -1) {
c = 0;
while (b[c] < n &&... | main() {
int a[1000003] = {}, b[999999] = {}, n, i, x = 0, c;
for (i = 2; i < 1000000; i++)
a[i] = i;
for (i = 0; i < 1000000; i++)
if (a[i] != 0) {
b[x] = i;
x++;
for (c = i; c < 1000000; c += i)
a[c] = 0;
}
while (scanf("%d", &n) != -1) {
c = 0;
while (b[c] <= n &... | [["-", 0, 52, 15, 23, 0, 16, 31, 16, 17, 18], ["+", 0, 52, 15, 23, 0, 16, 31, 16, 17, 19]] | 0 | 161 | 24 |
#define z 1000000
a[z], b[z], n, i = 1, x, c;
main() {
for (; i++ < z;)
a[i] = i;
for (i = -1; i++ < z;)
if (a[i]) {
b[x++] = i;
for (c = i; c < z; c += i)
a[c] = 0;
}
for (; ~scanf("%d", &n); c = 0)
while (b[c] <= n && b[c])
c++;
printf("%d\n", c);
exit(0);
} | #define z 1000000
a[z], b[z], n, i = 1, x, c;
main() {
for (; i++ < z;)
a[i] = i;
for (i = -1; i++ < z;)
if (a[i]) {
b[x++] = i;
for (c = i; c < z; c += i)
a[c] = 0;
}
while (~scanf("%d", &n)) {
c = 0;
while (b[c] <= n && b[c])
c++;
printf("%d\n", c);
}
exit(0... | [["-", 36, 36, 0, 30, 0, 9, 0, 7, 0, 88], ["+", 36, 36, 0, 30, 0, 9, 0, 52, 0, 89], ["-", 36, 36, 0, 30, 0, 9, 0, 7, 0, 35], ["+", 0, 30, 0, 9, 0, 52, 15, 23, 0, 25], ["+", 0, 30, 0, 9, 0, 52, 8, 9, 0, 45], ["-", 36, 36, 0, 30, 0, 9, 0, 7, 0, 25], ["+", 0, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 9, 0, 52, 8, 9, 0... | 0 | 145 | 13 |
#define z 1000000
a[z], b[z], n, i = 1, x, c;
main() {
for (; i++ < z;)
a[i] = i;
for (i = -1; i++ < z;)
if (a[i]) {
b[x++] = i;
for (c = i; c < z; c += i)
a[c] = 0;
}
for (; ~scanf("%d", &n); c = 0)
while (b[c] <= n && b[c])
c++;
printf("%d\n", c);
exit(0);
} | #define z 1000000
a[z], b[z], n, i = 1, x, c;
main() {
for (; i++ < z;)
a[i] = i;
for (i = -1; i++ < z;)
if (a[i]) {
b[x++] = i;
for (c = 0; c < z; c += i)
a[c] = 0;
}
for (; ~scanf("%d", &n);) {
c = 0;
while (b[c] <= n && b[c])
c++;
printf("%d\n", c);
}
exit(... | [["-", 8, 57, 64, 9, 0, 7, 10, 11, 12, 22], ["+", 8, 57, 64, 9, 0, 7, 10, 11, 12, 13], ["+", 36, 36, 0, 30, 0, 9, 0, 7, 0, 25], ["+", 0, 30, 0, 9, 0, 7, 8, 9, 0, 45], ["-", 36, 36, 0, 30, 0, 9, 0, 7, 0, 25], ["+", 0, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 9, 0, 7, 8, 9, 0, 46]] | 0 | 145 | 13 |
#include <stdio.h>
#define MAX (999999)
int main(void) {
int i, j;
char p[MAX] = {'0'};
// ツェツ素ツ青板表ツ催ャツ青ャツづ可使ツづつスツェ
int n, ans;
// ツつアツづつゥツづァツ素ツ青板表ツ催ャツ青ャ
p[0] = 1;
for (i = 2; i <= (MAX / 2); i++) {
for (j = 2; (i * j) <= MAX; j++) {
if (p[(i * j) - 1] == '0') {
p[(i * j) - 1] = '1';
... | #include <stdio.h>
#define MAX (999999)
int main(void) {
int i, j;
int p[MAX] = {0};
// ツェツ素ツ青板表ツ催ャツ青ャツづ可使ツづつスツェ
int n, ans;
// ツつアツづつゥツづァツ素ツ青板表ツ催ャツ青ャ
p[0] = 1;
for (i = 2; i <= (MAX / 2); i++) {
for (j = 2; (i * j) <= MAX; j++) {
if (p[(i * j) - 1] == 0) {
p[(i * j) - 1] = 1;
}... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 49, 50, 51, 83, 0, 103, 0, 104], ["-", 0, 57, 15, 23, 0, 16, 12, 103, 0, 104], ["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 104]] | 0 | 183 | 10 |
#include <stdio.h>
main() {
int n, i, sum;
while (scanf("%d", &n) != EOF) {
int l = 2, a[1000000] = {0};
sum = 0;
while (n >= l * l) {
if (a[l] == 0) {
for (i = l + l; i <= n; i += l) {
a[i] = 1;
}
}
l++;
}
for (i = 2; i < n; i++) {
if (a[i] == 0... | #include <stdio.h>
main() {
int n, i, sum;
while (scanf("%d", &n) != EOF) {
int l = 2, a[1000001] = {0};
sum = 0;
while (n >= l * l) {
if (a[l] == 0) {
for (i = l + l; i <= n; i += l) {
a[i] = 1;
}
}
l++;
}
for (i = 2; i <= n; i++) {
if (a[i] == ... | [["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 140 | 4 |
#include <stdio.h>
#define Num 1000000
int main(void) {
int a[Num + 1];
int n, i, j, count = 0;
for (i = 0; i < Num; i++) {
a[i] = 1;
}
// printf("1\n");
/*for(i=2;i<=n/2;i++)*/
for (i = 2; i * i <= Num; i++) {
// printf("2\n");
for (j = 2 * i; j <= Num; j += i) {
// printf("3\n");
... | #include <stdio.h>
#define Num 1000000
int main(void) {
int a[Num + 1];
int n, i, j, count = 0;
for (i = 0; i < Num; i++) {
a[i] = 1;
}
// printf("1\n");
/*for(i=2;i<=n/2;i++)*/
for (i = 2; i * i <= Num; i++) {
// printf("2\n");
for (j = 2 * i; j <= Num; j += i) {
// printf("3\n");
... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 172 | 2 |
#include <stdio.h>
char a[1000001];
void sosu();
main() {
int x, ans = 0, i;
sosu();
while (scanf("%d", &x) != EOF) {
ans = 0;
for (i = 2; i <= x; i++) {
if (a[i] != 1) {
ans++;
}
}
printf("%d\n", ans);
}
return 0;
}
void sosu() {
int i, j;
a[0] = 1;
a[1] = 1;
for ... | #include <stdio.h>
char a[1000001];
void sosu();
main() {
int x, ans = 0, i;
sosu();
while (scanf("%d", &x) != EOF) {
ans = 0;
for (i = 2; i <= x; i++) {
if (a[i] != 1) {
ans++;
}
}
printf("%d\n", ans);
}
return 0;
}
void sosu() {
int i, j;
a[0] = 1;
a[1] = 1;
for ... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 0 | 188 | 7 |
c[1000000];
main(i, j, n) {
for (i = 2; i * i < 1e6; ++i)
for (j = i; !c[i] && j < 1e6; c[j += i] = 1)
;
for (j = 0; ~scanf("%d", &n); j = !printf("%d\n", j))
for (i = n; i > 1; j += !c[i--])
;
} | c[1100000];
main(i, j, n) {
for (i = 2; i * i < 1e6; ++i)
for (j = i; !c[i] && j < 1e6; c[j += i] = 1)
;
for (j = 0; ~scanf("%d", &n); j = !printf("%d\n", j))
for (i = n; i > 1; j += !c[i--])
;
} | [["-", 36, 36, 0, 30, 0, 1, 0, 69, 71, 13], ["+", 36, 36, 0, 30, 0, 1, 0, 69, 71, 13]] | 0 | 107 | 13 |
c[1100000], n = 1e6;
main(i, j) {
for (i = 2; i * i < n; ++i)
if (c[i])
for (j = i; j < n; c[j += i] = 1)
;
for (j = 0; ~scanf("%d", &n); j = !printf("%d\n", j))
for (i = n; i > 1; j += !c[i--])
;
} | c[1100000], n = 1e6;
main(i, j) {
for (i = 2; i * i < n; ++i)
if (!c[i])
for (j = i; j < n; c[j += i] = 1)
;
for (j = 0; ~scanf("%d", &n); j = !printf("%d\n", j))
for (i = n; i > 1; j += !c[i--])
;
} | [["+", 0, 7, 8, 57, 15, 23, 0, 91, 17, 111]] | 0 | 109 | 1 |
#include <stdio.h>
int main(void) {
int n;
int i, j;
int cnt1 = 0, cnt2 = 0;
int pl[500000];
int pll;
pl[0] = 2;
pl[1] = 3;
while (scanf("%d", &n) != EOF) {
pll = 2;
for (i = 5; i < n; i = i + 2) {
for (j = 0; j < pll; j++) {
if (i % pl[j] == 0) {
cnt1++;
bre... | #include <stdio.h>
int main(void) {
int n;
int i, j;
int cnt1 = 0, cnt2 = 0;
int pl[500000];
int pll;
pl[0] = 2;
pl[1] = 3;
while (scanf("%d", &n) != EOF) {
pll = 2;
for (i = 5; i <= n; i = i + 2) {
for (j = 0; j < pll; j++) {
if (i % pl[j] == 0) {
cnt1++;
br... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 12, 13]] | 0 | 226 | 6 |
j, a[' '], s;
main(i) {
for (; ++i < 1e6;)
for (s += !a[i]; j < 1e6; a[i] = s)
a[j += i] = 1;
for (; ~scanf("%d", &i); printf("%d\n", a[i]))
;
} | j, a[' '], s;
main(i) {
for (; ++i < 1e6;)
for (s += !a[j = i]; j < 1e6; a[i] = s)
a[j += i] = 1;
for (; ~scanf("%d", &i); printf("%d\n", a[i]))
;
} | [["+", 10, 11, 12, 91, 28, 69, 71, 11, 31, 22], ["+", 10, 11, 12, 91, 28, 69, 71, 11, 17, 32]] | 0 | 84 | 2 |
j, a[' '], s;
main(i) {
for (; ++i < 1e6 || ~scanf("%d", &i) && printf("%d\n", a[i]);)
for (s += !a[j = i]; j < 1e6; a[i] = s)
a[j += i] = 1;
} | j, a[' '], s;
main(i) {
for (; ++i < 1e6 || ~scanf("%d", &j) && printf("%d\n", a[j]);)
for (s += !a[j = i]; j < 1e6; a[i] = s)
a[j += i] = 1;
} | [["-", 31, 91, 28, 2, 3, 4, 0, 66, 28, 22], ["+", 31, 91, 28, 2, 3, 4, 0, 66, 28, 22], ["-", 12, 16, 12, 2, 3, 4, 0, 69, 71, 22], ["+", 12, 16, 12, 2, 3, 4, 0, 69, 71, 22]] | 0 | 82 | 4 |
#include <stdio.h>
#define N 999999
long prime(long num);
int main() {
long j, n, ans;
while (scanf("%ld", &n) != EOF) {
printf("%ld\n", prime(n));
}
return 0;
}
long prime(long num) {
long i, j;
int k = 0;
char b[N];
for (i = 0; i < N; i++)
b[i] = 0;
for (i = 2; i < num; i++) {
if (b[i] =... | #include <stdio.h>
#define N 999999
long prime(long num);
int main() {
long j, n, ans;
while (scanf("%ld", &n) != EOF) {
printf("%ld\n", prime(n));
}
return 0;
}
long prime(long num) {
long i, j;
int k = 0;
char b[N];
for (i = 0; i < N; i++)
b[i] = 0;
for (i = 2; i <= num; i++) {
if (b[i] ... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 157 | 2 |
#include <math.h>
#include <stdio.h>
#define N_MAX 999999
int main(void) {
/* eratosthenes */
char a[N_MAX + 1];
int i, j;
a[0] = 0, a[1] = 0;
for (i = 2; i <= N_MAX; i++)
a[i] = 1;
for (i = 2; i <= (int)sqrt(N_MAX); i++)
if (a[i])
for (j = 2 * i; j <= N_MAX; j += i)
a[j] = 0;
wh... | #include <math.h>
#include <stdio.h>
#define N_MAX 999999
int main(void) {
/* eratosthenes */
char a[N_MAX + 1];
int i, j;
a[0] = 0, a[1] = 0;
for (i = 2; i <= N_MAX; i++)
a[i] = 1;
for (i = 2; i <= (int)sqrt(N_MAX); i++)
if (a[i])
for (j = 2 * i; j <= N_MAX; j += i)
a[j] = 0;
wh... | [["-", 0, 52, 8, 9, 0, 7, 15, 27, 17, 68], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 20], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 7, 26, 27, 17, 68]] | 0 | 158 | 5 |
#include <stdio.h>
#define MAX 1000000
int main() {
int m, ans = 0;
int c, c2, c3;
char list[MAX];
for (c = 0; c < MAX; c++) {
list[c] = 1;
}
list[0] = 0;
list[1] = 0;
while (~scanf("%d", &m)) {
for (c = 2; c < m + 1; c++) {
if (list[c]) {
for (c2 = c * 2; c2 < m + 1; c2 += c)
... | #include <stdio.h>
#define MAX 1000000
int main() {
int m, ans = 0;
int c, c2, c3;
char list[MAX];
for (c = 0; c < MAX; c++) {
list[c] = 1;
}
list[0] = 0;
list[1] = 0;
while (~scanf("%d", &m)) {
for (c = 2; c < m + 1; c++) {
if (list[c]) {
for (c2 = c * 2; c2 < m + 1; c2 += c)
... | [["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 0 | 197 | 4 |
#include <math.h>
#include <stdio.h>
int prime[100000];
int num_prime = 2;
int find(int n);
int main(void) {
int n, temp;
prime[0] = 2;
prime[1] = 3;
while (scanf("%d", &n) != EOF) {
if (n > prime[num_prime - 1]) {
temp = judge(n);
// print_prime();
printf("%d\n", temp);
} else if (n... | #include <math.h>
#include <stdio.h>
int prime[500000];
int num_prime = 2;
int find(int n);
int main(void) {
int n, temp;
prime[0] = 2;
prime[1] = 3;
while (scanf("%d", &n) != EOF) {
// printf("###%d###\n",n);
if (n > prime[num_prime - 1]) {
temp = judge(n);
// print_prime();
printf(... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 339 | 3 |
#include <stdio.h>
int isprimefunc(int);
int main() {
int n, i, j, kosu, *isprime;
isprime = (int *)malloc(1000000 * sizeof(int));
/* pre-processing */
for (i = 0; i < 1000000; i++)
isprime[i] = isprimefunc(i);
while (scanf("%d", &n) != EOF) {
kosu = 0;
for (i = 2; i <= n; i++)
if (isprim... | #include <stdio.h>
int isprimefunc(int);
int main() {
int n, i, j, kosu, *isprime;
isprime = (int *)malloc(1000000 * sizeof(int));
/* pre-processing */
for (i = 0; i < 1000000; i++)
isprime[i] = isprimefunc(i);
while (scanf("%d", &n) != EOF) {
kosu = 0;
for (i = 2; i <= n; i++)
if (isprim... | [["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 172 | 1 |
#include <stdio.h>
#define MAX 1000000
int main() {
char prime[MAX];
int num, i, j, ans;
for (i = 0; i < MAX; i++) {
prime[i] = 1;
}
prime[0] = prime[1] = 0;
for (i = 2; i < (MAX / 2); i++) {
if (prime[i]) {
for (j = 2 * i; j < MAX; j += i) {
prime[j] = 0;
}
}
}
while... | #include <stdio.h>
#define MAX 1000000
int main() {
char prime[MAX];
int num, i, j, ans;
for (i = 0; i < MAX; i++) {
prime[i] = 1;
}
prime[0] = prime[1] = 0;
for (i = 2; i < (MAX / 2); i++) {
if (prime[i]) {
for (j = 2 * i; j < MAX; j += i) {
prime[j] = 0;
}
}
}
while... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]] | 0 | 168 | 4 |
#include <stdio.h>
int x[1000000];
int main() {
int i, j, n, hantei = 0;
int sum = 0;
while (scanf("%d", &n) != EOF) {
for (i = 2; i <= n; i++) {
x[i] = 1;
}
for (i = 2; i <= n; i++) {
if (x[i] == 1) {
sum++;
}
for (j = 2; i * j <= n; j++) {
x[i * j] = 0;
... | #include <stdio.h>
int x[1000000];
int main() {
int i, j, n, hantei = 0;
int sum = 0;
while (scanf("%d", &n) != EOF) {
for (i = 2; i <= n; i++) {
x[i] = 1;
}
for (i = 2; i <= n; i++) {
if (x[i] == 1) {
sum++;
}
for (j = 2; i * j <= n; j++) {
x[i * j] = 0;
... | [["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 139 | 1 |
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#define ASIZE (1000000 / 2)
int compare(const void *a, const void *b) { return *(int *)a - *(int *)b; }
void enum_prime(int *list) {
int i;
list[0] = 2;
for (i = 1; i < ASIZE; i++) {
list[i] = 2 * i + 1;
}
list[ASIZE - 1] = INT_MAX;
int j, p, pl... | #include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#define ASIZE (1000000 / 2)
int compare(const void *a, const void *b) { return *(int *)a - *(int *)b; }
void enum_prime(int *list) {
int i;
list[0] = 2;
for (i = 1; i < ASIZE; i++) {
list[i] = 2 * i + 1;
}
list[ASIZE - 1] = INT_MAX;
int j, p, pl... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 322 | 2 |
#include <stdio.h>
int main() {
int i, j, count, n, flag, k;
char hyou[999999];
int p[100];
while (scanf("%d", &n) != EOF) {
count = 0;
k = 0;
for (i = 0; i <= n; i++) {
hyou[i] = 0;
}
for (i = 4; i <= n; i += 2) {
hyou[i] = 1;
}
j = 3;
while (j <= n) {
for (... | #include <stdio.h>
int main() {
int i, j, count, n, flag, k;
char hyou[999999];
int p[100];
while (scanf("%d", &n) != EOF) {
count = 0;
k = 0;
for (i = 0; i <= n; i++) {
hyou[i] = 0;
}
for (i = 4; i <= n; i += 2) {
hyou[i] = 1;
}
j = 3;
while (j <= n) {
for (... | [["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]] | 0 | 218 | 2 |
#include <stdio.h>
int prime[1000000] = {0};
int main() {
int i, j, k, flag;
while (scanf("%d", &i) != EOF) {
flag = 0;
for (j = 2; j <= i / 2; j++) {
for (k = 2; k * j < i; k++) {
prime[j * k] = 1;
}
}
for (j = 2; j <= i; j++) {
if (prime[j] == 0) {
flag++;
}... | #include <stdio.h>
int prime[1000000] = {0};
int main() {
int i, j, k, flag;
while (scanf("%d", &i) != EOF) {
flag = 0;
for (j = 2; j <= i / 2; j++) {
for (k = 2; k * j <= i; k++) {
prime[j * k] = 1;
}
}
for (j = 2; j <= i; j++) {
if (prime[j] == 0) {
flag++;
... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 134 | 2 |
#include <math.h>
#include <stdio.h>
#define max 1000000
int main() {
int a;
int x, y, z;
int r[max];
for (x = 3; x <= max; x += 2) {
r[x] = 1;
}
for (z = 3; z <= 1000; z += 2)
if (r[x] == 1) {
for (x = 3; x <= a / z; x += 2) {
r[x * z] = 0;
}
}
while ((scanf("%d", &a)) !... | #include <math.h>
#include <stdio.h>
#define max 1000000
int main() {
int a;
int x, y, z;
int r[max];
for (x = 3; x <= max; x += 2) {
r[x] = 1;
}
for (z = 3; z <= 1000; z += 2)
if (r[z] == 1) {
for (x = 3; x <= max / z; x += 2) {
r[x * z] = 0;
}
}
while ((scanf("%d", &a))... | [["-", 8, 57, 15, 23, 0, 16, 31, 69, 71, 22], ["+", 8, 57, 15, 23, 0, 16, 31, 69, 71, 22], ["-", 64, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 64, 9, 0, 7, 15, 16, 12, 16, 31, 22]] | 0 | 190 | 4 |
#include <stdio.h>
#define N 1000000
int main() {
int n, i, j;
int a[N];
a[0] = 0;
a[1] = 0;
a[2] = 1;
for (i = 3; i < N; i++) {
a[i] = i % 2;
}
for (i = 2; i < N; i++) {
if (a[i] == 1) {
for (j = i * 2; j < N; j += i)
;
a[j] = 0;
}
}
for (i = 1; i < N; i++) {
a[... | #include <stdio.h>
#define N 1000000
int main() {
int n, i, j;
int a[N];
a[0] = 0;
a[1] = 0;
a[2] = 1;
for (i = 3; i < N; i++) {
a[i] = i % 2;
}
for (i = 2; i < N; i++) {
if (a[i] == 1) {
for (j = i * 2; j < N; j += i) {
a[j] = 0;
}
}
}
for (i = 1; i < N; i++) {
... | [["-", 0, 57, 64, 9, 0, 7, 8, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46]] | 0 | 184 | 3 |
#include <stdio.h>
int m[1000000];
int main(void) {
int n, i, j, cnt;
while (scanf("%d", &n) != EOF) {
cnt = 0;
for (i = 0; i < n; i++) {
m[i] = i;
}
m[1] = 0;
for (i = 2; i <= n; i++) {
for (j = 2; i * j <= n; j++) {
m[i * j] = 0;
}
}
i = 0;
while (i < n) {... | #include <stdio.h>
int m[1000000];
int main(void) {
int n, i, j, cnt;
while (scanf("%d", &n) != EOF) {
cnt = 0;
for (i = 0; i <= n; i++) {
m[i] = i;
}
m[1] = 0;
for (i = 2; i <= n; i++) {
for (j = 2; i * j <= n; j++) {
m[i * j] = 0;
}
}
i = 0;
while (i <= n)... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 19]] | 0 | 154 | 4 |
#include <stdio.h>
int prime[1000000];
void ertsthns(int n) {
int i;
for (i = 2; i < n; i++) {
if (prime[i] == 1) {
int j;
for (j = 2 * i; j < n; j += i) {
prime[j] = 0;
}
}
}
}
void doit(int n) {
int i;
int cnt = 0;
ertsthns(n);
for (i = 0; i < n; i++) {
if (prime... | #include <stdio.h>
int prime[1000000];
void ertsthns(int n) {
int i;
for (i = 2; i <= n; i++) {
if (prime[i] == 1) {
int j;
for (j = 2 * i; j <= n; j += i) {
prime[j] = 0;
}
}
}
}
void doit(int n) {
int i;
int cnt = 0;
ertsthns(n);
for (i = 0; i <= n; i++) {
if (pr... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 209 | 8 |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define maxn 999999 + 5
typedef long long ll;
int prime[maxn];
void init() {
for (int i = 2; i < maxn - 4; i++)
prime[i] = i % 2;
prime[2] = 1;
prime[1] = 0;
for (int i = 2; i * i <= maxn; i++) {
if (!... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define maxn 999999 + 5
typedef long long ll;
int prime[maxn];
void init() {
for (int i = 2; i < maxn - 4; i++)
prime[i] = i % 2;
prime[2] = 1;
prime[1] = 0;
for (int i = 2; i * i <= maxn; i++) {
if (!... | [["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 1 | 191 | 3 |
#include <stdio.h>
#include <string.h>
bool mark[1000000];
void sieve() {
int N = 1000000;
memset(mark, true, N + 2);
mark[0] = mark[1] = false;
for (int i = 4; i < N + 2; i += 2)
mark[i] = false;
for (int i = 3; i * i <= N + 2; i += 2) {
if (mark[i] == true) {
for (int j = i * i; j < N + 2;... | /*#include<stdio.h>
int checkPrime(int i)
{
int p;
for ( p = 2 ; p <= i - 1 ; p++ )
{
if ( i%p == 0 )
return 0;
}
if ( p == i )
return 1;
}
int main()
{
int n,sum=0,count=0,rem,i;
while(scanf("%d",&n)!= EOF){
for(i=2;i<n-1;++i)
{
if(ch... | [["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 1 | 200 | 1 |
#include <stdio.h>
bool mark[1000000];
void init() {
for (int i = 0; i < 1000000; i++)
mark[i] = false;
mark[0] = true;
mark[1] = true;
for (int i = 2; i < 1000000; i++) {
if (mark[i])
continue;
for (int j = i * 2; j < 1000000; j += i) {
mark[j] = true;
}
}
}
int main() {
init(... | #include <stdio.h>
bool mark[1000000];
void init() {
for (int i = 0; i < 1000000; i++)
mark[i] = false;
mark[0] = true;
mark[1] = true;
for (int i = 2; i < 1000000; i++) {
if (mark[i])
continue;
for (int j = i * 2; j < 1000000; j += i) {
mark[j] = true;
}
}
}
int main() {
init(... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 179 | 2 |
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef int long long ll;
using namespace std;
int main() {... | #include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef int long long ll;
using namespace std;
int main() {... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 198 | 2 |
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int prime[40];
bool is_prime[40];
int i = 2, j = 2, n, count = 0;
while (scanf("%d", &n) != EOF) {
int p = 0;
for (i = 0; i <= n; i++) {
is_prime[i] = true;
}
is_prime[0] = is_prime[1] = false;
for (i = 2; i <= n... | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int prime[1000000];
bool is_prime[1000000];
int i = 2, j = 2, n, count = 0;
while (scanf("%d", &n) != EOF) {
int p = 0;
for (i = 0; i <= n; i++) {
is_prime[i] = true;
}
is_prime[0] = is_prime[1] = false;
for (i =... | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]] | 1 | 160 | 4 |
#include <iostream>
using namespace std;
int main() {
bool prime[1000000];
for (int i = 0; i < 1000000; i++)
prime[i] = true;
prime[0] = prime[1] = false;
for (int i = 0; i < 1000000; i++)
if (prime[i]) {
for (int j = i; j < 1000000; j += i)
prime[j] = false;
}
int n;
while (cin... | #include <iostream>
using namespace std;
int main() {
bool prime[1000000];
for (int i = 0; i < 1000000; i++)
prime[i] = true;
prime[0] = prime[1] = false;
for (int i = 0; i < 1000000; i++)
if (prime[i]) {
for (int j = i + i; j < 1000000; j += i)
prime[j] = false;
}
int n;
while ... | [["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 22]] | 1 | 147 | 2 |
#include <cstdio>
using namespace std;
bool prime[1000000];
#define max 1000000
int main() {
prime[1] = true;
for (int i = 2; i < max; i++) {
if (!prime[i]) {
for (int j = i * i; j < max; j += i) {
prime[j] = true;
}
}
}
int n;
while (scanf("%d", &n) != EOF) {
int ans = 0;
... | #include <cstdio>
using namespace std;
bool prime[1000000];
#define max 1000000
int main() {
prime[1] = true;
for (int i = 2; i * i < max; i++) {
if (!prime[i]) {
for (int j = i * i; j < max; j += i) {
prime[j] = true;
}
}
}
int n;
while (scanf("%d", &n) != EOF) {
int ans = 0;
... | [["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22]] | 1 | 144 | 2 |
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
bool isprime[1000000];
int main(int argc, char **argv) {
in... | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
bool isprime[1000000];
int main(int argc, char **argv) {
in... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 194 | 2 |
#include <cstdio>
#include <iostream>
using namespace std;
const int MAX_N = 1000000; // いくつまで調べるか
bool prime[MAX_N + 1]; // 添字が素数ならtrue、それ以外はfalse
void sieve() {
prime[0] = prime[1] = false; // 例外処理
// 配列prime の初期化
for (int i = 2; i <= MAX_N; ++i)
prime[i] = true;
// 素数でないものを調べる
for (int i = 2; i <= ... | #include <cstdio>
#include <iostream>
using namespace std;
const int MAX_N = 1000000; // いくつまで調べるか
bool prime[MAX_N + 1]; // 添字が素数ならtrue、それ以外はfalse
void sieve() {
prime[0] = prime[1] = false; // 例外処理
// 配列prime の初期化
for (int i = 2; i <= MAX_N; ++i)
prime[i] = true;
// 素数でないものを調べる
for (int i = 2; i <= ... | [["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 188 | 4 |
#include <cmath>
#include <iostream>
using namespace std;
bool check(int in) {
for (int i = 3; i <= sqrt(in); i += 2) {
if (i != 5 && i % 5 == 0)
continue;
if (in % i == 0)
return false;
}
return true;
}
int PrimeNumber(int in, int start) {
int count = 0;
if (in > 2)
count++;
for (... | #include <cmath>
#include <iostream>
using namespace std;
bool check(int in) {
for (int i = 3; i <= sqrt(in); i += 2) {
if (i != 5 && i % 5 == 0)
continue;
if (in % i == 0)
return false;
}
return true;
}
int PrimeNumber(int in, int start) {
int count = 0;
if (in >= 2 && start == 3)
c... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 248 | 6 |
#include <cmath>
#include <iostream>
using namespace std;
#define MAX 100
bool prime[MAX] = {};
void run() {
for (int i = 2; i < MAX; i++) {
prime[i] = true;
}
for (int i = 2; i < MAX; i++) {
if (!prime[i])
continue;
for (int j = 2; j * i < MAX; j++) { // i*1 is prime number
prime[i * j... | #include <cmath>
#include <iostream>
using namespace std;
#define MAX 1000000
bool prime[MAX] = {};
void run() {
for (int i = 2; i < MAX; i++) {
prime[i] = true;
}
for (int i = 2; i < MAX; i++) {
if (!prime[i])
continue;
for (int j = 2; j * i < MAX; j++) { // i*1 is prime number
prime[i... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 1 | 166 | 2 |
#include <iostream>
#include <vector>
using namespace std;
constexpr int MAX = 1000000;
int main() {
vector<bool> prime_list(MAX, true);
prime_list.at(0) = false;
prime_list.at(1) = false;
for (int i = 2; i * i < MAX; ++i) {
if (!prime_list.at(i))
continue;
for (int j = 2; i * j < MAX; ++j)
... | #include <iostream>
#include <vector>
using namespace std;
constexpr int MAX = 1000000;
int main() {
vector<bool> prime_list(MAX, true);
prime_list.at(0) = false;
prime_list.at(1) = false;
for (int i = 2; i * i < MAX; ++i) {
if (!prime_list.at(i))
continue;
for (int j = 2; i * j < MAX; ++j)
... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 158 | 2 |
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
/*
int main(void)
{
int n;
vector<int> vecPrime;
while (cin >> n)
{
// vectorの破棄
vecPrime.clear();
// nが2以上の時,2のみ追加
if (n >= 2)
... |
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
/*
int main(void)
{
int n;
vector<int> vecPrime;
while (cin >> n)
{
// vectorの破棄
vecPrime.clear();
// nが2以上の時,2のみ追加
if (n >= 2)
... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 18], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19]] | 1 | 168 | 2 |
#include <stdio.h>
#include <string.h>
int main(void) {
int n, i, c, k, prime[999999] = {0}, t;
for (i = 2; 999999 >= i; i++) {
if (!prime[i])
for (c = i * 2; 999999 >= c; c += i)
prime[c] = 1;
}
while (scanf("%d", &n) != EOF) {
i = 0;
for (c = 2; n > c; c++) {
if (!prime[c])
... | #include <stdio.h>
#include <string.h>
int main(void) {
int n, i, c, k, prime[999999] = {0}, t;
for (i = 2; 999999 >= i; i++) {
if (!prime[i])
for (c = i * 2; 999999 >= c; c += i)
prime[c] = 1;
}
while (scanf("%d", &n) != EOF) {
i = 0;
for (c = 2; n >= c; c++) {
if (!prime[c])
... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 20]] | 1 | 136 | 2 |
#include <bits/stdc++.h>
using namespace std;
vector<int> primes;
bool is_prime[1000100];
void search_prime(int n) {
for (int i = 0; i <= n; ++i)
is_prime[i] = true;
is_prime[0] = is_prime[1] = false;
for (int i = 2; i <= n; ++i) {
if (is_prime[i]) {
primes.push_back(i);
for (int j = i * 2; ... | #include <bits/stdc++.h>
using namespace std;
vector<int> primes;
bool is_prime[1000100];
void search_prime(int n) {
for (int i = 0; i <= n; ++i)
is_prime[i] = true;
is_prime[0] = is_prime[1] = false;
for (int i = 2; i <= n; ++i) {
if (is_prime[i]) {
primes.push_back(i);
for (int j = i * 2; ... | [["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 0, 9, 0, 57, 64, 1, 0, 27, 17, 68], ["+", 0, 9, 0, 57, 64, 1, 0, 27, 17, 29]] | 1 | 207 | 4 |
#include <cstdio>
#include <cstring>
const int N = 19;
int dp[N];
int isprime[N];
int main() {
dp[1] = 0;
for (int i = 2; i < N; i++) {
if (!isprime[i])
for (int j = 2 * i; j < N; j += i)
isprime[j] = 1;
dp[i] = dp[i - 1] + ((isprime[i]) ? 0 : 1);
}
int y;
while (~scanf("%d", &y))
... | #include <cstdio>
#include <cstring>
const int N = 1000009;
int dp[N];
int isprime[N];
int main() {
dp[1] = 0;
for (int i = 2; i < N; i++) {
if (!isprime[i])
for (int j = 2 * i; j < N; j += i)
isprime[j] = 1;
dp[i] = dp[i - 1] + ((isprime[i]) ? 0 : 1);
}
int y;
while (~scanf("%d", &y)... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]] | 1 | 140 | 2 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#pragma warning(disable : 4996)
int main() {
int num, cnt;
unsigned int i, j, k, data_num;
int data[30];
unsigned int sq_num;
unsigned int *prime;
for (data_num = 0; data_num < 30; data_num++) {
data[data_num] = -1;
scanf("%d", &data[data_n... | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#pragma warning(disable : 4996)
int main() {
int num, cnt;
unsigned int i, j, k, data_num;
int data[30];
unsigned int sq_num;
unsigned int *prime;
for (data_num = 0; data_num < 30; data_num++) {
data[data_num] = -1;
scanf("%d", &data[data_n... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 299 | 4 |
#include <iostream>
using namespace std;
int main() {
bool p[1000000] = {false};
int n;
for (int i = 2; i < 1000000; i++) {
for (int i2 = 2; i * i2 <= n; i2++) {
p[i * i2] = true;
}
}
p[2] = false;
p[3] = false;
while (cin >> n) {
int c = 0;
for (int i = 2; i <= n; i++) {
if (... | #include <iostream>
using namespace std;
int main() {
bool p[1000000] = {false};
int n;
for (int i = 2; i < 1000000; i++) {
for (int i2 = 2; i * i2 <= 1000000; i2++) {
p[i * i2] = true;
}
}
p[2] = false;
p[3] = false;
while (cin >> n) {
int c = 0;
for (int i = 2; i <= n; i++) {
... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 128 | 2 |
#include <iostream>
using namespace std;
#define x 1000000
int main() {
bool q[x];
for (int i = 2; i < x; i++)
q[i] = true;
for (int i = 2; i < x; i++)
if (q[i])
for (int j = 2; j <= x / i; j++)
q[i * j] = false;
int n;
while (cin >> n) {
int a = 0;
for (int i = 2; i < x; i++)
... | #include <iostream>
using namespace std;
#define x 1000000
int main() {
bool q[x];
for (int i = 2; i < x; i++)
q[i] = true;
for (int i = 2; i < x; i++)
if (q[i])
for (int j = 2; j <= x / i; j++)
q[i * j] = false;
int n;
while (cin >> n) {
int a = 0;
for (int i = 2; i <= n; i++)
... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 134 | 4 |
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int n, i, j, k;
int b;
int count = 0;
while (cin >> n) {
int a[n + 1];
for (i = 2; i < n + 1; i++) {
a[i] = i;
}
for (i = 2; i * i < n; i++) {
if (a[i] ... | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int n, i, j, k;
int b;
int count = 0;
while (cin >> n) {
int a[n + 1];
for (i = 2; i < n + 1; i++) {
a[i] = i;
}
for (i = 2; i * i < n + 1; i++) {
if (a... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 184 | 2 |
#include <iostream>
using namespace std;
int main() {
int w, n, a, b;
int amida[31];
for (int i = 1; i < 31; i++)
amida[i] = i;
cin >> w >> n;
for (int i = 0; i < n; i++) {
cin >> a >> b;
swap(amida[a], amida[b]);
}
for (int i = 1; i <= w; i++) {
cout << amida[i] << endl;
}
return ... | #include <iostream>
using namespace std;
int main() {
int w, n, a, b;
char comma;
int amida[31];
for (int i = 1; i < 31; i++)
amida[i] = i;
cin >> w >> n;
for (int i = 0; i < n; i++) {
cin >> a >> comma >> b;
swap(amida[a], amida[b]);
}
for (int i = 1; i <= w; i++) {
cout << amida[i] ... | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 117 | 5 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int w, n;
cin >> n;
cin >> w;
int T[31];
for (int i = 1; i <= n; i++) {
T[i] = i;
}
for (int i = 0; i < w; i++) {
int a, b;
cin >> a >> b;
swap(T[a], T[b]);
}
for (int i = 1; i <= n; i++)
cout << T[i] << en... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int w, n;
cin >> n;
cin >> w;
int T[31];
for (int i = 1; i <= n; i++) {
T[i] = i;
}
for (int i = 0; i < w; i++) {
int a, b;
char c;
cin >> a >> c >> b;
swap(T[a], T[b]);
}
for (int i = 1; i <= n; i++)
c... | [["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 49, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 122 | 5 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int w, n;
int u[30];
cin >> w >> n;
for (int i = 0; i < w; i++) {
u[i] = i + 1;
}
for (int i = 0; i < n; i++) {
int a, b;
scanf("%d,%d", &a, &b);
swap(u[a + 1], u[b + 1]);
}
for (int i = 0; i < w; i++) {
cout... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int w, n;
int u[30];
cin >> w >> n;
for (int i = 0; i < w; i++) {
u[i] = i + 1;
}
for (int i = 0; i < n; i++) {
int a, b;
scanf("%d,%d", &a, &b);
swap(u[a - 1], u[b - 1]);
}
for (int i = 0; i < w; i++) {
cout... | [["-", 3, 4, 0, 69, 341, 342, 0, 16, 17, 72], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 17, 33]] | 1 | 135 | 4 |
#include <iostream>
int main() {
int a, b, c, g, h;
std::cin >> a >> b;
int d[a];
for (int e = 1; e <= a; e++) {
d[e] = e;
}
for (int f = 0; f < b; f++) {
std::cin >> g >> h;
c = d[g];
d[g] = d[h];
d[h] = c;
}
for (int i = 1; i <= a; i++) {
std::cout << d[i] << std::endl;
}
... | #include <iostream>
int main() {
int a, b, c, g, h;
char j;
std::cin >> a >> b;
int d[a];
for (int e = 1; e <= a; e++) {
d[e] = e;
}
for (int f = 0; f < b; f++) {
std::cin >> g >> j >> h;
c = d[g];
d[g] = d[h];
d[h] = c;
}
for (int i = 1; i <= a; i++) {
std::cout << d[i] << st... | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 136 | 5 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define FOR(i, a) for (int i = 0; i < (int)a; ++i)
typedef long long ll;
typedef long double ld;
using namespace std;
void solver() {
int w, n;
vector<int> a, b;
vector<pair<int, int>> ans;
cin >> w;
cin >> n;
fo... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define FOR(i, a) for (int i = 0; i < (int)a; ++i)
typedef long long ll;
typedef long double ld;
using namespace std;
void solver() {
int w, n;
vector<int> a, b;
vector<pair<int, int>> ans;
cin >> w;
cin >> n;
fo... | [["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151]] | 1 | 242 | 6 |
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int w, n, a, b;
char o;
cin >> w >> o >> n;
vector<int> c;
for (int i = 0; i <= w + 1; i++)
c.push_back(i);
for (int i = 1; i <= n; i++) {
cin >> a >> b;
swap(c[a], c[b]);
}
for (in... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int w, n, a, b;
char o;
cin >> w >> n;
vector<int> c;
for (int i = 0; i <= w + 1; i++)
c.push_back(i);
for (int i = 1; i <= n; i++) {
cin >> a >> o >> b;
swap(c[a], c[b]);
}
for (in... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 125 | 4 |
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int w, n;
int c[] = {0};
int a, b;
// int temp;
scanf("%d", &w);
scanf("%d", &n);
for (int i = 0; i <= w; i++) {
c[i] = i;
}
for (int i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
swap(c[a], c[... | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int w, n;
int c[50] = {0};
int a, b;
// int temp;
scanf("%d", &w);
scanf("%d", &n);
for (int i = 0; i <= w; i++) {
c[i] = i;
}
for (int i = 0; i < n; i++) {
scanf("%d,%d", &a, &b);
swap(c[a], ... | [["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]] | 1 | 150 | 1 |
#include <algorithm>
#include <iostream>
#define MAX 31
using namespace std;
int main(void) {
int N[MAX];
int w, n;
int a, b;
char ten;
cin >> w >> n;
for (int i = 1; i <= w; i++)
N[i] = i;
for (int i = 1; i <= n; i++) {
cin >> a >> ten >> b;
swap(N[a], N[b]); // swap関数は第一引数と第二引数を交換する関数
... | #include <algorithm>
#include <iostream>
#define MAX 31
using namespace std;
int main(void) {
int N[MAX];
int w, n;
int a, b;
char ten;
cin >> w >> n;
for (int i = 1; i <= w; i++)
N[i] = i;
for (int i = 1; i <= n; i++) {
cin >> a >> ten >> b;
swap(N[a], N[b]); // swap関数は第一引数と第二引数を交換する関数
... | [["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 128 | 2 |
#include <iostream>
#include <string>
using namespace std;
int main() {
int place[31];
int w, n;
cin >> w >> n;
for (int i = 1; i <= w; i++)
place[i] = i;
int a, b;
char c;
for (int i = 1; i <= n; i++) {
cin >> a >> c >> b;
int temp = place[a];
place[a] = place[b];
place[b] = temp;... | #include <iostream>
#include <string>
using namespace std;
int main() {
int place[31];
int w, n;
cin >> w >> n;
for (int i = 1; i <= w; i++)
place[i] = i;
int a, b;
char c;
for (int i = 1; i <= n; i++) {
cin >> a >> c >> b;
int temp = place[a];
place[a] = place[b];
place[b] = temp;... | [["+", 8, 9, 0, 7, 8, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 7, 8, 1, 0, 16, 12, 22]] | 1 | 133 | 2 |
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
double x[n], y[n], r[n];
for (int i = 0; i < n; i++) {
double x1, y1, x2, y2, x3, y3;
double a, b, c, d, e, f;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
a = 2 * (x1 - x2);
b = 2 * (y1 -... | #include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
double x[n], y[n], r[n];
for (int i = 0; i < n; i++) {
double x1, y1, x2, y2, x3, y3;
double a, b, c, d, e, f;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
a = 2 * (x1 - x2);
b = 2 * (y1 -... | [["-", 12, 16, 12, 23, 0, 16, 12, 16, 31, 22], ["+", 12, 16, 12, 23, 0, 16, 12, 16, 31, 22], ["-", 12, 16, 12, 23, 0, 16, 12, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 12, 16, 12, 22]] | 1 | 315 | 4 |
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
double x1, y1, x2, y2, x3, y3;
int n;
while (n--) {
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
double d1 = x1 * x1 + y1 * y1;
double d2 = x2 * x2 + y2 * y2;
double d3 = x3 * x3 + y3 * y3;
double u =
... | #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
double x1, y1, x2, y2, x3, y3;
int n;
cin >> n;
while (n--)
{
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
double d1 = x1 * x1 + y1 * y1;
double d2 = x2 * x2 + y2 * y2;
double d3 = x3 * x3 + y3 * y3;
do... | [["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 226 | 4 |
include Math
gets.to_i.times do
x1, y1, x2, y2, x3, y3 = gets.split.map(&:to_i)
a1 = 2 * (x2 - x1)
b1 = 2 * (y2 - y1)
c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2
a2 = 2 * (x3 - x1)
b2 = 2 * (y3 - y1)
c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3
a = sqrt((x2 - x3)**2 + (y2 - y3)**2)
b = sqrt((x3 - x1)*... | include Math
gets.to_i.times do
x1, y1, x2, y2, x3, y3 = gets.split.map(&:to_f)
a1 = 2 * (x2 - x1)
b1 = 2 * (y2 - y1)
c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2
a2 = 2 * (x3 - x1)
b2 = 2 * (y3 - y1)
c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3
a = sqrt((x2 - x3)**2 + (y2 - y3)**2)
b = sqrt((x3 - x1)*... | [["-", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753]] | 4 | 260 | 2 |
require 'matrix'
gets.to_i.times do
x1, y1, x2, y2, x3, y3 = gets.split.map(&:to_f)
px, py = (Matrix[[2 * (x1 - x2), 2 * (y1 - y2)], [2 * (x1 - x3), 2 * (y1 - y3)]].inv *
Matrix[[x1**2 + y1**2 - x2**2 - y2**2], [x1**2 + y1**2 - x3**2 - y3**2]]).to_a.flatten
r = Math.sqrt((x1**2 - px)**2 + (y1**2 - py)**2)
... | require 'matrix'
gets.to_i.times do
x1, y1, x2, y2, x3, y3 = gets.split.map(&:to_f)
px, py = (Matrix[[2 * (x1 - x2), 2 * (y1 - y2)], [2 * (x1 - x3), 2 * (y1 - y3)]].inv *
Matrix[[x1**2 + y1**2 - x2**2 - y2**2], [x1**2 + y1**2 - x3**2 - y3**2]]).to_a.flatten
r = Math.sqrt((x1 - px)**2 + (y1 - py)**2)
printf... | [["-", 31, 738, 31, 739, 0, 738, 31, 738, 17, 578], ["-", 31, 738, 31, 739, 0, 738, 31, 738, 12, 612], ["-", 12, 738, 31, 739, 0, 738, 31, 738, 17, 578], ["-", 12, 738, 31, 739, 0, 738, 31, 738, 12, 612]] | 4 | 158 | 4 |
#!/usr/bin/ruby
gets.to_i.times do
x1, y1, x2, y2, x3, y3 = gets.split.map(&:to_f)
a1 = 2 * x2 - 2 * x1
b1 = 2 * y2 - 2 * y1
c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2
a2 = 2 * x3 - 2 * x1
b2 = 2 * y3 - 2 * y1
c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3
x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1)
y =... | #!/usr/bin/ruby
gets.to_i.times do
x1, y1, x2, y2, x3, y3 = gets.split.map(&:to_f)
a1 = 2 * x2 - 2 * x1
b1 = 2 * y2 - 2 * y1
c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2
a2 = 2 * x3 - 2 * x1
b2 = 2 * y3 - 2 * y1
c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3
x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1)
y =... | [["-", 3, 4, 0, 652, 3, 4, 0, 652, 486, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 652, 486, 743]] | 4 | 165 | 2 |
#! -*- coding:utf-8 -*-
import math
n = eval(input())
for x in range(n):
x1,y1,x2,y2,x3,y3 = list(map(float,input().split()))
a1 = 2.0*(x2-x1)
b1 = 2.0*(y2-y1)
x12 = x1**2
y12 = y1**2
c1 = x12-x2**2+y12+y2**2
a2 = 2.0*(x3-x1)
b2 = 2.0*(y3-y1)
c2 = x12-x3**2+y12-y3**2
denom=(a1*b2... | #! -*- coding:utf-8 -*-
import math
n = eval(input())
for x in range(n):
x1,y1,x2,y2,x3,y3 = list(map(float,input().split()))
a1 = 2.0*(x2-x1)
b1 = 2.0*(y2-y1)
x12 = x1**2
y12 = y1**2
c1 = x12-x2**2+y12-y2**2
a2 = 2.0*(x3-x1)
b2 = 2.0*(y3-y1)
c2 = x12-x3**2+y12-y3**2
denom=(a1*b2... | [["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33]] | 5 | 191 | 2 |
import math
n = int(input())
for i in range(n):
x1, y1, x2, y2, x3, y3 = list(map(int, input().split()))
px = ((y2 - y3)*(x1*x1 + y1*y1) + (y3 - y1)*(x2*x2 + y2*y2) + (y1 - y2)*(x3*x3 + y3*y3))/(2*(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2)))
py = ((x2 - x3)*(x1*x1 + y1*y1) + (x3 - x1)*(x2*x2 + y2*y2) + (x1 -... | import math
n = int(input())
for i in range(n):
x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
px = ((y2 - y3)*(x1*x1 + y1*y1) + (y3 - y1)*(x2*x2 + y2*y2) + (y1 - y2)*(x3*x3 + y3*y3))/(2*(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2)))
py = ((x2 - x3)*(x1*x1 + y1*y1) + (x3 - x1)*(x2*x2 + y2*y2) + (x1... | [["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22]] | 5 | 249 | 2 |
# -*- coding: utf-8 -*-
import sys
def length(a, b):
return ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5
def solve_sim_equ(a, b, c, d, e, f):
'''
From Problem 0004.
This function solves following equation.
ax + by = c
dx + ey = f
'''
if a==0 and d==0:
if b==0 and e==0:
... | # -*- coding: utf-8 -*-
import sys
def length(a, b):
return ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5
def solve_sim_equ(a, b, c, d, e, f):
'''
From Problem 0004.
This function solves following equation.
ax + by = c
dx + ey = f
'''
if a==0 and d==0:
if b==0 and e==0:
... | [["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]] | 5 | 447 | 2 |
import sys
import math
n = int(sys.stdin.readline().rstrip())
for i in range(n):
x1,y1,x2,y2,x3,y3 = map(float, sys.stdin.readline().rstrip().split(' '))
p = ((y1-y3)*(y1**2-y2**2+x1**2-x2**2)-(y1-y2)*(y1**2-y3**2+x1**2-x3**2)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3))
q = ((x1-x3)*(x1**2-x2**2+y1**2-y2**2)-(... | import sys
import math
n = int(sys.stdin.readline().rstrip())
for i in range(n):
x1,y1,x2,y2,x3,y3 = map(float, sys.stdin.readline().rstrip().split(' '))
p = ((y1-y3)*(y1**2-y2**2+x1**2-x2**2)-(y1-y2)*(y1**2-y3**2+x1**2-x3**2)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3))
q = ((x1-x3)*(x1**2-x2**2+y1**2-y2**2)-(... | [["-", 0, 657, 12, 657, 31, 23, 0, 657, 31, 22], ["+", 0, 657, 12, 657, 31, 23, 0, 657, 31, 22]] | 5 | 277 | 2 |
#coding: utf-8
def solve(a, b, c, d, e, f):
agn = a*e - b*d
x = (e*c - b*f)/float(agn)
y = (-d*c + a*f)/float(agn)
if x == 0.: x = 0.
if y == 0.: y = 0.
return (x, y)
while True:
try:
n = eval(input())
for i in range(n):
x = [0 for i in range(3)]
y... | #coding: utf-8
def solve(a, b, c, d, e, f):
agn = a*e - b*d
x = (e*c - b*f)/float(agn)
y = (-d*c + a*f)/float(agn)
if x == 0.: x = 0.
if y == 0.: y = 0.
return (x, y)
while True:
try:
n = eval(input())
for i in range(n):
x = [0 for i in range(3)]
y... | [["-", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 72], ["-", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 64, 196, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 12, 531]] | 5 | 512 | 7 |
<?php
$w=trim(fgets(STDIN));
$value=array();
for($i=0;$i<$w;$i++){
$value[]=$i;
}
$n=trim(fgets(STDIN));
for($i=0;$i<$n;$i++){
list($a,$b)=explode(",",trim(fgets(STDIN)));
$tmp=$value[$a];
$value[$a]=$value[$b];
$value[$b]=$tmp;
}
foreach ($value as $hoge) {
echo $hoge."\n";
} | <?php
$w=trim(fgets(STDIN));
$value=array();
for($i=1;$i<$w+1;$i++){
$value[$i]=$i;
}
$n=trim(fgets(STDIN));
for($i=0;$i<$n;$i++){
list($a,$b)=explode(",",trim(fgets(STDIN)));
$tmp=$value[$a];
$value[$a]=$value[$b];
$value[$b]=$tmp;
}
foreach($value as $hoge) {
echo $hoge."\n";
} | [["-", 36, 36, 0, 493, 0, 7, 0, 11, 12, 612], ["+", 36, 36, 0, 493, 0, 7, 0, 11, 12, 612], ["+", 0, 493, 0, 7, 0, 16, 12, 16, 17, 72], ["+", 0, 493, 0, 7, 0, 16, 12, 16, 12, 612], ["+", 0, 1, 0, 11, 31, 69, 0, 606, 0, 607], ["+", 0, 1, 0, 11, 31, 69, 0, 606, 0, 141]] | 6 | 152 | 6 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
int temp;
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
int temp;
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int ... | [["-", 51, 16, 31, 492, 3, 4, 0, 504, 71, 499], ["+", 51, 16, 31, 492, 3, 4, 0, 504, 71, 499]] | 3 | 217 | 2 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int w = Int... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int w = Int... | [["-", 8, 196, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499], ["+", 8, 196, 0, 7, 15, 16, 12, 492, 500, 22], ["+", 8, 196, 0, 7, 15, 16, 12, 492, 0, 131], ["+", 8, 196, 0, 7, 15, 16, 12, 492, 141, 22], ["+", 0, 7, 15, 16, 12, 492, 3, 4, 0, 24], ... | 3 | 288 | 8 |
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] k = new int[w];
for (int i = 0; i < w; i++) {
k[i] = i + 1;
}
for (int j = 0; j < n; j++) {
String[] line = sc... | import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] k = new int[w];
for (int i = 0; i < w; i++) {
k[i] = i + 1;
}
for (int j = 0; j < n; j++) {
String[] line = sc... | [["-", 0, 503, 49, 200, 51, 492, 500, 492, 141, 22], ["+", 0, 503, 49, 200, 51, 492, 500, 492, 141, 22]] | 3 | 209 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.