problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k | fixed_code stringlengths 12 526k | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M | fixed_submission_id int64 2 1.54M | user_id stringlengths 10 10 | language stringclasses 8
values |
|---|---|---|---|---|---|---|---|
p02280 | #include <algorithm>
#include <iostream>
using namespace std;
struct node {
int parent, left, right;
};
int getroot(node);
const int nil = -1;
int D[30], H[30];
node N[30];
void setdepth(int, int);
int setheight(int);
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
N[i].parent = N[i].left = N[i].... | #include <algorithm>
#include <iostream>
using namespace std;
struct node {
int parent, left, right;
};
int getroot(node);
const int nil = -1;
int D[30], H[30];
node N[30];
void setdepth(int, int);
int setheight(int);
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
N[i].parent = N[i].left = N[i].... | [
"literal.string.change",
"io.output.change"
] | 123,422 | 123,423 | u896418467 | cpp |
p02280 | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define MAX_N 25
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node *N;
int *D;
int *H;
int *B;
int max(int x, int y) {
if (x > y)
return x;
return y;
}
void print(int i) {
int deg = (N[i].left != 0) ... | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define MAX_N 25
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node *N;
int *D;
int *H;
int *B;
int max(int x, int y) {
if (x > y)
return x;
return y;
}
void print(int i) {
int deg = (N[i].left != NIL... | [
"identifier.replace.add",
"literal.replace.remove",
"expression.operation.binary.change"
] | 123,426 | 123,425 | u187878456 | cpp |
p02280 | #include <cstdio>
#include <iostream>
using namespace std;
struct node {
int parent, left, right;
};
int NIL_ALDS17B = -1;
void setDepth(int D[], node T[], int u, int depth) {
if (u == NIL_ALDS17B) {
return;
}
D[u] = depth;
setDepth(D, T, T[u].left, depth + 1);
setDepth(D, T, T[u].right, depth + 1)... | #include <cstdio>
#include <iostream>
using namespace std;
struct node {
int parent, left, right;
};
int NIL_ALDS17B = -1;
void setDepth(int D[], node T[], int u, int depth) {
if (u == NIL_ALDS17B) {
return;
}
D[u] = depth;
setDepth(D, T, T[u].left, depth + 1);
setDepth(D, T, T[u].right, depth + 1)... | [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 123,427 | 123,428 | u574853191 | cpp |
p02280 | #include <bits/stdc++.h>
#define MAX 10000
#define r(i, n) for (int i = 0; i < n; i++)
using namespace std;
struct Node {
int p, l, r;
};
Node T[MAX];
int D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == -1)
return;
D[u] == d;
setDepth(T[u].l, d + 1);
setDepth(T[u].r, d + 1);
}
int setHeight(int u) ... | #include <bits/stdc++.h>
#define MAX 10000
#define r(i, n) for (int i = 0; i < n; i++)
using namespace std;
struct Node {
int p, l, r;
};
Node T[MAX];
int D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == -1)
return;
D[u] = d;
setDepth(T[u].l, d + 1);
setDepth(T[u].r, d + 1);
}
int setHeight(int u) {... | [
"expression.operation.compare.replace.remove",
"assignment.replace.add",
"misc.typo"
] | 123,438 | 123,437 | u962041986 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(
int u,
int d) { // ??±???d?????????u??????????§????????????????????????¨????????±???????¨????????????¢?????´?????????
if (u == NIL)
return;
D[u] = d;
set... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(
int u,
int d) { // ??±???d?????????u??????????§????????????????????????¨????????±???????¨????????????¢?????´?????????
if (u == NIL)
return;
D[u] = d;
set... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,439 | 123,440 | u327125861 | cpp |
p02280 | #include "bits/stdc++.h"
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
i... | #include "bits/stdc++.h"
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
i... | [
"call.arguments.change",
"io.output.change"
] | 123,441 | 123,442 | u944777079 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0;
i... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0;
i... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,443 | 123,444 | u167064764 | cpp |
p02280 | #include <cstdio>
#include <iostream>
using namespace std;
#define MAX 30
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
i... | #include <cstdio>
#include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}... | [
"preprocessor.define.value.change",
"literal.integer.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,449 | 123,450 | u302611454 | cpp |
p02280 | #include <cstdio>
#include <iostream>
using namespace std;
#define MAX 30
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
i... | #include <cstdio>
#include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}... | [
"preprocessor.define.value.change",
"literal.integer.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,452 | 123,450 | u302611454 | cpp |
p02280 | #include <cstdio>
#include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}... | #include <cstdio>
#include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,453 | 123,450 | u302611454 | cpp |
p02280 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define MAX 30
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX]... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define MAX 30
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX]... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,454 | 123,455 | u302611454 | cpp |
p02280 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
enum {
NA = -1, // option is better? C++17
};
struct node {
int id;
int parent;
int right;
int left;
int sibling;
int degree;
int depth;
int height;
string state;
node()
: parent(NA), left(NA... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
enum {
NA = -1, // option is better? C++17
};
struct node {
int id;
int parent;
int right;
int left;
int sibling;
int degree;
int depth;
int height;
string state;
node()
: parent(NA), left(NA... | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 123,456 | 123,457 | u422898789 | cpp |
p02280 | #include "stdio.h"
#include <string>
using namespace std;
#define MAX 25
class Node {
public:
enum TYPE { ROOT, INTERNAL_NODE, LEAF };
Node(int ID, Node *PARENT) {
id = ID;
parent = PARENT;
}
~Node(){};
Node *parent = 0;
Node *sibling = 0;
Node *left = 0;
Node *right = 0;
int id;
int degree... | #include "stdio.h"
#include <string>
using namespace std;
#define MAX 25
class Node {
public:
enum TYPE { ROOT, INTERNAL_NODE, LEAF };
Node(int ID, Node *PARENT) {
id = ID;
parent = PARENT;
}
~Node(){};
Node *parent = 0;
Node *sibling = 0;
Node *left = 0;
Node *right = 0;
int id;
int degree... | [
"variable_declaration.value.change"
] | 123,458 | 123,459 | u050281953 | cpp |
p02280 | #include <iostream>
#include <vector>
using namespace std;
class Node {
public:
int p = -1, s = -1, l, r, d, h;
};
int getDepth(vector<Node> &nodes, Node &cur, int d) {
cur.d = d;
int hl = 0, hr = 0;
if (cur.l != -1)
hl = getDepth(nodes, nodes.at(cur.l), ++d) + 1;
if (cur.r != -1)
hr = getDepth(node... | #include <iostream>
#include <vector>
using namespace std;
class Node {
public:
int p = -1, s = -1, l, r, d, h;
};
int getDepth(vector<Node> &nodes, Node &cur, int d) {
cur.d = d;
int hl = 0, hr = 0;
if (cur.l != -1)
hl = getDepth(nodes, nodes.at(cur.l), d + 1) + 1;
if (cur.r != -1)
hr = getDepth(no... | [
"call.arguments.change",
"assignment.change"
] | 123,468 | 123,469 | u572132117 | cpp |
p02280 | #include <stdio.h>
#define N 25
typedef struct {
int p, l, r, s;
} Node;
int depth(Node *, int, int);
int height(Node *, int, int, int);
int depth(Node *node, int num, int con) {
if (node[num].p == -1)
return con;
con++;
con = depth(node, node[num].p, con);
return con;
}
int height(Node *node, int num... | #include <stdio.h>
#define N 25
typedef struct {
int p, l, r, s;
} Node;
int depth(Node *, int, int);
int height(Node *, int, int, int);
int depth(Node *node, int num, int con) {
if (node[num].p == -1)
return con;
con++;
con = depth(node, node[num].p, con);
return con;
}
int height(Node *node, int num... | [
"call.arguments.change",
"io.output.change"
] | 123,470 | 123,471 | u896148161 | cpp |
p02280 | #include <algorithm>
#include <iostream>
using namespace std;
int n, D[25], H[25];
struct node {
int parent, left, right;
} nodes[25];
int setheight(int r) {
int h1, h2;
h1 = h2 = 0;
if (nodes[r].left != -1)
h1 = setheight(nodes[r].left) + 1;
if (nodes[r].right != -1)
h2 = setheight(nodes[r].right)... | #include <algorithm>
#include <iostream>
using namespace std;
int n, D[25], H[25];
struct node {
int parent, left, right;
} nodes[25];
int setheight(int r) {
int h1, h2;
h1 = h2 = 0;
if (nodes[r].left != -1)
h1 = setheight(nodes[r].left) + 1;
if (nodes[r].right != -1)
h2 = setheight(nodes[r].right)... | [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 123,473 | 123,474 | u381149647 | cpp |
p02280 | #include <iostream>
using namespace std;
#define NIL -1
#define MAX 10000
struct Node {
int parent, left, right;
}; //????????????
Node T[MAX];
int n, D[MAX], H[MAX];
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[u].right != NIL)
h1 = setHeight(T[u].right) + 1;
if (T[u].left != NIL)
h2 = setHeight(T... | #include <iostream>
using namespace std;
#define NIL -1
#define MAX 10000
struct Node {
int parent, left, right;
}; //????????????
Node T[MAX];
int n, D[MAX], H[MAX];
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[u].right != NIL)
h1 = setHeight(T[u].right) + 1;
if (T[u].left != NIL)
h2 = setHeight(T... | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 123,475 | 123,476 | u649417416 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u = NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo",
"control_flow.branch.if.condition.change",
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change"
] | 123,477 | 123,478 | u303240337 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | [
"control_flow.branch.if.condition.change",
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change"
] | 123,479 | 123,478 | u303240337 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | [
"control_flow.branch.if.condition.change"
] | 123,480 | 123,478 | u303240337 | cpp |
p02280 | #include <stdio.h>
#define N 25
#define NILL -1
struct Tree {
int parent, right, left;
};
struct Tree T[N];
int D[N];
int H[N];
int n;
int root;
void setdepth(int u, int p) {
D[u] = p;
if (T[u].left != NILL)
setdepth(T[u].left, p + 1);
if (T[u].right != NILL)
setdepth(T[u].right, p + 1);
}
int Heig... | #include <stdio.h>
#define N 25
#define NILL -1
struct Tree {
int parent, right, left;
};
struct Tree T[N];
int D[N];
int H[N];
int n;
int root;
void setdepth(int u, int p) {
D[u] = p;
if (T[u].left != NILL)
setdepth(T[u].left, p + 1);
if (T[u].right != NILL)
setdepth(T[u].right, p + 1);
}
int Heig... | [
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 123,481 | 123,482 | u407335067 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, H[MAX], D[MAX];
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[u].left != NIL)
h1 = setHeight(T[u].left) + 1;
if (T[u].right != NIL)
h2 = setHeight(T[u].right) + 1;
return H[u] = (h1 >... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, H[MAX], D[MAX];
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[u].left != NIL)
h1 = setHeight(T[u].left) + 1;
if (T[u].right != NIL)
h2 = setHeight(T[u].right) + 1;
return H[u] = (h1 >... | [
"literal.string.change",
"call.arguments.change",
"io.output.change",
"io.output.newline.add"
] | 123,484 | 123,485 | u334460795 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, H[MAX], D[MAX];
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[u].left != NIL)
h1 = setHeight(T[u].left) + 1;
if (T[u].right != NIL)
h2 = setHeight(T[u].right) + 1;
return H[u] = (h1 >... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, H[MAX], D[MAX];
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[u].left != NIL)
h1 = setHeight(T[u].left) + 1;
if (T[u].right != NIL)
h2 = setHeight(T[u].right) + 1;
return H[u] = (h1 >... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,486 | 123,485 | u334460795 | cpp |
p02280 | #include <cstdio>
#define MAX 26
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[u]... | #include <cstdio>
#define MAX 26
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T[u]... | [
"assignment.change"
] | 123,488 | 123,489 | u334460795 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | [
"variable_declaration.remove",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 123,490 | 123,491 | u368364462 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2... | [
"assignment.variable.change",
"identifier.change"
] | 123,498 | 123,499 | u003647700 | cpp |
p02280 | #include <cstdio>
using namespace std;
#define MAX_N 25
#define NIL -1
struct Node {
int parent;
int left;
int right;
int depth;
int height;
int degree;
Node()
: parent(NIL), left(NIL), right(NIL), depth(NIL), height(NIL),
degree(NIL) {}
~Node() {}
};
Node tree[MAX_N];
// (tree index, ... | #include <cstdio>
using namespace std;
#define MAX_N 25
#define NIL -1
struct Node {
int parent;
int left;
int right;
int depth;
int height;
int degree;
Node()
: parent(NIL), left(NIL), right(NIL), depth(NIL), height(NIL),
degree(NIL) {}
~Node() {}
};
Node tree[MAX_N];
// (tree index, ... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,500 | 123,501 | u873323786 | cpp |
p02280 | #include <cstdio>
using namespace std;
#define MAX_N 25
#define NIL -1
struct Node {
int parent;
int left;
int right;
int depth;
int height;
int degree;
Node()
: parent(NIL), left(NIL), right(NIL), depth(NIL), height(NIL),
degree(NIL) {}
~Node() {}
};
Node tree[MAX_N];
// (tree index, ... | #include <cstdio>
using namespace std;
#define MAX_N 25
#define NIL -1
struct Node {
int parent;
int left;
int right;
int depth;
int height;
int degree;
Node()
: parent(NIL), left(NIL), right(NIL), depth(NIL), height(NIL),
degree(NIL) {}
~Node() {}
};
Node tree[MAX_N];
// (tree index, ... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,502 | 123,501 | u873323786 | cpp |
p02280 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, x, n) for (int i = x; i < n; i++)
#define pb push_back
#define int long long
#define MAX 10000
#define NIL -1
using namespace std;
const int INF = 1000000007;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct node {
int... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, x, n) for (int i = x; i < n; i++)
#define pb push_back
#define int long long
#define MAX 10000
#define NIL -1
using namespace std;
const int INF = 1000000007;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct node {
int... | [
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,503 | 123,504 | u280914315 | cpp |
p02280 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, x, n) for (int i = x; i < n; i++)
#define pb push_back
#define int long long
#define MAX 10000
#define NIL -1
using namespace std;
const int INF = 1000000007;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct node {
int... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, x, n) for (int i = x; i < n; i++)
#define pb push_back
#define int long long
#define MAX 10000
#define NIL -1
using namespace std;
const int INF = 1000000007;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct node {
int... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,505 | 123,504 | u280914315 | cpp |
p02280 | ////////////////////////////////////////
// ALDS1_7_B: Binary Trees
//
//??????????????????????????¨
////////////////////////////////////////
#include <algorithm> // next_permutation
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric> //accumulate
#include <qu... | ////////////////////////////////////////
// ALDS1_7_B: Binary Trees
//
//??????????????????????????¨
////////////////////////////////////////
#include <algorithm> // next_permutation
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric> //accumulate
#include <qu... | [
"literal.number.change",
"io.output.change"
] | 123,506 | 123,507 | u713060520 | cpp |
p02280 | #include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int ... | #include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int ... | [
"literal.string.change",
"io.output.change"
] | 123,508 | 123,509 | u001068672 | cpp |
p02280 | #include <cstdio>
#define maxn 10000
#define NIL -1
#include <iostream>
using namespace std;
struct Node {
int parent, left, right;
} T[maxn];
int n, D[maxn], H[maxn];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight... | #include <cstdio>
#define maxn 10000
#define NIL -1
#include <iostream>
using namespace std;
struct Node {
int parent, left, right;
} T[maxn];
int n, D[maxn], H[maxn];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,511 | 123,512 | u581468966 | cpp |
p02280 | #include <stdio.h>
#include <vector>
using namespace std;
struct node {
int l;
int r;
int parent;
int s;
int depth;
int d;
int height;
};
int max(int a, int b) {
if (a > b)
return a;
return b;
}
void build(int now, node tree[]) {
int l = 0, r = 0, d = 0;
if (tree[now].l != -1) {
tree[tree[... | #include <stdio.h>
#include <vector>
using namespace std;
struct node {
int l;
int r;
int parent;
int s;
int depth;
int d;
int height;
};
int max(int a, int b) {
if (a > b)
return a;
return b;
}
void build(int now, node tree[]) {
int l = -1, r = -1, d = 0;
if (tree[now].l != -1) {
tree[tre... | [
"literal.number.change",
"variable_declaration.value.change",
"assignment.change"
] | 123,513 | 123,514 | u048151615 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,515 | 123,516 | u043039307 | cpp |
p02280 | #include <bits/stdc++.h>
using namespace std;
typedef struct {
int parent;
int left, right;
} node;
node tree[30];
int d[30];
int h[30];
int c[30];
int n;
void get_depth(int now, int deep) {
d[now] = deep;
if (tree[now].left != -1)
get_depth(tree[now].left, deep + 1);
if (tree[now].right != -1)
get... | #include <bits/stdc++.h>
using namespace std;
typedef struct {
int parent;
int left, right;
} node;
node tree[30];
int d[30];
int h[30];
int c[30];
int n;
void get_depth(int now, int deep) {
d[now] = deep;
if (tree[now].left != -1)
get_depth(tree[now].left, deep + 1);
if (tree[now].right != -1)
get... | [
"expression.operation.unary.arithmetic.remove",
"control_flow.branch.if.condition.change"
] | 123,517 | 123,518 | u680244081 | cpp |
p02280 | #include <iostream>
using namespace std;
//
const int MAX = 25;
const int NIL = -1;
struct Node {
int parent = NIL;
int left = NIL;
int right = NIL;
};
Node T[MAX];
int D[MAX], H[MAX];
//
void setDepth(int u, int d) {
D[u] = d;
if (T[u].left != NIL)
setDepth(T[u].left, d + 1);
if (T[u].right != NIL... | #include <iostream>
using namespace std;
//
const int MAX = 25;
const int NIL = -1;
struct Node {
int parent = NIL;
int left = NIL;
int right = NIL;
};
Node T[MAX];
int D[MAX], H[MAX];
//
void setDepth(int u, int d) {
D[u] = d;
if (T[u].left != NIL)
setDepth(T[u].left, d + 1);
if (T[u].right != NIL... | [
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 123,534 | 123,535 | u759934006 | cpp |
p02280 | #include <iostream>
#include <stdio.h>
using namespace std;
// node最大量
#define MAX 100005
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
// 配列で保持する
Node gNode[MAX];
int gDepth[MAX], gHeight[MAX];
// 兄弟を返す
int getSibiling(int u) {
// rootの場合
if (gNode[u].parent == NIL)
return NIL;
//... | #include <iostream>
#include <stdio.h>
using namespace std;
// node最大量
#define MAX 100005
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
// 配列で保持する
Node gNode[MAX];
int gDepth[MAX], gHeight[MAX];
// 兄弟を返す
int getSibling(int u) {
// rootの場合
if (gNode[u].parent == NIL)
return NIL;
// ... | [
"identifier.change",
"literal.string.change",
"io.output.change",
"call.function.change"
] | 123,536 | 123,537 | u630911389 | cpp |
p02280 | #include <cstdio>
#define MAX 100000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (... | #include <cstdio>
#define MAX 100000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (... | [
"identifier.change",
"control_flow.branch.if.condition.change",
"assignment.variable.change",
"variable_access.subscript.index.change"
] | 123,538 | 123,539 | u936175119 | cpp |
p02280 | #include <cstdio>
#define MAX 10000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | #include <cstdio>
#define MAX 100000
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (... | [
"preprocessor.define.value.change",
"literal.integer.change",
"identifier.change",
"control_flow.branch.if.condition.change",
"assignment.variable.change",
"variable_access.subscript.index.change"
] | 123,540 | 123,539 | u936175119 | cpp |
p02280 | #include <iostream>
using namespace std;
constexpr int MAX = 10000;
constexpr int NIL = -1;
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeig... | #include <iostream>
using namespace std;
constexpr int MAX = 10000;
constexpr int NIL = -1;
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeig... | [
"literal.string.change",
"io.output.change"
] | 123,541 | 123,542 | u334865030 | cpp |
p02280 | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
static const int MAX = 26;
static const int NIL = -1;
typedef struct Node {
int parent, left, right;
} Node;
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].lef... | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
static const int MAX = 26;
static const int NIL = -1;
typedef struct Node {
int parent, left, right;
} Node;
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].lef... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,546 | 123,547 | u032207327 | cpp |
p02280 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
constexpr int nil = -1;
struct Node {
int id;
int parent{nil};
int left{nil};
int right{nil};
int degree() const { return (left != nil ? 1 : 0) + (right != nil ? 1 : 0); }
std::string type() const {
if (parent == nil)
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
constexpr int nil = -1;
struct Node {
int id;
int parent{nil};
int left{nil};
int right{nil};
int degree() const { return (left != nil ? 1 : 0) + (right != nil ? 1 : 0); }
std::string type() const {
if (parent == nil)
... | [
"literal.string.change",
"io.output.change"
] | 123,548 | 123,549 | u891005456 | cpp |
p02280 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
constexpr int nil = -1;
struct Node {
int id;
int parent{nil};
int left{nil};
int right{nil};
int degree() const { return (left != nil ? 1 : 0) + (right != nil ? 1 : 0); }
std::string type() const {
if (parent == nil)
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
constexpr int nil = -1;
struct Node {
int id;
int parent{nil};
int left{nil};
int right{nil};
int degree() const { return (left != nil ? 1 : 0) + (right != nil ? 1 : 0); }
std::string type() const {
if (parent == nil)
... | [
"literal.string.change",
"io.output.change"
] | 123,550 | 123,549 | u891005456 | cpp |
p02280 | #include <stdio.h>
const static int MAX = 10000;
const static int NIL = -1;
typedef struct {
int parent, left, right;
} Node;
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int... | #include <stdio.h>
const static int MAX = 10000;
const static int NIL = -1;
typedef struct {
int parent, left, right;
} Node;
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,551 | 123,552 | u475480520 | cpp |
p02280 | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
static const string ROOT = "root";
static const string INTERNAL_NODE = "internal node";
static const string LEAF = "leaf";
struct Node {
int id;
int parent;
int depth;
int height;
int left;
... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
static const string ROOT = "root";
static const string INTERNAL_NODE = "internal node";
static const string LEAF = "leaf";
struct Node {
int id;
int parent;
int depth;
int height;
int left;
... | [
"assignment.variable.change",
"variable_access.subscript.index.change",
"call.arguments.change"
] | 123,553 | 123,554 | u677185583 | cpp |
p02280 | #include <algorithm>
#include <iostream>
#define MAX 10000
#define NIL -1
using namespace std;
struct Node {
int partent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int... | #include <algorithm>
#include <iostream>
#define MAX 10000
#define NIL -1
using namespace std;
struct Node {
int partent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int... | [
"literal.string.change",
"io.output.change"
] | 123,555 | 123,556 | u633823896 | cpp |
p02280 | #include <cstdio>
#define NIL -1
struct Node {
int parent, left, right;
};
Node *T;
int *D, *H; // depth, height
void setDepth(int u, int depth) {
D[u] = depth;
if (T[u].left != NIL) {
setDepth(T[u].left, depth + 1);
}
if (T[u].right != NIL) {
setDepth(T[u].right, depth + 1);
}
}
int setHeight(i... | #include <cstdio>
#define NIL -1
struct Node {
int parent, left, right;
};
Node *T;
int *D, *H; // depth, height
void setDepth(int u, int depth) {
D[u] = depth;
if (T[u].left != NIL) {
setDepth(T[u].left, depth + 1);
}
if (T[u].right != NIL) {
setDepth(T[u].right, depth + 1);
}
}
int setHeight(i... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,557 | 123,558 | u775693229 | cpp |
p02280 | #include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL) {
return;
}
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeigh... | #include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node {
int parent;
int left;
int right;
};
Node T[MAX];
int D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL) {
return;
}
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeigh... | [] | 123,561 | 123,562 | u626935725 | cpp |
p02280 | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
map<int, int> mpa, mpb;
#define MAX 10005
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
map<int, int> mpa, mpb;
#define MAX 10005
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX... | [
"expression.operation.compare.replace.remove",
"assignment.replace.add",
"misc.typo",
"assignment.variable.change",
"identifier.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,566 | 123,567 | u721251852 | cpp |
p02280 | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
map<int, int> mpa, mpb;
#define MAX 10005
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
map<int, int> mpa, mpb;
#define MAX 10005
#define NIL -1
struct Node {
int parent, left, right;
};
Node T[MAX... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,569 | 123,567 | u721251852 | cpp |
p02280 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <st... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <st... | [
"assignment.change",
"literal.number.change",
"call.arguments.change"
] | 123,570 | 123,571 | u690299834 | cpp |
p02280 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <st... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <st... | [
"literal.number.change",
"call.arguments.change"
] | 123,572 | 123,571 | u690299834 | cpp |
p02280 | #include <cstdio>
#define NIL -1
#define MAX 10000
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | #include <cstdio>
#define NIL -1
#define MAX 10000
struct Node {
int parent, left, right;
};
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
if (u == NIL)
return;
D[u] = d;
setDepth(T[u].left, d + 1);
setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if (T... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,575 | 123,576 | u815527706 | cpp |
p02280 | /*
AOJ Algorithms and Data Structures I - Tree - Binary Trees
rooted tree と大体同じ。
まずは、木クラスを作っておく。
入力されたnを一周回れば、parentは全部埋まる。
そっからroot見つけて、それ使って再帰で子を辿って行ってdepthを埋めていく。
heightは再帰関数に返り値つけて戻して使う。
nodeは初期値に、?1とか入れて埋めておく。
new: inputのとこで、順番に入れてって、後でソートするのではなく、
最初にIDを添え字にして、目当てのところに入れる。
(
子の数が2以下なので、 子が一つの時もありうる。
left r... | /*
AOJ Algorithms and Data Structures I - Tree - Binary Trees
rooted tree と大体同じ。
まずは、木クラスを作っておく。
入力されたnを一周回れば、parentは全部埋まる。
そっからroot見つけて、それ使って再帰で子を辿って行ってdepthを埋めていく。
heightは再帰関数に返り値つけて戻して使う。
nodeは初期値に、?1とか入れて埋めておく。
new: inputのとこで、順番に入れてって、後でソートするのではなく、
最初にIDを添え字にして、目当てのところに入れる。
(
子の数が2以下なので、 子が一つの時もありうる。
left r... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,581 | 123,582 | u708195431 | cpp |
p02280 | #include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
struct b_tree {
int left;
int right;
int sibling;
int parent;
};
int getDepth(b_tree *array, int index) {
if (index == -1)
return 0;
if (array[index].left == -1 && array[index].right == -1)
return 0;
int r... | #include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
struct b_tree {
int left;
int right;
int sibling;
int parent;
};
int getDepth(b_tree *array, int index) {
if (index == -1)
return 0;
if (array[index].left == -1 && array[index].right == -1)
return 0;
int r... | [
"literal.string.change",
"io.output.change"
] | 123,585 | 123,586 | u333404033 | cpp |
p02283 | #include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <ut... | #include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <ut... | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 123,814 | 123,815 | u638043175 | cpp |
p02283 | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <ve... | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <ve... | [
"identifier.change",
"call.function.change",
"io.output.change"
] | 123,816 | 123,817 | u638043175 | cpp |
p02283 | // C++の難しさ
#include <iostream>
#include <stdio.h>
#define N_MAX 500000
using namespace std;
// thik&solve easy
//オブジェクトは変数でありその変数に記録されたデータそのもののことだ
int n; // num of input
class node { //将来を見据えて動的にしています
public:
int *key;
node *parent;
node *l_chld;
node *r_chld;
node(int n) {
key = new int(n);
parent... | // C++の難しさ
#include <iostream>
#include <stdio.h>
#define N_MAX 500000
using namespace std;
// thik&solve easy
//オブジェクトは変数でありその変数に記録されたデータそのもののことだ
int n; // num of input
class node { //将来を見据えて動的にしています
public:
int *key;
node *parent;
node *l_chld;
node *r_chld;
node(int n) {
key = new int(n);
parent... | [
"identifier.change",
"call.function.change"
] | 123,820 | 123,821 | u401858389 | cpp |
p02283 | #include <iostream>
using namespace std;
struct Node {
int k;
Node *r, *l, *p;
};
Node *T;
Node *NIL;
void insert(int key) {
Node *x = T;
Node *y = NIL;
Node *z;
z = new Node;
z->k = key;
z->l = z->r = NIL;
while (x != NIL) {
y = x;
if (z->k > x->k) {
x = x->r;
} else if (z->k <... | #include <iostream>
using namespace std;
struct Node {
int k;
Node *r, *l, *p;
};
Node *T;
Node *NIL;
void insert(int key) {
Node *x = T;
Node *y = NIL;
Node *z;
z = new Node;
z->k = key;
z->l = z->r = NIL;
while (x != NIL) {
y = x;
if (z->k > x->k) {
x = x->r;
} else if (z->k <... | [
"identifier.change",
"call.function.change",
"io.output.change"
] | 123,822 | 123,823 | u623167544 | cpp |
p02283 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void print_preorder(const vector<pair<int, int>> &nodes,
const vector<int> &node_val, const int r) {
if (r < 0)
return;
cout << ' ' << node_val[r];
print_preorder(nodes, node_val, nodes[r].f... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void print_preorder(const vector<pair<int, int>> &nodes,
const vector<int> &node_val, const int r) {
if (r < 0)
return;
cout << ' ' << node_val[r];
print_preorder(nodes, node_val, nodes[r].f... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 123,824 | 123,825 | u342312206 | cpp |
p02283 | #include <cstdio>
#include <cstdlib>
typedef struct node {
long v;
node *parent;
node *left;
node *right;
} Node;
typedef struct {
Node *root;
} Tree;
Tree T = {NULL};
void insertTree(Node *node) {
Node *y = NULL;
Node *x = T.root;
while (x != NULL) {
y = x;
if (node->v < x->v) {
x = x... | #include <cstdio>
#include <cstdlib>
typedef struct node {
long v;
node *parent;
node *left;
node *right;
} Node;
typedef struct {
Node *root;
} Tree;
Tree T = {NULL};
void insertTree(Node *node) {
Node *y = NULL;
Node *x = T.root;
while (x != NULL) {
y = x;
if (node->v < x->v) {
x = x... | [
"identifier.change",
"call.function.change"
] | 123,826 | 123,827 | u890722286 | cpp |
p02283 | #include <iostream>
#include <string>
using namespace std;
int a;
struct NodeDiv2 {
int key;
NodeDiv2 *parent, *left, *right;
};
NodeDiv2 *root, *NIL;
void preTreeWalkDiv2(NodeDiv2 *u) {
if (u == NIL) {
return;
}
cout << ' ' << u->key;
preTreeWalkDiv2(u->left);
preTreeWalkDiv2(u->right);
}
void i... | /*Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2DDiv2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2iv2Div2Div2Div2
Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2DDiv2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2iv2Div2Div2Div2
Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2Div2DDiv2Div2Div... | [
"identifier.change",
"call.function.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 123,830 | 123,831 | u852311840 | cpp |
p02283 | #include <iostream>
#include <string>
using namespace std;
int a;
struct NodeDiv2 {
int key;
NodeDiv2 *parent, *left, *right;
};
NodeDiv2 *root, *NIL;
void preTreeWalkDiv2(NodeDiv2 *u) {
if (u == NIL) {
return;
}
cout << ' ' << u->key;
preTreeWalkDiv2(u->left);
preTreeWalkDiv2(u->right);
}
void i... | #include <iostream>
#include <string>
using namespace std;
int a;
struct NodeDiv2 {
int key;
NodeDiv2 *parent, *left, *right;
};
NodeDiv2 *root, *NIL;
void preTreeWalkDiv2(NodeDiv2 *u) {
if (u == NIL) {
return;
}
cout << ' ' << u->key;
preTreeWalkDiv2(u->left);
preTreeWalkDiv2(u->right);
}
void inTree... | [
"identifier.change",
"call.function.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 123,830 | 123,834 | u852311840 | cpp |
p02283 | #include <iostream>
using namespace std;
struct Node {
int key;
Node *parent, *left, *right;
};
Node *NIL, *root;
void printPreOrder(Node *u);
void printInOrder(Node *u);
void insertTree(int k);
int main() {
int i, j, n, k;
char com[10];
cin >> n;
for (i = 0; i < n; i++) {
cin >> com;
if (com[0... | #include <iostream>
using namespace std;
struct Node {
int key;
Node *parent, *left, *right;
};
Node *NIL, *root;
void printPreOrder(Node *u);
void printInOrder(Node *u);
void insertTree(int k);
int main() {
int i, j, n, k;
char com[10];
cin >> n;
for (i = 0; i < n; i++) {
cin >> com;
if (com[0... | [
"identifier.change",
"call.function.change",
"io.output.change"
] | 123,835 | 123,836 | u389538742 | cpp |
p02283 | #include <bits/stdc++.h>
#define INF 2000000001
using namespace std;
typedef struct node {
node *p, *l, *r;
int key;
} Node;
typedef Node *Nodepointer;
Nodepointer T;
void insert(int z) {
Nodepointer t = (Node *)malloc(sizeof(Node));
t->l = NULL;
t->r = NULL;
t->key = z;
if (T->key == INF) {
T->ke... | #include <bits/stdc++.h>
#define INF 2000000001
using namespace std;
typedef struct node {
node *p, *l, *r;
int key;
} Node;
typedef Node *Nodepointer;
Nodepointer T;
void insert(int z) {
Nodepointer t = (Node *)malloc(sizeof(Node));
t->l = NULL;
t->r = NULL;
t->key = z;
if (T->key == INF) {
T->ke... | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 123,840 | 123,841 | u084540620 | cpp |
p02283 | #include <iostream>
using namespace std;
struct Node {
int key;
Node *p, *l, *r;
};
Node *nil;
Node *root = nil;
void insert(int k) {
Node *y = nil;
Node *x = root;
Node *z = new Node;
z->key = k;
z->l = nil;
z->r = nil;
while (x != nil) {
y = x;
if (z->key < x->key)
x = x->l;
els... | #include <iostream>
using namespace std;
struct Node {
int key;
Node *p, *l, *r;
};
Node *nil;
Node *root = nil;
void insert(int k) {
Node *y = nil;
Node *x = root;
Node *z = new Node;
z->key = k;
z->l = nil;
z->r = nil;
while (x != nil) {
y = x;
if (z->key < x->key)
x = x->l;
els... | [
"identifier.change",
"call.function.change"
] | 123,845 | 123,846 | u629066397 | cpp |
p02283 | #include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *parent, *left, *right;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z;
z = new Node;
z->key = k;
z->left = NIL;
z->right = NIL;
while (x != NIL) {
y = x;
if (z->key... | #include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *parent, *left, *right;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z;
z = new Node;
z->key = k;
z->left = NIL;
z->right = NIL;
while (x != NIL) {
y = x;
if (z->key... | [] | 123,850 | 123,851 | u699373030 | cpp |
p02283 | #include <stdio.h>
#include <stdlib.h>
struct node {
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node *Node;
#define NIL NULL
Node root;
Node treeMinimum(Node x) { return NIL; }
Node treeMaximum(Node x) { return NIL; }
Node treeSearch(Node u, int k) { return NIL; ... | #include <stdio.h>
#include <stdlib.h>
struct node {
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node *Node;
#define NIL NULL
Node root;
Node treeMinimum(Node x) { return NIL; }
Node treeMaximum(Node x) { return NIL; }
Node treeSearch(Node u, int k) { return NIL; ... | [
"literal.string.change",
"literal.string.case.change",
"control_flow.branch.if.condition.change"
] | 123,852 | 123,853 | u922538592 | cpp |
p02283 | #include "bits/stdc++.h"
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL; // x??????
Node *x = root; // T??????
Node *z;
z = (Node *)malloc(sizeof(Node));
z->key = k;
z->left = NIL;
z->right = NIL;
while (x != NIL) {... | #include "bits/stdc++.h"
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL; // x??????
Node *x = root; // T??????
Node *z;
z = (Node *)malloc(sizeof(Node));
z->key = k;
z->left = NIL;
z->right = NIL;
while (x != NIL) {... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 123,854 | 123,855 | u944777079 | cpp |
p02282 | #include <iostream>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
void to_post(int *A, int *B, int *C, int h) {
int x = A[0];
C[h - 1] = x;
if (h < 2)
return;
int m = 0;
while (B[m] != x)
m++;
if (m > 0)
to_post(A + 1, B, C, m);
if (h - m - 1 > 0)
to_post(A + m + 1, B + m + ... | #include <iostream>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
void to_post(int *A, int *B, int *C, int h) {
int x = A[0];
C[h - 1] = x;
if (h < 2)
return;
int m = 0;
while (B[m] != x)
m++;
if (m > 0)
to_post(A + 1, B, C, m);
if (h - m - 1 > 0)
to_post(A + m + 1, B + m + ... | [
"identifier.change",
"variable_access.subscript.index.change",
"call.arguments.change"
] | 124,015 | 124,016 | u986478725 | cpp |
p02282 | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <vector>
using namespace std;
vector<int> pre, in, post;
int pos = 0;
void constructPost(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
con... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <vector>
using namespace std;
vector<int> pre, in, post;
int pos = 0;
void constructPost(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
con... | [
"expression.unary.arithmetic.add"
] | 124,027 | 124,028 | u574853191 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + l, r);
post.pu... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | [
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change",
"expression.operation.binary.change"
] | 124,031 | 124,032 | u167064764 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | [
"identifier.change",
"expression.operation.binary.change"
] | 124,037 | 124,038 | u722526744 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l == r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"identifier.change",
"expression.operation.binary.change"
] | 124,037 | 124,040 | u722526744 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l = r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pus... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l == r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 124,041 | 124,040 | u722526744 | cpp |
p02282 | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
struct node {
int left, right;
} nodes[100];
int n, pre[105], in[105], inloc[105], cnt = 0;
int rec(int s, int e) {
if (s < e) {
int m = inloc[pre[cnt++]];
int l = rec(s, m - 1);
int r = rec(m + 1, e);
nodes[in[m]].l... | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
struct node {
int left, right;
} nodes[100];
int n, pre[105], in[105], inloc[105], cnt = 0;
int rec(int s, int e) {
if (s < e) {
int m = inloc[pre[cnt++]];
int l = rec(s, m - 1);
int r = rec(m + 1, e);
nodes[in[m]].l... | [
"expression.unary.arithmetic.add"
] | 124,046 | 124,047 | u381149647 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int N, pos;
vector<int> pre, in, post;
void rec(int left, int right) {
if (left >= right) {
return;
}
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(left, m);
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int N, pos;
vector<int> pre, in, post;
void rec(int left, int right) {
if (left >= right) {
return;
}
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(left, m);
... | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"variable_declaration.remove"
] | 124,062 | 124,063 | u626935725 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int N, pos;
vector<int> pre, in, post;
void rec(int left, int right) {
if (left >= right) {
return;
}
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(left, m);
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int N, pos;
vector<int> pre, in, post;
void rec(int left, int right) {
if (left >= right) {
return;
}
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(left, m);
... | [
"variable_declaration.remove"
] | 124,064 | 124,063 | u626935725 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(1, m);
rec(m + 1, r);
post.pu... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"literal.number.change"
] | 124,065 | 124,066 | u815527706 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(1, m);
rec(m + 1, r);
post.pu... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change"
] | 124,067 | 124,066 | u815527706 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in_, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in_.begin(), find(in_.begin(), in_.end(), root));
rec(1, m);
rec(m + 1, r);
pos... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | [
"identifier.change",
"call.arguments.change",
"identifier.replace.add",
"literal.replace.remove"
] | 124,068 | 124,066 | u815527706 | cpp |
p02282 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, ino, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(ino.begin(), find(ino.begin(), ino.end(), root));
rec(1, m);
rec(m + 1, r);
pos... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, pos;
vector<int> pre, in, post;
void rec(int l, int r) {
if (l >= r)
return;
int root = pre[pos++];
int m = distance(in.begin(), find(in.begin(), in.end(), root));
rec(l, m);
rec(m + 1, r);
post.pu... | [
"identifier.change",
"call.arguments.change",
"identifier.replace.add",
"literal.replace.remove"
] | 124,069 | 124,066 | u815527706 | cpp |
p02283 | #include <cstdint>
#include <iostream>
using namespace std;
template <typename T> class BinTree {
private:
struct Node {
T val;
Node *parent;
Node *left;
Node *right;
};
Node *root;
void inner_print_inorder(Node *x) {
if (x == NULL)
return;
inner_print_inorder(x->left);
co... | #include <cstdint>
#include <iostream>
using namespace std;
template <typename T> class BinTree {
private:
struct Node {
T val;
Node *parent;
Node *left;
Node *right;
};
Node *root;
void inner_print_inorder(Node *x) {
if (x == NULL)
return;
inner_print_inorder(x->left);
co... | [
"identifier.change",
"call.function.change",
"io.output.change"
] | 124,089 | 124,090 | u828599533 | cpp |
p02283 | #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *left;
Node *right;
Node() { left = right = NULL; }
};
class Tree {
Node *root;
public:
void insert(Node *n) {
Node *y = NULL;
Node *x = root;
while (x != NULL) {
y = x;
if (n... | #include <cstdio>
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *left;
Node *right;
Node() { left = right = NULL; }
};
class Tree {
Node *root = NULL;
public:
void insert(Node *n) {
Node *y = NULL;
Node *x = root;
while (x != NULL) {
y = x;
... | [] | 124,097 | 124,096 | u808404363 | cpp |
p02283 | /*
* Problem Description: Binary Search Tree I
* Category: Binary Search Trees
* Author: Khan
* Date: 21th October, 2017
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *r, *l, *p;
};
Node *root, *NIL;
void Insert(int k) {
No... | /*
* Problem Description: Binary Search Tree I
* Category: Binary Search Trees
* Author: Khan
* Date: 21th October, 2017
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *r, *l, *p;
};
Node *root, *NIL;
void Insert(int k) {
No... | [
"identifier.change",
"call.function.change"
] | 124,098 | 124,099 | u701472721 | cpp |
p02283 | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z;
z = (Node *)malloc(sizeof(Node));
z->key... | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z;
z = (Node *)malloc(sizeof(Node));
z->key... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 124,102 | 124,101 | u043039307 | cpp |
p02283 | #include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z;
z = (Node *)malloc(sizeof(Node));
z->key = k;
z->left = NIL;
z->right = NIL;
while (x... | #include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z;
z = (Node *)malloc(sizeof(Node));
z->key = k;
z->left = NIL;
z->right = NIL;
while (x... | [
"identifier.change",
"call.function.change"
] | 124,118 | 124,119 | u047256438 | cpp |
p02283 | #include <cstdio>
#include <iostream>
#include <memory>
using namespace std;
struct Node {
int key;
Node *parent;
Node *left;
Node *right;
Node(int key = -1)
: key(key), parent(nullptr), left(nullptr), right(nullptr){};
};
struct Tree {
Node *root;
Tree() : root(nullptr){};
};
static void inse... | #include <cstdio>
#include <iostream>
#include <memory>
using namespace std;
struct Node {
int key;
Node *parent;
Node *left;
Node *right;
Node(int key = -1)
: key(key), parent(nullptr), left(nullptr), right(nullptr){};
};
struct Tree {
Node *root;
Tree() : root(nullptr){};
};
static void inse... | [
"identifier.change",
"call.function.change"
] | 124,122 | 124,123 | u677185583 | cpp |
p02283 | #include <iostream>
#include <stdio.h>
using namespace std;
struct Node {
int key;
Node *parent;
Node *left;
Node *right;
};
struct Node *NIL, *root;
void init() { root = NIL; }
void insert(Node *z) {
struct Node *y = NIL; // xの親
struct Node *x = root;
while (x != NIL) {
y = x;
if (z->key < x... | #include <iostream>
#include <stdio.h>
using namespace std;
struct Node {
int key;
Node *parent;
Node *left;
Node *right;
};
struct Node *NIL, *root;
void init() { root = NIL; }
void insert(Node *z) {
struct Node *y = NIL; // xの親
struct Node *x = root;
while (x != NIL) {
y = x;
if (z->key < x... | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 124,124 | 124,125 | u173597612 | cpp |
p02283 | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL; // yは親、xは現在地のノードを表す
Node *x = root; // rootから探索する
Node *z; // zは挿入したいノード
z = (Node *)malloc... | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL; // yは親、xは現在地のノードを表す
Node *x = root; // rootから探索する
Node *z; // zは挿入したいノード
z = (Node *)malloc... | [
"identifier.change",
"call.function.change"
] | 124,128 | 124,129 | u938236735 | cpp |
p02283 | /*
* ALDS1_8_A.cpp
*
* Created on: May 2, 2018
* Author: 13743
*/
#include <cstdio>
#include <cstdlib>
struct Node {
int key;
Node *pa, *lc, *rc;
};
Node *root = NULL;
void insert(int k) {
Node *y = NULL;
Node *x = root;
Node *z = new Node;
while (x != NULL) {
y = x;
if (k < y->key)
... | /*
* ALDS1_8_A.cpp
*
* Created on: May 2, 2018
* Author: 13743
*/
#include <cstdio>
#include <cstdlib>
struct Node {
int key;
Node *pa, *lc, *rc;
};
Node *root = NULL;
void insert(int k) {
Node *y = NULL;
Node *x = root;
Node *z = new Node;
while (x != NULL) {
y = x;
if (k < y->key)
... | [] | 124,130 | 124,131 | u115352705 | cpp |
p02283 | #include <iostream>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z;
z = (Node *)malloc(sizeof(Node));
z->key = k;
z->left = NIL;
z->right = NIL;
while (x != NIL) {
y = x;
if (z->ke... | #include <iostream>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z;
z = (Node *)malloc(sizeof(Node));
z->key = k;
z->left = NIL;
z->right = NIL;
while (x != NIL) {
y = x;
if (z->ke... | [
"call.remove",
"call.add"
] | 124,133 | 124,134 | u583707373 | cpp |
p02283 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <st... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <st... | [
"identifier.change",
"call.function.change"
] | 124,135 | 124,136 | u690299834 | cpp |
p02283 | #include <bits/stdc++.h>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *NIL;
struct BST {
Node *root;
BST() { root = NIL; }
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z = (Node *)malloc(sizeof(Node));
z->key = k;
z->left = NIL;
z->... | #include <bits/stdc++.h>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
Node *NIL;
struct BST {
Node *root;
BST() { root = NIL; }
void insert(int k) {
Node *y = NIL;
Node *x = root;
Node *z = (Node *)malloc(sizeof(Node));
z->key = k;
z->left = NIL;
z->... | [
"identifier.change",
"call.function.change"
] | 124,137 | 124,138 | u695600391 | cpp |
p02283 | #include <cstdlib>
#include <iostream>
using namespace std;
struct tree {
tree *left;
tree *right;
tree *parent;
int val;
};
void printInorder(tree *root) {
if (root == NULL)
return;
cout << " " << root->val;
printInorder(root->left);
printInorder(root->right);
return;
}
void printPreorder(tree ... | #include <cstdlib>
#include <iostream>
using namespace std;
struct tree {
tree *left;
tree *right;
tree *parent;
int val;
};
void printInorder(tree *root) {
if (root == NULL)
return;
cout << " " << root->val;
printInorder(root->left);
printInorder(root->right);
return;
}
void printPreorder(tree ... | [
"identifier.change",
"call.function.change",
"io.output.change"
] | 124,160 | 124,161 | u333404033 | cpp |
p02282 | #include <iostream>
#include <vector>
#define eol '\n';
using namespace std;
class Node {
public:
int id;
int l;
int r;
int p;
Node() : id(-1), l(-1), r(-1), p(-1){};
};
Node *tree;
int create_tree(int parent, vector<int> pre, vector<int> in) {
if (pre.size() == 0 && in.size() == 0) {
return -1;
}
... | #include <iostream>
#include <vector>
#define eol '\n';
using namespace std;
class Node {
public:
int id;
int l;
int r;
int p;
Node() : id(-1), l(-1), r(-1), p(-1){};
};
Node *tree;
int create_tree(int parent, vector<int> pre, vector<int> in) {
if (pre.size() == 0 && in.size() == 0) {
return -1;
}
... | [
"assignment.change"
] | 124,439 | 124,440 | u813563655 | cpp |
p02282 | #include <iostream>
#include <vector>
using namespace std;
void fnInput(vector<int> &rvnPodr, vector<int> &rvnIodrSeq) {
int nMaxSiz;
cin >> nMaxSiz;
rvnPodr.resize(nMaxSiz);
rvnIodrSeq.resize(nMaxSiz + 1);
for (int i = 0; i < nMaxSiz; i++)
cin >> rvnPodr[i];
int nNode;
for (int i = 1; i < nMaxSiz... | #include <iostream>
#include <vector>
using namespace std;
void fnInput(vector<int> &rvnPodr, vector<int> &rvnIodrSeq) {
int nMaxSiz;
cin >> nMaxSiz;
rvnPodr.resize(nMaxSiz + 1);
rvnIodrSeq.resize(nMaxSiz + 1);
for (int i = 1; i < nMaxSiz + 1; i++)
cin >> rvnPodr[i];
int nNode;
for (int i = 1; i <... | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 124,446 | 124,447 | u050764167 | cpp |
p02284 | #include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define REP(i, N) for (ll i = 0; i < N; ++i)
struct Node {
Node(){};
~Node() {
delete left;
delete right;
};
long long key;
Node *parent;
Node *left;
Node *right;
};
// root node is not nullptr
voi... | #include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define REP(i, N) for (ll i = 0; i < N; ++i)
struct Node {
Node(){};
~Node() {
delete left;
delete right;
};
long long key;
Node *parent;
Node *left;
Node *right;
};
// root node is not nullptr
voi... | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 124,466 | 124,467 | u843674796 | cpp |
p02284 | #include <iostream>
#include <memory>
#include <string>
namespace BinarySearchTree {
using namespace std;
constexpr int nullNum = -1;
class Node {
public:
Node(int k, shared_ptr<Node> p, shared_ptr<Node> l, shared_ptr<Node> r)
: key(k), parent(p), left(l), right(r) {}
Node(int k) : key(k), parent(nullptr),... | #include <iostream>
#include <memory>
#include <string>
namespace BinarySearchTree {
using namespace std;
constexpr int nullNum = -1;
class Node {
public:
Node(int k, shared_ptr<Node> p, shared_ptr<Node> l, shared_ptr<Node> r)
: key(k), parent(p), left(l), right(r) {}
Node(int k) : key(k), parent(nullptr),... | [
"control_flow.return.add",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo",
"literal.number.change",
"assignment.value.change",
"variable_access.subscript.index.c... | 124,472 | 124,473 | u462133671 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.