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 <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int n, w;
int dat[100];
int maxi;
int l, r;
double calc() {
double ans = 0;
for (int i = l; i <= r; ++i) {
ans += ((double)(r - i) / (r - l)) * ((double)dat[i] / maxi);
}
return ans + 0.01;
}
main() {
while ((cin >> n >> w) &... | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int n, w;
int dat[100];
int maxi;
int l, r;
double calc() {
double ans = 0;
l = 0;
for (int i = l; i <= r; ++i) {
ans += ((double)(r - i) / (r - l)) * ((double)dat[i] / maxi);
}
return ans + 0.01;
}
main() {
while ((cin >> ... | [["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 218 | 4 |
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
int f[100];
int main() {
int n, w, v;
while (cin >> n >> w, n | w) {
memset(f, 0, sizeof(f));
int rm = 0, maxh = 0;
double s = 0;
while (n--) {
cin >> v;
maxh = max(maxh, ++f[v / w]);
rm = max(rm, v /... | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
int f[100];
int main() {
int n, w, v;
while (cin >> n >> w, n | w) {
memset(f, 0, sizeof(f));
int rm = 0, maxh = 0;
double s = 0;
while (n--) {
cin >> v;
maxh = max(maxh, ++f[v / w]);
rm = max(rm, v /... | [["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 85], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22]] | 1 | 151 | 2 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#incl... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#incl... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 1,158 | 2 |
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, a) REP(i, 0, a)
using namespace std;
int n, m, k;
int main(void) {
while (cin >> n >> m >> k && n) {
int dp[n][n * m + 1];
memset(dp, 0, sizeof(dp));
rep(i... | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, a) REP(i, 0, a)
using namespace std;
int n, m, k;
int main(void) {
while (cin >> n >> m >> k && n) {
int dp[n][n * m + 1];
memset(dp, 0, sizeof(dp));
rep(i... | [["-", 28, 69, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 28, 69, 28, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 236 | 5 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define SZ(n) (int)n.size()
#define dump(x) cerr << #x << " = " << (x) << endl;
#d... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define SZ(n) (int)n.size()
#define dump(x) cerr << #x << " = " << (x) << endl;
#d... | [["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 1 | 254 | 1 |
#include <algorithm>
#include <assert.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);
#define REP... | #include <algorithm>
#include <assert.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);
#define REP... | [["-", 3, 4, 0, 105, 51, 74, 39, 77, 39, 40], ["+", 3, 4, 0, 105, 51, 74, 39, 77, 39, 40], ["+", 51, 74, 51, 66, 28, 23, 0, 16, 17, 72], ["+", 51, 74, 51, 66, 28, 23, 0, 16, 12, 13]] | 1 | 296 | 4 |
#include <cmath>
#include <iostream>
using namespace std;
main() {
int n, m, k;
while (1) {
cin >> n >> m >> k;
if (n == 0 && m == 0 && k == 0)
break;
int num[100000000];
for (int i = 1; i <= n; i++)
num[i] = 1;
bool end = false;
double ans = 0;
double a = pow((double)m, (... | #include <cmath>
#include <iostream>
using namespace std;
main() {
int n, m, k;
while (1) {
cin >> n >> m >> k;
if (n == 0 && m == 0 && k == 0)
break;
int num[10000];
for (int i = 1; i <= n; i++)
num[i] = 1;
bool end = false;
double ans = 0;
double a = pow((double)m, (doub... | [["-", 0, 52, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 80, 81, 13]] | 1 | 272 | 2 |
while True:
n,m,k = list(map(int,input().split(" ")))
if n == m == k == 0: break
dice = [[0 for _ in range(m * n)] for _ in range(n)]
for i in range(m):
dice[0][i] = 1
for i in range(n-1):
for j in range(m * n):
if dice[i][j] == 0: continue
for l in range(1,m+1):
dice[i+1][j+l] += dice[i][j]
print(s... | while True:
n,m,k = list(map(int,input().split(" ")))
if n == m == k == 0: break
dice = [[0 for _ in range(m * n)] for _ in range(n)]
for i in range(m):
dice[0][i] = 1
for i in range(n-1):
for j in range(m * n):
if dice[i][j] == 0: continue
for l in range(1,m+1):
dice[i+1][j+l] += dice[i][j]
print(s... | [["+", 0, 659, 12, 652, 3, 4, 0, 23, 0, 24], ["+", 3, 4, 0, 23, 0, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 23, 0, 657, 31, 657, 17, 48], ["+", 3, 4, 0, 23, 0, 657, 31, 657, 12, 22], ["+", 12, 652, 3, 4, 0, 23, 0, 657, 17, 33], ["+", 0, 659, 12, 652, 3, 4, 0, 23, 0, 25]] | 5 | 194 | 6 |
#include <bits/stdc++.h>
using namespace std;
namespace {
template <class T> ostream &operator<<(ostream &os, const vector<T> &vs) {
if (vs.empty())
return os << "[]";
os << "[" << vs[0];
for (int i = 1; i < vs.size(); i++)
os << " " << vs[i];
return os << "]";
}
int N;
vector<int> S, T, U;
bool inp... | #include <bits/stdc++.h>
using namespace std;
namespace {
template <class T> ostream &operator<<(ostream &os, const vector<T> &vs) {
if (vs.empty())
return os << "[]";
os << "[" << vs[0];
for (int i = 1; i < vs.size(); i++)
os << " " << vs[i];
return os << "]";
}
int N;
vector<int> S, T, U;
bool inp... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18]] | 1 | 916 | 2 |
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define... | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22]] | 1 | 888 | 2 |
import static java.lang.Integer.parseInt;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Problem A: Grey Area
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(Sys... | import static java.lang.Integer.parseInt;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Problem A: Grey Area
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(Sys... | [["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499]] | 3 | 560 | 2 |
#include <memory.h>
#include <stdio.h>
int main(void) {
int n, w, i, v, h[10], maxh, maxv, maxw;
double ans;
while (1) {
scanf("%d %d", &n, &w);
if (!n) {
break;
}
maxv = -1;
ans = maxh = maxw = 0;
memset(h, 0, sizeof(h));
for (i = 0; i < n; i++) {
scanf("%d", &v);
if... | #include <memory.h>
#include <stdio.h>
int main(void) {
int n, w, i, v, h[11], maxh, maxv, maxw;
double ans;
while (1) {
scanf("%d %d", &n, &w);
if (!n) {
break;
}
maxv = -1;
ans = maxh = maxw = 0;
memset(h, 0, sizeof(h));
for (i = 0; i < n; i++) {
scanf("%d", &v);
if... | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]] | 0 | 224 | 2 |
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for (int... | #include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for (int... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 328 | 2 |
#include <bits/stdc++.h>
using namespace std;
typedef ostringstream OSS;
typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<str... | #include <bits/stdc++.h>
using namespace std;
typedef ostringstream OSS;
typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<str... | [["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 9, 0, 42, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 42, 0, 2, 3, 4, 0, 13]] | 1 | 485 | 4 |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define INF 1000000000
#define rep(i, n) for (int i = 0; i < n; i... |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define INF 1000000000
#define rep(i, n) for (int i = 0; i < n; i... | [["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 234 | 6 |
#include "bits/stdc++.h"
#include <unordered_map>
#pragma warning(disable : 4996)
using namespace std;
const int My_Inf = 2147483647;
const long long int My_LInf = 9223372036854775807;
struct action {
int ac;
int time;
};
int main() {
while (1) {
int n, w;
cin >> n >> w;
if (!n)
break;
vect... | #include "bits/stdc++.h"
#include <unordered_map>
#pragma warning(disable : 4996)
using namespace std;
const int My_Inf = 2147483647;
const long long int My_LInf = 9223372036854775807;
struct action {
int ac;
int time;
};
int main() {
while (1) {
int n, w;
cin >> n >> w;
if (!n)
break;
vect... | [["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]] | 1 | 212 | 2 |
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9
using namespace std;
int main() {
int n, w;
while (cin >> n >> w and n + w) {
vector<int> data(n);
REP(i, n) { cin >> data[i]; }
sort(ALL(data));
int maxim = data[n ... | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9
using namespace std;
int main() {
int n, w;
while (cin >> n >> w and n + w) {
vector<int> data(n);
REP(i, n) { cin >> data[i]; }
sort(ALL(data));
int maxim = data[n ... | [["+", 49, 50, 51, 23, 0, 16, 31, 23, 0, 24], ["+", 51, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 51, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 49, 50, 51, 23, 0, 16, 31, 23, 0, 25]] | 1 | 235 | 4 |
#include <iostream>
using namespace std;
int main() {
for (int h, w; cin >> h >> w;) {
int a[21] = {}, b[21] = {}, r = 0;
for (int i = 0, t; i < h && cin >> t; i++)
a[t]++;
for (int i = 0, t; i < w && cin >> t; i++)
b[t]++;
for (int i = 0; i < 21; i++) {
int t = min(a[i], b[i]);
... | #include <iostream>
using namespace std;
int main() {
for (int h, w; cin >> h >> w, h;) {
int a[21] = {}, b[21] = {}, r = 0;
for (int i = 0, t; i < h && cin >> t; i++)
a[t]++;
for (int i = 0, t; i < w && cin >> t; i++)
b[t]++;
for (int i = 0; i < 21; i++) {
int t = min(a[i], b[i]);
... | [["+", 0, 14, 8, 9, 0, 7, 15, 34, 0, 21], ["+", 0, 14, 8, 9, 0, 7, 15, 34, 12, 22]] | 1 | 210 | 2 |
while True:
w,d = [int(i) for i in input().split()]
if w == 0:
break
h = [int(i) for i in input().split()]
h_ = [int(i) for i in input().split()]
h = sorted(h)
h_ = sorted(h_)
hdic = {}
h_dic = {}
for i in h:
if i in hdic.keys():
hdic[i]+= 1
else:... | while True:
w,d = [int(i) for i in input().split()]
if w == 0:
break
h = [int(i) for i in input().split()]
h_ = [int(i) for i in input().split()]
h = sorted(h)
h_ = sorted(h_)
hdic = {}
h_dic = {}
for i in h:
if i in hdic.keys():
hdic[i]+= 1
else:... | [["-", 12, 657, 12, 652, 3, 4, 0, 206, 206, 22], ["+", 12, 657, 12, 652, 3, 4, 0, 206, 206, 22]] | 5 | 190 | 4 |
#include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include ... | #include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include ... | [["-", 0, 42, 0, 2, 63, 2, 63, 118, 119, 120], ["+", 0, 42, 0, 2, 63, 2, 63, 118, 119, 120]] | 1 | 540 | 2 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<int> v;
bool isPrime(int n) {
for (int i = 0; i < v.size() && v[i] * v[i] <= n; i++) {
if (n % v[i] == 0)
return false;
}
return true;
}
int main() {
v.push_back(2);
v.push_back(3);
for (int i = 5; i * i <= 1... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<int> v;
bool isPrime(int n) {
for (int i = 0; i < v.size() && v[i] * v[i] <= n; i++) {
if (n % v[i] == 0)
return false;
}
return true;
}
int main() {
v.push_back(2);
v.push_back(3);
for (int i = 5; i <= 10000... | [["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22]] | 1 | 301 | 2 |
primes = [0, 0] + [1]*996
for i in range(2, 32):
if primes[i]:
for j in range(i*i, 998, i):
primes[j] = 0
while True:
n = int(input())
if n == 0:
break
m = n
while not primes[m]:
m -= 1
pnum = [i for i in range(m+1) if primes[i]]
ans = 0
for i in range... | primes = [0, 0] + [1]*9999
for i in range(2, 101):
if primes[i]:
for j in range(i*i, 10001, i):
primes[j] = 0
while True:
n = int(input())
if n == 0:
break
m = n
while not primes[m]:
m -= 1
pnum = [i for i in range(m+1) if primes[i]]
ans = 0
for i in r... | [["-", 0, 1, 0, 662, 12, 657, 12, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 12, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 153 | 6 |
#include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
double R;
int n, a[100];
struct ST {
double w, a, h;
ST() {}
ST(double w, double a, double h) : w(w), a(a), h(h) {}
};
ST combine(const ST &p, const ST &q) {
const double a = p.... | #include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
double R;
int n, a[100];
struct ST {
double w, a, h;
ST() {}
ST(double w, double a, double h) : w(w), a(a), h(h) {}
};
ST combine(const ST &p, const ST &q) {
const double a = q.... | [["-", 0, 43, 49, 50, 51, 16, 31, 118, 28, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 118, 28, 22]] | 1 | 507 | 2 |
// 2006年アジアA How I Wonder What You Are!
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define EPS 1e-9
typedef struct {
double x, y, z;
} Position;
double dot(Position a, Position b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
double dist(Position a) { return sqrt(a.x * a.x + a.y * a.y + a.z * a.z); ... | // 2006年アジアA How I Wonder What You Are!
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define EPS 1e-9
typedef struct {
double x, y, z;
} Position;
double dot(Position a, Position b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
double dist(Position a) { return sqrt(a.x * a.x + a.y * a.y + a.z * a.z); ... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]] | 0 | 360 | 2 |
#include <bits/stdc++.h>
using namespace std;
class Point3d {
public:
double x, y, z;
Point3d(double a = 0, double b = 0, double c = 0) : x(a), y(b), z(c) {}
};
double norm(Point3d a, Point3d b) {
return pow((a.x - b.x), 2) + pow((a.y - b.y), 2) + pow((a.z - b.z), 2);
}
double abs(Point3d a, Point3d b) { retur... | #include <bits/stdc++.h>
using namespace std;
class Point3d {
public:
double x, y, z;
Point3d(double a = 0, double b = 0, double c = 0) : x(a), y(b), z(c) {}
};
double norm(Point3d a, Point3d b) {
return pow((a.x - b.x), 2) + pow((a.y - b.y), 2) + pow((a.z - b.z), 2);
}
double abs(Point3d a, Point3d b) { retur... | [["-", 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, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22]] | 1 | 447 | 6 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <exception>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <v... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <exception>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <v... | [["-", 64, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 27, 28, 69, 341, 342, 0, 22]] | 1 | 524 | 2 |
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
class P3 {
public:
double x, y, z;
P3(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {}
P3(const P3 &p) : x(p.x), y(p.y), z(p.z) {}
void set(const P3 &p) { x = p.x, y = p.y, z = p.z; }
void set(double... | #include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
class P3 {
public:
double x, y, z;
P3(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {}
P3(const P3 &p) : x(p.x), y(p.y), z(p.z) {}
void set(const P3 &p) { x = p.x, y = p.y, z = p.z; }
void set(double... | [["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]] | 1 | 799 | 6 |
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define... | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22]] | 1 | 1,130 | 2 |
/*
AOJ 1291
Title:Search of Concatenated Strings
@kankichi573
*/
#include <stdio.h>
#include <string.h>
int n, m;
char e[12][21];
int len[12];
char t[5001];
char flag[5001][4096];
void dump_flag(char flag[5001][4096], int len) {
int i, j;
for (i = 0; i < len; i++)
for (j = 0; j < 4096; j++)
if (fla... | /*
AOJ 1291
Title:Search of Concatenated Strings
@kankichi573
*/
#include <stdio.h>
#include <string.h>
int n, m;
char e[12][21];
int len[12];
char t[5001];
char flag[5001][4096];
void dump_flag(char flag[5001][4096], int len) {
int i, j;
for (i = 0; i < len; i++)
for (j = 0; j < 4096; j++)
if (fla... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 486 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, x, y) for (int i = (x); i < (y); ++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
const int inf = 1e9;
const int64_t in... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, x, y) for (int i = (x); i < (y); ++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
const int inf = 1e9;
const int64_t in... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]] | 1 | 663 | 2 |
#include <bits/stdc++.h>
#define N 12
#define S 5005
#define M 1777771
using namespace std;
typedef unsigned long long ull;
bool dp[(1 << N)][S];
int n, m;
string s[N], t;
ull d1[N], d2[S], A[30];
int main() {
while (1) {
cin >> n >> m;
if (!n && !m)
break;
for (int i = 0; i < n; i++)
ci... | #include <bits/stdc++.h>
#define N 12
#define S 5005
#define M 1777771
using namespace std;
typedef unsigned long long ull;
bool dp[(1 << N)][S];
int n, m;
string s[N], t;
ull d1[N], d2[S], A[30];
int main() {
while (1) {
cin >> n >> m;
if (!n && !m)
break;
for (int i = 0; i < n; i++)
ci... | [["-", 341, 342, 0, 16, 31, 16, 12, 69, 28, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 73]] | 1 | 552 | 3 |
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<vector<ll>, ll> pvi;
vector<ll> polyadd(const vector<ll> &a, const vector<ll> &b) {
const ll n = a.size(), m = b.size();
vector<ll> result(max(n, m));
for (ll i... | #include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<vector<ll>, ll> pvi;
vector<ll> polyadd(const vector<ll> &a, const vector<ll> &b) {
const ll n = a.size(), m = b.size();
vector<ll> result(max(n, m));
for (ll i... | [["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22]] | 1 | 1,809 | 2 |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
final int w = sc.nextInt();
final int d = sc.nextInt();
if (w == 0 && d == 0) {
break;
}
int[] wh = new... | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
final int w = sc.nextInt();
final int d = sc.nextInt();
if (w == 0 && d == 0) {
break;
}
int[] wh = new... | [["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 140], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33]] | 3 | 236 | 2 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define f... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define f... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 176 | 2 |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
int main() {
for (int w, d; cin >> w >> d && (w | d);) {
vector<int> h1(w + 1, INF), h2(d + 1, INF + 1);
for (int i = 0; i < w; ++i)
cin >> h1[i];
for (int i = 0; i < d; ++i)
cin >> h2[i];
sort(h1.begin(), h1.end());
... | #include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
int main() {
for (int w, d; cin >> w >> d && (w | d);) {
vector<int> h1(w + 1, INF), h2(d + 1, INF + 1);
for (int i = 0; i < w; ++i)
cin >> h1[i];
for (int i = 0; i < d; ++i)
cin >> h2[i];
sort(h1.begin(), h1.end());
... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 98], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 106]] | 1 | 235 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int n, m;
int a[20], b[20];
int solve() {
rep(i, n) rep(j, m) {
if (a[i] == b[j])
b[j] = 0;
}
int res = 0;
rep(i, n) res += a[i];
rep(i, m) res += b[i];
return res;
}
int main() {
while (cin ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int n, m;
int a[20], b[20];
int solve() {
rep(i, n) rep(j, m) {
if (a[i] == b[j]) {
b[j] = 0;
break;
}
}
int res = 0;
rep(i, n) res += a[i];
rep(i, m) res += b[i];
return res;
}
int m... | [["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]] | 1 | 155 | 4 |
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
int x[30][2];
int y[30];
int h, w, sum;
int s[20], t[20];
int hantei() {
sum = 0;
memset(x, 0, sizeof(x));
memset(y, 0, sizeof(y));
for (int i = 0; i < h; i++) {
x[s[i]][0]++;
}
for (int i = 0; i < w; i++) {
x[t[i]][1]... | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
int x[30][2];
int y[30];
int h, w, sum;
int s[20], t[20];
int hantei() {
sum = 0;
memset(x, 0, sizeof(x));
memset(y, 0, sizeof(y));
for (int i = 0; i < h; i++) {
x[s[i]][0]++;
}
for (int i = 0; i < w; i++) {
x[t[i]][1]... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 269 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int w, d;
while (cin >> w >> d) {
int a1[22] = {}, a2[22] = {};
for (int i = 0; i < w; i++) {
int k;
cin >> k;
a1[k]++;
}
for (int i = 0; i < d; i++) {
int k;
cin >> k;
a2[k]++;
}
i... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int w, d;
while (cin >> w >> d, w, d) {
int a1[22] = {}, a2[22] = {};
for (int i = 0; i < w; i++) {
int k;
cin >> k;
a1[k]++;
}
for (int i = 0; i < d; i++) {
int k;
cin >> k;
a2[k]++;
}... | [["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 0, 52, 15, 339, 51, 34, 12, 34, 31, 22], ["+", 0, 52, 15, 339, 51, 34, 12, 34, 0, 21], ["+", 0, 52, 15, 339, 51, 34, 12, 34, 12, 22]] | 1 | 146 | 4 |
#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;
//// < "d:\d_download\visual studio
///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual
///studio 2015\projects\programin... | #include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;
//// < "d:\d_download\visual studio
///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual
///studio 2015\projects\programin... | [["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 431 | 6 |
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <vector>
using namespace std;
set<string> s;
set<string> visit;
map<string, vector<string>> m;
void solve(string &key) {
int i;
vector<string> &z = m[key];
for (i = 0; i < z.size(); i++)
if (m.find(z[i]) != m.end())
s.insert... | #include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <vector>
using namespace std;
set<string> s;
set<string> visit;
map<string, vector<string>> m;
void solve(string &key) {
int i;
vector<string> &z = m[key];
for (i = 0; i < z.size(); i++)
if (m.find(z[i]) == m.end())
s.insert... | [["-", 0, 7, 8, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 17, 60]] | 1 | 338 | 30 |
import static java.lang.Math.*;
import java.util.*;
public class Main {
final Scanner sc = new Scanner(System.in);
public static void main(String[] args) { new Main().init(); }
void init() {
final long STACK_SIZE = 8 * 1024 * 1024;
new Thread(null, new AOJ1306(), "RUN!", STACK_SIZE).start();
// new L... | import static java.lang.Math.*;
import java.util.*;
public class Main {
final Scanner sc = new Scanner(System.in);
public static void main(String[] args) { new Main().init(); }
void init() {
final long STACK_SIZE = 8 * 1024 * 1024;
new Thread(null, new AOJ1306(), "RUN!", STACK_SIZE).start();
// new L... | [["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46]] | 3 | 667 | 4 |
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;
int N;
int dp[40][4];
int NG_index;
int P[40];
int T[40];
const int INF = (int)1e9;
int solve(int index, int num) {
if (index == N)
return P[index - 1];
int &res = dp[index][num];
if (res != -1)
return res... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
using namespace std;
int N;
int dp[40][4];
int NG_index;
int P[40];
int T[40];
const int INF = (int)1e9;
int solve(int index, int num) {
if (index == N)
return P[index - 1];
int &res = dp[index][num];
if (res != -1)
return res... | [["-", 31, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 31, 16, 12, 16, 31, 23, 0, 16, 12, 13]] | 1 | 381 | 2 |
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
const int MAXN = 42;
const int MAXB = 4;
const int INF = 1 << 28;
int N;
int dp[MAXN][MAXB];
int P[MAXN], T[MAXN];
int main() {
while (cin >> N && N) {
P[0] = 0;
T[0] = 0;
for (int i = 0; i < N; ++i) {
cin >> P[i + 1] ... | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
const int MAXN = 45;
const int MAXB = 4;
const int INF = 1 << 28;
int N;
int dp[MAXN][MAXB];
int P[MAXN], T[MAXN];
int main() {
while (cin >> N && N) {
P[0] = 0;
T[0] = 0;
for (int i = 0; i < N; ++i) {
cin >> P[i + 1] ... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6]] | 1 | 464 | 4 |
#include <bits/stdc++.h>
using namespace std;
#define MAX 45
#define INF 1e9
int N, p[MAX], t[MAX];
int dp[MAX][4];
bool used[MAX];
void init() {
p[0] = t[0] = 0;
fill(dp[0], dp[0] + MAX * 4, INF);
memset(used, false, sizeof(used));
}
int d(int idx, bool v) {
if (v) {
return p[idx] + p[idx + 1];
} el... | #include <bits/stdc++.h>
using namespace std;
#define MAX 45
#define INF 1e9
int N, p[MAX], t[MAX];
int dp[MAX][4];
bool used[MAX];
void init() {
p[0] = t[0] = 0;
fill(dp[0], dp[0] + MAX * 4, INF);
memset(used, false, sizeof(used));
}
int d(int idx, bool v) {
if (v) {
return p[idx] + p[idx + 1];
} el... | [["-", 64, 9, 0, 37, 0, 11, 12, 2, 63, 22], ["-", 0, 37, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 64, 9, 0, 37, 0, 11, 12, 69, 28, 22], ["+", 0, 37, 0, 11, 12, 69, 341, 342, 0, 70], ["-", 0, 37, 0, 11, 12, 2, 3, 4, 0, 21], ["-", 0, 37, 0, 11, 12, 2, 3, 4, 0, 13], ["-", 0, 37, 0, 11, 12, 2, 3, 4, 0, 25], ["+", 0, 37, 0, 11, 12... | 1 | 420 | 8 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 100000000
using namespace std;
int n, p, t, dp[50][3], P, T, a;
int main() {
while (cin >> n, n) {
rep(i, 50) rep(j, 3) dp[i][j] = INF;
dp[0][0] = 0;
P = 0;
T = 0;
a = INF;
rep(i, n) {
cin >> p >> t;
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 100000000
using namespace std;
int n, p, t, dp[50][3], P, T, a;
int main() {
while (cin >> n, n) {
rep(i, 50) rep(j, 3) dp[i][j] = INF;
dp[0][0] = 0;
P = 0;
T = 0;
a = INF;
rep(i, n) {
cin >> p >> t;
... | [["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6]] | 1 | 374 | 2 |
#include <cstdio>
#include <cstdlib>
#include <cstring>
struct solver {
//鬚倡岼謇?怙蜿倬?
int n;
int p[55], t[55];
// weapon
int dp
[55]
[5]; // 蠖灘燕蝨ィ隨ャi荳ェ逅?噪菴咲スョ?瑚スヲ荳顔噪豌皮帥謨ー?梧園陦碁ゥカ逧?怙遏ュ霍晉ヲサ
bool init() {
scanf("%d", &n);
if (!n)
return false;
for (int i = 1; i <= n; i++) {
sc... | #include <cstdio>
#include <cstdlib>
#include <cstring>
struct solver {
//鬚倡岼謇?怙蜿倬?
int n;
int p[55], t[55];
// weapon
int dp
[55]
[5]; // 蠖灘燕蝨ィ隨ャi荳ェ逅?噪菴咲スョ?瑚スヲ荳顔噪豌皮帥謨ー?梧園陦碁ゥカ逧?怙遏ュ霍晉ヲサ
bool init() {
scanf("%d", &n);
if (!n)
return false;
for (int i = 1; i <= n; i++) {
sc... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 499 | 2 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;
int main() {
const int INF = 1 << 29;
for (int n; scanf("%d", &n), n;) {
vector<pair<int, int>> v(n + 1);
vector<vector<int>> m(n + 1);
for (int i = 0; i <= n; i++) {
if (i)
s... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;
int main() {
const int INF = 1 << 29;
for (int n; scanf("%d", &n), n;) {
vector<pair<int, int>> v(n + 1);
vector<vector<int>> m(n + 1);
for (int i = 0; i <= n; i++) {
if (i)
s... | [["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 106]] | 1 | 479 | 2 |
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1 << 30
#define pb push_back
#define mp make_pair
using namespace ... | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1 << 30
#define pb push_back
#define mp make_pair
using namespace ... | [["+", 51, 16, 31, 16, 31, 16, 12, 23, 0, 24], ["+", 31, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 16, 31, 16, 12, 23, 0, 16, 12, 13], ["+", 51, 16, 31, 16, 31, 16, 12, 23, 0, 25]] | 1 | 454 | 4 |
#include "bits/stdc++.h"
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define RREP(i, n) for (ll i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < n; ++i)
#define RFOR(i, m, n) for (ll i = n - 1; i >= m; --i)
#define ALL(v) (v).begin(), (v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(uniqu... | #include "bits/stdc++.h"
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define RREP(i, n) for (ll i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < n; ++i)
#define RFOR(i, m, n) for (ll i = n - 1; i >= m; --i)
#define ALL(v) (v).begin(), (v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(uniqu... | [["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]] | 1 | 705 | 4 |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
// dp[i][j] := i??????????¢¨????????§?????????,
// j????¢¨???????????£???????????¨?????????????????¢
int dp[50][5];
void solve(const int n, const vector<int> &p, const vector<int> &t) {
for (int i = 0; i < 50; ++i)
for (int j = 0; j < 5; ++j)
... | /*
* 1645025T ????±± ??????
*/
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
// dp[i][j] := i??????????¢¨????????§?????????,
// j????¢¨???????????£???????????¨?????????????????¢
int dp[50][5];
void solve(const int n, const vector<int> &p, const vector<int> &t) {
for (int i = 0; i < 50; ++i)... | [["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 13]] | 1 | 599 | 2 |
#include <algorithm>
#include <cstdio>
void chmin(int &a, int b) { a = std::min(a, b); }
int p[50], t[50];
int dp[50][5];
const int INF = 1 << 30;
int main() {
int N;
while (1) {
scanf("%d", &N);
if (N == 0)
return 0;
for (int i = 0; i < N; i++) {
scanf("%d%d", &p[i + 1], &t[i + 1]);
... | #include <algorithm>
#include <cstdio>
void chmin(int &a, int b) { a = std::min(a, b); }
int p[50], t[50];
int dp[50][5];
const int INF = 1 << 30;
int main() {
int N;
while (1) {
scanf("%d", &N);
if (N == 0)
return 0;
for (int i = 0; i < N; i++) {
scanf("%d%d", &p[i + 1], &t[i + 1]);
... | [["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 25]] | 1 | 442 | 6 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
while (cin >> n, n) {
vector<int> p(n), t(n);
for (int i = 0; i < n; ++i) {
cin >> p[i] >> t[i];
}
int INF = 1000000000;
vector<vector<int>> dp(n, vector<int>(4, INF));
if (p[0] > t[0]) ... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
while (cin >> n, n) {
vector<int> p(n), t(n);
for (int i = 0; i < n; ++i) {
cin >> p[i] >> t[i];
}
int INF = 1000000000;
vector<vector<int>> dp(n, vector<int>(4, INF));
if (p[0] > t[0]) ... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]] | 1 | 448 | 4 |
#include "bits/stdc++.h"
using namespace std;
const int INF = numeric_limits<int>::max() / 2;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
while (cin >> n, n) {
vector<int> p(n + 1, 0), t(n + 1, 0);
vector<vector<int>> dp(n + 1, vector<int>(5, INF));
dp[0][0] = 0;
bool flag =... | #include "bits/stdc++.h"
using namespace std;
const int INF = numeric_limits<int>::max() / 2;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
while (cin >> n, n) {
vector<int> p(n + 1, 0), t(n + 1, 0);
// dp[i][j]:= i番目の風船をj個積載した状態で取得する時の最小移動距離
vector<vector<int>> dp(n + 1, vector<i... | [["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22]] | 1 | 469 | 6 |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef pair<int, int> pi;
#define MK make_pair
#define F first
#define S second
int dp[100][4];
pi s... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef pair<int, int> pi;
#define MK make_pair
#define F first
#define S second
int dp[100][4];
pi s... | [["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 842 | 2 |
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
struct state {
int d, n, k;
state(int a, int b, int c) : d(a), n(b), k(c) {}
bool operator<(const state &s) const { return d > s.d; }
};
int main() {
int N;
while (cin >> N && N != 0) {
vector<pair<int, int>... | #include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
struct state {
int d, n, k;
state(int a, int b, int c) : d(a), n(b), k(c) {}
bool operator<(const state &s) const { return d > s.d; }
};
int main() {
int N;
while (cin >> N && N != 0) {
vector<pair<int, int>... | [["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6]] | 1 | 560 | 2 |
#include <cstdlib>
#include <iostream>
#include <queue>
using namespace std;
class State {
public:
int n, k, d;
State(int n, int k, int d) : n(n), k(k), d(d) {}
bool operator<(const State &s) const {
if (n != s.n)
return n > s.n;
return d > s.d;
}
};
int N, p[41], t[41];
pair<bool, int> solve(... | #include <cstdlib>
#include <iostream>
#include <queue>
using namespace std;
class State {
public:
int n, k, d;
State(int n, int k, int d) : n(n), k(k), d(d) {}
bool operator<(const State &s) const {
if (n != s.n)
return n > s.n;
return d > s.d;
}
};
int N, p[41], t[41];
pair<bool, int> solve(... | [["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]] | 1 | 552 | 2 |
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#inc... | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#inc... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 564 | 2 |
#include <algorithm>
#include <cmath>
#include <iostream>
#define INF 1000000
using namespace std;
int main(void) {
int n;
int ptime, ctimes;
int pdis, cdis;
while (cin >> n, n) {
int dp[41][3];
for (int i = 0; i < 41; i++)
for (int j = 0; j < 3; j++)
dp[i][j] = INF;
dp[0][0] = 0;
... | #include <algorithm>
#include <cmath>
#include <iostream>
#define INF 1000000
using namespace std;
int main(void) {
int n;
int ptime, ctimes;
int pdis, cdis;
while (cin >> n, n) {
int dp[41][3];
for (int i = 0; i < 41; i++)
for (int j = 0; j < 3; j++)
dp[i][j] = INF;
dp[0][0] = 0;
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 429 | 2 |
loop do
n = gets.to_i
break if n == 0
bs = n.times.map{gets.split.map(&:to_i)}
bs.push([0,50000])
dp = Array.new(n+1).map{Array.new(4, Float::INFINITY)}
if bs[0][1] < bs[0][0]
puts "NG 1"
next
end
pos = bs[0][0]
time = bs[0][1]
dp[0][0] = pos
bl = false
1.... | loop do
n = gets.to_i
break if n == 0
bs = n.times.map{gets.split.map(&:to_i)}
bs.push([0,50000])
dp = Array.new(n+1).map{Array.new(4, Float::INFINITY)}
if bs[0][1] < bs[0][0]
puts "NG 1"
next
end
pos = bs[0][0]
time = bs[0][1]
dp[0][0] = pos
bl = true
1.u... | [["-", 0, 652, 196, 737, 8, 736, 0, 662, 12, 147], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 12, 146], ["-", 8, 736, 0, 121, 15, 738, 12, 738, 12, 612], ["+", 8, 736, 0, 121, 15, 738, 12, 738, 12, 612]] | 4 | 398 | 4 |
#include <bits/stdc++.h>
using namespace std;
typedef double dbl;
#define double long double
typedef complex<double> P;
typedef vector<P> G;
#define REP(i, n) for (int i = 0; i < n; i++)
map<int, int> cur;
int count(int x) {
auto it = cur.find(x);
if (it == cur.end())
return 0;
else
return it->second;
}... | #include <bits/stdc++.h>
using namespace std;
typedef double dbl;
#define double long double
typedef complex<double> P;
typedef vector<P> G;
#define REP(i, n) for (int i = 0; i < n; i++)
map<int, int> cur;
int count(int x) {
auto it = cur.find(x);
if (it == cur.end())
return 0;
else
return it->second;
}... | [["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 845 | 2 |
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
double width(int *x, int *y, int size, double given_x) {
double max_point = -1000.0, min_point = 1000.0;
for (int i = 0; i < size; i++) {
double x1 = x[i], y1 = y[i], x2 = x[(i + 1) % size], y2 = y[(i + 1) % siz... | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
double width(int *x, int *y, int size, double given_x) {
double max_point = -1000.0, min_point = 1000.0;
for (int i = 0; i < size; i++) {
double x1 = x[i], y1 = y[i], x2 = x[(i + 1) % size], y2 = y[(i + 1) % siz... | [["-", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 119, 120], ["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25], ["+", 0, 7, 15, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 7, 15, 16, 12, 16, 31, 16, 17, 72], ["+", 0, ... | 1 | 612 | 10 |
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define FOR(k, m, n) for (ll(k) = (m); (k) < (n); (k)++)
#define REP(i, n) FOR((i), 0, (n))
#define WAITING(str) \... | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define FOR(k, m, n) for (ll(k) = (m); (k) < (n); (k)++)
#define REP(i, n) FOR((i), 0, (n))
#define WAITING(str) \... | [["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 106]] | 1 | 548 | 2 |
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <st... | #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <st... | [["-", 12, 16, 12, 69, 341, 342, 0, 69, 28, 22], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["-", 12, 69, 341, 342, 0, 69, 341, 342, 0, 73], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22]] | 1 | 539 | 5 |
#include <cstring>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int N;
bool endow[1000];
int tm[1000], tt[1000];
pair<int, int> separete(string s) {
stringstream ss(s);
int a, b;
char c;
ss >> a >> c >> b;
return make_pair(a, b);
}
int transMin(string s) {
pair<int, int... | #include <cstring>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int N;
bool endow[1000];
int tm[1000], tt[1000];
pair<int, int> separete(string s) {
stringstream ss(s);
int a, b;
char c;
ss >> a >> c >> b;
return make_pair(a, b);
}
int transMin(string s) {
pair<int, int... | [["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 12, 2, 3, 4, 0, 69, 341, 342, 0, 22]] | 1 | 359 | 2 |
while True:
n = int(input())
if n == 0: break
exist = set([])
enter = [0]*1000
bless = [0]*1000
for loop in range(n):
md,hm,io,p = input().split()
h,m = list(map(int,hm.split(":")))
t = 60*h+m
p = int(p)
if io == "I":
time[p] = t
ex... | while True:
n = int(input())
if n == 0: break
exist = set([])
enter = [0]*1000
bless = [0]*1000
for loop in range(n):
md,hm,io,p = input().split()
h,m = list(map(int,hm.split(":")))
t = 60*h+m
p = int(p)
if io == "I":
enter[p] = t
e... | [["-", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22]] | 5 | 181 | 2 |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.NoSuchElementException;
public class Main {
int H, W;
int[] DX = {0, 0, 1, 1, 1, -1, -1, -1};
int[] DY = {1, -1, 0, 1, -1, 0, 1, -1};
boolean[][] used;
char[][] spells;
HashMap<St... | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.NoSuchElementException;
public class Main {
int H, W;
int[] DX = {0, 0, 1, 1, 1, -1, -1, -1};
int[] DY = {1, -1, 0, 1, -1, 0, 1, -1};
boolean[][] used;
char[][] spells;
HashMap<St... | [["-", 75, 57, 15, 15, 0, 16, 12, 16, 17, 60], ["+", 75, 57, 15, 15, 0, 16, 12, 16, 17, 20]] | 3 | 859 | 2 |
import java.util.*;
class Main {
int h, w;
int[] dx = {0, 0, 1, -1, 1, 1, -1, -1};
int[] dy = {1, -1, 0, 0, 1, -1, 1, -1};
char[][] donut;
String cutS;
@SuppressWarnings("unchecked")
void solve() {
Scanner sc = new Scanner(System.in);
while (true) {
h = sc.nextInt();
w = sc.nextInt... | import java.util.*;
class Main {
int h, w;
int[] dx = {0, 0, 1, -1, 1, 1, -1, -1};
int[] dy = {1, -1, 0, 0, 1, -1, 1, -1};
char[][] donut;
String cutS;
@SuppressWarnings("unchecked")
void solve() {
Scanner sc = new Scanner(System.in);
while (true) {
h = sc.nextInt();
w = sc.nextInt... | [["-", 0, 7, 502, 503, 49, 200, 51, 16, 17, 33], ["-", 0, 7, 502, 503, 49, 200, 51, 16, 12, 499]] | 3 | 666 | 2 |
#include <iostream>
#include <set>
#include <string>
using namespace std;
string mp[11];
int w, h;
set<string> cnt;
string ans;
void check(int x, int y) {
string str;
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++) {
if (i == 0 && j == 0)
continue;
str = mp[y][x];
int nx = ... | #include <iostream>
#include <set>
#include <string>
using namespace std;
string mp[11];
int w, h;
set<string> cnt;
string ans;
void check(int x, int y) {
string str;
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++) {
if (i == 0 && j == 0)
continue;
str = mp[y][x];
int nx = ... | [["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 344 | 6 |
#include <bits/stdc++.h>
using namespace std;
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp ... | #include <bits/stdc++.h>
using namespace std;
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp ... | [["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 62]] | 1 | 479 | 2 |
#include <bits/stdc++.h>
#define FOR(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
const int mod = 2;
const int eps = 0;
struct Mod {
int n;
Mod() : n(0) { ; }
Mod(int m) : n(m) {
if (n >= mod)
n %= mod;
else if (n... | #include <bits/stdc++.h>
#define FOR(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
const int mod = 2;
const int eps = 0;
struct Mod {
int n;
Mod() : n(0) { ; }
Mod(int m) : n(m) {
if (n >= mod)
n %= mod;
else if (n... | [["-", 0, 1, 0, 16, 31, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 965 | 4 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 2; // assert mod is prime
template <int M> struct Mint {
int x;
Mint() : x(0) {}
Mint(int y) : x(y >= 0 ? y % M : M - (-y) % M) {}
Mint &operator+=(const Mint &rhs) {
if ((x += rhs.x) >= M)
x -= M;
return *this;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 2; // assert mod is prime
template <int M> struct Mint {
int x;
Mint() : x(0) {}
Mint(int y) : x(y >= 0 ? y % M : M - (-y) % M) {}
Mint &operator+=(const Mint &rhs) {
if ((x += rhs.x) >= M)
x -= M;
return *this;
... | [["-", 28, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["+", 28, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["-", 31, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 12, 22]] | 1 | 1,303 | 6 |
#include <cmath>
#include <iostream>
#define eps 1e-9
using namespace std;
int m, n, d, N;
int mat[650][650];
void swapRow(int x, int y) {
int t;
for (int i = 0; i < N + 1; i++) {
t = mat[x][i];
mat[x][i] = mat[y][i];
mat[y][i] = t;
}
}
int main(void) {
while (1) {
cin >> m >> n >> d;
if... | #include <cmath>
#include <iostream>
#define eps 1e-9
using namespace std;
int m, n, d, N;
int mat[650][650];
void swapRow(int x, int y) {
int t;
for (int i = 0; i < N + 1; i++) {
t = mat[x][i];
mat[x][i] = mat[y][i];
mat[y][i] = t;
}
}
int main(void) {
while (1) {
cin >> m >> n >> d;
if... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 580 | 2 |
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
// BEGIN CUT HERE
const Int MAX = 2002;
using BS = bitset<MAX * 2>;
using mat = vector<BS>;
void gauss(mat &v) {
int n = v.size();
for (Int i = 0; i < n; i++) {
for (Int k = i; k < n; k++) {
if (v[k][i]) {
swap(v[i], v[k]);
... | #include <bits/stdc++.h>
using namespace std;
using Int = long long;
// BEGIN CUT HERE
const Int MAX = 2002;
using BS = bitset<MAX * 2>;
using mat = vector<BS>;
void gauss(mat &v) {
int n = v.size();
for (Int i = 0; i < n; i++) {
for (Int k = i; k < n; k++) {
if (v[k][i]) {
swap(v[i], v[k]);
... | [["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 48], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 22], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 12, 22]] | 1 | 1,687 | 4 |
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#incl... | #include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#incl... | [["-", 51, 34, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 15, 339, 51, 34, 31, 16, 31, 16, 17, 152], ["+", 15, 339, 51, 34, 31, 16, 31, 16, 17, 152], ["+", 15, 339, 51, 34, 31, 16, 31, 16, 12, 22]] | 1 | 794 | 4 |
// 59
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
int main() {
for (int m, n, d; cin >> m >> n >> d, m | n | d;) {
vector<vector<int>> v(m * n, vector<int>(m * n + 1));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
for (int k... | // 59
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
int main() {
for (int m, n, d; cin >> m >> n >> d, m | n | d;) {
vector<vector<int>> v(m * n, vector<int>(m * n + 1));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
for (int k... | [["-", 28, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["+", 28, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["-", 31, 69, 341, 342, 0, 16, 31, 16, 12, 22], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 12, 22]] | 1 | 401 | 6 |
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <set>
#include <unordered_set>
using namespace std;
typedef pair<int, int> pii;
/// pair<int,int> hasher
namespace std {
template <typename I> class hash<pair<I, I>> {
public:
size_t operator()(const pair<I, I> &p) const {
return has... | #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <set>
#include <unordered_set>
using namespace std;
typedef pair<int, int> pii;
/// pair<int,int> hasher
namespace std {
template <typename I> class hash<pair<I, I>> {
public:
size_t operator()(const pair<I, I> &p) const {
return has... | [["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]] | 1 | 861 | 4 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, bg, ed) for (int i = bg; i < ed; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define fi first
#define se second
#define pb push_back
typedef long long LL;
const LL INF = 1e10;
template <typename T> bool chmin(T &l, T r) {
b... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, bg, ed) for (int i = bg; i < ed; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define fi first
#define se second
#define pb push_back
typedef long long LL;
const LL INF = 1e10;
template <typename T> bool chmin(T &l, T r) {
b... | [["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 539 | 4 |
#include <bits/stdc++.h>
#define GET_MACRO(_1, _2, _3, _4, _5, NAME, ...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__, pr5, pr4, pr3, pr2, pr1)(__VA_ARGS__)
#define pr1(a) (#a) << "=" << (a)
#define pr2(a, b) pr1(a) << ", " << pr1(b)
#define pr3(a, b, c) pr2(a, b) << ", " << pr1(c)
#define pr4(a, b, c, d) pr3(a, b, c) <... | #include <bits/stdc++.h>
#define GET_MACRO(_1, _2, _3, _4, _5, NAME, ...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__, pr5, pr4, pr3, pr2, pr1)(__VA_ARGS__)
#define pr1(a) (#a) << "=" << (a)
#define pr2(a, b) pr1(a) << ", " << pr1(b)
#define pr3(a, b, c) pr2(a, b) << ", " << pr1(c)
#define pr4(a, b, c, d) pr3(a, b, c) <... | [["-", 8, 9, 0, 57, 64, 37, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 64, 37, 0, 16, 17, 60]] | 1 | 1,087 | 2 |
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int N, S, W, Q;
int a[100000];
void solve() {
unsigned int res = 0;
map<int, int> M;
M.clear();
int g = S;
for (int i = 0; i < N; i++) {
a[i] = (g / 7) % 10;
if (g % 2 == 0) {
g = (g / 2);
} else {
g = (g /... | #include <iostream>
#include <map>
#include <vector>
using namespace std;
int N, S, W, Q;
int a[100000];
void solve() {
unsigned int res = 0;
map<int, int> M;
M.clear();
int g = S;
for (int i = 0; i < N; i++) {
a[i] = (g / 7) % 10;
if (g % 2 == 0) {
g = (g / 2);
} else {
g = (g /... | [["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]] | 1 | 344 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)
template <class T1, class T2> void chmin(T1 &a, T2 b) {
... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)
template <class T1, class T2> void chmin(T1 &a, T2 b) {
... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 639 | 2 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#inclu... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#inclu... | [["+", 51, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 51, 4, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 835 | 2 |
#include <algorithm>
#include <iostream>
#include <queue>
#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)
const int N = 1000;
const int M = 100;
char m[N][N + 20];
char in[M][M + 20];
char *ptr[N];
int atm[N][N + 20];
void decode(int c, string &in... | #include <algorithm>
#include <iostream>
#include <queue>
#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)
const int N = 1000;
const int M = 100;
char m[N][N + 20];
char in[M][M + 20];
char *ptr[N];
int atm[N][N + 20];
void decode(int c, string &in... | [["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]] | 1 | 1,784 | 2 |
#include <bits/stdc++.h>
using namespace std;
int m, n;
const double EPS = 1e-11;
double width(vector<pair<int, int>> polygon, double x) {
vector<double> w;
for (int i = 0; i < polygon.size(); i++) {
pair<int, int> p = polygon[i];
pair<int, int> q = polygon[(i + 1) % polygon.size()];
if (abs(p.first -... | #include <bits/stdc++.h>
using namespace std;
int m, n;
const double EPS = 1e-11;
double width(vector<pair<int, int>> polygon, double x) {
vector<double> w;
for (int i = 0; i < polygon.size(); i++) {
pair<int, int> p = polygon[i];
pair<int, int> q = polygon[(i + 1) % polygon.size()];
if (abs(p.first -... | [["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0... | 1 | 703 | 12 |
// Enjoy your stay.
#include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it, X) for (auto it = (X).begin(); it != (X).end(); it++)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m,... | // Enjoy your stay.
#include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it, X) for (auto it = (X).begin(); it != (X).end(); it++)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m,... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 1,709 | 4 |
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static int[] sq = new int[20001];
public static void main(String[] args) {
for (int i = 1; i * i < 20000; ++i) {
sq[i * i] = i;
}
int N = sc.nextInt();
for (int i = 0; i < N; ++i) {
int m = sc.n... | import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static int[] sq = new int[20001];
public static void main(String[] args) {
for (int i = 1; i * i < 20000; ++i) {
sq[i * i] = i;
}
int N = sc.nextInt();
for (int i = 0; i < N; ++i) {
int m = sc.n... | [["-", 8, 196, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 8, 196, 0, 7, 15, 16, 31, 16, 12, 499]] | 3 | 273 | 2 |
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
int n;
cin >> n;
REP(i, n) {
int a, b;
cin >> a >> b;
complex<int> z(a, b);
int norm = a * a + b ... | #include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
int n;
cin >> n;
REP(i, n) {
int a, b;
cin >> a >> b;
complex<int> z(a, b);
int norm = a * a + b ... | [["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]] | 1 | 237 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define for_(i, a, b) for (int i = a; i < b; ++i)
#define allof(a) a.begin(), a.end()
#define minit(a, b) memset(a, b, sizeof(b))
int T;
int m, n;
void solve() {
int s = m * m + n * n;
int range = (int)ceil(sqrt(s));
int cnt = 0;
for_(i, -range, range + 1) for_(... | #include <bits/stdc++.h>
using namespace std;
#define for_(i, a, b) for (int i = a; i < b; ++i)
#define allof(a) a.begin(), a.end()
#define minit(a, b) memset(a, b, sizeof(b))
int T;
int m, n;
void solve() {
int s = m * m + n * n;
int range = ceil(sqrt(s));
int cnt = 0;
for_(i, -range, range + 1) for_(j, -r... | [["-", 8, 9, 0, 43, 49, 50, 51, 74, 0, 24], ["-", 0, 43, 49, 50, 51, 74, 39, 77, 39, 40], ["-", 8, 9, 0, 43, 49, 50, 51, 74, 0, 25], ["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6]] | 1 | 215 | 5 |
#include <iostream>
using namespace std;
int x[1 << 23], p, q, n, i, j;
main() {
for (i = 0; i < 1000; i++) {
for (j = 0; j < 1000; j++) {
x[i * i + j * j]++;
}
}
cin >> n;
for (i = 0; i < n; i++) {
cin >> p >> q;
int r = p * p + q * q, s = 0;
for (j = 1; j <= r; j++) {
if (r % j... | #include <iostream>
using namespace std;
int x[1 << 23], p, q, n, i, j;
main() {
for (i = 0; i < 1000; i++) {
for (j = 0; j < 1000; j++) {
x[i * i + j * j]++;
}
}
cin >> n;
for (i = 0; i < n; i++) {
cin >> p >> q;
int r = p * p + q * q, s = 0;
for (j = 1; j <= r; j++) {
if (r % j... | [["-", 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], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 12, 22... | 1 | 177 | 8 |
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1 << 30
#define pb push_back
#define mp make_pair
using namespace ... | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1 << 30
#define pb push_back
#define mp make_pair
using namespace ... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 31, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]] | 1 | 323 | 6 |
#define ll long long
#include <bits/stdc++.h>
#define mp(a, b) make_pair(a, b)
using namespace std;
ll p, q, tt;
ll gcd(ll a, ll b) { return a == 0 ? b : gcd(b % a, a); }
set<pair<ll, ll>> ss;
bool isValid(ll k) {
for (ll m = 1; m * m < k; m++) {
ll n = sqrt(k - m * m);
pair<ll, ll> pp = mp(m, n);
if (n *... | #define ll long long
#include <bits/stdc++.h>
#define mp(a, b) make_pair(a, b)
using namespace std;
ll p, q, tt;
ll gcd(ll a, ll b) { return a == 0 ? b : gcd(b % a, a); }
set<pair<ll, ll>> ss;
bool isValid(ll k) {
for (ll m = 0; m * m < k; m++) {
ll n = sqrt(k - m * m);
pair<ll, ll> pp = mp(m, n);
if (n *... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 684 | 2 |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(n) rep(i, n)
#define all(n) n.begin(), n.end()
#define foreach(it, c) ... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(n) rep(i, n)
#define all(n) n.begin(), n.end()
#define foreach(it, c) ... | [["-", 12, 23, 0, 16, 12, 16, 12, 91, 17, 33]] | 1 | 297 | 1 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
int t;
cin >> t;
while (t--) {
int p, q;
cin >> p >> q;
int tmp = p * p + q * q, cnt = 0;
for (int n = 0; n * n <= tmp; n++) {
for (int m = 0; m * m <= tmp; m++) {
if (m * m + n * n ... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
int t;
cin >> t;
while (t--) {
int p, q;
cin >> p >> q;
int tmp = p * p + q * q, cnt = 0;
for (int n = 0; n * n <= tmp; n++) {
for (int m = 0; m * m <= tmp; m++) {
if (m * m + n * n ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 184 | 2 |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, m;
string s;
int main() {
while (cin >> n >> m, n) {
vector<int> a(n + m), b(n + m), c(n + m), d(n + m);
int da = 0, db = 0, dc = 0;
for (int i = 0; i < n; i++) {
cin >> s;
a[i] = da, b[i] ... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, m;
string s;
int main() {
while (cin >> n >> m, n) {
vector<int> a(n + m), b(n + m), c(n + m), d(n + m);
int da = 0, db = 0, dc = 0;
for (int i = 0; i < n; i++) {
cin >> s;
a[i] = da, b[i] ... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 666 | 6 |
import itertools
while True:
n, k, s = map(int, input().split())
if n + k + s == 0:
break
a = itertools.combinations(range(n + 1), k)
ans = 0
for e in a:
if sum(e) != s:
continue
ans += 1
print(ans) | import itertools
while True:
n, k, s = map(int, input().split())
if n + k + s == 0:
break
a = itertools.combinations(range(1, n + 1), k)
ans = 0
for e in a:
if sum(e) != s:
continue
ans += 1
print(ans) | [["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21]] | 5 | 72 | 2 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
while (true) {
long long int n, l;
cin >> n >> l;
if (n == 0)
break;
vector<pair<long long int, long long int>> v;
for (long long int i = 0; i < n; i++) {
char c;
long long int in;
cin >> c >> in;... | #include <iostream>
#include <vector>
using namespace std;
int main() {
while (true) {
long long int n, l;
cin >> n >> l;
if (n == 0)
break;
vector<pair<long long int, long long int>> v;
for (long long int i = 0; i < n; i++) {
char c;
long long int in;
cin >> c >> in;... | [["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 375 | 4 |
#include <bits/stdc++.h>
using namespace std;
char T;
int l, a, b, x[999], d[999], M, N, y[999], z[999], i, j;
main() {
while (1) {
M = 0;
memset(y, 0, 999);
cin >> b >> l;
if (!l) {
break;
}
for (i = 1; i <= b; i++) {
cin >> T >> x[i];
if (T == 'L') {
d[i] = 0;
... | #include <bits/stdc++.h>
using namespace std;
char T;
int l, a, b, x[999], d[999], M, N, y[999], z[999], i, j;
main() {
while (1) {
M = 0;
memset(y, 0, 999);
cin >> b >> l;
if (!l) {
break;
}
for (i = 1; i <= b; i++) {
cin >> T >> x[i];
if (T == 'L') {
d[i] = 0;
... | [["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 380 | 2 |
while True:
n,l = list(map(int,input().split()))
if n == 0: break
tunnel = [[] for i in range(l-1)]
for i in range(1,n+1):
d,p = input().split()
tunnel[int(p)-1].append(i if d == "R" else -i)
t = num = 0
while sum(sum(unit) for unit in tunnel) != 0:
for i in range(l-... | while True:
n,l = list(map(int,input().split()))
if n == 0: break
tunnel = [[] for i in range(l-1)]
for i in range(1,n+1):
d,p = input().split()
tunnel[int(p)-1].append(i if d == "R" else -i)
t = num = 0
while sum(len(unit) for unit in tunnel) != 0:
for i in range(l-... | [["-", 15, 666, 0, 652, 3, 668, 8, 652, 63, 22], ["+", 15, 666, 0, 652, 3, 668, 8, 652, 63, 22]] | 5 | 270 | 2 |
while True:
n,l = list(map(int,input().split()))
if n == 0: break
R = [0]*(l-1)
L = [0]*(l-1)
for i in range(1,n+1):
d,p = input().split()
p = int(p)-1
if d == "R": R[p] = i
else: L[p] = i
t = num = 0
while sum(R)+sum(L) != 0:
if R[-1] > 0: num = ... | while True:
n,l = list(map(int,input().split()))
if n == 0: break
R = [0]*(l-1)
L = [0]*(l-1)
for i in range(1,n+1):
d,p = input().split()
p = int(p)-1
if d == "R": R[p] = i
else: L[p] = i
t = num = 0
while sum(R)+sum(L) != 0:
if R[-1] > 0: num = R[-1]... | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 231 | 4 |
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
int n, xa[52], ya[52], xb[52], yb[52], xc[102], yc[102], xd[52], yd[52], xe[52],
ye[52], f[103][103];
long long d[103][103];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
void rec(int x, int y) {
f[y][x] = true;
for (int i = 0;... | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
int n, xa[52], ya[52], xb[52], yb[52], xc[102], yc[102], xd[52], yd[52], xe[52],
ye[52], f[103][103];
long long d[103][103];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
void rec(int x, int y) {
f[y][x] = true;
for (int i = 0;... | [["+", 0, 7, 15, 16, 12, 16, 31, 16, 31, 13], ["+", 0, 7, 15, 16, 12, 16, 31, 16, 17, 48]] | 1 | 744 | 4 |
#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
vector<int> data;
int parts;
UnionFind(int size) {
data.assign(size, -1);
parts = size;
}
void Union(int x, int y) {
x = Find(x), y = Find(y);
if (x == y)
return;
--parts;
if (data[x] > data[y])
swap(x, y);
... | #include <bits/stdc++.h>
using namespace std;
struct UnionFind {
vector<int> data;
int parts;
UnionFind(int size) {
data.assign(size, -1);
parts = size;
}
void Union(int x, int y) {
x = Find(x), y = Find(y);
if (x == y)
return;
--parts;
if (data[x] > data[y])
swap(x, y);
... | [["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22]] | 1 | 850 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.