buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k | change_count int64 0 100 |
|---|---|---|---|---|---|
import java.io.*;
class Main {
public static void main(String args[]) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String buf;
int count = 1;
try {
while (!(buf = br.readLine()).equals("0")) {
int n = Integer.parseInt(buf);
int scan[][] = new int[... | import java.io.*;
class Main {
public static void main(String args[]) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String buf;
int count = 1;
try {
while (!(buf = br.readLine()).equals("0")) {
int n = Integer.parseInt(buf);
int scan[][] = new int[... | [["-", 0, 52, 8, 196, 0, 503, 49, 200, 51, 146], ["+", 0, 52, 8, 196, 0, 503, 49, 200, 51, 147]] | 3 | 453 | 2 |
import java.util.Scanner;
public class Main {
public static int count = 1;
public static int a1[][] = {{1}};
public static int a2[][] = {{1, 2}, {3, 4}};
public static int a3[][] = {
{1, 2, 6},
{3, 5, 7},
{4, 8, 9},
};
public static int a4[][] = {
{1, 2, 6, 7}, {3, 5, 8, 13}, {4, 9, ... | import java.util.Scanner;
public class Main {
public static int count = 1;
public static int a1[][] = {{1}};
public static int a2[][] = {{1, 2}, {3, 4}};
public static int a3[][] = {
{1, 2, 6},
{3, 5, 7},
{4, 8, 9},
};
public static int a4[][] = {
{1, 2, 6, 7}, {3, 5, 8, 13}, {4, 9, ... | [["-", 0, 124, 49, 200, 51, 518, 0, 518, 0, 499], ["+", 0, 124, 49, 200, 51, 518, 0, 518, 0, 499]] | 3 | 1,570 | 2 |
import java.io.*;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String is;
String ia[];
int cc = 1;
while (true) {
int n = Integer.parseInt(in.readLine());
... | import java.io.*;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String is;
String ia[];
int cc = 1;
while (true) {
int n = Integer.parseInt(in.readLine());
... | [["+", 0, 52, 8, 196, 0, 1, 0, 27, 0, 29], ["+", 0, 52, 8, 196, 0, 1, 0, 27, 0, 22], ["+", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35]] | 3 | 346 | 3 |
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
static int matrix[][];
static int n;
static int i, j, m;
static int c;
public static void main(String args[]) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int c = 0;
try {
while (tru... | import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
static int matrix[][];
static int n;
static int i, j, m;
static int c;
public static void main(String args[]) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
c = 0;
try {
while (true) {... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507]] | 3 | 434 | 1 |
#include <stdio.h>
char map[10][10];
int main() {
int i, j, k, ic = 1, n, nx;
do {
scanf("%d", &n);
if (!n)
break;
for (i = 0, nx = 1; i < n; i++) {
if (i % 2) {
for (j = 0; j < i + 1; j++, nx++) {
map[j][i - j] = nx;
}
} else {
for (j = 0; j < i + 1... | #include <stdio.h>
char map[10][10];
int main() {
int i, j, k, ic = 1, n, nx;
do {
scanf("%d", &n);
if (!n)
break;
for (i = 0, nx = 1; i < n; i++) {
if (i % 2) {
for (j = 0; j < i + 1; j++, nx++) {
map[j][i - j] = nx;
}
} else {
for (j = 0; j < i + 1... | [["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 109], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 342 | 8 |
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0) {
return (b);
} else {
return (gcd(b, a % b));
}
}
int main() {
int a, b;
while (cin >> a >> b) {
if (a < b)
swap(a, b);
cout << gcd(a, b);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0) {
return (b);
} else {
return (gcd(b, a % b));
}
}
int main() {
int a, b;
while (cin >> a >> b) {
if (a < b)
swap(a, b);
cout << gcd(a, b) << endl;
}
return 0;
} | [["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 93 | 2 |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<int> a(2);
while (cin >> a[0] >> a[1]) {
while (1) {
sort(a.begin(), a.end());
if (a[1] % a[0] == 0) {
cout << a[0] << endl;
break;
}
int d = a[1];
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<int> a(2);
while (cin >> a[0] >> a[1]) {
while (1) {
sort(a.begin(), a.end());
if (a[1] % a[0] == 0) {
cout << a[0] << endl;
break;
}
int d = a[0];
... | [["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 13], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 13], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13]] | 1 | 121 | 6 |
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) {
if (a < b)
swap(a, b);
for (int i = a; i > 1; i--) {
if (b % i == 0 && a % i == 0) {
cout << i << endl;
break;
}
}
}
} | #include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) {
if (a < b)
swap(a, b);
for (int i = a; i > 0; i--) {
if (b % i == 0 && a % i == 0) {
cout << i << endl;
break;
}
}
}
} | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 86 | 2 |
#include <iostream>
int eucgcd(int m, int n) {
int p = m % n;
while (p > 0) {
m = n;
n = p;
p = m % n;
}
return n;
}
int main() {
int m, n;
while (std::cin >> m >> n, (m || n)) {
if (m >= n)
std::cout << eucgcd(m, n) << std::endl;
else
std::cout << eucgcd(n, m) << std::e... | #include <iostream>
int eucgcd(int m, int n) {
int p = m % n;
while (p > 0) {
m = n;
n = p;
p = m % n;
}
return n;
}
int main() {
int m, n;
while (std::cin >> m >> n && m && n) {
if (m >= n)
std::cout << eucgcd(m, n) << std::endl;
else
std::cout << eucgcd(n, m) << std::e... | [["-", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["-", 0, 52, 15, 339, 51, 34, 12, 23, 0, 24], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 98], ["-", 15, 339, 51, 34, 12, 23, 0, 16, 17, 106], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["-", 8, 9, 0, 57, 75, 76, 0, 1, 0, 35], ["-",... | 1 | 116 | 8 |
#include <cstdio>
using namespace std;
int main() {
int a, b;
while (scanf("%d %d", &a, &b) != 2) {
while (a != b) {
if (a > b)
a -= b;
else
b -= a;
}
printf("%d\n", a);
}
return 0;
} | #include <cstdio>
using namespace std;
int main() {
int a, b;
while (scanf("%d %d", &a, &b) == 2) {
while (a != b) {
if (a > b)
a -= b;
else
b -= a;
}
printf("%d\n", a);
}
return 0;
} | [["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60]] | 1 | 72 | 2 |
#include <iostream>
using namespace std;
int gcd(int m, int n) {
// 引数に0がある場合は0を返す
if ((0 == m) || (0 == n))
return 0;
// ユークリッドの方法
while (m != n) {
if (m > n)
m = m - n;
else
n = n - m;
}
return m;
};
int main(int argc, const char *argv[]) {
int n, m;
while (cin >> n >> m) {
... | #include <iostream>
using namespace std;
int gcd(int m, int n) {
if ((0 == m) || (0 == n))
return 0;
while (m != n) {
if (m > n)
m = m - n;
else
n = n - m;
}
return m;
};
int main(int argc, const char *argv[]) {
int n, m;
while (cin >> n >> m) {
cout << gcd(m, n) << "\n";
}
... | [["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 44]] | 1 | 110 | 4 |
def gcd(a, b)
gcd(b, a) if b > a
return b if (r = a % b).zero?
gcd(b, r)
end
while str = gets do
a, b = str.chomp.split(" ").to_i
puts gcd(a, b)
end | def gcd(a, b)
gcd(b, a) if b > a
return b if (r = a % b).zero?
gcd(b, r)
end
while str = gets do
a, b = str.chomp.split(" ").map(&:to_i)
puts gcd(a, b)
end | [["-", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22], ["+", 8, 170, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 67], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["+", 8, 170, 0, 662, 12, 652, 3, 4, 0, 25]] | 4 | 65 | 6 |
#include <bits/stdc++.h>
using namespace std;
void sik(int);
int gr[7][7];
int ch[7];
int co[7];
int main() {
while (1) {
//
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 7; j++) {
gr[i][j] = 0;
ch[i] = -1;
co[i] = 0;
}
}
int f = 0;
//
int n;
cin >> ... | #include <bits/stdc++.h>
using namespace std;
void sik(int);
int gr[7][7];
int ch[7];
int co[7];
int main() {
while (1) {
//
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 7; j++) {
gr[i][j] = 0;
ch[i] = -1;
co[i] = 0;
}
}
int f = 0;
//
int n;
cin >> ... | [["-", 0, 57, 64, 9, 0, 57, 64, 93, 0, 94], ["+", 0, 57, 64, 9, 0, 57, 64, 116, 0, 117]] | 1 | 380 | 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... | [["-", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["-", 51, 16, 12, 16, 31, 69, 341, 342, 0, 70], ["-", 51, 16, 12, 16, 31, 69, 341, 342, 0, 73]] | 1 | 499 | 3 |
#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... | [["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]] | 1 | 581 | 2 |
#include <iostream>
using namespace std;
int n, a;
int t[7], u[2];
bool v[7][7];
bool ud[7], vd[7];
void dfs(int pos) {
if (vd[pos] == true)
return;
vd[pos] = true;
for (int i = 0; i < 7; i++) {
if (v[pos][i] == false)
continue;
dfs(i);
}
}
bool check() {
for (int i = 0; i < 7; i++)
v... | #include <iostream>
using namespace std;
int n, a;
int t[7], u[2];
bool v[7][7];
bool ud[7], vd[7];
void dfs(int pos) {
if (vd[pos] == true)
return;
vd[pos] = true;
for (int i = 0; i < 7; i++) {
if (v[pos][i] == false)
continue;
dfs(i);
}
}
bool check() {
for (int i = 0; i < 7; i++)
v... | [["+", 8, 9, 0, 7, 8, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 7, 8, 57, 64, 9, 0, 46]] | 1 | 419 | 4 |
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
class UnionFind {
private:
int n;
vector<int> a;
public:
UnionFind(int n) : n(n), a(n, -1) {}
int find(int x) { return a[x] < 0 ? x : (a[x] = find(a[x])); }
bool equal(int x, int y) { return find(... | #include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
class UnionFind {
private:
int n;
vector<int> a;
public:
UnionFind(int n) : n(n), a(n, -1) {}
int find(int x) { return a[x] < 0 ? x : (a[x] = find(a[x])); }
bool equal(int x, int y) { return find(... | [["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]] | 1 | 382 | 8 |
import java.util.*;
class Main {
public static void main(String args[]) {
Solve s = new Solve();
s.solve();
}
}
class Solve {
Scanner in = new Scanner(System.in);
void solve() {
while (in.hasNext()) {
int n = in.nextInt();
int ans = 0, t = 1;
for (int i = 0; i < n / 2; i++) {
... | import java.util.*;
class Main {
public static void main(String args[]) {
Solve s = new Solve();
s.solve();
}
}
class Solve {
Scanner in = new Scanner(System.in);
void solve() {
while (in.hasNext()) {
int n = in.nextInt();
int ans = 0, t = 1;
for (int i = 0; i < n / 2; i++) {
... | [["-", 0, 7, 8, 196, 0, 1, 0, 11, 17, 107], ["-", 0, 7, 8, 196, 0, 1, 0, 11, 12, 499], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 17, 108], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 12, 499]] | 3 | 137 | 4 |
#include <iostream>
using namespace std;
int n, f[33];
int main() {
f[1] = 1, f[2] = 2, f[3] = 5;
for (int i = 4; i <= 30; i++) {
if (i & 1) {
f[i] = 4;
for (int j = 1; j < i / 2; j++)
f[i] *= 3;
f[i] += f[i - 2];
} else {
f[i] = 1;
for (int j = 1; j < i / 2; i++)
... | #include <iostream>
using namespace std;
int n, f[33];
int main() {
f[1] = 1, f[2] = 2, f[3] = 5;
for (int i = 4; i <= 30; i++) {
if (i & 1) {
f[i] = 4;
for (int j = 1; j < i / 2; j++)
f[i] *= 3;
f[i] += f[i - 2];
} else {
f[i] = 1;
for (int j = 1; j < i / 2; j++)
... | [["-", 75, 76, 0, 9, 0, 7, 26, 27, 28, 22], ["+", 75, 76, 0, 9, 0, 7, 26, 27, 28, 22]] | 1 | 172 | 2 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[40] = {}, p = 1;
for (int i = 1; i < 40; i++) {
if (i >= 2 && i % 2)
p += 2;
a[i] = a[i - 1] + p;
}
int n;
while (cin >> n) {
cout << a[n] << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a[40] = {}, p = 1;
for (int i = 1; i < 40; i++) {
if (i >= 2 && i % 2)
p *= 3;
a[i] = a[i - 1] + p;
}
int n;
while (cin >> n) {
cout << a[n] << endl;
}
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 108], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]] | 1 | 89 | 7 |
#include <iostream>
using namespace std;
int ans[31];
int main(void) {
ans[1] = 1;
ans[2] = 2;
ans[3] = 5;
ans[4] = 8;
for (int i = 5; i <= 30; ++i) {
if (i % 2 == 1) {
ans[i] = 2 * ans[i - 1] + 1;
} else {
ans[i] = ans[i - 1] + (2 * ans[i - 2] + 1);
}
}
while (true) {
int n;
... | #include <iostream>
using namespace std;
int ans[31];
int main(void) {
ans[1] = 1;
ans[2] = 2;
ans[3] = 5;
ans[4] = 8;
for (int i = 5; i <= 30; ++i) {
if (i % 2 == 1) {
ans[i] = 2 * ans[i - 1] + 1;
} else {
ans[i] = ans[i - 1] + ans[i - 2] + 1;
}
}
while (true) {
int n;
cin... | [["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["-", 12, 16, 12, 23, 0, 16, 31, 16, 31, 13], ["-", 12, 16, 12, 23, 0, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]] | 1 | 152 | 4 |
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n) {
if (n > 2) {
if (n % 2)
n = 1 + 2 * (pow(3, (n - 2) / 2) - 1);
else
n = 2 + 3 * (pow(3, (n - 2) / 2) - 1);
}
cout << n << endl;
}
} | #include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n) {
if (n > 2) {
if (n % 2)
n = 1 + 2 * (pow(3, (n - 1) / 2) - 1);
else
n = 2 + 3 * (pow(3, (n - 2) / 2) - 1);
}
cout << n << endl;
}
} | [["-", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13]] | 1 | 92 | 2 |
#include <cmath>
#include <cstdio>
#include <iostream>
#define print(x) printf("%d\n", x)
using namespace std;
int main() {
int n;
while (~scanf("%d", &n)) {
if (n % 2) {
print((int)(1 + 3 * (pow(3, (n - 2) / 2) - 1)));
} else {
print((int)(2 + 3 * (pow(3, (n - 1) / 2) - 1)));
}
}
retu... | #include <cmath>
#include <cstdio>
#include <iostream>
#define print(x) printf("%d\n", x)
using namespace std;
int main() {
int n;
while (~scanf("%d", &n)) {
if (n % 2) {
print((int)(1 + 2 * (pow(3, (n - 1) / 2) - 1)));
} else {
print((int)(2 + 3 * (pow(3, (n - 2) / 2) - 1)));
}
}
retu... | [["-", 0, 74, 51, 23, 0, 16, 12, 16, 31, 13], ["+", 0, 74, 51, 23, 0, 16, 12, 16, 31, 13], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13]] | 1 | 112 | 6 |
#include <cstring>
#include <iostream>
int pow(int x, int y) {
int r = x;
for (int i = 1; i < y; i++)
r *= x;
return r;
}
int main() {
int n;
int dp[31];
memset(dp, 0, sizeof(dp));
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= 30; i++) {
if (i % 2 == 1)
dp[i] = dp[i - 1] + pow(3, (i - ... | #include <cstring>
#include <iostream>
int pow(int x, int y) {
int r = x;
for (int i = 1; i < y; i++)
r *= x;
return r;
}
int main() {
int n;
int dp[31];
memset(dp, 0, sizeof(dp));
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= 30; i++) {
if (i % 2 == 1)
dp[i] = dp[i - 1] + pow(3, (i - ... | [["-", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]] | 1 | 197 | 3 |
#include <iostream>
using namespace std;
typedef long long ll;
const int MAX = 31;
ll dp[MAX];
ll pow(ll A, ll e) {
ll res = 1;
while (e--)
res *= A;
return res;
}
int main() {
ll d = 2;
dp[0] = 0;
dp[1] = 1;
dp[2] = 2;
dp[3] = 8;
dp[4] = 8;
for (int i = 4; i < MAX; i += 2) {
ll add = ... | #include <iostream>
using namespace std;
typedef long long ll;
const int MAX = 31;
ll dp[MAX];
ll pow(ll A, ll e) {
ll res = 1;
while (e--)
res *= A;
return res;
}
int main() {
ll d = 2;
dp[0] = 0;
dp[1] = 1;
dp[2] = 2;
dp[3] = 5;
dp[4] = 8;
for (int i = 4; i < MAX; i += 2) {
ll add = ... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 178 | 2 |
// Aizu 1012: Operations with Finite Sets
// 2017.9.23 bal4u@uu
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 510
int set[5][110], sLen[5];
int uSet[MAX], uLen;
int ans[MAX], aLen;
char buf[MAX], *p;
int cmp(int *a, int *b) { return *a - *b; }
int expr(int *a);
int norm(int *a, int len) {
... | // Aizu 1012: Operations with Finite Sets
// 2017.9.23 bal4u@uu
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 510
int set[5][110], sLen[5];
int uSet[MAX], uLen;
int ans[MAX], aLen;
char buf[MAX], *p;
int cmp(int *a, int *b) { return *a - *b; }
int expr(int *a);
int norm(int *a, int len) {
... | [["-", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["-", 64, 1, 0, 2, 3, 4, 0, 103, 0, 104], ["-", 64, 1, 0, 2, 3, 4, 0, 103, 0, 44], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 1,157 | 8 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using S = set<int>;
S U;
map<char, S> m;
string s;
int N;
int c;
S expr();
S factor();
S num();
void debug(string text) {
// return;
cout << text + " " + s << endl;
for (int i = 0; i < text.size() + 1 + N; i++) {
if (i == text.size() + 1 ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using S = set<int>;
S U;
map<char, S> m;
string s;
int N;
int c;
S expr();
S factor();
S num();
void debug(string text) {
return;
cout << text + " " + s << endl;
for (int i = 0; i < text.size() + 1 + N; i++) {
if (i == text.size() + 1 + c... | [["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]] | 1 | 901 | 2 |
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] arg) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String is;
String[] ia;
while (true) {
ia = in.readLine().split("[ \t]");
int s = Integer.parseInt... | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] arg) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String is;
String[] ia;
while (true) {
ia = in.readLine().split("[ \t]");
int s = Integer.parseInt... | [["-", 0, 7, 502, 503, 49, 200, 51, 16, 31, 22], ["-", 0, 7, 502, 503, 49, 200, 51, 16, 17, 72], ["-", 0, 7, 502, 503, 49, 200, 51, 16, 12, 499], ["+", 64, 196, 0, 7, 502, 503, 49, 200, 51, 499]] | 3 | 629 | 4 |
s, m, k;
main() {
for (; scanf("%d", &m), k-- ? (s += m) : (k = m / 4);
k ?: (s = !printf("%d\n", s)))
;
} | s, k;
main(m) {
for (; scanf("%d", &m), k-- ? s += m, 1 : (k = m / 4);
k ?: (s = !printf("%d\n", s)))
;
} | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 0, 30, 0, 14, 49, 65, 0, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 7, 15, 34, 12, 41, 64, 23, 0, 24], ["-", 0, 7, 15, 34, 12, 41, 64, 23, 0, 25], ["+", 0, 7, 15, 34, 12, 41, 0, 42, 0, 21], ["+", 0, 7, 15, ... | 0 | 61 | 8 |
main(l, h, a) {
for (; scanf("%d", &l) * l; printf("%d", h))
for (h = 0; l > 1; l = l - 4, h += a)
scanf("%d", &a);
} | main(l, h, a) {
for (; scanf("%d", &l) * l; printf("%d\n", h))
for (h = 0; l > 1; l = l - 4, h += a)
scanf("%d", &a);
} | [["+", 0, 7, 26, 2, 3, 4, 0, 5, 0, 44]] | 0 | 65 | 1 |
#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... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 85], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 131 | 3 |
#include <iostream>
int n;
int sum = 0;
int main() {
while (1) {
sum = 0;
int a;
std::cin >> n;
if (n == 0)
break;
for (int i = 0; i < n / 4; ++i) {
std::cin >> a;
sum += a * 4;
}
std::cout << sum << std::endl;
}
return 0;
} | #include <iostream>
int n;
int sum = 0;
int main() {
while (1) {
sum = 0;
int a;
std::cin >> n;
if (n == 0)
break;
for (int i = 0; i < n / 4; ++i) {
std::cin >> a;
sum += a * 4;
}
std::cout << sum / 4 << std::endl;
}
return 0;
} | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 86 | 2 |
#include <iostream>
int main() {
while (1) {
int a = 0, c, n;
std::cin >> n;
if (n == 0)
break;
for (int i = 0; i < n / 4; i++) {
std::cin >> c;
a += c;
}
std::cout << c << std::endl;
}
return 0;
} | #include <iostream>
int main() {
while (1) {
int a = 0, c, n;
std::cin >> n;
if (n == 0)
break;
for (int i = 0; i < n / 4; i++) {
std::cin >> c;
a += c;
}
std::cout << a << std::endl;
}
return 0;
} | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 78 | 2 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
while (cin >> n) {
int sum = 0;
for (int i = 0; i < n / 4; ++i) {
int tmp;
cin >> tmp;
sum += tmp;
}
cout << sum << endl;
}
return 0;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
while (cin >> n, n) {
int sum = 0;
for (int i = 0; i < n / 4; ++i) {
int tmp;
cin >> tmp;
sum += tmp;
}
cout << sum << endl;
}
return 0;
}
| [["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]] | 1 | 68 | 2 |
while gets
n = $_.to_i
break if n==0
a = 0
n.times do
a += gets.to_i
end
p a
end | while gets
n = $_.to_i
break if n==0
a = 0
(n/4).times do
a += gets.to_i
end
p a
end | [["+", 0, 89, 8, 170, 0, 652, 486, 739, 0, 24], ["+", 8, 170, 0, 652, 486, 739, 0, 738, 17, 85], ["+", 8, 170, 0, 652, 486, 739, 0, 738, 12, 612], ["+", 0, 89, 8, 170, 0, 652, 486, 739, 0, 25]] | 4 | 28 | 4 |
class Q1041
def doIt
n = gets.to_i / 4
while n > 1
calc n
n = gets.to_i / 4
end
end
def calc(n)
sum = 0
for i in 1..n
sum += gets.to_i
end
puts sum
end
end
Q1041.new.doIt | class Q1041
def doIt
n = gets.to_i / 4
while n > 0
calc n
n = gets.to_i / 4
end
end
def calc(n)
sum = 0
for i in 1..n
sum += gets.to_i
end
puts sum
end
end
Q1041.new.doIt | [["-", 0, 735, 8, 736, 0, 89, 15, 738, 12, 612], ["+", 0, 735, 8, 736, 0, 89, 15, 738, 12, 612]] | 4 | 55 | 2 |
while True:
n = int(input())
if n == 0: break
print(sum([int(input()) for _ in range(n)])) | while True:
n = int(input())
if n == 0: break
print(sum([int(input()) for _ in range(n//4)])) | [["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 676], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 38 | 2 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
while (sc.hasNext()) {
String s = sc.nextLine();
if (s.equals("END OF INPUT"))
;
String[] str = s.split(" ");
for (String a : str) { ... |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
while (sc.hasNext()) {
String s = sc.nextLine();
if (s.equals("END OF INPUT"))
break;
String[] str = s.split(" ");
for (String a : s... | [["+", 0, 52, 8, 196, 0, 57, 64, 93, 0, 94]] | 3 | 115 | 1 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string S;
while (true) {
S = "";
while (S == "") {
getline(cin, S);
}
if (S == "END OF INPUT") {
break;
}
int count_ = 0;
for (int i = 0; i < S.size(); i++) {
if (S[i] == ' ') {
cout ... | #include <iostream>
#include <string>
using namespace std;
int main() {
string S;
while (true) {
S = "";
while (S == "") {
getline(cin, S);
}
if (S == "END OF INPUT") {
break;
}
int count_ = 0;
for (int i = 0; i < S.size(); i++) {
if (S[i] == ' ') {
cout ... | [["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]] | 1 | 119 | 2 |
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
using namespace std;
int main() {
string a;
while (cin >> a && a != "END OF INPUT") {
string h = "";
string g = "";
a += " ";
for (int i = 0; i < a.length(); i++) {
if (a[i] == ' ') {
g += to_string(h.length());
... | #include <algorithm>
#include <iostream>
#include <set>
#include <string>
using namespace std;
int main() {
string a;
while (getline(cin, a) && a != "END OF INPUT") {
string h = "";
string g = "";
a += " ";
for (int i = 0; i < a.length(); i++) {
if (a[i] == ' ') {
g += to_string(h.leng... | [["+", 0, 52, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 152], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 21], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]] | 1 | 116 | 5 |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
while (getline(cin, s)) {
if (s == "END OF TEXT")
return 0;
int num = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == ' ') {
cout << num;
num = 0;
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
while (getline(cin, s)) {
if (s == "END OF INPUT")
return 0;
int num = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == ' ') {
cout << num;
num = 0;
... | [["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]] | 1 | 118 | 2 |
#include <iostream>
using namespace std;
int main() {
int K;
while (cin >> K) {
if (K == 0) {
break;
} else {
int m;
for (int i = 0; i < K * (K - 1) / 2; ++i) {
int c;
cin >> c;
m += c;
}
int r;
r = m / (K - 1);
cout << r << endl;
}
}
... | #include <iostream>
using namespace std;
int main() {
int K;
while (cin >> K) {
if (K == 0) {
break;
} else {
int m = 0;
for (int i = 0; i < K * (K - 1) / 2; ++i) {
int c;
cin >> c;
m += c;
}
int r;
r = m / (K - 1);
cout << r << endl;
}
... | [["+", 75, 76, 0, 9, 0, 43, 49, 50, 0, 32], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 51, 13]] | 1 | 96 | 2 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
while (1) {
int k, sum;
cin >> k;
int n = k * (k - 1) / 2;
vector<int> c(n);
if (k == 0)
break;
for (int i = 0; i < n; i++) {
cin >> c[i];
sum += c[i];
}
cout << sum / (k - 1) << endl;
}
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
while (1) {
int k, sum = 0;
cin >> k;
int n = k * (k - 1) / 2;
vector<int> c(n);
if (k == 0)
break;
for (int i = 0; i < n; i++) {
cin >> c[i];
sum += c[i];
}
cout << sum / (k - 1) << endl;
}
}... | [["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 101 | 2 |
#include <bits/stdc++.h>
using namespace std;
int K, a, t;
int main() {
while (scanf("%d", &K), K) {
a = 0;
for (int x = 0; x < K * (K - 1) / 2; ++x) {
scanf("%d", &t);
a += t;
}
printf("%d\n", a / (t - 1));
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int K, a, t;
int main() {
while (scanf("%d", &K), K) {
a = 0;
for (int x = 0; x < K * (K - 1) / 2; ++x) {
scanf("%d", &t);
a += t;
}
printf("%d\n", a / (K - 1));
}
return 0;
} | [["-", 3, 4, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 31, 22]] | 1 | 96 | 2 |
#include <iostream>
using namespace std;
int main() {
int k, sum;
while (cin >> k) {
if (k == 0)
break;
sum = 0;
for (int i = 0; i < k * (k - 1) / 2; i++) {
cin >> k;
sum += k;
}
cout << sum / (k - 1) << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int k, n, sum;
while (cin >> k) {
if (k == 0)
break;
sum = 0;
for (int i = 0; i < k * (k - 1) / 2; i++) {
cin >> n;
sum += n;
}
cout << sum / (k - 1) << endl;
}
return 0;
} | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 84 | 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, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25]] | 1 | 122 | 6 |
#include <iostream>
using namespace std;
int main() {
int k;
while (cin >> k) {
if (!k)
return 0;
int sum = 0;
for (int i = 0; i < k * (k - 1) / 2; i++) {
int a;
cin >> a;
sum += k;
}
cout << sum / (k - 1) << endl;
}
} | #include <iostream>
using namespace std;
int main() {
int k;
while (cin >> k) {
if (!k)
return 0;
int sum = 0;
for (int i = 0; i < k * (k - 1) / 2; i++) {
int a;
cin >> a;
sum += a;
}
cout << sum / (k - 1) << endl;
}
} | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 83 | 2 |
#include <iostream>
using namespace std;
int main() {
int n, k, c;
for (;;) {
c = 0;
cin >> n;
if (!n)
break;
for (int i = 0; i < k * (k - 1) / 2; i++)
cin >> k, c += k;
cout << c / (n - 1) << endl;
}
} | #include <iostream>
using namespace std;
int main() {
int n, k, c;
for (;;) {
c = 0;
cin >> n;
if (!n)
break;
for (int i = 0; i < n * (n - 1) / 2; i++)
cin >> k, c += k;
cout << c / (n - 1) << endl;
}
} | [["-", 0, 7, 15, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 7, 15, 16, 12, 16, 31, 16, 31, 22], ["-", 12, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 31, 22]] | 1 | 83 | 4 |
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
while (1) {
int n;
scanf("%d", &n);
if (n == 0) {
break;
}
int cont = 0;
for (int i = 0; i < n - 1; i++) {
for (int j =... | #include <algorithm>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
while (1) {
int n;
scanf("%d", &n);
if (n == 0) {
break;
}
int cont = 0;
for (int i = 0; i < n - 1; i++) {
for (int j =... | [["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 25]] | 1 | 121 | 6 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#def... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#def... | [["-", 31, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 31, 22]] | 1 | 149 | 2 |
loop {
n = gets.to_i
break if n == 0
p gets.map(&:to_i).inject(:+) / (n-1)
} | loop {
n = gets.to_i
break if n == 0
p gets.split.map(&:to_i).inject(:+) / (n-1)
} | [["+", 0, 738, 31, 652, 486, 652, 486, 652, 735, 22], ["+", 3, 4, 0, 738, 31, 652, 486, 652, 17, 131]] | 4 | 32 | 2 |
#include <cmath>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m) {
if (n == 0 && m == 0) {
break;
}
priority_queue<long long int, vector<long long int>, greater<long long int>>
pq;
long lon... | #include <cmath>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m) {
if (n == 0 && m == 0) {
break;
}
priority_queue<long long int, vector<long long int>, greater<long long int>>
pq;
long lon... | [["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 22]] | 1 | 203 | 2 |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
const int MAX = 10000100;
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define all(a) (a).begin... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
const int MAX = 10000100;
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define all(a) (a).begin... | [["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]] | 1 | 228 | 3 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define ll long long
#de... |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define ll long long
#de... | [["-", 0, 11, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13]] | 1 | 233 | 2 |
#include <algorithm>
#include <cstdio>
using namespace std;
int n, m, t[20000];
int main() {
while (scanf("%d%d", &n, &m), (n | m) != 0) {
for (int i = 0; i < n + m; i++) {
scanf("%d", &t[i]);
}
sort(t, t + n + m);
int mx = t[0];
for (int i = 1; i < n + n; i++) {
if (mx < t[i] - t[i ... | #include <algorithm>
#include <cstdio>
using namespace std;
int n, m, t[20000];
int main() {
while (scanf("%d%d", &n, &m), (n | m) != 0) {
for (int i = 0; i < n + m; i++) {
scanf("%d", &t[i]);
}
sort(t, t + n + m);
int mx = t[0];
for (int i = 1; i < n + m; i++) {
if (mx < t[i] - t[i ... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22]] | 1 | 162 | 2 |
#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>
using namespace std;
const string eof = "END OF INPUT";
typedef vec... | #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>
using namespace std;
const string eof = "END OF INPUT";
typedef vec... | [["-", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 205 | 3 |
#include <cmath>
#include <iostream>
#include <string.h>
#include <vector>
using namespace std;
int main() {
char s[1000];
while (true) {
fgets(s, 1000, stdin);
if (s[strlen(s) - 1] == '\n') {
s[strlen(s) - 1] = '\0';
}
if (s[strlen(s) - 1] == '\r') {
s[strlen(s) - 1] = '\0';
}
... | #include <cmath>
#include <iostream>
#include <string.h>
#include <vector>
using namespace std;
int main() {
char s[1000];
while (true) {
fgets(s, 1000, stdin);
if (s[strlen(s) - 1] == '\n') {
s[strlen(s) - 1] = '\0';
}
if (s[strlen(s) - 1] == '\r') {
s[strlen(s) - 1] = '\0';
}
... | [["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]] | 1 | 185 | 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 <string>
#include <utility>
#include <vector>
using nam... | #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 <string>
#include <utility>
#include <vector>
using nam... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 276 | 2 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string str;
while (cin >> str) {
if (str == "END OF INPUT")
break;
int idx = 0;
while (idx < str.size()) {
int cnt = 0;
while (idx < str.size() && str[idx++] != ' ')
cnt++;
cout << cnt;
}
co... | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
while (getline(cin, str)) {
if (str == "END OF INPUT")
break;
int idx = 0;
while (idx < str.size()) {
int cnt = 0;
while (idx < str.size() && str[idx++] != ' ')
cnt++;
cout << cnt;
}... | [["+", 8, 9, 0, 52, 15, 339, 51, 2, 63, 22], ["+", 0, 52, 15, 339, 51, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 152], ["+", 0, 52, 15, 339, 51, 2, 3, 4, 0, 21], ["+", 0, 52, 15, 339, 51, 2, 3, 4, 0, 25]] | 1 | 88 | 5 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string str;
while (getline(cin, str)) {
if (str == "END OF INPUT")
break;
int res = 0;
for (int i = 0; i < str.size(); i++) {
if (str[i] == ' ') {
cout << res << endl;
res = 0;
} else {
r... | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
while (getline(cin, str)) {
if (str == "END OF INPUT")
break;
int res = 0;
for (int i = 0; i < str.size(); i++) {
if (str[i] == ' ') {
cout << res;
res = 0;
} else {
res++;
... | [["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]] | 1 | 101 | 2 |
puts $_.chomp.split.map{ |i| i.length }.join(" ") until gets == "END OF INPUT\n" | puts $_.chomp.split(/ /).map{ |i| i.length }.join("") until gets == "END OF INPUT\n" | [["+", 0, 652, 486, 652, 486, 652, 3, 4, 0, 24], ["+", 486, 652, 486, 652, 3, 4, 0, 575, 0, 85], ["+", 486, 652, 486, 652, 3, 4, 0, 575, 0, 6], ["+", 0, 652, 486, 652, 486, 652, 3, 4, 0, 25], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 4 | 30 | 6 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#define IN... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#define IN... | [["-", 12, 16, 31, 69, 341, 342, 0, 118, 119, 120], ["+", 12, 16, 31, 69, 341, 342, 0, 118, 119, 120], ["-", 0, 27, 28, 69, 341, 342, 0, 118, 119, 120], ["+", 0, 27, 28, 69, 341, 342, 0, 118, 119, 120]] | 1 | 461 | 12 |
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
class teamInfo {
public:
int id;
int u;
int a;
int p;
bool operator<(const teamInfo &ti) const {
if (ti.a < this->a)
return true;
else if (ti.a > this->a)
return false;
else {
if (ti... | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
class teamInfo {
public:
int id;
int u;
int a;
int p;
bool operator<(const teamInfo &ti) const {
if (ti.a < this->a)
return true;
else if (ti.a > this->a)
return false;
else {
if (ti... | [["-", 0, 57, 15, 339, 51, 16, 31, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 16, 31, 118, 119, 120], ["-", 0, 57, 15, 339, 51, 16, 12, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 16, 12, 118, 119, 120]] | 1 | 429 | 4 |
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int a, b, c, d, n, cnt, tmp;
string str;
int id[300], id2[300], ac[300], wa[300], used[1001];
void change(int x) {
tmp = id[x];
id[x] = id[x + 1];
id[x + 1] = tmp;
tmp = id2[x];
id2[x] = id2[x + 1];
id2[x + 1] = tmp;
tmp = ac... | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int a, b, c, d, n, cnt, tmp;
string str;
int id[300], id2[300], ac[300], wa[300], used[1001];
void change(int x) {
tmp = id[x];
id[x] = id[x + 1];
id[x + 1] = tmp;
tmp = id2[x];
id2[x] = id2[x + 1];
id2[x + 1] = tmp;
tmp = ac... | [["-", 31, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["+", 31, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22]] | 1 | 568 | 6 |
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
while (true) {
String word = sc.next();
String query = sc.next();
if (query.equals("X"))
break;
ArrayList<String> elem... | import java.util.ArrayList;
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
while (true) {
String word = sc.next();
String query = sc.next();
if (query.equals("X"))
break;
ArrayList<String> elem... | [["+", 0, 1, 0, 492, 3, 4, 0, 492, 0, 131], ["+", 0, 1, 0, 492, 3, 4, 0, 492, 141, 22], ["+", 0, 492, 3, 4, 0, 492, 3, 4, 0, 24], ["+", 75, 196, 0, 1, 0, 492, 3, 4, 0, 25]] | 3 | 447 | 4 |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string str;
while (1) {
getline(cin, str);
string name = str.substr(0, str.size() - 2);
char type = str[str.size() - 1];
if (type == 'L') {
if (name[0] >= 'a' && name[0] <= 'z') {
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string str;
while (1) {
getline(cin, str);
string name = str.substr(0, str.size() - 2);
char type = str[str.size() - 1];
if (type == 'L') {
if (name[0] >= 'a' && name[0] <= 'z') {
... | [["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]] | 1 | 650 | 3 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int W, Q;
while (cin >> W >> Q, W | Q) {
vector<char> field(W, '#');
int id, w;
for (int p = 0; p < Q; p++) {
char c;
cin >> c;
if (c == 's') {
bool flg;
int id, w;
cin >> id >> w;
for (int ... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int W, Q;
while (cin >> W >> Q, W | Q) {
vector<char> field(W, '#');
int id, w;
for (int p = 0; p < Q; p++) {
char c;
cin >> c;
if (c == 's') {
bool flg = false;
int id, w;
cin >> id >> w;
f... | [["+", 0, 57, 64, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 51, 147]] | 1 | 274 | 2 |
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#inc... | #define _USE_MATH_DEFINES
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#inc... | [["-", 0, 52, 15, 339, 51, 34, 12, 16, 17, 98], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 106], ["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 566 | 4 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define each(it, v) ... | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define each(it, v) ... | [["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 344 | 2 |
#include <cstdio>
#include <iostream>
#include <string>
#define P pair<int, string>
using namespace std;
int main() {
int a, b;
while (cin >> b >> a, a | b) {
int c[100]{};
for (int d = 0; d < a; d++) {
char e;
cin >> e;
if (e == 's') {
int f, g;
cin >> f >> g;
f++... | #include <cstdio>
#include <iostream>
#include <string>
#define P pair<int, string>
using namespace std;
int main() {
int a, b;
while (cin >> b >> a, a | b) {
int c[100]{};
for (int d = 0; d < a; d++) {
char e;
cin >> e;
if (e == 's') {
int f, g;
cin >> f >> g;
f++... | [["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]] | 1 | 245 | 2 |
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
while (true) {
int W, Q;
cin >> W >> Q;
vector<int> ws(W, -1);
map<int, pair<int, int>> m; // id = idx, w
if (W + Q == 0) {
break;
}
for (int i = 0; i < Q; i+... | #include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
while (true) {
int W, Q;
cin >> W >> Q;
vector<int> ws(W, -1);
map<int, pair<int, int>> m; // id = idx, w
if (W + Q == 0) {
break;
}
for (int i = 0; i < Q; i+... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 335 | 2 |
#include <cstdio>
#include <vector>
#define R second.second
#define Z(i, a, b, c) v.insert(v.begin() + i, make_pair(a, make_pair(b, c)))
using namespace std;
main() {
int W, Q, d, w, i;
char s[2];
for (; scanf("%d%d", &W, &Q), W; puts("END")) { // some case Q==0
vector<pair<int, pair<int, int>>> v;
for (Z... | #include <cstdio>
#include <vector>
#define R second.second
#define Z(i, a, b, c) v.insert(v.begin() + i, make_pair(a, make_pair(b, c)))
using namespace std;
main() {
int W, Q, d, w, i;
char s[2];
for (; scanf("%d%d", &W, &Q), W; puts("END")) { // some case Q==0
vector<pair<int, pair<int, int>>> v;
for (Z... | [["-", 0, 7, 10, 34, 12, 2, 3, 4, 0, 13], ["+", 0, 7, 10, 34, 12, 2, 3, 4, 0, 13]] | 1 | 310 | 2 |
char r[99], g[99], d[99];
main() {
int c, i, j, k;
for (; scanf("%s%s%s", r, g, d) > 2; puts("")) {
for (i = j = k = 0, c = g[j++]; i + j < strlen(r) + strlen(g);) {
// if(c==r[i]){
if (c == d[k]) { // push_down
k++;
c = r[i++];
} else { // push_right
putchar(c);
... | char r[99], g[99], d[99];
main() {
int c, i, j, k;
for (; scanf("%s%s%s", r, g, d) > 2; puts("")) {
for (i = j = k = 0, c = g[j++]; i + j <= strlen(r) + strlen(g);) {
// if(c==r[i]){
if (c == d[k]) { // push_down
k++;
c = r[i++];
} else { // push_right
putchar(c);
... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 0 | 138 | 2 |
char r[99], g[99], *G, d[99];
main(c, i, k) {
for (; scanf("%s%s%s", r, g, d) > 1; puts(""))
for (i = k = 0, G = g, c = *G++; *G;)
c == d[k] ? k++, c = r[i++] : (putchar(c), c = *G++);
exit(0);
} | char r[99], g[99], *G, d[99];
main(c, i, k) {
for (; scanf("%s%s%s", r, g, d) > 1; puts(""))
for (i = k = 0, G = g, c = *G++; *(G - 1);)
c == d[k] ? k++, c = r[i++] : (putchar(c), c = *G++);
exit(0);
} | [["+", 0, 7, 8, 7, 15, 66, 28, 23, 0, 24], ["+", 8, 7, 15, 66, 28, 23, 0, 16, 17, 33], ["+", 8, 7, 15, 66, 28, 23, 0, 16, 12, 13], ["+", 0, 7, 8, 7, 15, 66, 28, 23, 0, 25]] | 0 | 112 | 22 |
#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, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 1,384 | 5 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
double eps = 1e-9;
double inf = 1e30;
int N;
int M;
typedef struct tag_Point {
double X;
double Y;
} Point;
Point Add(const Point v, const Point w) {
Point P;
P.X = v.X + w.X;
P.Y = v.Y + w.Y;
return P;
}
Point Times(const double r, const Point v)... | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
double eps = 1e-9;
double inf = 1e30;
int N;
int M;
typedef struct tag_Point {
double X;
double Y;
} Point;
Point Add(const Point v, const Point w) {
Point P;
P.X = v.X + w.X;
P.Y = v.Y + w.Y;
return P;
}
Point Times(const double r, const Point v)... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]] | 0 | 1,322 | 2 |
#include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
double dx[11];
double dy[11];
double dv[11];
int ret[11];
double eps = 1e-7;
double fx[1100];
double fy[1100];
double vx[1100];
double vy[1100];
double tx[11];
double ty[11];
double ABS(double a) { return max(a, -a); }
int main() {
int a, ... | #include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
double dx[11];
double dy[11];
double dv[11];
int ret[11];
double eps = 1e-7;
double fx[1100];
double fy[1100];
double vx[1100];
double vy[1100];
double tx[11];
double ty[11];
double ABS(double a) { return max(a, -a); }
int main() {
int a, ... | [["-", 12, 16, 31, 23, 0, 16, 12, 69, 28, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 69, 28, 22]] | 1 | 792 | 2 |
#include <bits/stdc++.h>
#define double long double
using namespace std;
typedef complex<double> P;
const int INF = 1e9;
double calc_time(P s, P t, P dog, double v) {
dog -= s;
double a = abs(t * t) - v * v;
double b = -2 * (t.real() * dog.real() + t.imag() * dog.imag());
double c = abs(dog * dog);
if (a < ... | #include <bits/stdc++.h>
#define double long double
using namespace std;
typedef complex<double> P;
const int INF = 1e9;
double calc_time(P s, P t, P dog, double v) {
dog -= s;
double a = abs(t * t) - v * v;
double b = -2 * (t.real() * dog.real() + t.imag() * dog.imag());
double c = abs(dog * dog);
if (a < ... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22]] | 1 | 586 | 4 |
#include <stdio.h>
int main(void) {
int i, n, sum, x;
scanf("%d", &n);
while (n != 0) {
for (i = 0; i < n / 4; i++) {
scanf("%d", &x);
sum += x;
}
printf("%d\n", sum);
scanf("%d", &n);
}
return 0;
}
| #include <stdio.h>
int main(void) {
int i, n, sum, x;
scanf("%d", &n);
while (n != 0) {
sum = 0;
for (i = 0; i < n / 4; i++) {
scanf("%d", &x);
sum += x;
}
printf("%d\n", sum);
scanf("%d", &n);
}
return 0;
}
| [["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 0 | 90 | 4 |
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, m;
int tl[22222];
int main(void) {
while (cin >> n >> m && n + m) {
for (int i = 1; i <= n + m; i++)
cin >> tl[i];
sort(tl, tl + n + m + 1);
int res = 0;
for (int i = 1; i <= n + m + 1; i++)
res = max(re... | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int n, m;
int tl[22222];
int main(void) {
while (cin >> n >> m && n + m) {
for (int i = 1; i <= n + m; i++)
cin >> tl[i];
sort(tl, tl + n + m + 1);
int res = 0;
for (int i = 1; i <= n + m; i++)
res = max(res, t... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 126 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int t[20000];
int n, m;
while (1) {
for (int i = 0; i < 2000; i++)
t[i] = 0;
cin >> n >> m;
if (n == 0 && m == 0)
break;
for (int i = 0; i < n + m; i++)
cin >> t[i];
sort(t, t + (n + m));
in... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int t[20000];
int n, m;
while (1) {
for (int i = 0; i < 2000; i++)
t[i] = 0;
cin >> n >> m;
if (n == 0 && m == 0)
break;
for (int i = 0; i < n + m; i++)
cin >> t[i];
sort(t, t + (n + m));
in... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12,... | 1 | 202 | 7 |
get = lambda:list(map(int, input().split()))
while True:
n,m = get()
if n==m==0: break
t = [0]
if n!=0: t += get()
if m!=0: t += get()
t.sort()
print(max(t[i+1]-t[i] for i in range(n+m-1)) if n+m>1 else t[0]) | get = lambda:list(map(int, input().split()))
while True:
n,m = get()
if n==m==0: break
t = [0]
if n!=0: t += get()
if m!=0: t += get()
t.sort()
print(max(t[i+1]-t[i] for i in range(n+m)) if n+m>1 else t[1]) | [["-", 0, 659, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 652, 3, 4, 0, 41, 0, 206, 206, 612], ["+", 0, 652, 3, 4, 0, 41, 0, 206, 206, 612]] | 5 | 106 | 4 |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
while (true) {
var nh = arr.shift();
if (nh == "0 0")
break;
nh = nh.split(" ").map(Number);
var n = nh[0];
var h = nh[1];
var obj = {};
for (var i = 0; i < h; i++) {
var ary = arr.shift().split(" ");... | var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
while (true) {
var nh = arr.shift();
if (nh == "0 0")
break;
nh = nh.split(" ").map(Number);
var n = nh[0];
var h = nh[1];
var obj = {};
for (var i = 0; i < h; i++) {
var ary = arr.shift().split(" ");... | [["-", 64, 556, 0, 7, 10, 198, 0, 200, 51, 555], ["+", 64, 556, 0, 7, 10, 198, 0, 200, 51, 555], ["-", 64, 556, 0, 7, 15, 1, 0, 16, 17, 18], ["+", 64, 556, 0, 7, 15, 1, 0, 16, 17, 19]] | 2 | 311 | 12 |
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define INF 100000000
typedef... | #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define INF 100000000
typedef... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 238 | 4 |
#include <iostream>
#include <set>
#include <string>
#include <tuple>
using namespace std;
int n, q, a, b;
string s;
int main() {
while (cin >> n >> q, n | q) {
set<tuple<int, int, int>> d;
for (int i = 0; i < q; i++) {
cin >> s >> a >> b;
for (int j = 1; j < n; j++) {
if (s == "xy")
... | #include <iostream>
#include <set>
#include <string>
#include <tuple>
using namespace std;
int n, q, a, b;
string s;
int main() {
while (cin >> n >> q, n | q) {
set<tuple<int, int, int>> d;
for (int i = 0; i < q; i++) {
cin >> s >> a >> b;
for (int j = 1; j <= n; j++) {
if (s == "xy")
... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 31, 16, 12, 16, 12, 2, 63, 118, 28, 22], ["+", 31, 16, 12, 16, 12, 2, 63, 118, 28, 22]] | 1 | 179 | 4 |
#include <iostream>
#include <set>
#include <string>
using namespace std;
class Point {
public:
int x, y, z;
Point(int x = 0, int y = 0, int z = 0) : x(x), y(y), z(z) {}
bool operator<(const Point &p) const {
if (z != p.z)
return z < p.z;
if (y != p.y)
return y < p.y;
if (x != p.x)
... | #include <iostream>
#include <set>
#include <string>
using namespace std;
class Point {
public:
int x, y, z;
Point(int x = 0, int y = 0, int z = 0) : x(x), y(y), z(z) {}
bool operator<(const Point &p) const {
if (z != p.z)
return z < p.z;
if (y != p.y)
return y < p.y;
if (x != p.x)
... | [["-", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19]] | 1 | 332 | 12 |
#include <iostream>
#include <set>
#include <string>
using namespace std;
void solve() {
int n, h;
while (cin >> n >> h, n || h) {
set<int> Set;
string str;
int a, b;
for (int i = 0; i < h; ++i) {
cin >> str >> a >> b;
--a;
--b;
int temp;
if (str == "xy") {
te... | #include <iostream>
#include <set>
#include <string>
using namespace std;
void solve() {
int n, h;
while (cin >> n >> h, n || h) {
set<int> Set;
string str;
int a, b;
for (int i = 0; i < h; ++i) {
cin >> str >> a >> b;
--a;
--b;
int temp;
if (str == "xy") {
te... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13]] | 1 | 256 | 6 |
require 'set'
loop do
n,h = gets.split.map(&:to_i)
break if (n|h)==0
set = Set.new
h.times do
s,a,b = gets.split
n.times do |i|
case s
when "xy"
set << a+","+b+","+i.to_s
when "yz"
set << i.to_s+","+a+","+b
when "xz"
set << a+","+i.to_s+","+b
end
... | require 'set'
loop do
n,h = gets.split.map(&:to_i)
break if (n|h)==0
set = Set.new
h.times do
s,a,b = gets.split
1.upto(n) do |i|
case s
when "xy"
set << a+","+b+","+i.to_s
when "yz"
set << i.to_s+","+a+","+b
when "xz"
set << a+","+i.to_s+","+b
end
... | [["-", 0, 652, 196, 737, 8, 736, 0, 652, 486, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 486, 612], ["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["+", 196, 737, 8, 736, 0, 652, 3, 4, 0, 24], ["+", 196, 737, 8, 736, 0, 652, 3, 4, 0, 22], ["+", 196, 737, 8, 736, 0,... | 4 | 130 | 7 |
// Aizu Vol-10 1031: Simple GUI Application
// 2017.8.19 bal4u@uu
#include <ctype.h>
#include <stdio.h>
#include <string.h>
char *gets(char *);
char buf[100], *p;
int getInt(void) {
int n = 0;
while (isspace(*p) || *p == ',')
p++;
while (isdigit(*p))
n = 10 * n + (*p++ - '0');
return n;
}
char tag[10... | // Aizu Vol-10 1031: Simple GUI Application
// 2017.8.19 bal4u@uu
#include <ctype.h>
#include <stdio.h>
#include <string.h>
char *gets(char *);
char buf[100], *p;
int getInt(void) {
int n = 0;
while (isspace(*p) || *p == ',')
p++;
while (isdigit(*p))
n = 10 * n + (*p++ - '0');
return n;
}
char tag[10... | [["-", 15, 23, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 15, 23, 0, 16, 31, 16, 12, 16, 12, 22], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22]] | 0 | 463 | 4 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define ALL(v) (v).begin(), (v).end()
#define REP(i, p, n) for (int ... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define ALL(v) (v).begin(), (v).end()
#define REP(i, p, n) for (int ... | [["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]] | 1 | 642 | 3 |
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool between(int a, int b, int c) { return a <= b && b <= c; }
vector<string> split(const string &s, char c) {
vector<string> v;
size_t prev = 0, cur;
while ((cur = s.find(c, prev)) != string::npos) {
v.push_bac... | #include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool between(int a, int b, int c) { return a <= b && b <= c; }
vector<string> split(const string &s, char c) {
vector<string> v;
size_t prev = 0, cur;
while ((cur = s.find(c, prev)) != string::npos) {
v.push_bac... | [["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 22], ["+", 15, 339, 51, 16, 12, 2, 3, 4, 0, 22]] | 1 | 630 | 2 |
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <s... | #include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <s... | [["-", 31, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 31, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22]] | 1 | 509 | 6 |
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int n, U, tmp, sum;
int c[30], k[30], r[30], low[30];
int ans;
bool f;
int main() {
while (scanf("%d%d", &n, &U), (n || U)) {
for (int i = 0; i < n; i++) {
scanf("%d%d", &c[i], &k[i]);
low[i] = c[i];
... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int n, U, tmp, sum;
int c[30], k[30], r[30], low[30];
int ans;
bool f;
int main() {
while (scanf("%d%d", &n, &U), (n || U)) {
for (int i = 0; i < n; i++) {
scanf("%d%d", &c[i], &k[i]);
low[i] = c[i];
... | [["-", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22]] | 1 | 397 | 2 |
import java.io.*;
public class Main {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true) {
/* input */
String[] line = br.readLine().split(" ");
int w = Integer.parseInt(line[0]), q = Integer.pa... | import java.io.*;
public class Main {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true) {
/* input */
String[] line = br.readLine().split(" ");
int w = Integer.parseInt(line[0]), q = Integer.pa... | [["+", 0, 520, 0, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 27, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 27, 0, 68], ["+", 0, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 520, 0, 196, 0, 57, 64, 196, 0, 46]] | 3 | 460 | 5 |
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define INF 100000000
typedef... | #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define INF 100000000
typedef... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]] | 1 | 390 | 4 |
#include <algorithm>
#include <stdio.h>
using namespace std;
int used[110];
char in[3];
int main() {
int a, b;
while (scanf("%d%d", &a, &b), a) {
for (int i = 0; i < a; i++)
used[i] = -1;
while (b--) {
scanf("%s", in);
if (in[0] == 's') {
int c, d;
scanf("%d%d", &c, &d);
... | #include <algorithm>
#include <stdio.h>
using namespace std;
int used[110];
char in[3];
int main() {
int a, b;
while (scanf("%d%d", &a, &b), a) {
for (int i = 0; i < a; i++)
used[i] = -1;
while (b--) {
scanf("%s", in);
if (in[0] == 's') {
int c, d;
scanf("%d%d", &c, &d);
... | [["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]] | 1 | 275 | 2 |
#include <iostream>
#include <string>
using namespace std;
int main() {
int w, q, wall[100], id, cat;
string op;
cin >> w >> q;
while (w) {
for (int i = 0; i < w; i++) {
wall[i] = -1;
}
for (int i = 0; i < q; i++) {
cin >> op >> id;
if (op == "s") {
cin >> cat;
in... | #include <iostream>
#include <string>
using namespace std;
int main() {
int w, q, wall[100], id, cat;
string op;
cin >> w >> q;
while (w) {
for (int i = 0; i < w; i++) {
wall[i] = -1;
}
for (int i = 0; i < q; i++) {
cin >> op >> id;
if (op == "s") {
cin >> cat;
in... | [["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19]] | 1 | 313 | 2 |
loop do
name,type = gets.split
break if type =='X'
if name.include?('_')
words = name.split('_')
else
name.gsub!(/(.)([A-Z])/,'\1 \2')
words = name.split
end
case type
when 'U'
puts words.map(&:capitalize).join
when 'L'
words.map!(&:capitalize)
words[0].downcase!
puts words.... | loop do
name,type = gets.split
break if type =='X'
if name.include?('_')
words = name.split('_')
else
name.gsub!(/([A-Z])/,' \1')
words = name.split
end
case type
when 'U'
puts words.map(&:capitalize).join
when 'L'
words.map!(&:capitalize)
words[0].downcase!
puts words.join
... | [["-", 75, 95, 0, 652, 3, 4, 0, 575, 0, 6], ["+", 75, 95, 0, 652, 3, 4, 0, 575, 0, 6], ["-", 75, 95, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 75, 95, 0, 652, 3, 4, 0, 557, 0, 6]] | 4 | 113 | 4 |
def main
loop do
str,pattern = gets.chomp.split(' ')
break if pattern.eql?('X')
answers << case pattern
when 'U'
puts conversion_to_upper_camel_case(str)
when 'L'
puts conversion_to_lower_camel_case(str)
when 'D'
puts conversion_to_snake_case(str)
end
end
end
def spli... | def main
loop do
str,pattern = gets.chomp.split(' ')
break if pattern.eql?('X')
case pattern
when 'U'
puts conversion_to_upper_camel_case(str)
when 'L'
puts conversion_to_lower_camel_case(str)
when 'D'
puts conversion_to_snake_case(str)
end
end
end
def split_word str
... | [["-", 0, 652, 196, 737, 8, 736, 0, 738, 31, 22], ["-", 0, 652, 196, 737, 8, 736, 0, 738, 17, 151]] | 4 | 235 | 2 |
while True:
name,type = list(map(str, input().split()))
ans = ""
if (type == 'X'):
break
names = []
if (name.find("_") != -1):
names = name.split("_")
elif (name[0].islower() == True):
tmp = name[0]
for i in range(1, len(name)):
if (name[i].isupper() =... | while True:
name,type = list(map(str, input().split()))
ans = ""
if (type == 'X'):
break
names = []
if (name.find("_") != -1):
names = name.split("_")
elif (name[0].islower() == True):
tmp = name[0]
for i in range(1, len(name)):
if (name[i].isupper() =... | [["-", 64, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["+", 64, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612]] | 5 | 334 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.