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 <iomanip> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) const int N = 10, ONE_KUURU = 12; vector<double> E; void init() { E.assign(N + 1, 0.0); vector<vector<double>> dp(N + 2, vector<double>(ONE_KUURU + 1)); dp[1][0] = 1.0; for (int i = ...
#include <iomanip> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) const int N = 100000, ONE_KUURU = 12; vector<double> E; void init() { E.assign(N + 1, 0.0); vector<vector<double>> dp(N + 2, vector<double>(ONE_KUURU + 1)); dp[1][0] = 1.0; for (int ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
247
2
#include <cstdio> #include <iostream> using namespace std; #define NMAX 100000 double dp[NMAX + 1]; int main() { int n = NMAX; for (int i = 0; i < n + 1; i++) { dp[i] = 0.0; } for (int i = 0; i < n; i++) { long long int foo = 1; int bar = 1; for (int j = i + 1; j < n + 1 and j < i + 40; j++) {...
#include <cstdio> #include <iostream> using namespace std; #define NMAX 100000 double dp[NMAX + 1]; int main() { int n = NMAX; for (int i = 0; i < n + 1; i++) { dp[i] = 0.0; } for (int i = 0; i < n; i++) { long long int foo = 1; long long int bar = 1; for (int j = i + 1; j < n + 1 and foo < 1e...
[["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 0, 7, 15, 16, 12, 16, 12, 16, 31, 22], ["-", 0, 7, 15, 16, 12, 16, 12, 16, 17, 72], ["-", 0, 7, 15, 16, 12, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
188
8
#include <bits/stdc++.h> #define N 100010 using namespace std; bool mem[N][50]; int used[N][50]; double dfs(int day, int cnt, double p) { if (day == 0) return 0; if (cnt >= 50) return 0; if (used[day][cnt]) return mem[day][cnt]; used[day][cnt] = 1; double res = 0; res += p * (1 + dfs(day - 1, c...
#include <bits/stdc++.h> #define N 100010 using namespace std; double mem[N][50]; bool used[N][50]; double dfs(int day, int cnt, double p) { if (day == 0) return 0; if (cnt >= 50) return 0; if (used[day][cnt]) return mem[day][cnt]; used[day][cnt] = 1; double res = 0; res += p * (1 + dfs(day - 1...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40]]
1
187
4
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory.h> #include <memory> #include <numeric> #include <queue> #include <set> #include <s...
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory.h> #include <memory> #include <numeric> #include <queue> #include <set> #include <s...
[["-", 31, 66, 28, 69, 28, 69, 341, 342, 0, 13], ["+", 31, 66, 28, 69, 28, 69, 341, 342, 0, 13], ["-", 0, 16, 31, 66, 28, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 66, 28, 69, 341, 342, 0, 13]]
1
363
4
#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> #inc...
#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> #inc...
[["-", 0, 11, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 69, 28, 69, 341, 342, 0, 22]]
1
327
2
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main(void) { int n; double dp[100001] = {0}, p, w; dp[1] = 1.0; for (int i = 2; i < 100001; i++) { p = 1.0; w = 0.5; for (int j = 1; j < i && 0.0000000001 < p; j++) { dp[i] += p * (1 - w) * (j + dp[max(0, i...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main(void) { int n; double dp[100001] = {0}, p, w; dp[1] = 1.0; for (int i = 2; i < 100001; i++) { p = 1.0; w = 0.5; for (int j = 1; j < i && 0.00000000001 < p; j++) { dp[i] += p * (1 - w) * (j + dp[max(0, ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
157
4
#include <cstdio> #include <cstring> #define EPS (1e-13) #define MAX(A, B) ((A) >= (B) ? (A) : (B)) double dp[1000001]; int main() { int n; while (scanf("%d", &n), n) { for (int i = 0; i <= 1000000; i++) dp[i] = 0; dp[1] = 1; for (int i = 2; i <= n; i++) { double p = 1.0, win = 0.5; fo...
#include <cstdio> #include <cstring> #define EPS (1e-13) #define MAX(A, B) ((A) >= (B) ? (A) : (B)) double dp[1000001]; int main() { int n; while (scanf("%d", &n), n) { for (int i = 0; i <= 1000000; i++) dp[i] = 0; dp[1] = 1; for (int i = 2; i <= n; i++) { double p = 1.0, win = 0.5; fo...
[["-", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 341, 342, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 341, 342, 0, 2, 3, 4, 0, 16, 12, 13]]
1
185
6
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; const int INF = 1 << 29; typedef pair<int, int> P; int n; const int MAX_N...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; const int INF = 1 << 29; typedef pair<int, int> P; int n; const int MAX_N...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
266
6
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <vector> #ifdef _MSC_VER #include <agents...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <vector> #ifdef _MSC_VER #include <agents...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21]]
1
350
4
dp = Array.new(100001,0.0) dp[1] = 1 for i in 2...100 p = 1.0 w = 0.5 k = 1 while k<i && p>1e-13 dp[i] += (p*(1-w))*(k+dp[[0,i-k-1].max]) p *= w w /= 2 k += 1 end dp[i] += i*p end while true n = gets.to_i if n == 0 break end puts dp[n] end
dp = Array.new(100001,0.0) dp[1] = 1 for i in 2..100000 p = 1.0 w = 0.5 k = 1 while k<i && p>1e-13 dp[i] += (p*(1-w))*(k+dp[[0,i-k-1].max]) p *= w w /= 2 k += 1 end dp[i] += i*p end while true n = gets.to_i if n == 0 break end puts dp[n] en...
[["-", 0, 493, 0, 88, 51, 267, 0, 475, 17, 389], ["-", 0, 493, 0, 88, 51, 267, 0, 475, 444, 612], ["+", 0, 493, 0, 88, 51, 267, 0, 475, 17, 757], ["+", 0, 493, 0, 88, 51, 267, 0, 475, 444, 612]]
4
110
4
dp=[.0]*100001 dp[1]=1. for i in range(2,100001): a,b,j=.5,1,1 while j<i and b> 1e-5: dp[i]+=b*(1-a)*(j+dp[i-j-1]) b*=a;a/=2;j+=1 dp[i]+=i*b while 1: n=int(input()) if n==0:break print(dp[n])
dp=[.0]*100001 dp[1]=1. for i in range(2,100001): a,b,j=.5,1,1 while j<i and b>1e-15: dp[i]+=b*(1-a)*(j+dp[i-j-1]) b*=a;a/=2;j+=1 dp[i]+=i*b while 1: n=int(input()) if n==0:break print(dp[n])
[["-", 8, 196, 0, 52, 15, 679, 12, 666, 0, 531], ["+", 8, 196, 0, 52, 15, 679, 12, 666, 0, 531]]
5
111
2
#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, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22]]
1
1,096
4
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1 << 24; const int INF = 1 << 28; int r, c; int w, h; int seg[8 * MAX_N]; void init() { for (w = 1; w < r; w <<= 1) ; for (h = 1; h < c; h <<= 1) ; fill_n(seg, 8 * MAX_N, INF); } void update(int x, int y, int v, int k = 0, int ax = 0, int ...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1 << 20; const int INF = INT_MAX; int r, c; int w, h; int seg[8 * MAX_N]; void init() { for (w = 1; w < r; w <<= 1) ; for (h = 1; h < c; h <<= 1) ; fill_n(seg, 8 * MAX_N, INF); } void update(int x, int y, int v, int k = 0, int ax = 0, int ...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 17, 151], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 22]]
1
847
6
#include <algorithm> #include <math.h> #include <stdio.h> using namespace std; long long b[110000]; long long gz[550]; double eps = 1e-9; int main() { int a; while (scanf("%d", &a), a) { long double A = 1; int sz = 0; for (int i = 0; i < (a + 1) * a / 2; i++) { scanf("%lld", b + i); if (b[i]...
#include <algorithm> #include <math.h> #include <stdio.h> using namespace std; long long b[110000]; long long gz[550]; double eps = 1e-9; int main() { int a; while (scanf("%d", &a), a) { long double A = 1; int sz = 0; for (int i = 0; i < (a + 1) * a / 2; i++) { scanf("%lld", b + i); if (b[i]...
[["-", 49, 50, 51, 74, 51, 23, 0, 16, 12, 22], ["+", 49, 50, 51, 74, 51, 23, 0, 16, 12, 13]]
1
242
2
#include <algorithm> #include <cmath> #include <cstdio> using namespace std; long long a[100000]; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int cmp(const long long &a, const long long &b) { if (a % 2 == 0 && b % 2 == 1) return 1; else if (a % 2 == 1 && b % 2 == 0) return 0; ...
#include <algorithm> #include <cmath> #include <cstdio> using namespace std; long long a[100000]; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int cmp(const long long &a, const long long &b) { if (a % 2 == 0 && b % 2 == 1) return 1; else if (a % 2 == 1 && b % 2 == 0) return 0; ...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
395
2
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <v...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <v...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
729
4
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); for (;;) { int r = in.nextInt(), c = in.nextInt(); if ((r | c) == 0) return; System.out.println(r * c % 2 == 0 ? "Yes" : "No"); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); for (;;) { int r = in.nextInt(), c = in.nextInt(); if ((r | c) == 0) return; System.out.println(r * c % 2 == 0 ? "yes" : "no"); } } }
[["-", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["-", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491]]
3
94
4
c; main(r) { for (; scanf("%d%d", &r, &c), r;) puts(r & c % 2 ? "no" : "yes"); }
c; main(r) { for (; scanf("%d%d", &r, &c), r;) puts((r & c) % 2 ? "no" : "yes"); }
[["+", 3, 4, 0, 41, 15, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 41, 15, 16, 31, 23, 0, 25]]
0
44
2
#include <iostream> using namespace std; int main() { int r, c; while (cin >> r >> c && r) { cout << "yes\0no" + (r & 1 || c & 1) * 4 << endl; } return 0; }
#include <iostream> using namespace std; int main() { int r, c; while (cin >> r >> c && r) { cout << "yes\0no" + (r & 1 && c & 1) * 4 << endl; } return 0; }
[["-", 12, 16, 12, 16, 31, 23, 0, 16, 17, 106], ["+", 12, 16, 12, 16, 31, 23, 0, 16, 17, 98]]
1
54
2
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int a, b; while (cin >> a >> b, a | b) { if ((a & 1) && (b & 1)) cout << "no" << endl; cout << "yes" << endl; } }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int a, b; while (cin >> a >> b, a | b) { if ((a & 1) && (b & 1)) cout << "no" << endl; else cout << "yes" << endl; } }
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95]]
1
67
1
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using na...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using na...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
188
4
#include <cstdio> int main() { int r, c; while (~scanf("%d%d", &r, &c) && (r || c)) { if (r >= 2 && c >= 2) { puts("yes"); } else { puts("no"); } } return 0; }
#include <cstdio> int main() { int r, c; while (~scanf("%d%d", &r, &c) && (r || c)) { if (r % 2 && c % 2) { puts("no"); } else { puts("yes"); } } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 109], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
69
8
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) R...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) R...
[["+", 0, 41, 15, 16, 31, 16, 31, 23, 0, 24], ["+", 15, 16, 31, 16, 31, 23, 0, 16, 17, 48], ["+", 15, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 41, 15, 16, 31, 16, 31, 23, 0, 25]]
1
126
4
#include <cstdio> main() { int a, b; for (; scanf("%d%d", &a, &b), a + b;) { puts((a * b) % 2 ? "yes" : "no"); } }
#include <cstdio> main() { int a, b; for (; scanf("%d%d", &a, &b), a + b;) { puts(!((a * b) % 2) ? "yes" : "no"); } }
[["+", 0, 2, 3, 4, 0, 41, 15, 91, 17, 111], ["+", 15, 91, 28, 23, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 41, 15, 91, 28, 23, 0, 25]]
1
54
3
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define mp...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define mp...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 109]]
1
219
2
while True: r, c = list(map(int, input().split())) if r == 0: break print("yes" if r%2+c%2 == 0 else "no")
while True: r,c=list(map(int,input().split())) if r==0:break print("yes" if r*c%2==0 else "no")
[["-", 0, 41, 0, 666, 0, 657, 31, 657, 17, 109], ["-", 0, 41, 0, 666, 0, 657, 31, 657, 12, 612], ["-", 3, 4, 0, 41, 0, 666, 0, 657, 17, 72], ["+", 0, 41, 0, 666, 0, 657, 31, 657, 17, 48]]
5
48
4
import java.awt.geom.*; import java.io.*; import java.math.*; import java.util.*; public class Main { static int INF = 2 << 27; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int n = sc.nextInt(); if (n == 0) break; Data[] data = new D...
import java.awt.geom.*; import java.io.*; import java.math.*; import java.util.*; public class Main { static int INF = 2 << 27; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int n = sc.nextInt(); if (n == 0) break; Data[] data = new D...
[["-", 0, 57, 64, 37, 0, 492, 500, 509, 500, 274], ["+", 0, 57, 64, 37, 0, 492, 500, 509, 500, 22], ["-", 64, 37, 0, 492, 3, 4, 0, 509, 500, 22], ["+", 64, 37, 0, 492, 3, 4, 0, 509, 500, 274]]
3
395
4
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); while (true) { int n = sc.nextInt(); if (n == 0) break; String names[] = new String[n]; int[] ns = new int[30]; boolean[][] act = ...
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); while (true) { int n = sc.nextInt(); if (n == 0) break; String names[] = new String[n]; int[] ns = new int[30]; boolean[][] act = ...
[["-", 64, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 64, 196, 0, 57, 15, 15, 0, 16, 17, 18]]
3
318
2
char names[20][16]; int M[20][30], S[30], P[20]; main(n, m, i, j, d) { for (; scanf("%d", &n), n; printf("%d %s\n", P[d], names[d])) { memset(names, 0, sizeof names), memset(M, 0, sizeof M), memset(S, 0, sizeof S), memset(P, 0, sizeof P); for (i = 0; i < n; i++) for (scanf("%s%d", names[i], &m),...
char names[20][16]; int M[20][30], S[30], P[20]; main(n, m, i, j, d) { for (; scanf("%d", &n), n; printf("%d %s\n", P[d], names[d])) { memset(names, 0, sizeof names), memset(M, 0, sizeof M), memset(S, 0, sizeof S), memset(P, 0, sizeof P); for (i = 0; i < n; i++) for (scanf("%s%d", names[i], &m),...
[["-", 0, 16, 12, 23, 0, 16, 12, 16, 17, 47], ["+", 0, 16, 12, 23, 0, 16, 12, 16, 17, 18]]
0
304
2
#include <stdio.h> #include <string.h> typedef struct { char name[12]; int disp_num; int disp_time[30]; int points; } kyara_t; int kyara_num; kyara_t kyara[20]; int all_disp_num[30]; int main(void) { int i, j; int min_id; while (1) { scanf("%d", &kyara_num); if (kyara_num == 0) break; ...
#include <stdio.h> #include <string.h> typedef struct { char name[12]; int disp_num; int disp_time[30]; int points; } kyara_t; int kyara_num; kyara_t kyara[20]; int all_disp_num[30]; int main(void) { int i, j; int min_id; while (1) { scanf("%d", &kyara_num); if (kyara_num == 0) break; ...
[["-", 64, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 23, 0, 16, 17, 18]]
0
408
2
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { string name[40]; int m[40] = {}; int d[40][40] = {}; // input for (int i = 0; i < n; i++) { cin >> name[i] >> m[i]; for (int j = 0; j < m[i]; j++) { int tmp; cin >> tmp; d[i][t...
#include <iostream> using namespace std; int main() { int n; while (cin >> n && n) { string name[40]; int m[40] = {}; int d[40][40] = {}; // input for (int i = 0; i < n; i++) { cin >> name[i] >> m[i]; for (int j = 0; j < m[i]; j++) { int tmp; cin >> tmp; d...
[["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
344
2
#include <cstdio> #include <iostream> #include <string> #include <utility> using namespace std; typedef struct { string name; int popularity; bool scene[30]; } character; int main() { while (1) { int n; character c[20]; for (int i = 0; i < 20; ++i) { c[i].popularity = 0; for (int j = ...
#include <cstdio> #include <iostream> #include <string> #include <utility> using namespace std; typedef struct { string name; int popularity; bool scene[30]; } character; int main() { while (1) { int n; character c[20]; for (int i = 0; i < 20; ++i) { c[i].popularity = 0; for (int j = ...
[["-", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
428
2
#include <algorithm> #include <iostream> #include <string> using namespace std; int d[50], n, a, b, v[50][50]; pair<int, string> S[30]; int main() { while (true) { cin >> n; if (n == 0) break; for (int i = 0; i < 2500; i++) { d[i % 50] = 0; v[i / 50][i % 50] = 0; S[i % 30] = make_p...
#include <algorithm> #include <iostream> #include <string> using namespace std; int d[50], n, a, b, v[50][50]; pair<int, string> S[30]; int main() { while (true) { cin >> n; if (n == 0) break; for (int i = 0; i < 2500; i++) { d[i % 50] = 0; v[i / 50][i % 50] = 0; S[i % 30] = make_p...
[["-", 31, 16, 31, 16, 31, 16, 12, 118, 119, 120], ["+", 31, 16, 31, 16, 31, 16, 12, 118, 119, 120], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120]]
1
278
4
#include <algorithm> #include <cmath> #include <queue> #include <stack> #include <stdio.h> #include <vector> typedef long long int ll; #define BIG_NUM 2000000000 using namespace std; struct Info { Info() { point = 0; } char name[11]; int point; }; struct Data { Data() { index = 0; } int table[31], index; ...
#include <algorithm> #include <cmath> #include <queue> #include <stack> #include <stdio.h> #include <vector> typedef long long int ll; #define BIG_NUM 2000000000 using namespace std; struct Info { Info() { point = 0; } char name[11]; int point; }; struct Data { Data() { index = 0; } int table[35], index; ...
[["-", 0, 122, 8, 123, 0, 124, 49, 80, 81, 13], ["+", 0, 122, 8, 123, 0, 124, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
770
4
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; bool compare(const pair<string, int> &a, const pair<string, int> &b) { if (a.second != b.second) return a.second < b.second; else return a.first > b.first; } int main(void) { int n; while (cin >> n, n) { ...
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; bool compare(const pair<string, int> &a, const pair<string, int> &b) { if (a.second != b.second) return a.second < b.second; else return a.first < b.first; } int main(void) { int n; while (cin >> n, n) { ...
[["-", 0, 57, 75, 76, 0, 37, 0, 16, 17, 47], ["+", 0, 57, 75, 76, 0, 37, 0, 16, 17, 18]]
1
291
2
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 28; struct Primal_Dual { typedef pair<int, int> Pi; struct edge { int to, cap, cost, rev; }; vector<vector<edge>> graph; vector<int> potential, min_cost, prevv, preve; Primal_Dual(int V) : graph(V) {} void add_edge(int from, int t...
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 28; struct Primal_Dual { typedef pair<int, int> Pi; struct edge { int to, cap, cost, rev; }; vector<vector<edge>> graph; vector<int> potential, min_cost, prevv, preve; Primal_Dual(int V) : graph(V) {} void add_edge(int from, int t...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22]]
1
1,225
2
#include <bits/stdc++.h> #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(i, 0, (n)) #define RREP(i, n) RFOR(i, 0, (n)) using namespace std; typedef pair<int, int> P; #define pb push_back #define mp make_pair #define ft first #define...
#include <bits/stdc++.h> #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(i, 0, (n)) #define RREP(i, n) RFOR(i, 0, (n)) using namespace std; typedef pair<int, int> P; #define pb push_back #define mp make_pair #define ft first #define ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79]]
1
1,557
2
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #d...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #d...
[["+", 8, 9, 0, 43, 49, 50, 49, 352, 0, 67], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
1,337
3
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<vector<pii>> graph; const int INF = 1e9; inline int match(int cur, int in, const string &s) { string prv = s.substr(0, cur) + (char)(in + '0'); rep(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<vector<pii>> graph; const int INF = 1e9; inline int match(int cur, int in, const string &s) { string prv = s.substr(0, cur) + (char)(in + '0'); rep(...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
1,168
4
#include <algorithm> #include <cstdio> #include <cstring> #include <queue> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; const int INF = 1 << 29; struct edge { int v, cost; }; // Šg’£‚µ‚½ƒOƒ‰ƒt‚É‚¨‚¯‚é’¸“_ struct Xnode { int u, t; // ƒR[ƒ“‚̔ԍ†, pttn // ‚̉½•¶Žš–ڂ܂Ń}ƒbƒ`...
#include <algorithm> #include <cstdio> #include <cstring> #include <queue> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; const int INF = 1 << 29; struct edge { int v, cost; }; // Šg’£‚µ‚½ƒOƒ‰ƒt‚É‚¨‚¯‚é’¸“_ struct Xnode { int u, t; // ƒR[ƒ“‚̔ԍ†, pttn // ‚̉½•¶Žš–ڂ܂Ń}ƒbƒ`...
[["-", 12, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 12, 11, 31, 69, 28, 69, 341, 342, 0, 22]]
1
1,698
2
#define _GLIBCXX_DEBUG #include <algorithm> #include <cassert> #include <deque> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define FOREACH(it, c) \ for (__typeof((c).begin()) it = (c).begin(); it != (c).end();...
//#define _GLIBCXX_DEBUG #include <algorithm> #include <cassert> #include <deque> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define FOREACH(it, c) \ for (__typeof((c).begin()) it = (c).begin(); it != (c).end(...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22]]
1
1,623
2
function heron(a, b, c) { var s = (a + b + c) / 2; var S = Math.sqrt(s * (s - a) * (s - b) * (s - c)); return S; } var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.trim()).split("\n"); for (var i = 0; i < Arr.length; i++) { var ALX = Arr[i].split(" ").map(Number); var A = ALX[0];...
function heron(a, b, c) { var s = (a + b + c) / 2; var S = Math.sqrt(s * (s - a) * (s - b) * (s - c)); return S; } var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.trim()).split("\n"); for (var i = 0; i < Arr.length; i++) { var ALX = Arr[i].split(" ").map(Number); var A = ALX[0];...
[["-", 12, 23, 0, 16, 31, 2, 3, 3, 0, 22], ["+", 12, 23, 0, 16, 31, 2, 3, 3, 0, 22]]
2
211
2
#include <cmath> #include <iomanip> #include <iostream> using namespace std; long double f(int x, int y) { return x * sqrtl(y * y - x * x / 4) / 2; } int a, l, x; int main() { while (cin >> a >> l >> x) { cout << fixed << setprecision(20) << f(a, l) + f(l * 2, l + x) / 2 << endl; } }
#include <cmath> #include <iomanip> #include <iostream> using namespace std; long double f(int x, int y) { return x * sqrtl(y * y - x * x / 4.0L) / 2; } int a, l, x; int main() { while (cin >> a >> l >> x) { cout << fixed << setprecision(20) << f(a, l) + f(l * 2, l + x) / 2 << endl; } }
[["-", 12, 2, 3, 4, 0, 16, 12, 16, 12, 13], ["+", 12, 2, 3, 4, 0, 16, 12, 16, 12, 13]]
1
96
2
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std...
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std...
[["+", 51, 16, 31, 2, 3, 4, 0, 66, 17, 67]]
1
189
3
#!ruby -apl a,l,x=$F.map &:to_f k=2*l $_="%.8f"%[k*Math.sqrt(x*x+x*k)+a*Math.sqrt(k*k-a*a)]
#!ruby -apl a,l,x=$F.map &:to_f k=2*l $_="%.8f"%[(k*Math.sqrt(x*x+x*k)+a*Math.sqrt(k*k-a*a))/4]
[["-", 0, 493, 0, 662, 12, 771, 0, 557, 0, 6], ["+", 0, 493, 0, 662, 12, 771, 0, 557, 0, 6]]
4
25
2
import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static int S, D, M; static int[][] P, W; public static void main(String[] args) { while (sc.hasNext()) { S = sc.nextInt(); D = sc.nextInt(); M = sc.nextInt(); W = new...
import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static int S, D, M; static int[][] P, W; public static void main(String[] args) { while (sc.hasNext()) { S = sc.nextInt(); D = sc.nextInt(); M = sc.nextInt(); W = new...
[["-", 15, 16, 12, 16, 12, 504, 516, 504, 71, 22], ["+", 15, 16, 12, 16, 12, 504, 516, 504, 71, 22], ["-", 31, 504, 71, 16, 12, 504, 516, 504, 71, 22], ["+", 31, 504, 71, 16, 12, 504, 516, 504, 71, 22], ["-", 3, 4, 0, 16, 12, 504, 516, 504, 71, 22], ["+", 3, 4, 0, 16, 12, 504, 516, 504, 71, 22]]
3
427
8
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp[5555][301]; struct Okashi { ll e; ll c; }; void dbgprng(const vector<vector<Okashi>> &kind_of_okashi, ll s) { for (ll j = 0; j < s; j++) { for (ll i = 0; i < kind_of_okashi[j].size(); i++) { cout << "eff=" << kind_of_okashi[j][i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp[5555][301]; struct Okashi { ll e; ll c; }; void dbgprng(const vector<vector<Okashi>> &kind_of_okashi, ll s) { for (ll j = 0; j < s; j++) { for (ll i = 0; i < kind_of_okashi[j].size(); i++) { cout << "eff=" << kind_of_okashi[j][i...
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
561
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; using ll = long long; #define all(c) (c).begin(), (c).end() #define rep(i, n) for...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; using ll = long long; #define all(c) (c).begin(), (c).end() #define rep(i, n) for...
[["-", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 3, 4, 0, 69, 28, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 69, 28, 69, 341, 342, 0, 22]]
1
512
6
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class t> using table = vector<vector<t>>; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class t> using table = vector<vector<t>>; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94]]
1
510
7
#include <bits/stdc++.h> using namespace std; #define mk make_pair main() { int s, d, m; while (cin >> s >> d >> m) { int dp[5001][101] = {}, pp = 0, ppp = 100000000, k, w, p, cc; vector<pair<int, int>> a[101], c; for (int i = 0; i < s; i++) { cin >> k; for (int j = 0; j < k; j++) { ...
#include <bits/stdc++.h> using namespace std; #define mk make_pair main() { int s, d, m; while (cin >> s >> d >> m) { int dp[5001][301] = {}, pp = 0, ppp = 100000000, k, w, p, cc; vector<pair<int, int>> a[101], c; for (int i = 0; i < s; i++) { cin >> k; for (int j = 0; j < k; j++) { ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
1
383
2
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 ...
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
416
2
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 ...
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
547
2
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 ...
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
608
2
#include <cstdlib> #include <cstring> #include <iostream> using namespace std; int s, d, m; int k[101]; int w[101][51]; int p[101][51]; int f[101]; int dp[5001][301]; int main() { while (cin >> s >> d >> m) { memset(w, 0, sizeof(w)); memset(p, 0, sizeof(p)); memset(f, 0, sizeof(f)); memset(dp, -1, ...
#include <cstdlib> #include <cstring> #include <iostream> using namespace std; int s, d, m; int k[101]; int w[101][51]; int p[101][51]; int f[101]; int dp[5001][301]; int main() { while (cin >> s >> d >> m) { memset(w, 0, sizeof(w)); memset(p, 0, sizeof(p)); memset(f, 0, sizeof(f)); memset(dp, -1, ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 151], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
471
4
#include <algorithm> #include <cstdio> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; void knapsack(int yosan, const vector<pair<int, int>> &a) { int n = a.size(); int dp[101] = {}; rep(i, n) { int value = a[i].first, price = a[i].second; for (int j = yosan; j >=...
#include <algorithm> #include <cstdio> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; void knapsack(int yosan, const vector<pair<int, int>> &a) { int n = a.size(); int dp[301] = {}; rep(i, n) { int value = a[i].first, price = a[i].second; for (int j = yosan; j >=...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
1
338
2
#include <iostream> #include <vector> using namespace std; const int INF = 1 << 28; int main() { int s, d, m; vector<int> w[100], p[100]; int dp[301]; while (cin >> s >> d >> m) { for (int i = 0; i < s; i++) { int k; cin >> k; w[i].resize(k), p[i].resize(k); for (int j = 0; j < k; ...
#include <iostream> #include <vector> using namespace std; const int INF = 1 << 28; int main() { int s, d, m; vector<int> w[100], p[100]; int dp[301]; while (cin >> s >> d >> m) { for (int i = 0; i < s; i++) { int k; cin >> k; w[i].resize(k), p[i].resize(k); for (int j = 0; j < k; ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
303
2
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef pair<int, int> pii; int dp1[50][301], dp2[101][301]; int main(void) { int s, d, m; while (cin >> s >> d >> m) { vector<pii> a[s]; for (int i = 0; i < s; i++) { int w, p, k; cin >> k; for (int j = 0...
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef pair<int, int> pii; int dp1[101][301], dp2[101][301]; int main(void) { int s, d, m; while (cin >> s >> d >> m) { vector<pii> a[s]; for (int i = 0; i < s; i++) { int w, p, k; cin >> k; for (int j = ...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
515
6
// AOJ 1093: KND Runs for Sweets // 2017.11.16 bal4u@uu #include <math.h> #include <stdio.h> #include <stdlib.h> #define KAI 25 int x[101], y[101], v[101]; int n; int max; double fx(double a, double b) { int i; double d, max; max = 0; for (i = 0; i < n; i++) { d = hypot(a - x[i], b - y[i]) / v[i]; i...
// AOJ 1093: KND Runs for Sweets // 2017.11.16 bal4u@uu #include <math.h> #include <stdio.h> #include <stdlib.h> #define KAI 35 int x[101], y[101], v[101]; int n; int max; double fx(double a, double b) { int i; double d, max; max = 0; for (i = 0; i < n; i++) { d = hypot(a - x[i], b - y[i]) / v[i]; i...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
0
416
24
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; double EPS = 1e-10; double add(double a, double b) { if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0; return a + b; } struct point { double x, y; point() {} point(double x, double y) :...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; double EPS = 1e-8; double add(double a, double b) { if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0; return a + b; } struct point { double x, y; point() {} point(double x, double y) : ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
521
4
#include <complex> #include <iomanip> #include <iostream> #include <vector> using namespace std; typedef complex<double> Point; bool intersect(Point p1, double r1, Point p2, double r2) { double d = abs(p1 - p2); if (d < abs(r1 - r2)) return false; if (d > r1 + r2) return false; return true; } Point cros...
#include <complex> #include <iomanip> #include <iostream> #include <vector> using namespace std; typedef complex<double> Point; bool intersect(Point p1, double r1, Point p2, double r2) { double d = abs(p1 - p2); if (d < abs(r1 - r2)) return false; if (d > r1 + r2) return false; return true; } Point cros...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
652
2
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <queue> #include <set> #define REP(i, n) for (int i = 0; i < (int)(n); i++) inline int getInt() { int s; scanf("%d", &s); return s; } using namespace std; typedef complex<double> P; int main() { while (const int n = getInt...
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <queue> #include <set> #define REP(i, n) for (int i = 0; i < (int)(n); i++) inline int getInt() { int s; scanf("%d", &s); return s; } using namespace std; typedef complex<double> P; int main() { while (const int n = getInt...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
276
2
#include <algorithm> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define inf (1 << 29) #define EPS (1e-10) #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK 2 #define ONLI...
#include <algorithm> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define inf (1 << 29) #define EPS (1e-10) #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK 2 #define ONLI...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
794
2
X, Y, V = *0..2 EPS = 1e-9 until (n = gets.to_i).zero? cafe = n.times.map{gets.split.map(&:to_f)} x, y = cafe.first d = 50.0 r = 0.9 until d < EPS farthermost = cafe.max_by{|c| Math.hypot(c[X] - x, c[Y] - y) / c[V]} angle = Math::atan2(farthermost[Y] - y, farthermost[X] - x) x += Math::cos(angle) ...
X, Y, V = *0..2 EPS = 1e-9 until (n = gets.to_i).zero? cafe = n.times.map{gets.split.map(&:to_f)} x, y = cafe.first d = 50.0 r = 0.98 until d < EPS farthermost = cafe.max_by{|c| Math.hypot(c[X] - x, c[Y] - y) / c[V]} angle = Math::atan2(farthermost[Y] - y, farthermost[X] - x) x += Math::cos(angle)...
[["-", 0, 493, 0, 750, 8, 170, 0, 662, 12, 531], ["+", 0, 493, 0, 750, 8, 170, 0, 662, 12, 531]]
4
174
2
import java.util.Scanner; class Main { public static void main(String[] args) { final int X = 0; final int Y = 1; int p[][] = new int[50][2]; int times = 1; Scanner stdin = new Scanner(System.in); while (true) { int n = stdin.nextInt(); if (n == 0) { break; } ...
import java.util.Scanner; class Main { public static void main(String[] args) { final int X = 0; final int Y = 1; int p[][] = new int[50][2]; int times = 1; Scanner stdin = new Scanner(System.in); while (true) { int n = stdin.nextInt(); if (n == 0) { break; } ...
[["+", 0, 52, 8, 196, 0, 1, 0, 27, 0, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 27, 0, 29], ["+", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35]]
3
269
3
#include <math.h> #include <stdio.h> int N, P[51][2], i, c, s; int main() { for (c = 1; scanf("%d", &N), N; c++) { scanf("%d%d", &P[0][0], &P[0][1]); for (i = 0, s = 0; i < N; i++) { if (i < N - 1) scanf("%d%d", &P[i + 1][0], &P[i + 1][1]); s += P[i][0] * P[(i + 1) % N][1] - P[(i + 1) % N]...
#include <math.h> #include <stdio.h> int N, P[51][2], i, c, s; int main() { for (c = 1; scanf("%d", &N), N; c++) { scanf("%d%d", &P[0][0], &P[0][1]); for (i = 0, s = 0; i < N; i++) { if (i < N - 1) scanf("%d%d", &P[i + 1][0], &P[i + 1][1]); s += P[i][0] * P[(i + 1) % N][1] - P[(i + 1) % N]...
[["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
0
197
2
#include <stdio.h> int main(void) { int n, x[100], y[100]; int va_x, va_y, vb_x, vb_y; int i, count = 1; double s = 0.0, sum = 0.0; scanf("%d", &n); do { sum = 0.0; for (i = 0; i < n; i++) { scanf("%d %d", &x[i], &y[i]); } for (i = 1; i < n - 1; i++) { va_x = x[i] - x[0]; ...
#include <stdio.h> int main(void) { int n, x[100], y[100]; int va_x, va_y, vb_x, vb_y; int i, count = 1; double s = 0.0, sum = 0.0; scanf("%d", &n); do { sum = 0.0; for (i = 0; i < n; i++) { scanf("%d %d", &x[i], &y[i]); } for (i = 1; i < n - 1; i++) { va_x = x[i] - x[0]; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
226
1
#include <stdio.h> int main() { int n, cnt = 1; scanf("%d", &n); while (n) { float s = 0, x0, y0, xa, xb, ya, yb; scanf("%d %d", &x0, &y0); xb = x0; yb = y0; for (int i = n - 1; i > 0; i--) { xa = xb; ya = yb; scanf("%d %d", &xb, &yb); s += (xb + xa) * (yb - ya); }...
#include <stdio.h> int main() { int n, cnt = 1; scanf("%d", &n); while (n) { float s = 0, x0, y0, xa, xb, ya, yb; scanf("%f %f", &x0, &y0); xb = x0; yb = y0; for (int i = n - 1; i > 0; i--) { xa = xb; ya = yb; scanf("%f %f", &xb, &yb); s += (xb + xa) * (yb - ya); }...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
175
4
#include <algorithm> #include <complex> #include <cstdio> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; double cross(complex<double> a, complex<double> b) { return (a * conj(b)).imag(); } int main() { int n, j = 1; while (cin >> n, n) { vector<complex<double...
#include <algorithm> #include <complex> #include <cstdio> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; double cross(complex<double> a, complex<double> b) { return (a * conj(b)).imag(); } int main() { int n, j = 1; while (cin >> n, n) { vector<complex<double...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
200
1
import java.awt.geom.*; import java.io.*; import java.math.*; import java.util.*; public class Main { static int INF = 2 << 27; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int n = sc.nextInt(); if (n == 0) break; int[] count = new i...
import java.awt.geom.*; import java.io.*; import java.math.*; import java.util.*; public class Main { static int INF = 2 << 27; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int n = sc.nextInt(); if (n == 0) break; int[] count = new i...
[["-", 0, 16, 12, 16, 12, 16, 31, 16, 31, 499], ["+", 0, 16, 12, 16, 12, 16, 31, 16, 31, 499]]
3
612
2
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Problem A: It's our delight!! */ public class Main { static final int Lmin = 660; static final int Lmax = 900; static final int Dmin = 1080; static final int Dmax = 1...
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Problem A: It's our delight!! */ public class Main { static final int Lmin = 660; static final int Lmax = 900; static final int Dmin = 1080; static final int Dmax = 1...
[["-", 0, 16, 12, 23, 0, 510, 15, 16, 31, 22], ["+", 0, 16, 12, 23, 0, 510, 15, 16, 31, 22]]
3
446
6
/* AOJ 1062 Title: @kankichi573 */ #include <stdio.h> #include <string.h> int denp[3][2]; char timezone[3][9] = {"lunch", "dinner", "midnight"}; void output() { int i; for (i = 0; i < 3; i++) { printf("%s ", &timezone[i][0]); if (denp[i][0] == 0) printf("no guest\n"); else printf("%d\...
/* AOJ 1062 Title: @kankichi573 */ #include <stdio.h> #include <string.h> int denp[3][2]; char timezone[3][9] = {"lunch", "dinner", "midnight"}; void output() { int i; for (i = 0; i < 3; i++) { printf("%s ", &timezone[i][0]); if (denp[i][0] == 0) printf("no guest\n"); else printf("%d\...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 20]]
0
315
2
#include <stdio.h> int main(void) { int l[2], d[2], s[2], n, h, m, t, i; while (scanf("%d", &n), n != 0) { l[0] = 0; l[1] = 0; d[0] = 0; d[1] = 0; s[0] = 0; s[1] = 0; for (i = 1; i <= n; i++) { scanf("%d:%d%d", &h, &m, &t); if (m > t) { t += 60; } if (11 ...
#include <stdio.h> int main(void) { int l[2], d[2], s[2], n, h, m, t, i; while (scanf("%d", &n), n != 0) { l[0] = 0; l[1] = 0; d[0] = 0; d[1] = 0; s[0] = 0; s[1] = 0; for (i = 1; i <= n; i++) { scanf("%d:%d%d", &h, &m, &t); if (m > t) { t += 60; } if (11 ...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 31, 13], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 19]]
0
363
4
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <math.h> #include <stdio.h> #include <stdlib.h> #define P(type, x, y) fprintf(stdout, #x " %" #type "\n", x * 100 / y) int main() { int h, m, M, lunch, dinner, midnight, n, cl, cd, cm; for (; fscanf(stdin, "%d", &n), n != 0;) { lunch = dinner ...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <math.h> #include <stdio.h> #include <stdlib.h> #define P(type, x, y) fprintf(stdout, #x " %" #type "\n", x * 100 / y) int main() { int h, m, M, lunch, dinner, midnight, n, cl, cd, cm; for (; fscanf(stdin, "%d", &n), n != 0;) { lunch = dinner ...
[["-", 0, 7, 8, 9, 0, 57, 15, 23, 0, 22], ["+", 0, 7, 8, 9, 0, 57, 15, 23, 0, 22], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
0
264
4
#define zone(h) \ ((11 <= (h) && (h) < 15) ? 0 \ : (18 <= (h) && (h) < 21) ? 1 \ : (21 <= (h) && (h) < 26) ? 2 ...
#define zone(h) \ ((11 <= (h) && (h) < 15) ? 0 \ : (18 <= (h) && (h) < 21) ? 1 \ : (21 <= (h) && (h) < 26) ? 2 ...
[["-", 15, 23, 0, 16, 31, 2, 3, 4, 0, 22], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 22], ["-", 0, 27, 28, 69, 71, 2, 3, 4, 0, 22], ["+", 0, 27, 28, 69, 71, 2, 3, 4, 0, 22]]
0
277
6
#include <stdio.h> int main(void) { int menu; int hour, min, order_time; int hantei; int l_ac, d_ac, m_ac; int l_ord, d_ord, m_ord; int i; while (1) { scanf("%d", &menu); if (menu == 0) { break; } l_ord = d_ord = m_ord = l_ac = d_ac = m_ac = 0; for (i = 0; i < menu; i++) { ...
#include <stdio.h> int main(void) { int menu; int hour, min, order_time; int hantei; int l_ac, d_ac, m_ac; int l_ord, d_ord, m_ord; int i; while (1) { scanf("%d", &menu); if (menu == 0) { break; } l_ord = d_ord = m_ord = l_ac = d_ac = m_ac = 0; for (i = 0; i < menu; i++) { ...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13]]
0
396
2
#include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string...
#include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string...
[["-", 49, 50, 51, 23, 0, 41, 15, 16, 17, 47], ["+", 49, 50, 51, 23, 0, 41, 15, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22]]
1
502
8
#include <algorithm> #include <cstdio> #include <vector> using namespace std; int main() { int n; const char *d[] = {"lunch", "dinner", "midnight"}; while (scanf("%d", &n), n) { int cnt[3] = {0}, acnt[3] = {0}; while (n--) { int t, m, r; scanf("%d%*c%d%d", &t, &m, &r); r -= m; if (...
#include <algorithm> #include <cstdio> #include <vector> using namespace std; int main() { int n; const char *d[] = {"lunch", "dinner", "midnight"}; while (scanf("%d", &n), n) { int cnt[3] = {0}, acnt[3] = {0}; while (n--) { int t, m, r; scanf("%d%*c%d%d", &t, &m, &r); r -= m; if (...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
268
2
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back int main() { int n; while (cin >> n) { if (n == 0) break; int l = 0,...
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back int main() { int n; while (cin >> n) { if (n == 0) break; int l = 0,...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
341
6
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #defin...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #defin...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
1
417
2
#include <bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define fi first #define se second #define X real() #define Y imag() #define value(x, y, w, h) (x >= 0 && x < w && y >= 0 && y < h) #define all(r) (r).begin(), (r).end() #define gsort(st, en) sort((st), (en), greater<int>()) #define vmax(ary) *ma...
#include <bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define fi first #define se second #define X real() #define Y imag() #define value(x, y, w, h) (x >= 0 && x < w && y >= 0 && y < h) #define all(r) (r).begin(), (r).end() #define gsort(st, en) sort((st), (en), greater<int>()) #define vmax(ary) *ma...
[["-", 51, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 51, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
741
8
#include <bits/stdc++.h> using namespace std; int main() { string str[] = {"lunch", "dinner", "midnught"}; int a; while (scanf("%d", &a), a) { int b[3][2]{}; for (int c = 0; c < a; c++) { int d, e, f; scanf("%d%*c%d%d", &d, &e, &f); if (f < e) f += 60; if (f - e < 9) { ...
#include <bits/stdc++.h> using namespace std; int main() { string str[] = {"lunch", "dinner", "midnight"}; int a; while (scanf("%d", &a), a) { int b[3][2]{}; for (int c = 0; c < a; c++) { int d, e, f; scanf("%d%*c%d%d", &d, &e, &f); if (f < e) f += 60; if (f - e < 9) { ...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
1
355
2
/* * Author: Zhang Jiangbin * Created Time: 2011/8/22/星期一 15:59:48 * File Name: a.cpp */ #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> using namespace std; #define SZ(v) ((int)(v).size()) int main() { int n, a, b, c, d, ...
/* * Author: Zhang Jiangbin * Created Time: 2011/8/22/星期一 15:59:48 * File Name: a.cpp */ #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> using namespace std; #define SZ(v) ((int)(v).size()) int main() { int n, a, b, c, d, ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
375
6
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include ...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include ...
[["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
526
2
#include <iostream> using namespace std; int main(void) { int n; while (cin >> n && n) { int l = 0, sl = 0, d = 0, sd = 0, m = 0, sm = 0; int hh, mm, MM; for (int i = 0; i < n; i++) { cin >> hh; cin.ignore(); // for ":" cin >> mm >> MM; if (mm > MM) MM += 60; bool...
#include <iostream> using namespace std; int main(void) { int n; while (cin >> n && n) { int l = 0, sl = 0, d = 0, sd = 0, m = 0, sm = 0; int hh, mm, MM; for (int i = 0; i < n; i++) { cin >> hh; cin.ignore(); // for ":" cin >> mm >> MM; if (mm > MM) MM += 60; bool...
[["-", 64, 9, 0, 57, 64, 1, 0, 27, 28, 22], ["+", 64, 9, 0, 57, 64, 1, 0, 27, 28, 22]]
1
300
2
#define _USE_MATH_DEFINES #define INF 100000000 #include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> using...
#define _USE_MATH_DEFINES #define INF 100000000 #include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> using...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
504
2
#include <bits/stdc++.h> using namespace std; enum { LUNCH, DINNER, MIDNIGHT }; int main() { const string times[] = {"lunch", "dinner", "midnight"}; for (int n; scanf("%d", &n) == 1 && n;) { array<int, 3> num, ok; num.fill(0); ok.fill(0); for (int i = 0; i < n; ++i) { int h, m; scanf...
#include <bits/stdc++.h> using namespace std; enum { LUNCH, DINNER, MIDNIGHT }; int main() { const string times[] = {"lunch", "dinner", "midnight"}; for (int n; scanf("%d", &n) == 1 && n;) { array<int, 3> num, ok; num.fill(0); ok.fill(0); for (int i = 0; i < n; ++i) { int h, m; scanf...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106]]
1
287
2
#include <iostream> using namespace std; int main() { int n; for (; cin >> n, n;) { int ans[3] = {0, 0, 0}; int sum[3] = {0, 0, 0}; for (int i = 0; i < n; i++) { int hh, mm, m; char buf; cin >> hh >> buf >> mm >> m; // cout<<hh<<" "<<mm<<" "<<m<<endl; int time = hh * 60 + ...
#include <iostream> using namespace std; int main() { int n; for (; cin >> n, n;) { int ans[3] = {0, 0, 0}; int sum[3] = {0, 0, 0}; for (int i = 0; i < n; i++) { int hh, mm, m; char buf; cin >> hh >> buf >> mm >> m; // cout<<hh<<" "<<mm<<" "<<m<<endl; int time = hh * 60 + ...
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["-", 75, 76, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 12, 22]]
1
342
4
while 1: n=int(input()) if n==0:break l=d=m=cl=cm=cd=0 for i in range(n): t,M=input().split() M=int(M) h,m=map(int,t.split(':')) if m>M:M+=60 a=M-m<=8 if 11<=h<15:cl+=1;l+=a elif 18<=h<21:cd+=1;d+=a elif 21<=h or h< 2:cm+=1;m+=a print('...
while 1: n=int(input()) if n==0:break l=d=mi=cl=cm=cd=0 for i in range(n): t,M=input().split() M=int(M) h,m=map(int,t.split(":")) if m>M:M+=60 a=M-m<=8 if 11<=h<15:cl+=1;l+=a elif 18<=h<21:cd+=1;d+=a elif 21<=h or h< 2:cm+=1;mi+=a print...
[["-", 0, 1, 0, 662, 12, 662, 12, 662, 31, 22], ["+", 0, 1, 0, 662, 12, 662, 12, 662, 31, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22], ["+", ...
5
185
10
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; typedef pair<int, int> P; map<string, int> mp; int N, M; vector<P> t, A, B; int solve(int start) { int ai = 0, bi = 0, now = start, res = 0; int as = A.size(), bs = B.size(), cnt = 0; while (1) { int ag = (ai < as ...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; typedef pair<int, int> P; map<string, int> mp; int N, M; vector<P> t, A, B; int solve(int start) { int ai = 0, bi = 0, now = start, res = 0; int as = A.size(), bs = B.size(), cnt = 0; while (1) { int ag = (ai < as ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
565
4
//============================================================================ // Name : TopCoderCompetition.cpp // Author : taguchi // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //=====================================================================...
//============================================================================ // Name : TopCoderCompetition.cpp // Author : taguchi // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //=====================================================================...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
835
4
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) static const int MAX = 500; static const int L = 30; bool overlap(int a, int b) { if (a > b) swap(a, b); return a + 30 > b; } int getPro...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) static const int MAX = 500; static const int L = 30; bool overlap(int a, int b) { if (a > b) swap(a, b); return a + 30 > b; } int getPro...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
468
4
import java.util.ArrayList; import java.util.List; import java.util.Scanner; // The House of Huge Family public class Main { class E { int s, t, id; long c; public E(int s, int t, long c, int id) { this.s = s; this.t = t; this.c = c; this.id = id; } } int n, m; List<E>...
import java.util.ArrayList; import java.util.List; import java.util.Scanner; // The House of Huge Family public class Main { class E { int s, t, id; long c; public E(int s, int t, long c, int id) { this.s = s; this.t = t; this.c = c; this.id = id; } } int n, m; List<E>...
[["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 91, 17, 111], ["+", 0, 7, 8, 57, 15, 15, 0, 91, 17, 111], ["+", 8, 7, 8, 57, 15, 15, 0, 91, 17, 111]]
3
620
5
#define _USE_MATH_DEFINES #define INF 100000000 #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #inclu...
#define _USE_MATH_DEFINES #define INF 100000000 #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #inclu...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
1,124
2
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <sstream> #include...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <sstream> #include...
[["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 146]]
1
1,017
2
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; #define eps 1e-8 #define pi acos(-1.0) #define inf 1 << 30 #define linf 1LL << 60 #define pb push...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; #define eps 1e-8 #define pi acos(-1.0) #define inf 1 << 30 #define linf 1LL << 60 #define pb push...
[["-", 64, 9, 0, 1, 0, 11, 12, 91, 17, 33]]
1
623
1
#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 <vector> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (i...
#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 <vector> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (i...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
675
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, m, n) for (int i = m; i < n; i++) typedef long long l...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, m, n) for (int i = m; i < n; i++) typedef long long l...
[["-", 15, 339, 51, 16, 12, 16, 12, 5, 0, 6], ["+", 15, 339, 51, 16, 12, 16, 12, 5, 0, 6]]
1
415
2
#include <iostream> enum { N = 100000, M = 100000007 }; int d[N + 1][2], t, i, j, l[2] = {3, 5}; main() { for (; t < 2; t++) { for (d[1][t] = i = 1; i++ < l[t];) d[i][t] = d[i - 1][t] * 2; for (i = l[t]; i++ < N;) for (d[i][t] = 1, j = 0; j++ < l[t];) d[i][t] = (d[i][t] + d[i - j][t]) % M;...
#include <iostream> enum { N = 100000, M = 100000007 }; long long d[N + 1][2]; int t, i, j, l[2] = {3, 5}; main() { for (; t < 2; t++) { for (d[1][t] = i = 1; i++ < l[t];) d[i][t] = d[i - 1][t] * 2; for (i = l[t]; i++ < N;) for (d[i][t] = 1, j = 0; j++ < l[t];) d[i][t] = (d[i][t] + d[i - j...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40]]
1
276
6
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); for (;;) { int n = in.nextInt(); int k = in.nextInt(); if ((n | k) == 0) return; int a[] = new int[n]; int max = 0; int cmax = 0; for (int i =...
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); for (;;) { int n = in.nextInt(); int k = in.nextInt(); if ((n | k) == 0) return; int a[] = new int[n]; int max = 0; int cmax = 0; for (int i =...
[["-", 0, 11, 12, 492, 3, 4, 0, 16, 31, 22], ["-", 0, 11, 12, 492, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 492, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 492, 3, 4, 0, 16, 12, 22]]
3
365
4
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) int main() { int N, K; while (cin >> N >> K && (N | K)) { int C[N]; rep(i, N) { cin >> C[i]; } int mx1 = 1; rep(i, N) { int mul = 1; REP(j, i, i + K) { ...
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) int main() { int N, K; while (cin >> N >> K && (N | K)) { int C[N]; rep(i, N) { cin >> C[i]; } int mx1 = 1; rep(i, N) { int mul = 1; REP(j, i, i + K) { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12,...
1
272
9