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> using namespace std; int prime[10000]; bool is_prime[1000000]; int sosuu(int n) { int p = 0; 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]) { prime[p++] = ...
#include <cstdio> #include <iostream> #include <math.h> using namespace std; int prime[100000]; bool is_prime[1000000]; int sosuu(int n) { int p = 0; 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]) { prime[p++] ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
158
4
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int const M = 40; int a, hantei[M]; int main() { hantei[0] = hantei[1] = 1; for (int i = 2; i < M; i++) { if (hantei[i] == 0) { for (int j = 2; j * i < M; j++) { if (j * i < M) { hantei[j...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int const M = 1000010; int a, hantei[M]; int main() { hantei[0] = hantei[1] = 1; for (int i = 2; i < M; i++) { if (hantei[i] == 0) { for (int j = 2; j * i < M; j++) { if (j * i < M) { han...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
159
2
#include <algorithm> #include <iostream> #include <vector> using namespace std; vector<int> prime; void init() { for (int i = 2; i < 999999; i++) { bool isprime = true; for (vector<int>::iterator p(prime.begin()); p != prime.end(); p++) { if ((*p) * (*p) > i) break; if (i % *p == 0) { ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; vector<int> prime; void init() { for (int i = 2; i < 999999; i++) { bool isprime = true; for (vector<int>::iterator p(prime.begin()); p != prime.end(); p++) { if ((*p) * (*p) > i) break; if (i % *p == 0) { ...
[["-", 31, 16, 12, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
172
4
#include <iostream> using namespace std; int main() { long n, i, j, *nn; for (;;) { cin >> n; if (cin.eof()) break; nn = new long[n + 1]; nn[1] = 0; nn[2] = 1; for (i = 3; i <= n; i += 2) nn[i] = 1; for (i = 4; i <= n; i += 2) nn[i] = 0; for (i = 3; i * i < n;) { ...
#include <iostream> using namespace std; int main() { long n, i, j, *nn; for (;;) { cin >> n; if (cin.eof()) break; nn = new long[n + 1]; nn[1] = 0; nn[2] = 1; for (i = 3; i <= n; i += 2) nn[i] = 1; for (i = 4; i <= n; i += 2) nn[i] = 0; for (i = 3; i * i <= n;) { ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 52, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60]]
1
207
4
#include <bitset> #include <iostream> using namespace std; int main() { int count = 0, n; bitset<1000001> prime; prime[0] = 1; prime[1] = 1; for (int i = 2; i <= 1000; i++) if (prime[i] == 0) for (int j = i + 1; j <= 1000000; j++) if (j % i == 0) prime[j] = 1; while (cin >> n)...
#include <bitset> #include <iostream> using namespace std; int main() { int count = 0, n; bitset<1000001> prime; prime[0] = 1; prime[1] = 1; for (int i = 2; i <= 1000; i++) if (prime[i] == 0) for (int j = i + 1; j <= 1000000; j++) if (j % i == 0) prime[j] = 1; while (cin >> n)...
[["+", 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]]
1
135
4
#include <iostream> #include <vector> int main() { int n; while (std::cin >> n) { int ans = 0; std::vector<int> vec(n); for (int i = 0; i < n; i++) vec[i] = 1; vec[0] = vec[1] = 0; for (int i = 2; i < n; i++) { if (vec[i] == 1) { ans++; for (int j = 2 * i; j < n; j +=...
#include <iostream> #include <vector> int main() { int n; while (std::cin >> n) { int ans = 0; std::vector<int> vec(n + 1); for (int i = 0; i <= n; i++) vec[i] = 1; vec[0] = vec[1] = 0; for (int i = 2; i <= n; i++) { if (vec[i] == 1) { ans++; for (int j = 2 * i; j <= ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 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]]
1
141
8
#include <stdio.h> #include <string.h> int main(void) { int n = 99, a, b, c; char x[1000000]; memset(x, 0, sizeof(x)); for (a = 2, c = 0; a <= n; a++) { if (x[a]) { x[a] = c; continue; } x[a] = ++c; for (b = a * 2; b <= n; b += a) x[b] = -1; } while (~scanf("%d", &n)) { ...
#include <stdio.h> #include <string.h> int main(void) { int n = 999999, a, b, c; int x[1000000]; memset(x, 0, sizeof(x)); for (a = 2, c = 0; a <= n; a++) { if (x[a]) { x[a] = c; continue; } x[a] = ++c; for (b = a * 2; b <= n; b += a) x[b] = -1; } while (~scanf("%d", &n)) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
139
4
#include <cstdio> int d[1000000], c[1000000]; int main() { int i, j, r = 0, n; for (i = 2; i < 500000; i++) { if (d[i]) { c[i] = r; continue; } c[i] = ++r; for (j = i * 2; j <= 999999; j += i) d[j] = 1; } while (scanf("%d", &n) != EOF) { printf("%d\n", d[n]); } }
#include <cstdio> int d[1000000], c[1000000]; int main() { int i, j, r = 0, n; for (i = 2; i <= 999999; i++) { if (d[i]) { c[i] = r; continue; } c[i] = ++r; for (j = i * 2; j <= 999999; j += i) d[j] = 1; } while (scanf("%d", &n) != EOF) { printf("%d\n", c[n]); } }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22]]
1
123
6
#include <iostream> using namespace std; int main() { int prime[999999]; bool is_prime[1000000]; int p = 0; int n; int i; while (cin >> n) { for (i = 0; i <= n; i++) is_prime[i] = true; is_prime[0] = is_prime[1] = false; for (i = 2; i <= n; i++) { if (is_prime[i]) { prime[p+...
#include <iostream> using namespace std; int main() { int prime[999999]; bool is_prime[1000000]; int p = 0; int n; int i; while (cin >> n) { for (i = 0; i <= n; i++) is_prime[i] = true; is_prime[0] = is_prime[1] = false; for (i = 2; i <= n; i++) { if (is_prime[i]) { prime[p+...
[["+", 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]]
1
140
4
#include <math.h> #include <stdio.h> #define DB(x) (x) int prime[80000]; int GetPrime(int num); int main() { int count = GetPrime(1000000); DB(printf("%d\n", count)); int n, ans[100], cor = 0; int i; while (scanf("%d", &n) != EOF) { for (i = 0; n >= prime[i] && i < count; i++) ; ans[cor] = i; ...
#include <math.h> #include <stdio.h> #define DB(x) int prime[80000]; int GetPrime(int num); int main() { int count = GetPrime(1000000); DB(printf("%d\n", count)); int n, ans[100], cor = 0; int i; while (scanf("%d", &n) != EOF) { for (i = 0; n >= prime[i] && i < count; i++) ; ans[cor] = i; c...
[["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59]]
1
247
1
#include <iostream> #include <math.h> using namespace std; int main() { int b[1000000]; for (int k = 0; k < 1000001; k++) { b[k] = 0; } b[2] = 1; b[3] = 1; b[4] = 0; b[5] = 1; b[6] = 0; b[7] = 1; for (int p = 11; p < 1000001; p += 2) { int i, a = 0; i = 3; while (i < sqrt(p)) { ...
#include <iostream> #include <math.h> using namespace std; int main() { int b[1000000]; for (int k = 0; k < 1000001; k++) { b[k] = 0; } b[2] = 1; b[3] = 1; b[4] = 0; b[5] = 1; b[6] = 0; b[7] = 1; for (int p = 11; p < 1000001; p += 2) { int i, a = 0; i = 3; while (i <= sqrt(p)) { ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
228
4
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Map<String, I...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Map<String, I...
[["+", 0, 52, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 0, 52, 8, 196, 0, 57, 64, 196, 0, 46]]
3
267
4
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { int n = sc.nextInt(); int c = 0; boolean[] p = new boolean[n + 1]; for (int i = 0; i <= n; i++) { p[i] = true; } in...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { int n = sc.nextInt(); int c = 0; boolean[] p = new boolean[n + 1]; for (int i = 0; i <= n; i++) { p[i] = true; } in...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19]]
3
198
2
import java.util.*; class Main { public static void main(String[] z) { int i = 0, e = 2, c; int[] p = new int[175]; for (; i < 175; p[i++] = e++) for (; f(p, e) < 1; e++) ; for (Scanner s = new Scanner(System.in); s.hasNext(); System.out.println(c)) { e = s.nextInt(); ...
import java.util.*; class Main { public static void main(String[] z) { int i = 0, e = 2, c; int[] p = new int[175]; for (; i < 175; p[i++] = e++) for (; f(p, e) < 1; e++) ; for (Scanner s = new Scanner(System.in); s.hasNext(); System.out.println(c)) { e = s.nextInt(); ...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19]]
3
189
2
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static int n; static boolean[] prime; public static void main(String[] args) { makePrime(); while (read()) { solve(); } } static boolean read() { if (!sc.hasNext()) return false; n = sc.nextI...
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static int n; static boolean[] prime; public static void main(String[] args) { makePrime(); while (read()) { solve(); } } static boolean read() { if (!sc.hasNext()) return false; n = sc.nextI...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
234
2
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int[] prime = new int[999999]; prime[0] = 2; int num = 1; while (s.hasNext()) { int n = s.nextInt(); if (prime[num - 1] > n) { int out = 0; for (int i =...
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int[] prime = new int[999999]; prime[0] = 2; int num = 1; while (s.hasNext()) { int n = s.nextInt(); if (prime[num - 1] > n) { int out = 0; for (int i =...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19]]
3
232
2
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static boolean[] prime_number; static int max; public static void main(String[] args) { eratosu(999999); while (read()) { solve(); } } public static void eratosu(int max_int) { prime_number = new ...
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static boolean[] prime_number; static int max; public static void main(String[] args) { eratosu(999999); while (read()) { solve(); } } public static void eratosu(int max_int) { prime_number = new ...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
249
2
import java.util.Scanner; public class Main { static boolean[] primes; static void primeSet(final int MAX) { primes = new boolean[MAX + 1]; primes[2] = true; for (int i = 3; i <= MAX; i += 2) { primes[i] = true; } int rt = (int)Math.sqrt(MAX); for (int i = 3; i <= rt; i += 2) { ...
import java.util.Scanner; public class Main { static boolean[] primes; static void primeSet(final int MAX) { primes = new boolean[MAX + 1]; primes[2] = true; for (int i = 3; i <= MAX; i += 2) { primes[i] = true; } int rt = (int)Math.sqrt(MAX); for (int i = 3; i <= rt; i += 2) { ...
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
3
244
2
import java.io.*; import java.util.*; public class Main { public static void main(String... args) { Main m = new Main(); m.start(); m.close(); } private Scanner sc; private PrintWriter pw; public Main() { sc = new Scanner(System.in); pw = new PrintWriter(System.out); } private void ...
import java.io.*; import java.util.*; public class Main { public static void main(String... args) { Main m = new Main(); m.start(); m.close(); } private Scanner sc; private PrintWriter pw; public Main() { sc = new Scanner(System.in); pw = new PrintWriter(System.out); } private void ...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
315
2
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); boolean[] flag = new boolean[1000000]; for (int i = 2; i * i <= 1000000; i++) { if (!flag[i]) { for (int j = i * 2; j <= 1000000; j += i) { ...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); boolean[] flag = new boolean[1000001]; for (int i = 2; i * i <= 1000000; i++) { if (!flag[i]) { for (int j = i * 2; j <= 1000000; j += i) { ...
[["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499]]
3
167
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] a) { String str; BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); try { while (null != (str = bf.readLine())) { int n...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] a) { String str; BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); try { while (null != (str = bf.readLine())) { int n...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 47], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 20]]
3
284
2
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNextInt()) { int n = input.nextInt(); int count = 1; if (n < 2) { System.out.println("0"); } else { for (int i = 3; i <= n; i ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNextInt()) { int n = input.nextInt(); int count = 1; if (n < 2) { System.out.println("0"); } else { for (int i = 3; i <= n; i ...
[["-", 0, 52, 8, 196, 0, 57, 75, 196, 0, 46], ["+", 0, 52, 8, 196, 0, 57, 75, 196, 0, 46]]
3
157
2
import java.util.*; public class Main { public static void main(String[] args) { final int MAX = 999999; Scanner sc = new Scanner(System.in); boolean[] prime = primeList(MAX); while (sc.hasNextInt()) { int n = sc.nextInt(); int cnt = 0; for (int i = 0; i < n; i++) { if (prime...
import java.util.*; public class Main { public static void main(String[] args) { final int MAX = 999999; Scanner sc = new Scanner(System.in); boolean[] prime = primeList(MAX); while (sc.hasNextInt()) { int n = sc.nextInt(); int cnt = 0; for (int i = 0; i <= n; i++) { if (prim...
[["-", 0, 52, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 8, 196, 0, 7, 15, 16, 12, 509, 500, 22], ["-", 8, 196, 0, 7, 15, 16, 12, 509, 0, 131], ["-", 8, 196, 0, 7, 15, 16, 12, 509, 119, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22]]
3
269
6
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int n = scanner.nextInt(); int result = 0; boolean[] prime = new boolean[n + 1]; for (int i = 2; i < n + 1; i++) { prime[i] ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int n = scanner.nextInt(); int result = 0; boolean[] prime = new boolean[n + 1]; for (int i = 2; i < n + 1; i++) { prime[i] ...
[["-", 64, 196, 0, 7, 15, 16, 12, 492, 500, 22], ["-", 64, 196, 0, 7, 15, 16, 12, 492, 0, 131], ["-", 64, 196, 0, 7, 15, 16, 12, 492, 141, 22], ["-", 0, 7, 15, 16, 12, 492, 3, 4, 0, 24], ["-", 0, 7, 15, 16, 12, 492, 3, 4, 0, 25]]
3
169
5
import java.util.*; public class Main { /** * @param args */ public static Scanner sc = new Scanner(System.in); void run() { int n, ans; boolean[] sieve; while (sc.hasNextInt()) { n = sc.nextInt(); ans = 0; sieve = new boolean[n + 1]; if (n <= 1) System.out.pri...
import java.util.*; public class Main { /** * @param args */ public static Scanner sc = new Scanner(System.in); void run() { int n, ans; boolean[] sieve; while (sc.hasNextInt()) { n = sc.nextInt(); ans = 0; sieve = new boolean[n + 1]; if (n <= 1) System.out.pri...
[["-", 0, 57, 64, 1, 0, 492, 3, 4, 0, 499], ["+", 0, 57, 64, 1, 0, 492, 3, 4, 0, 499]]
3
177
2
import java.io.*; public class Main { public static void main(String[] args) throws IOException { int[] prime = new int[1000000]; for (int i = 2; i <= 500000; i++) { for (int j = 2; i * j <= 1000000; j++) { prime[i * j] = 1; } } BufferedReader buf = new BufferedReader(new InputStre...
import java.io.*; public class Main { public static void main(String[] args) throws IOException { int[] prime = new int[1000005]; for (int i = 2; i <= 500000; i++) { for (int j = 2; i * j <= 1000000; j++) { prime[i * j] = 1; } } BufferedReader buf = new BufferedReader(new InputStre...
[["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499]]
3
170
2
import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int MAX = 1000000; int[] prime = new int[MAX]; prime[0] = prime[1] = 0; for (int i = 2; i < MAX; i++) { prime[i] = 1; } for (in...
import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int MAX = 1000000; int[] prime = new int[MAX]; prime[0] = prime[1] = 0; for (int i = 2; i < MAX; i++) { prime[i] = 1; } for (in...
[["-", 0, 52, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 17, 19]]
3
207
2
import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { int n = scan.nextInt(); boolean[] isPrime = new boolean[n + 1]; for (int i = 2; i <= n; i++) { isPrime[i]...
import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { int n = scan.nextInt(); boolean[] isPrime = new boolean[n + 1]; for (int i = 2; i <= n; i++) { isPrime[i]...
[["-", 8, 196, 0, 1, 0, 11, 31, 504, 71, 22], ["+", 8, 196, 0, 1, 0, 11, 31, 504, 71, 22]]
3
189
2
#include <math.h> #include <stdbool.h> #include <stdio.h> static int count = 1; static int prime[500000] = {2, 3}; static bool primebool[500000] = {true, true}; int primesearch(int); void primecount(int, int); void reset(); int main() { int n; while (scanf("%d", &n) != EOF) { if (n > 1) { primecount(0,...
#include <math.h> #include <stdbool.h> #include <stdio.h> static int count = 0; static int prime[500000] = {2, 3}; static bool primebool[500000] = {true, true}; int primesearch(int); void primecount(int, int); void reset(); int main() { int n; while (scanf("%d", &n) != EOF) { if (n > 1) { primecount(0...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
0
265
4
#include <math.h> #include <stdio.h> int main(int argc, const char *argv[]) { int n, i, j, k; int count; //素数の個数 int l[100000]; //素数の数を格納 while (scanf("%d", &n) != EOF) { count = 0; //偶数で素数を持つのは2のみ if (n >= 2) { l[count++] = 2; // printf("l[%d] = %d\n",count - 1,l[count - 1]);// ...
#include <math.h> #include <stdio.h> int main(int argc, const char *argv[]) { int n, i, j, k; int count; //素数の個数 int l[100000]; //素数の数を格納 while (scanf("%d", &n) != EOF) { count = 0; //偶数で素数を持つのは2のみ if (n >= 2) { l[count++] = 2; // printf("l[%d] = %d\n",count - 1,l[count - 1]);// ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
188
2
#include <stdio.h> int main(void) { long prm[78498] = {2, 3}, n, m, cnt = 2; int judge; for (n = 5; n <= 999999; n += 2) { judge = 1; for (m = 0; prm[m] * prm[m] <= n; m++) { if (!n % prm[m]) { judge = 0; break; } } if (judge) { prm[cnt++] = n; } } while ...
#include <stdio.h> int main(void) { long prm[78498] = {2, 3}, n, m, cnt = 2; int judge; for (n = 5; n <= 999999; n += 2) { judge = 1; for (m = 0; prm[m] * prm[m] <= n; m++) { if (n % prm[m] == 0) { judge = 0; break; } } if (judge) { prm[cnt++] = n; } } wh...
[["-", 0, 57, 15, 23, 0, 16, 31, 91, 17, 111], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46]]
0
152
10
#include <stdio.h> #define SIEVE_SIZE (1000000) int not_p[SIEVE_SIZE] = {1, 1}; int prime_count[SIEVE_SIZE]; // [n] -> [0, n] int main() { int i, j; int n; for (i = 2; i * i < SIEVE_SIZE; i++) { if (not_p[i]) continue; for (j = i * i; j < SIEVE_SIZE; j += i) { not_p[i] = 1; } } for...
#include <stdio.h> #define SIEVE_SIZE (1000000) int not_p[SIEVE_SIZE] = {1, 1}; int prime_count[SIEVE_SIZE]; // [n] -> [0, n] int main() { int i, j; int n; for (i = 2; i * i < SIEVE_SIZE; i++) { if (not_p[i]) continue; for (j = i * i; j < SIEVE_SIZE; j += i) { not_p[j] = 1; } } for...
[["-", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22]]
0
156
2
#include <stdio.h> int p[1000000]; int main(void) { int n; int i, j; p[0] = p[1] = 0; for (i = 2; i < 1000000; i++) { p[i] = 1; } for (i = 2; i * i < 1000000; i++) { for (j = i * i; j < 1000000; j++) { p[j] = 0; } } for (i = 1; i < 1000000; i++) { p[i] += p[i - 1]; } whil...
#include <stdio.h> int p[1000000]; int main(void) { int n; int i, j; p[0] = p[1] = 0; for (i = 2; i < 1000000; i++) { p[i] = 1; } for (i = 2; i * i < 1000000; i++) { for (j = i * i; j < 1000000; j += i) { p[j] = 0; } } for (i = 1; i < 1000000; i++) { p[i] += p[i - 1]; } w...
[["-", 0, 7, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 7, 26, 11, 12, 22]]
0
159
3
#include <stdio.h> int main(void) { int i, j, n, count; while (scanf("%d", &n) != EOF) { int num[1000000] = {0}; for (i = 2; i <= n / 2; i++) { for (j = 2; j * i < n; j++) { num[i * j]++; } } for (i = 2; i <= n; i++) { if (num[i] == 0) count++; } printf("%d\...
#include <stdio.h> int main(void) { int i, j, n, count; while (scanf("%d", &n) != EOF) { count = 0; int num[1000000] = {0}; for (i = 2; i <= n / 2; i++) { for (j = 2; j * i <= n; j++) { num[i * j]++; } } for (i = 2; i <= n; i++) { if (num[i] == 0) count++; }...
[["+", 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, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
0
128
6
#include <stdio.h> #define N 1000000 int main() { static int prime[N]; int i = 0, j = 0, k = 0, limit; for (i = 2; i < N; i++) { prime[i] = 1; } prime[0] = prime[1] = 0; for (i = 2; i < N; i++) { if (prime[i] == 1) { for (j = i + i; j < N; j += i) { prime[j] = 0; } } }...
#include <stdio.h> #define N 1000000 int main() { static int prime[N]; int i = 0, j = 0, k = 0, limit; for (i = 2; i < N; i++) { prime[i] = 1; } prime[0] = prime[1] = 0; for (i = 2; i < N; i++) { if (prime[i] == 1) { for (j = i + i; j < N; j += i) { prime[j] = 0; } } }...
[["+", 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
176
4
#include <stdio.h> int memo[1000001] = {0}; int main() { int n; int i, j, k; int sum; for (i = 2; i <= 1000001; i++) { if (memo[i] == 1) continue; for (k = i * 23; k <= 1000001; k += i) memo[k] = 1; } while (scanf("%d", &n) != EOF) { sum = 0; for (i = 2; i <= n; i++) { if (...
#include <stdio.h> int memo[1000001] = {0}; int main() { int n; int i, j, k; int sum; for (i = 2; i <= 1000001; i++) { if (memo[i] == 1) continue; for (k = i * 2; k <= 1000001; k += i) memo[k] = 1; } while (scanf("%d", &n) != EOF) { sum = 0; for (i = 2; i <= n; i++) { if (m...
[["-", 8, 9, 0, 7, 10, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 10, 11, 12, 16, 12, 13]]
0
144
2
#include <math.h> #include <stdio.h> int prime(int x); int main(void) { int num[30], c[30], data[30]; int index = 0; int i; while (scanf("%d", &num[index]) != EOF) { if ((1 <= num[index]) && (num[index] <= 999999)) index++; if (index == 30) break; } for (i = 0; i < index; i++) { ...
#include <math.h> #include <stdio.h> int prime(int x); int main(void) { int num[30], c[30], data[30]; int index = 0; int i; while (scanf("%d", &num[index]) != EOF) { if ((1 <= num[index]) && (num[index] <= 999999)) index++; if (index == 30) break; } for (i = 0; i < index; i++) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["-", 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, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, ...
0
253
10
#include <stdio.h> int main() { int i, j, ch[1000000]; for (i = 0; i < 1000000; i += 2) { ch[i] = 0; ch[i + 1] = 1; } ch[1] = 0; ch[2] = 1; for (i = 3; i < 1000; i += 2) if (ch[i]) for (j = i + i; j < 1000000; j += i) ch[j] = 0; for (i = 3; i < 1000000; i++) ch[i] = ch[i ...
#include <stdio.h> int main() { int i, j, ch[1000000]; for (i = 0; i < 1000000; i += 2) { ch[i] = 0; ch[i + 1] = 1; } ch[1] = 0; ch[2] = 1; for (i = 3; i < 1000; i += 2) if (ch[i]) for (j = i + i; j < 1000000; j += i) ch[j] = 0; for (i = 3; i < 1000000; i++) ch[i] += ch[i...
[["-", 8, 9, 0, 7, 8, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 7, 8, 1, 0, 11, 17, 107]]
0
163
26
#include <stdio.h> #define N 1000000 int calcPrime(int); int main() { int prime_num[N], i, num; for (i = 0; i < N; i++) prime_num[i] = 0; for (i = 0; i < N; i++) { if (calcPrime(i)) prime_num[i] = prime_num[i - 1] + 1; else prime_num[i] = prime_num[i - 1]; } while (scanf("%d", &...
#include <stdio.h> #define N 1000000 int calcPrime(int); int main() { int prime_num[N], i, num; for (i = 0; i < N; i++) prime_num[i] = 0; for (i = 0; i < N; i++) { if (calcPrime(i)) prime_num[i] = prime_num[i - 1] + 1; else prime_num[i] = prime_num[i - 1]; } while (scanf("%d", &...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
203
1
#include <stdio.h> #define MAX 1000000 int total[MAX]; int main(void) { int i, n, cnt; total[0] = total[1] = 0; for (i = 2; i < MAX; i++) total[i] = 1; for (i = 2; i * i < MAX; i++) { if (total[i] == 1) { for (n = i; n < MAX; n += i) { total[n] = 0; } } } while (scanf("%d...
#include <stdio.h> #define MAX 1000000 int total[MAX]; int main(void) { int i, n, cnt; total[0] = total[1] = 0; for (i = 2; i < MAX; i++) total[i] = 1; for (i = 2; i * i < MAX; i++) { if (total[i] == 1) { for (n = i * 2; n < MAX; n += i) { total[n] = 0; } } } while (scanf...
[["+", 64, 9, 0, 7, 10, 11, 12, 16, 17, 48], ["+", 64, 9, 0, 7, 10, 11, 12, 16, 12, 13]]
0
163
2
#include <math.h> #include <stdio.h> #define MAX 999999 int Primes[MAX + 1]; int IsPrime(int n) { if (n < 2) { return 0; } else if (n == 2) { return 1; } else if (n % 2 == 0) { return 0; } else { int i = 3; for (; i < sqrt(n); i += 2) { if (n % i == 0) { return 0; ...
#include <math.h> #include <stdio.h> #define MAX 999999 int Primes[MAX + 1]; int IsPrime(int n) { if (n < 2) { return 0; } else if (n == 2) { return 1; } else if (n % 2 == 0) { return 0; } else { int i = 3; for (; i <= sqrt(n); i += 2) { if (n % i == 0) { return 0; ...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19]]
0
177
2
#include <stdio.h> unsigned long long int N = 1000000; int main(void) { int i, j, n; int pn[N]; for (i = 3; i < N; i += 2) { pn[i] = -1; } pn[0] = pn[1] = -1; pn[2] = 1; for (i = 3; i < N; i += 2) { if (pn[i] == -1) { pn[i] = 1; for (j = i * 2; j < N; j += i) { pn[j] = 0; ...
#include <stdio.h> unsigned long long int N = 1000000; int main(void) { int i, j, n; int pn[N]; for (i = 3; i < N; i += 2) { pn[i] = -1; } pn[0] = pn[1] = 0; pn[2] = 1; for (i = 3; i < N; i += 2) { if (pn[i] == -1) { pn[i] = 1; for (j = i * 2; j < N; j += i) { pn[j] = 0; ...
[["-", 8, 9, 0, 1, 0, 11, 12, 11, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 12, 13]]
0
192
2
x=[0]*37 for a in range(10): for b in range(10): for c in range(10): for d in range(10): x[a+b+c+d]+=1 while True: try: print(x[int(input())]) except: break
x=[0]*51 for a in range(10): for b in range(10): for c in range(10): for d in range(10): x[a+b+c+d]+=1 while True: try: print(x[int(input())]) except: break
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
71
2
# -*- coding: utf-8 -*- while(True): try: n = int(input()) sum = 0 for a in range(10): for b in range(10): for c in range(10): for d in range(10): if (a + b + c + d == n): sum += 0 pr...
# -*- coding: utf-8 -*- while(True): try: n = int(input()) sum = 0 for a in range(10): for b in range(10): for c in range(10): for d in range(10): if (a + b + c + d == n): sum += 1 pr...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612]]
5
75
2
def get_input(): while True: try: yield ''.join(input()) except EOFError: break ar = [0] * 50 for i in range(10): for j in range(10): for k in range(10): for l in range(10): ar[i + j + k + l] += 1 for a in list(get_input()): print(ar[int(a)])
def get_input(): while True: try: yield ''.join(input()) except EOFError: break ar = [0] * 51 for i in range(10): for j in range(10): for k in range(10): for l in range(10): ar[i + j + k + l] += 1 for a in list(get_input()): print(ar[int(a)])
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
95
2
import sys s=[0]*51 for a in range(10): for b in range(10): for c in range(10): for d in range(10): s[a+b+c+d]+=1 for l in sys.stdin:print(x[int(l)])
import sys s=[0]*51 for a in range(10): for b in range(10): for c in range(10): for d in range(10): s[a+b+c+d]+=1 for l in sys.stdin:print(s[int(l)])
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22]]
5
70
2
import itertools s=list(range(0,10)) chk=list(itertools.product(s,repeat=4)) for j in sys.stdin: ans=0 for k in chk: if sum(k)==int(j): ans+=1 print(ans)
import itertools import sys s=list(range(0,10)) chk=list(itertools.product(s,repeat=4)) for j in sys.stdin: ans=0 for k in chk: if sum(k)==int(j): ans+=1 print(ans)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
61
2
from itertools import product while True: try: n = int(input) except: break count = sum(a + b + c + d == n for a, b, c, d in product(range(10), repeat=4)) print(count)
from itertools import product while True: try: n = int(input()) except: break count = sum(a + b + c + d == n for a, b, c, d in product(range(10), repeat=4)) print(count)
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
56
2
import sys for n in sys.stdin.readline(): ret = 0 for a in range(10): for b in range(10): for c in range(10): for d in range(10): if a+b+c+d == int(n): ret += 1 print(ret)
import sys for n in sys.stdin: ret = 0 for a in range(10): for b in range(10): for c in range(10): for d in range(10): if a+b+c+d == int(n): ret += 1 print(ret)
[["-", 0, 656, 0, 7, 12, 652, 63, 319, 0, 131], ["-", 0, 656, 0, 7, 12, 652, 63, 319, 319, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25]]
5
69
4
import itertools def combination(n): c=0 for i in itertools.product(range(10),repeat=4): (a,b,c,d)=i if a+b+c+d==n: c+=1 return c while True: try: n=int(input()) combination(n) except EOFError: break
import itertools def combination(n): m=0 for i in itertools.product(range(10),repeat=4): (a,b,c,d)=i if a+b+c+d==n: m+=1 return m while True: try: n=int(input()) print(combination(n)) except EOFError: break
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 656, 0, 14, 8, 196, 0, 37, 0, 22], ["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 22], ["+", 0, 246, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8,...
5
76
9
import sys for line in sys.stdin: N = int(input()) ans = 0 for a in range(10): for b in range(10): for c in range(10): for d in range(10): if a+b+c+d == N: ans += 1 print(ans)
import sys for line in sys.stdin: N = int(line) ans = 0 for a in range(10): for b in range(10): for c in range(10): for d in range(10): if a+b+c+d == N: ans += 1 print(ans)
[["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
70
4
INF=-1 memo=[[INF]*51 for i in range(5)] def rec(i,n): if memo[i][n]!=INF: return memo[i][n] if i==4: return 1 if n==0 else 0 for m in range(10): memo[i][n]+=rec(i+1,n-m) return memo[i][n] while True: try: n=int(input()) print(rec(0,n)) except: bre...
memo=[[0]*51 for i in range(5)] def rec(i,n): if memo[i][n]!=0: return memo[i][n] if i==4: return 1 if n==0 else 0 for m in range(10): memo[i][n]+=rec(i+1,n-m) return memo[i][n] while True: try: n=int(input()) print(rec(0,n)) except: break
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612], ["-", 0, 662, 12, 658, 8, 657, 31, 634, 0, 22], ["+", 0, 662, 12, 658, 8, 657, 31, 634, 0, 612], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, ...
5
119
8
import sys values = [] for line in sys.stdin: values.append(int(line)) ans = [1 for i in range(10) for j in range(10) for k in range(10) for l in range(10) if n == i + j + k + l] print(ans.count(1))
import sys values = [] for line in sys.stdin: values.append(int(line)) for v in values: ans = [1 for i in range(10) for j in range(10) for k in range(10) for l in range(10) if v == i + j + k + l] print(ans.count(1))
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 662, 12, 658, 0, 678, 0, 666, 0, 22], ["+", 0, 662, 12, 658, 0, 678, 0, 666, 0, 22]]
5
74
7
ans=[0]*51 for a in range(10): for b in range(10): for c in range(10): for d in range(10): ans[sum([a,b,c,d])] += 1 while True: try:print(sum[int(imput())]) except:break
ans=[0]*51 for a in range(10): for b in range(10): for c in range(10): for d in range(10): ans[sum([a,b,c,d])] += 1 while True: try:print(ans[int(input())]) except:break
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 0, 206, 206, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 206, 206, 652, 3, 4, 0, 652, 63, 22]]
5
76
4
lst=[0 for i in range(50)] for a in range(10): for b in range(10): for c in range(10): for d in range(10): lst[a+b+c+d] += 1 while 1: try: print(lst[int(input())]) except: break
lst=[0 for i in range(51)] for a in range(10): for b in range(10): for c in range(10): for d in range(10): lst[a+b+c+d] += 1 while 1: try: print(lst[int(input())]) except: break
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
76
2
while True: try: n = int(input()) count = 0 for i in range(10): for j in range(10): for k in range(10): for l in range(10): i+j+k+l == n count += 1 print(count) except: break
while True: try: n = int(input()) count = 0 for i in range(10): for j in range(10): for k in range(10): for l in range(10): if i+j+k+l == n: count += 1 print(count) except: ...
[["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 102]]
5
67
2
import sys for n in sys.stdin: print(len([None for a in range(10) for b in range(10) for c in range(10) for d in range(10) if a+b+c+d == N]))
import sys for n in sys.stdin: print(len([None for a in range(10) for b in range(10) for c in range(10) for d in range(10) if a+b+c+d == int(n)]))
[["-", 3, 4, 0, 658, 0, 678, 0, 666, 0, 22], ["+", 0, 658, 0, 678, 0, 666, 0, 652, 63, 22], ["+", 0, 678, 0, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 678, 0, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 678, 0, 666, 0, 652, 3, 4, 0, 25]]
5
56
5
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)); String line = ""; boolean[] ns = new boolean[1000000]; ...
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)); String line = ""; boolean[] ns = new boolean[1000000]; ...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499]]
3
216
2
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { int n = sc.nextInt(); int a = 0; int b[] = new int[n + 1]; if (n < 2) { System.out.println("0"); } else { for (int i = ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { int n = sc.nextInt(); int a = 0; int b[] = new int[n + 1]; if (n < 2) { System.out.println("0"); } else { for (int i = ...
[["-", 0, 52, 8, 196, 0, 57, 75, 196, 0, 46], ["+", 0, 52, 8, 196, 0, 57, 75, 196, 0, 46]]
3
186
2
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = null; try { sc = new Scanner(System.in); while (sc.hasNextInt()) { int num = sc.nextInt(); int count = 0; boolean isPrime = true; if (num <= 1) { System.out.print...
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = null; try { sc = new Scanner(System.in); while (sc.hasNextInt()) { int num = sc.nextInt(); int count = 0; boolean isPrime = true; if (num <= 1) { System.out.print...
[["+", 75, 57, 75, 196, 0, 1, 0, 11, 31, 22], ["+", 75, 57, 75, 196, 0, 1, 0, 11, 17, 32], ["+", 75, 57, 75, 196, 0, 1, 0, 11, 12, 499], ["+", 75, 57, 75, 57, 75, 196, 0, 1, 0, 35], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19]]
3
226
6
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { int count = 0; int n = sc.nextInt(); boolean[] prime = new boolean[n + 1]; for (int i = 2; i <= n; i++) { prime[i] = true; } for...
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { int count = 0; int n = sc.nextInt(); boolean[] prime = new boolean[n + 1]; for (int i = 2; i <= n; i++) { prime[i] = true; } for...
[["-", 0, 57, 64, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 196, 0, 7, 15, 16, 17, 19]]
3
157
2
import java.util.HashMap; import java.util.Scanner; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); boolean[] isPrimes = new boolean[1000000]; for (int x = 2; x < 1000000 / 2 + 1; x++) { if (!isPrimes[x]) { for (int y = 2; y < 1000000 / x + 1; y++...
import java.util.HashMap; import java.util.Scanner; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); boolean[] isPrimes = new boolean[1000000]; for (int x = 2; x < 1000000 / 2 + 1; x++) { if (!isPrimes[x]) { for (int y = 2; y < 999999 / x + 1; y++)...
[["-", 0, 7, 15, 16, 12, 16, 31, 16, 31, 499], ["+", 0, 7, 15, 16, 12, 16, 31, 16, 31, 499]]
3
194
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String input; int primes = 0; int[] n = new int[1000000]; ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String input; int primes = 0; int[] n = new int[1000000]; ...
[["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 72], ["+", 0, 492, 3, 4, 0, 16, 12, 5, 0, 62], ["+", 0, 492, 3, 4, 0, 16, 12, 5, 0, 44]]
3
204
4
import java.io.*; import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { try { int n = Integer.parseInt(br.readLine()); int count = 0; boolean[] map = n...
import java.io.*; import java.util.*; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { try { int n = Integer.parseInt(br.readLine()); int count = 0; boolean[] map = n...
[["-", 0, 246, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 246, 8, 196, 0, 7, 15, 16, 17, 19]]
3
211
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { new Main(); } public Main() { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String x = ""; try { while ((x = in.r...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { new Main(); } public Main() { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String x = ""; try { while ((x = in.r...
[["-", 0, 52, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499]]
3
268
6
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { @SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int[] num = new int[100000...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { @SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int[] num = new int[100000...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["-", 0, 52, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 17, 19]]
3
261
4
import java.util.Scanner; public class Main { static Scanner sc = new java.util.Scanner(System.in); public static void main(String[] args) { while (sc.hasNext()) { int n = sc.nextInt(); int x = 0; for (int i = 3; i <= n; i = i + 2) { for (int j = 3; j < Math.sqrt(i); j = j + 2) {...
import java.util.Scanner; public class Main { static Scanner sc = new java.util.Scanner(System.in); public static void main(String[] args) { while (sc.hasNext()) { int n = sc.nextInt(); int x = 0; for (int i = 3; i <= n; i = i + 2) { for (int j = 3; j <= Math.sqrt(i); j = j + 2) ...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19]]
3
190
2
#include <complex> #include <stdio.h> using namespace std; typedef complex<double> point; #define X real() #define Y imag() typedef point vec; double cross(vec a, vec b) { return a.X * b.Y - b.X * a.Y; } double dis(point a, point b) { return abs(a - b); } point center(point A, point B, point C) // Circumcenter { ...
#include <complex> #include <stdio.h> using namespace std; typedef complex<double> point; #define X real() #define Y imag() typedef point vec; double cross(vec a, vec b) { return a.X * b.Y - b.X * a.Y; } double dis(point a, point b) { return abs(a - b); } point center(point A, point B, point C) // Circumcenter { ...
[["+", 0, 14, 8, 9, 0, 37, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 72]]
1
277
2
#include <cmath> #include <iostream> #include <sstream> #include <string> using namespace std; double fpx(double a, double b, double c, double d, double e, double f); double fpy(double a, double b, double c, double d, double e, double f); double fr(double a, double b, double c, double d); string toStr(double a); strin...
#include <cmath> #include <iostream> #include <sstream> #include <string> using namespace std; double fpx(double a, double b, double c, double d, double e, double f); double fpy(double a, double b, double c, double d, double e, double f); double fr(double a, double b, double c, double d); string toStr(double a); strin...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
647
2
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main(void) { int n; cin >> n; double x1, x2, x3, y1, y2, y3; for (int i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; double a = x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1; double b = x3 * x3 - x1 * x1 + y3 * y...
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main(void) { int n; cin >> n; double x1, x2, x3, y1, y2, y3; for (int i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; double a = x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1; double b = x3 * x3 - x1 * x1 + y3 * y...
[["-", 31, 23, 0, 16, 31, 16, 31, 16, 31, 13], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 31, 13], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 17, 33], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 72]]
1
237
4
#include <cmath> #include <cstdio> using namespace std; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { double x[3], y[3], s[3]; double l, m, n; for (int j = 0; j < 3; j++) { scanf("%lf %lf", &x[j], &y[j]); s[j] = x[j] * x[j] + y[j] * y[j]; } double x2[2], y...
#include <cmath> #include <cstdio> using namespace std; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { double x[3], y[3], s[3]; double l, m, n; for (int j = 0; j < 3; j++) { scanf("%lf %lf", &x[j], &y[j]); s[j] = x[j] * x[j] + y[j] * y[j]; } double x2[2], y...
[["-", 0, 11, 12, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 16, 12, 16, 12, 22]]
1
410
2
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string.h> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define RREP(i, n) for (int i = (n)...
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string.h> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define RREP(i, n) for (int i = (n)...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13]]
1
2,529
2
/*include*/ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <iomanip> #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--) #...
/*include*/ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <iomanip> #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--) #...
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
3,630
2
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; typedef pair<double, double> vec; vec operator+(vec v1, vec v2) { return make_pair(v1.first + v2.first, v1.second + v2.second); } vec operator-(vec v1, vec v2) { return make_pair(v1.first - v2.first, v1.second - v2.second); } vec oper...
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; typedef pair<double, double> vec; vec operator+(vec v1, vec v2) { return make_pair(v1.first + v2.first, v1.second + v2.second); } vec operator-(vec v1, vec v2) { return make_pair(v1.first - v2.first, v1.second - v2.second); } vec operat...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40]]
1
540
2
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n; double x1, y1, x2, y2, x3, y3; cin >> n; while (n > 0) { double px, py, r; double A, B, C, a, b, c; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; A = 2 * (x2 - x1); B = 2 * (y2 - y1); C = (pow(x...
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n; double x1, y1, x2, y2, x3, y3; cin >> n; while (n > 0) { double px, py, r; double A, B, C, a, b, c; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; A = 2 * (x2 - x1); B = 2 * (y2 - y1); C = (pow(x...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33]]
1
270
2
#include <iomanip> #include <iostream> #include <math.h> using namespace std; double length(double x1, double y1, double x2, double y2) { return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); } double round(double d) { if (d < 0) { d *= 1000; d -= 0.5; int i = d; d = i / 1000.0; } else { d *= 1000...
#include <iomanip> #include <iostream> #include <math.h> using namespace std; double length(double x1, double y1, double x2, double y2) { return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); } double round(double d) { if (d < 0) { d *= 1000; d -= 0.5; int i = d; d = i / 1000.0; } else { d *= 1000...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
441
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <vector> #define rep(i, j) FOR(i, 0, j) #define FOR(i, j, k) for (int i = j; i < k; ++i) #define SQ(i) ((i) * (i)) using namespace std; int main() { double x1, y1, x2, y2, x3, y3...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <vector> #define rep(i, j) FOR(i, 0, j) #define FOR(i, j, k) for (int i = j; i < k; ++i) #define SQ(i) ((i) * (i)) using namespace std; int main() { double x1, y1, x2, y2, x3, y3...
[["-", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22]]
1
297
2
#include <cmath> #include <cstdio> int n; double x[3], y[3]; struct data { double a, b, c; data(double aa, double bb, double cc) { a = aa; b = bb; c = cc; } }; struct data2 { double x, y, r; data2() {} data2(double xx, double yy, double rr) { x = xx; y = yy; r = rr; } }; data ma...
#include <cmath> #include <cstdio> int n; double x[3], y[3]; struct data { double a, b, c; data(double aa, double bb, double cc) { a = aa; b = bb; c = cc; } }; struct data2 { double x, y, r; data2() {} data2(double xx, double yy, double rr) { x = xx; y = yy; r = rr; } }; data ma...
[["+", 0, 1, 0, 11, 12, 16, 31, 91, 17, 33]]
1
553
1
#include <cmath> #include <cstdio> #include <iostream> #include <utility> // ax + by = e1 // cx + dy = e2 auto solve(double a, double b, double c, double d, double e1, double e2) -> std::pair<double, double> { auto delta = a * d - b * c; auto x = (d * e1 - b * e2) / delta; auto y = (a * e2 - c * e1) / delta;...
#include <cmath> #include <cstdio> #include <iostream> #include <utility> // ax + by = e1 // cx + dy = e2 auto solve(double a, double b, double c, double d, double e1, double e2) -> std::pair<double, double> { auto delta = a * d - b * c; auto x = (d * e1 - b * e2) / delta; auto y = (a * e2 - c * e1) / delta;...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
431
4
#include <algorithm> #include <complex> #include <cstdio> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define pb push_back #define A...
#include <algorithm> #include <complex> #include <cstdio> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define pb push_back #define A...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
319
2
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main() { int datasetnum; double x1, y1, x2, y2, x3, y3; cin >> datasetnum; for (int loopcount = 0; loopcount < datasetnum; loopcount++) { double px, py, r; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; double len_1 = s...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main() { int datasetnum; double x1, y1, x2, y2, x3, y3; cin >> datasetnum; for (int loopcount = 0; loopcount < datasetnum; loopcount++) { double px, py, r; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; double len_1 = s...
[["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
375
4
#include <math.h> #include <stdio.h> int main() { int i, n; double x1, x2, x3, y1, y2, y3; double a, b, c, d, e, f; double X1, Y1, r; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); a = 2 * (x2 - x1); b = 2 * (y2 - y1); c = x1 * x1...
#include <math.h> #include <stdio.h> int main() { int i, n; double x1, x2, x3, y1, y2, y3; double a, b, c, d, e, f; double X1, Y1, r; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3); a = 2 * (x2 - x1); b = 2 * (y2 - y1); c = x1 * x1...
[["-", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22]]
1
273
2
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { double x1, x2, x3, y1, y2, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; double a1 = 2 * (x2 - x1); double b1 = 2 * (y2 - y1); double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; double a2 = 2 * (x3...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { double x1, x2, x3, y1, y2, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; double a1 = 2 * (x2 - x1); double b1 = 2 * (y2 - y1); double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; double a2 = 2 * (x3...
[["-", 49, 50, 51, 16, 12, 23, 0, 16, 31, 22], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 31, 22], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 12, 22], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 12, 22]]
1
209
4
#include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <utility> #include <vector> using namespace std; typedef complex<double> Point; #define X real() #define Y imag() #define EPS 10e-8 namespace std { bool operator<(Point a, Point b) { if (a.X != b.X) return a.X < b.X; return a.Y ...
#include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <utility> #include <vector> using namespace std; typedef complex<double> Point; #define X real() #define Y imag() #define EPS 10e-8 namespace std { bool operator<(Point a, Point b) { if (a.X != b.X) return a.X < b.X; return a.Y ...
[["-", 8, 9, 0, 37, 0, 16, 31, 2, 63, 40], ["+", 8, 9, 0, 37, 0, 16, 31, 2, 63, 22], ["-", 0, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
535
4
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n; cin >> n; double x1, x2, x3, y1, y2, y3, x12, x13, y12, y13, xx12, yy12, xx13, yy13, x, y, r; for (int i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; x12 = x1 - x2; x13 = x1 - x3; ...
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n; cin >> n; double x1, x2, x3, y1, y2, y3, x12, x13, y12, y13, xx12, yy12, xx13, yy13, x, y, r; for (int i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; x12 = x1 - x2; x13 = x1 - x3; ...
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 22]]
1
266
2
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; using LL = long long; constexpr int MOD = 1000000000 + 7; //?¶???...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; using LL = long long; constexpr int MOD = 1000000000 + 7; //?¶???...
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
286
2
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main(void) { int n; double x1, x2, x3, y1, y2, y3; cin >> n; while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) { double a = 2 * (x1 - x2); double b = 2 * (y1 - y2); double c = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; d...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main(void) { int n; double x1, x2, x3, y1, y2, y3; cin >> n; while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) { double a = 2 * (x1 - x2); double b = 2 * (y1 - y2); double c = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; d...
[["-", 0, 1, 0, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 13]]
1
240
2
#include <math.h> #include <stdio.h> int main(void) { int i, n, j, k; double x1, y1, x2, y2, x3, y3; scanf("%d", &n); for (i = 0; i < n; ++i) { scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3); double xt1 = (x1 + x2) / 2, xt2 = (x3 + x2) / 2, yt1 = (y1 + y2) / 2, yt2 = (y3 + y2) / 2...
#include <math.h> #include <stdio.h> int main(void) { int i, n, j, k; double x1, y1, x2, y2, x3, y3; scanf("%d", &n); for (i = 0; i < n; ++i) { scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3); double xt1 = (x1 + x2) / 2, xt2 = (x3 + x2) / 2, yt1 = (y1 + y2) / 2, yt2 = (y3 + y2) / 2...
[["+", 0, 1, 0, 11, 12, 16, 31, 91, 17, 33], ["+", 0, 34, 31, 11, 12, 16, 31, 91, 17, 33], ["+", 0, 34, 12, 11, 12, 16, 31, 91, 17, 33]]
1
338
4
#include <cmath> #include <iostream> #include <stdio.h> using namespace std; int main() { int n = 0, p, q, r; double ax = 0, ay = 0, bx = 0, by = 0, cx = 0, cy = 0, S = 0, R = 0, a = 0, b = 0, c = 0, x = 0, y = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> ax >> ay >> bx >> by >> cx >> cy; ...
#include <cmath> #include <iostream> #include <stdio.h> using namespace std; int main() { int n = 0, p, q, r; double ax = 0, ay = 0, bx = 0, by = 0, cx = 0, cy = 0, S = 0, R = 0, a = 0, b = 0, c = 0, x = 0, y = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> ax >> ay >> bx >> by >> cx >> cy; ...
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 31, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
403
3
#include <cmath> #include <complex> #include <cstdio> #include <iostream> using namespace std; typedef complex<double> Point; bool eqv(double d1, double d2) { return abs(d1 - d2) < 1e-10; } double r_(double x) { if (abs(x) < 0.001) return 0; return x; } int main() { int N; cin >> N; while (N--) { ...
#include <cmath> #include <complex> #include <cstdio> #include <iostream> using namespace std; typedef complex<double> Point; bool eqv(double d1, double d2) { return abs(d1 - d2) < 1e-10; } double r_(double x) { if (abs(x) < 0.001) return 0; return x; } int main() { int N; cin >> N; while (N--) { ...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22]]
1
302
4
#include <math.h> #include <stdio.h> int main() { int a; scanf("%d", &a); while (a--) { double x1, y1, x2, y2, x3, y3; scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3); double a1 = 2 * (x2 - x1); double b1 = 2 * (y2 - y2); double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; double ...
#include <math.h> #include <stdio.h> int main() { int a; scanf("%d", &a); while (a--) { double x1, y1, x2, y2, x3, y3; scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3); double a1 = 2 * (x2 - x1); double b1 = 2 * (y2 - y1); double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; double ...
[["-", 49, 50, 51, 16, 12, 23, 0, 16, 12, 22], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 12, 22]]
1
224
2
#include <stdio.h> #define _USE_MATH_DEFINES #include <math.h> int main(void) { int n, i; float x1, x2, x3, y1, y2, y3, a1, a2, b1, b2, c1, c2, xp, yp, r; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3); a1 = 2 * (x2 - x1); b1 = 2 * (y2 - y1); ...
#include <stdio.h> #define _USE_MATH_DEFINES #include <math.h> int main(void) { int n, i, buf; float x1, x2, x3, y1, y2, y3, a1, a2, b1, b2, c1, c2, xp, yp, r; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3); a1 = 2 * (x2 - x1); b1 = 2 * (y2 - y1...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22]]
1
265
4
#include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> // require fabs #include <cstdio> // require scanf printf #include <cstdlib> // require abs exit atof atoi #include <cstring> // requir...
#include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> // require fabs #include <cstdio> // require scanf printf #include <cstdlib> // require abs exit atof atoi #include <cstring> // requir...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40]]
1
473
8
/* Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface. */ #include <cmath> #include <iomanip> #include <iostream> #include <vector> using namespace std; /* http://zo3k...
/* Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface. */ #include <cmath> #include <iomanip> #include <iostream> #include <vector> using namespace std; /* http://zo3k...
[["-", 0, 11, 12, 16, 31, 16, 31, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48]]
1
565
6
#include <math.h> #include <stdio.h> void solve(double x1, double x2, double x3, double y1, double y2, double y3) { double cx1 = (x1 + x2) / 2.0, cx2 = (x2 + x3) / 2.0; double cy1 = (y1 + y2) / 2.0, cy2 = (y2 + y3) / 2.0; double tx1 = y2 - y1, tx2 = y3 - y2; double ty1 = x2 - x1, ty2 = x3 - x2; double a = ty...
#include <math.h> #include <stdio.h> void solve(double x1, double x2, double x3, double y1, double y2, double y3) { double cx1 = (x1 + x2) / 2.0, cx2 = (x2 + x3) / 2.0; double cy1 = (y1 + y2) / 2.0, cy2 = (y2 + y3) / 2.0; double tx1 = y1 - y2, tx2 = y2 - y3; double ty1 = x2 - x1, ty2 = x3 - x2; double a = ty...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
313
8
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; struct vect { double x, y; }; int main() { vect a, b, c, p, l1, l2, M1, M2; double t1, r; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y; M1.x = (a.x + b.x) / 2; M1.y = (a....
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; struct vect { double x, y; }; int main() { vect a, b, c, p, l1, l2, M1, M2; double t1, r; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y; M1.x = (a.x + b.x) / 2; M1.y = (a....
[["-", 12, 16, 12, 23, 0, 16, 31, 118, 119, 120], ["+", 12, 16, 12, 23, 0, 16, 31, 118, 119, 120]]
1
360
2
#include <cstdio> #include <iostream> #define _USE_MATH_DEFINES #include <cmath> #include <map> #include <vector> using namespace std; #define INF 1e+10 #define EPS 1e-10 #define EQ(a, b) (abs(a - b) < EPS) //誤差を考慮して足し算 double add(double a, double b) { if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0; retur...
#include <cstdio> #include <iostream> #define _USE_MATH_DEFINES #include <cmath> #include <map> #include <vector> using namespace std; #define INF 1e+10 #define EPS 1e-10 #define EQ(a, b) (abs(a - b) < EPS) //誤差を考慮して足し算 double add(double a, double b) { if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0; retur...
[["-", 0, 91, 28, 23, 0, 16, 31, 118, 119, 120], ["+", 0, 91, 28, 23, 0, 16, 31, 118, 119, 120]]
1
1,288
4
#include <cmath> #include <iostream> using namespace std; int main() { int n; double x1, y1, x2, y2, x3, y3; double a1, b1, c1, a2, b2, c2; double x, y, r; cin >> n; while (n--) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; a1 = x2 - x1; b1 = y2 - x1; c1 = -a1 * (x1 + x2) * 0.5 - b1 * (y1 + y2...
#include <cmath> #include <iostream> using namespace std; int main() { int n; double x1, y1, x2, y2, x3, y3; double a1, b1, c1, a2, b2, c2; double x, y, r; cin >> n; while (n--) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; a1 = x2 - x1; b1 = y2 - y1; c1 = -a1 * (x1 + x2) * 0.5 - b1 * (y1 + y2...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
265
2
#include <cmath> #include <iomanip> #include <iostream> #define PI 3.1415 using namespace std; int main() { int n; double x1, y1, x2, y2, x3, y3; double la, lb, lc; double a, b, c; double r; double px, py; cin >> n; for (int i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; // ...
#include <cmath> #include <iomanip> #include <iostream> #define PI 3.14159265359 using namespace std; int main() { int n; double x1, y1, x2, y2, x3, y3; double la, lb, lc; double a, b, c; double r; double px, py; cin >> n; for (int i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
439
2
#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
391
2