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
p00001
C++
Runtime Error
#include <algorithm> #include <cstdio> using namespace std; int main(void) { int i, array[10]; for (i = 0; i < 10; i++) scanf("%d", &array[i]); sort(array, array + 10); for (i = 9; i >= 7; i++) printf("%d\n", array[i]); return 0; }
#include <algorithm> #include <cstdio> using namespace std; int main(void) { int i, array[10]; for (i = 0; i < 10; i++) scanf("%d", &array[i]); sort(array, array + 10); for (i = 9; i >= 7; i--) printf("%d\n", array[i]); return 0; }
replace
11
12
11
12
-11
p00001
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> typedef long long ll; using namespace std; int main(void) { int h[10]; for (int i = 0; i < 10; i++) { cin >> h[i]; } sort(h, h + 10, greater<int>()); cout << h[0] << endl << h[1] << endl << h[2]; while (1) ; return 0; }
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> typedef long long ll; using namespace std; int main(void) { int h[10]; for (int i = 0; i < 10; i++) { cin >> h[i]; } sort(h, h + 10, greater<int>()); cout << h[0] << endl << h[1] << endl << h[2] << endl; return 0; }
replace
35
38
35
36
TLE
p00001
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { vector<int> line; int pro; for (int i = 0; i < 10; ++i) { cin >> pro; line.push_back(pro); } sort(line.begin(), line.end()); for (int i = 9; i > 6; -i) { cout << line[i] << endl; } return 0; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { vector<int> line; int pro; for (int i = 0; i < 10; ++i) { cin >> pro; line.push_back(pro); } sort(line.begin(), line.end()); for (int i = 9; i > 6; --i) { cout << line[i] << endl; } return 0; }
replace
12
13
12
13
TLE
p00001
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int a[10]; for (int i = 0; i < 10; i++) { cin >> a[i]; } sort(a, a + 10); for (int i = 9; i > 6; i++) { cout << a[i] << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a[10]; for (int i = 0; i < 10; i++) { cin >> a[i]; } sort(a, a + 10); for (int i = 9; i > 6; i--) { cout << a[i] << endl; } return 0; }
replace
9
10
9
10
-11
p00001
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int main() { int i, m[10]; for (i = 0; i < 10; i++) { while (1) { cin >> m[i]; if (m[i] > 0 && m[i] < 10001) break; } } sort(m, m + 10); for (i = 9; i > 6; i--) { cout << m[i] << endl; } }
#include <algorithm> #include <iostream> using namespace std; int main() { int i, m[10]; for (i = 0; i < 10; i++) { cin >> m[i]; } sort(m, m + 10); for (i = 9; i > 6; i--) { cout << m[i] << endl; } }
replace
9
14
9
10
TLE
p00001
C++
Time Limit Exceeded
#include <stdio.h> int main(void) { int a = 0, b = 0, c = 0, n, t; while (scanf("%d", &n)) { if (n > a) t = n, n = a, a = t; if (n > b) t = n, n = b, b = t; if (n > c) c = n; } printf("%d\n%d\n%d\n", a, b, c); return 0; }
#include <stdio.h> int main(void) { int a = 0, b = 0, c = 0, n, t; while (scanf("%d", &n) > 0) { if (n > a) t = n, n = a, a = t; if (n > b) t = n, n = b, b = t; if (n > c) c = n; } printf("%d\n%d\n%d\n", a, b, c); return 0; }
replace
3
4
3
4
TLE
p00001
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, a[50]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n); for (int i = n; i >= n - 2; i--) { cout << a[i] << endl; } }
#include <bits/stdc++.h> using namespace std; int n, a[50]; int main() { n = 10; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + 1 + n); for (int i = n; i >= n - 2; i--) { cout << a[i] << endl; } }
replace
4
5
4
5
-11
p00001
C++
Runtime Error
#include <algorithm> #include <cstdio> using namespace std; const int N = 10; int a[N]; int main() { for (int i = 0; i < N; i++) { scanf("%d", &a[i]); } sort(a, a + N); for (int i = N - 1; i > N - 4; i++) printf("%d/n", a[i]); }
#include <algorithm> #include <cstdio> using namespace std; const int N = 10; int a[N]; int main() { for (int i = 0; i < N; i++) { scanf("%d", &a[i]); } sort(a, a + N); for (int i = 1; i < 4; i++) printf("%d\n", a[N - i]); }
replace
13
15
13
15
-11
p00001
C++
Runtime Error
#include <stdio.h> int main() { int height[10], rank[3] = {0}; int i; for (i = 0; i < 10; i++) { scanf("%d\n", height[i]); if (rank[0] < height[i]) { rank[2] = rank[1]; rank[1] = rank[0]; rank[0] = height[i]; } else if (rank[1] < height[i]) { rank[2] = rank[1]; rank[1] = height[i]; } else if (rank[2] < height[i]) { rank[2] = height[i]; } } for (i = 0; i < 3; i++) { printf("%d\n", rank[i]); } return 0; }
#include <stdio.h> int main() { int height[10], rank[3] = {0}; int i; for (i = 0; i < 10; i++) { scanf("%d\n", &height[i]); if (rank[0] < height[i]) { rank[2] = rank[1]; rank[1] = rank[0]; rank[0] = height[i]; } else if (rank[1] < height[i]) { rank[2] = rank[1]; rank[1] = height[i]; } else if (rank[2] < height[i]) { rank[2] = height[i]; } } for (i = 0; i < 3; i++) { printf("%d\n", rank[i]); } return 0; }
replace
7
8
7
8
-11
p00001
C++
Runtime Error
#include <stdio.h> int main(void) { int i, j, n[10], w; for (i = 0; i < 10; i++) { scanf("%d", n[i]); } for (i = 0; i < 10; i++) { for (j = 0; j <= 10; j++) { if (n[j] <= n[i]) { w = n[i]; n[i] = n[j]; n[j] = w; } } } for (i = 0; i < 3; i++) { printf("%d\n", n[i]); } return 0; }
#include <stdio.h> int main(void) { int i, j, n[10], w; for (i = 0; i < 10; i++) { scanf("%d", &n[i]); } for (i = 0; i < 10; i++) { for (j = 0; j <= 10; j++) { if (n[j] <= n[i]) { w = n[i]; n[i] = n[j]; n[j] = w; } } } for (i = 0; i < 3; i++) { printf("%d\n", n[i]); } return 0; }
replace
4
5
4
5
-11
p00001
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { vector<int> mountain; for (int i = 0; i < 10; i++) { cin >> mountain.at(i); } sort(mountain.begin(), mountain.end()); reverse(mountain.begin(), mountain.end()); for (int i = 0; i < 3; i++) { cout << mountain.at(i) << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { vector<int> mountain(10); for (int i = 0; i < 10; i++) { cin >> mountain.at(i); } sort(mountain.begin(), mountain.end()); reverse(mountain.begin(), mountain.end()); for (int i = 0; i < 3; i++) { cout << mountain.at(i) << endl; } }
replace
4
5
4
5
-6
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
p00001
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define EXIST(s, e) ((s).find(e) != (s).end()) #define EXIST2(s, e) (find(ALL(s), (e)) != (s).end()) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define EACH(t, i, c) for (t::iterator i = (c).begin(); i != (c).end(); ++i) const double EPS = 1e-10; const double PI = acos(-1.0); int main() { vi a; REP(i, 10) { cin >> a[i]; } sort(RALL(a)); cout << a[0] << endl; cout << a[1] << endl; cout << a[2] << endl; }
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define EXIST(s, e) ((s).find(e) != (s).end()) #define EXIST2(s, e) (find(ALL(s), (e)) != (s).end()) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define EACH(t, i, c) for (t::iterator i = (c).begin(); i != (c).end(); ++i) const double EPS = 1e-10; const double PI = acos(-1.0); int main() { vi a(10); REP(i, 10) { cin >> a[i]; } sort(RALL(a)); cout << a[0] << endl; cout << a[1] << endl; cout << a[2] << endl; }
replace
49
50
49
50
-11
p00001
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; void bubbleSort(vector<int> &h) { int tmp; for (int i = 0; i < h.size() - 1; i++) { for (int j = 0; j < h.size() - 1 - i; j++) { if (h[j] < h[j + 1]) { tmp = h[j + 1]; h[j + 1] = h[j]; h[j] = tmp; } } } } int main() { vector<int> height(10); for (int i = 0; i < 10; i++) { cin >> height[i]; } bubbleSort(height); for (int i : height) { cout << i << endl; } return 0; }
#include <iostream> #include <vector> using namespace std; void bubbleSort(vector<int> &h) { int tmp; for (int i = 0; i < h.size() - 1; i++) { for (int j = 0; j < h.size() - 1 - i; j++) { if (h[j] < h[j + 1]) { tmp = h[j + 1]; h[j + 1] = h[j]; h[j] = tmp; } } } } int main() { vector<int> height(10); for (int i = 0; i < 10; i++) { cin >> height[i]; } bubbleSort(height); for (int i = 0; i < 3; i++) { cout << height[i] << endl; } return 0; }
replace
23
25
23
25
TLE
p00001
Python
Runtime Error
num = [int(input()) for i in range(10)] num.sort(reverse=True) for i in range[0:3]: print(num[i])
num = [int(input()) for i in range(10)] num.sort(reverse=True) for i in range(3): print(num[i])
replace
2
3
2
3
TypeError: 'type' object is not subscriptable
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p00001/Python/s016107060.py", line 3, in <module> for i in range[0:3]: TypeError: 'type' object is not subscriptable
p00001
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { bool flag; int result[3], buf, temp[10]; for (int i = 0; i < 10; i++) { cin >> temp[i]; } for (int l = 0; l < 3; l++) { while (1) { for (int j = l; j < 9; j++) { if (temp[j] < temp[j + 1]) { buf = temp[j + 1]; temp[j + 1] = temp[j]; temp[j] = buf; } } flag = false; for (int k = 0; k < 9; k++) { if (temp[l] < temp[k]) flag = true; } if (flag != true) { result[l] = temp[l]; break; } } } cout << result[0] << endl; cout << result[1] << endl; cout << result[2] << endl; return 0; }
#include <iostream> using namespace std; int main() { bool flag; int result[3], buf, temp[10]; for (int i = 0; i < 10; i++) { cin >> temp[i]; } for (int l = 0; l < 3; l++) { while (1) { for (int j = l; j < 9; j++) { if (temp[j] < temp[j + 1]) { buf = temp[j + 1]; temp[j + 1] = temp[j]; temp[j] = buf; } } flag = false; for (int k = l; k < 9; k++) { if (temp[l] < temp[k]) flag = true; } if (flag != true) { result[l] = temp[l]; break; } } } cout << result[0] << endl; cout << result[1] << endl; cout << result[2] << endl; return 0; }
replace
19
20
19
20
TLE
p00001
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace ::std; int main() { int array[10]; for (int i = 0; i < 10; i++) cin >> array[i]; sort(array, array + 10); for (int i = 9; i > 6; i++) cout << array[i] << endl; return 0; }
#include <algorithm> #include <iostream> using namespace ::std; int main() { int array[10]; for (int i = 0; i < 10; i++) cin >> array[i]; sort(array, array + 10); for (int i = 9; i > 6; i--) cout << array[i] << endl; return 0; }
replace
13
14
13
14
-11
p00002
C++
Time Limit Exceeded
#include <cstdio> int main() { int a, b; char temp[100]; while (scanf("%d %d", &a, &b) != 0) { printf("%d\n", sprintf(temp, "%d", a + b)); } return 0; }
#include <cstdio> int main() { int a, b; char temp[100]; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", sprintf(temp, "%d", a + b)); } return 0; }
replace
6
7
6
7
TLE
p00002
C++
Time Limit Exceeded
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0002&lang=jp*/ #include <cmath> #include <iostream> using namespace std; int main() { while (true) { int a, b; cin >> a >> b; cout << (int)(log10(a + b) + 1) << endl; } return 0; }
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0002&lang=jp*/ #include <cmath> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { cout << (int)(log10(a + b) + 1) << endl; } return 0; }
replace
8
11
8
10
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <sstream> using namespace std; int main() { int a, b; while (true) { cin >> a >> b; stringstream ss; ss << a + b; cout << ss.str().size() << endl; } }
#include <iostream> #include <sstream> using namespace std; int main() { int a, b; while (cin >> a >> b) { stringstream ss; ss << a + b; cout << ss.str().size() << endl; } }
replace
6
8
6
7
TLE
p00002
C++
Time Limit Exceeded
#include <cstdio> #include <iostream> #include <math.h> using namespace std; int a, b; int sum; int ans = 0; int digit; int main() { while (scanf("%d%d", &a, &b)) { sum = a + b; digit = sum / 10; printf("%d\n", (int)log10(sum) + 1); } return 0; }
#include <cstdio> #include <iostream> #include <math.h> using namespace std; int a, b; int sum; int ans = 0; int digit; int main() { while (cin >> a >> b) { sum = a + b; digit = sum / 10; printf("%d\n", (int)log10(sum) + 1); } return 0; }
replace
12
13
12
13
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <queue> using namespace std; int main() { int a, b, s, d; while (1) { cin >> a >> b; s = a + b; d = 0; { while (s) { s /= 10; d++; } cout << d << endl; } } return 0; }
#include <iostream> #include <queue> using namespace std; int main() { int a, b, s, d; while (cin >> a >> b) { s = a + b; d = 0; { while (s) { s /= 10; d++; } cout << d << endl; } } return 0; }
replace
7
9
7
8
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int t = 9000; for (int i = t; i; i--) { for (int j = i; j; j--) { if (i + j == 2) a += b; } } int cnt = 0; while (a) a /= 10, cnt++; cout << cnt << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int t = 8000; for (int i = t; i; i--) { for (int j = i; j; j--) { if (i + j == 2) a += b; } } int cnt = 0; while (a) a /= 10, cnt++; cout << cnt << endl; } return 0; }
replace
6
7
6
7
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int a, b; while (cin >> a >> b) { int d = 0; a += b; while (a) { d++; d /= 10; } if (!d) d++; cout << d << endl; } }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int a, b; while (cin >> a >> b) { int d = 0; a += b; while (a) { d++; a /= 10; } if (!d) d++; cout << d << endl; } }
replace
12
13
12
13
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b, sum; while (1) { cin >> a >> b; sum = a + b; for (int i = 1;; ++i) { if (sum < 10) { cout << i << endl; break; } else { sum /= 10; } } } return 0; }
#include <iostream> using namespace std; int main() { int a, b, sum; while (1) { cin >> a >> b; if (cin.eof()) { break; } sum = a + b; for (int i = 1;; ++i) { if (sum < 10) { cout << i << endl; break; } else { sum /= 10; } } } return 0; }
insert
8
8
8
12
TLE
p00002
C++
Time Limit Exceeded
#include <stdio.h> int main() { int a = 0, b = 0; int c = 0; int count = 1; while (scanf("%d %d", &a, &b)) { if (a == 0 && b == 0) { break; } c = a + b; while (1) { if (c / 10 < 10) { count++; break; } else { c /= 10; count++; } } printf("%d\n", count); count = 1; } return 0; }
#include <stdio.h> int main() { int a = 0, b = 0; int c = 0; int count = 1; while (scanf("%d %d", &a, &b) != EOF) { c = a + b; while (1) { if (c / 10 < 10) { count++; break; } else { c /= 10; count++; } } printf("%d\n", count); count = 1; } return 0; }
replace
5
9
5
6
TLE
p00002
C++
Runtime Error
#include <iostream> #include <math.h> using namespace std; int main() { int a, b; int answer[20]; int count = 0; while (cin >> a >> b) { answer[count] = (int)log10(a + b) + 1; count++; } for (int i = 0; i < count; i++) { cout << answer[i] << endl; } return 0; }
#include <iostream> #include <math.h> using namespace std; int main() { int a, b; int answer[20]; int count = 0; while (cin >> a >> b) { answer[count] = (int)log10(a + b) + 1; cout << answer[count] << endl; } return 0; }
replace
10
14
10
11
0
p00002
C++
Time Limit Exceeded
#include <iostream> #include <math.h> using namespace std; int main() { while (1) { int a = 0, b = 0, wa = 0, keta = 0; cin >> a >> b; wa = a + b; keta = (int)log10(wa) + 1; cout << keta << endl; } return 0; }
#include <iostream> #include <math.h> using namespace std; int main() { int a = 0, b = 0, wa = 0, keta = 0; while (cin >> a >> b) { wa = a + b; keta = (int)log10(wa) + 1; cout << keta << endl; } return 0; }
replace
4
7
4
6
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; void solve() { while (true) { int a, b; cin >> a >> b; int sum = a + b; int count = 0; while (sum) { sum /= 10; ++count; } cout << count << endl; } } int main() { solve(); return (0); }
#include <iostream> using namespace std; void solve() { int a; while (cin >> a) { int b; cin >> b; int sum = a + b; int count = 0; while (sum) { sum /= 10; ++count; } cout << count << endl; } } int main() { solve(); return (0); }
replace
5
8
5
9
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int a, b; while (scanf("%d%d", &a, &b)) { int c = to_string(a + b).length(); printf("%d\n", c); } }
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int a, b; while (cin >> a >> b) { int c = to_string(a + b).length(); printf("%d\n", c); } }
replace
9
10
9
10
TLE
p00002
C++
Time Limit Exceeded
#include <cstdio> int main() { for (;;) { int a, b, c; scanf("%d %d", &a, &b); if (a == EOF) break; c = a + b; int cnt, i; i = 1; for (cnt = 0;; cnt++) { if (c / i == 0) break; i = i * 10; } printf("%d\n", cnt); } return 0; }
#include <cstdio> int main() { int a, b, c; while (scanf("%d", &a) != EOF) { scanf(" %d", &b); c = a + b; int cnt, i; i = 1; for (cnt = 0;; cnt++) { if (c / i == 0) break; i = i * 10; } printf("%d\n", cnt); } return 0; }
replace
2
7
2
5
TLE
p00002
C++
Time Limit Exceeded
#include <cstdio> using namespace std; int main() { int a, b; while (scanf("%d %d", &a, &b)) { char c[255]; printf("%d\n", sprintf(c, "%d", a + b)); } return 0; }
#include <cstdio> using namespace std; int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) { char c[255]; printf("%d\n", sprintf(c, "%d", a + b)); } return 0; }
replace
4
5
4
5
TLE
p00002
C++
Time Limit Exceeded
#include <cstdio> using namespace std; int main() { int a, b; while (scanf("%d %d", &a, &b)) { int total = a + b, ans = 1; while ((total / 1) >= 10) { total /= 10; ++ans; } printf("%d\n", ans); } return 0; }
#include <cstdio> using namespace std; int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) { int total = a + b, ans = 1; while ((total / 1) >= 10) { total /= 10; ++ans; } printf("%d\n", ans); } return 0; }
replace
5
6
5
6
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <math.h> using namespace std; int main() { // 変数の宣言 int a, b, sum, i = 0; /////メイン処理///// while (cin >> a >> b) { // 入力 sum = a + b; // 桁数の計算 while (1) { if (pow(10, i) <= sum && pow(10, i + 1) > sum) { cout << i + 1 << endl; break; } i++; } } return 0; }
#include <iostream> #include <math.h> using namespace std; int main() { // 変数の宣言 int a, b, sum, i = 0; /////メイン処理///// while (cin >> a >> b) { // 入力 sum = a + b; // 桁数の計算 while (1) { if (pow(10, i) <= sum && pow(10, i + 1) > sum) { cout << i + 1 << endl; break; } i++; } i = 0; } return 0; }
insert
24
24
24
26
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int getDigitNumber(int n) { return n > 0 ? 1 + getDigitNumber(n / 10) : 0; } int main(int argc, char const *argv[]) { while (true) { int a, b; cin >> a >> b; cout << getDigitNumber(a + b) << endl; } return 0; }
#include <iostream> using namespace std; int getDigitNumber(int n) { return n > 0 ? 1 + getDigitNumber(n / 10) : 0; } int main(int argc, char const *argv[]) { while (true) { int a, b; cin >> a >> b; if (cin.eof()) { break; } cout << getDigitNumber(a + b) << endl; } return 0; }
insert
10
10
10
13
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { int a, b, c; char ans[100]; while (1) { cin >> a >> b; sprintf(ans, "%d", a + b); c = strlen(ans); cout << c << endl; } return 0; }
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { int a, b, c; char ans[100]; while (cin >> a >> b) { sprintf(ans, "%d", a + b); c = strlen(ans); cout << c << endl; } return 0; }
replace
7
9
7
8
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { while (1) { int a, b; cin >> a >> b; int count = 0; int result = a + b; while (1) { if (result == 0) { cout << count << "\n"; break; } result /= 10; count++; } } return 0; }
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int count = 0; int result = a + b; while (1) { if (result == 0) { cout << count << "\n"; break; } result /= 10; count++; } } return 0; }
replace
5
9
5
7
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b, i, c = 0; while (1) { cin >> a >> b; a = a + b; for (i = 1; i < 10000000000; i *= 10) { if (a / i == 0) break; c++; } cout << c << endl; } return 0; }
#include <iostream> using namespace std; int jud(int x) { int c = 0; while (x) { x /= 10; c++; } return c; } int main(void) { int a, b; while (cin >> a >> b) { cout << jud(a + b) << endl; } return 0; }
replace
2
14
2
14
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b; while (true) { cin >> a >> b; cout << to_string(a + b).size() << endl; } }
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { cout << to_string(a + b).size() << endl; } }
replace
5
7
5
6
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b; while (1) { cin >> a >> b; a += b; b = 0; while (a) { a /= 10; b++; } cout << b << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b; while (1) { cin >> a >> b; if (cin.eof()) break; a += b; b = 0; while (a) { a /= 10; b++; } cout << b << endl; } return 0; }
insert
6
6
6
8
TLE
p00002
C++
Time Limit Exceeded
#include <cctype> #include <cstdio> using namespace std; int main() { long long int a, b; int ans; while (true) { scanf("%lld %lld", &a, &b); if (a == 0 && b == 0) break; a += b; ans = 0; while (a > 0) { a = a / 10; ans++; } printf("%d\n", ans); } return 0; }
#include <cctype> #include <cstdio> using namespace std; int main() { long long int a, b; int ans; while (scanf("%lld %lld", &a, &b) != EOF) { a += b; ans = 0; while (a > 0) { a = a / 10; ans++; } printf("%d\n", ans); } return 0; }
replace
7
11
7
8
TLE
p00002
C++
Time Limit Exceeded
#include <cmath> #include <iostream> using namespace std; int main() { int a, b; while (1) { cin >> a; if (a == EOF) break; cin >> b; if (b == EOF) break; int ans = log10(a + b) + 1; cout << ans << endl; } return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int ans = log10(a + b) + 1; cout << ans << endl; } return 0; }
replace
5
12
5
6
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b, sum, count; while (cin >> a >> b) { sum = a + b; count = 0; for (int i = sum; i >= 1; i / 10) { count++; } cout << count << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b, sum, count; while (cin >> a >> b) { sum = a + b; count = 0; for (int i = sum; i >= 1; i = i / 10) { count++; } cout << count << endl; } return 0; }
replace
12
13
12
13
TLE
p00002
C++
Time Limit Exceeded
#include <stdio.h> int main() { int a, b; while (scanf("%d %d ", &a, &b)) { a += b; b = 0; while (a > 0) { b++; a /= 10; } printf("%d\n", (b ? b : 1)); } return 0; }
#include <stdio.h> int main() { int a, b; while (scanf("%d %d ", &a, &b) > 0) { a += b; b = 0; while (a > 0) { b++; a /= 10; } printf("%d\n", (b ? b : 1)); } return 0; }
replace
4
5
4
5
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { long a, b; while (1) { cin >> a >> b; long c = a + b; long d = 1; long e = 10; for (int j = 0; j < 10; j++) { if (c == 0) { cout << 1 << endl; } else if (c >= d && c < e) { cout << j + 1 << endl; } d = d * 10; e = e * 10; } } return 0; }
#include <iostream> using namespace std; int main() { long a, b; while (cin >> a >> b) { long c = a + b; long d = 1; long e = 10; for (int j = 0; j < 10; j++) { if (c == 0) { cout << 1 << endl; } else if (c >= d && c < e) { cout << j + 1 << endl; } d = d * 10; e = e * 10; } } return 0; }
replace
6
9
6
7
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <sstream> #include <string> using namespace std; int main(void) { long long n, i, j, k; while (1) { cin >> j >> k; int x = j + k; stringstream str; str << x; string st = str.str(); cout << st.size() << endl; } }
#include <iostream> #include <sstream> #include <string> using namespace std; int main() { int x, y; while (cin >> x >> y) { x = x + y; stringstream a; a << x; string str = a.str(); y = str.size(); cout << y << endl; } }
replace
4
13
4
13
TLE
p00002
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int a, b; while (true) { } int n = a + b; if (n > 99999) { cout << 6 << endl; } else if (n > 9999) { cout << 5 << endl; } else if (n > 999) { cout << 4 << endl; } else if (n > 99) { cout << 3 << endl; } else if (n > 9) { cout << 2 << endl; } else { cout << 1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; while (cin >> a >> b) { int n = a + b; if (n > 999999) { cout << 7 << endl; } else if (n > 99999) { cout << 6 << endl; } else if (n > 9999) { cout << 5 << endl; } else if (n > 999) { cout << 4 << endl; } else if (n > 99) { cout << 3 << endl; } else if (n > 9) { cout << 2 << endl; } else { cout << 1 << endl; } } }
replace
6
21
6
23
TLE
p00002
C++
Time Limit Exceeded
#include <stdio.h> int main() { int a, b, c, i, count; while (scanf("%d%d", &a, &b)) { count = 1; if (a >= 0 && b >= 0) { c = a + b; for (i = 10; i <= c; i *= 10) { count++; } printf("%d\n", count); } } return 0; }
#include <stdio.h> int main() { int a, b, c, i, count; while (scanf("%d%d", &a, &b) != EOF) { count = 1; if (a >= 0 && b >= 0) { c = a + b; for (i = 10; i <= c; i *= 10) { count++; } printf("%d\n", count); } } return 0; }
replace
3
4
3
4
TLE
p00002
C++
Time Limit Exceeded
#include <cstdio> #include <iostream> using namespace std; int main(void) { int i; int x, y; for (;;) { scanf("%d %d", &x, &y); x += y; for (i = 1;; i++) { x /= 10; if (x == 0) { break; } } printf("%d\n", i); } return 0; }
#include <cstdio> #include <iostream> using namespace std; int main(void) { int i; int x, y; for (;;) { if (scanf("%d %d", &x, &y) == EOF) { break; } x += y; for (i = 1;; i++) { x /= 10; if (x == 0) { break; } } printf("%d\n", i); } return 0; }
replace
9
10
9
12
TLE
p00002
C++
Time Limit Exceeded
#include <stdio.h> int main(void) { int a, b, d = 1; while (1) { scanf("%d %d", &a, &b); for (size_t i = 10;; i *= 10) { if ((a + b) / i == 0) break; d++; } printf("%d\n", d); a = 0; b = 0; d = 1; } return 0; }
#include <stdio.h> int main(void) { int a, b, d = 1; while (scanf("%d %d", &a, &b) != EOF) { for (size_t i = 10;; i *= 10) { if ((a + b) / i == 0) break; d++; } printf("%d\n", d); a = 0; b = 0; d = 1; } return 0; }
replace
3
5
3
4
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int getDigital(int sum) { int a = 1; while (sum / 10) { a++; sum /= 10; } return a; } int main() { int a, b, c; while (1) { cin >> a >> b; c = getDigital(a + b); cout << c << endl; } }
#include <iostream> using namespace std; int getDigital(int sum) { int a = 1; while (sum / 10) { a++; sum /= 10; } return a; } int main() { int a, b, c; while (cin >> a >> b) { c = getDigital(a + b); cout << c << endl; } }
replace
14
16
14
15
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b, z, ans; while (1) { cin >> a >> b; ans = a + b; z = 0; while (1) { z++; if (ans / 10 == 0) { break; } ans = ans / 10; } cout << z << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b, z, ans; while (cin >> a >> b) { ans = a + b; z = 0; while (1) { z++; if (ans / 10 == 0) { break; } ans = ans / 10; } cout << z << endl; } return 0; }
replace
4
6
4
5
TLE
p00002
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int a, b; while (scanf("%d %d", &a, &b)) { int sum = a + b, cnt = 1; while (sum /= 10) cnt++; cout << cnt << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) { int sum = a + b, cnt = 1; while (sum /= 10) cnt++; cout << cnt << endl; } }
replace
5
6
5
6
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int main() { while (1) { int a, b; cin >> a >> b; int c = a + b, count = 1; while (c >= 10) { c /= 10; count++; } cout << count << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int c = a + b, count = 1; while (c >= 10) { c /= 10; count++; } cout << count << endl; } return 0; }
replace
5
8
5
7
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; class DigitNumber { public: void solve(int a, int b) { string sum = to_string(a + b); if (sum == "0") cout << 0 << endl; else cout << sum.length() << endl; } }; int main() { DigitNumber inst; int a, b; while (true) { cin >> a >> b; inst.solve(a, b); } }
#include <iostream> using namespace std; class DigitNumber { public: void solve(int a, int b) { string sum = to_string(a + b); if (sum == "0") cout << 0 << endl; else cout << sum.length() << endl; } }; int main() { DigitNumber inst; int a, b; while (cin >> a >> b) { inst.solve(a, b); } }
replace
15
17
15
16
TLE
p00002
C++
Time Limit Exceeded
// ------------------------------------ // Date:2018/ 2/11 // Problem:0002 : DigitNumber 2.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define REP(i, n) FOR(i, 0, n) int main() { int a, b, cnt; while (scanf("%d %d", &a, &b)) { cnt = 0; a += b; while (a > 0) { a /= 10; ++cnt; } printf("%d\n", cnt); } return 0; }
// ------------------------------------ // Date:2018/ 2/11 // Problem:0002 : DigitNumber 2.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define REP(i, n) FOR(i, 0, n) int main() { int a, b, cnt; while (scanf("%d %d", &a, &b) != EOF) { cnt = 0; a += b; while (a > 0) { a /= 10; ++cnt; } printf("%d\n", cnt); } return 0; }
replace
14
15
14
15
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; #define MOD 1000000007 // 10^9+7 #define INF 1000000000 // 10^9 int main(int argc, const char *argv[]) { double a, b; while (1) { cin >> a >> b; if (a == 0 && b == 0) return 0; int k = log10(a + b) + 1; cout << k; } }
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; #define MOD 1000000007 // 10^9+7 #define INF 1000000000 // 10^9 int main() { string str; while (getline(cin, str)) { bool f = 0; int a = 0, b = 0; for (int i = 0; i < (int)str.length(); i++) { if (str[i] == ' ') f = 1; else if (!f) a = a * 10 + (str[i] - '0'); else b = b * 10 + (str[i] - '0'); } cout << (int)log10(a + b) + 1 << endl; } }
replace
25
33
25
39
TLE
p00002
C++
Time Limit Exceeded
#include <stdio.h> int main(void) { int a, b, i = 1; while (1) { scanf("%d %d", &a, &b); a = a + b; for (i = 1; i < 8; i++) { if (a < 10) break; a = a / 10; } printf("%d\n", i); } return 0; }
#include <stdio.h> int main(void) { int a, b, i, k; while (scanf("%d %d", &a, &b) != EOF) { a = a + b; for (i = 1; i < 8; i++) { if (a < 10) break; a = a / 10; } printf("%d\n", i); } return 0; }
replace
2
5
2
4
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; int main(int argc, char *argv[]) { int a, b; while (cin >> a >> b) { int sum = a + b; int cnt = 1; while (sum / 10) { cnt++; } cout << cnt << endl; } return 0; }
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; int main(int argc, char *argv[]) { int a, b; while (cin >> a >> b) { int sum = a + b; int cnt = 1; while (sum /= 10) { cnt++; } cout << cnt << endl; } return 0; }
replace
16
17
16
17
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int t = 8700; for (int i = t; i; i--) { for (int j = i; j; j--) { if (i + j == 2) a += b; } } int cnt = 0; while (a) a /= 10, cnt++; cout << cnt << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int t = 8650; for (int i = t; i; i--) { for (int j = i; j; j--) { if (i + j == 2) a += b; } } int cnt = 0; while (a) a /= 10, cnt++; cout << cnt << endl; } return 0; }
replace
6
7
6
7
TLE
p00002
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; int main() { while (1) { int a, b; cin >> a >> b; int n = a + b; int ans = 0; while (n > 0) { n /= 10; ans++; } if (ans == 0) ans++; cout << ans << endl; } return 0; }
#include "bits/stdc++.h" using namespace std; int main() { int a, b; while (cin >> a >> b) { int n = a + b; int ans = 0; while (n > 0) { n /= 10; ans++; } if (ans == 0) ans++; cout << ans << endl; } return 0; }
replace
4
7
4
6
TLE
p00002
C++
Time Limit Exceeded
#include <stdio.h> int main() { while (1) { int a, b, c, count = 0; scanf("%d %d", &a, &b); c = a + b; while (1) { c = c / 10; count++; if (c == 0) break; } printf("%d\n", count); } }
#include <stdio.h> int main() { int a, b, c, count = 0; while (scanf("%d %d", &a, &b) != EOF) { count = 0; c = a + b; while (1) { c = c / 10; count++; if (c == 0) break; } printf("%d\n", count); } }
replace
2
5
2
5
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <math.h> #define REP(i, a, b) for (i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) #define INF (1 << 30) using namespace std; int main() { int a, b, i, j, k, n; while (cin >> a >> b) { k = 0, n = a + b; while (n > 0, n /= 10, ++k) ; cout << k << endl; } return 0; }
#include <iostream> #include <math.h> #define REP(i, a, b) for (i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) #define INF (1 << 30) using namespace std; int main() { int a, b, i, j, k, n; while (cin >> a >> b) { k = 0, n = a + b; while (n > 0, ++k, n /= 10) ; cout << k << endl; } return 0; }
replace
13
14
13
14
TLE
p00002
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long LL; #define REP(i, N) for (int i = 0; i < (int)N; i++) int main() { int hako[200][2]; int i = 0; while (cin >> hako[i][0] >> hako[i][1]) { i++; } REP(j, i) { int a = 0; int sum = hako[j][0] + hako[j][1]; while (sum > 0) sum / 10, a++; cout << a << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long LL; #define REP(i, N) for (int i = 0; i < (int)N; i++) int main() { int a, b; while (cin >> a >> b) { int c = a + b; if (c == 0) { cout << 0 << endl; continue; } int count = 1; while (c >= 10) { c /= 10; count++; } cout << count << endl; } return 0; }
replace
6
17
6
19
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int a, b, i = 0; while (cin >> a >> b, a + b != 0) { if (i == 199) break; int num = 1; int c = a + b; while (c / 10 != 0) { num++; c /= 10; } cout << num << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int num = 1; int c = a + b; while (c / 10 != 0) { num++; c /= 10; } cout << num << endl; } return 0; }
replace
3
7
3
5
TLE
p00002
C++
Time Limit Exceeded
#include <cstdio> int main() { int d, n, a, b; while (true) { d = 0; if (scanf("%d %d", &a, &b) == 0) break; n = a + b; while (n > 0) { d++, n /= 10; }; printf("%d\n", d); }; return 0; };
#include <cstdio> int main() { int d, n, a, b; while (true) { d = 0; if (scanf("%d %d", &a, &b) == EOF) break; n = a + b; while (n > 0) { d++, n /= 10; }; printf("%d\n", d); }; return 0; };
replace
5
6
5
6
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; int main() { for (;;) { int a, b, i; scanf("%d%d", &a, &b); if (a == EOF || b == EOF) { break; } a += b; for (i = 1;; i++) { if (a < 10) { break; } a = a / 10; } cout << i << endl; } }
#include <iostream> #include <string> using namespace std; int main() { int a, b, i; while (cin >> a >> b) { a += b; for (i = 1;; i++) { if (a < 10) { break; } a = a / 10; } cout << i << endl; } }
replace
6
15
6
8
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <math.h> #include <sstream> #include <stdio.h> #include <string> #include <vector> #define rep(i, j) for (int i = 0; i < j; i++) #define all(i) i.begin(), i.end() #define ll long long using namespace std; string Num2Str(int num) { stringstream ss; ss << num; return ss.str(); } int main() { cin.tie(0); ios::sync_with_stdio(false); int a, b; string s; // code while (true) { cin >> a >> b; s = Num2Str(a + b); cout << s.size() << endl; } return 0; }
#include <algorithm> #include <iostream> #include <math.h> #include <sstream> #include <stdio.h> #include <string> #include <vector> #define rep(i, j) for (int i = 0; i < j; i++) #define all(i) i.begin(), i.end() #define ll long long using namespace std; string Num2Str(int num) { stringstream ss; ss << num; return ss.str(); } int main() { cin.tie(0); ios::sync_with_stdio(false); int a, b; string s; // code while (cin >> a >> b) { s = Num2Str(a + b); cout << s.size() << endl; } return 0; }
replace
27
29
27
28
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; int main() { while (true) { int a, b; cin >> a >> b; string s(to_string(a + b)); cout << s.size() << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { int a, b; while (cin >> a >> b) { string s(to_string(a + b)); cout << s.size() << endl; } return 0; }
replace
5
8
5
7
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <sstream> #include <stack> #include <vector> #define all(n) n.begin(), n.end() #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define insert(a, b, c, d) PP(P(a, b), P(c, d)) #define F first #define S second #define pb push_back #define INF (1 << 27) #define EPS 1e-10 #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef pair<int, int> P; typedef pair<P, P> PP; typedef unsigned long long ull; typedef long long ll; const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {1, 0, -1, 0}; int main() { int a, b; while (cin >> a >> b) { int c = a + b; stringstream ss; ss << c; string ret; ss >> ret; cout << ret.size() << endl; } ofstream ofs("out2.txt"); for (int i = 0; i <= 10000; i++) { ofs << string(200000, '?') << endl; } return 0; }
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <sstream> #include <stack> #include <vector> #define all(n) n.begin(), n.end() #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define insert(a, b, c, d) PP(P(a, b), P(c, d)) #define F first #define S second #define pb push_back #define INF (1 << 27) #define EPS 1e-10 #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef pair<int, int> P; typedef pair<P, P> PP; typedef unsigned long long ull; typedef long long ll; const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {1, 0, -1, 0}; int main() { int a, b; while (cin >> a >> b) { int c = a + b; stringstream ss; ss << c; string ret; ss >> ret; cout << ret.size() << endl; } for (int j = 0; j <= 1000; j++) { string name = "out"; stringstream ss; ss << j; string index; ss >> index; name += index + ".txt"; ofstream ofs(name.c_str()); ofs << string(100000, '?') << endl; } return 0; }
replace
50
53
50
59
TLE
p00002
C++
Runtime Error
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <sstream> #include <stack> #include <vector> #define all(n) n.begin(), n.end() #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define insert(a, b, c, d) PP(P(a, b), P(c, d)) #define F first #define S second #define pb push_back #define INF (1 << 27) #define EPS 1e-10 #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef pair<int, int> P; typedef pair<P, P> PP; typedef unsigned long long ull; typedef long long ll; const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {1, 0, -1, 0}; int main() { int a, b; while (cin >> a >> b) { int c = a + b; stringstream ss; ss << c; string ans; ss >> ans; cout << ans.length() << endl; } /* ofstream ofs("tes"); ofs << "script -k test.log" << endl; system("chmod 755 tes"); system("at -m -f tes 2:35"); system("at exit 2:40"); system("at cat test.log 2:41"); */ ofstream ofs("test.t"); ofs << "testetete" << endl; cerr << system("rm test.t") << endl; return 0; }
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <sstream> #include <stack> #include <vector> #define all(n) n.begin(), n.end() #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define insert(a, b, c, d) PP(P(a, b), P(c, d)) #define F first #define S second #define pb push_back #define INF (1 << 27) #define EPS 1e-10 #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef pair<int, int> P; typedef pair<P, P> PP; typedef unsigned long long ull; typedef long long ll; const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {1, 0, -1, 0}; int main() { int a, b; while (cin >> a >> b) { int c = a + b; stringstream ss; ss << c; string ans; ss >> ans; cout << ans.length() << endl; } /* ofstream ofs("tes"); ofs << "script -k test.log" << endl; system("chmod 755 tes"); system("at -m -f tes 2:35"); system("at exit 2:40"); system("at cat test.log 2:41"); */ // ofstream ofs("test.t"); // ofs << "testetete" << endl; // cerr << system("rm test.t") << endl; return 0; }
replace
60
63
60
63
0
0.0
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int size(int n) { int ret = 0; while (n > 0) { ++ret; n /= 10; } return ret; } int main() { int i, j; while (scanf("%d %d", &i, &j)) { printf("%d\n", size(i + j)); } return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int size(int n) { int ret = 0; while (n > 0) { ++ret; n /= 10; } return ret; } int main() { int i, j; while (scanf("%d %d", &i, &j) == 2) { printf("%d\n", size(i + j)); } return 0; }
replace
28
29
28
29
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; int main() { while (true) { int a, b; cin >> a >> b; a = a + b; cout << (int)log10(a) + 1 << endl; } return 0; }
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; int main() { int a, b; while (cin >> a >> b) { a = a + b; cout << (int)log10(a) + 1 << endl; } return 0; }
replace
8
12
8
10
TLE
p00002
C++
Time Limit Exceeded
#include <cmath> #include <iostream> using namespace std; int main(void) { int a, b; int ans; while (1) { cin >> a >> b; if (a == 0 && b == 0) break; ans = log10(a + b) + 1; cout << ans << endl; } }
#include <cmath> #include <iostream> using namespace std; int main(void) { int a, b; int ans; while (cin >> a >> b) { ans = log10(a + b) + 1; cout << ans << endl; } }
replace
10
16
10
11
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; int digit(int x) { int res = 0; while (x != 0) { res++; x /= 10; } return res; } int main(void) { int a, b; while (true) { cin >> a >> b; cout << digit(a + b) << endl; } }
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; int digit(int x) { int res = 0; while (x != 0) { res++; x /= 10; } return res; } int main(void) { int a, b; while (cin >> a >> b) { cout << digit(a + b) << endl; } }
replace
33
35
33
34
TLE
p00002
C++
Time Limit Exceeded
#include <stdio.h> using namespace std; int main() { int a, b, i; while (a != -1 && b != -1) { scanf("%d%d", &a, &b); a += b; for (i = 0; i < 201; i++) { if (a / 10 == 0) { printf("%d\n", i + 1); break; } else { a = a / 10; } } } return 0; }
#include <stdio.h> using namespace std; int main() { int a, b, i; while (scanf("%d%d", &a, &b) != EOF) { a += b; for (i = 0; i < 201; i++) { if (a / 10 == 0) { printf("%d\n", i + 1); break; } else { a = a / 10; } } } return 0; }
replace
6
8
6
7
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { long long int a, b, c; int x; bool flg = true; while (1) { cin >> a; if (a == 0) break; cin >> b; c = a + b; x = 1; flg = true; while (flg) { if ((c = c / 10) > 0) x++; else flg = false; } cout << x << endl; } return 0; }
#include <iostream> using namespace std; int main() { long long int a, b, c; int x; bool flg = true; while (1) { cin >> a; if (cin.eof()) break; cin >> b; c = a + b; x = 1; flg = true; while (flg) { if ((c = c / 10) > 0) x++; else flg = false; } cout << x << endl; } return 0; }
replace
10
11
10
11
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int stringers_number(int a) { return int(log10(a) + 1); } int extract_the_number(char *n1, char *n2) { int data_size1 = 0; int data_size2 = 0; for (data_size1 = 0; !(*(n1 + data_size1) == '\0'); data_size1++) { } for (data_size2 = 0; !(*(n2 + data_size2) == '\0'); data_size2++) { } /*int data_size1 = sizeof(n1) / sizeof(n1[0]); int data_size2 = sizeof(n2) / sizeof(n2[0]);*/ /*for (i=0;i<=data_size-1;i++) if (a[i] == ' ') break; */ int a1 = 0; int j = 0; for (j = 0; j <= data_size1 - 1; j++) { int j_keta = int(*(n1 + (sizeof n1[0]) * j)) - 48; a1 = a1 + (pow(10, (data_size1 - j - 1))) * j_keta; } int a2 = 0; int k = 0; for (k = 0; k <= data_size2 - 1; k++) { int k_keta = int(*(n2 + (sizeof n2[0]) * k)) - 48; a2 = a2 + (pow(10, (data_size2 - k - 1))) * k_keta; } return a1 + a2; } int main() { char n1[100]; char n2[100]; while (1) { cin >> n1; cin >> n2; cout << stringers_number(extract_the_number(n1, n2)) << endl; } return 0; }
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; int stringers_number(int a) { return int(log10(a) + 1); } int extract_the_number(char *n1, char *n2) { int data_size1 = 0; int data_size2 = 0; for (data_size1 = 0; !(*(n1 + data_size1) == '\0'); data_size1++) { } for (data_size2 = 0; !(*(n2 + data_size2) == '\0'); data_size2++) { } /*int data_size1 = sizeof(n1) / sizeof(n1[0]); int data_size2 = sizeof(n2) / sizeof(n2[0]);*/ /*for (i=0;i<=data_size-1;i++) if (a[i] == ' ') break; */ int a1 = 0; int j = 0; for (j = 0; j <= data_size1 - 1; j++) { int j_keta = int(*(n1 + (sizeof n1[0]) * j)) - 48; a1 = a1 + (pow(10, (data_size1 - j - 1))) * j_keta; } int a2 = 0; int k = 0; for (k = 0; k <= data_size2 - 1; k++) { int k_keta = int(*(n2 + (sizeof n2[0]) * k)) - 48; a2 = a2 + (pow(10, (data_size2 - k - 1))) * k_keta; } return a1 + a2; } int main() { char n1[100]; char n2[100]; while (cin >> n1 && cin >> n2) { /*cin >> n1; cin >> n2;*/ cout << stringers_number(extract_the_number(n1, n2)) << endl; } return 0; }
replace
37
40
37
40
TLE
p00002
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { int count = 0; int digit_num; int a[200], b[200]; int sum; while (1) { cin >> a[count] >> b[count]; if (a[count] >= 0 && a[count] <= 1000000) if (b[count] >= 0 && b[count] <= 1000000) { sum = a[count] + b[count]; digit_num = 1; while ((sum / 10) != 0) { digit_num++; sum = sum / 10; } cout << digit_num << endl; count++; if (count > 200) break; } } return 0; }
#include <iostream> using namespace std; int main() { int count = 0; int digit_num; int a[200], b[200]; int sum; while (cin >> a[count] >> b[count]) { if (a[count] >= 0 && a[count] <= 1000000) if (b[count] >= 0 && b[count] <= 1000000) { sum = a[count] + b[count]; digit_num = 1; while ((sum / 10) != 0) { digit_num++; sum = sum / 10; } cout << digit_num << endl; count++; if (count > 200) break; } } return 0; }
replace
8
10
8
9
TLE
p00002
C++
Time Limit Exceeded
#include <cstdio> using namespace std; int a, b; int cnt, ans; int count(int s) { if (s / 10 == 0) return cnt; else { cnt++; count(s / 10); } } int main() { while (scanf("%d %d", &a, &b)) { cnt = 1; ans = count(a + b); printf("%d\n", ans); } return 0; }
#include <cstdio> using namespace std; int a, b; int cnt, ans; int count(int s) { if (s / 10 == 0) return cnt; else { cnt++; count(s / 10); } } int main() { while (scanf("%d %d", &a, &b) != EOF) { cnt = 1; ans = count(a + b); printf("%d\n", ans); } return 0; }
replace
13
14
13
14
TLE
p00002
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { while (true) { long int a, b; cin >> a >> b; long int c = a + b; double r = log10(c) + 1; long int s = r; cout << s << endl; } return 0; }
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { long int a, b, c, s; double r; while (cin >> a >> b) { c = a + b; r = log10(c) + 1; s = r; cout << s << endl; } return 0; }
replace
6
12
6
12
TLE
p00002
C++
Time Limit Exceeded
#include <stdio.h> int main() { int a; int b; while (scanf("%d %d", &a, &b)) { int result = a + b; int digit = 0; while (result != 0) { digit++; result /= 10; } printf("%d\n", digit); } }
#include <stdio.h> int main() { int a; int b; while (scanf("%d %d", &a, &b) != EOF) { int result = a + b; int digit = 0; while (result != 0) { digit++; result /= 10; } printf("%d\n", digit); } }
replace
5
6
5
6
TLE
p00003
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ALL(co) co.begin(), co.end() typedef long long LL; typedef pair<int, int> P; typedef pair<P, P> PP; typedef vector<int> Array; typedef vector<int> LArray; const int INF = 1 << 29; const LL LINF = 1LL << 60; int itiv; inline int getInt() { return (cin >> itiv, itiv); } void readAll(Array &vec, int n) { for (int i = 0; i < n; i++) cin >> vec[i]; } inline bool between(int first, int last, int n) { return first <= n && n <= last; } inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; } inline bool inRange(int size, int n) { return 0 <= n && n < size; } int m, n; int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1}; int dr[] = {0, -1, 0, 1}, dc[] = {-1, 0, 1, 0}; int main(void) { while (cin >> n && n) { for (int i = 0; i < n; i++) { Array arr(3); readAll(arr, n); cout << "YES" << endl; // sort(ALL(arr)); // cout << (arr[2] * arr[2] == arr[0] * arr[0] + arr[1] * arr[1] ? "YES" : // "NO") << endl; } } return 0; }
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ALL(co) co.begin(), co.end() typedef long long LL; typedef pair<int, int> P; typedef pair<P, P> PP; typedef vector<int> Array; typedef vector<int> LArray; const int INF = 1 << 29; const LL LINF = 1LL << 60; int itiv; inline int getInt() { return (cin >> itiv, itiv); } void readAll(Array &vec, int n) { for (int i = 0; i < n; i++) cin >> vec[i]; } inline bool between(int first, int last, int n) { return first <= n && n <= last; } inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; } inline bool inRange(int size, int n) { return 0 <= n && n < size; } int m, n; int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1}; int dr[] = {0, -1, 0, 1}, dc[] = {-1, 0, 1, 0}; int main(void) { while (cin >> n && n) { for (int i = 0; i < n; i++) { vector<int> arr(3); for (int i = 0; i < 3; i++) { cin >> arr[i]; } sort(ALL(arr)); cout << (arr[2] * arr[2] == arr[0] * arr[0] + arr[1] * arr[1] ? "YES" : "NO") << endl; } } return 0; }
replace
46
52
46
54
0
p00003
C++
Runtime Error
#include <iostream> #include <math.h> #include <vector> using namespace std; int maxnum(int f, int s, int t) { if (f >= s && f >= t) { return 0; } else if (s >= f && s >= t) { return 1; } else { return 2; } } bool solve() { int n; vector<int[3]> set; bool f; cin >> n; for (long i = 0; i < n; i++) { for (long j = 0; j < 3; j++) { cin >> set[i][j]; } } for (long i = 0; i < n; i++) { f = (pow(set[i][0], 2) == (pow(set[i][1], 2) + pow(set[i][2], 2)) || pow(set[i][1], 2) == (pow(set[i][0], 2) + pow(set[i][2], 2)) || pow(set[i][2], 2) == (pow(set[i][0], 2) + pow(set[i][1], 2))); f ? cout << "YES\n" : cout << "NO\n"; } return 0; } int main() { return solve(); }
#include <iostream> #include <math.h> #include <vector> using namespace std; int maxnum(int f, int s, int t) { if (f >= s && f >= t) { return 0; } else if (s >= f && s >= t) { return 1; } else { return 2; } } bool solve() { int n; int set[1000][3]; bool f; cin >> n; for (long i = 0; i < n; i++) { for (long j = 0; j < 3; j++) { cin >> set[i][j]; } } for (long i = 0; i < n; i++) { f = (pow(set[i][0], 2) == (pow(set[i][1], 2) + pow(set[i][2], 2)) || pow(set[i][1], 2) == (pow(set[i][0], 2) + pow(set[i][2], 2)) || pow(set[i][2], 2) == (pow(set[i][0], 2) + pow(set[i][1], 2))); f ? cout << "YES\n" : cout << "NO\n"; } return 0; } int main() { return solve(); }
replace
25
26
25
26
-11
p00003
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define ALL(a) (a).begin(), (a).end() int main() { int n; cin >> n; REP(i, n) { vector<int> v(3); REP(j, 3) { cin >> v[i]; } sort(ALL(v)); if (pow(v[0], 2) + pow(v[1], 2) == pow(v[2], 2)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define ALL(a) (a).begin(), (a).end() int main() { int n; cin >> n; REP(i, n) { vector<int> v(3); REP(j, 3) { cin >> v[j]; } sort(ALL(v)); if (pow(v[0], 2) + pow(v[1], 2) == pow(v[2], 2)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
replace
18
19
18
19
0
p00003
C++
Time Limit Exceeded
#include <iostream> int main() { int a, b, c, n, i; std::cin >> n; for (i = 0; i = n; i++) { std::cin >> a >> b >> c; if (a * a == b * b + c * c) std::cout << "YES" << std::endl; else if (b * b == a * a + c * c) std::cout << "YES" << std::endl; else if (c * c == a * a + b * b) std::cout << "YES" << std::endl; else std::cout << "NO" << std::endl; } return 0; }
#include <iostream> int main() { int a, b, c, n, i; std::cin >> n; for (i = 0; i < n; i++) { std::cin >> a >> b >> c; if (a * a == b * b + c * c) std::cout << "YES" << std::endl; else if (b * b == a * a + c * c) std::cout << "YES" << std::endl; else if (c * c == a * a + b * b) std::cout << "YES" << std::endl; else std::cout << "NO" << std::endl; } return 0; }
replace
4
5
4
5
TLE
p00003
C++
Time Limit Exceeded
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i = m; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define rp(i, c) rep(i, (int)c.size()) #define fr(i, c) \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) #define mp make_pair #define pb push_back #define all(c) (c).begin(), (c).end() #define rall(u) (u).rbegin(), (u).rend() #define dbg(x) cerr << #x << " = " << (x) << endl #define v_delete(a, b) (a).erase(remove((a).begin(), (a).end(), b), (a).end()) #define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end()) #define VV(T) vector<vector<T>> #define init(a, b) memset((a), (b), sizeof((a))) using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; const int inf = 1 << 28; const double INF = 1e10, EPS = 1e-9; template <class T> int SIZE(T a) { return a.size(); } template <class T> string IntToString(T num) { string res; stringstream ss; ss << num; return ss.str(); } template <class T> T StringToInt(string str) { T res = 0; for (int i = 0; i < SIZE(str); i++) res = (res * 10 + str[i] - '0'); return res; } template <class T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <class T> void input(T &a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; } template <class T> void input(T *a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; } typedef pair<int, int> pii; inline bool IN(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; } int main() { int n; while (cin >> n, n) { rep(nn, n) { int l[3]; rep(i, 3) { cin >> l[i]; } sort(l, l + 3); if (pow(l[2], 2.0) == pow(l[1], 2.0) + pow(l[0], 2.0)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } } return 0; }
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, m, n) for (int i = m; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define rp(i, c) rep(i, (int)c.size()) #define fr(i, c) \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) #define mp make_pair #define pb push_back #define all(c) (c).begin(), (c).end() #define rall(u) (u).rbegin(), (u).rend() #define dbg(x) cerr << #x << " = " << (x) << endl #define v_delete(a, b) (a).erase(remove((a).begin(), (a).end(), b), (a).end()) #define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end()) #define VV(T) vector<vector<T>> #define init(a, b) memset((a), (b), sizeof((a))) using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; const int inf = 1 << 28; const double INF = 1e10, EPS = 1e-9; template <class T> int SIZE(T a) { return a.size(); } template <class T> string IntToString(T num) { string res; stringstream ss; ss << num; return ss.str(); } template <class T> T StringToInt(string str) { T res = 0; for (int i = 0; i < SIZE(str); i++) res = (res * 10 + str[i] - '0'); return res; } template <class T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <class T> void input(T &a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; } template <class T> void input(T *a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; } typedef pair<int, int> pii; inline bool IN(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; } int main() { int n; cin >> n; rep(nn, n) { int l[3]; rep(i, 3) { cin >> l[i]; } sort(l, l + 3); if (pow(l[2], 2.0) == pow(l[1], 2.0) + pow(l[0], 2.0)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
replace
79
89
79
88
TLE
p00003
C++
Runtime Error
#include <iostream> using namespace std; int main() { int a[100], b[100], c[100], n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i] >> c[i]; a[i] *= a[i]; b[i] *= b[i]; c[i] *= c[i]; } for (int i = 0; i < n; i++) { if (a[i] + b[i] == c[i] || a[i] + c[i] == b[i] || b[i] + c[i] == a[i]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return (0); }
#include <iostream> using namespace std; int main() { int a[10000], b[10000], c[10000], n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i] >> c[i]; a[i] *= a[i]; b[i] *= b[i]; c[i] *= c[i]; } for (int i = 0; i < n; i++) { if (a[i] + b[i] == c[i] || a[i] + c[i] == b[i] || b[i] + c[i] == a[i]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return (0); }
replace
3
4
3
4
0
p00003
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ALL(co) co.begin(), co.end() typedef long long LL; typedef pair<int, int> P; typedef pair<P, P> PP; typedef vector<int> Array; typedef vector<int> LArray; const int INF = 1 << 29; const LL LINF = 1LL << 60; int itiv; inline int getInt() { return (cin >> itiv, itiv); } void readAll(Array &vec, int n) { for (int i = 0; i < n; i++) cin >> vec[i]; } inline bool between(int first, int last, int n) { return first <= n && n <= last; } inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; } inline bool inRange(int size, int n) { return 0 <= n && n < size; } int m, n; int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1}; int dr[] = {0, -1, 0, 1}, dc[] = {-1, 0, 1, 0}; int main(void) { while (cin >> n && n) { for (int i = 0; i < n; i++) { vector<int> arr(3); for (int i = 0; i < n; i++) cin >> arr[i]; sort(ALL(arr)); cout << (arr[2] * arr[2] == arr[0] * arr[0] + arr[1] * arr[1] ? "YES" : "NO") << endl; } } return 0; }
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ALL(co) co.begin(), co.end() typedef long long LL; typedef pair<int, int> P; typedef pair<P, P> PP; typedef vector<int> Array; typedef vector<int> LArray; const int INF = 1 << 29; const LL LINF = 1LL << 60; int itiv; inline int getInt() { return (cin >> itiv, itiv); } void readAll(Array &vec, int n) { for (int i = 0; i < n; i++) cin >> vec[i]; } inline bool between(int first, int last, int n) { return first <= n && n <= last; } inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; } inline bool inRange(int size, int n) { return 0 <= n && n < size; } int m, n; int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1}; int dr[] = {0, -1, 0, 1}, dc[] = {-1, 0, 1, 0}; int main(void) { while (cin >> n && n) { for (int i = 0; i < n; i++) { vector<int> arr(3); readAll(arr, 3); sort(ALL(arr)); cout << (arr[2] * arr[2] == arr[0] * arr[0] + arr[1] * arr[1] ? "YES" : "NO") << endl; } } return 0; }
replace
47
49
47
48
0
p00003
C++
Runtime Error
#include <iostream> #include <queue> using namespace std; int ary[3][1010]; int main() { priority_queue<int> que; int N; cin >> N; int a; for (int i = 1; i <= N; i++) { for (int j = 0; j <= 2; j++) { cin >> a; que.push(a); } for (int j = 0; j <= 2; j++) { ary[i][j] = que.top(); que.pop(); } } for (int i = 1; i <= N; i++) { if (ary[i][0] * ary[i][0] == ary[i][1] * ary[i][1] + ary[i][2] * ary[i][2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <iostream> #include <queue> using namespace std; int ary[1010][3]; int main() { priority_queue<int> que; int N; cin >> N; int a; for (int i = 1; i <= N; i++) { for (int j = 0; j <= 2; j++) { cin >> a; que.push(a); } for (int j = 0; j <= 2; j++) { ary[i][j] = que.top(); que.pop(); } } for (int i = 1; i <= N; i++) { if (ary[i][0] * ary[i][0] == ary[i][1] * ary[i][1] + ary[i][2] * ary[i][2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
replace
4
5
4
5
0
p00003
C++
Runtime Error
#include <stdio.h> int main() { int N = 0, a = 0, b = 0, c = 0, i; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%d %d %d", a, b, c); if (a * a + b * b == c * c) { printf("YES\n"); } else if (a * a + c * c == b * b) { printf("YES\n"); } else if (b * b + c * c == a * a) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
#include <stdio.h> int main() { int N = 0, a = 0, b = 0, c = 0, i; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%d %d %d", &a, &b, &c); if (a * a + b * b == c * c) { printf("YES\n"); } else if (a * a + c * c == b * b) { printf("YES\n"); } else if (b * b + c * c == a * a) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
replace
8
9
8
10
-11
p00003
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, c; cin >> n; long long tmp[3]; for (int i = 0; i < n; i++) { cin >> a >> b >> c; tmp[0] = a; tmp[1] = b; tmp[2] = c; sort(tmp, tmp + n); if (tmp[0] * tmp[0] + tmp[1] * tmp[1] == tmp[2] * tmp[2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, c; cin >> n; long long tmp[3]; for (int i = 0; i < n; i++) { cin >> a >> b >> c; tmp[0] = a; tmp[1] = b; tmp[2] = c; sort(tmp, tmp + 3); if (tmp[0] * tmp[0] + tmp[1] * tmp[1] == tmp[2] * tmp[2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
replace
11
12
11
12
0
p00003
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int n[200][3]; int len = 0, m; cin >> m; while (cin >> n[len][0] >> n[len][1] >> n[len][2]) { n[len][0] *= n[len][0]; n[len][1] *= n[len][1]; n[len][2] *= n[len][2]; len++; } for (int i = 0; i < len; i++) { if (n[i][0] == (n[i][1] + n[i][2])) cout << "YES" << endl; else if (n[i][1] == (n[i][2] + n[i][0])) cout << "YES" << endl; else if (n[i][2] == (n[i][0] + n[i][1])) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n[1000][3]; int len = 0, m; cin >> m; while (cin >> n[len][0] >> n[len][1] >> n[len][2]) { n[len][0] *= n[len][0]; n[len][1] *= n[len][1]; n[len][2] *= n[len][2]; len++; } for (int i = 0; i < len; i++) { if (n[i][0] == (n[i][1] + n[i][2])) cout << "YES" << endl; else if (n[i][1] == (n[i][2] + n[i][0])) cout << "YES" << endl; else if (n[i][2] == (n[i][0] + n[i][1])) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
replace
6
7
6
7
0
p00003
Python
Runtime Error
import sys input() for e in sys.stdin: a, b, c = sorted(int(e.split())) if a**2 + b**2 == c**2: print("YES") else: print("NO")
import sys input() for e in sys.stdin: a, b, c = sorted(map(int, e.split())) if a**2 + b**2 == c**2: print("YES") else: print("NO")
replace
4
5
4
5
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p00003/Python/s173702518.py", line 4, in <module> a, b, c = sorted(int(e.split())) TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
p00003
C++
Time Limit Exceeded
#include <iostream> #include <stdio.h> using namespace std; int triangle(int a, int b, int c) { a = a * a; b = b * b; c = c * c; if (a == (b + c)) return 0; else if (b == (a + c)) return 0; else if (c == (a + b)) return 0; else return 1; } int main() { int n; int a, b, c; int i = 0; scanf("%d", &n); while (i < n) { scanf("%d %d %d", &a, &b, &c); if (triangle(a, b, c) == 0) { cout << "YES\n"; } else { cout << "NO\n"; } } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int triangle(int a, int b, int c) { a = a * a; b = b * b; c = c * c; if (a == (b + c)) return 0; else if (b == (a + c)) return 0; else if (c == (a + b)) return 0; else return 1; } int main() { int n; int a, b, c; int i = 0; scanf("%d", &n); while (i < n) { scanf("%d %d %d", &a, &b, &c); if (triangle(a, b, c) == 0) { cout << "YES\n"; } else { cout << "NO\n"; } i++; } return 0; }
insert
34
34
34
35
TLE
p00003
C++
Runtime Error
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n) { vector<string> ans; for (int i = 0; i < n; ++i) { int x, y, z; cin >> x >> y >> z; if (x < y + z && y < z + x && z < x + y) { if (x * x == y * y + z * z || y * y == z * z + x * x || z * z == x * x + y * y) { ans.push_back("YES"); } } else { ans.push_back("NO"); } } for (int i = 0; i < n; ++i) { cout << ans[i] << endl; } } return 0; }
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n) { vector<string> ans; for (int i = 0; i < n; ++i) { int x, y, z; cin >> x >> y >> z; if (x * x == y * y + z * z || y * y == z * z + x * x || z * z == x * x + y * y) { ans.push_back("YES"); } else { ans.push_back("NO"); } } for (int i = 0; i < n; ++i) { cout << ans[i] << endl; } } return 0; }
replace
11
16
11
14
-11
p00003
Python
Runtime Error
while True: try: input_line = input() if input_line == "": break else: nums = list(map(int, input_line.split())) max_num = max(nums) nums.remove(max_num) if max_num**2 == nums[0] ** 2 + nums[1] ** 2: print("YES") else: print("NO") except EOFError: break
n = int(input()) for i in range(0, n): nums = list(map(int, input().split())) max_num = max(nums) nums.remove(max_num) if max_num**2 == nums[0] ** 2 + nums[1] ** 2: print("YES") else: print("NO")
replace
0
15
0
9
IndexError: list index out of range
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p00003/Python/s398056618.py", line 10, in <module> if max_num**2 == nums[0]**2 + nums[1]**2: IndexError: list index out of range
p00003
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(3); for (int i = 0; i < n; ++i) { for (int j = 0; i < 3; ++j) { cin >> v[j]; } sort(v.begin(), v.end()); if (v[0] * v[0] + v[1] * v[1] == v[2] * v[2]) cout << "YES" << endl; else cout << "NO" << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(3); for (int i = 0; i < n; ++i) { cin >> v[0] >> v[1] >> v[2]; sort(v.begin(), v.end()); if (v[0] * v[0] + v[1] * v[1] == v[2] * v[2]) cout << "YES" << endl; else cout << "NO" << endl; } }
replace
12
15
12
14
TLE
p00004
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8; typedef vector<double> Vec; typedef vector<Vec> Mat; void show(const Mat &m) { puts("===="); for (int i = 0; i < m.size(); i++) { for (int j = 0; j < m[i].size(); j++) { printf("%f ", m[i][j]); } puts(""); } puts("===="); } Vec gauss_jordan(const Mat &A, const Vec &b) { int n = A.size(); Mat B(n, Vec(n + 1)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { B[i][j] = A[i][j]; } B[i][n] = b[i]; } for (int i = 0; i < n; i++) { int pivot = i; for (int j = i; j < n; j++) { if (abs(B[j][i]) > abs(B[pivot][i])) { pivot = j; } } swap(B[i], B[pivot]); if (abs(B[i][i]) < EPS) return Vec(); for (int j = i + 1; j <= n; j++) { B[i][j] /= B[i][i]; } for (int j = 0; j < n; j++) { if (i != j) { for (int k = i + 1; k <= n; k++) { B[j][k] -= B[j][i] * B[i][k]; } } } // show(B); } Vec x(n); for (int i = 0; i < n; i++) { x[i] = B[i][n]; } return x; } int main() { while (true) { Mat A(2, Vec(2)); Vec b(2); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { scanf("%lf", &A[i][j]); } scanf("%lf", &b[i]); } Vec res = gauss_jordan(A, b); printf("%.3f %.3f\n", res[0], res[1]); } return 0; }
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8; typedef vector<double> Vec; typedef vector<Vec> Mat; void show(const Mat &m) { puts("===="); for (int i = 0; i < m.size(); i++) { for (int j = 0; j < m[i].size(); j++) { printf("%f ", m[i][j]); } puts(""); } puts("===="); } Vec gauss_jordan(const Mat &A, const Vec &b) { int n = A.size(); Mat B(n, Vec(n + 1)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { B[i][j] = A[i][j]; } B[i][n] = b[i]; } for (int i = 0; i < n; i++) { int pivot = i; for (int j = i; j < n; j++) { if (abs(B[j][i]) > abs(B[pivot][i])) { pivot = j; } } swap(B[i], B[pivot]); if (abs(B[i][i]) < EPS) return Vec(); for (int j = i + 1; j <= n; j++) { B[i][j] /= B[i][i]; } for (int j = 0; j < n; j++) { if (i != j) { for (int k = i + 1; k <= n; k++) { B[j][k] -= B[j][i] * B[i][k]; } } } // show(B); } Vec x(n); for (int i = 0; i < n; i++) { x[i] = B[i][n]; } return x; } int main() { while (true) { Mat A(2, Vec(2)); Vec b(2); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { if (scanf("%lf", &A[i][j]) == EOF) return 0; } scanf("%lf", &b[i]); } Vec res = gauss_jordan(A, b); printf("%.3f %.3f\n", res[0], res[1]); } return 0; }
replace
70
71
70
72
-11
p00004
C++
Time Limit Exceeded
#include <cstdio> 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), (c * d - a * f) / (b * d - a * e)); } return 0; }
#include <cstdio> 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) != -1) { double x = (c * e - b * f) / (a * e - b * d); double y = (c * d - a * f) / (b * d - a * e); if (x == -0) x = 0; if (y == -0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
replace
6
9
6
14
TLE
p00004
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main(void) { while (scanf("") != EOF) { float equ[2][3]; for (int i = 0; i < 2; i++) for (int j = 0; j < 3; j++) cin >> equ[i][j]; float delta = -equ[0][0] * equ[1][1] + equ[0][1] * equ[1][0]; float y = (-equ[0][0] * equ[1][2] + equ[0][2] * equ [1][0]) / delta; float x = (equ[0][2] - equ[0][1] * y) / equ[0][0]; printf("%.3f %.3f\n", x, y); } }
#include <bits/stdc++.h> using namespace std; int main(void) { float a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { float delta = -a * e + b * d; float y = (-a * f + c * d) / delta; float x = (c - b * y) / a; printf("%.3f %.3f\n", x, y); } }
replace
4
17
4
9
TLE