buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1 && b == 0 && c == 0) { cout << "close" << endl; } if (a == 0 && b == 1 && c == 0) { cout << "close" << endl; } if (a == 1 && b == 1 && c == 0) { cout << "open" << endl; } if (a == 0 && b ==...
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1 && b == 0 && c == 0) { cout << "Close" << endl; } if (a == 0 && b == 1 && c == 0) { cout << "Close" << endl; } if (a == 1 && b == 1 && c == 0) { cout << "Open" << endl; } if (a == 0 && b ==...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
150
10
#include <stdio.h> int main(void) { int b1, b2, b3; scanf("%d%d%d", &b1, &b2, &b3); if (b3 == 1) { printf("Open\n"); } else if (b1 == 0 && b2 == 0) { printf("Open\n"); } else { printf("Close\n"); } return 0; }
#include <stdio.h> int main(void) { int b1, b2, b3; scanf("%d%d%d", &b1, &b2, &b3); if (b3 == 1) { printf("Open\n"); } else if (b1 == 1 && b2 == 1) { printf("Open\n"); } else { printf("Close\n"); } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
83
4
//============================================================================ // Name : AOJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <cctyp...
//============================================================================ // Name : AOJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <cctyp...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
153
4
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1 && b == 1) { cout << "Open" << endl; } if (c == 1) { cout << "Open" << endl; } else { cout << "Close" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1 && b == 1) { cout << "Open" << endl; } else if (c == 1) { cout << "Open" << endl; } else { cout << "Close" << endl; } return 0; }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
77
1
#include <iostream> using namespace std; int main(void) { int b[3]; for (int i = 0; i < 3; i++) { cin >> b[i]; } if ((b[0] == 1 && b[1] == 1) && b[2] == 0) { cout << "open" << endl; } else if ((b[0] == 0 && b[1] == 0) && b[2] == 1) { cout << "open" << endl; } else { cout << "close" << endl;...
#include <iostream> using namespace std; int main(void) { int b[3]; for (int i = 0; i < 3; i++) { cin >> b[i]; } if ((b[0] == 1 && b[1] == 1) && b[2] == 0) { cout << "Open" << endl; } else if ((b[0] == 0 && b[1] == 0) && b[2] == 1) { cout << "Open" << endl; } else { cout << "Close" << endl;...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
127
6
#include <stdio.h> int main(void) { int b1, b2, b3; scanf("%d %d %d", &b1, &b2, &b3); if (b1 == 0 && b2 == 0 && b3 == 1) printf("Open\n"); else printf("Close\n"); return 0; }
#include <stdio.h> int main(void) { int b1, b2, b3; scanf("%d %d %d", &b1, &b2, &b3); if (b1 == 1 && b2 == 1 || b3 == 1) printf("Open\n"); else printf("Close\n"); return 0; }
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 12, 13], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
66
6
#include <stdio.h> int main(void) { int a, b = 0, c, i, j; scanf("%d %d %d", &a, &b, &c); if (a == 1) { if (b == 0) { printf("Close\n"); } if (b == 1) { printf("Open\n"); } } else { if (b == 0) { if (c == 0) { printf("close\n"); } if (c == 1) { ...
#include <stdio.h> int main(void) { int a, b = 0, c, i, j; scanf("%d %d %d", &a, &b, &c); if (a == 1) { if (b == 0) { printf("Close\n"); } if (b == 1) { printf("Open\n"); } } else { if (b == 0) { if (c == 0) { printf("Close\n"); } if (c == 1) { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
137
2
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1 && b == 1 && c == 0 && a == 0 && b == 0 && c == 1) cout << "Open" << endl; else cout << "Close" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1 && b == 1 && c == 0 || a == 0 && b == 0 && c == 1) cout << "Open" << endl; else cout << "Close" << endl; return 0; }
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
73
2
#include <bits/stdc++.h> using namespace std; // pp basics #define in , #define esc_paren(...) __VA_ARGS__ #define pp_empty(...) #define pp_cat_i(x, y) x##y #define pp_cat(x, y) pp_cat_i(x, y) #define pp_inc0 1 #define pp_inc1 2 #define pp_inc2 3 #define pp_inc3 4 #define pp_inc4 5 #define pp_inc5 6 #define pp_inc6...
#include <bits/stdc++.h> using namespace std; // pp basics #define in , #define esc_paren(...) __VA_ARGS__ #define pp_empty(...) #define pp_cat_i(x, y) x##y #define pp_cat(x, y) pp_cat_i(x, y) #define pp_inc0 1 #define pp_inc1 2 #define pp_inc2 3 #define pp_inc3 4 #define pp_inc4 5 #define pp_inc5 6 #define pp_inc6...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
1,063
2
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1) { if (b == 0) { cout << "close" << endl; } else { cout << "open" << endl; } } else { if (c == 1) { cout << "open" << endl; } else { cout << "close" << endl; } } ...
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1) { if (b == 0) { cout << "Close" << endl; } else { cout << "Open" << endl; } } else { if (c == 1) { cout << "Open" << endl; } else { cout << "Close" << endl; } } ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
95
8
#include <iostream> #include <string> using namespace std; int main(void) { string s; getline(cin, s); if (s == "1 1 0" || s == "0 0 1") cout << "Open" << endl; else cout << "Closed" << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main(void) { string s; getline(cin, s); if (s == "1 1 0" || s == "0 0 1") cout << "Open" << endl; else cout << "Close" << endl; return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
59
2
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1 && b == 0 && c == 0) cout << "Close"; if (a == 0 && b == 1 && c == 0) cout << "Close"; if (a == 1 && b == 1 && c == 0) cout << "Open"; if (a == 0 && b == 0 && c == 1) cout << "Open"; if (a == ...
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 1 && b == 0 && c == 0) cout << "Close"; if (a == 0 && b == 1 && c == 0) cout << "Close"; if (a == 1 && b == 1 && c == 0) cout << "Open"; if (a == 0 && b == 0 && c == 1) cout << "Open"; if (a == ...
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6]]
1
134
2
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #includ...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
548
2
while True: try: ticket = input().split() if ticket[2] == "1": print("Open") elif ticket[0] == ticket[1] and ticket[0] == "0": print("Open") else: print("Close") except: exit()
while True: try: ticket = input().split() if ticket[2] == "1": print("Open") elif ticket[0] == ticket[1] and ticket[0] == "1": print("Open") else: print("Close") except: exit()
[["-", 75, 665, 15, 679, 12, 666, 0, 557, 0, 6], ["+", 75, 665, 15, 679, 12, 666, 0, 557, 0, 6]]
5
69
2
m=[0,1,0,0,0,0,1,0] (a, b, c) = list(map(int, input().split())) print(["Close", "Open"][a * 4 + b * 2 + c])
m=[0,1,0,0,0,0,1,0] (a, b, c) = list(map(int, input().split())) print(["Close", "Open"][m[a * 4 + b * 2 + c]])
[["+", 0, 652, 3, 4, 0, 206, 206, 206, 51, 22], ["+", 0, 652, 3, 4, 0, 206, 206, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 206, 206, 206, 0, 73]]
5
65
3
import java.util.*; class Main { int n; int[] h = new int[101]; Main() { Scanner sc = new Scanner(System.in); while (true) { n = sc.nextInt(); if (n == 0) { break; } for (int i = 0; i < n + 1; i++) { h[i] = sc.nextInt(); } for (int i = 0; i < n + 1; i++...
import java.util.*; class Main { int n; int[] h = new int[101]; Main() { Scanner sc = new Scanner(System.in); while (true) { n = sc.nextInt(); if (n == 0) { break; } for (int i = 0; i < n + 1; i++) { h[i] = sc.nextInt(); } for (int i = 0; i < n + 1; i++...
[["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46]]
3
254
4
#include <stdio.h> int main(void) { int n, h[101]; int i, j, k; int sa[101], b[101]; int flg; scanf("%d", &n); while (n != 0) { for (i = 0; i < n + 1; i++) { scanf("%d", &h[i]); } for (i = 0; i < n + 1; i++) { k = 0; for (j = 0; j < n + 1; j++) { if (i != j) { ...
#include <stdio.h> int main(void) { int n, h[101]; int i, j, k; int sa[101], b[101]; int flg; scanf("%d", &n); while (n != 0) { for (i = 0; i < n + 1; i++) { scanf("%d", &h[i]); } for (i = 0; i < n + 1; i++) { k = 0; for (j = 0; j < n + 1; j++) { if (i != j) { ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
0
254
2
#include <stdio.h> int main(void) { int i, w, cnt, n, h[101], sa[5]; while (scanf("%d", &n), n != 0) { for (i = 0; i <= n; i++) scanf("%d", &h[i]); sa[0] = h[1] - h[0]; sa[1] = h[i - 1] - h[i - 2]; sa[2] = h[(i - 1) / 2] - h[(i - 1) / 2 - 1]; sa[3] = h[(i - 1) / 2 + 1] - h[(i - 1) / 2]; ...
#include <stdio.h> int main(void) { int i, w, cnt, n, h[101], sa[5]; while (scanf("%d", &n), n != 0) { for (i = cnt = w = 0; i <= n; i++) scanf("%d", &h[i]); sa[0] = h[1] - h[0]; sa[1] = h[i - 1] - h[i - 2]; sa[2] = h[(i - 1) / 2] - h[(i - 1) / 2 - 1]; sa[3] = h[(i - 1) / 2 + 1] - h[(i - 1...
[["+", 8, 9, 0, 7, 10, 11, 12, 11, 31, 22], ["+", 8, 9, 0, 7, 10, 11, 12, 11, 17, 32], ["+", 0, 7, 10, 11, 12, 11, 12, 11, 31, 22], ["+", 0, 7, 10, 11, 12, 11, 12, 11, 17, 32]]
0
350
4
#include <iostream> using namespace std; int n; int a[101], b[100]; main() { while (cin >> n, n) { for (int i = 0; i < n + 1; i++) cin >> a[i]; for (int i = 0; i < n + 1; i++) { bool f = 1; int c = 0; for (int j = 0; j < n + 1; j++) if (i != j) b[c++] = a[j]; in...
#include <iostream> using namespace std; int n; int a[101], b[100]; main() { while (cin >> n, n) { for (int i = 0; i < n + 1; i++) cin >> a[i]; for (int i = 0; i < n + 1; i++) { bool f = 1; int c = 0; for (int j = 0; j < n + 1; j++) if (i != j) b[c++] = a[j]; in...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
177
4
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define dep(i, a, n) for (int i = a; i >= (n); i--) #define FOR(i, a, n) for (int i = a; i < (n); i++) #define mod (ll)(1e9 + 7) #define int ll #define INF 1...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define dep(i, a, n) for (int i = a; i >= (n); i--) #define FOR(i, a, n) for (int i = a; i < (n); i++) #define mod (ll)(1e9 + 7) #define int ll #define INF 1...
[["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
265
2
#include <cassert> #include <ccomplex> #include <cctype> #include <cerrno> #include <cfenv> #include <cfloat> #include <cinttypes> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstdbool> #include <cstddef> #include <cstdint>...
#include <cassert> #include <ccomplex> #include <cctype> #include <cerrno> #include <cfenv> #include <cfloat> #include <cinttypes> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstdbool> #include <cstddef> #include <cstdint>...
[["-", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 69, 28, 22]]
1
870
2
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <v...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <v...
[["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
316
2
#include <cstdio> #include <vector> using namespace std; int h[101]; int main() { int n; while (scanf("%d", &n), n) { for (int i = 0; i <= n; i++) { scanf("%d", &h[i]); } for (int i = 0; i <= n; i++) { vector<int> v; for (int j = 0; j <= n; j++) { if (i != j) v.push_b...
#include <cstdio> #include <vector> using namespace std; int h[101]; int main() { int n; while (scanf("%d", &n), n) { for (int i = 0; i <= n; i++) { scanf("%d", &h[i]); } for (int i = 0; i <= n; i++) { vector<int> v; for (int j = 0; j <= n; j++) { if (i != j) v.push_b...
[["-", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 12, 69, 28, 22]]
1
201
4
#include <iostream> #include <vector> using namespace std; int n, a[1000], s; vector<int> p; int main() { while (true) { cin >> n; if (!n) { break; } for (int i = 0; i < n + 1; i++) { cin >> a[i]; } for (int i = 0; i < n + 1; i++) { p.clear(); for (int j = 0; j < n + 1;...
#include <iostream> #include <vector> using namespace std; int n, a[1000], s; vector<int> p; int main() { while (true) { cin >> n; if (!n) { break; } for (int i = 0; i < n + 1; i++) { cin >> a[i]; } for (int i = 0; i < n + 1; i++) { p.clear(); for (int j = 0; j < n + 1;...
[["-", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["-", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["-", 15, 339, 51, 16, 31, 16, 12, 69, 28, 22],...
1
218
8
#include <iostream> using namespace std; int main() { int n, a, c, j; int b[105]; int s[105]; int i = 0; while (cin >> n && n) { n++; for (j = 0; j < n; j++) { cin >> b[j]; } c = b[1] - b[0]; for (j = 1; j < n - 1; j++) { if (c != b[j + 1] - b[j]) { if (j == 1) { ...
#include <iostream> using namespace std; int main() { int n, a, c, j; int b[105]; int s[505]; int i = 0; while (cin >> n && n) { n++; for (j = 0; j < n; j++) { cin >> b[j]; } c = b[1] - b[0]; for (j = 1; j < n - 1; j++) { if (c != b[j + 1] - b[j]) { if (j == 1) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 51, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["-", 51, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["-", 51, 16, 12, 16, 12, 69, 341, 342, 0...
1
268
8
/* * src.cpp * * Created on: 2016/08/08 * Author: joi */ #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, a) FOR(i, 0, a) const int MAX_N = 1e2; int N; int H[MAX_N + 1]; vector<int> vec; int main() { do { scanf("%d", &N); if (N...
/* * src.cpp * * Created on: 2016/08/08 * Author: joi */ #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, a) FOR(i, 0, a) const int MAX_N = 1e2; int N; int H[MAX_N + 1]; vector<int> vec; int main() { do { scanf("%d", &N); if (N...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
230
6
#include <stdio.h> int t[101]; int c[100]; int main() { int a; while (scanf("%d", &a), a) { for (int i = 0; i <= a; i++) { scanf("%d", t + i); } for (int i = 0; i <= a; i++) { int I = 0; for (int j = 0; j <= a; j++) if (i != j) c[I++] = t[j]; bool ok = true; ...
#include <stdio.h> int t[101]; int c[100]; int main() { int a; while (scanf("%d", &a), a) { for (int i = 0; i <= a; i++) { scanf("%d", t + i); } for (int i = 0; i <= a; i++) { int I = 0; for (int j = 0; j <= a; j++) if (i != j) c[I++] = t[j]; bool ok = true; ...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
198
4
#include <iostream> #include <vector> using namespace std; int n; vector<int> naes; bool isSequense(vector<int> &data) { int sa = data[1] - data[0]; for (int i = 0; i < n - 2; i++) { if (data[i + 1] - data[i] != sa) return false; } return true; } int solve() { for (int i = 0; i < n; i++) { ve...
#include <iostream> #include <vector> using namespace std; int n; vector<int> naes; bool isSequense(vector<int> &data) { int sa = data[1] - data[0]; for (int i = 0; i < n - 2; i++) { if (data[i + 1] - data[i] != sa) return false; } return true; } int solve() { for (int i = 0; i < n; i++) { ve...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
195
3
#include <bits/stdc++.h> using namespace std; bool solve(vector<int> v, int idx) { v.erase(v.begin() + idx); int diff = v[1] - v[0]; for (int i = 0; i < (int)v.size() - 1; i++) { if (diff != v[i + 1] - v[i]) return false; } return true; } int main() { int n; while (cin >> n, n) { vector<in...
#include <bits/stdc++.h> using namespace std; bool solve(vector<int> v, int idx) { v.erase(v.begin() + idx); int diff = v[1] - v[0]; for (int i = 0; i < (int)v.size() - 1; i++) { if (diff != v[i + 1] - v[i]) return false; } return true; } int main() { int n; while (cin >> n, n) { vector<in...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
190
4
while True: n = eval(input()) if n == 0: break a = list(map(int,input().split())) da = [a[i+1] - a[i] for i in range(n)] d = sorted(list(set(da)), key = lambda x:da.count(x))[1] for i in range(n): if i == 0 and a[i] + d != a[i+1]: if a[i] + 2*d == a[i+2]: print(a[i+1]) else: print(a[i]) break ...
while True: n = eval(input()) if n == 0: break a = list(map(int,input().split())) da = [a[i+1] - a[i] for i in range(n)] d = sorted(list(set(da)), key = lambda x:da.count(x))[-1] for i in range(n): if i == 0 and a[i] + d != a[i+1]: if a[i+1] + d != a[i+2]: print(a[i+1]) else: print(a[i]) break ...
[["+", 0, 1, 0, 662, 12, 206, 206, 664, 17, 33], ["+", 15, 666, 0, 657, 31, 206, 206, 657, 17, 72], ["+", 15, 666, 0, 657, 31, 206, 206, 657, 12, 612], ["-", 0, 57, 15, 666, 0, 657, 12, 657, 31, 612], ["-", 0, 57, 15, 666, 0, 657, 12, 657, 17, 48], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 57, 64, 196, 0...
5
171
7
#include <stdio.h> int main(void) { int N; int a[4]; int L, S; int i, j, cnt, tmp; while (scanf("%d", &N) != EOF) { if (N == 0000) { break; } else if (N % 1111 == 0) { printf("NA\n"); } else { cnt = 0; while (N != 6174) { a[0] = N / 1000; a[1] = N / 100 %...
#include <stdio.h> int main(void) { int N; int a[4]; int L, S; int i, j, cnt, tmp; while (scanf("%d", &N) != EOF) { if (N == 0000) { break; } else if (N % 1111 == 0) { printf("NA\n"); } else { cnt = 0; while (N != 6174) { a[0] = N / 1000; a[1] = N / 100 %...
[["-", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46]]
0
360
2
#include <stdio.h> #include <string.h> int lower(char *a, char *b) { return *a - *b; } int upper(char *a, char *b) { return *b - *a; } int main(void) { char num[8]; char lnum[8]; char unum[8]; int c; while (~scanf("%s", num)) { c = 0; while (atoi(num) != 6174) { if (atoi(num) % 1111 == 0) { ...
#include <stdio.h> #include <string.h> int lower(char *a, char *b) { return *a - *b; } int upper(char *a, char *b) { return *b - *a; } int main(void) { char num[8]; char lnum[8]; char unum[8]; int c; while (scanf("%s", num), atoi(num)) { c = 0; while (atoi(num) != 6174) { if (atoi(num) % 1111...
[["-", 8, 9, 0, 52, 15, 23, 0, 91, 17, 92], ["+", 15, 23, 0, 34, 31, 2, 3, 4, 0, 21], ["+", 15, 23, 0, 34, 31, 2, 3, 4, 0, 22], ["+", 15, 23, 0, 34, 31, 2, 3, 4, 0, 25], ["+", 0, 52, 15, 23, 0, 34, 12, 2, 63, 22], ["+", 15, 23, 0, 34, 12, 2, 3, 4, 0, 24]]
0
201
6
#include <stdio.h> #include <stdlib.h> #include <string.h> int comp1(const void *a, const void *b) { return *(char *)a - *(char *)b; } int comp2(const void *a, const void *b) { return *(char *)b - *(char *)a; } int ctoi(char *s) { return ((s[0] - '0') * 1000 + (s[1] - '0') * 100 + (s[2] - '0') * 10 + (s[3...
#include <stdio.h> #include <stdlib.h> #include <string.h> int comp1(const void *a, const void *b) { return *(char *)a - *(char *)b; } int comp2(const void *a, const void *b) { return *(char *)b - *(char *)a; } int ctoi(char *s) { return ((s[0] - '0') * 1000 + (s[1] - '0') * 100 + (s[2] - '0') * 10 + (s[3...
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 98], ["-", 0, 52, 15, 23, 0, 16, 12, 16, 31, 22], ["-", 0, 52, 15, 23, 0, 16, 12, 16, 17, 18], ["-", 0, 52, 15, 23, 0, 16, 12, 16, 12, 13]]
0
400
4
#include <bits/stdc++.h> using namespace std; int main() { int m, n, l; cin >> n; while (n != 0) { int nn[4] = {n % 10, (n / 10) % 10, (n / 100) % 10, (n / 1000) % 10}; if (nn[0] == nn[1] && nn[1] == nn[2] && nn[2] == nn[3]) { cout << "NA" << endl; } else { int cou = 0; while (nn[0] ...
#include <bits/stdc++.h> using namespace std; int main() { int m, n, l; cin >> n; while (n != 0) { int nn[4] = {n % 10, (n / 10) % 10, (n / 100) % 10, (n / 1000) % 10}; // cout<<nn[3]<<nn[2]<<nn[1]<<nn[0]<<endl; if (nn[0] == nn[1] && nn[1] == nn[2] && nn[2] == nn[3]) { cout << "NA" << endl; ...
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 17, 98], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 106], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 98], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 106], ["-", 0, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 0, 9, 0, 52, 15, 339, 51, 16, 17, 106]]
1
374
6
#include <bits/stdc++.h> using namespace std; typedef long int lint; typedef long long int llint; typedef pair<int, int> pii; typedef pair<int, string> pis; typedef pair<long, long> pll; #define EACH(i, c) \ for (__typeof((c).begin()) i = (c).begin(); i !=...
#include <bits/stdc++.h> using namespace std; typedef long int lint; typedef long long int llint; typedef pair<int, int> pii; typedef pair<int, string> pis; typedef pair<long, long> pll; #define EACH(i, c) \ for (__typeof((c).begin()) i = (c).begin(); i !=...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
367
2
#include <iostream> #include <stdio.h> using namespace std; int main() { int N, S = 0; while (1) { cin >> N; int big[4] = {0}, small[4], ans = 0; if (N == 0000) break; if (N % 1111 == 0) puts("NA"); else { while (N != 6174) { big[0] = small[0] = N / 1000; big[1...
#include <iostream> #include <stdio.h> using namespace std; int main() { int N, S = 0; while (1) { cin >> N; int big[4] = {0}, small[4], ans = 0; if (N == 0000) break; if (N % 1111 == 0) { puts("NA"); } else { while (N != 6174) { big[0] = small[0] = N / 1000; b...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 75, 76, 0, 9, 0, 52, 8, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
320
4
#include <iostream> #include <vector> using namespace std; typedef pair<int, int> P; int ans, used[1000010]; vector<P> in[1000010]; int n, m; void check(int pos) { if (used[pos] || ans) return; used[pos] = 1; for (int i = 0; i < in[pos].size(); i++) { int nx = in[pos][i].first, idx = in[pos][i].second; ...
#include <iostream> #include <vector> using namespace std; typedef pair<int, int> P; int ans, used[1000010]; vector<P> in[1000010]; int n, m; void check(int pos) { if (used[pos] || !ans) return; used[pos] = 1; for (int i = 0; i < in[pos].size(); i++) { int nx = in[pos][i].first, idx = in[pos][i].second; ...
[["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 111]]
1
371
1
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; bool check(const vector<vector<pair<int, int>>> &humans, int x, int y) { for (int i = 0; i < 4; ++i) { auto it = find(humans[i].begin(), hum...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; bool check(const vector<vector<pair<int, int>>> &humans, int x, int y) { for (int i = 0; i < 4; ++i) { auto it = find(humans[i].begin(), hum...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
1,041
4
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <iomanip> #include <iostream> #include <utility> #include <vector> using namespace std; typedef double D; typedef complex<D> P; const D EPS = 1e-8; D calc(const vector<P> &plg, D v) { int n = plg.size(); int lt...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <iomanip> #include <iostream> #include <utility> #include <vector> using namespace std; typedef double D; typedef complex<D> P; const D EPS = 1e-8; D calc(const vector<P> &plg, D v) { int n = plg.size(); int lt...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 18], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 20]]
1
676
2
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; typedef long long ll; int main() { int n, m; while (cin >> n >> m, n || m) { vector<ll> k(n); for (int i = 0; i < n; ++i) { cin >> k[i]; k[i] %= m; } vector<ll> sum(n + 1); for (int i =...
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; typedef long long ll; int main() { int n, m; while (cin >> n >> m, n || m) { vector<ll> k(n); for (int i = 0; i < n; ++i) { cin >> k[i]; k[i] %= m; } vector<ll> sum(n + 1); for (int i =...
[["-", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 22]]
1
242
4
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 28; struct SegNode { int v; SegNode(int v) : v(v) {} SegNode operator*(const SegNode &r) const { return (v > r.v ? *this : r); } } e(-(1 << 30)); struct SegmentTree { int sz; vector<SegNode> seg; SegmentTree(int n) { sz = 1; w...
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 28; struct SegNode { int v; SegNode(int v) : v(v) {} SegNode operator*(const SegNode &r) const { return (v > r.v ? *this : r); } } e(-(1 << 30)); struct SegmentTree { int sz; vector<SegNode> seg; SegmentTree(int n) { sz = 1; w...
[["-", 0, 16, 31, 118, 28, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 118, 28, 2, 3, 4, 0, 22]]
1
579
2
#include <bits/stdc++.h> #define GET_MACRO(_1, _2, _3, _4, _5, NAME, ...) NAME #define pr(...) GET_MACRO(__VA_ARGS__, pr5, pr4, pr3, pr2, pr1)(__VA_ARGS__) #define pr1(a) (#a) << "=" << (a) #define pr2(a, b) pr1(a) << ", " << pr1(b) #define pr3(a, b, c) pr2(a, b) << ", " << pr1(c) #define pr4(a, b, c, d) pr3(a, b, c) <...
#include <bits/stdc++.h> #define GET_MACRO(_1, _2, _3, _4, _5, NAME, ...) NAME #define pr(...) GET_MACRO(__VA_ARGS__, pr5, pr4, pr3, pr2, pr1)(__VA_ARGS__) #define pr1(a) (#a) << "=" << (a) #define pr2(a, b) pr1(a) << ", " << pr1(b) #define pr3(a, b, c) pr2(a, b) << ", " << pr1(c) #define pr4(a, b, c, d) pr3(a, b, c) <...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
607
6
s; main(t) { for (; gets(&t); s += atoi()) ; s = !printf("%d\n", s); }
s; main(t) { for (; gets(&t); s += atoi(&t)) ; s = !printf("%d\n", s); } //////////
[["+", 26, 11, 12, 2, 3, 4, 0, 66, 17, 67], ["+", 26, 11, 12, 2, 3, 4, 0, 66, 28, 22]]
0
37
2
#include <stdio.h> int main(void) { int a = 0; int i; for (i = 0; i < 10; i++) { int b; scanf("%d", &b); a += b; } printf("%d\n", a / 10); return 0; }
#include <stdio.h> int main(void) { int a = 0; int i; for (i = 0; i < 10; i++) { int b; scanf("%d", &b); a += b; } printf("%d\n", a); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 85], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
64
2
#include <stdio.h> int main(void) { int a[10], g = 0, i; for (i = 0; i < 10; i++) { scanf("%d", a[i]); g = g + a[i]; } printf("%d\n", g); return 0; }
#include <stdio.h> int main(void) { int a[10], g = 0, i; for (i = 0; i < 10; i++) { scanf("%d", &a[i]); g += a[i]; } printf("%d\n", g); return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107]]
0
70
5
#include <stdio.h> int main(void) { int a, b, i; a = 0; b = 0; for (i = 0; i < 10; i++) { scanf("%d", &a); a += b; } printf("%d\n", b); return 0; }
#include <stdio.h> int main(void) { int a, b, i; a = 0; b = 0; for (i = 0; i < 10; i++) { scanf("%d", &a); b = a + b; } printf("%d\n", b); return 0; }
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72]]
0
66
4
#include <cstdio> int ans, n; int main() { for (int i = 0; i < 10; i++) { scanf("%d", &n); ans += n; } printf("%d\n", &ans); }
#include <cstdio> int ans, n; int main() { for (int i = 0; i < 10; i++) { scanf("%d", &n); ans += n; } printf("%d\n", ans); }
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
54
1
### main while true n = gets.strip.to_i break if n == 0 words = [] hists = {} n.times do ws = gets.strip.split(' ') for w in ws if hists[w].nil? words << w hists[w] = 1 else hists[w] += 1 end end end #p words #p hists k = gets.strip kwords ...
### main while true n = gets.strip.to_i break if n == 0 words = [] hists = {} n.times do ws = gets.strip.split(' ') for w in ws if hists[w].nil? words << w hists[w] = 1 else hists[w] += 1 end end end #p words #p hists k = gets.strip kwords ...
[["-", 31, 739, 0, 662, 12, 738, 12, 742, 0, 22], ["+", 31, 739, 0, 662, 12, 738, 12, 742, 0, 22]]
4
148
2
#include <iostream> #include <queue> using namespace std; struct grid { char g[12][12]; int cost; }; void paint(grid gr, char l_u_cell, char changecolor, int p_x, int p_y) { if (gr.g[p_y][p_x] != l_u_cell) { return; } gr.g[p_y][p_x] = changecolor; paint(gr, l_u_cell, changecolor, p_x + 1, p_y); pain...
#include <iostream> #include <queue> using namespace std; struct grid { char g[12][12]; int cost; }; void paint(grid &gr, char l_u_cell, char changecolor, int p_x, int p_y) { if (gr.g[p_y][p_x] != l_u_cell) { return; } gr.g[p_y][p_x] = changecolor; paint(gr, l_u_cell, changecolor, p_x + 1, p_y); pai...
[["+", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67]]
1
520
2
#include <stdio.h> int main() { int n, m, i, j, k, l, mi, min, a, b, e; int c[2][110] = {0}; while (scanf("%d %d", &n, &m), n || m) { int d[110][110] = {0}; while (m--) { scanf("%d %d %d", &a, &b, &e); d[a][b] = d[b][a] = e; } for (i = 2; i <= n; i++) c[0][i] = c[1][i] = 10000000...
#include <stdio.h> int main() { int n, m, i, j, k, l, mi, min, a, b, e; int c[2][110] = {0}; while (scanf("%d %d", &n, &m), n || m) { int d[110][110] = {0}; while (m--) { scanf("%d %d %d", &a, &b, &e); d[a][b] = d[b][a] = e; } for (i = 2; i <= n; i++) c[0][i] = c[1][i] = 10000000...
[["-", 15, 23, 0, 16, 12, 69, 28, 69, 71, 22], ["+", 15, 23, 0, 16, 12, 69, 28, 69, 71, 22]]
0
441
2
#define REP(i, n) for (int i = 0; i < (int)(n); i++) #include <cstdio> #include <queue> #include <set> using namespace std; inline int getInt() { int s; scanf("%d", &s); return s; } int main() { while (true) { const int n = getInt(); const int m = getInt(); if (n + m == 0) break; con...
#define REP(i, n) for (int i = 0; i < (int)(n); i++) #include <cstdio> #include <queue> #include <set> using namespace std; inline int getInt() { int s; scanf("%d", &s); return s; } int main() { while (true) { const int n = getInt(); const int m = getInt(); if (n + m == 0) break; con...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13]]
1
502
2
#include <stdio.h> #include <string.h> #define MAX(x, y) ((x > y) ? x : y) typedef struct g { int d, s, e; } G; G a[12]; typedef struct p { int x, y, z, f; } P; P q[50000], sq[50000], cp; int qn, sqn; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; char map[25][25]; int func(int d, P p) { p.x += dx[d]; p.y ...
#include <stdio.h> #include <string.h> #define MAX(x, y) ((x > y) ? x : y) typedef struct g { int d, s, e; } G; G a[12]; typedef struct p { int x, y, z, f; } P; P q[50000], sq[50000], cp; int qn, sqn; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; char map[25][25]; int func(int d, P p) { p.x += dx[d]; p.y ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
1,023
2
#include <bits/stdc++.h> using namespace std; int w, h, n; char mas[20][20]; int change[10]; typedef pair<int, int> Pi; typedef pair<Pi, Pi> Piii; typedef pair<Piii, int> Piiii; Pi p; struct sell { int d; //値引き額 int s; //開始時刻 int e; //終了時刻 }; sell shop[10]; int min_cost[20][20][1 << 10]; int bfs() { priorit...
#include <bits/stdc++.h> using namespace std; int w, h, n; char mas[20][20]; int change[10]; typedef pair<int, int> Pi; typedef pair<Pi, Pi> Piii; typedef pair<Piii, int> Piiii; Pi p; struct sell { int d; //値引き額 int s; //開始時刻 int e; //終了時刻 }; sell shop[10]; int min_cost[20][20][1 << 10]; int bfs() { priorit...
[["-", 28, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 28, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 12, 22]]
1
922
4
#include <iostream> using namespace std; struct comd { int sn, d, s, e; }; int main() { int x, y, i, j, k, g, n, t, a, b, e, h, dx[4] = {1, 0, -1, 0}, dy[4] = {0, -1, 0, 1}, d[2][20][20][256], m[20][20], f[20][20]; char c; comd co[10]; while (cin >> x >> y && x > 0) { for (h = 0; h < 2; h++) ...
#include <iostream> using namespace std; struct comd { int sn, d, s, e; }; int main() { int x, y, i, j, k, g, n, t, a, b, e, h, dx[4] = {1, 0, -1, 0}, dy[4] = {0, -1, 0, 1}, d[2][20][20][256], m[20][20], f[20][20]; char c; comd co[10]; while (cin >> x >> y && x > 0) { for (h = 0; h < 2; h++) ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 31, 13], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 17, 33]]
1
861
4
// ynymxiaolongbao is a really pro! #include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; struct Manju { int k[10]; }; bool operator<(const Manju &m1, const Manju &m2) { for (int i = 0; i < 10; i++) { if (m1.k[i] < m2.k[i]) return true; if (m1....
// ynymxiaolongbao is a really pro! #include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; struct Manju { short k[10]; }; bool operator<(const Manju &m1, const Manju &m2) { for (int i = 0; i < 10; i++) { if (m1.k[i] < m2.k[i]) return true; if (m...
[["-", 0, 30, 0, 122, 8, 123, 0, 124, 39, 40], ["+", 0, 122, 8, 123, 0, 124, 39, 86, 0, 133], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40]]
1
716
3
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; bool check(const vector<vector<pair<int, int>>> &humans, int x, int y) { for (int i = 0; i < 4; ++i) { auto it = find(humans[i].begin(), hum...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; bool check(const vector<vector<pair<int, int>>> &humans, int x, int y) { for (int i = 0; i < 4; ++i) { auto it = find(humans[i].begin(), hum...
[["+", 0, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 48]]
1
948
2
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; const int COUNTER_CLOCKWISE = +1; const int CLOCKWISE = -1; const int ONLINE_BACK = +2; const int ONLINE_FRONT = -2; const int ON_SEGMENT = 0; const double EPS = 1e-6; const double INF = 1e10; const double PI = acos(-1); typedef complex<double> ...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; const int COUNTER_CLOCKWISE = +1; const int CLOCKWISE = -1; const int ONLINE_BACK = +2; const int ONLINE_FRONT = -2; const int ON_SEGMENT = 0; const double EPS = 1e-6; const double INF = 1e10; const double PI = acos(-1); typedef complex<double> ...
[["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
1
3,158
3
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int best = 4280; int k; int n = 0; int w = scan.nextInt(); while (w != -1) { if (w > 30) { n = 0; n += 1150 + 125 * 10 + 140 * 10 + 160 * (w ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int best = 4280; int k; int n = 0; int w = scan.nextInt(); while (w != -1) { if (w > 30) { n = 0; n += 1150 + 125 * 10 + 140 * 10 + 160 * (w ...
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 31, 499], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 31, 499]]
3
200
2
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); while (w >= 0) { int price = 1150; if (w > 30) { price *= 160 * (w - 30); w = 30; } if (w > 20) { price *= 140 *...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); while (w >= 0) { int price = 1150; if (w > 30) { price += 160 * (w - 30); w = 30; } if (w > 20) { price += 140 *...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 17, 108], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 17, 107]]
3
138
6
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); while (true) { int w = in.nextInt(); if (w == -1) break; int S = 0; if (w <= 10) { S = 1150; } else if (w <= 20) { S = 1150 + (w % ...
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); while (true) { int w = in.nextInt(); if (w == -1) break; int S = 0; if (w <= 10) { S = 1150; } else if (w <= 20) { S = 1150 + (w - ...
[["-", 12, 16, 12, 16, 31, 23, 0, 16, 17, 109], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33]]
3
160
6
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int w = sc.nextInt(); if (w == -1) break; int pay = 0; if (w < 10) pay += 1150; if (10 <= w && w < 20) pay += 125 ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int w = sc.nextInt(); if (w == -1) break; int pay = 0; if (w < 10) pay += 1150; if (10 <= w && w < 20) pay += 125 ...
[["-", 31, 16, 31, 16, 12, 23, 0, 16, 12, 499], ["+", 31, 16, 31, 16, 12, 23, 0, 16, 12, 499]]
3
165
2
import java.util.Scanner; public class Main { public static void main(String[] args) throws java.io.IOException { Scanner scan = new Scanner(System.in); int w = scan.nextInt(); int m = 4280; while (w != -1) { int r = 0; if (w <= 10) { r = 1150; } else if (w <= 20) { r...
import java.util.Scanner; public class Main { public static void main(String[] args) throws java.io.IOException { Scanner scan = new Scanner(System.in); int w = scan.nextInt(); int m = 4280; while (w != -1) { int r = 0; if (w <= 10) { r = 1150; } else if (w <= 20) { r...
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 12, 499], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 499]]
3
169
2
import java.util.Scanner; public class Main { public static void main(String arg[]) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int n = in.nextInt(); if (n == -1) return; int uti = 1150; int be = 4280; int count = 11; if (n > 10) while (c...
import java.util.Scanner; public class Main { public static void main(String arg[]) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int n = in.nextInt(); if (n == -1) return; int uti = 1150; int be = 4280; int count = 11; if (n > 10) while (c...
[["-", 64, 52, 15, 15, 0, 16, 31, 16, 12, 499], ["-", 0, 57, 64, 52, 15, 15, 0, 16, 17, 98], ["-", 64, 52, 15, 15, 0, 16, 12, 16, 31, 22], ["-", 64, 52, 15, 15, 0, 16, 12, 16, 17, 19]]
3
164
4
#include <stdio.h> int main(void) { int i, w, s, k = 0; while (1) { scanf("%d", &w); if (w == -1) break; for (i = 11, k = 1150; i <= w; i++) { if (i <= 20) k += 140; else if (i <= 30) k += 140; else k += 1160; } printf("%d\n", 4280 - k); } retu...
#include <stdio.h> int main(void) { int i, w, s, k = 0; while (1) { scanf("%d", &w); if (w == -1) break; for (i = 11, k = 1150; i <= w; i++) { if (i <= 20) k += 125; else if (i <= 30) k += 140; else k += 160; } printf("%d\n", 4280 - k); } retur...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["-", 0, 57, 75, 76, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 13]]
0
106
4
#include <stdio.h> int main(void) { int w; while (scanf("%d", &w) + w != 0) { int money = 1150; if (w > 30) { money += (w - 30) * 160; w -= w % 30; } if (w > 20) { money += (w - 20) * 140; w -= w % 20; } if (w > 10) { money += (w - 10) * 125; } printf...
#include <stdio.h> int main(void) { int w; while (scanf("%d", &w) + w != 0) { int money = 1150; if (w > 30) { money += (w - 30) * 160; w = 30; } if (w > 20) { money += (w - 20) * 140; w = 20; } if (w > 10) { money += (w - 10) * 125; } printf("%d\n", 4...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
116
8
#// AOJ Volume2 0216 #include <stdio.h> int fee(int w) { int f; int wt; // 第1段階 f = 1150; // 第2段階 w -= 10; if (w <= 0) { return (f); } if (w > 10) { wt = 10; } else { wt = w; } f += wt * 125; // 第3段階 w -= 10; if (w <= 0) { return (f); } if (w > 10) { wt = 10; ...
#// AOJ Volume2 0216 #include <stdio.h> int fee(int w) { int f; int wt; // 第1段階 f = 1150; // 第2段階 w -= 10; if (w <= 0) { return (f); } if (w > 10) { wt = 10; } else { wt = w; } f += wt * 125; // 第3段階 w -= 10; if (w <= 0) { return (f); } if (w > 10) { wt = 10; ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
194
4
#include <stdio.h> int main(void) { int w; int m, i; while (scanf("%d", &w) && w != -1) { m = 1150; if (10 < w && w <= 20) m = m + 125 * (w - 10); if (20 < w && w <= 30) m = m + 140 * (w - 20) + 1250; if (30 < w && w <= 40) m = m + 160 * (w - 30) + 2650; printf("%d\n", 4280...
#include <stdio.h> int main(void) { int w; int m, i; while (scanf("%d", &w) && w != -1) { m = 1150; if (10 < w && w <= 20) m = m + 125 * (w - 10); if (20 < w && w <= 30) m = m + 140 * (w - 20) + 1250; if (30 < w) m = m + 160 * (w - 30) + 2650; printf("%d\n", 4280 - m); } ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 98], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 19], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13]]
0
124
4
#include <stdio.h> int main(void) { int water, bill; scanf("%d", &water); while (water != -1) { bill = 1150; if (water - 10 > 0) bill += (water - 10) * 125; if (water - 20 > 0) bill += (water - 20) * 15; if (water - 30 > 0) bill += (water - 30) * 20; printf("%d\n", bill - 42...
#include <stdio.h> int main(void) { int water, bill; scanf("%d", &water); while (water != -1) { bill = 1150; if (water - 10 > 0) bill += (water - 10) * 125; if (water - 20 > 0) bill += (water - 20) * 15; if (water - 30 > 0) bill += (water - 30) * 20; printf("%d\n", 4280 - bi...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
117
4
int main(void) { while (1) { int w; int s = 0, t = 0, f = 0; int sum; scanf("%d", &w); if (w == -1) break; if (w > 10) w = w - 10; if (w > 10) s = 10; else if (w > 0) s = w; w = w - 10; if (w > 10) t = 10; else if (w > 0) t = w; w = w...
int main(void) { while (1) { int w; int s = 0, t = 0, f = 0; int sum; scanf("%d", &w); if (w == -1) break; w = w - 10; if (w > 10) s = 10; else if (w > 0) s = w; w = w - 10; if (w > 10) t = 10; else if (w > 0) t = w; w = w - 10; if (w >...
[["-", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["-", 0, 52, 8, 9, 0, 57, 15, 23, 0, 24], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["-", 0, 52, 8, 9, 0, 57, 15, 23, 0, 25]]
0
157
6
#include <stdio.h> int main(void) { int a, b, i; while (1) { scanf("%d", &a); if (a == -1) break; b = 0; if (a <= 10) { b = 1150; } else if (10 < a <= 20) { b = 1150; for (i = 0; i < a - 10; i++) { b += 125; } } else if (20 < a <= 30) { b = 2400; ...
#include <stdio.h> int main(void) { int a, b, i; while (1) { scanf("%d", &a); if (a == -1) break; b = 0; if (a <= 10) { b = 1150; } else if (a <= 20) { b = 1150; for (i = 0; i < a - 10; i++) { b += 125; } } else if (a <= 30) { b = 2400; for (...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 31, 13], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18]]
0
177
4
#include <stdio.h> int main() { while (1) { int w; scanf("%d", &w); if (w == -1) break; if (w <= 10) { printf("%d", 4280 - 1150); } else if (w <= 20) { printf("%d\n", 4280 - 1150 - 125 * (w - 10)); } else if (w <= 30) { printf("%d\n", 4280 - 1150 - 1250 - (140 * (w - 20...
#include <stdio.h> int main() { while (1) { int w; scanf("%d", &w); if (w == -1) break; if (w <= 10) { printf("%d\n", 4280 - 1150); } else if (w <= 20) { printf("%d\n", 4280 - 1150 - 125 * (w - 10)); } else if (w <= 30) { printf("%d\n", 4280 - 1150 - 1250 - (140 * (w - ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
148
1
main(n) { for (; scanf("%d", &n) + n; printf("%d\n", (n < 11 ? 626 : n < 21 ? 886 - n * 25 : n < 31 ? 936 - n * 28 : 1056 - n * 32) * ...
main(n) { for (; scanf("%d", &n) + n; printf("%d\n", (n < 11 ? 626 : n < 21 ? 876 - n * 25 : n < 31 ? 936 - n * 28 : 1056 - n * 32) * ...
[["-", 31, 23, 0, 41, 75, 41, 64, 16, 31, 13], ["+", 31, 23, 0, 41, 75, 41, 64, 16, 31, 13]]
0
66
2
#include <stdio.h> int main() { int a; int R; scanf("%d", &a); while (a != -1) { R = 1150; if (20 <= a) { R += 1250; } else if (10 <= a) { R += (a - 10) * 125; } if (a >= 30) { R += 1400; R += (a - 30) * 160; } else if (20 <= a) { R += (a - 20) * 140; }...
#include <stdio.h> int main() { int a; int R; scanf("%d", &a); while (a != -1) { R = 1150; if (20 <= a) { R += 1250; } else if (10 <= a) { R += (a - 10) * 125; } if (a >= 30) { R += 1400; R += (a - 30) * 160; } else if (20 <= a) { R += (a - 20) * 140; }...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33]]
0
131
2
#include <stdio.h> int main() { int w; while (1) { scanf("%d", &w); if (w == -1) break; if (w <= 10) printf("3130\n"); else if (w <= 20) printf("%d\d", 3130 - 125 * (w - 10)); else if (w <= 30) printf("%d\n", 1880 - 140 * (w - 20)); else printf("%d\n", 480 - 1...
#include <stdio.h> int main() { int w; while (1) { scanf("%d", &w); if (w == -1) break; if (w <= 10) printf("3130\n"); else if (w <= 20) printf("%d\n", 3130 - 125 * (w - 10)); else if (w <= 30) printf("%d\n", 1880 - 140 * (w - 20)); else printf("%d\n", 480 - 1...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
121
2
#include <stdio.h> int main(void) { int w, a; while (scanf("%d", &w) != EOF && w != -1) { int rates = 1150; if (w > 30) { rates += (1250 + 1400); rates += (w - 30) * 160; } else { if (w > 20) { rates += 1250; rates += (w - 20) * 140; } else if (10 < w && w < 2...
#include <stdio.h> int main(void) { int w, a; while (scanf("%d", &w) != EOF && w != -1) { int rates = 1150; if (w > 30) { rates += (1250 + 1400); rates += (w - 30) * 160; } else { if (w > 20) { rates += 1250; rates += (w - 20) * 140; } else if (10 < w && w <= ...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 19]]
0
128
2
#include <bits/stdc++.h> using namespace std; int main() { while (true) { int w; cin >> w; if (w == -1) break; if (w <= 10) cout << 4280 - (1150) << "\n"; w -= 10; if (w <= 10 && w > 0) cout << 4280 - (1150 + w * 125) << "\n"; w -= 10; if (w <= 10 && w > 0) cout...
#include <bits/stdc++.h> using namespace std; int main() { while (true) { int w; cin >> w; if (w == -1) break; if (w <= 10) cout << 4280 - 1150 << "\n"; w -= 10; if (w <= 10 && w > 0) cout << 4280 - (1150 + w * 125) << "\n"; w -= 10; if (w <= 10 && w > 0) cout <...
[["-", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["-", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
152
4
#include <stdio.h> int main() { int W, T = 4280; int d = 0, x = 0; while (1) { scanf("%d", &W); if (W == -1) break; T = T - 1150; if (W <= 10) { printf("%d\n", T); } else if (W <= 20) { d = 125 * (W - 10); T = T - d; printf("%d\n", T); } else if (W <= 30) { ...
#include <stdio.h> int main() { int W, T = 4280; int d = 0, x = 0; while (1) { scanf("%d", &W); if (W == -1) break; T = T - 1150; if (W <= 10) { printf("%d\n", T); } else if (W <= 20) { d = 125 * (W - 10); T = T - d; printf("%d\n", T); } else if (W <= 30) { ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
186
4
#include <bits/stdc++.h> using namespace std; int w; int main() { while (cin >> w && (~w)) { int res = 1150; if (w > 10) { res += min(10, w - 10) * 125; } if (w > 20) { res += min(10, w - 20) * 140; } if (w > 30) { res += (w - 30) * 160; } cout << -4280 + res << endl...
#include <bits/stdc++.h> using namespace std; int w; int main() { while (cin >> w && (~w)) { int res = 1150; if (w > 10) { res += min(10, w - 10) * 125; } if (w > 20) { res += min(10, w - 20) * 140; } if (w > 30) { res += (w - 30) * 160; } cout << 4280 - res << endl;...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]]
1
101
4
#include <stdio.h> #include <string.h> int main(void) { int a, s, d, f, g, h, i, j; scanf("%d", &a); while (a != -1) { s = 4280 - 1150; if (a > 10 && a <= 20) { s = 4280 - (a - 10) * 125 + 1150; } if (a > 20 && a <= 30) { s = 4280 - ((a - 20) * 140 + 1250 + 1150); } if (a > 30)...
#include <stdio.h> #include <string.h> int main(void) { int a, s, d, f, g, h, i, j; scanf("%d", &a); while (a != -1) { s = 4280 - 1150; if (a > 10 && a <= 20) { s = 4280 - ((a - 10) * 125 + 1150); } if (a > 20 && a <= 30) { s = 4280 - ((a - 20) * 140 + 1250 + 1150); } if (a > 3...
[["+", 12, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
159
2
#include <iostream> using namespace std; int main() { while (1) { int w; cin >> w; if (w == -1) break; if (w <= 10) { cout << 4280 - 1150 << endl; } else if (w <= 20 && w >= 11) { cout << 4280 - 1150 - 125 * (w - 10) << endl; } else if (w <= 30 && w >= 21) { cout << 428...
#include <iostream> using namespace std; int main() { while (1) { int w; cin >> w; if (w == -1) break; if (w <= 10) { cout << 4280 - 1150 << endl; } else if (w <= 20 && w >= 11) { cout << 4280 - 1150 - 125 * (w - 10) << endl; } else if (w <= 30 && w >= 21) { cout << 428...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 12, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 12, 16, 12, 16, 12, 23, 0, 16, 12, 13]]
1
148
6
#include <iostream> using namespace std; int main() { int x; while (1) { cin >> x; if (x == -1) break; else if (0 <= x && x <= 10) cout << 4280 - 1150 << endl; else if (11 <= x && x <= 20) cout << 4280 - 1150 - 125 * (x - 10) << endl; else if (21 <= x && x <= 30) cout << ...
#include <iostream> using namespace std; int main() { int x; while (1) { cin >> x; if (x == -1) break; else if (0 <= x && x <= 10) cout << 4280 - 1150 << endl; else if (11 <= x && x <= 20) cout << 4280 - 1150 - 125 * (x - 10) << endl; else if (21 <= x && x <= 30) cout << ...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
145
4
using namespace std; #include <algorithm> #include <functional> #include <iostream> #include <set> #include <stdio.h> #include <string> #include <vector> int main() { int n; while (cin >> n && n != -1) { int ans = 1150; if (10 < n) ans += min(10, (n - 10)) * 125; if (20 < n) ans += min(10, (...
using namespace std; #include <algorithm> #include <functional> #include <iostream> #include <set> #include <stdio.h> #include <string> #include <vector> int main() { int n; while (cin >> n && n != -1) { int ans = 1150; if (10 < n) ans += min(10, (n - 10)) * 125; if (20 < n) ans += min(10, (...
[["-", 64, 1, 0, 11, 12, 16, 31, 2, 63, 22], ["-", 0, 11, 12, 16, 31, 2, 3, 4, 0, 13], ["-", 0, 11, 12, 16, 31, 2, 3, 4, 0, 21], ["-", 12, 16, 31, 2, 3, 4, 0, 23, 0, 24], ["-", 12, 16, 31, 2, 3, 4, 0, 23, 0, 25]]
1
118
5
#include <iostream> using namespace std; int main() { int a = 4280, b, sum, ans; while (true) { cin >> b; if (b == -1) break; if (b <= 10) { sum = 1150; ans = a - sum; cout << ans << endl; } if (b > 10 && b <= 20) { sum = 1150 + (b - 10) * 125; ans = a - sum; ...
#include <iostream> using namespace std; int main() { int a = 4280, b, sum, ans; while (true) { cin >> b; if (b == -1) break; if (b <= 10) { sum = 1150; ans = a - sum; cout << ans << endl; } if (b > 10 && b <= 20) { sum = 1150 + (b - 10) * 125; ans = a - sum; ...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13]]
1
175
2
#include <algorithm> #include <iostream> using namespace std; int main() { int w; while (true) { int x = 1150; cin >> w; if (w < 0) { return 0; } w -= 10; if (w > 0) { x += 125 * min(10, w); } w -= 10; if (w > 0) { x += 140 * min(10, w); } w -= 10; ...
#include <algorithm> #include <iostream> using namespace std; int main() { int w; while (true) { int x = 1150; cin >> w; if (w < 0) { return 0; } w -= 10; if (w > 0) { x += 125 * min(10, w); } w -= 10; if (w > 0) { x += 140 * min(10, w); } w -= 10; ...
[["-", 0, 1, 0, 11, 12, 16, 12, 2, 63, 22], ["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 13], ["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 21], ["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 25]]
1
120
5
#include <cstdio> #include <iostream> using namespace std; int main() { int w; while (1) { int rs; scanf("%d", &w); if (w == -1) { break; } if (w <= 10) { rs = 1150; } else if (w <= 20) { rs = 1150 + (w % 10) * 125; } else if (w <= 30) { rs = 1150 + 1250 + (w...
#include <cstdio> #include <iostream> using namespace std; int main() { int w; while (1) { int rs; scanf("%d", &w); if (w == -1) { break; } if (w <= 10) { rs = 1150; } else if (w <= 20) { rs = 1150 + (w - 10) * 125; } else if (w <= 30) { rs = 1150 + 1250 + (w...
[["-", 12, 16, 12, 16, 31, 23, 0, 16, 17, 109], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["-", 12, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 12, 13]]
1
140
8
#include <algorithm> #include <iostream> using namespace std; typedef long long lli; const int N = 10; const int M = 50; const lli INF = 1LL << 40; int w, h, f, m, o; int dat[N][N]; lli dp[N + 1][N][1 << N][M + 1]; main() { while (cin >> w >> h && (w | h)) { cin >> f >> m >> o; for (int i = 0; i < h; i++) ...
#include <algorithm> #include <iostream> using namespace std; typedef long long lli; const int N = 10; const int M = 50; const lli INF = 1LL << 40; int w, h, f, m, o; int dat[N][N]; lli dp[N + 1][N][1 << N][M + 1]; main() { while (cin >> w >> h && (w | h)) { cin >> f >> m >> o; for (int i = 0; i < h; i++) ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
1,162
8
#include <stdio.h> int main() { int n, a, b, t, ans = 0; int i, j, k, l, p, q, far = 0, sta[20] = {0}, now = 0, tail = 0, count; int lis [20] [23]; // 0-19隣接リスト,20隣接する島への時間の合計,21隣接する島の数,22島1からの時間 scanf("%d", &n); while (n > 0) { for (p = 0; p < 20; p++) { for (q = 0; q < 23; q++) { ...
#include <stdio.h> int main() { int n, a, b, t, ans = 0; int i, j, k, l, p, q, far = 0, sta[20] = {0}, now = 0, tail = 0, count; int lis [20] [23]; // 0-19隣接リスト,20隣接する島への時間の合計,21隣接する島の数,22島1からの時間 scanf("%d", &n); while (n > 0) { for (p = 0; p < 20; p++) { for (q = 0; q < 23; q++) { ...
[["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 98], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13]]
0
498
4
#include <bits/stdc++.h> using namespace std; #define int long long #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define REP(i, n) FOR(i, 0, n) #define REPR(i, m) for (int(i) = (m); (i) >= 0; (i)--) #define REPONE(i, n) FOR(i, 1, n + 1) #define ALL(a) (a).begin(), (a).end() #define MP make_pair #define X ...
#include <bits/stdc++.h> using namespace std; #define int long long #define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define REP(i, n) FOR(i, 0, n) #define REPR(i, m) for (int(i) = (m); (i) >= 0; (i)--) #define REPONE(i, n) FOR(i, 1, n + 1) #define ALL(a) (a).begin(), (a).end() #define MP make_pair #define X ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 1, 0, 11, 12, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 11, 12, 16, 12, 13]]
1
427
4
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; struct edge { int to, cost; }; int n, a, b, c; int main() { while (cin >> n, n) { vector<vector<edge>> G(n); for (int i = 0; i < n - 1; i++) { cin >> a >> b >> c; a--, b--; G[a].push_back(edge{...
#include <algorithm> #include <iostream> #include <queue> #include <vector> using namespace std; struct edge { int to, cost; }; int n, a, b, c; int main() { while (cin >> n, n) { vector<vector<edge>> G(n); for (int i = 0; i < n - 1; i++) { cin >> a >> b >> c; a--, b--; G[a].push_back(edge{...
[["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 13]]
1
394
2
#include <algorithm> #include <cstdio> #include <cstring> #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--) constexpr int MAX_N = 20; int N, ans = 0, bridges...
#include <algorithm> #include <cstdio> #include <cstring> #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--) constexpr int MAX_N = 20; int N, ans = 0, bridges...
[["-", 64, 9, 0, 1, 0, 11, 12, 11, 12, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 11, 12, 13]]
1
377
2
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; vector<P> E[20], G[20]; bool used[20]; void C(int u) { used[u] = true; for (P v : E[u]) { if (0 < G[v.second].size() && !used[v.second]) { G[u].push_back(v); C(v.second); } }...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; vector<P> E[20], G[20]; bool used[20]; void C(int u) { used[u] = true; for (P v : E[u]) { if (0 < E[v.second].size() && !used[v.second]) { G[u].push_back(v); C(v.second); } }...
[["-", 31, 16, 12, 2, 63, 118, 28, 69, 28, 22], ["+", 31, 16, 12, 2, 63, 118, 28, 69, 28, 22]]
1
387
2
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> #define P pair<int, int> // cost to using namespace std; bool X[20]; vector<P> rinsetu[20]; bool S[20]; int MAX...
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> #define P pair<int, int> // cost to using namespace std; bool X[20]; vector<P> rinsetu[20]; bool S[20]; int MAX...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
349
2
// 2011/01/10 Tazoe #include <iostream> using namespace std; void swp(int abt[20][3], int i, int j) { abt[19][0] = abt[i][0]; abt[19][1] = abt[i][1]; abt[19][2] = abt[i][2]; abt[i][0] = abt[j][0]; abt[i][1] = abt[j][1]; abt[i][2] = abt[j][2]; abt[j][0] = abt[19][0]; abt[j][1] = abt[19][1]; abt[j][2]...
// 2011/01/10 Tazoe #include <iostream> using namespace std; void swp(int abt[20][3], int i, int j) { abt[19][0] = abt[i][0]; abt[19][1] = abt[i][1]; abt[19][2] = abt[i][2]; abt[i][0] = abt[j][0]; abt[i][1] = abt[j][1]; abt[i][2] = abt[j][2]; abt[j][0] = abt[19][0]; abt[j][1] = abt[19][1]; abt[j][2]...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
679
5
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_set> #include <vector> using namespace std; #define FOR(i, k, n)...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_set> #include <vector> using namespace std; #define FOR(i, k, n)...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
914
2
#include <stdio.h> int main(void) { int t; int n; while (scanf("%d", &t), t != 0) { scanf("%d", &n); while (n-- > 0) { int s, f; scanf("%d %d", &s, &f); t -= f - s; } if (t == 0) { puts("OK"); } else { printf("%d\n", t); } } return 0; }
#include <stdio.h> int main(void) { int t; int n; while (scanf("%d", &t), t != 0) { scanf("%d", &n); while (n-- > 0) { int s, f; scanf("%d %d", &s, &f); t -= f - s; } if (t <= 0) { puts("OK"); } else { printf("%d\n", t); } } return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
107
2
#include <stdio.h> int main(void) { int t, n, s, f, time, i; scanf("%d", &t); while (t) { time = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &s, &f); time += f - s; } if (time >= t) { puts("OK"); } else { printf("%d", t - time); } scanf("%d",...
#include <stdio.h> int main(void) { int t, n, s, f, time, i; scanf("%d", &t); while (t) { time = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &s, &f); time += f - s; } if (time >= t) { puts("OK"); } else { printf("%d\n", t - time); } scanf("%d...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
130
1
#include <stdio.h> int main(void) { int t, n, s, f, sum; int i; while (1) { sum = 0; scanf("%d", &t); if (t == 0) break; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &s, &f); sum += f - s; } if (sum >= t) printf("OK\n"); else printf("%d", ...
#include <stdio.h> int main(void) { int t, n, s, f, sum; int i; while (1) { sum = 0; scanf("%d", &t); if (t == 0) break; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &s, &f); sum += f - s; } if (sum >= t) printf("OK\n"); else printf("%d\n"...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
124
1
#include <stdio.h> int main(void) { int t, n, i, s, e, zen = 0; while (1) { scanf("%d", &t); if (t == 0) break; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &s, &e); zen += e - s; } if (zen >= t) printf("OK\n"); else printf("%d\n", t - zen); }...
#include <stdio.h> int main(void) { int t, n, i, s, e, zen = 0; while (1) { scanf("%d", &t); if (t == 0) break; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &s, &e); zen += e - s; } if (zen >= t) printf("OK\n"); else printf("%d\n", t - zen); ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
122
4
#include <stdio.h> int main() { int n; int t; int i; int start; int stop; int time = 0; while (scanf("%d", &t) != 0) { if (t == 0) break; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &start, &stop); time += stop - start; } if (t <= time) { printf("O...
#include <stdio.h> int main() { int n; int t; int i; int start; int stop; int time = 0; while (scanf("%d", &t) != 0) { if (t == 0) break; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &start, &stop); time += stop - start; } if (t <= time) { printf("O...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
0
134
2
#include <stdio.h> int main(void) { int i, t, n, s, f, total; /* 1行目 1日の目標時間t(整数) 2行目 勉強の回数 n(整数) 3行目 第1の勉強の開始時刻s 終了時刻f(整数 整数;半角空白区切り) : n+2行目 第nの勉強の開始時刻s 終了時刻f */ while (scanf("%d\n", &t) == 1) { if (!t) break; total = 0; scanf("%d\n", &n); for (i = 0; i < n; i++) { sca...
#include <stdio.h> int main(void) { int i, t, n, s, f, total; /* 1行目 1日の目標時間t(整数) 2行目 勉強の回数 n(整数) 3行目 第1の勉強の開始時刻s 終了時刻f(整数 整数;半角空白区切り) : n+2行目 第nの勉強の開始時刻s 終了時刻f */ while (scanf("%d\n", &t) == 1) { if (!t) break; total = 0; scanf("%d\n", &n); for (i = 0; i < n; i++) { sca...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, ...
0
135
8