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
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { Scanner sc = new Scanner(System.in); public void run() { while (sc.hasNext()) { n = sc.nextInt(); m = sc.nextInt(); if (n == 0 && m == 0) break; else calc(n, m); } }...
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { Scanner sc = new Scanner(System.in); public void run() { while (sc.hasNext()) { n = sc.nextInt(); m = sc.nextInt(); if (n == 0 && m == 0) break; else calc(n, m); } }...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499]]
3
482
2
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vecto...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vecto...
[["-", 0, 82, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 82, 8, 9, 0, 7, 15, 16, 12, 13]]
1
451
2
#include <stdio.h> #define MAX_N 200000 int par[MAX_N]; int original_par[MAX_N]; int rank[MAX_N]; int query_list[MAX_N][2]; void init(int n) { int i; for (i = 0; i < n; i++) { par[i] = i; rank[i] = 0; } } int find(int x) { if (par[x] == x) { return x; } else { return par[x] = find(par[x]); ...
#include <stdio.h> #define MAX_N 200000 int par[MAX_N]; int original_par[MAX_N]; int rank[MAX_N]; int query_list[MAX_N][2]; void init(int n) { int i; for (i = 0; i < n; i++) { par[i] = i; rank[i] = 0; } } int find(int x) { if (par[x] == x) { return x; } else { return par[x] = find(par[x]); ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
0
595
7
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stdio.h> #include <string.h> #include <string> #include <vector> //#pragma comment(linker,"/STACK:1024000000,1024000000") using namespace std; const int INF = 0x3f3f3f3f; const double e...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stdio.h> #include <string.h> #include <string> #include <vector> //#pragma comment(linker,"/STACK:1024000000,1024000000") using namespace std; const int INF = 0x3f3f3f3f; const double e...
[["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
242
4
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> using namespace std; //------- Union-Find木 --------- vector<int> par; // 親 // 初期化 void init(int n) { par = vector<int>(n); par[0] = 0; } // 木の根を求める int find(int x) { if (par[x] == x) { ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> using namespace std; //------- Union-Find木 --------- vector<int> par; // 親 // 初期化 void init(int n) { par = vector<int>(n); par[0] = 0; } // 木の根を求める int find(int x) { if (par[x] == x) { ...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 16, 31, 118, 119, 120]]
1
520
7
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1000000000; #define REP(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) typedef pair<bool, int> bi; int T[100000]; bool marked[100000]; int N; int dfs(int v) { if (marked[v]) return v; else ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1000000000; #define REP(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) typedef pair<bool, int> bi; int T[100000]; bool marked[100000]; int N; int dfs(int v) { if (marked[v]) return v; else ...
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 9, 0, 1, 0, 16, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22]]
1
242
6
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <typeinfo> #include <vector> #define syos...
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <typeinfo> #include <vector> #define syos...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
667
4
#include <algorithm> #include <cmath> #include <cstdlib> #include <ctime> #include <iostream> #include <vector> using namespace std; #define REP(i, b, n) for (int i = b; i < n; i++) #define rep(i, n) REP(i, 0, n) #define N 101 const double eps = 1e-8; // n matrix size a00+x0+...=c0 // k current step // mat Matrix boo...
#include <algorithm> #include <cmath> #include <cstdlib> #include <ctime> #include <iostream> #include <vector> using namespace std; #define REP(i, b, n) for (int i = b; i < n; i++) #define rep(i, n) REP(i, 0, n) #define N 101 const double eps = 1e-8; // n matrix size a00+x0+...=c0 // k current step // mat Matrix boo...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 12, 16, 12, 16, 31, 69, 28, 69, 28, 22], ["+", 12, 16, 12, 16, 31, 69, 28, 69, 28, 22]]
1
830
4
L = int(input().strip()) for _ in range(0,L): gx,gy = map(int,input().strip().split(" ")) heiankyo = [[0 for j in range(0,gx+1)] for i in range(0,gy+1)] heiankyo[0][0] = 1 P = int(input()) matatabi = [] for p in range(P): x1,y1,x2,y2 = map(int,input().strip().split(" ")) l = [[x1...
L = int(input().strip()) for _ in range(0,L): gx,gy = map(int,input().strip().split(" ")) heiankyo = [[0 for j in range(0,gx+1)] for i in range(0,gy+1)] heiankyo[0][0] = 1 P = int(input()) matatabi = [] for p in range(P): x1,y1,x2,y2 = map(int,input().strip().split(" ")) l = [[y1...
[["-", 0, 1, 0, 662, 12, 634, 0, 634, 0, 22], ["-", 0, 1, 0, 662, 12, 634, 0, 634, 0, 21], ["+", 0, 1, 0, 662, 12, 634, 0, 634, 0, 21], ["+", 0, 1, 0, 662, 12, 634, 0, 634, 0, 22]]
5
397
8
#include <iostream> using namespace std; int n, a[2][9]; bool used[10]; int rec(int dep, int s) { if (dep == 9) return (s > 0 ? 1 : 0); int ret = 0; for (int i = 0; i < 9; i++) { if (!used[i]) { used[i] = true; if (a[0][i] > a[1][dep]) ret += rec(dep + 1, s + a[0][i] + a[1][dep]); ...
#include <iostream> using namespace std; int n, a[2][9]; bool used[10]; int rec(int dep, int s) { if (dep == 9) return (s > 0 ? 1 : 0); int ret = 0; for (int i = 0; i < 9; i++) { if (!used[i]) { used[i] = true; if (a[0][i] > a[1][dep]) ret += rec(dep + 1, s + a[0][i] + a[1][dep]); ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
1
254
5
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; vector<vector<int>> flag((6000), vector<int>(1 << 9)); vector<vector<pair<double, double>>> memo((10000), vector<pair<double, double>>(1 << 9)); pair...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; vector<vector<int>> flag((4000), vector<int>(1 << 9)); vector<vector<pair<double, double>>> memo((4000), vector<pair<double, double>>(1 << 9)); pair<...
[["-", 0, 43, 49, 50, 51, 4, 0, 23, 0, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 23, 0, 13], ["-", 49, 50, 51, 16, 31, 16, 12, 16, 31, 13], ["+", 49, 50, 51, 16, 31, 16, 12, 16, 31, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 13], ["+", 8, ...
1
671
10
import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.ListIterator; import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int n = sc.nextInt(); for...
import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.ListIterator; import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int n = sc.nextInt(); for...
[["+", 49, 200, 51, 16, 12, 16, 31, 23, 0, 24], ["+", 51, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 51, 16, 12, 16, 31, 23, 0, 16, 12, 499], ["+", 49, 200, 51, 16, 12, 16, 31, 23, 0, 25], ["-", 0, 503, 49, 200, 51, 16, 12, 16, 12, 499], ["+", 0, 503, 49, 200, 51, 16, 12, 16, 12, 499]]
3
184
6
#include <stdio.h> int main() { int i, N, tmp, cnt; char c1, c2; scanf("%d%*c", &N); for (i = 0; i < N; i++) { cnt = 0; while (1) { c1 = getc(stdin); if (c1 == '\n') break; c2 = getc(stdin); if (c2 == '\n') break; tmp = (c1 + c2) - (2 * '0'); if (t...
#include <stdio.h> int main() { int i, N, tmp, cnt; char c1, c2; scanf("%d%*c", &N); for (i = 0; i < N; i++) { cnt = 0; while (1) { c1 = getc(stdin); if (c1 == '\n') break; c2 = getc(stdin); if (c2 == '\n') break; tmp = (c1 + c2) - (2 * '0'); if (t...
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6]]
0
191
2
/* AOJ 2189 Title:Additon game @kankichi573 */ #include <stdio.h> #include <string.h> char buf[1001]; main() { int i, j, len, sum, N, ret; scanf("%d ", &N); for (i = 0; i < N; i++) { scanf("%s", buf); len = strlen(buf); for (j = sum = 0; j < len; j++) sum += (buf[j] - '0'); ret = ((...
/* AOJ 2189 Title:Additon game @kankichi573 */ #include <stdio.h> #include <string.h> char buf[1001]; main() { int i, j, len, sum, N, ret; scanf("%d ", &N); for (i = 0; i < N; i++) { scanf("%s", buf); len = strlen(buf); for (j = sum = 0; j < len; j++) sum += (buf[j] - '0'); ret = ((...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
144
2
f() { int a = -1, b = -1, c; for (; (c = getchar()) != '\n'; a++) b += c - 48; printf("%s wins.\n", (a + b / 9) & 1 ? "Fabre" : "Audrey"); } main(n) { for (scanf("%d", &n), getc(); n--;) f(); exit(0); }
f() { int a = -1, b = -1, c; for (; (c = getchar()) != '\n'; a++) b += c - 48; printf("%s wins.\n", (a + b / 9) & 1 ? "Fabre" : "Audrey"); } main(n) { for (scanf("%d", &n), getchar(); n--;) f(); exit(0); }
[["-", 8, 9, 0, 7, 10, 34, 12, 2, 63, 22], ["+", 8, 9, 0, 7, 10, 34, 12, 2, 63, 22]]
0
101
2
#include <bits/stdc++.h> using namespace std; int calc(string s) { int c = 0; deque<int> v; for (int i = 0; i < s.size(); i++) v.push_back(s[i] - '0'); while (v.size() != 1) { int s = v[0] + v[1]; v.pop_front(); v.pop_front(); if (s < 10) v.push_front(s); else v.push_front(s...
#include <bits/stdc++.h> using namespace std; int calc(string s) { int c = 0; deque<int> v; for (int i = 0; i < s.size(); i++) v.push_back(s[i] - '0'); while (v.size() != 1) { int s = v[0] + v[1]; v.pop_front(); v.pop_front(); if (s < 10) v.push_front(s); else v.push_front(s...
[["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6]]
1
180
2
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #in...
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #in...
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6]]
1
321
2
#include <iostream> #include <string> using namespace std; int main() { int N; cin >> N; while (N--) { string s; cin >> s; int turn = 0; int n = s.size(); while (n > 1) { ++turn; int x = s[n - 1] - '0' + s[n - 2] - '0'; if (x > 9) { s[n - 2] = '1'; s[n - 1] = ...
#include <iostream> #include <string> using namespace std; int main() { int N; cin >> N; while (N--) { string s; cin >> s; int turn = 0; int n = s.size(); while (n > 1) { ++turn; int x = s[n - 1] - '0' + s[n - 2] - '0'; if (x > 9) { s[n - 2] = '1'; s[n - 1] = ...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
167
2
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j; int w; string str; cin >> n; for (i = 0; i < n; i++) { cin >> str; vector<int> s; for (j = 0; j < str.length(); j++) { s.push_back(str[j] - '0'); } w = 0; while (s.size() > 2) { int b = (s[0] + s[1]) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j; int w; string str; cin >> n; for (i = 0; i < n; i++) { cin >> str; vector<int> s; for (j = 0; j < str.length(); j++) { s.push_back(str[j] - '0'); } w = 0; while (s.size() > 1) { int b = (s[0] + s[1])...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
195
2
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; int main() { int T; cin >> T; while (T--) { string st; cin >> st; int num = 0; for (auto c : st) { num += c - '0'; } int sum = num / 10 + st.size(); if...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; int main() { int T; cin >> T; while (T--) { string st; cin >> st; int num = 0; for (auto c : st) { num += c - '0'; } int sum = (num - 1) / 9 + st.size(); ...
[["+", 49, 50, 51, 16, 31, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 49, 50, 51, 16, 31, 16, 31, 23, 0, 25], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13]]
1
106
6
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define f first #define s second #define mp make...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define f first #define s second #define mp make...
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6]]
1
381
2
#include <iostream> #include <string> #include <vector> using namespace std; typedef vector<int> vi; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int len = s.length(); vi v(len); for (int i = 0; i < len; i++) v[i] = s[i] - '0'; int step; for (int i = 0, p = ...
#include <iostream> #include <string> #include <vector> using namespace std; typedef vector<int> vi; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int len = s.length(); vi v(len); for (int i = 0; i < len; i++) v[i] = s[i] - '0'; int step; for (int i = 0, p = ...
[["-", 0, 1, 0, 34, 31, 11, 12, 16, 17, 109], ["+", 0, 1, 0, 34, 31, 11, 12, 16, 17, 85]]
1
203
2
#include <iostream> #include <string> using namespace std; inline void change(string &s) { int a = s[0] - '0', b = s[1] - '0'; string res; if (a + b > 9) { res += '0' + (a + b) / 10; res += '0' + (a + b) % 10; } else { res += '0' + a + b; } s = res + s.substr(2); } int main() { int n; str...
#include <iostream> #include <string> using namespace std; inline void change(string &s) { int a = s[0] - '0', b = s[1] - '0'; string res; if (a + b > 9) { res += '0' + (a + b) / 10; res += '0' + (a + b) % 10; } else { res += '0' + a + b; } s = res + s.substr(2); } int main() { int n; str...
[["+", 31, 16, 12, 23, 0, 41, 15, 23, 0, 24], ["+", 31, 16, 12, 23, 0, 41, 15, 23, 0, 25], ["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6]]
1
177
4
#include <algorithm> #include <iostream> #include <stack> #include <string> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n; cin >> n; while (n--) { int cnt = 0; string str; stack<int> st; cin >> str; rep(i, str.size()) st.push(str[i] - '0'); while (...
#include <algorithm> #include <iostream> #include <stack> #include <string> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n; cin >> n; while (n--) { int cnt = 0; string str; stack<int> st; cin >> str; rep(i, str.size()) st.push(str[i] - '0'); while (...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
184
2
#include <cstdlib> #include <iostream> #include <stack> using namespace std; template <class T> inline T pop_element(stack<T> &sta) { const T res = sta.top(); sta.pop(); return res; } string solve() { string value; cin >> value; stack<int> sta; for (const auto &e : value) sta.push(e - '0'); for ...
#include <cstdlib> #include <iostream> #include <stack> using namespace std; template <class T> inline T pop_element(stack<T> &sta) { const T res = sta.top(); sta.pop(); return res; } string solve() { string value; cin >> value; stack<int> sta; for (const auto &e : value) sta.push(e - '0'); for ...
[["-", 0, 57, 64, 37, 0, 41, 64, 5, 0, 6], ["+", 0, 57, 64, 37, 0, 41, 64, 5, 0, 6], ["-", 0, 57, 64, 37, 0, 41, 75, 5, 0, 6], ["+", 0, 57, 64, 37, 0, 41, 75, 5, 0, 6]]
1
206
4
import static java.lang.Math.*; import static java.util.Arrays.*; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { try { String packageName = new Main().getClass().getPackage().getName(); System.setIn(new FileInputStream("src/" + packageName + "/inpu...
import static java.lang.Math.*; import static java.util.Arrays.*; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { try { String packageName = new Main().getClass().getPackage().getName(); System.setIn(new FileInputStream("src/" + packageName + "/inpu...
[["-", 75, 57, 15, 15, 0, 16, 12, 16, 12, 499], ["+", 75, 57, 15, 15, 0, 16, 12, 16, 12, 499], ["-", 15, 15, 0, 16, 31, 16, 12, 16, 17, 47], ["+", 15, 15, 0, 16, 31, 16, 12, 16, 17, 20]]
3
717
6
#include <algorithm> #include <stdio.h> using namespace std; int key[] = {0, 2, 3, 5, 7, 8, 10}; char in[5]; int p[110000]; int q[110000]; int n; int solve(int a, int b) { if (a < 0 && b < 0) return 1; if (a < 0) return 0; if (b < 0) return 0; if (b >= n) return 0; if (p[b] == q[a]) return...
#include <algorithm> #include <stdio.h> using namespace std; int key[] = {0, 2, 3, 5, 7, 8, 10}; char in[5]; int p[110000]; int q[110000]; int n; int solve(int a, int b) { if (a < 0 && b == -1) return 1; if (a < 0) return 0; if (b < 0) return 0; if (b >= n) return 0; if (p[b] == q[a]) retu...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
406
4
#include <bits/stdc++.h> using namespace std; int main() { string c[12] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}; int T; cin >> T; while (T--) { int n, m; cin >> n >> m; string s[n], t[m]; for (int i = 0; i < n; i++) cin >> s[i]; for (...
#include <bits/stdc++.h> using namespace std; int main() { string c[12] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}; int T; cin >> T; while (T--) { int n, m; cin >> n >> m; string s[n], t[m]; for (int i = 0; i < n; i++) cin >> s[i]; for (...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
347
4
#include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int, int> pint; typedef vector<int> vint; typedef vector<pint> vpint; #define pb push_back #define mp make_pair #define fi first #define se second #define all(v) (v).begin(), (v).end() #define rep(i, n) for (int i = 0; i < (n); i++) #defi...
#include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int, int> pint; typedef vector<int> vint; typedef vector<pint> vpint; #define pb push_back #define mp make_pair #define fi first #define se second #define all(v) (v).begin(), (v).end() #define rep(i, n) for (int i = 0; i < (n); i++) #defi...
[["+", 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
486
3
#include <iostream> using namespace std; int n, m; int t[50010], s[50010]; bool f; int oct(string x) { if (x == "C") return 0; if (x == "C#") return 1; if (x == "D") return 2; if (x == "D#") return 3; if (x == "E") return 4; if (x == "F") return 5; if (x == "F#") return 6; ...
#include <iostream> using namespace std; int n, m; int t[50010], s[50010]; bool f; int oct(string x) { if (x == "C") return 0; if (x == "C#") return 1; if (x == "D") return 2; if (x == "D#") return 3; if (x == "E") return 4; if (x == "F") return 5; if (x == "F#") return 6; ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
433
4
#include <algorithm> #include <iostream> #include <map> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) map<string, int> onkai; int numOnkai = 0; bool isok(int curT, int curS, int n, vector<int> &t, vector<int> &s) { ...
#include <algorithm> #include <iostream> #include <map> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) map<string, int> onkai; int numOnkai = 0; bool isok(int curT, int curS, int n, vector<int> &t, vector<int> &s) { ...
[["-", 0, 37, 0, 16, 12, 23, 0, 16, 17, 19], ["-", 0, 37, 0, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 37, 0, 16, 12, 23, 0, 16, 17, 60], ["+", 0, 37, 0, 16, 12, 23, 0, 16, 12, 13]]
1
491
4
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <s...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <s...
[["-", 51, 16, 31, 2, 3, 4, 0, 69, 28, 22], ["+", 51, 16, 31, 2, 3, 4, 0, 69, 28, 22]]
1
708
2
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <s...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <s...
[["-", 51, 16, 31, 2, 3, 4, 0, 69, 28, 22], ["+", 51, 16, 31, 2, 3, 4, 0, 69, 28, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
680
7
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace ...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22]]
1
540
2
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; #define reps(i, j, n) for (int i = j; i < n; ++i) #define rep(i, n) reps(i, 0, n) #define fr first #define sc second #define SQR(x) ((x) * (x)) #define INF (1 << 28) typedef pair<int, int> Pt; int main() { ...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; #define reps(i, j, n) for (int i = j; i < n; ++i) #define rep(i, n) reps(i, 0, n) #define fr first #define sc second #define SQR(x) ((x) * (x)) #define INF (1 << 28) typedef pair<int, int> Pt; int main() { ...
[["-", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 16, 12, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 16, 12, 118, 119, 120]]
1
469
4
function Main(input) { input = input.split("\n"); for (var i = 0; 1; i++) { var n = parseInt(input[i], 10); var ans = 0; if (n == 0) break; for (var j = 2; j < n; j++) { if (n - j * (j - 1) / 2 >= 0 && (n - j * (j - 1) / 2) % j == 0) { ans++; } } console.log(ans); ...
function Main(input) { input = input.split("\n"); for (var i = 0; 1; i++) { var n = parseInt(input[i], 10); var ans = 0; if (n == 0) break; for (var j = 2; j < n; j++) { if (n - j * (j - 1) / 2 > 0 && (n - j * (j - 1) / 2) % j == 0) { ans++; } } console.log(ans); ...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 47]]
2
141
2
#include <bits/stdc++.h> using namespace std; int main() { int a, b; while (cin >> a >> b, a) { b -= a; int c = b % 1000; int d = c % 500; cout << d / 100 << ' ' << c / 500 << ' ' << d / 1000 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; while (cin >> a >> b, a) { b -= a; int c = b % 1000; int d = c % 500; cout << d / 100 << ' ' << c / 500 << ' ' << b / 1000 << endl; } }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
71
2
#include <iostream> using namespace std; int main() { int A, B, n; int x, y, z; while (1) { cin >> A >> B; if (A == 0 && B == 0) break; n = B - A; if (n / 1000 > 0) { x = n / 1000; n = n % 1000; } else x = 0; if (n / 500 > 0) { y = n / 500; n = n % 50...
#include <iostream> using namespace std; int main() { int A, B, n; int x, y, z; while (1) { cin >> A >> B; if (A == 0 && B == 0) break; n = B - A; if (n / 1000 > 0) { x = n / 1000; n = n % 1000; } else x = 0; if (n / 500 > 0) { y = n / 500; n = n % 50...
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
158
4
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define f first #define s second #define mp make...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define f first #define s second #define mp make...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
301
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int N, T[4][15], Y[15], i, j, t, f = 0; char CS[5][2], s[] = "SCHD", n[] = "A23456789TJQK"; int ns(char a) { int i, c = 0; for (i = 0; i < 5; i++) c += CS[i][0] == a; return c; } int cf() { int i; for (i = 1; i < 5 && CS[i][1] == CS[i - 1][1]; i+...
#include <stdio.h> #include <stdlib.h> #include <string.h> int N, T[4][15], Y[15], i, j, t, f = 0; char CS[5][2], s[] = "SCHD", n[] = "A23456789TJQKA"; int ns(char a) { int i, c = 0; for (i = 0; i < 5; i++) c += CS[i][0] == a; return c; } int cf() { int i; for (i = 1; i < 5 && CS[i][1] == CS[i - 1][1]; i...
[["-", 0, 30, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 0, 30, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 25]]
0
716
4
#include <algorithm> #include <iostream> #include <string> using namespace std; struct Pa { int num; int mark; }; bool comp(const Pa &p1, const Pa &p2) { return p1.num < p2.num; } int func(char v) { if (v == 'S') { return 0; } if (v == 'C') { return 1; } if (v == 'H') { return 2; } re...
#include <algorithm> #include <iostream> #include <string> using namespace std; struct Pa { int num; int mark; }; bool comp(const Pa &p1, const Pa &p2) { return p1.num < p2.num; } int func(char v) { if (v == 'S') { return 0; } if (v == 'C') { return 1; } if (v == 'H') { return 2; } re...
[["+", 31, 16, 12, 23, 0, 16, 12, 69, 28, 22], ["+", 12, 23, 0, 16, 12, 69, 341, 342, 0, 70], ["+", 12, 23, 0, 16, 12, 69, 341, 342, 0, 73]]
1
1,281
3
// 32 #include <algorithm> #include <cstring> #include <iostream> using namespace std; int main() { bool ns = false; for (int n; cin >> n;) { const char *s = "SCHD"; int b[128][13]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 13; j++) { cin >> b[s[i]][j]; } } int m[10...
// 32 #include <algorithm> #include <cstring> #include <iostream> using namespace std; int main() { bool ns = false; for (int n; cin >> n;) { const char *s = "SCHD"; int b[128][13]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 13; j++) { cin >> b[s[i]][j]; } } int m[10...
[["+", 0, 16, 31, 16, 12, 16, 12, 69, 28, 22], ["+", 31, 16, 12, 16, 12, 69, 341, 342, 0, 70], ["+", 31, 16, 12, 16, 12, 69, 341, 342, 0, 73]]
1
521
3
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) FOR(i, 0, n) #define MP make_pair using namespace std; typedef pair<int, int> P; int base[5][20]; int rate[10]; int check(int num[5], int suit[5]) { sort...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) FOR(i, 0, n) #define MP make_pair using namespace std; typedef pair<int, int> P; int base[5][20]; int rate[10]; int check(int num[5], int suit[5]) { sort...
[["+", 0, 16, 31, 16, 12, 16, 12, 69, 28, 22], ["+", 31, 16, 12, 16, 12, 69, 341, 342, 0, 70], ["+", 31, 16, 12, 16, 12, 69, 341, 342, 0, 73]]
1
586
3
card_table = {'A': 0, '2': 1, '3': 2, '4': 3, '5': 4, '6': 5, '7': 6, '8': 7, '9': 8, 'T': 9, 'J': 10, 'Q': 11, 'K': 12} suit_table = {'S': 0, 'C': 1, 'H': 2, 'D': 3} def get_numlist(cards): numlist = [] for card in cards: numlist.append(card[0]) return numlist def is_royal(cards): numlist =...
card_table = {'A': 0, '2': 1, '3': 2, '4': 3, '5': 4, '6': 5, '7': 6, '8': 7, '9': 8, 'T': 9, 'J': 10, 'Q': 11, 'K': 12} suit_table = {'S': 0, 'C': 1, 'H': 2, 'D': 3} def get_numlist(cards): numlist = [] for card in cards: numlist.append(card[0]) return numlist def is_royal(cards): numlist =...
[["-", 0, 246, 8, 196, 0, 57, 15, 681, 0, 372]]
5
790
1
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var arr = input.trim().split("\n"); while (arr.length != 0) { var nm = arr.shift().split(" ").map(Number); var n = nm[0]; var m = nm[1]; var item1 = [ "" ]; var item2 = [ "" ]; var item3 = [ "" ]; for (var i = 0; i < n; i++) { arr.shift();...
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var arr = input.trim().split("\n"); while (arr.length != 0) { var nm = arr.shift().split(" ").map(Number); var n = nm[0]; var m = nm[1]; var item1 = [ "" ]; var item2 = [ "" ]; var item3 = [ "" ]; for (var i = 0; i < n; i++) { arr.shift();...
[["-", 3, 3, 0, 2, 3, 3, 0, 69, 71, 555], ["+", 3, 3, 0, 2, 3, 3, 0, 69, 71, 555]]
2
824
2
#include <algorithm> #include <cstring> #include <iomanip> #include <iostream> using namespace std; #define INF (1 << 30) int x[105], l[105], f[105], d[105], ud[105], v[105]; double up(int n) { return 1.0 * l[n] / f[n]; } double down(int n) { return 1.0 * l[n] / d[n]; } double dp[105][1250]; int main() { cout <<...
#include <algorithm> #include <cstring> #include <iomanip> #include <iostream> using namespace std; #define INF (1 << 30) int x[105], l[105], f[105], d[105], ud[105], v[105]; double up(int n) { return 1.0 * l[n] / f[n]; } double down(int n) { return 1.0 * l[n] / d[n]; } double dp[105][1250]; int main() { cout <<...
[["-", 0, 11, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
628
2
import java.io.*; import java.util.*; class Main { public static void main(String[] args) { BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); try { String[] st; while (true) { int n = Integer.valueOf(sc.readLine()); if (n == 0) break; int ...
import java.io.*; import java.util.*; class Main { public static void main(String[] args) { BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); try { String[] st; while (true) { int n = Integer.valueOf(sc.readLine()); if (n == 0) break; int ...
[["-", 0, 52, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 52, 8, 196, 0, 503, 49, 200, 51, 499]]
3
206
4
#include <stdio.h> int main() { int i, j, sum, min, max, n, m; while (1) { scanf("%d", &m); if (m == 0) break; min = 101; max = -1; for (i = 0; i < m; i++) { for (sum = 0, j = 0; j < 5; j++) { scanf("%d", &n); sum += n; } if (max < sum) max = sum;...
#include <stdio.h> int main() { int i, j, sum, min, max, n, m; while (1) { scanf("%d", &m); if (m == 0) break; min = 501; max = -1; for (i = 0; i < m; i++) { for (sum = 0, j = 0; j < 5; j++) { scanf("%d", &n); sum += n; } if (max < sum) max = sum;...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
138
2
#include <stdio.h> int main() { int a, b, c, d, e, n, total, score, max, min, i; max = 0; min = 500; while (1) { scanf("%d", &n); if (n == 0) { break; } for (i = 0; i < n; i++) { scanf("%d %d %d %d %d", &a, &b, &c, &d, &e); total = a + b + c + d + e; if (total > max) { ...
#include <stdio.h> int main() { int a, b, c, d, e, n, total, score, max, min, i; max = 0; min = 500; while (1) { scanf("%d", &n); if (n == 0) { break; } for (i = 0; i < n; i++) { scanf("%d %d %d %d %d", &a, &b, &c, &d, &e); total = a + b + c + d + e; if (total > max) { ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
0
160
3
#include <stdio.h> int main(void) { int n, i, test, max = 0, min = 0; int t; scanf("%d", &n); while (n) { max = 0; min = 500; for (; n > 0; n--) { test = 0; for (i = 0; i < 5; i++) { scanf("%d", &t); test += t; } if (max < test) max = test; if ...
#include <stdio.h> int main(void) { int n, i, test, max = 0, min = 0; int t; scanf("%d", &n); while (n) { max = 0; min = 500; for (; n > 0; n--) { test = 0; for (i = 0; i < 5; i++) { scanf("%d", &t); test += t; } if (max < test) max = test; if ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
142
1
#define _USE_MATH_DEFINES #include "bits/stdc++.h" #define EPS 1e-10 using namespace std; typedef long long llong; int main() { int i, j, max, min, sum = 0, n = 1, test[1000][5] = {0}; while (1) { max = -10000; min = 10000; scanf("%d", &n); if (n == 0) break; sum = 0; for (i = 0; i < n...
#define _USE_MATH_DEFINES #include "bits/stdc++.h" #define EPS 1e-10 using namespace std; typedef long long llong; int main() { int i, j, max, min, sum = 0, n = 1, test[1000][5] = {0}; while (1) { max = -10000; min = 10000; scanf("%d", &n); if (n == 0) break; sum = 0; for (i = 0; i < n...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
220
4
#include <bits/stdc++.h> #define INF 1 << 29 using namespace std; int main() { int a, b; while (scanf("%d%d", &a), a) { int MIN = 1 << 29, MAX = -(1 << 29); for (int c = 0; c < a; c++) { int s = 0; int e; for (int d = 0; d < 5; d++) { scanf("%d", &e); s += e; } ...
#include <bits/stdc++.h> #define INF 1 << 29 using namespace std; int main() { int a, b; while (scanf("%d", &a), a) { int MIN = 1 << 29, MAX = -(1 << 29); for (int c = 0; c < a; c++) { int s = 0; int e; for (int d = 0; d < 5; d++) { scanf("%d", &e); s += e; } M...
[["-", 51, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 51, 34, 31, 2, 3, 4, 0, 5, 0, 6]]
1
136
2
#include <algorithm> #include <iostream> #include <math.h> using namespace std; int main() { int n; while (cin >> n) { int up = 0; int low = 100000; for (int i = 0; i < n; i++) { int sum = 0; for (int j = 0; j < 5; j++) { int a; cin >> a; sum += a; } up = ...
#include <algorithm> #include <iostream> #include <math.h> using namespace std; int main() { int n; while (cin >> n, n) { int up = 0; int low = 100000; for (int i = 0; i < n; i++) { int sum = 0; for (int j = 0; j < 5; j++) { int a; cin >> a; sum += a; } up...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
118
2
#include <iostream> using namespace std; int main() { int max, min; int ten, sum; int n; while (cin >> n, n != 0) { max = 0; min = 1000; for (int i = 0; i < n; i++) { sum = 0; for (int j = 0; j < 5; j++) { cin >> ten; sum += ten; } if (max < sum) max...
#include <iostream> using namespace std; int main() { int max, min; int ten, sum; int n; while (cin >> n, n != 0) { max = 0; min = 1000; for (int i = 0; i < n; i++) { sum = 0; for (int j = 0; j < 5; j++) { cin >> ten; sum += ten; } if (max < sum) max...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
121
4
#include <algorithm> #include <iostream> using namespace std; int by[300][3]; int cost[300]; int N, M; int dp(int k) { int maxi = -1; int value[M + 1]; fill(value, value + M + 1, 0); for (int i = 0; i < N; i++) { for (int j = cost[i]; j <= M; j++) { value[j] = max(value[j], by[i][k] + value[j - cos...
#include <algorithm> #include <iostream> using namespace std; int by[300][3]; int cost[300]; int N, M; int dp(int k) { int maxi = -1; int value[M + 1]; fill(value, value + M + 1, 0); for (int i = 0; i < N; i++) { for (int j = cost[i]; j <= M; j++) { value[j] = max(value[j], by[i][k] + value[j - cos...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
270
2
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define MAX 305 using namespace std; int C[MAX], V[MAX], D[MAX], L[MAX]; int n, cost; int dp[MAX][MAX]; int recv(int i, int j) { if (dp[i][j] != -1) return dp[i][j]; if (i == n) return 0; int res = 0; // if(j < C[i])return r...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define MAX 305 using namespace std; int C[MAX], V[MAX], D[MAX], L[MAX]; int n, cost; int dp[MAX][MAX]; int recv(int i, int j) { if (dp[i][j] != -1) return dp[i][j]; if (i == n) return 0; int res = 0; // if(j < C[i])return r...
[["+", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 12, 23, 0, 34, 12, 2, 3, 4, 0, 25]]
1
566
2
#include <cstdio> #include <iostream> #include <string> #include <vector> #define MAX 1000 #define DIAGONAL 1 #define TOP 0 using namespace std; struct Item { int value, weight; }; int N, W; Item items[MAX]; int C[MAX + 1][MAX + 1]; int knapsack() { for (int w = 0; w <= W; w++) C[0][w] = 0; for (int i = 1...
#include <cstdio> #include <iostream> #include <string> #include <vector> #define MAX 1000 #define DIAGONAL 1 #define TOP 0 using namespace std; struct Item { int value, weight; }; int N, W; Item items[MAX]; int C[MAX + 1][MAX + 1]; int knapsack() { for (int w = 0; w <= W; w++) C[0][w] = 0; for (int i = 1...
[["-", 12, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["-", 12, 69, 28, 69, 341, 342, 0, 16, 12, 13]]
1
520
2
while True: try: N,M = list(map(int,input().split())) dp = [[0]*(M+1) for i in range(3)] for _ in range(N): name = input() C,V,D,L = list(map(int,input().split())) VDL = [V,D,L] for i in range(3): dp[i][C] = max(dp[i][C],VDL[i]) for j in range(M): if dp[i][j]: try: dp[i][j+C] = max...
while True: try: N,M = list(map(int,input().split())) dp = [[0]*(M+1) for i in range(3)] for _ in range(N): name = input() C,V,D,L = list(map(int,input().split())) VDL = [V,D,L] for i in range(3): try: dp[i][C] = max(dp[i][C],VDL[i]) except: pass for j in range(M): if dp[i][j]: ...
[["+", 8, 196, 0, 7, 8, 196, 0, 246, 0, 247], ["+", 8, 196, 0, 7, 8, 196, 0, 246, 0, 102], ["+", 0, 7, 8, 196, 0, 246, 0, 671, 0, 672], ["+", 0, 7, 8, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 674, 0, 675]]
5
209
15
#include <algorithm> #include <math.h> #include <stdio.h> using namespace std; double eps = 1e-9; int a, b, c, d; inline double f(double x) { return x * x * x * a + x * x * b + x * c + d; } inline double ABS(double x) { return max(x, -x); } int main() { int t; scanf("%d", &t); while (t--) { scanf("%d%d%d%d", ...
#include <algorithm> #include <math.h> #include <stdio.h> using namespace std; double eps = 1e-9; int a, b, c, d; inline double f(double x) { return x * x * x * a + x * x * b + x * c + d; } inline double ABS(double x) { return max(x, -x); } int main() { int t; scanf("%d", &t); while (t--) { scanf("%d%d%d%d", ...
[["+", 31, 16, 31, 23, 0, 16, 31, 74, 0, 24], ["+", 31, 23, 0, 16, 12, 2, 3, 4, 0, 25], ["-", 0, 43, 49, 50, 51, 16, 12, 16, 17, 48], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 85], ["+", 49, 50, 51, 16, 31, 16, 31, 23, 0, 24], ["+", 49, 50, 51, 16, 31, 16, 31, 23, 0, 25]]
1
559
8
// 2220 #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; const double PI = 2 * asin(1.0); double cuberoot(double x) { double s, prev; int positive; if (x == 0) return 0; if (x > 0) positive = 1; else { positive = 0; x = -x; } if (x > 1) s ...
// 2220 #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; const double PI = 2 * asin(1.0); double cuberoot(double x) { double s, prev; int positive; if (x == 0) return 0; if (x > 0) positive = 1; else { positive = 0; x = -x; } if (x > 1) s ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
575
2
#include <bits/stdc++.h> #define mod 1000000007 #define MAX_V 100000 #define N MAX_V using namespace std; typedef long long ll; int V; vector<int> G[MAX_V]; vector<int> rG[MAX_V]; vector<int> vs; bool used[MAX_V]; int cmp[MAX_V]; int n, m; void add_edge(int from, int to) { G[from].push_back(to); rG[to].push_back(f...
#include <bits/stdc++.h> #define mod 1000000007 #define MAX_V 100000 #define N MAX_V using namespace std; typedef long long ll; int V; vector<int> G[MAX_V]; vector<int> rG[MAX_V]; vector<int> vs; bool used[MAX_V]; int cmp[MAX_V]; int n, m; void add_edge(int from, int to) { G[from].push_back(to); rG[to].push_back(f...
[["-", 28, 69, 341, 342, 0, 69, 28, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 28, 69, 28, 22]]
1
765
2
#include <bits/stdc++.h> using namespace std; #define MAX_V 2050 #define int long long int MOD = 1000000007; int V; vector<int> G[MAX_V], rG[MAX_V], nG[MAX_V], vs, kv[MAX_V]; bool used[MAX_V]; int cmp[MAX_V]; void add_edge(int from, int to) { G[from].push_back(to); rG[to].push_back(from); } void dfs(int v) { used...
#include <bits/stdc++.h> using namespace std; #define MAX_V 2050 #define int long long int MOD = 1000000007; int V; vector<int> G[MAX_V], rG[MAX_V], nG[MAX_V], vs, kv[MAX_V]; bool used[MAX_V]; int cmp[MAX_V]; void add_edge(int from, int to) { G[from].push_back(to); rG[to].push_back(from); } void dfs(int v) { used...
[["+", 0, 16, 12, 2, 3, 4, 0, 69, 28, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
787
3
#include <bits/stdc++.h> /* */ using namespace std; #define mod 100000007LL template <typename T> class UF { public: UF() { size = 0; } //???????????\?????? void push(T a) { M[a] = size; V.push_back(size); rank.push_back(0); C.push_back(1); size++; } //????????°?????????????????? v...
#include <bits/stdc++.h> /* */ using namespace std; #define mod 1000000007LL template <typename T> class UF { public: UF() { size = 0; } //???????????\?????? void push(T a) { M[a] = size; V.push_back(size); rank.push_back(0); C.push_back(1); size++; } //????????°?????????????????? ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
983
2
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 28, 69, 341, 342, 0, 69, 341, 342, 0, 13], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38]]
1
1,025
6
#include <bits/stdc++.h> #define rep(n) for (int i = 0; i < n; i++) #define repp(j, n) for (int j = 0; j < n; j++) #define reppp(i, m, n) for (int i = m; i < n; i++) #define all(c) c.begin(), c.end() #define rall(c) c.rbegin(), c.rend() #define debug(x) cerr << #x << ": " << x << endl using namespace std; typedef lo...
#include <bits/stdc++.h> #define rep(n) for (int i = 0; i < n; i++) #define repp(j, n) for (int j = 0; j < n; j++) #define reppp(i, m, n) for (int i = m; i < n; i++) #define all(c) c.begin(), c.end() #define rall(c) c.rbegin(), c.rend() #define debug(x) cerr << #x << ": " << x << endl using namespace std; typedef lo...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 51, 91, 28, 2, 63, 118, 28, 69, 28, 22], ["+", 51, 91, 28, 2, 63, 118, 28, 69, 28, 22]]
1
909
6
#include <algorithm> #include <cassert> #include <climits> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define MOD (1000000007) #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define IINF (INT_MAX) #define ...
#include <algorithm> #include <cassert> #include <climits> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define MOD (1000000007) #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define IINF (INT_MAX) #define ...
[["-", 341, 342, 0, 118, 28, 69, 341, 342, 0, 22], ["+", 341, 342, 0, 118, 28, 69, 341, 342, 0, 22]]
1
1,070
2
#include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <vector> using namespace std; char s[15][15]; int wayx[10] = {-1, 0, 1, 0}; int wayy[10] = {0, 1, 0, -1}; char ss[10] = "URDL"; int ck(char c) { f...
#include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <vector> using namespace std; char s[15][15]; int wayx[10] = {-1, 0, 1, 0}; int wayy[10] = {0, 1, 0, -1}; char ss[10] = "URDL"; int ck(char c) { f...
[["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 147], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
1
498
3
// template {{{ #include <bits/stdc++.h> using namespace std; #define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) loop(i, 0, n) #define rloop(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define rrep(i, n) rloop(i, 0, n) #define eb emplace_back #define ef emplace_front #define p...
// template {{{ #include <bits/stdc++.h> using namespace std; #define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) loop(i, 0, n) #define rloop(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define rrep(i, n) rloop(i, 0, n) #define eb emplace_back #define ef emplace_front #define p...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
822
2
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1000000000; #define REP(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) const int dx[4] = {1, 0, 0, -1}, dy[4] = {0, 1, -1, 0}; int H, W; map<char, int> dir; map<int, char> dir2; string ans; bool ra...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; const int INF = 1000000000; #define REP(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) const int dx[4] = {1, 0, 0, -1}, dy[4] = {0, 1, -1, 0}; int H, W; map<char, int> dir; map<int, char> dir2; string ans; bool ra...
[["-", 341, 342, 0, 69, 28, 69, 341, 342, 0, 22], ["+", 341, 342, 0, 69, 28, 69, 341, 342, 0, 22], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["+", 12, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["-", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 34...
1
551
8
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; int w, h, sum, dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0}; string s[11], t; map<int, char> m; void dfs(int y, int x, int d, char p) { if (d == sum) { cout << t << endl; exit(0); } else { char a = p; s[y][x] = '...
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; int w, h, sum, dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0}; string s[11], t; map<int, char> m; void dfs(int y, int x, int d, char p) { if (d == sum) { cout << t << endl; exit(0); } else { char a = p; s[y][x] = '...
[["-", 3, 4, 0, 16, 31, 2, 63, 118, 119, 120], ["+", 3, 4, 0, 16, 31, 2, 63, 118, 119, 120], ["+", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
440
4
#include <cstdio> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; int h, w; char B[10][11]; int num; char ans[31]; bool dfs(int i, int x, int y, int dir) { if (i == num) return true; B[y][x] = '.'; rep(k, 4) if (k != (dir + 2) & ...
#include <cstdio> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; int h, w; char B[10][11]; int num; char ans[31]; bool dfs(int i, int x, int y, int dir) { if (i == num) return true; B[y][x] = '.'; rep(k, 4) if (k != ((dir + 2) &...
[["+", 51, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
1
426
2
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int> P; typedef pair<int, P> P1; #define fr first #define...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int> P; typedef pair<int, P> P1; #define fr first #define...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 3, 4, 0, 74, 39, 77, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
731
4
#include <bits/stdc++.h> #define f first #define s second using namespace std; typedef pair<int, int> P; typedef pair<double, int> id; int n, m; double ans; P a[10000]; vector<int> G[10000]; bool used[10000]; double getl(P a, P b) { return sqrt((a.f - b.f) * (a.f - b.f) + (a.s - b.s) * (a.s - b.s)); } void prin() {...
#include <bits/stdc++.h> #define f first #define s second using namespace std; typedef pair<int, int> P; typedef pair<double, int> id; int n, m; double ans; P a[10000]; vector<int> G[10000]; bool used[10000]; double getl(P a, P b) { return sqrt((a.f - b.f) * (a.f - b.f) + (a.s - b.s) * (a.s - b.s)); } void prin() {...
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 69, 341, 342, 0, 118, 28, 22], ["+", 3, 4, 0, 69, 341, 342, 0, 118, 17, 131], ["+", 3, 4, 0, 69, 341, 342, 0, 118, 119, 120]]
1
403
4
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef struct { string N; int M; } Lottery; class GreaterLength { public: bool operator()(const Lottery &lhs, const Lottery &rhs) { return lhs.N.size() > rhs.N.size(); } }; int main() { int n, m; while ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef struct { string N; int M; } Lottery; class GreaterLength { public: bool operator()(const Lottery &lhs, const Lottery &rhs) { return lhs.N.size() > rhs.N.size(); } }; int main() { int n, m; while ...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
287
2
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #in...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #in...
[["-", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]]
1
458
7
#include <stdio.h> #include <string.h> char unit[100][17]; int ulen = 0; int getnum(char *s) { for (int i = 0; i < ulen; i++) if (strcmp(s, unit[i]) == 0) return i; strcpy(unit[ulen], s); return ulen++; } int main() { int i, j, x, y, z, n, dx, dy, x0, y0; char buf[64], *p; char a[17], b[17]; ...
#include <stdio.h> #include <string.h> char unit[200][17]; int ulen = 0; int getnum(char *s) { for (int i = 0; i < ulen; i++) if (strcmp(s, unit[i]) == 0) return i; strcpy(unit[ulen], s); return ulen++; } int main() { int i, j, x, y, z, n, dx, dy, x0, y0; char buf[64], *p; char a[17], b[17]; ...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
0
607
8
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using name...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using name...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 22], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48]]
1
543
8
template <int Size = 1000000, typename WeightType = int> class WeightedUnionFind { int par[Size], rank[Size], sizes[Size]; WeightType wei[Size]; public: WeightedUnionFind() = default; WeightedUnionFind(const WeightedUnionFind &) = default; WeightedUnionFind(WeightedUnionFind &&) = default; WeightedUnionFin...
template <int Size = 1000000, typename WeightType = int> class WeightedUnionFind { int par[Size], rank[Size], sizes[Size]; WeightType wei[Size]; public: WeightedUnionFind() = default; WeightedUnionFind(const WeightedUnionFind &) = default; WeightedUnionFind(WeightedUnionFind &&) = default; WeightedUnionFin...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 48], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117]]
1
719
4
// UTPC2010 D. ツ鳴ウツ鳴オツ渉つづ按単ツ暗環系 #include <iostream> #include <map> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n) { string s, t, r; map<string, int> mp; vector<vector<pair<int, int>>> vp; int size = 0; for (int...
// UTPC2010 D. ツ鳴ウツ鳴オツ渉つづ按単ツ暗環系 #include <iostream> #include <map> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n, n) { string s, t, r; map<string, int> mp; vector<vector<pair<int, int>>> vp; int size = 0; for (...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
461
2
#include <iostream> #include <string> #include <vector> using namespace std; int main() { while (true) { int n, m = 0; int a, b, e; string s1, s2; char c, d; int i, j, k; cin >> n; if (!n) break; int graph[200][200]; for (i = 0; i < 200; i++) for (j = 0; j < 200; j++) ...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { while (true) { int n, m = 0; int a, b, e; string s1, s2; char c, d; int i, j, k; cin >> n; if (!n) break; int graph[200][200]; for (i = 0; i < 200; i++) for (j = 0; j < 200; j++) ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
409
4
#include <cstdio> #include <map> #include <string> #include <vector> #define mp make_pair #define pb push_back using namespace std; typedef pair<int, int> pii; const int inf = 1 << 29; int main() { for (int n; scanf("%d", &n), n;) { int unum = 0; pair<pii, int> edge[100]; map<string, int> name; f...
#include <cstdio> #include <map> #include <string> #include <vector> #define mp make_pair #define pb push_back using namespace std; typedef pair<int, int> pii; const int inf = 1 << 29; int main() { for (int n; scanf("%d", &n), n;) { int unum = 0; pair<pii, int> edge[100]; map<string, int> name; f...
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["-", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6]]
1
494
4
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define all(c) (c).begin(), (c).end()...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define all(c) (c).begin(), (c).end()...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 28, 69, 28, 2, 3, 4, 0, 16, 31, 13], ["+", 28, 69, 28, 2, 3, 4, 0, 16, 17, 48]]
1
405
4
#include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) bool visited[100]; int c[100]; bool dfs(vector<vector<pair<int, int>>> &edge, int now, int cost) { if (visited[now]) return cost == c[now]; c[now] = co...
#include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) bool visited[200]; int c[200]; bool dfs(vector<vector<pair<int, int>>> &edge, int now, int cost) { if (visited[now]) return cost == c[now]; c[now] = co...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 48], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 1, 0...
1
421
11
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; const int INF = 200 * 100 + 100; struct Dict { map<string, int> dict; int id; Dict() : id(0) {} int get(const string &str) { if (dict.count(str)) re...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; const int INF = 200 * 100 + 100; struct Dict { map<string, int> dict; int id; Dict() : id(0) {} int get(const string &str) { if (dict.count(str)) re...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48]]
1
624
2
#include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <set> #include <sstream> #include <vector> #define F first #define S second #define inf (1 << 28) #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) using namespace std; str...
#include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <set> #include <sstream> #include <vector> #define F first #define S second #define inf (1 << 28) #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) using namespace std; str...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
837
2
#include <cstdlib> #include <iostream> #include <unordered_map> #include <vector> using namespace std; unordered_map<string, int> converter; int convert(const string &s) { if (!converter.count(s)) converter.insert({s, converter.size()}); return converter[s]; } class union_find { private: static constexpr in...
#include <cstdlib> #include <iostream> #include <unordered_map> #include <vector> using namespace std; unordered_map<string, int> converter; int convert(const string &s) { if (!converter.count(s)) converter.insert({s, converter.size()}); return converter[s]; } class union_find { private: static constexpr in...
[["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
622
4
while 1: n = int(input()) if n == 0:break m = [] f = 1 for _ in range(n): _, a, _, v, b = input().split() v = int(v[3:]) x, y = -1, -1 for i in range(len(m)): if a in m[i]:x = i if b in m[i]:y = i if x >= 0: if y >= 0: ...
while 1: n = int(input()) if n == 0:break m = [] f = 1 for _ in range(n): _, a, _, v, b = input().split() v = int(v[3:]) x, y = -1, -1 for i in range(len(m)): if a in m[i]:x = i if b in m[i]:y = i if x >= 0: if y >= 0: ...
[["-", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6]]
5
256
4
#include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; struct R { int o, x, s, ok; }; struct C { int o, x, s, ok; };...
#include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; struct R { int o, x, s, ok; }; struct C { int o, x, s, ok; };...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
1
806
6
import java.util.Scanner; public class Main { final boolean DEBUG = false; final int INF = 100000000; final int MAX_N = 200; final int MAX_R = 1000; void run() { Scanner scan = new Scanner(System.in); while (true) { int n = scan.nextInt(); int m = scan.nextInt(); if (n + m == 0) ...
import java.util.Scanner; public class Main { final boolean DEBUG = false; final int INF = 100000000; final int MAX_N = 200; final int MAX_R = 1000; void run() { Scanner scan = new Scanner(System.in); while (true) { int n = scan.nextInt(); int m = scan.nextInt(); if (n + m == 0) ...
[["-", 8, 196, 0, 1, 0, 11, 31, 504, 71, 499], ["+", 0, 1, 0, 11, 31, 504, 71, 504, 516, 22], ["+", 0, 1, 0, 11, 31, 504, 71, 504, 0, 70], ["+", 0, 1, 0, 11, 31, 504, 71, 504, 71, 499], ["+", 0, 1, 0, 11, 31, 504, 71, 504, 0, 73]]
3
1,050
5
import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import java.io.*; import java.util.*; public class Main { int INF = 1 << 28; int N = 220; void run() { Scanner sc = new Scanner(System.in); for (;;) { int n = sc.nextInt(); int m = sc.ne...
import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import java.io.*; import java.util.*; public class Main { int INF = 1 << 28; int N = 220; void run() { Scanner sc = new Scanner(System.in); for (;;) { int n = sc.nextInt(); int m = sc.ne...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22]]
3
793
2
#include <stdio.h> int MIN(int a, int b) { return a < b ? a : b; } int main() { int n, m, p[1010], d[1010][1010], w[2][310][310]; int a, b, c, i, j, k, l, t, M = 100000000; char r; while (scanf("%d %d", &n, &m), n + m) { for (i = 0; i < n * n; i++) w[0][i / n][i % n] = w[1][i / n][i % n] = M; for ...
#include <stdio.h> int MIN(int a, int b) { return a < b ? a : b; } int main() { int n, m, p[1010], d[1010][1010], w[2][310][310]; int a, b, c, i, j, k, l, t, M = 100000000; char r; while (scanf("%d %d", &n, &m), n + m) { for (i = 0; i < n * n; i++) w[0][i / n][i % n] = w[1][i / n][i % n] = M; for ...
[["-", 0, 11, 31, 69, 28, 69, 71, 69, 28, 22], ["-", 0, 11, 31, 69, 28, 69, 71, 69, 0, 70], ["-", 0, 11, 31, 69, 28, 69, 71, 69, 0, 73]]
0
723
3
#include <iostream> #include <vector> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long INF = 1LL << 60; int main() ...
#include <iostream> #include <vector> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long INF = 1LL << 60; int main() ...
[["+", 0, 11, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
689
3
//////////////////// /// template /// //////////////////// #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> ...
//////////////////// /// template /// //////////////////// #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 31, 69, 28, 69, 28, 2, 3, 4, 0, 22], ["+", 31, 69, 28, 69, 28, 2, 3, 4, 0, 22]]
1
4,480
4
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int> P; typedef pair<int, P> P1; #define fr first #define...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int> P; typedef pair<int, P> P1; #define fr first #define...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
927
2
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <vector> #define rep(i, j) for (int i = 0; i < (j); i++) #define reps(i, j, k) for (int i = j; i <= (k); i++) #define INF ((int)1 << 29) #define mk(i, j) make_pair(i, j) #define N 200 #define M 10000 #define R 1000 int sdst[N][N]; i...
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <vector> #define rep(i, j) for (int i = 0; i < (j); i++) #define reps(i, j, k) for (int i = j; i <= (k); i++) #define INF ((int)1 << 28) #define mk(i, j) make_pair(i, j) #define N 200 #define M 10000 #define R 1000 int sdst[N][N]; i...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
543
2
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long LL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; const LL INF = (LL)1e9 + 7; int main() { while (1) { int N, M; cin >> N >> M; if (N + M == 0) return 0; VVLL umi(N + 1, VLL(N + 1, INF)), riku(...
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long LL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; const LL INF = (LL)1e9 + 7; int main() { while (1) { int N, M; cin >> N >> M; if (N + M == 0) return 0; VVLL umi(N + 1, VLL(N + 1, INF)), riku(...
[["+", 0, 11, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
627
3
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; const int INF = 1 << 22; int N, M, R; void wf(VVI &adj) { for (int k = 0; k < N; ++k) { for (int i = 0; i < N; ++i) { for (int j = 0; j < N...
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; const int INF = 1 << 22; int N, M, R; void wf(VVI &adj) { for (int k = 0; k < N; ++k) { for (int i = 0; i < N; ++i) { for (int j = 0; j < N...
[["-", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25]]
1
894
4
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii...
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii...
[["-", 31, 16, 12, 2, 3, 4, 0, 69, 28, 22], ["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
730
3
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
[["-", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
725
8
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < b; i++) #define INF 1LL << 60 typedef long long ll; int N, M; ll d1[200][200]; // Land ll d2[200][200]; // Sea ll dp[1010][200]; int R; int Z[1010]; int main() { cin.tie(0); ios::sync_with_stdio(false); while (cin >> N >>...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < b; i++) #define INF 1LL << 60 typedef long long ll; int N, M; ll d1[200][200]; // Land ll d2[200][200]; // Sea ll dp[1010][200]; int R; int Z[1010]; int main() { cin.tie(0); ios::sync_with_stdio(false); while (cin >> N >>...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
645
2