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 <iostream>
using namespace std;
int main() {
int d;
while (cin >> d) {
int S = 0;
for (int i = 1; i < 600 / d; i++) {
S += d * d * i * i;
}
cout << S << endl;
}
} | #include <iostream>
using namespace std;
int main() {
int d;
while (cin >> d) {
int S = 0;
for (int i = 1; i * d < 600; i++) {
S += d * d * d * i * i;
}
cout << S << endl;
}
} | [["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22], ["+", 12, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["+", 12, 16, 31, 16, 31, 16, 31, 16, 17, 48]] | 1 | 62 | 6 |
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
int f(int x) { return x * x; }
int main() {
int d;
int D = 600;
cin >> d;
int s = 0;
for (int i = 1; i * d < D; i++)
s += f(i * d) * d;
cout << s << ... | #include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
int f(int x) { return x * x; }
int main() {
int d;
int D = 600;
while (cin >> d) {
int s = 0;
for (int i = 1; i * d < D; i++)
s += f(i * d) * d;
... | [["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]] | 1 | 87 | 6 |
#include <iostream>
using namespace std;
int main() {
long d;
while (cin >> d) {
long count;
for (int i = 0; i < 600; i += d) {
count += d * i * i;
}
cout << count << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
long d;
while (cin >> d) {
long count = 0;
for (int i = 0; i < 600; i += d) {
count += d * i * i;
}
cout << count << endl;
}
return 0;
} | [["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 60 | 2 |
#include <iostream>
using namespace std;
int main() {
double d;
while (cin >> d) {
double sum = 0;
for (int i = 1; i * d < 600; i++) {
sum = sum + d * (i * d) * (i * d);
}
cout << sum << endl;
}
} | #include <iostream>
using namespace std;
int main() {
double d;
while (cin >> d) {
int sum = 0;
for (int i = 0; i * d < 600; i++) {
sum = sum + d * (i * d) * (i * d);
}
cout << sum << endl;
}
} | [["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 70 | 4 |
/*#include<stdio.h>
#include <algorithm>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iostream>
#include<math.h>
#include<queue>
#include<stdlib.h>
#include<string>
#include<vector>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int ... | /*#include<stdio.h>
#include <algorithm>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iostream>
#include<math.h>
#include<queue>
#include<stdlib.h>
#include<string>
#include<vector>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int ... | [["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 373 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int d;
cin >> d;
int n = 600 / d;
int ans = 0;
for (int i = 1; i < n; i++) {
ans += d * (i * d * i * d);
}
cout << ans << endl;
} | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int d;
while (cin >> d) {
int n = 600 / d;
long ans = 0;
for (int i = 1; i < n; i++) {
ans += d * (i * d * i * d);
}
cout << ans << endl;
}
} | [["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 52, 8,... | 1 | 69 | 8 |
def f(x)
x * x
end
l = gets.chomp.to_i
a = 600
p = 0
sum = 0
while a > p
sum += l * f(p)
p += l
end
puts sum
| def f(x)
x * x
end
while l = gets
l = l.chomp.to_i
a = 600
p = 0
sum = 0
while a > p
sum += l * f(p)
p += l
end
puts sum
end
| [["+", 36, 36, 36, 36, 0, 493, 0, 89, 0, 89], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 8, 170, 0, 662, 12, 652, 486, 652, 486, 22], ["+", 36, 36, 0, 493, 0, 89, 8, 170, 0, 444]] | 4 | 43 | 5 |
#!/usr/local/bin/ruby
def f(x)
x * x
end
while line = gets
d = line.to_i
(0..(600 - 2 * d) / d).each do |_i|
a += d
sum += f(a)
end
ans = sum * d
puts ans.to_s
a = 0
ans = 0
sum = 0
end
| #!/usr/local/bin/ruby
a = 0
sum = 0
def f(x)
x * x
end
while line = gets
d = line.to_i
(0..(600 - 2 * d) / d).each do |_i|
a += d
sum += f(a)
end
ans = sum * d
puts ans.to_s
a = 0
ans = 0
sum = 0
end
| [["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612]] | 4 | 67 | 6 |
def square(n)
n * n
end
# main
arr = []
while n = gets
arr << n.to_i
end
p arr
arr.each do |d|
sum = 0
0.upto(600 / d - 1) do |i|
sum += square(i * d) * d
end
puts sum
end
| def square(n)
n * n
end
# main
arr = []
while n = gets
arr << n.to_i
end
arr.each do |d|
sum = 0
0.upto(600 / d - 1) do |i|
sum += square(i * d) * d
end
puts sum
end
| [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]] | 4 | 64 | 2 |
import sys
for d in map(int, sys.stdin):
sum = 0
for x in range(d, 600, d):
sum += (x**2)*d
print(s) | import sys
for d in map(int, sys.stdin):
sum = 0
for x in range(d, 600, d):
sum += (x**2)*d
print(sum) | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 42 | 2 |
import sys
X = 600
for line in sys.stdin:
s=0
d = int(line)
for nowx in range(0,X,d):
s += d*(nowx**2)
print(nowx)
print(s) | import sys
X = 600
for line in sys.stdin:
s=0
d = int(line)
for nowx in range(0,X,d):
s += d*(nowx**2)
print(s) | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 50 | 4 |
import sys
a = []
for line in sys.stdin:
a.append(line)
for n in a:
num=int(n)
x=0
are=0
while x<600:
are+=(x**2)*num
x+=num
print(area) | import sys
a = []
for line in sys.stdin:
a.append(line)
for n in a:
num=int(n)
x=0
are=0
while x<600:
are+=(x**2)*num
x+=num
print(are) | [["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 57 | 2 |
import sys
def f(x):
return x ** 2
def integral(d):
s = f(d) * d
for i in range(600 // d - 1):
s += f(d * (i + 1)) * d
return s
lines = sys.stdin.readlines()
for line in lines:
print(integral(int(line))) | import sys
def f(x):
return x ** 2
def integral(d):
s = 0
for i in range(600 // d - 1):
s += f(d * (i + 1)) * d
return s
lines = sys.stdin.readlines()
for line in lines:
print(integral(int(line))) | [["-", 0, 1, 0, 662, 12, 657, 31, 652, 63, 22], ["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 24], ["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22], ["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612... | 5 | 78 | 7 |
import sys
for line in sys.stdin:
d = int(line)
S = 0
for x in range(1, 600, d):
S += (x ** 2) * d
print(S) | import sys
for line in sys.stdin:
d = int(line)
S = 0
for x in range(0, 600, d):
S += (x ** 2) * d
print(S) | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 43 | 2 |
def f(x):
return x**2
while True:
try:
d0 = input()
if d0 == '':
break
area = []
d = int(d0)
for i in range(d, 600, d):
print(i)
area.append(d*f(i))
Sumpoyo = sum(area)
print(Sumpoyo)
except EOFError:
break | def f(x):
return x**2
while True:
try:
d0 = input()
if d0 == '':
break
area = []
d = int(d0)
for i in range(d, 600, d):
area.append(d*f(i))
Sumpoyo = sum(area)
print(Sumpoyo)
except EOFError:
break | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 78 | 4 |
import sys
for d in int(sys.stdin):
print(sum([d*x*x for x in range(d,600,d)])) | import sys
for d in map(int, sys.stdin):
print(sum([d*x*x for x in range(d,600,d)])) | [["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]] | 5 | 36 | 4 |
(function(input) {
var p = input.replace(/\n$/, '').split('\n');
var N = Number(p.shift());
var count = 0;
while (count++ < N) {
var n1 = p.shift();
var n2 = p.shift();
if (n1.length >= 80 || n2.length >= 80) {
console.log('overflow');
continue;
}
var n = sum(n1, n2);
if (n.length >= 80) {
conso... | (function(input) {
var p = input.replace(/\n$/, '').split('\n');
var N = Number(p.shift());
var count = 0;
while (count++ < N) {
var n1 = p.shift();
var n2 = p.shift();
if (n1.length > 80 || n2.length > 80) {
console.log('overflow');
continue;
}
var n = sum(n1, n2);
if (n.length > 80) {
console.... | [["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 47], ["-", 8, 556, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 556, 0, 57, 15, 23, 0, 16, 17, 47]] | 2 | 376 | 6 |
import java.io.*;
import java.math.*;
public class Main {
public static void main(String args[]) throws IOException {
String str1, str2;
int i, d = 0;
BigInteger big1, big2, total;
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
i = Integer.parseInt(input.readLine())... | import java.io.*;
import java.math.*;
public class Main {
public static void main(String args[]) throws IOException {
String str1, str2;
int i, d = 0;
BigInteger big1, big2, total;
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
i = Integer.parseInt(input.readLine())... | [["+", 0, 52, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 52, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 95], ["+", 0, 52, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 52, 8, 196, 0, 57, 75, 196, 0, 46]] | 3 | 180 | 5 |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
BigInteger a = new BigInteger(sc.next());
BigInteger b = new BigInteger(sc.next());
... | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
BigInteger a = new BigInteger(sc.next());
BigInteger b = new BigInteger(sc.next());
... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47]] | 3 | 142 | 2 |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int dataset = scanner.nextInt();
for (int i = 0; i < dataset; i++) {
BigInteger first = scanner.nextBigInteger();
BigInteger second = ... | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int dataset = scanner.nextInt();
for (int i = 0; i < dataset; i++) {
BigInteger first = scanner.nextBigInteger();
BigInteger second = ... | [["+", 75, 196, 0, 1, 0, 492, 3, 4, 0, 22]] | 3 | 133 | 1 |
public class Main {
public void run(java.io.InputStream in, java.io.PrintStream out) {
java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
int n;
String a, b;
char[] ca, cb;
int i, j, d;
n = sc.nextInt();
for (i = 0; i < n; i++) {
a = sc.next();
b = sc.next();
... | public class Main {
public void run(java.io.InputStream in, java.io.PrintStream out) {
java.util.Scanner sc = new java.util.Scanner(in);
int n;
String a, b;
char[] ca, cb;
int i, j, d;
n = sc.nextInt();
for (i = 0; i < n; i++) {
a = sc.next();
b = sc.next();
d = a.length... | [["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499], ["-", 0, 16, 12, 23, 0, 16, 12, 16, 17, 60], ["+", 0, 16, 12, 23, 0, 16, 12, 16, 17, 79], ["-", 75, 196, 0, 7, 8, 57, 64, 196, 0, 45], ["-", 75, 196, 0, 7, 8, 57, 64, 196, 0, 46]] | 3 | 419 | 6 |
import java.math.BigDecimal;
import java.util.Scanner;
import java.util.Stack;
public class Main {
public static Scanner sc = new Scanner(System.in);
public static long res = 0;
public static void main(String[] args) throws Exception {
int n = sc.nextInt();
while (sc.hasNext()) {
BigDecimal a = new... | import java.math.BigDecimal;
import java.util.Scanner;
import java.util.Stack;
public class Main {
public static Scanner sc = new Scanner(System.in);
public static long res = 0;
public static void main(String[] args) throws Exception {
int n = sc.nextInt();
while (sc.hasNext()) {
BigDecimal a = new... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47]] | 3 | 158 | 2 |
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while (n-- > 0) {
String a = sc.next();
String b = sc.next();
int result;
String answer = "";
int m = 0;
if (a.length() > 80 || b.... | import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while (n-- > 0) {
String a = sc.next();
String b = sc.next();
int result;
String answer = "";
int m = 0;
if (a.length() > 80 || b.... | [["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 35]] | 3 | 257 | 2 |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
for (int i = 0; i < N; i++) {
String a = scanner.next(), b = scanner.next();
BigInteger sum = new BigInteger... | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
for (int i = 0; i < N; i++) {
String a = scanner.next(), b = scanner.next();
BigInteger A = new BigInteger(a... | [["-", 0, 7, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 7, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 503, 39, 78], ["+", 0, 7, 8, 196, 0, 503, 49, 200, 0, 32], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 500, 22], ["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 22], ["+", 0, 503, 49, 200, 51, 492, 3, 4, 0, 22... | 3 | 153 | 9 |
import java.math.BigInteger;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int times = stdin.nextInt();
for (int i = 0; i < times; i++) {
BigInteger a = new BigInteger(stdin.next());
BigInteger b = new BigInteger(stdin... | import java.math.BigInteger;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int times = stdin.nextInt();
for (int i = 0; i < times; i++) {
BigInteger a = new BigInteger(stdin.next());
BigInteger b = new BigInteger(stdin... | [["-", 31, 492, 3, 4, 0, 492, 3, 4, 0, 499], ["+", 31, 492, 3, 4, 0, 492, 3, 4, 0, 499]] | 3 | 140 | 2 |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
for (int i = 0; i < N; ++i) {
BigInteger n = sc.nextBigInteger();
BigInteger m = sc.nextBigInteger();
BigIntege... | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
for (int i = 0; i < N; ++i) {
BigInteger n = sc.nextBigInteger();
BigInteger m = sc.nextBigInteger();
BigIntege... | [["-", 49, 200, 51, 230, 3, 4, 0, 5, 0, 491], ["+", 49, 200, 51, 230, 3, 4, 0, 5, 0, 491]] | 3 | 142 | 2 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main {
public static void main(String[] args)
throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BigI... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main {
public static void main(String[] args)
throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BigI... | [["-", 49, 200, 51, 230, 3, 4, 0, 5, 0, 491], ["+", 49, 200, 51, 230, 3, 4, 0, 5, 0, 491]] | 3 | 245 | 2 |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String numstr = "";
for (int i = 0; i < 79; i++) {
numstr += "9";
}
int n;
BigInteger a, b, c;
BigInteger max = new BigInteger(numstr); // numstr : 9999 ... 999
Scanne... | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String numstr = "";
for (int i = 0; i < 80; i++) {
numstr += "9";
}
int n;
BigInteger a, b, c;
BigInteger max = new BigInteger(numstr); // numstr : 9999 ... 999
Scanne... | [["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499]] | 3 | 179 | 2 |
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int dataSet = scan.nextInt();
BigDecimal[] ans = new BigDecimal[dataSet];
for (int i = 0; i < dataSet; i++) {
ans[i] = scan.nextBigDecimal... | import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
// scan.useDelimiter("\\r\\n");
int dataSet = scan.nextInt();
BigDecimal[] ans = new BigDecimal[dataSet];
for (int i = 0; i < dataSet; i++) ... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47]] | 3 | 162 | 2 |
import java.util.*;
public class Main {
public void doIt() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while (n-- > 0) {
String str1 = new StringBuilder(sc.next()).reverse().toString();
String str2 = new StringBuilder(sc.next()).reverse().toString();
int maxlen = Math.... |
import java.util.*;
public class Main {
public void doIt() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while (n-- > 0) {
String str1 = new StringBuilder(sc.next()).reverse().toString();
String str2 = new StringBuilder(sc.next()).reverse().toString();
int maxlen = Math.... | [["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 17, 60], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499]] | 3 | 395 | 6 |
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws java.io.IOException {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
while (n != 0) {
BigInteger bi1 = new BigInteger(scan.next());
BigInteger bi2 = new BigIntege... | import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws java.io.IOException {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
while (n != 0) {
BigInteger bi1 = new BigInteger(scan.next());
BigInteger bi2 = new BigIntege... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19]] | 3 | 139 | 2 |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
for (int i = 0; i < n; i++) {
String inputBigInt1 = stdIn.next();
String inputBigInt2 = stdIn.next();
if ... | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
for (int i = 0; i < n; i++) {
String inputBigInt1 = stdIn.next();
String inputBigInt2 = stdIn.next();
if ... | [["-", 0, 57, 15, 15, 0, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 47], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47]] | 3 | 184 | 6 |
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
BigInteger a, b, c;
String s, ss, sss;
int n = cin.nextInt();
while (n-- != 0) {
a = cin.nextBigInteger();
b = cin.nextBigInteger();
s = a.... | import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
BigInteger a, b, c;
String s, ss, sss;
int n = cin.nextInt();
while (n-- != 0) {
a = cin.nextBigInteger();
b = cin.nextBigInteger();
s = a.... | [["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]] | 3 | 194 | 4 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
for (int i = 0; i < n; i++) {
StringBuffer int1 = new StringBuffer(scanner.next());
StringBuffer int2 = new StringBuffer(scanner.next());
... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
for (int i = 0; i < n; i++) {
StringBuffer int1 = new StringBuffer(scanner.next());
StringBuffer int2 = new StringBuffer(scanner.next());
... | [["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 7, 8, 196, 0, 57, 75, 196, 0, 46]] | 3 | 333 | 5 |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = sc.nextInt();
for (int i = 0; i < count; i++) {
BigInteger a = sc.nextBigInteger();
BigInteger b = sc.nextBigInteger();
a... | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = sc.nextInt();
for (int i = 0; i < count; i++) {
BigInteger a = sc.nextBigInteger();
BigInteger b = sc.nextBigInteger();
B... | [["+", 8, 196, 0, 7, 8, 196, 0, 503, 39, 78], ["+", 0, 7, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 7, 8, 196, 0, 503, 49, 200, 0, 32], ["-", 0, 510, 15, 16, 12, 492, 500, 492, 500, 22], ["+", 0, 510, 15, 16, 12, 492, 500, 492, 500, 22], ["-", 0, 492, 3, 4, 0, 510, 75, 492, 500, 22], ["+", 0, 492, 3, 4, 0, 510, 75, 4... | 3 | 121 | 7 |
import java.math.*;
import java.util.*;
public class Main {
public static void main(String args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
for (int i = 0; i < n; i++) {
BigInteger a = s.nextBigInteger();
BigInteger b = s.nextBigInteger();
BigInteger c = a.add(b);
... | import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
for (int i = 0; i < n; i++) {
BigInteger a = s.nextBigInteger();
BigInteger b = s.nextBigInteger();
BigInteger c = a.add(b);
... | [["+", 54, 495, 0, 496, 39, 224, 497, 497, 0, 70], ["+", 54, 495, 0, 496, 39, 224, 497, 497, 0, 73]] | 3 | 132 | 2 |
import java.io.*;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(in.readLine());
BigInteger a, b;
for (int i = 0; i < N; i++) {
a = ne... | import java.io.*;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(in.readLine());
BigInteger a, b;
for (int i = 0; i < N; i++) {
a = ne... | [["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]] | 3 | 198 | 2 |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
for (int i = 0; i... | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
for (int i = 0; i... | [["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35]] | 3 | 216 | 4 |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int temp = Integer.valueOf(scan.nextLine());
for (int i = 0; i < temp; i++) {
BigInteger a1 = new BigInteger(scan.nextLine());
BigInteger... | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int temp = Integer.valueOf(scan.nextLine());
for (int i = 0; i < temp; i++) {
BigInteger a1 = new BigInteger(scan.nextLine());
BigInteger... | [["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 7, 8, 196, 0, 57, 75, 196, 0, 46]] | 3 | 143 | 3 |
require 'English'
MAX = 1000
prime = Array.new(1_000_001, true)
prime[0] = false
prime[1] = false
(2..MAX).each do |i|
j = i * i
while j < 1_000_000
prime[j] = false
j += i
end
end
while gets
n = $LAST_READ_LINE.to_i
ans = 0
n.times do |i|
ans += 1 if prime[i]
end
puts ans
end
| require 'English'
MAX = 1000
prime = Array.new(1_000_001, true)
prime[0] = false
prime[1] = false
(2..MAX).each do |i|
j = i * i
while j < 1_000_000
prime[j] = false
j += i
end
end
while gets
n = $LAST_READ_LINE.to_i
ans = 0
(2..n).each do |i|
ans += 1 if prime[i]
end
puts ans
end
| [["+", 0, 89, 8, 170, 0, 652, 486, 739, 0, 24], ["+", 8, 170, 0, 652, 486, 739, 0, 475, 756, 612], ["+", 8, 170, 0, 652, 486, 739, 0, 475, 17, 757], ["+", 0, 89, 8, 170, 0, 652, 486, 739, 0, 25], ["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22]] | 4 | 89 | 6 |
require 'prime'
primes = Prime.each(999_999).to_a
while (l = gets)
puts primes.count { |p| p < l.to_i }
end
| require 'prime'
primes = Prime.each(999_999).to_a
while (l = gets)
puts primes.count { |p| p <= l.to_i }
end
| [["-", 0, 652, 196, 196, 8, 734, 0, 738, 17, 18], ["+", 0, 652, 196, 196, 8, 734, 0, 738, 17, 19]] | 4 | 35 | 2 |
require 'Prime'
while s = gets
puts Prime.each(s.to_i).count
end
| require 'prime'
while s = gets
puts Prime.each(s.to_i).count
end
| [["-", 0, 493, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 493, 0, 652, 3, 4, 0, 557, 0, 6]] | 4 | 20 | 2 |
$stdin.read.split("\n").map { |i| i.chomp.to_i }.each do |max|
table = Array.new(max + 1, true)
prime_list = []
(2..max).each do |num|
prime_list << num if table[num] == true
k = num * num
while k <= max
table[k] = false
k += num
end
end
prime_list.count
end
| $stdin.read.split("\n").map { |i| i.chomp.to_i }.each do |max|
table = Array.new(max + 1, true)
prime_list = []
(2..max).each do |num|
prime_list << num if table[num] == true
k = num * num
while k <= max
table[k] = false
k += num
end
end
puts prime_list.count
end
| [["+", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22]] | 4 | 89 | 1 |
require 'English'
def get_prime_list(n)
sn = (n**0.5).to_i
is_prime = [false, false] + [true] * (n - 1)
(2..sn).each do |i|
next unless is_prime[i]
(i * i).step(n, i) do |j|
is_prime[j] = false
end
end
(2..n).to_a.select { |i| is_prime[i] }
end
list = get_prime_list(999_999)
while gets
... | require 'English'
def get_prime_list(n)
sn = (n**0.5).to_i
is_prime = [false, false] + [true] * (n - 1)
(2..sn).each do |i|
next unless is_prime[i]
(i * i).step(n, i) do |j|
is_prime[j] = false
end
end
(2..n).to_a.select { |i| is_prime[i] }
end
list = get_prime_list(999_999)
while gets
... | [["-", 486, 652, 196, 196, 8, 734, 0, 738, 17, 18], ["+", 486, 652, 196, 196, 8, 734, 0, 738, 17, 19]] | 4 | 123 | 2 |
require 'prime'
gets.split.map(&:to_i).each do |i|
puts Prime.each(i).to_a.size
end
| require 'prime'
while l = gets
l.split.map(&:to_i).each do |i|
puts Prime.each(i).to_a.size
end
end
| [["+", 36, 36, 36, 36, 0, 493, 0, 89, 0, 89], ["+", 36, 36, 0, 493, 0, 89, 15, 662, 31, 22], ["+", 36, 36, 0, 493, 0, 89, 15, 662, 0, 32], ["+", 8, 170, 0, 652, 486, 652, 486, 652, 486, 22], ["+", 0, 89, 8, 170, 0, 652, 196, 737, 0, 444]] | 4 | 31 | 5 |
require 'prime'
$primes = []
def main
$primes = Prime.first 80_000
while num = gets
num = num.chomp.to_i
puts solve(num).to_s
end
end
def solve(num)
nn = $primes.bsearch { |x| x >= num }
$primes.index nn
end
main
| require 'prime'
$primes = []
def main
$primes = Prime.first 80_000
while num = gets
num = num.chomp.to_i
puts solve(num).to_s
end
end
def solve(num)
nn = $primes.bsearch { |x| x > num }
$primes.index nn
end
main
| [["-", 12, 652, 196, 196, 8, 734, 0, 738, 17, 20], ["+", 12, 652, 196, 196, 8, 734, 0, 738, 17, 47]] | 4 | 60 | 2 |
prime=[2]
for i in range(3,100,2):
primeq=True
for p in prime:
if i%p==0:
primeq=False
break
if i<p*p:break
if primeq:prime.append(i)
while True:
try:
n=int(input())
ans=0
for p in prime:
if p>n:break
ans+=1
... | prime=[2]
for i in range(3,1000000,2):
primeq=True
for p in prime:
if i%p==0:
primeq=False
break
if i<p*p:break
if primeq:prime.append(i)
while True:
try:
n=int(input())
ans=0
for p in prime:
if p>n:break
ans+=1
... | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 90 | 2 |
# AOJ 0009
import sys
ps = [0]*10**6
used = [False]*10**6
p = 0
def sieve():
global p
used[0] = used[1] = True
for i in range(0,10**6):
if not used[i]:
ps[p] = i
p+=1
for j in range(i,10**6,i):
used[j] = True
def upper_bound(x):
lb = 0
ub = p
while ub-lb > 1:
mid = lb+... | # AOJ 0009
import sys
ps = [0]*10**6
used = [False]*10**6
p = 0
def sieve():
global p
used[0] = used[1] = True
for i in range(0,10**6):
if not used[i]:
ps[p] = i
p+=1
for j in range(i,10**6,i):
used[j] = True
def upper_bound(x):
lb = -1
ub = p
while ub-lb > 1:
mid = lb... | [["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 664, 28, 612], ["-", 0, 52, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22... | 5 | 154 | 9 |
import sys
n_list = list(map(int, sys.stdin.readlines()))
n_max = max(n_list)
pn_candidates = [0] + [1] * (n_max - 1)
pn = 2
while pn < n_max:
if pn_candidates[pn - 1] != 1:
pn += 1
continue
i = 2
while pn * i < n_max:
pn_candidates[pn * i - 1] = 0
i += 1
pn += 1
for... | import sys
n_list = list(map(int, sys.stdin.readlines()))
n_max = max(n_list)
pn_candidates = [0] + [1] * (n_max - 1)
pn = 2
while pn <= n_max:
if pn_candidates[pn - 1] != 1:
pn += 1
continue
i = 2
while pn * i <= n_max:
pn_candidates[pn * i - 1] = 0
i += 1
pn += 1
f... | [["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19], ["-", 0, 52, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 0, 52, 8, 196, 0, 52, 15, 666, 667, 19]] | 5 | 104 | 4 |
n = []
while True:
try:n.append(int(input()))
except:break
R = max(n)+1
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0 for i in range(4,R,2)]
for i in range(3,int(R**0.5)+1,2):
if p[i]:
p[2*i::i] = [0]*len(p[2*i::i])
print(p)
for i in n:
print(sum(p[:i+1])) | n = []
while True:
try:n.append(int(input()))
except:break
R = max(n)+1
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0 for i in range(4,R,2)]
for i in range(3,int(R**0.5)+1,2):
if p[i]:
p[2*i::i] = [0]*len(p[2*i::i])
for i in n:
print(sum(p[:i+1])) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 144 | 20 |
import math
while True:
try:
n.append(int(input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
for i in n:
print(sum(p[:i])) | import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
for i in n:
print(sum(p[:i])) | [["+", 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, 634, 0, 70], ["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 73]] | 5 | 109 | 4 |
import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = [0]*list(range(2*i+1,r,i+1))
for i in n:
print(sum(p[:i])) | import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
for i in n:
print(sum(p[:i])) | [["-", 0, 1, 0, 662, 12, 657, 31, 634, 0, 73], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 0, 1, 0, 662, 12, 657, 12, 652, 63, 22], ["-", 0, 662, 12, 657, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 658, 0, 659, 0, 88], ["+", 0, 1, 0, 662, 12, 658, 0, 659, 31, 22], ["+", 0, 1, 0, 662, 12, 658, 0, 659, 0, 26... | 5 | 124 | 9 |
import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[1::2] = [0 for x in range(0,r,2)]
for i in range(2,sqrt,2):
if p[i]:
p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
for i in n:
print(sum(p[... | import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
if p[i]:
p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
for i in n:
print(sum(p... | [["-", 0, 1, 0, 662, 31, 206, 206, 663, 0, 612], ["+", 0, 1, 0, 662, 31, 206, 206, 663, 0, 612], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]] | 5 | 147 | 4 |
# -*- coding;utf-8 -*-
def sieve(n):
p = 0
primes = []
is_prime = [True]*(n+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, n+1):
if(is_prime[i]):
primes.append(i)
p += 1
for j in range(i*2,n,i):#iごとに増える
is_prime[j] = Fals... | # -*- coding;utf-8 -*-
def sieve(n):
p = 0
primes = []
is_prime = [True]*(n+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, n+1):
if(is_prime[i]):
primes.append(i)
p += 1
for j in range(i*2,n+1,i):#iごとに増える
is_prime[j] = Fa... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 123 | 2 |
while True:
try:
n=int(input())
a=[True]*(n+1)
a[0]=a[1]=False
for i in range(2,int(n**0.5)+1):
if a[i]:
for j in range(i**2,n,i):
a[j]=False
print(a.count(True))
except:
break | while True:
try:
n=int(input())
a=[True]*(n+1)
a[0]=a[1]=False
for i in range(2,int(n**0.5)+1):
if a[i]:
for j in range(i**2,n+1,i):
a[j]=False
print(a.count(True))
except:
break | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 90 | 2 |
import sys
n=999999
prime = [1]*(n+1)
(prime[0],prime[1])=(0,0)
for i in [v for v in range(2,n+1) if v*v<n+1]:
for j in range(i*i,n+1,i):
prime[j]=0
for inp in sys.stdin:
print(prime[:int(inp)-1].count(1)) | import sys
n=999999
prime = [1]*(n+1)
(prime[0],prime[1])=(0,0)
for i in [v for v in range(2,n+1) if v*v<n+1]:
for j in range(i*i,n+1,i):
prime[j]=0
for inp in sys.stdin:
print(prime[:int(inp)+1].count(1)) | [["-", 63, 319, 500, 206, 206, 663, 0, 657, 17, 33], ["+", 63, 319, 500, 206, 206, 663, 0, 657, 17, 72]] | 5 | 106 | 2 |
import sys
ary=[]
for i in sys.stdin:
ary.append(int(i))
m = max(ary)
prime=[1] * (m + 1)
prime[0] = prime[1] = 0
for i in range(2, int(m ** 0.5) + 1):
if prime[i] == 1:
for j in range(i*2, m + 1, i):
prime[j] = 0
for i in range(len(ary)):
print(sum(prime[:ary[i]])) | import sys
ary=[]
for i in sys.stdin:
ary.append(int(i))
m = max(ary)
prime=[1] * (m + 1)
prime[0] = prime[1] = 0
for i in range(2, int(m ** 0.5) + 1):
if prime[i] == 1:
for j in range(i*2, m + 1, i):
prime[j] = 0
for i in range(len(ary)):
print(sum(prime[:ary[i] + 1])) | [["+", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["+", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]] | 5 | 122 | 2 |
prime=[False]*1000000
for i in range(2,1001):
for j in range(i*2,1000000,i):
prime[j]=True
while True:
try:
n=int(input())
except:
break
print(prime[:n+1].count(False)) |
prime=[False]*1000000
for i in range(2,1001):
for j in range(i*2,1000000,i):
prime[j]=True
while True:
try:
n=int(input())
except:
break
print(prime[2:n+1].count(False)) | [["+", 0, 652, 63, 319, 500, 206, 206, 663, 0, 612]] | 5 | 68 | 1 |
import sys
import math
N = 1000000
primes = [1] * N
primes[0] = 0
primes[1] = 0
primes[4::2] = [0] * len(primes[4::2])
for i in range(3,int(math.sqrt(N)),2):
if primes[i]:
primes[i*i::i*2] = [0] * len(primes[i*i::i*2])
for i in sys.stdin:
n = int(i)
print(sum(primes[0:n])) | import sys
import math
N = 1000000
primes = [1] * N
primes[0] = 0
primes[1] = 0
primes[4::2] = [0] * len(primes[4::2])
for i in range(3,int(math.sqrt(N)),2):
if primes[i]:
primes[i*i::i*2] = [0] * len(primes[i*i::i*2])
for i in sys.stdin:
n = int(i)
print(sum(primes[0:n+1])) | [["+", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["+", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]] | 5 | 129 | 2 |
import sys
x = 500000
f = [0, 1] * xx
i = 3
while i * i <= 2 * xx:
if f[i] == 1:
j = i * i
while j <= 2 * xx:
f[j] = 0
j += i + i
i += 2
f.pop(0)
f.pop(1)
for n in sys.stdin:
i = int(n)
if i < 2:
print(0)
else:
print(sum(f[:i - 1])) | import sys
xx = 500000
f = [0, 1] * xx
i = 3
while i * i <= 2 * xx:
if f[i] == 1:
j = i * i
while j <= 2 * xx:
f[j] = 0
j += i + i
i += 2
f.pop(0)
f.pop(1)
for n in sys.stdin:
i = int(n)
if i < 2:
print(0)
else:
print(sum(f[:i - 1])) | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]] | 5 | 109 | 2 |
from math import sqrt,floor
from sys import stdin
def cntPrime(n):
mx = sqrt(n)
if n % 2 == 0:
l = [0, 1] + [1, 0] * (int(n/2) - 1)
else:
l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
c = 3
while c < mx:
for k in range(c*2, n+1, c):
l[k-1] = 0
c = l[(c+1):].inde... | from math import sqrt,floor
from sys import stdin
def cntPrime(n):
mx = sqrt(n)
if n % 2 == 0:
l = [0, 1] + [1, 0] * (int(n/2) - 1)
else:
l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
c = 3
while c < mx:
for k in range(c*2, n+1, c):
l[k-1] = 0
c = l[(c+1):].inde... | [["-", 3, 4, 0, 206, 206, 663, 0, 657, 17, 33], ["-", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]] | 5 | 194 | 2 |
import sys
prime = [2,3,5,7,11,13,19,23,29,31]
shieve1 = [1]*1001
for i in prime:
itr = i-1
while(itr<1000):
shieve1[itr] = 0
itr += i
for i in range(32,1000):
if shieve1[i]:
prime.append(i+1)
shieve2 = [1]*(10**6+1)
for i in prime:
itr = i-1
while(itr<10**6):
sh... | import sys
prime = [2,3,5,7,11,13,17,19,23,29,31]
shieve1 = [1]*1001
for i in prime:
itr = i-1
while(itr<1000):
shieve1[itr] = 0
itr += i
for i in range(32,1000):
if shieve1[i]:
prime.append(i+1)
shieve2 = [1]*(10**6+1)
for i in prime:
itr = i-1
while(itr<10**6):
... | [["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 21]] | 5 | 187 | 2 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
LIMIT = 1000000
is_prime = [True] * (LIMIT+1)
p = 2
while p**2 <= LIMIT:
if is_prime[p]:
for i in range(p*2, n+1, p):
is_prime[i] = False
p += 1
for line in sys.stdin.readlines():
n = int(line.strip())
if n <= 1:
prin... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
LIMIT = 1000000
is_prime = [True] * (LIMIT+1)
p = 2
while p**2 <= LIMIT:
if is_prime[p]:
for i in range(p*2, LIMIT+1, p):
is_prime[i] = False
p += 1
for line in sys.stdin.readlines():
n = int(line.strip())
if n <= 1:
... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]] | 5 | 128 | 2 |
import sys
import math as mas
def sieve(n):
p=[True for i in range(n+1)]
p[0]=p[1]=False
end=int(n**0.5)
for i in range(2,end+1):
if p[i]:
for j in range(i*i,n+1,i):
p[j]=False
return p
sosu=sieve(1000010)
for i in sys.stdin:
print(sum(sosu[t] for t in range(int(i))))
# a,b=map(int,i.split())
# print... | import sys
import math as mas
def sieve(n):
p=[True for i in range(n+1)]
p[0]=p[1]=False
end=int(n**0.5)
for i in range(2,end+1):
if p[i]:
for j in range(i*i,n+1,i):
p[j]=False
return p
sosu=sieve(1000010)
for i in sys.stdin:
print(sum(sosu[t] for t in range(int(i)+1)))
# a,b=map(int,i.split())
# pri... | [["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 122 | 2 |
import sys
N = 999999
lis = []
if N >= 2:
lis.append(2)
if N >= 3:
lis.append(3)
if N >= 5:
for i in range(5,N+1,2):
for item in lis:
if item > (i**0.5):
lis.append(i)
break
if i % item == 0:
break
else:
lis.append(i)
dp = [0]*999999
for item in lis:
dp[item-1] += 1
for i in range(1,999999... | import sys
N = 999999
lis = []
if N >= 2:
lis.append(2)
if N >= 3:
lis.append(3)
if N >= 5:
for i in range(5,N+1,2):
for item in lis:
if item > (i**0.5):
lis.append(i)
break
if i % item == 0:
break
else:
lis.append(i)
dp = [0]*999999
for item in lis:
dp[item-1] += 1
for i in range(1,999999... | [["-", 0, 652, 3, 4, 0, 206, 206, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 31, 22]] | 5 | 150 | 2 |
import sys
MAX = 999999
L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311,... | import sys
MAX = 999999
L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311,... | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]] | 5 | 575 | 4 |
import sys
m=10**6;a=[1]*m;a[0:2]=0,0
for i in range(2,999):
if a[i]>0:
for j in range(i*2,m,i):a[j]=0
for e in sys.stdin:print(sum(a[:int(e)]))
| import sys
m=10**6;a=[1]*m;a[0:2]=0,0
for i in range(2,999):
if a[i]>0:
for j in range(i*2,m,i):a[j]=0
for e in sys.stdin:print(sum(a[:int(e)+1]))
| [["+", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["+", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]] | 5 | 85 | 2 |
import sys
m=166666;s=[1]*m;t=[1]*m
for i in range(m):
for j in range(2):
if (s[i],t[i])[j]:
k=6*i+[5,7][j];n=[i+k,k-i-2]
s[n[i]::k]=[0]*len(s[n[i]::k])
t[n[1-i]::k]=[0]*len(t[n[1-i]::k])
for e in map(int,sys.stdin):
print([e-1,sum(s[:(e+1)//6])+sum(t[:(e-1)//6])+2][e>3])
| import sys
m=166666;s=[1]*m;t=[1]*m
for i in range(m):
for j in range(2):
if (s[i],t[i])[j]:
k=6*i+[5,7][j];n=[i+k,k-i-2]
s[n[j]::k]=[0]*len(s[n[j]::k])
t[n[1-j]::k]=[0]*len(t[n[1-j]::k])
for e in map(int,sys.stdin):
print([e-1,sum(s[:(e+1)//6])+sum(t[:(e-1)//6])+2][e>3])
| [["-", 0, 662, 31, 206, 206, 663, 0, 206, 206, 22], ["+", 0, 662, 31, 206, 206, 663, 0, 206, 206, 22], ["-", 3, 4, 0, 206, 206, 663, 0, 206, 206, 22], ["+", 3, 4, 0, 206, 206, 663, 0, 206, 206, 22], ["-", 31, 206, 206, 663, 0, 206, 206, 657, 12, 22], ["+", 31, 206, 206, 663, 0, 206, 206, 657, 12, 22], ["-", 0, 206, 206... | 5 | 198 | 8 |
LIMIT = 999999
prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]
for i in range(3, LIMIT + 1):
if prime[i - 1]:
for j in range(i ** 2, len(prime), i):
prime[j - 1] = 0
while True:
try:
n = int(input())
except EOFError:
break
print(n, sum(p... | # coding: utf-8
LIMIT = 999999
prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]
for i in range(3, LIMIT + 1):
if prime[i - 1]:
for j in range(i ** 2, LIMIT + 1, i):
prime[j - 1] = 0
while True:
try:
n = int(input())
except EOFError:
break
pr... | [["-", 0, 7, 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, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 8, 196,... | 5 | 108 | 9 |
#include <stdio.h>
#include <string.h>
#define STR_MAX 3
#define ASCII_BIAS 48
char h_adder(char n1, char n2, char *n3, char carry) {
char result = n1 + n2 + carry;
if (result < 10) {
*n3 = result + ASCII_BIAS;
return 0;
} else {
*n3 = result - 10 + ASCII_BIAS;
return 1;
}
}
int main(void) {... | #include <stdio.h>
#include <string.h>
#define STR_MAX 80
#define ASCII_BIAS 48
char h_adder(char n1, char n2, char *n3, char carry) {
char result = n1 + n2 + carry;
if (result < 10) {
*n3 = result + ASCII_BIAS;
return 0;
} else {
*n3 = result - 10 + ASCII_BIAS;
return 1;
}
}
int main(void) ... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 0 | 647 | 2 |
#include <stdio.h>
#include <string.h>
int main() {
char a[10000], b[10000];
int i, l, n, k = 0;
scanf("%d", &n);
while (n--) {
char c[81] = {0};
char d[81] = {0};
for (i = 0; i < 80; i++)
c[i] = d[i] = '0';
scanf("%s", a);
l = strlen(a); // printf("%d ",l);
if (l < 81)
strcp... | #include <stdio.h>
#include <string.h>
int main() {
char a[10000], b[10000];
int i, l, n, k = 0;
scanf("%d", &n);
while (n--) {
char c[81] = {0};
char d[81] = {0};
k = 0;
for (i = 0; i < 80; i++)
c[i] = d[i] = '0';
scanf("%s", a);
l = strlen(a); // printf("%d ",l);
if (l < 81)
... | [["+", 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], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 305 | 6 |
#include <stdio.h>
#include <string.h>
int main() {
char a[1000], b[1000];
int c[1000];
int i, j, k, l, m, n;
scanf("%d", &n);
for (i = 0; i < n; i++) {
for (j = 0; j < 90; j++) {
a[j] = '0';
b[j] = '0';
c[j] = 0;
}
scanf("%s", a);
scanf("%s", b);
j = strlen(a);
k = ... | #include <stdio.h>
#include <string.h>
int main() {
char a[1000], b[1000];
int c[1000];
int i, j, k, l, m, n;
scanf("%d", &n);
for (i = 0; i < n; i++) {
for (j = 0; j < 90; j++) {
a[j] = '0';
b[j] = '0';
c[j] = 0;
}
scanf("%s", a);
scanf("%s", b);
j = strlen(a);
k = ... | [["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["-", 0, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 12, 13]] | 0 | 346 | 4 |
#include <stdio.h>
#include <stdlib.h>
#define KETA 101
int main(void) {
int n = 0, i = 0, j = 0;
int *sum;
int goukei = 0;
int keta_max = 0;
int countsum = 0;
char *money1;
char *money2;
int count1 = 0, count2 = 0;
int *money_int1;
int *money_int2;
int t = 0, p = 0;
scanf("%d", &n);
for (t... | #include <stdio.h>
#include <stdlib.h>
#define KETA 101
int main(void) {
int n = 0, i = 0, j = 0;
int *sum;
int goukei = 0;
int keta_max = 0;
int countsum = 0;
char *money1;
char *money2;
int count1 = 0, count2 = 0;
int *money_int1;
int *money_int2;
int t = 0, p = 0;
scanf("%d", &n);
for (t... | [["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 610 | 3 |
#include <stdio.h>
#include <string.h>
#define MAX 180
#define LIMIT 180
int main() {
int n = 0;
int i = 0;
int j = 0;
int k = 0;
int a = 0;
char num1[MAX];
char num2[MAX];
int num1_int[MAX];
int num2_int[MAX];
int count1 = 0;
int count2 = 0;
int sum[MAX];
int ans[MAX];
scanf("%d", &n);
s... | #include <stdio.h>
#include <string.h>
#define MAX 180
#define LIMIT 180
int main() {
int n = 0;
int i = 0;
int j = 0;
int k = 0;
int a = 0;
char num1[MAX];
char num2[MAX];
int num1_int[MAX];
int num2_int[MAX];
int count1 = 0;
int count2 = 0;
int sum[MAX];
int ans[MAX];
scanf("%d", &n);
s... | [["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["-", 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... | 0 | 645 | 8 |
#include <stdio.h>
#include <string.h>
void resetArray(int x[], int n) {
int i;
for (i = 0; i < n; i++)
x[i] = 0;
}
int main(void) {
char as[100], bs[100];
int a[100], b[100], c[100];
int n, ch, i, an, bn, abn, cn;
while (scanf("%d", &n) != EOF) {
while (n--) {
resetArray(a, 100);
res... | #include <stdio.h>
#include <string.h>
void resetArray(int x[], int n) {
int i;
for (i = 0; i < n; i++)
x[i] = 0;
}
int main(void) {
char as[100], bs[100];
int a[100], b[100], c[100];
int n, ch, i, an, bn, abn, cn;
while (scanf("%d", &n) != EOF) {
while (n--) {
resetArray(a, 100);
res... | [["-", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]] | 0 | 380 | 6 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define M 1000000000
#define N 13
void changCode(char *num, int *a);
void addCode(int *a, int *b);
int main(void) {
int i, j, n, a[N], b[N];
char num1[101], num2[101];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s %s", num1, num2);
ch... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define M 1000000000
#define N 13
void changCode(char *num, int *a);
void addCode(int *a, int *b);
int main(void) {
int i, j, n, a[N], b[N];
char num1[101], num2[101];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s %s", num1, num2);
ch... | [["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["+", 15, 23, 0, 16, 12, 16, 12, 16, 31, 22], ["+", 15, 23, 0, 16, 12, 16, 12, 16, 17, 85], ["+", 15, 23, 0, 16, 12, 16, 12, 16, 12, 13]] | 0 | 506 | 4 |
#include <stdio.h>
#include <string.h>
int main(void) {
char sa[100], sb[100];
int ra[100], rb[100], t[101];
int la, lb;
int N;
int i, j, k;
int a = 0;
for (i = 0; i < 101; i++) {
t[i] = 0;
}
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%s", &sa);
scanf("%s", &sb);
la = strlen(... | #include <stdio.h>
#include <string.h>
int main(void) {
char sa[100], sb[100];
int ra[100], rb[100], t[101];
int la, lb;
int N;
int i, j, k;
int a = 0;
for (i = 0; i < 101; i++) {
t[i] = 0;
}
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%s", &sa);
scanf("%s", &sb);
la = strlen(... | [["-", 0, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 23, 0, 16, 17, 20]] | 0 | 426 | 2 |
#include <stdio.h>
#include <string.h>
#define MAX_LEN 100
#define MAX_LEN1 (MAX_LEN + 1)
#define LABEL_OVERFLOW "overflow"
int main() {
char in1[MAX_LEN1], in2[MAX_LEN1], out[MAX_LEN1];
int len1, len2, len, i1, i2, o, carry, i, j, n;
scanf("%d", &n);
for (j = 0; j < n; j++) {
scanf("%s", in1);
scanf(... | #include <stdio.h>
#include <string.h>
#define MAX_LEN 100
#define MAX_LEN1 (MAX_LEN + 1)
#define LABEL_OVERFLOW "overflow"
int main() {
char in1[MAX_LEN1], in2[MAX_LEN1], out[MAX_LEN1];
int len1, len2, len, i1, i2, o, carry, i, j, n;
scanf("%d", &n);
for (j = 0; j < n; j++) {
scanf("%s", in1);
scanf(... | [["-", 64, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 343 | 7 |
#include <stdio.h>
#include <string.h>
#define MAX 80
char a[MAX + 1], b[MAX + 1];
int sum[MAX + 1];
int a_size, b_size, sum_size;
void culc(int carry) {
if (sum_size < a_size && sum_size < b_size)
sum[sum_size] =
a[a_size - sum_size - 1] - '0' + b[b_size - sum_size - 1] - '0' + carry;
else if (sum_s... | #include <stdio.h>
#include <string.h>
#define MAX 80
char a[MAX + 1], b[MAX + 1];
int sum[MAX + 1];
int a_size, b_size, sum_size;
void culc(int carry) {
if (sum_size < a_size && sum_size < b_size)
sum[sum_size] =
a[a_size - sum_size - 1] - '0' + b[b_size - sum_size - 1] - '0' + carry;
else if (sum_s... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 377 | 2 |
#include <stdio.h>
int main(void) {
int a[80];
int b[80];
int result[80];
int ketaagari;
int i, j;
int max;
int temp[80];
char in;
int overflow;
int count, kazu;
scanf("%d", &kazu);
while (getchar() != '\n')
;
for (count = 0; count < kazu; count++) {
for (i = 0; i < 80; i++) {
a... | #include <stdio.h>
int main(void) {
int a[80];
int b[80];
int result[80];
int ketaagari;
int i, j;
int max;
int temp[80];
char in;
int overflow;
int count, kazu;
scanf("%d", &kazu);
while (getchar() != '\n')
;
for (count = 0; count < kazu; count++) {
for (i = 0; i < 80; i++) {
a... | [["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47]] | 0 | 447 | 4 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char a[82], b[82];
int ans[81];
int a_len, b_len;
int a_num, b_num, ans_num, agari;
int setsize, keta;
int i, j;
scanf("%d", &setsize);
for (i = 0; i < setsize; i++) {
scanf("%81s%*", a);
scanf("%81s%*", b);
if ((a_len... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char a[82], b[82];
int ans[81];
int a_len, b_len;
int a_num, b_num, ans_num, agari;
int setsize, keta;
int i, j;
scanf("%d", &setsize);
for (i = 0; i < setsize; i++) {
scanf("%81s%*", a);
scanf("%81s%*", b);
if ((a_len... | [["-", 0, 7, 8, 9, 0, 7, 10, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71... | 0 | 355 | 8 |
// ツ堕スツ倍ツ陳キツ可可算
#include <stdio.h>
#include <string.h>
#define MAX_LEN (80)
int main(void) {
int no;
scanf("%d", &no);
while (no--) {
char num_str[MAX_LEN + 2];
char add_str[MAX_LEN + 2];
int num_len, add_len;
int i;
int tmp;
scanf("%80s", num_str);
scanf("%80s", add_str);
num... | // ツ堕スツ倍ツ陳キツ可可算
#include <stdio.h>
#include <string.h>
#define MAX_LEN (80)
int main(void) {
int no;
scanf("%d", &no);
while (no--) {
char num_str[MAX_LEN + 2];
char add_str[MAX_LEN + 2];
int num_len, add_len;
int i;
int tmp;
scanf("%81s", num_str);
scanf("%81s", add_str);
num... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 348 | 4 |
#include <stdio.h>
#include <string.h>
#define DIGIT (80)
int main() {
int i, j, n, temp, overFlow = 0;
char num[2][DIGIT + 1];
char ans[DIGIT + 2];
char fmt[8];
int len[2], index;
// scanf format
sprintf(fmt, "%%%ds", DIGIT);
scanf("%d", &n);
for (i = 0; i < n; ++i) {
overFlow = 0;
for (... | #include <stdio.h>
#include <string.h>
#define DIGIT (80)
int main() {
int i, j, n, temp, overFlow = 0;
char num[2][DIGIT + 1];
char ans[DIGIT + 2];
char fmt[8];
int len[2], index;
// scanf format
sprintf(fmt, "%%%ds", DIGIT);
scanf("%d", &n);
for (i = 0; i < n; ++i) {
overFlow = 0;
for (... | [["-", 8, 9, 0, 7, 15, 16, 31, 91, 17, 111], ["-", 8, 9, 0, 7, 15, 16, 31, 91, 28, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 98]] | 0 | 411 | 3 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
const int START = 500;
int n, anssize;
char xstr[1000], ystr[1000], answer[100];
scanf("%d", &n);
while (n > 0) {
anssize = 99;
answer[anssize--] = '\0';
memset(xstr, '0', 200);
memset(ystr, '0', 200);
scanf("%s"... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
const int START = 500;
int n, anssize;
char xstr[1000], ystr[1000], answer[1000];
scanf("%d", &n);
while (n > 0) {
anssize = 999;
answer[anssize--] = '\0';
memset(xstr, '0', 1000);
memset(ystr, '0', 1000);
scanf(... | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16... | 0 | 273 | 10 |
#include <stdio.h>
#define MAX_DIGIT 80
void initialize(int a[]) {
int i;
for (i = 0; i < MAX_DIGIT; i++)
a[i] = 0;
}
void reverse(int a[], int n) {
int i, temp[MAX_DIGIT];
for (i = 0; i < n; i++)
temp[i] = a[i];
for (i = 0; i < n; i++)
a[i] = temp[n - 1 - i];
}
int input_number(int a[]) {
... | #include <stdio.h>
#define MAX_DIGIT 80
void initialize(int a[]) {
int i;
for (i = 0; i < MAX_DIGIT; i++)
a[i] = 0;
}
void reverse(int a[], int n) {
int i, temp[MAX_DIGIT];
for (i = 0; i < n; i++)
temp[i] = a[i];
for (i = 0; i < n; i++)
a[i] = temp[n - 1 - i];
}
int input_number(int a[]) {
... | [["-", 0, 57, 64, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 57, 64, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 516 | 3 |
#include <stdio.h>
#include <string.h>
#define STR_SIZE 100
int add_bignum(char a[], char b[], char out[]) {
int alen = strlen(a);
int blen = strlen(b);
if (alen >= 80 || blen >= 80) {
return 0;
}
char buf[STR_SIZE] = "";
--alen;
--blen;
int i, digit, tmp = 0;
for (i = 0; i < 100; i++) {
if (a... | #include <stdio.h>
#include <string.h>
#define STR_SIZE 100
int add_bignum(char a[], char b[], char out[]) {
int alen = strlen(a);
int blen = strlen(b);
if (alen >= 81 || blen >= 81) {
return 0;
}
char buf[STR_SIZE] = "";
--alen;
--blen;
int i, digit, tmp = 0;
for (i = 0; i < 100; i++) {
if (a... | [["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]] | 0 | 398 | 6 |
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <malloc.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LEN 1024
void convert(char num[LEN], int a[LEN]);
void add(int a[LEN], int b[LEN], int c[LEN]);
void printLDV(int c[LEN]);
int main()... | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <malloc.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LEN 1024
void convert(char num[LEN], int a[LEN]);
void add(int a[LEN], int b[LEN], int c[LEN]);
void printLDV(int c[LEN]);
int main()... | [["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13]] | 0 | 500 | 2 |
#include <math.h>
#include <stdio.h>
#include <string.h>
void rev(char *s) {
int i, d = strlen(s);
char tmp;
for (i = 0; i < d / 2; i++) {
tmp = *(s + i);
*(s + i) = *(s + d - i - 1);
*(s + d - i - 1) = tmp;
}
}
int main() {
int n, p, q, x, y, dt, i, j, k, t, u, flag;
char str1[128], str2[128],... | #include <math.h>
#include <stdio.h>
#include <string.h>
void rev(char *s) {
int i, d = strlen(s);
char tmp;
for (i = 0; i < d / 2; i++) {
tmp = *(s + i);
*(s + i) = *(s + d - i - 1);
*(s + d - i - 1) = tmp;
}
}
int main() {
int n, p, q, x, y, dt, i, j, k, t, u, flag;
char str1[1024], str2[1024... | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]] | 0 | 517 | 8 |
#include <iostream>
#include <stdio.h>
#include <string.h>
int n;
char a[1000];
int temp[1000], temp2[1000], temp3[1000];
int main() {
std::cin >> n;
while (n--) {
memset(temp, -1, sizeof(temp));
memset(temp2, -1, sizeof(temp2));
memset(temp3, 0, sizeof(temp3));
std::cin >> a;
for (int i = ... | #include <iostream>
#include <stdio.h>
#include <string.h>
int n;
char a[1000];
int temp[1000], temp2[1000], temp3[1000];
int main() {
std::cin >> n;
while (n--) {
memset(temp, -1, sizeof(temp));
memset(temp2, -1, sizeof(temp2));
memset(temp3, 0, sizeof(temp3));
std::cin >> a;
for (int i = ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 414 | 2 |
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#define MAX_DIGIT 80
#define ERROR ("Overflow")
int main(void) {
using namespace std;
int N;
cin >> N;
vector<pair<string, string>> input;
input.reserve(N);
for (int i = 1; i <= N; i++) {
string slhs, srhs;
cin >> sl... | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#define MAX_DIGIT 80
#define ERROR ("overflow")
int main(void) {
using namespace std;
int N;
cin >> N;
vector<pair<string, string>> input;
input.reserve(N);
for (int i = 1; i <= N; i++) {
string slhs, srhs;
cin >> sl... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 1 | 475 | 2 |
#include <cstdio>
#include <iostream>
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
char moneywrite[2][1000];
int money[2][1000];
int stl[2] = {0, 0};
int stlstl;
int sum[81];
scanf("%s", moneywrite[0]);
scanf("%s", moneywrite[1]);
for (int j = 0; moneywrite[0]... | #include <cstdio>
#include <iostream>
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
char moneywrite[2][1000];
int money[2][1000];
int stl[2] = {0, 0};
int stlstl;
int sum[81];
scanf("%s", moneywrite[0]);
scanf("%s", moneywrite[1]);
for (int j = 0; moneywrite[0]... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]] | 1 | 599 | 4 |
#include <algorithm>
#include <cstring>
#include <iostream>
#include <stack>
using namespace std;
int main(void) {
string s1, s2;
stack<int> sum;
int tmp, carry, n, len1, len2;
cin >> n;
for (int i = 0; i < n; i++) {
tmp = carry = 0;
// clear stack
while (!sum.empty())
sum.pop();
cin >... | #include <algorithm>
#include <cstring>
#include <iostream>
#include <stack>
using namespace std;
int main(void) {
string s1, s2;
stack<int> sum;
int tmp, carry, n, len1, len2;
cin >> n;
for (int i = 0; i < n; i++) {
tmp = carry = 0;
while (!sum.empty())
sum.pop();
cin >> s1 >> s2;
len... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]] | 1 | 283 | 2 |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <valarray>
#include <vector>
using namespace std;
typedef lon... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <valarray>
#include <vector>
using namespace std;
typedef lon... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]] | 1 | 369 | 2 |
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
string str1, str2;
int testnum;
cin >> testnum;
int t = 0;
while (t < testnum && cin >> str1 >> str2) {
string sumstr;
reverse(str1.begin(), str1.end());
reverse(str2.begin(), str2.end());
unsigned... | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
string str1, str2;
int testnum;
cin >> testnum;
int t = 0;
while (t < testnum && cin >> str1 >> str2) {
string sumstr;
reverse(str1.begin(), str1.end());
reverse(str2.begin(), str2.end());
unsigned... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 290 | 2 |
#include <bits/stdc++.h>
using namespace std;
int f(char x) {
switch (x) {
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8;
case '... | #include <bits/stdc++.h>
using namespace std;
int f(char x) {
switch (x) {
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8;
case '... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 365 | 2 |
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
using namespace std;
string sum(string &a, string &b) {
int i = a.length() - 1;
int j = b.length() - 1;
int carry = 0;
string temp;
while (i >= 0 || j >= 0) {
int c = i >= 0 ? a[i] - '0' : 0;
int d = j ... | #include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
using namespace std;
string sum(string &a, string &b) {
int i = a.length() - 1;
int j = b.length() - 1;
int carry = 0;
string temp;
while (i >= 0 || j >= 0) {
int c = i >= 0 ? a[i] - '0' : 0;
int d = j ... | [["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["-", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120]] | 1 | 284 | 4 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define PI 3.141592653
int main() {
string A, B;
int n, Ak, Bk, ans[81];
scanf("%d", &n);
for (int ... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define PI 3.141592653
int main() {
string A, B;
int n, Ak, Bk, ans[81];
scanf("%d", &n);
for (int ... | [["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13]] | 1 | 421 | 2 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++) {
string a, b, c, d;
cin >> a;
cin >> b;
int x = max(a.length(), b.length());
for (int j = 0; j < x - a.length() + 1; j++) {
c += "0";
}
for (int j = 0; j < x - b.length() + ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
for (int i = 0; i < N; i++) {
string a, b, c, d;
cin >> a;
cin >> b;
int x = max(a.length(), b.length());
for (int j = 0; j < x - a.length() + 1; j++) {
c += "0";
}
for (int j = 0; j < x - b.length() + ... | [["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 300 | 4 |
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N, c = 0, tmp;
cin >> N;
string ans;
for (int i = 0; i < N; i++) {
ans = "";
string a, b;
cin >> a >> b;
for (int j = 0; j < max(a.length(), b.length()); j++) {
int A, B;
A = a.length() - j... | #include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N, c, tmp;
cin >> N;
string ans;
for (int i = 0; i < N; i++) {
ans = "";
c = 0;
string a, b;
cin >> a >> b;
for (int j = 0; j < max(a.length(), b.length()); j++) {
int A, B;
A = a.lengt... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 220 | 6 |
#include <iostream>
#include <string>
using namespace std;
int main() {
int n, i, j;
cin >> n;
for (i = 0; i < n; i++) {
string str1, str2, temp;
int kuriagari = 0;
cin >> str1 >> str2;
if (str1.size() < str2.size()) {
temp = str1;
str1 = str2;
str2 = temp;
}
int gouk... | #include <iostream>
#include <string>
using namespace std;
int main() {
int n, i, j;
cin >> n;
for (i = 0; i < n; i++) {
string str1, str2, temp;
int kuriagari = 0;
cin >> str1 >> str2;
if (str1.size() < str2.size()) {
temp = str1;
str1 = str2;
str2 = temp;
}
int gouk... | [["-", 15, 339, 51, 16, 31, 23, 0, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 23, 0, 16, 17, 20]] | 1 | 408 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.