problem_id
stringlengths 6
6
| language
stringclasses 2
values | original_status
stringclasses 3
values | original_src
stringlengths 19
243k
| changed_src
stringlengths 19
243k
| change
stringclasses 3
values | i1
int64 0
8.44k
| i2
int64 0
8.44k
| j1
int64 0
8.44k
| j2
int64 0
8.44k
| error
stringclasses 270
values | stderr
stringlengths 0
226k
|
---|---|---|---|---|---|---|---|---|---|---|---|
p00004 | C++ | Time Limit Exceeded | /*************************************************************************
> File Name: 23.cpp
> Author: ralph
> Mail: [email protected]
> Created Time: 2018年12月21日 星期五 21时32分48秒
************************************************************************/
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d, e, f;
while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f)) {
printf("%.3f %.3f\n",
(c * e - b * f) / (a * e - b * d) == 0
? 0.000
: (c * e - b * f) / (a * e - b * d),
(a * f - c * d) / (a * e - b * d) == 0
? 0.000
: (a * f - c * d) / (a * e - b * d));
}
}
| /*************************************************************************
> File Name: 23.cpp
> Author: ralph
> Mail: [email protected]
> Created Time: 2018年12月21日 星期五 21时32分48秒
************************************************************************/
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d, e, f;
while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) {
double ans1 = (c * e - b * f) / (a * e - b * d),
ans2 = (a * f - c * d) / (a * e - b * d);
printf("%.3f %.3f\n", ans1 == 0 ? 0 : ans1, ans2 == 0 ? 0 : ans2);
}
}
| replace | 11 | 19 | 11 | 15 | TLE | |
p00004 | C++ | Time Limit Exceeded | #include <stdio.h>
int main() {
while (1) {
float a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, x = 0, y = 0;
scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f);
y = (c * d - f * a) / (b * d - e * a);
x = (c - b * y) / a;
printf("%.3f %.3f\n", x, y);
}
return 0;
} | #include <stdio.h>
int main() {
float a, b, c, d, e, f, x, y;
while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f) != EOF) {
y = (c * d - f * a) / (b * d - e * a);
x = (c - b * y) / a;
printf("%.3f %.3f\n", x, y);
}
return 0;
} | replace | 3 | 6 | 3 | 6 | TLE | |
p00004 | C++ | Time Limit Exceeded | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
double a, b, c, d, e, f, x, y;
while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f)) {
y = (c * d - f * a) / (b * d - a * e);
x = (c - b * y) / a;
printf("%.3f %.3f\n", x, y);
}
return 0;
} | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
double a, b, c, d, e, f, x, y;
while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
y = (c * d - f * a) / (b * d - a * e);
x = (c - b * y) / a;
printf("%.3f %.3f\n", x, y);
}
return 0;
} | replace | 5 | 6 | 5 | 6 | TLE | |
p00004 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <stdio.h>
using namespace std;
double a, b, c, d, e, f;
double x, y;
int main() {
while (1) {
cin >> a >> b >> c >> d >> e >> f;
y = (c - f * a / d) / (b - e * a / d);
x = -b / a * y + c / a;
printf("%.3lf %.3lf\n", x, y);
}
} | #include <algorithm>
#include <iostream>
#include <stdio.h>
using namespace std;
double a, b, c, d, e, f;
double x, y;
int main() {
while (cin >> a >> b >> c >> d >> e >> f) {
double det = a * e - b * d;
x = (c * e - b * f) / det;
y = (a * f - c * d) / det;
if (x == -0)
x = 0;
if (y == -0)
y = 0;
printf("%.3f %.3f\n", x, y);
}
} | replace | 10 | 15 | 10 | 19 | TLE | |
p00004 | C++ | Time Limit Exceeded | #include <stdio.h>
int main() {
double a, b, c, d, e, f, x, y;
while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f)) {
x = ((c * e - f * b) / (a * e - d * b));
y = ((c - a * x) / b);
if (x > 0)
x += 0.0005;
else
x -= 0.0005;
if (y > 0)
x += 0.0005;
else
y = -0.0005;
printf("%.3ld %.3ld", x, y);
}
return 0;
} | #include <stdio.h>
int main() {
double a, b, c, d, e, f;
while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != -1) {
printf("%.3lf %.3lf\n",
(c * e - f * b) == 0 ? 0 : (c * e - f * b) / (a * e - d * b),
(c * d - a * f) == 0 ? 0 : (c * d - a * f) / (b * d - a * e));
}
return 0;
} | replace | 2 | 15 | 2 | 7 | TLE | |
p00004 | C++ | Time Limit Exceeded | #include <iostream>
int main() {
for (float a, b, c, d, e, f, x, y, g, h;
std::cin.eof() || (std::cin >> a >> b >> c >> d >> e >> f, 1);
printf("%.3f %.3f\n", x, y))
g = b * d - a * e, h = c * d - a * f,
d * g ? (x = f / d - e * h / g / d,
y = b ? c / b - a * x / b : f / e - d * x / e)
: (y = h / g, x = a ? c / a - b * y / a : f / d - e * y / d);
} | #include <iostream>
int main() {
for (float a, b, c, d, e, f, x, y, g, h;; printf("%.3f %.3f\n", x, y)) {
std::cin >> a >> b >> c >> d >> e >> f;
if (std::cin.eof())
break;
g = b * d - a * e;
h = c * d - a * f;
d *g ? (x = f / d - e * h / g / d,
y = b ? c / b - a * x / b : f / e - d * x / e)
: (y = h / g, x = a ? c / a - b * y / a : f / d - e * y / d);
}
} | replace | 2 | 9 | 2 | 12 | TLE | |
p00004 | C++ | Time Limit Exceeded | #include <iomanip>
#include <iostream>
double halfadjust(double x) {
int tmp = (x * 10000);
tmp = tmp % 10;
double ans = static_cast<double>(static_cast<int>(x * 1000));
ans = ans / 1000;
if (tmp >= 5)
ans += 0.001;
if (tmp <= -5)
ans -= 0.001;
return ans;
}
double a, b, c, d, e, f;
void solve() {
using namespace std;
double x = (c * e - b * f) / (a * e - b * d);
double y = (c * d - a * f) / (b * d - a * e);
cout << setprecision(3) << fixed << halfadjust(x) << ' ';
cout << halfadjust(y) << endl;
cout << setprecision(6);
}
int main() {
while (true) {
std::cin >> a >> b >> c >> d >> e >> f;
if (!a && !b && !c && !d && !e && !f)
break;
solve();
}
return 0;
} | #include <iomanip>
#include <iostream>
double halfadjust(double x) {
int tmp = (x * 10000);
tmp = tmp % 10;
double ans = static_cast<double>(static_cast<int>(x * 1000));
ans = ans / 1000;
if (tmp >= 5)
ans += 0.001;
if (tmp <= -5)
ans -= 0.001;
return ans;
}
double a, b, c, d, e, f;
void solve() {
using namespace std;
double x = (c * e - b * f) / (a * e - b * d);
double y = (c * d - a * f) / (b * d - a * e);
cout << setprecision(3) << fixed << halfadjust(x) << ' ';
cout << halfadjust(y) << endl;
cout << setprecision(6);
}
int main() {
using std::cin;
while (cin >> a && cin >> b && cin >> c && cin >> d && cin >> e && cin >> f) {
solve();
}
return 0;
} | replace | 27 | 31 | 27 | 29 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main(void) {
while (1) {
ll a, b, A, B;
cin >> a >> b;
A = a;
B = b;
if (a < b)
swap(a, b);
ll r = b;
while (r) {
r = a % b;
a = b;
b = r;
}
cout << a << " " << (A / a) * B << endl;
}
return 0;
} | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main(void) {
ll a, b, A, B;
while (cin >> a >> b) {
A = a;
B = b;
if (a < b)
swap(a, b);
ll r = b;
while (r) {
r = a % b;
a = b;
b = r;
}
cout << a << " " << (A / a) * B << endl;
}
return 0;
} | replace | 17 | 20 | 17 | 19 | TLE | |
p00005 | C++ | Runtime Error | #include "bits/stdc++.h"
using namespace std;
long long int GCD(long long int a, long long int b) {
return (b % a == b) ? a : GCD(b % a, a);
}
long long int LCM(long long int a, long long int b) {
return (a / GCD(a, b)) * b;
}
int main() {
long long int a, b;
while (cin >> a >> b) {
cout << GCD(a, b) << " " << LCM(a, b) << endl;
}
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
long long int GCD(long long int a, long long int b) {
return (b % a == 0) ? a : GCD(b % a, a);
}
long long int LCM(long long int a, long long int b) {
return (a / GCD(a, b)) * b;
}
int main() {
long long int a, b;
while (cin >> a >> b) {
cout << GCD(a, b) << " " << LCM(a, b) << endl;
}
return 0;
}
| replace | 4 | 5 | 4 | 5 | 0 | |
p00005 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long long int a, b, x, y, z;
while (cin >> a >> b, a, b) {
x = max(a, b);
y = min(a, b);
while (1) {
if (y == 0)
break;
z = x % y;
x = y;
y = z;
}
cout << x << ' ' << a * b / x << endl;
}
return 0;
} | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long long int a, b, x, y, z;
while (cin >> a >> b) {
x = max(a, b);
y = min(a, b);
while (1) {
if (y == 0)
break;
z = x % y;
x = y;
y = z;
}
cout << x << ' ' << a * b / x << endl;
}
return 0;
} | replace | 7 | 8 | 7 | 8 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
long long int a, b, t, aa, bb;
while (1) {
cin >> a;
if (a == 0)
break;
cin >> b;
aa = a;
bb = b;
while (1) {
if (b == 0)
break;
t = b;
b = a % b;
a = t;
}
cout << a << " " << aa * bb / a << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
long long int a, b, t, aa, bb;
while (1) {
cin >> a;
if (cin.eof())
break;
cin >> b;
aa = a;
bb = b;
while (1) {
if (b == 0)
break;
t = b;
b = a % b;
a = t;
}
cout << a << " " << aa * bb / a << endl;
}
return 0;
} | replace | 8 | 9 | 8 | 9 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <cmath>
#include <cstdio>
using namespace std;
int main() {
int a, b;
while (scanf("%d%d", &a, &b) != EOF) {
int gcd;
for (int i = 2; i <= ((a < b) ? b : a); i++) {
if ((a % i == 0) && (b % i == 0))
gcd = i;
}
printf("%d %d\n", gcd, (int)((long)a * b / (long)gcd));
}
return 0;
} | #include <cmath>
#include <cstdio>
using namespace std;
int main() {
int a, b;
while (scanf("%d%d", &a, &b) != EOF) {
int gcd = a, tmp_b = b;
int tmp;
while (tmp_b != 0) {
tmp = gcd % tmp_b;
gcd = tmp_b;
tmp_b = tmp;
}
printf("%d %d\n", gcd, (int)((long)a * b / (long)gcd));
}
return 0;
} | replace | 9 | 14 | 9 | 15 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int gcd(int x, int y) {
int amari;
while (y != 0) {
amari = x % y;
x = y;
y = amari;
}
return x;
}
int lcm(int x, int y) {
int g = gcd(x, y);
return x / g * y;
}
int main() {
int a, b;
while (true) {
cin >> a >> b;
cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
}
} | #include <iostream>
using namespace std;
int gcd(int x, int y) {
int amari;
while (y != 0) {
amari = x % y;
x = y;
y = amari;
}
return x;
}
int lcm(int x, int y) {
int g = gcd(x, y);
return x / g * y;
}
int main() {
int a, b;
while (true) {
cin >> a >> b;
if (std::cin.eof()) {
break;
}
cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
}
} | insert | 22 | 22 | 22 | 25 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int gcd(int a, int b) {
if (b = 0) {
return a;
}
return gcd(b, a % b);
}
int main() {
while (true) {
int a, b;
cin >> a >> b;
if (cin.eof())
break;
int g = gcd(a, b);
cout << g << " " << a / g * b << endl;
}
return 0;
}
| #include <iostream>
using namespace std;
int gcd(int a, int b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
int main() {
while (true) {
int a, b;
cin >> a >> b;
if (cin.eof())
break;
int g = gcd(a, b);
cout << g << " " << a / g * b << endl;
}
return 0;
}
| replace | 4 | 5 | 4 | 5 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <stdio.h>
using namespace std;
long long int n, m, ans, amari, ahokusa;
int main(void) {
while (1) {
scanf("%lld%lld", &n, &m);
ans = n * m;
if (n < m) {
ahokusa = n;
n = m;
m = ahokusa;
}
amari = n % m;
while (amari != 0) {
n = m;
m = amari;
amari = n % m;
}
ans = ans / m;
printf("%lld %lld\n", m, ans);
}
return 0;
} | #include <stdio.h>
using namespace std;
long long int n, m, ans, amari, ahokusa;
int main() {
while (scanf("%lld%lld", &n, &m) != -1) {
ans = n * m;
if (n < m) {
ahokusa = n;
n = m;
m = ahokusa;
}
amari = n % m;
while (amari != 0) {
n = m;
m = amari;
amari = n % m;
}
ans = ans / m;
printf("%lld %lld\n", m, ans);
}
return 0;
} | replace | 4 | 7 | 4 | 6 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int a, b, c, rest;
while (1) {
cin >> a >> b;
int a2 = a, b2 = b;
if (a > b) {
c = a;
a = b;
b = c;
}
while ((rest = b % a) != 0) {
b = a;
a = rest;
}
cout << a << " " << a2 / a * b2 << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int a, b, c, rest;
while (cin >> a >> b) {
int a2 = a, b2 = b;
if (a > b) {
c = a;
a = b;
b = c;
}
while ((rest = b % a) != 0) {
b = a;
a = rest;
}
cout << a << " " << a2 / a * b2 << endl;
}
return 0;
} | replace | 4 | 6 | 4 | 5 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int a, b, a1, b1, r;
int tmp = 0;
int i = 0;
while (scanf("%d %d", &a, &b)) {
if (a < b) {
tmp = a;
a = b;
b = tmp;
}
a1 = a;
b1 = b;
r = a1 % b1;
while (r != 0) {
a1 = b1;
b1 = r;
r = a1 % b1;
}
printf("%d %ld\n", b1, (long)a * b / b1);
}
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int a, b, a1, b1, r;
int tmp = 0;
int i = 0;
while (cin >> a >> b) {
if (a < b) {
tmp = a;
a = b;
b = tmp;
}
a1 = a;
b1 = b;
r = a1 % b1;
while (r != 0) {
a1 = b1;
b1 = r;
r = a1 % b1;
}
printf("%d %ld\n", b1, (long)a * b / b1);
}
return 0;
} | replace | 9 | 10 | 9 | 10 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <cstdio>
#include <iostream>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int lcm(int a, int b, int ans_gcd) {
int ans;
ans = a / ans_gcd * b;
return ans;
}
int main() {
int a, b;
int ans_gcd, ans_lcm;
while (1) { // cin >> a >> b) {
cin >> a >> b;
if ((a == 0) && (b == 0))
break;
ans_gcd = gcd(a, b);
ans_lcm = lcm(a, b, ans_gcd);
cout << ans_gcd << " " << ans_lcm << endl;
}
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int lcm(int a, int b, int ans_gcd) {
int ans;
ans = a / ans_gcd * b;
return ans;
}
int main() {
int a, b;
int ans_gcd, ans_lcm;
while (cin >> a >> b) {
if ((a == 0) && (b == 0))
break;
ans_gcd = gcd(a, b);
ans_lcm = lcm(a, b, ans_gcd);
cout << ans_gcd << " " << ans_lcm << endl;
}
return 0;
} | replace | 25 | 27 | 25 | 26 | TLE | |
p00005 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int x[2], k = 1, a, b;
while (cin >> x[1] >> x[2]) {
if (x[2] > x[1])
swap(x[1], x[2]);
a = x[1];
b = x[2];
while (x[3 - k] != 0) {
x[k] = x[k] % x[3 - k];
k = 3 - k;
}
cout << x[k] << " " << a / x[k] * b << endl;
k = 1;
}
return 0;
} | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int x[3], k = 1, a, b;
while (cin >> x[1] >> x[2]) {
if (x[2] > x[1])
swap(x[1], x[2]);
a = x[1];
b = x[2];
while (x[3 - k] != 0) {
x[k] = x[k] % x[3 - k];
k = 3 - k;
}
cout << x[k] << " " << a / x[k] * b << endl;
k = 1;
}
return 0;
} | replace | 5 | 6 | 5 | 6 | -6 | *** stack smashing detected ***: terminated
|
p00005 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cstdio>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
if (a < b)
swap(a, b);
return gcd(b, a % b);
}
int main() {
int a, b;
while (scanf("%d %d", &a, &b), &a, &b) {
int g = gcd(a, b);
printf("%d %d\n", g, a / g * b / g * g);
}
return 0;
} | #include <algorithm>
#include <cstdio>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
if (a < b)
swap(a, b);
return gcd(b, a % b);
}
int main() {
int a, b;
while (scanf("%d %d", &a, &b) != EOF) {
int g = gcd(a, b);
printf("%d %d\n", g, a / g * b / g * g);
}
return 0;
} | replace | 15 | 16 | 15 | 16 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int a, b, c, d, e, f, g, l;
while (cin >> a >> b) {
c = a;
d = b;
e = a;
f = b;
while (1) {
if (a > b) {
a %= b;
if (a == 0) {
g = b;
break;
}
} else if (a < b) {
b %= a;
if (b == 0) {
g = a;
break;
}
}
}
while (1) {
if (c > d)
d += f;
else if (c < d)
c += e;
if (c == d) {
l = c;
break;
}
}
cout << g << " " << l << endl;
}
} | #include <iostream>
using namespace std;
int main() {
int a, b, c, d, e, f, g, l;
while (cin >> a >> b) {
c = a;
d = b;
e = a;
f = b;
while (1) {
if (a >= b) {
a %= b;
if (a == 0) {
g = b;
break;
}
} else if (a < b) {
b %= a;
if (b == 0) {
g = a;
break;
}
}
}
while (1) {
if (c > d)
d += f;
else if (c < d)
c += e;
if (c == d) {
l = c;
break;
}
}
cout << g << " " << l << endl;
}
} | replace | 11 | 12 | 11 | 12 | TLE | |
p00005 | C++ | Time Limit Exceeded |
#include <algorithm>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
bool solve() {
int a, b;
while (cin >> a >> b) {
int lcm, gcd;
for (int i = min(a, b); i >= 1; i--) {
if (!(a % i) && !(b % i)) {
gcd = i;
break;
}
}
lcm = a * (b / gcd); //()必要。intの範囲のため
cout << gcd << " " << lcm << endl;
}
return true;
}
int main() {
cout.setf(ios::fixed);
cout.precision(10);
solve();
return 0;
}
|
#include <algorithm>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
bool solve() {
int a, b;
while (cin >> a >> b) {
int lcm, gcd;
int n = min(a, b);
if (!(a % n) && !(b % n)) {
gcd = n;
} else {
for (int i = n / 2; i >= 1; i--) {
if (!(a % i) && !(b % i)) {
gcd = i;
break;
}
}
}
lcm = a * (b / gcd); //()必要。intの範囲のため
cout << gcd << " " << lcm << endl;
}
return true;
}
int main() {
cout.setf(ios::fixed);
cout.precision(10);
solve();
return 0;
}
| replace | 18 | 22 | 18 | 27 | TLE | |
p00005 | C++ | Runtime Error | #include <iostream>
using namespace std;
int gcd(int m, int n) {
if ((0 == m) || (0 == n))
return 0;
while (m != n) {
if (m > n)
m = m - n;
else
n = n - m;
}
return m;
}
int lcm(int m, int n) {
if ((0 == m) || (0 == n))
return 0;
return ((m / gcd(m, n)) * n);
}
int main() {
int m, n;
cin >> m;
cin >> n;
cout << gcd(m, n) << " " << lcm(m, n) << endl;
return 1;
} | #include <iostream>
using namespace std;
int gcd(int m, int n) {
if ((0 == m) || (0 == n))
return 0;
while (m != n) {
if (m > n)
m = m - n;
else
n = n - m;
}
return m;
}
int lcm(int m, int n) {
if ((0 == m) || (0 == n))
return 0;
return ((m / gcd(m, n)) * n);
}
int main() {
int m, n;
while (cin >> m >> n) {
cout << gcd(m, n) << " " << lcm(m, n) << endl;
}
} | replace | 22 | 26 | 22 | 25 | 1 | |
p00005 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long long a, b;
while (cin >> a >> b) {
long long gcd;
long long c = max(a, b);
long long d = min(a, b);
while (true) {
if (c % d == 0) {
gcd = d;
goto C;
} else {
c -= d;
swap(c, d);
}
}
C:
cout << gcd << ' ' << a * b / gcd << endl;
}
} | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long long a, b;
while (cin >> a >> b) {
long long gcd;
long long c = max(a, b);
long long d = min(a, b);
while (true) {
if (c % d == 0) {
gcd = d;
goto C;
} else {
c -= d;
if (c <= d) {
swap(c, d);
}
}
}
C:
cout << gcd << ' ' << a * b / gcd << endl;
}
} | replace | 15 | 16 | 15 | 18 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int a, b, i;
while (cin >> a >> b) {
for (i = a; i > 0; i--) {
if (b % i == 0 && a % i == 0) {
cout << i << " ";
break;
}
// if (i == 0)
// cout << 1 << " ";
}
if (a > b)
i = a;
else
i = b;
if (a > b) {
for (i = a; i % b; i += a)
;
cout << i << endl;
} else {
for (i = b; i % a; i += b)
;
cout << i << endl;
}
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int a, b, i;
while (cin >> a >> b) {
if (a > b)
i = b;
else
i = a;
for (; i > 0; i--) {
if (b % i == 0 && a % i == 0) {
cout << i << " ";
break;
}
// if (i == 0)
// cout << 1 << " ";
}
if (a > b)
i = a;
else
i = b;
if (a > b) {
for (i = a; i % b; i += a)
;
cout << i << endl;
} else {
for (i = b; i % a; i += b)
;
cout << i << endl;
}
}
return 0;
}
| replace | 6 | 7 | 6 | 11 | TLE | |
p00005 | C++ | Runtime Error | #include <iostream>
using namespace std;
long gcd(long a, long b) { return a % b == 0 ? b : gcd(b, b % a); }
int main() {
long a, b;
while (cin >> a >> b) {
cout << gcd(a, b) << " " << a / gcd(a, b) * b << endl;
}
} | #include <iostream>
using namespace std;
long gcd(long a, long b) {
if (a < b)
return gcd(b, a);
if (a % b == 0) {
return b;
} else {
return gcd(b, a % b);
}
}
int main() {
long a, b;
while (cin >> a >> b) {
cout << gcd(a, b) << " " << a / gcd(a, b) * b << endl;
}
} | replace | 3 | 4 | 3 | 12 | 0 | |
p00005 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main(void) {
int a, b, fl;
while (cin >> a >> b) {
fl = 0;
for (int i = 1; fl == 0; i++) {
if (a % i == 0 && b % (a / i) == 0) {
cout << a / i << " ";
fl++;
} else
;
}
fl = 0;
for (int i = 1; fl == 0; i++) {
if (b % (a * i) == 0) {
cout << a * i << endl;
fl++;
} else
;
}
}
return 0;
}
| #include <iostream>
using namespace std;
int main(void) {
int a, b, fl;
while (cin >> a >> b) {
fl = 0;
for (int i = 1; fl == 0; i++) {
if (a % i == 0 && b % (a / i) == 0) {
cout << a / i << " ";
fl++;
} else
;
}
fl = 0;
for (int i = 1; fl == 0; i++) {
if ((a * i) % b == 0) {
cout << a * i << endl;
fl++;
} else
;
}
}
return 0;
}
| replace | 15 | 16 | 15 | 16 | TLE | |
p00005 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long gcd(long a, long b) { return a % b ? b : gcd(b, a % b); }
void solve(long a, long b) {
int c = gcd(a, b);
cout << c << " " << a / c * b << endl;
}
int main() {
long a, b;
while (cin >> a >> b)
solve(a, b);
} | #include <bits/stdc++.h>
using namespace std;
long gcd(long a, long b) { return a % b ? gcd(b, a % b) : b; }
void solve(long a, long b) {
int c = gcd(a, b);
cout << c << " " << a / c * b << endl;
}
int main() {
long a, b;
while (cin >> a >> b)
solve(a, b);
}
| replace | 3 | 4 | 3 | 4 | 0 | |
p00005 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
int a, b, r, G, R, L, tmp;
while (cin >> a >> b) {
R = a;
L = b;
if (b > a) {
a = tmp;
a = b;
b = tmp;
}
while (1) {
r = a % b;
if (r == 0)
break;
a = b;
b = r;
}
G = b;
R = R / G;
L = L / G;
cout << G << " " << R * L * G << endl;
}
} | #include <iostream>
using namespace std;
int main() {
int a, b, r, G, R, L, tmp;
while (cin >> a >> b) {
R = a;
L = b;
if (b > a) {
tmp = a;
a = b;
b = tmp;
}
while (1) {
r = a % b;
if (r == 0)
break;
a = b;
b = r;
}
G = b;
R = R / G;
L = L / G;
cout << G << " " << R * L * G << endl;
}
} | replace | 8 | 9 | 8 | 9 | 0 | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int gcd(int a, int b) { return b > 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int main() {
int a, b;
while (cin >> a >> b, a, b) {
cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
}
} | #include <iostream>
using namespace std;
int gcd(int a, int b) { return b > 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int main() {
int a, b;
while (cin >> a >> b) {
cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
}
} | replace | 10 | 11 | 10 | 11 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
#define CASE double
using namespace std;
int GCD(CASE x, CASE y) {
if (x == 0 || y == 0)
return x + y;
else {
if (x >= y) {
x = x - y;
GCD(x, y);
} else {
y = y - x;
GCD(x, y);
}
}
}
int main() {
CASE a, b;
unsigned long int d, l;
while (1) {
cin >> a;
cin >> b;
d = (unsigned long int)GCD(a, b);
l = a * b / d;
cout << d << " " << l << endl;
}
return 0;
} | #include <iostream>
#define CASE double
using namespace std;
int GCD(CASE x, CASE y) {
if (x == 0 || y == 0)
return x + y;
else {
if (x >= y) {
x = x - y;
GCD(x, y);
} else {
y = y - x;
GCD(x, y);
}
}
}
int main() {
CASE a, b;
unsigned long int d, l;
while (cin >> a >> b) {
d = (unsigned long int)GCD(a, b);
l = a * b / d;
cout << d << " " << l << endl;
}
return 0;
} | replace | 23 | 26 | 23 | 25 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <cmath>
#include <iostream>
using namespace std;
long long a, b;
long long gcd(long long x, long long y) {
if (b == 0)
return x;
else
return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return (x * y) / gcd(x, y); }
int main() {
while (cin >> a >> b) {
cout << gcd(a, b) << " " << lcm(a, b) << endl;
}
return 0;
} | #include <cmath>
#include <iostream>
using namespace std;
long long a, b;
long long gcd(long long x, long long y) {
if (y == 0)
return x;
else
return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return (x * y) / gcd(x, y); }
int main() {
while (cin >> a >> b) {
cout << gcd(a, b) << " " << lcm(a, b) << endl;
}
return 0;
} | replace | 7 | 8 | 7 | 8 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <cstdio>
using namespace std;
int gcdr(int a, int b) {
if (b == 0)
return a;
return gcdr(b, a % b);
}
int main() {
int a, b, gcd;
long int lcm;
while (true) {
scanf("%d%d", &a, &b);
gcd = gcdr(a, b);
// printf("%d\n",gcd);
lcm = (long)a * b / gcd;
printf("%d %ld\n", gcd, lcm);
}
return 0;
}
| #include <cstdio>
using namespace std;
int gcdr(int a, int b) {
if (b == 0)
return a;
return gcdr(b, a % b);
}
int main() {
int a, b, gcd;
long int lcm;
while (scanf("%d%d", &a, &b) != EOF) {
gcd = gcdr(a, b);
// printf("%d\n",gcd);
lcm = (long)a * b / gcd;
printf("%d %ld\n", gcd, lcm);
}
return 0;
}
| replace | 13 | 15 | 13 | 14 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int p, q;
int a, b, c;
int lcm, gcd;
while (1) {
cin >> p >> q;
if (cin.eof())
break;
if (p > q) {
a = p;
b = q;
} else {
b = p;
a = q;
}
while (a % b) {
c = a - b;
a = b;
b = c;
}
lcm = b;
gcd = p / lcm * q;
cout << lcm << " " << gcd << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int p, q;
int a, b, c;
int lcm, gcd;
while (1) {
cin >> p >> q;
if (cin.eof())
break;
if (p > q) {
a = p;
b = q;
} else {
b = p;
a = q;
}
while (a % b) {
c = a % b;
a = b;
b = c;
}
lcm = b;
gcd = p / lcm * q;
cout << lcm << " " << gcd << endl;
}
return 0;
} | replace | 21 | 22 | 21 | 22 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <cstdio>
int main() {
unsigned long a, b;
while (scanf("%lu %lu", &a, &b)) {
unsigned long max = (a > b) ? a : b, min = (a < b) ? a : b;
while (min) {
int r = max % min;
max = min;
min = r;
}
unsigned long lcm = a * b / max;
printf("%lu %lu\n", max, lcm);
}
return 0;
} | #include <cstdio>
int main() {
unsigned long a, b;
while (scanf("%lu %lu", &a, &b) != EOF) {
unsigned long max = (a > b) ? a : b, min = (a < b) ? a : b;
while (min) {
int r = max % min;
max = min;
min = r;
}
unsigned long lcm = a * b / max;
printf("%lu %lu\n", max, lcm);
}
return 0;
} | replace | 5 | 6 | 5 | 6 | TLE | |
p00005 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cstdio>
int main() {
int a, b;
while (scanf("%d%d", &a, &b))
printf("%d %d\n", std::__gcd(a, b), std::__gcd(a, b) * b);
return 0;
}
| #include <algorithm>
#include <cstdio>
int main() {
int a, b;
while (2 == scanf("%d%d", &a, &b))
printf("%d %d\n", std::__gcd(a, b), a / std::__gcd(a, b) * b);
return 0;
} | replace | 4 | 6 | 4 | 6 | TLE | |
p00006 | C++ | Time Limit Exceeded | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
int i = 0, j = str.size() - 1;
while (i < j) {
char tmp;
tmp = str[i];
str[i] = str[j];
str[j] = tmp;
}
cout << str << endl;
return 0;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
int i = 0, j = str.size() - 1;
while (i < j) {
char tmp;
tmp = str[i];
str[i] = str[j];
str[j] = tmp;
++i;
--j;
}
cout << str << endl;
return 0;
} | insert | 14 | 14 | 14 | 16 | TLE | |
p00006 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdint>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
constexpr int INF = 1000000000; /* 1e+9a */
constexpr int MODULO = 1000000007;
#define int long
#define REP(i, f, n) for (int i = (f); i < (n); ++i)
#define PER(i, f, n) for (int i = (n - 1); i >= f; --i)
constexpr int evx[4] = {1, 0, -1, 0};
constexpr int evy[4] = {0, 1, 0, -1};
//----------------------------------
//----------------------------------
signed main() {
ios::sync_with_stdio(false);
string s;
cin >> s;
PER(i, s.size(), 0)
cout << s[i];
cout << endl;
} | #include <algorithm>
#include <cmath>
#include <cstdint>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
constexpr int INF = 1000000000; /* 1e+9a */
constexpr int MODULO = 1000000007;
#define int long
#define REP(i, f, n) for (int i = (f); i < (n); ++i)
#define PER(i, f, n) for (int i = (n - 1); i >= f; --i)
constexpr int evx[4] = {1, 0, -1, 0};
constexpr int evy[4] = {0, 1, 0, -1};
//----------------------------------
//----------------------------------
signed main() {
ios::sync_with_stdio(false);
string s;
cin >> s;
PER(i, 0, s.size())
cout << s[i];
cout << endl;
} | replace | 32 | 33 | 32 | 33 | -11 | |
p00006 | C++ | Runtime Error | #include <stdio.h>
int main() {
char str[20];
int i, j;
scanf("%s", str);
for (i = 0; str[i] != '\0'; i++) {
}
for (j = i - 1; j > -1; j--) {
printf("%c", str[j]);
}
puts("");
return 0;
} | #include <stdio.h>
int main() {
char str[21];
int i, j;
scanf("%s", str);
for (i = 0; str[i] != '\0'; i++) {
}
for (j = i - 1; j > -1; j--) {
printf("%c", str[j]);
}
puts("");
return 0;
} | replace | 2 | 3 | 2 | 3 | 0 | |
p00006 | C++ | Runtime Error | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
for (int i = str.size() - 1; i >= 0; i++) {
cout << str[i];
}
cout << endl;
return 0;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
for (int i = str.size() - 1; i >= 0; i--) {
cout << str[i];
}
cout << endl;
return 0;
} | replace | 9 | 10 | 9 | 10 | -11 | |
p00006 | Python | Runtime Error | print(input[::-1])
| print(input()[::-1])
| replace | 0 | 1 | 0 | 1 | TypeError: 'builtin_function_or_method' object is not subscriptable | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p00006/Python/s441661847.py", line 1, in <module>
print(input[::-1])
TypeError: 'builtin_function_or_method' object is not subscriptable
|
p00006 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
int main(void) {
char str[20];
scanf("%s", str);
for (int i = strlen(str) - 1; i > 0; i--)
printf("%s", str[i - 1]);
printf("\n");
return 0;
} | #include <stdio.h>
#include <string.h>
int main(void) {
char str[20];
scanf("%s", str);
for (int i = strlen(str) - 1; i >= 0; i--) {
printf("%c", str[i]);
}
printf("\n");
return 0;
} | replace | 6 | 8 | 6 | 9 | -11 | |
p00006 | C++ | Runtime Error | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
for (size_t i = str.size() - 1; i >= 0; --i) {
cout << str[i];
}
cout << endl;
return 0;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
for (size_t i = str.size() - 1; i >= 0; --i) {
if (i == -1)
break;
cout << str[i];
}
cout << endl;
return 0;
} | insert | 8 | 8 | 8 | 10 | -11 | |
p00006 | C++ | Time Limit Exceeded | #include <iostream>
#include <math.h>
#include <string>
#include <vector>
int main(void);
std::string rev_string(std::string str);
int main() {
std::string str = "";
// char str[20];
std::cin >> str;
std::cout << rev_string(str) << std::endl;
while (1)
;
return 0;
}
//*
std::string rev_string(std::string str) {
int i;
int len = str.length();
for (i = 0; i < len / 2; i++) {
char temp = str[i];
str[i] = str[len - i - 1];
str[len - i - 1] = temp;
}
return str;
}
//*/
| #include <iostream>
#include <math.h>
#include <string>
#include <vector>
int main(void);
std::string rev_string(std::string str);
int main() {
std::string str = "";
// char str[20];
std::cin >> str;
std::cout << rev_string(str) << std::endl;
// while (1);
return 0;
}
//*
std::string rev_string(std::string str) {
int i;
int len = str.length();
for (i = 0; i < len / 2; i++) {
char temp = str[i];
str[i] = str[len - i - 1];
str[len - i - 1] = temp;
}
return str;
}
//*/
| replace | 14 | 16 | 14 | 15 | TLE | |
p00006 | C++ | Runtime Error | #include <cstring>
#include <iostream>
using namespace std;
int main() {
char in[20], out[20];
cin >> in;
int len = strlen(in);
for (int i = 0; i < len; i++) {
out[len - i - 1] = in[i];
}
out[len] = 0;
cout << out << endl;
return 0;
} | #include <cstring>
#include <iostream>
using namespace std;
int main() {
char in[21], out[21];
cin >> in;
int len = strlen(in);
for (int i = 0; i < len; i++) {
out[len - i - 1] = in[i];
}
out[len] = 0;
cout << out << endl;
return 0;
} | replace | 4 | 5 | 4 | 5 | 0 | |
p00006 | C++ | Runtime Error | #include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define FOR(I, F, N) for (int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout << V << endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(void) {
string S;
cin >> S;
for (int i = S.size();; i--)
cout << S[i];
cout << endl;
return 0;
}
int StrToInt(string s) {
stringstream ss;
ss << s;
int val;
ss >> val;
return val;
}
string IntToStr(int i) {
stringstream ss;
ss << i;
return ss.str();
} | #include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define FOR(I, F, N) for (int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout << V << endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(void) {
string S;
cin >> S;
for (int i = S.size(); i--;)
cout << S[i];
cout << endl;
return 0;
}
int StrToInt(string s) {
stringstream ss;
ss << s;
int val;
ss >> val;
return val;
}
string IntToStr(int i) {
stringstream ss;
ss << i;
return ss.str();
} | replace | 31 | 32 | 31 | 32 | -11 | |
p00006 | C++ | Runtime Error | #include <cstdio>
#include <cstring>
using namespace std;
int main() {
char str[20];
scanf("%s", str);
int len = strlen(str);
for (int i = len - 1; i >= 0; i--) {
printf("%c", str[i]);
}
printf("\n");
return 0;
}
| #include <cstdio>
#include <cstring>
using namespace std;
int main() {
char str[21];
scanf("%s", str);
int len = strlen(str);
for (int i = len - 1; i >= 0; i--) {
printf("%c", str[i]);
}
printf("\n");
return 0;
}
| replace | 4 | 5 | 4 | 5 | 0 | |
p00006 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main(void) {
string str;
cin >> str;
int l = str.size();
for (int i = l; i >= 0; i++) {
cout << str[i];
}
cout << endl;
return 0;
} | #include <iostream>
using namespace std;
int main(void) {
string str;
cin >> str;
int l = str.size();
for (int i = l; i > 0; i--) {
cout << str[i - 1];
}
cout << endl;
return 0;
} | replace | 7 | 9 | 7 | 9 | -11 | |
p00006 | C++ | Runtime Error | #include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
int main() {
string x;
int i;
cin >> x;
for (i = x.size();; i--) {
cout << x[i];
}
cout << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
int main() {
string x;
int i;
cin >> x;
for (i = x.size(); i--;) {
cout << x[i];
}
cout << endl;
return 0;
} | replace | 9 | 10 | 9 | 10 | -11 | |
p00006 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
string str;
cin >> str;
int n = str.size();
for (int i = n - 1; i >= 0; i++) {
cout << str[i];
}
cout << endl;
} | #include <iostream>
using namespace std;
int main() {
string str;
cin >> str;
int n = str.size();
for (int i = n - 1; i >= 0; i--) {
cout << str[i];
}
cout << endl;
} | replace | 6 | 7 | 6 | 7 | -11 | |
p00006 | C++ | Runtime Error | #include <stdio.h>
#include <string.h>
int main(void) {
char str[20], reversed_str[20];
scanf("%s", str);
int len = strlen(str);
int i;
for (i = 0; i < len; ++i) {
reversed_str[i] = str[len - 1 - i];
}
reversed_str[len] = '\0';
printf("%s\n", reversed_str);
return 0;
} | #include <stdio.h>
#include <string.h>
int main(void) {
char str[21], reversed_str[21];
scanf("%s", str);
int len = strlen(str);
int i;
for (i = 0; i < len; ++i) {
reversed_str[i] = str[len - 1 - i];
}
reversed_str[len] = '\0';
printf("%s\n", reversed_str);
return 0;
} | replace | 4 | 5 | 4 | 5 | 0 | |
p00006 | C++ | Runtime Error | #include <iostream>
#include <string>
using namespace std;
string s;
int main() {
cin >> s;
for (unsigned i = s.size() - 1; i >= 0; i--)
cout << s[i];
return 0;
} | #include <iostream>
#include <string>
using namespace std;
string s;
int main() {
cin >> s;
for (string::reverse_iterator it = s.rbegin(); it != s.rend(); it++)
cout << *it;
cout << endl;
return 0;
} | replace | 6 | 8 | 6 | 9 | -11 | |
p00006 | C++ | Runtime Error | #include <stdio.h>
int main() {
int n = 0;
char a[1000];
for (int i = 0; i < 1000; i++)
a[i] = '\0';
scanf("%s", a);
while (a[n] != '\0')
n++;
for (int i = n - 1; i >= 0; i++)
printf("%c", a[i]);
printf("\n");
} | #include <stdio.h>
int main() {
int n = 0;
char a[1000];
for (int i = 0; i < 1000; i++)
a[i] = '\0';
scanf("%s", a);
while (a[n] != '\0')
n++;
for (int i = n - 1; i >= 0; i--)
printf("%c", a[i]);
printf("\n");
} | replace | 9 | 10 | 9 | 10 | -11 | |
p00006 | C++ | Runtime Error | #include <iostream>
#include <string>
using namespace std;
int main() {
char a;
string str;
cin >> str;
for (int i = 0; i != str.size() - 1 - i; i++) {
a = str[i];
str[i] = str[str.size() - 1 - i];
str[str.size() - 1 - i] = a;
}
cout << str << endl;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
char a;
string str;
cin >> str;
for (int i = 0; i < str.size() - 1 - i; i++) {
a = str[i];
str[i] = str[str.size() - 1 - i];
str[str.size() - 1 - i] = a;
}
cout << str << endl;
} | replace | 7 | 8 | 7 | 8 | -11 | |
p00006 | C++ | Runtime Error | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
if (s.size() <= 20) {
for (int i = s.size();; i--) {
cout << s[i];
}
cout << endl;
}
return 0;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
if (s.size() <= 20) {
for (int i = s.size(); i--;) {
cout << s[i];
}
cout << endl;
}
return 0;
} | replace | 7 | 8 | 7 | 8 | -11 | |
p00006 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = s.size() - 1; i >= 0; ++i)
cout << s[i];
cout << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for (int i = s.size() - 1; i >= 0; --i)
cout << s[i];
cout << endl;
}
| replace | 9 | 10 | 9 | 10 | -11 | |
p00006 | C++ | Runtime Error | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
for (int i = str.size() - 1; i >= 0; i++)
cout << str[i];
cout << endl;
return 0;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
for (int i = str.size() - 1; i >= 0; i--)
cout << str[i];
cout << endl;
return 0;
} | replace | 8 | 9 | 8 | 9 | -11 | |
p00007 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
while (1) {
int m = 100000;
while (n--) {
m = ceil(m * 1.05 / 1000) * 1000;
}
cout << m << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n) {
int m = 100000;
while (n--) {
m = ceil(m * 1.05 / 1000) * 1000;
}
cout << m << endl;
}
return 0;
} | replace | 8 | 9 | 8 | 9 | TLE | |
p00007 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int n, debt = 100000;
cin >> n;
while (n--) {
debt = debt * 1.05;
debt += 999;
debt /= 1000;
debt *= 1000;
}
cout << debt << endl;
while (1)
;
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n, debt = 100000;
cin >> n;
while (n--) {
debt = debt * 1.05;
debt += 999;
debt /= 1000;
debt *= 1000;
}
cout << debt << endl;
return 0;
} | delete | 14 | 16 | 14 | 14 | TLE | |
p00007 | Python | Runtime Error | import math
r = 100
n = input()
for i in range(n):
r = math.ceil(r * 1.05)
print(r * 1000)
| import math
r = 100
n = int(input())
for i in range(n):
r = math.ceil(r * 1.05)
print(r * 1000)
| replace | 3 | 4 | 3 | 4 | TypeError: 'str' object cannot be interpreted as an integer | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p00007/Python/s183798433.py", line 5, in <module>
for i in range(n):
TypeError: 'str' object cannot be interpreted as an integer
|
p00008 | C++ | Time Limit Exceeded | #include <iostream>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
using namespace std;
int main() {
int n;
while (cin >> n, n) {
int co = 0;
rep(a, 10) {
rep(b, 10) {
rep(c, 10) {
if (n - a - b - c >= 0 && n - a - b - c < 10)
co++;
}
}
}
cout << co << endl;
}
} | #include <iostream>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
using namespace std;
int main() {
int n;
while (cin >> n) {
int co = 0;
rep(a, 10) {
rep(b, 10) {
rep(c, 10) {
if (n - a - b - c >= 0 && n - a - b - c < 10)
co++;
}
}
}
cout << co << endl;
}
} | replace | 6 | 7 | 6 | 7 | TLE | |
p00008 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main(void) {
int val;
while (cin >> val)
cerr << val << endl;
return 0;
} | #include <iostream>
using namespace std;
int main(void) {
int n, a[4], count;
while (cin >> n) {
count = 0;
for (a[0] = 0; a[0] < 10; a[0]++)
for (a[1] = 0; a[1] < 10; a[1]++)
for (a[2] = 0; a[2] < 10; a[2]++)
for (a[3] = 0; a[3] < 10; a[3]++)
if (a[0] + a[1] + a[2] + a[3] == n) {
count++;
break;
}
cout << count << endl;
}
return 0;
} | replace | 5 | 8 | 5 | 19 | 0 | 35
1
|
p00008 | C++ | Time Limit Exceeded | #include <iostream>
#define rep(i, a) for (int i = 0; i < a; ++i)
using namespace std;
int main(void) {
int n;
int a[4];
while (cin >> n, n) {
int count = 0;
rep(i, 10) {
rep(j, 10) {
rep(c, 10) {
rep(d, 10) {
if (i + j + c + d == n)
++count;
}
}
}
}
cout << count << endl;
}
return 0;
} | #include <iostream>
#define rep(i, a) for (int i = 0; i < a; ++i)
using namespace std;
int main(void) {
int n;
while (cin >> n) {
int a[4] = {};
int count = 0;
rep(i, 10) {
rep(j, 10) {
rep(c, 10) {
rep(d, 10) {
if (i + j + c + d == n)
++count;
}
}
}
}
cout << count << endl;
}
return 0;
} | replace | 7 | 9 | 7 | 9 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int countSolve(int a, int b, int n);
void solve(int n);
int main() {
int n;
while (1) {
cin >> n;
solve(n);
}
return 0;
}
int countSolve(int a, int b, int n) {
int x = n - a - b;
int count = 0, i = 0, j = 0;
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
if (x == i + j)
count++;
}
}
return count;
}
void solve(int n) {
int count = 0;
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 10; b++) {
count += countSolve(a, b, n);
}
}
cout << count << endl;
} | #include <iostream>
using namespace std;
int countSolve(int a, int b, int n);
void solve(int n);
int main() {
int n;
while (1) {
cin >> n;
if (cin.eof())
break;
solve(n);
}
return 0;
}
int countSolve(int a, int b, int n) {
int x = n - a - b;
int count = 0, i = 0, j = 0;
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
if (x == i + j)
count++;
}
}
return count;
}
void solve(int n) {
int count = 0;
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 10; b++) {
count += countSolve(a, b, n);
}
}
cout << count << endl;
} | insert | 10 | 10 | 10 | 12 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int combination(int n) {
int temp = 0;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
for (int k = 0; k < 10; k++)
if ((n - i - j - k) >= 0 && (n - i - j - k) < 10)
temp++;
return temp;
}
int main() {
int n;
while (1) {
cin >> n;
cout << combination(n) << endl;
}
} | #include <iostream>
using namespace std;
int combination(int n) {
int temp = 0;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
for (int k = 0; k < 10; k++)
if ((n - i - j - k) >= 0 && (n - i - j - k) < 10)
temp++;
return temp;
}
int main() {
int n;
while (cin >> n) {
cout << combination(n) << endl;
}
} | replace | 15 | 17 | 15 | 16 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <cstdio>
// #include<cmath>
// #include<iostream>
using namespace std;
int main() {
int n, i, a, b, c, d;
while (scanf("%d", &n)) {
for (i = 0, a = 0; a < 10; a++) {
for (b = 0; b < 10; b++) {
for (c = 0; c < 10; c++) {
for (d = 0; d < 10; d++) {
if (a + b + c + d == n)
i++;
}
}
}
}
printf("%d\n", i);
}
return 0;
} | #include <cstdio>
// #include<cmath>
// #include<iostream>
using namespace std;
int main() {
int n, i, a, b, c, d;
while (~scanf("%d", &n)) {
for (i = 0, a = 0; a < 10; a++) {
for (b = 0; b < 10; b++) {
for (c = 0; c < 10; c++) {
for (d = 0; d < 10; d++) {
if (a + b + c + d == n)
i++;
}
}
}
}
printf("%d\n", i);
}
return 0;
} | replace | 8 | 9 | 8 | 9 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
int cnt = 0;
for (int i = 0; i = 10; i++) {
for (int j = 0; j = 10; j++) {
for (int k = 0; k = 10; k++) {
if (0 <= n - i - j - k && n - i - j - k < 10)
cnt++;
}
}
}
cout << cnt << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
int cnt = 0;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 10; k++) {
if (0 <= n - i - j - k && n - i - j - k < 10)
cnt++;
}
}
}
cout << cnt << endl;
}
} | replace | 6 | 9 | 6 | 9 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main(void) {
int n = 0;
while (true) {
n = 0;
cin >> n;
int num = 0;
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 10; b++) {
for (int c = 0; c < 10; c++) {
for (int d = 0; d < 10; d++) {
if (a + b + c + d == n)
num++;
}
}
}
}
cout << num << '\n';
}
return 0;
} | #include <iostream>
using namespace std;
int main(void) {
int n, i = 0;
while (cin >> n) {
int num = 0;
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 10; b++) {
for (int c = 0; c < 10; c++) {
for (int d = 0; d < 10; d++) {
if (a + b + c + d == n)
num++;
}
}
}
}
cout << num << '\n';
}
return 0;
} | replace | 5 | 10 | 5 | 7 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int n, count;
while (cin >> n, n) {
count = 0;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
for (int k = 0; k < 10; k++)
for (int l = 0; l < 10; l++)
if (i + j + k + l == n)
count++;
cout << count << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n, count;
while (cin >> n && n) {
count = 0;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
for (int k = 0; k < 10; k++)
for (int l = 0; l < 10; l++)
if (i + j + k + l == n)
count++;
cout << count << endl;
}
return 0;
} | replace | 5 | 6 | 5 | 6 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
int main() {
int n;
while (std::cin >> n) {
int count = 0;
for (int a = 0; a < 10; ++a) {
for (int b = 0; a < 10; ++b) {
for (int c = 0; a < 10; ++c) {
for (int d = 0; a < 10; ++d) {
if (a + b + c + d == n) {
++count;
}
}
}
}
}
std::cout << count << std::endl;
}
return 0;
} | #include <iostream>
int main() {
int n;
while (std::cin >> n) {
int count = 0;
for (int a = 0; a < 10; ++a) {
for (int b = 0; b < 10; ++b) {
for (int c = 0; c < 10; ++c) {
for (int d = 0; d < 10; ++d) {
if (a + b + c + d == n) {
++count;
}
}
}
}
}
std::cout << count << std::endl;
}
return 0;
} | replace | 8 | 11 | 8 | 11 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <stdio.h>
#include <string.h>
int main(void) {
int n, count = 0;
while (1) {
scanf("%d", &n);
if (n == EOF)
break;
for (size_t a = 0; a <= 9; a++) {
for (size_t b = 0; b <= 9; b++) {
for (size_t c = 0; c <= 9; c++) {
for (size_t d = 0; d <= 9; d++) {
if (a + b + c + d == n) {
count++;
}
}
}
}
}
printf("%d\n", count);
count = 0;
}
return 0;
} | #include <stdio.h>
#include <string.h>
int main(void) {
int n, count = 0;
while (scanf("%d", &n) != EOF) {
for (size_t a = 0; a <= 9; a++) {
for (size_t b = 0; b <= 9; b++) {
for (size_t c = 0; c <= 9; c++) {
for (size_t d = 0; d <= 9; d++) {
if (a + b + c + d == n) {
count++;
}
}
}
}
}
printf("%d\n", count);
count = 0;
}
return 0;
} | replace | 4 | 8 | 4 | 5 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int a = 0, b = 0, c = 0, d = 0, e = 0, n, count;
while (1) {
cin >> n;
do {
if ((a + b + c + d) == n) {
count++;
}
if (a == 9 && b == 9 && c == 9 && d == 9) {
e = 1;
}
else if (b == 9 && c == 9 && d == 9) {
a++;
b = 0, c = 0, d = 0;
} else if (c == 9 && d == 9) {
b++;
c = 0, d = 0;
} else if (d == 9) {
c++;
d = 0;
} else {
d++;
}
} while (e == 0);
cout << count << endl;
count = 0, a = 0, b = 0, c = 0, d = 0, e = 0;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int a = 0, b = 0, c = 0, d = 0, e = 0, n, count;
for (int i = 1; i <= 50; i++) {
cin >> n;
do {
if ((a + b + c + d) == n) {
count++;
}
if (a == 9 && b == 9 && c == 9 && d == 9) {
e = 1;
}
else if (b == 9 && c == 9 && d == 9) {
a++;
b = 0, c = 0, d = 0;
} else if (c == 9 && d == 9) {
b++;
c = 0, d = 0;
} else if (d == 9) {
c++;
d = 0;
} else {
d++;
}
} while (e == 0);
cout << count << endl;
count = 0, a = 0, b = 0, c = 0, d = 0, e = 0;
}
return 0;
} | replace | 6 | 7 | 6 | 7 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define llong long long
int n;
int ans;
bool memo[1001];
void solve(int num, int sum, int d) {
if (d == 4) {
if (sum == num) {
ans++;
}
return;
}
if (num < sum)
return;
for (int i = 0; i <= 9; i++) {
solve(num, sum + i, d + 1);
}
return;
}
int main() {
while (cin >> n, n != EOF) {
ans = 0;
solve(n, 0, 0);
cout << ans << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define llong long long
int n;
int ans;
bool memo[1001];
void solve(int num, int sum, int d) {
if (d == 4) {
if (sum == num) {
ans++;
}
return;
}
if (num < sum)
return;
for (int i = 0; i <= 9; i++) {
solve(num, sum + i, d + 1);
}
return;
}
int main() {
while (cin >> n) {
ans = 0;
solve(n, 0, 0);
cout << ans << endl;
}
return 0;
} | replace | 27 | 28 | 27 | 28 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <cstdio>
#include <iostream>
using namespace std;
int main(void) {
int n = 0;
while (scanf("%d", &n) && n != EOF) {
int ans = 0;
for (int i = 0; i <= 9; i++) {
for (int j = 0; j <= 9; j++) {
for (int k = 0; k <= 9; k++) {
for (int l = 0; l <= 9; l++) {
if (n == i + j + k + l) {
ans++;
}
}
}
}
}
cout << ans << endl;
}
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
int main(void) {
int n = 0;
while (scanf("%d", &n) != EOF) {
int ans = 0;
for (int i = 0; i <= 9; i++) {
for (int j = 0; j <= 9; j++) {
for (int k = 0; k <= 9; k++) {
for (int l = 0; l <= 9; l++) {
if (n == i + j + k + l) {
ans++;
}
}
}
}
}
cout << ans << endl;
}
return 0;
} | replace | 8 | 9 | 8 | 9 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
#include <stdio.h>
int main() {
int n, a, b, c, d, count;
while (scanf("%d", &n)) {
count = 0;
for (a = 0; a < 10; a++) {
for (b = 0; b < 10; b++) {
for (c = 0; c < 10; c++) {
for (d = 0; d < 10; d++) {
if (a + b + c + d == n)
count = count + 1;
}
}
}
}
printf("%d\n", count);
}
return 0;
} | #include <iostream>
#include <stdio.h>
int main() {
int n, a, b, c, d, count;
while (scanf("%d", &n) == 1) {
count = 0;
for (a = 0; a < 10; a++) {
for (b = 0; b < 10; b++) {
for (c = 0; c < 10; c++) {
for (d = 0; d < 10; d++) {
if (a + b + c + d == n)
count = count + 1;
}
}
}
}
printf("%d\n", count);
}
return 0;
} | replace | 5 | 6 | 5 | 6 | TLE | |
p00008 | C++ | Time Limit Exceeded | // ↓template↓
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n) n.begin(), n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long> dij;
struct edge {
long long to, cost;
};
vector<vector<edge>> G;
long long mod_pow(long long a, long long b) {
long long res = 1, mul = a;
for (int i = 0; i < 31; ++i) {
if (b >> i & 1) {
res *= mul;
res %= MOD;
}
mul = (mul * mul) % MOD;
}
return res;
}
void addedge(int from, int to, int cost) {
G[from].push_back({to, cost});
G[to].push_back({from, cost});
}
// ↑template↑
int main() {
int n;
while (cin >> n) {
int ans = 0;
for (int i = 0; i <= 9; ++i) {
for (int j = 0; j = 9; ++j) {
for (int k = 0; k <= 9; ++k) {
int mon = n - i - j - k;
if (0 <= mon && mon <= 9) {
++ans;
}
}
}
}
cout << ans << endl;
}
}
| // ↓template↓
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n) n.begin(), n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long> dij;
struct edge {
long long to, cost;
};
vector<vector<edge>> G;
long long mod_pow(long long a, long long b) {
long long res = 1, mul = a;
for (int i = 0; i < 31; ++i) {
if (b >> i & 1) {
res *= mul;
res %= MOD;
}
mul = (mul * mul) % MOD;
}
return res;
}
void addedge(int from, int to, int cost) {
G[from].push_back({to, cost});
G[to].push_back({from, cost});
}
// ↑template↑
int main() {
int n;
while (cin >> n) {
int ans = 0;
for (int i = 0; i <= 9; ++i) {
for (int j = 0; j <= 9; ++j) {
for (int k = 0; k <= 9; ++k) {
int mon = n - i - j - k;
if (0 <= mon && mon <= 9) {
++ans;
}
}
}
}
cout << ans << endl;
}
}
| replace | 44 | 45 | 44 | 45 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int dp[40];
int main() {
for (int i = 0; i <= 9; i++) {
for (int j = 0; j <= 9; j++) {
for (int k = 0; k <= 9; k++) {
for (int l = 0; l <= 9; l++) {
dp[i + j + k + l]++;
}
}
}
}
while (true) {
int n;
cin >> n;
if (n == 0) {
break;
}
cout << dp[n] << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int dp[40];
int main() {
for (int i = 0; i <= 9; i++) {
for (int j = 0; j <= 9; j++) {
for (int k = 0; k <= 9; k++) {
for (int l = 0; l <= 9; l++) {
dp[i + j + k + l]++;
}
}
}
}
int n;
while (cin >> n) {
if (n == 0) {
break;
}
cout << dp[n] << endl;
}
return 0;
} | replace | 13 | 16 | 13 | 15 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int a, b, c, d, n, e = 0;
for (;;) {
cin >> n;
for (a = 0; a < 10; a++) {
for (b = 0; b < 10; b++) {
for (c = 0; c < 10; c++) {
for (d = 0; d < 10; d++) {
if (a + b + c + d == n)
e++;
}
}
}
}
cout << e << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int a, b, c, d, n, e;
while (cin >> n) {
e = 0;
for (a = 0; a < 10; a++) {
for (b = 0; b < 10; b++) {
for (c = 0; c < 10; c++) {
for (d = 0; d < 10; d++) {
if (a + b + c + d == n)
e++;
}
}
}
}
cout << e << endl;
}
return 0;
} | replace | 4 | 7 | 4 | 7 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int n;
int d[4][61];
int main(void) {
for (int i = 0; i <= 9; i++)
d[0][i]++;
for (int i = 0; i < 3; i++) {
for (int j = 0; j <= 9; j++) {
for (int k = 0; k <= 9 * (i + 2); k++) {
d[i + 1][k + j] += d[i][k];
}
}
}
while (cin >> n, n) {
cout << d[3][n] << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int n;
int d[4][61];
int main(void) {
for (int i = 0; i <= 9; i++)
d[0][i]++;
for (int i = 0; i < 3; i++) {
for (int j = 0; j <= 9; j++) {
for (int k = 0; k <= 9 * (i + 2); k++) {
d[i + 1][k + j] += d[i][k];
}
}
}
while (cin >> n, !cin.eof()) {
cout << d[3][n] << endl;
}
return 0;
} | replace | 19 | 20 | 19 | 20 | TLE | |
p00008 | C++ | Runtime Error | #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int n, counter = 0;
while (scanf("%d", n) == -1) {
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 10; b++) {
for (int c = 0; c < 10; c++) {
for (int d = 0; d < 10; d++) {
if (a + b + c + d == n)
counter++;
}
}
}
}
cout << counter << endl;
}
return 0;
} | #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int n, counter = 0;
while (scanf("%d", &n) != -1) {
counter = 0;
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 10; b++) {
for (int c = 0; c < 10; c++) {
for (int d = 0; d < 10; d++) {
if (a + b + c + d == n)
counter++;
}
}
}
}
cout << counter << endl;
}
return 0;
} | replace | 15 | 16 | 15 | 17 | -11 | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
int n, g, ans = 0;
while (1) {
cin >> n;
for (int a = 0; a <= 9; a++) {
for (int b = 0; b <= 9; b++) {
for (int c = 0; c <= 9; c++) {
for (int d = 0; d <= 9; d++) {
g = a + b + c + d;
if (g == n)
ans++;
}
}
}
}
cout << ans << endl;
ans = 0;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n, g, ans = 0;
while (cin >> n) {
for (int a = 0; a <= 9; a++) {
for (int b = 0; b <= 9; b++) {
for (int c = 0; c <= 9; c++) {
for (int d = 0; d <= 9; d++) {
g = a + b + c + d;
if (g == n)
ans++;
}
}
}
}
cout << ans << endl;
ans = 0;
}
return 0;
} | replace | 4 | 6 | 4 | 5 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
int func(int n) {
int count = 0;
for (int a = 0; a <= 9; a++) {
for (int b = 0; b <= 9; b++) {
for (int c = 0; c <= 9; c++) {
for (int d = 0; d <= 9; d++) {
if (a + b + c + d == n) {
count++;
}
}
}
}
}
return count;
}
int main() {
int input;
while (true) {
if (std::cin >> input) {
std::cout << func(input) << "\n";
}
}
return 0;
} | #include <iostream>
int func(int n) {
int count = 0;
for (int a = 0; a <= 9; a++) {
for (int b = 0; b <= 9; b++) {
for (int c = 0; c <= 9; c++) {
for (int d = 0; d <= 9; d++) {
if (a + b + c + d == n) {
count++;
}
}
}
}
}
return count;
}
int main() {
int input;
while (std::cin >> input) {
std::cout << func(input) << "\n";
}
return 0;
} | replace | 23 | 27 | 23 | 25 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <stdio.h>
#include <string.h>
int dp[2][51];
int main() {
while (1) {
int n;
if (0 == scanf("%d", &n)) {
break;
}
int now = 0;
for (int i = 0; i <= 50; i++) {
dp[now][i] = 0;
}
dp[now][0] = 1;
for (int k = 0; k < 4; k++) {
int nex = (now + 1) % 2;
for (int i = 0; i <= 50; i++) {
dp[nex][i] = 0;
}
for (int j = 0; j <= 50; j++) {
for (int i = 0; i <= 9; i++) {
if (j + i <= 50) {
dp[nex][j + i] += dp[now][j];
}
}
}
now = nex;
}
printf("%d\n", dp[now][n]);
}
return 0;
} | #include <stdio.h>
#include <string.h>
int dp[2][51];
int main() {
while (1) {
int n;
if (EOF == scanf("%d", &n)) {
break;
}
int now = 0;
for (int i = 0; i <= 50; i++) {
dp[now][i] = 0;
}
dp[now][0] = 1;
for (int k = 0; k < 4; k++) {
int nex = (now + 1) % 2;
for (int i = 0; i <= 50; i++) {
dp[nex][i] = 0;
}
for (int j = 0; j <= 50; j++) {
for (int i = 0; i <= 9; i++) {
if (j + i <= 50) {
dp[nex][j + i] += dp[now][j];
}
}
}
now = nex;
}
printf("%d\n", dp[now][n]);
}
return 0;
} | replace | 8 | 9 | 8 | 9 | TLE | |
p00008 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
template <class T> int streamvar(std::istream &in, T &var) {
if (!in) {
cerr << "invalid istream" << endl;
return 1;
}
in >> var;
if (in.fail()) {
cerr << "no var" << endl;
return 1;
}
return 0;
}
template <class T> int streamvec(std::istream &in, std::vector<T> &v) {
v.clear();
string s;
if (!in) {
cerr << "invalid istream" << endl;
return 1;
}
getline(in, s);
if (in.fail()) {
cerr << "no line" << endl;
return 1;
}
istringstream is(s);
while (1) {
T tmp;
is >> tmp;
if (is.fail())
break;
v.push_back(tmp);
}
return 0;
}
int main(void) {
int n;
while (!streamvar(cin, n)) {
int counter = 0;
for (int a = 0; a < 10; a++)
for (int b = 0; b < 10; b++)
for (int c = 0; c < 10; c++)
for (int d = 0; d < 10; d++)
if (a + b + c + d == n)
counter++;
cout << counter << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
template <class T> int streamvar(std::istream &in, T &var) {
if (!in) {
cerr << "invalid istream" << endl;
return 1;
}
in >> var;
if (in.fail()) {
// cerr << "no var" << endl;
return 1;
}
return 0;
}
template <class T> int streamvec(std::istream &in, std::vector<T> &v) {
v.clear();
string s;
if (!in) {
cerr << "invalid istream" << endl;
return 1;
}
getline(in, s);
if (in.fail()) {
cerr << "no line" << endl;
return 1;
}
istringstream is(s);
while (1) {
T tmp;
is >> tmp;
if (is.fail())
break;
v.push_back(tmp);
}
return 0;
}
int main(void) {
int n;
while (!streamvar(cin, n)) {
int counter = 0;
for (int a = 0; a < 10; a++)
for (int b = 0; b < 10; b++)
for (int c = 0; c < 10; c++)
for (int d = 0; d < 10; d++)
if (a + b + c + d == n)
counter++;
cout << counter << endl;
}
return 0;
} | replace | 17 | 18 | 17 | 18 | 0 | no var
|
p00008 | C++ | Time Limit Exceeded | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int cnt;
while (1) {
int num;
cin >> num;
cnt = 0;
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 10; b++) {
for (int c = 0; c < 10; c++) {
for (int d = 0; d < 10; d++) {
if (a + b + c + d == num) {
cnt++;
}
}
}
}
}
printf("%d\n", cnt);
}
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int cnt;
int num;
while (cin >> num) {
cnt = 0;
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 10; b++) {
for (int c = 0; c < 10; c++) {
for (int d = 0; d < 10; d++) {
if (a + b + c + d == num) {
cnt++;
}
}
}
}
}
printf("%d\n", cnt);
}
return 0;
} | replace | 6 | 9 | 6 | 8 | TLE | |
p00008 | C++ | Time Limit Exceeded |
#include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n) {
int cnt = 0;
for (int i = 0; i <= 9; ++i)
for (int j = 0; i <= 9; ++j)
for (int k = 0; k <= 9; ++k)
for (int l = 0; l <= 9; ++l)
if (i + j + k + l == n)
++cnt;
cout << cnt << endl;
}
return 0;
} |
#include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n) {
int cnt = 0;
for (int i = 0; i <= 9; ++i)
for (int j = 0; j <= 9; ++j)
for (int k = 0; k <= 9; ++k)
for (int l = 0; l <= 9; ++l)
if (i + j + k + l == n)
++cnt;
cout << cnt << endl;
}
return 0;
} | replace | 10 | 11 | 10 | 11 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int a, b, c, d, n, x, sum = 0;
for (;;) {
cin >> x;
for (a = 0; a <= 9; a++) {
for (b = 0; b <= 9; b++) {
for (c = 0; c <= 9; c++) {
for (d = 0; d <= 9; d++) {
n = a + b + c + d;
if (x == n) {
sum++;
}
}
}
}
}
cout << sum << endl;
sum = 0;
}
return 0;
} | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int a, b, c, d, n, x, sum = 0, i;
for (i = 0; i < 50; i++) {
cin >> x;
for (a = 0; a <= 9; a++) {
for (b = 0; b <= 9; b++) {
for (c = 0; c <= 9; c++) {
for (d = 0; d <= 9; d++) {
n = a + b + c + d;
if (x == n) {
sum++;
}
}
}
}
}
cout << sum << endl;
sum = 0;
}
return 0;
} | replace | 4 | 6 | 4 | 6 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main(void) {
int dp[50][4];
for (int i = 0; i < 50; i++) {
for (int j = 0; i < 4; j++) {
if (i < 10 && j == 0)
dp[i][j] = 1;
else
dp[i][j] = 0;
}
}
for (int i = 1; i < 4; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 37; k++) {
if (k - j >= 0) {
dp[k][i] += dp[k - j][i - 1];
}
}
}
}
int n;
while (cin >> n) {
cout << dp[n][3] << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main(void) {
int c;
while (cin >> c) {
int cnt = 0;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
for (int k = 0; k < 10; k++)
for (int l = 0; l < 10; l++)
if (i + j + k + l == c)
cnt++;
cout << cnt << endl;
}
return 0;
} | replace | 4 | 27 | 4 | 14 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;
int main() {
while (1) {
int n;
cin >> n;
int cnt = 0;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
for (int k = 0; k < 10; k++)
for (int l = 0; l < 10; l++) {
if (i + j + k + l == n) {
cnt++;
}
}
cout << cnt << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;
int main() {
int n;
while (scanf("%d", &n) != EOF) {
int cnt = 0;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
for (int k = 0; k < 10; k++)
for (int l = 0; l < 10; l++) {
if (i + j + k + l == n) {
cnt++;
}
}
cout << cnt << endl;
}
return 0;
}
| replace | 8 | 12 | 8 | 10 | TLE | |
p00008 | C++ | Time Limit Exceeded | #include <stdio.h>
int main(void) {
int num, cnt = 0;
int i, j, k, l;
while (scanf("%d", &num)) {
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
for (k = 0; k < 10; k++) {
for (l = 0; l < 10; l++) {
if (i + j + k + l == num) {
cnt++;
}
}
}
}
}
printf("%d\n", cnt);
cnt = 0;
}
return 0;
} | #include <stdio.h>
int main(void) {
int num, cnt = 0;
int i, j, k, l;
while (scanf("%d", &num) != EOF) {
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
for (k = 0; k < 10; k++) {
for (l = 0; l < 10; l++) {
if (i + j + k + l == num) {
cnt++;
}
}
}
}
}
printf("%d\n", cnt);
cnt = 0;
}
return 0;
} | replace | 6 | 7 | 6 | 7 | TLE | |
p00009 | C++ | Time Limit Exceeded | #include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <set>
#include <vector>
std::vector<std::size_t> prime_table = {2};
void make_prime_table() {
std::set<std::size_t> undefined_table;
for (std::size_t i = 3; i <= 999999; ++i) {
undefined_table.insert(i);
}
const std::size_t sn = 1000;
for (std::size_t p = 0; !undefined_table.empty() && p < prime_table.size();
++p) {
for (auto u = undefined_table.begin(); u != undefined_table.end();) {
if (0 == *u % prime_table[p]) {
u = undefined_table.erase(u);
} else {
++u;
}
}
if (!undefined_table.empty()) {
prime_table.push_back(*undefined_table.begin());
undefined_table.erase(undefined_table.begin());
if (sn <= prime_table.back()) {
break;
}
}
}
prime_table.insert(prime_table.end(), undefined_table.begin(),
undefined_table.end());
}
std::array<std::size_t, 1000000> prime_acc = {{0, 0}};
void make_prime_acc() {
std::size_t acc_found = 1;
for (auto p = prime_table.begin(); p != prime_table.end(); ++p) {
std::fill_n(prime_acc.begin() + acc_found + 1, *p - acc_found - 1,
prime_acc[acc_found]);
acc_found = *p;
prime_acc[acc_found] = prime_acc[acc_found - 1] + 1;
}
std::fill(prime_acc.begin() + acc_found + 1, prime_acc.end(),
prime_acc[acc_found]);
}
int main() {
make_prime_table();
make_prime_acc();
std::size_t n;
while (std::cin >> n, !std::cin.eof()) {
std::cout << prime_acc[n] << std::endl;
}
} | #include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <set>
#include <vector>
std::vector<std::size_t> prime_table = {2};
void make_prime_table() {
std::set<std::size_t> undefined_table;
for (std::size_t i = 3; i <= 999999; i += 2) {
undefined_table.insert(i);
}
const std::size_t sn = 1000;
for (std::size_t p = 0; !undefined_table.empty() && p < prime_table.size();
++p) {
for (auto u = undefined_table.begin(); u != undefined_table.end();) {
if (0 == *u % prime_table[p]) {
u = undefined_table.erase(u);
} else {
++u;
}
}
if (!undefined_table.empty()) {
prime_table.push_back(*undefined_table.begin());
undefined_table.erase(undefined_table.begin());
if (sn <= prime_table.back()) {
break;
}
}
}
prime_table.insert(prime_table.end(), undefined_table.begin(),
undefined_table.end());
}
std::array<std::size_t, 1000000> prime_acc = {{0, 0}};
void make_prime_acc() {
std::size_t acc_found = 1;
for (auto p = prime_table.begin(); p != prime_table.end(); ++p) {
std::fill_n(prime_acc.begin() + acc_found + 1, *p - acc_found - 1,
prime_acc[acc_found]);
acc_found = *p;
prime_acc[acc_found] = prime_acc[acc_found - 1] + 1;
}
std::fill(prime_acc.begin() + acc_found + 1, prime_acc.end(),
prime_acc[acc_found]);
}
int main() {
make_prime_table();
make_prime_acc();
std::size_t n;
while (std::cin >> n, !std::cin.eof()) {
std::cout << prime_acc[n] << std::endl;
}
} | replace | 11 | 12 | 11 | 12 | TLE | |
p00009 | C++ | Memory Limit Exceeded | #include <iostream>
using namespace std;
//??¨??????????????????????????§?´???°??¨?????????
//?´???°??¨??¨?´???????????????£?????????????????§??¨????????????
const int MAX_V = 10000000;
int prime[MAX_V + 1]; //?´???°??¨
int sum[MAX_V + 1]; //?´???°?????°???????¨?
int main() {
int i, k, v;
prime[0] = prime[1] = 0;
for (i = 2; i <= MAX_V; i++) {
prime[i] = 1;
}
for (i = 2; i * i <= MAX_V; i++) {
if (prime[i]) {
for (k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0;
}
}
}
sum[0] = 0;
for (i = 0; i < MAX_V + 1; i++) {
sum[i + 1] = sum[i] + prime[i + 1];
}
int input;
while (cin >> input) {
cout << sum[input] << endl;
}
return 0;
} | #include <iostream>
using namespace std;
//??¨??????????????????????????§?´???°??¨?????????
//?´???°??¨??¨?´???????????????£?????????????????§??¨????????????
const int MAX_V = 999999;
int prime[MAX_V + 1]; //?´???°??¨
int sum[MAX_V + 1]; //?´???°?????°???????¨?
int main() {
int i, k, v;
prime[0] = prime[1] = 0;
for (i = 2; i <= MAX_V; i++) {
prime[i] = 1;
}
for (i = 2; i * i <= MAX_V; i++) {
if (prime[i]) {
for (k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0;
}
}
}
sum[0] = 0;
for (i = 0; i < MAX_V + 1; i++) {
sum[i + 1] = sum[i] + prime[i + 1];
}
int input;
while (cin >> input) {
cout << sum[input] << endl;
}
return 0;
} | replace | 6 | 7 | 6 | 7 | MLE | |
p00009 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define LOG(...) fprintf(stderr, __VA_ARGS__)
// #define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAX_VALUE = 100007;
bool prime[MAX_VALUE];
int main() {
FOR(i, 2, MAX_VALUE) {
if (prime[i])
continue;
for (int j = i * 2; j < MAX_VALUE; j += i)
prime[j] = true;
}
int n;
while (cin >> n) {
int cnt = 0;
FOR(i, 2, n + 1) {
if (!prime[i])
cnt++;
}
cout << cnt << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
#define LOG(...) fprintf(stderr, __VA_ARGS__)
// #define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAX_VALUE = 1000007;
bool prime[MAX_VALUE];
int main() {
FOR(i, 2, MAX_VALUE) {
if (prime[i])
continue;
for (int j = i * 2; j < MAX_VALUE; j += i)
prime[j] = true;
}
int n;
while (cin >> n) {
int cnt = 0;
FOR(i, 2, n + 1) {
if (!prime[i])
cnt++;
}
cout << cnt << endl;
}
} | replace | 26 | 27 | 26 | 27 | 0 | |
p00009 | C++ | Runtime Error | #include <iostream>
#include <vector>
#define MAX 100000
using namespace std;
int main() {
// bool num[MAX];
pair<bool, int> num[MAX];
int input = 0;
while (cin >> input) {
int count = 0;
for (int i = 2; i < MAX; i++) {
num[i].first = true;
num[i].second = i;
}
for (int i = 2; i < input + 1; i++) {
if (num[i].first) {
// cout << num[i].second <<",";
count++;
for (int j = i + i; j < MAX; j += i) {
num[j].first = false;
}
}
}
cout << count << endl;
}
} | #include <iostream>
#include <vector>
#define MAX 1000000
using namespace std;
int main() {
// bool num[MAX];
pair<bool, int> num[MAX];
int input = 0;
while (cin >> input) {
int count = 0;
for (int i = 2; i < MAX; i++) {
num[i].first = true;
num[i].second = i;
}
for (int i = 2; i < input + 1; i++) {
if (num[i].first) {
// cout << num[i].second <<",";
count++;
for (int j = i + i; j < MAX; j += i) {
num[j].first = false;
}
}
}
cout << count << endl;
}
} | replace | 2 | 3 | 2 | 3 | 0 | |
p00009 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
int N;
bool is_prime[1000000];
is_prime[0] = 0;
is_prime[1] = 0;
for (int i = 2; i < 1000000; i++) {
is_prime[i] = 1;
}
for (int s = 2; s < 1000000; s++) {
if (is_prime[s] == 1) {
for (long long i = s * s; i < 1000000; i += s) {
is_prime[i] = 0;
}
}
}
while (cin >> N) {
int ans = 0;
for (int i = 2; i < N + 1; i++) {
ans += is_prime[i];
}
cout << ans << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int N;
bool is_prime[1000000];
is_prime[0] = 0;
is_prime[1] = 0;
for (int i = 2; i < 1000000; i++) {
is_prime[i] = 1;
}
for (long s = 2; s < 1000000; s++) {
if (is_prime[s] == 1) {
for (long long i = s * s; i < 1000000; i += s) {
is_prime[i] = 0;
}
}
}
while (cin >> N) {
int ans = 0;
for (int i = 2; i < N + 1; i++) {
ans += is_prime[i];
}
cout << ans << endl;
}
return 0;
} | replace | 12 | 13 | 12 | 13 | -11 | |
p00009 | C++ | Runtime Error | #include <iostream>
using namespace std;
int main() {
bool a[1000000];
a[0] = a[1] = false;
for (int i = 2; i < 1000000; i++) {
a[i] = true;
}
for (int i = 2; i * i < 1000000; i++) {
if (a[i]) {
for (int j = i * i; j < 10000000; j += i) {
a[j] = false;
}
}
}
int n[1000000];
int tmp = 0;
for (int i = 0; i < 1000000; i++) {
if (a[i]) {
tmp++;
}
n[i] = tmp;
}
while (true) {
int m;
cin >> m;
if (cin.eof()) {
break;
}
cout << n[m] << endl;
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
bool a[1000000];
a[0] = a[1] = false;
for (int i = 2; i < 1000000; i++) {
a[i] = true;
}
for (int i = 2; i * i < 1000000; i++) {
if (a[i]) {
for (int j = i * i; j < 1000000; j += i) {
a[j] = false;
}
}
}
int n[1000000];
int tmp = 0;
for (int i = 0; i < 1000000; i++) {
if (a[i]) {
tmp++;
}
n[i] = tmp;
}
while (true) {
int m;
cin >> m;
if (cin.eof()) {
break;
}
cout << n[m] << endl;
}
return 0;
}
| replace | 13 | 14 | 13 | 14 | -11 | |
p00009 | C++ | Runtime Error | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i, a, b) for (int i = (a); i < ((int)b); ++i)
#define RFOR(i, a) for (int i = (a); i >= 0; --i)
#define FOE(i, a) for (auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14
using namespace std;
// nまでの素数のリストを作成(nを含む) O(N log long N)
vector<int> make_prime_list(int n) {
vector<bool> is_prime(n + 1, true);
is_prime[0] = false;
is_prime[1] = false;
vector<int> prime_list;
for (int i = 2; i < n + 1; ++i) {
if (!is_prime[i]) {
continue;
}
prime_list.emplace_back(i);
for (int j = i; j < n + 1; j += i) {
is_prime[j] = false;
}
}
return prime_list;
}
int main(int argc, char *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
vector<int> prime_list = make_prime_list(1000001);
int n;
while (cin >> n) {
int ans = 0;
for (int i = 0;; ++i) {
if (prime_list[i] <= n) {
ans++;
} else {
break;
}
}
cout << ans << endl;
}
return 0;
}
| #include <algorithm>
#include <assert.h>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i, a, b) for (int i = (a); i < ((int)b); ++i)
#define RFOR(i, a) for (int i = (a); i >= 0; --i)
#define FOE(i, a) for (auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14
using namespace std;
// nまでの素数のリストを作成(nを含む) O(N log long N)
vector<int> make_prime_list(int n) {
vector<bool> is_prime(n + 1, true);
is_prime[0] = false;
is_prime[1] = false;
vector<int> prime_list;
for (int i = 2; i < n + 1; ++i) {
if (!is_prime[i]) {
continue;
}
prime_list.emplace_back(i);
for (int j = i; j < n + 1; j += i) {
is_prime[j] = false;
}
}
return prime_list;
}
int main(int argc, char *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
vector<int> prime_list = make_prime_list(1000100);
int n;
while (cin >> n) {
int ans = 0;
for (int i = 0;; ++i) {
if (prime_list[i] <= n) {
ans++;
} else {
break;
}
}
cout << ans << endl;
}
return 0;
}
| replace | 66 | 67 | 66 | 67 | 0 | |
p00009 | C++ | Runtime Error | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> p;
int n;
p.push_back(2);
for (int i = 3; i < 999999; i++) {
for (int j = 0;; j++) {
if (i % p[j] == 0)
break;
if (i < p[j] * p[j]) {
p.push_back(i);
break;
}
}
}
while (cin >> n) {
int i = 0;
while (n >= p[i]) {
i++;
}
cout << i << endl;
}
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> p;
int n;
p.push_back(2);
for (int i = 3; i < 999999; i++) {
for (int j = 0;; j++) {
if (i % p[j] == 0)
break;
if (i < p[j] * p[j]) {
p.push_back(i);
break;
}
}
}
p.push_back(9999999);
while (cin >> n) {
int i = 0;
while (n >= p[i]) {
i++;
}
cout << i << endl;
}
return 0;
} | insert | 18 | 18 | 18 | 19 | 0 | |
p00009 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int f[1000001];
int main() {
fill_n(f, 1000001, 1);
f[0] = f[1] = 0;
for (int i = 2; i < 1000001; i++) {
f[i] += f[i - 1];
if (!f[i])
continue;
for (int j = i + i; j < 1000001; j += i)
f[j] = 0;
}
int N;
while (scanf("%d", &N), &N) {
printf("%d\n", f[N]);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int f[1000001];
int main() {
fill_n(f, 1000001, 1);
f[0] = f[1] = 0;
for (int i = 2; i < 1000001; i++) {
f[i] += f[i - 1];
if (!f[i])
continue;
for (int j = i + i; j < 1000001; j += i)
f[j] = 0;
}
int N;
while (scanf("%d", &N) != EOF) {
printf("%d\n", f[N]);
}
return 0;
} | replace | 18 | 19 | 18 | 19 | TLE | |
p00009 | C++ | Runtime Error | #include <cstdio>
#include <iostream>
using namespace std;
const int maxn = 1e6 + 7;
int prime[maxn];
bool is_prime[maxn];
int n, p = -1;
void Eular() {
for (int i = 1; i <= maxn - 7; i++)
is_prime[i] = true;
for (int i = 2; i <= maxn - 7; i++) {
if (is_prime[i])
prime[++p] = i;
for (int j = 0; j <= p && i * prime[j] <= maxn - 7; j++)
is_prime[i * prime[j]] = false;
}
}
int main() {
Eular();
while (~scanf("%d", &n)) {
int i = 0, ans = 0;
while (prime[i] <= n)
i++, ans++;
printf("%d\n", ans);
}
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
const int maxn = 1e6 + 7;
int prime[maxn];
bool is_prime[maxn];
int n, p = -1;
void Eular() {
for (int i = 1; i <= maxn - 7; i++)
is_prime[i] = true;
for (int i = 2; i <= maxn - 7; i++) {
if (is_prime[i])
prime[++p] = i;
for (int j = 0; j <= p && i * prime[j] <= maxn - 7; j++)
is_prime[i * prime[j]] = false;
}
}
int main() {
Eular();
while (~scanf("%d", &n)) {
int i = 0, ans = 0;
while (i <= p && prime[i] <= n)
i++, ans++;
printf("%d\n", ans);
}
return 0;
} | replace | 23 | 24 | 23 | 24 | 0 |