buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k | change_count int64 0 100 |
|---|---|---|---|---|---|
#include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
struct point {
double x, y;
};
void koch(int n, point a, point b) {
if (n == 0)
return;
point s, t, u;
double th = M_PI * 60.0 / 180.0;
s.x = (2.0 * a.x + b.x) / 3.0;
s.y = (2.0 * a.y + b.y) / 3.0;
t.x = (a.x + 2.0 * b.x)... | #include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
struct point {
double x, y;
};
void koch(int n, point a, point b) {
if (n == 0)
return;
point s, t, u;
double th = M_PI * 60.0 / 180.0;
s.x = (2.0 * a.x + b.x) / 3.0;
s.y = (2.0 * a.y + b.y) / 3.0;
t.x = (a.x + 2.0 * b.x)... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]] | 1 | 384 | 2 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
const int INF = 0x3f3f3f3f;
struct Point {
double x, y;
};
void koch(int d, Point x1, Point x2) {
if (!d)
return;
Point s, u, t;
double th = M_PI * 60.0 / 180.0;
s.x = ... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
const int INF = 0x3f3f3f3f;
// const double M_PI = acos(double(-1));
struct Point {
double x, y;
};
void koch(int d, Point x1, Point x2) {
if (!d)
return;
Point s, u, t;
d... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 395 | 2 |
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
struct point {
float x, y;
};
void kehe(point a, point b, int n) {
if (n == 0) {
if (fabs(a.x - 0.0) < 0.000001)
printf("%.6f %.6f\n", a.x, a.y);
printf("%.6f %.6f\n", b.x, b.y);
} else {
double pi = M_PI / 3.0;
... | #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
struct point {
float x, y;
};
void kehe(point a, point b, int n) {
if (n == 0) {
if (fabs(a.x - 0.0) < 0.000001)
printf("%.6f %.6f\n", a.x, a.y);
printf("%.6f %.6f\n", b.x, b.y);
} else {
double pi = M_PI / 3.0;
... | [["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72]] | 1 | 354 | 2 |
#define _USE_MATH_DEFINES
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
using vec = pair<double, double>;
void koch(int d, vec p1, vec p2) {
if (d == 0)
return;
vec s, u, t;
double rad = M_PI * 60 / 180.;
// cauculate new coordinate
// first : x, second... | #define _USE_MATH_DEFINES
#include <cmath>
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
using vec = pair<double, double>;
void koch(int d, vec p1, vec p2) {
if (d == 0)
return;
vec s, u, t;
double rad = M_PI * 60 / 180.;
// cauculate new coordinate
// first : x, second... | [["-", 31, 16, 31, 23, 0, 16, 12, 118, 28, 22], ["+", 31, 16, 31, 23, 0, 16, 12, 118, 28, 22]] | 1 | 385 | 4 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node {
double x, y;
} Point;
void koch(int, Point, Point);
void koch(int n, Point p1, Point p2) {
if (n == 0)
return;
Point s, t, u;
double th = M_PI * 60 / 180;
s.x = (2 * p1.x + 1 * p2.x) / 3;
s.y = (2 * p2.... | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node {
double x, y;
} Point;
void koch(int, Point, Point);
void koch(int n, Point p1, Point p2) {
if (n == 0)
return;
Point s, t, u;
double th = M_PI * 60 / 180;
s.x = (2 * p1.x + 1 * p2.x) / 3;
s.y = (2 * p1.... | [["-", 31, 23, 0, 16, 31, 16, 12, 118, 28, 22], ["+", 31, 23, 0, 16, 31, 16, 12, 118, 28, 22]] | 1 | 408 | 4 |
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846
struct Point {
double x, y;
};
double kock(int n, Point p1, Point p2) {
if (n == 0)
return 0;
double rad = 60.0 * PI / 180.0;
Point s, t, u;
s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
s.y = (2.0 ... | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846
struct Point {
double x, y;
};
double kock(int n, Point p1, Point p2) {
if (n == 0)
return 0;
double rad = PI * 60.0 / 180.0;
Point s, t, u;
s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
s.y = (2.0... | [["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]] | 1 | 384 | 6 |
#include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
#define FOR(k, m, n) for (int(k) = (m); (k) < (n); (k)++)
#define REP(i, n) FOR((i), 0, (n))
#define LL long long
#define M_PIn 3.141592653589793
struct Point {
double x, y;
};
void koch(int n, Point a, Point b) {
if (n == 0)
ret... | #include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
#define FOR(k, m, n) for (int(k) = (m); (k) < (n); (k)++)
#define REP(i, n) FOR((i), 0, (n))
#define LL long long
#define M_PIn 3.141592653589793
struct Point {
double x, y;
};
void koch(int n, Point a, Point b) {
if (n == 0)
ret... | [["-", 31, 16, 31, 16, 31, 16, 12, 118, 28, 22], ["+", 31, 16, 31, 16, 31, 16, 12, 118, 28, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 28, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 118, 28, 22]] | 1 | 418 | 8 |
///
// File: alds1_5_c.cpp
// Author: ymiyamoto
//
// Created on Mon Oct 9 10:11:20 2017
//
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
#define PI 3.14159265
struct point_t {
double x;
double y;
};
vector<point_t> calc_koch(point_t a, poin... | ///
// File: alds1_5_c.cpp
// Author: ymiyamoto
//
// Created on Mon Oct 9 10:11:20 2017
//
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
#define PI 3.14159265
struct point_t {
double x;
double y;
};
vector<point_t> calc_koch(point_t a, poin... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]] | 1 | 518 | 2 |
#define _USE_MATH_DEFINES // M_PI???????????????
#include <cmath>
#include <iostream>
using namespace std;
struct Point {
double x, y;
};
void makeKoch(int n, Point p1, Point p2) {
if (n <= 0)
return;
Point s, t, u;
s = {p1.x + (p2.x - p1.x) / 3, p2.y + (p2.y - p1.y) / 3};
t = {p1.x + 2 * (p2.x - p1.... | #define _USE_MATH_DEFINES // M_PI???????????????
#include <cmath>
#include <iostream>
using namespace std;
struct Point {
double x, y;
};
void makeKoch(int n, Point p1, Point p2) {
if (n <= 0)
return;
Point s, t, u;
s = {p1.x + (p2.x - p1.x) / 3, p1.y + (p2.y - p1.y) / 3};
t = {p1.x + 2 * (p2.x - p1.... | [["-", 0, 11, 12, 83, 0, 16, 31, 118, 28, 22], ["+", 0, 11, 12, 83, 0, 16, 31, 118, 28, 22]] | 1 | 375 | 4 |
#include <cmath>
#include <iostream>
#include <map>
#include <vector>
#define f first
#define s second
using namespace std;
int main() {
vector<pair<double, double>> p;
int n, i, j;
p.push_back(make_pair(0, 0));
p.push_back(make_pair(100, 0));
cin >> n;
for (i = 0; i < n; i++) {
for (j = 0; p[j].f != ... | #include <cmath>
#include <iostream>
#include <map>
#include <vector>
#define f first
#define s second
using namespace std;
int main() {
vector<pair<double, double>> p;
int n, i, j;
p.push_back(make_pair(0, 0));
p.push_back(make_pair(100, 0));
cin >> n;
for (i = 0; i < n; i++) {
for (j = 0; p[j].f != ... | [["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72]] | 1 | 416 | 2 |
#include <math.h>
#include <stdio.h>
struct point {
double x, y;
};
void koch(int n, struct point a, struct point b) {
if (n == 0)
return;
struct point s, t, u;
double tp = M_PI * 60.0 / 180.0;
s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
t.x = (1.0 * a.x + 2.0 * b.x) /... | #include <math.h>
#include <stdio.h>
struct point {
double x, y;
};
void koch(int n, struct point a, struct point b) {
if (n == 0)
return;
struct point s, t, u;
double deg = M_PI * 60.0 / 180.0;
s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
t.x = (1.0 * a.x + 2.0 * b.x) ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 12, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11... | 1 | 396 | 12 |
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define BIG 1000000000
#define SIZE 40
#define PI 3.14159265359
using namespace std;
struct Point {
d... | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define BIG 1000000000
#define SIZE 40
#define PI 3.14159265359
using namespace std;
struct Point {
d... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]] | 1 | 396 | 2 |
//
// main.cpp
// koch_curve
//
// Created by ???????????? on 2017/10/07.
// Copyright ?? 2017 ????????????. All rights reserved.
//
#include <iostream>
#include <stdio.h>
//#include <cmath>
#include <iomanip>
#include <math.h>
//#define PI 3.14159265
using namespace std;
double param = 60.0 * M_PI / 180.0;
st... | //
// main.cpp
// koch_curve
//
// Created by ???????????? on 2017/10/07.
// Copyright ?? 2017 ????????????. All rights reserved.
//
#include <iostream>
#include <stdio.h>
//#include <cmath>
#include <iomanip>
#include <math.h>
//#define PI 3.14159265
using namespace std;
double param = 60.0 * M_PI / 180.0;
st... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 406 | 2 |
#include <cmath>
#include <cstdio>
using namespace std;
struct Point {
double x;
double y;
};
double sin60 = sqrt(3) / 2;
double cos60 = 1.0 / 2.0;
void kock(int depth, Point p1, Point p2) {
if (depth == 0)
return;
Point s, t, u;
s.x = (p1.x * 2 + p2.x) / 3;
s.y = (p1.y * 2 + p2.y) / 3;
t.x = (p1.... | #include <cmath>
#include <cstdio>
using namespace std;
struct Point {
double x;
double y;
};
double sin60 = sqrt(3.0) / 2.0;
double cos60 = 1.0 / 2.0;
void kock(int depth, Point p1, Point p2) {
if (depth == 0)
return;
Point s, t, u;
s.x = (p1.x * 2 + p2.x) / 3;
s.y = (p1.y * 2 + p2.y) / 3;
t.x = ... | [["-", 49, 50, 51, 16, 31, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 16, 31, 2, 3, 4, 0, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13]] | 1 | 367 | 6 |
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define _USE_MATH_DEFINES
#include <map>
#include <math.h>
#define SENTINEL 1000000001
#define min... | #include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define _USE_MATH_DEFINES
#include <map>
#include <math.h>
#define SENTINEL 1000000001
#define min... | [["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25]] | 1 | 428 | 6 |
#include <cmath>
#include <cstdio>
#include <iostream>
const double PI = acos(-1.0);
struct Point {
double x;
double y;
};
void Koch(int n, Point a, Point b) {
if (n == 0)
return;
Point s, t, u;
double th = PI * 60.0 / 180.0;
s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
s.y = (2.0 * a.y + 1.0 * b.y) / 3.0... | #include <cmath>
#include <cstdio>
#include <iostream>
const double PI = acos(-1.0);
struct Point {
double x;
double y;
};
void Koch(int n, Point a, Point b) {
if (n == 0)
return;
Point s, t, u;
double th = PI * 60.0 / 180.0;
s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
s.y = (2.0 * a.y + 1.0 * b.y) / 3.0... | [["-", 31, 23, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 31, 23, 0, 16, 31, 16, 12, 118, 119, 120]] | 1 | 408 | 2 |
#include <cmath>
#include <cstdio>
#include <iostream>
const double PI = 3.14159265;
struct Point {
double x, y;
};
// 回転行列を掛け合わせる関数
void Rotation(const Point &s, const Point &t, Point &u) {
double params = 60.0;
double rad = params * PI / 180.0;
double cos60 = cos(rad);
double sin60 = sin(rad);
u.x = c... | #include <cmath>
#include <cstdio>
#include <iostream>
const double PI = 3.14159265;
struct Point {
double x, y;
};
// 回転行列を掛け合わせる関数
void Rotation(const Point &s, const Point &t, Point &u) {
double params = 60.0;
double rad = params * PI / 180.0;
double cos60 = cos(rad);
double sin60 = sin(rad);
u.x = c... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33]] | 1 | 439 | 2 |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <queue>
#include <vector>
using namespace std;
double sin60 = sqrt(3.) / 2.;
struct Pt {
double x;
double y;
Pt operator+(const Pt &other) { return {x + other.x, y + other.y}; }
Pt oper... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <queue>
#include <vector>
using namespace std;
double sin60 = sqrt(3.) / 2.;
struct Pt {
double x;
double y;
Pt operator+(const Pt &other) { return {x + other.x, y + other.y}; }
Pt oper... | [["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 346 | 2 |
#include <math.h>
#include <stdio.h>
struct dot {
double x;
double y;
};
void koch(struct dot d1, struct dot d2, int n) {
if (n == 0) {
return;
}
struct dot s;
s.x = d1.x * 2 / 3 + d2.x * 1 / 3;
s.y = d1.y * 2 / 3 + d2.y * 1 / 3;
struct dot t;
t.x = d1.x * 1 / 3 + d2.x * 2 / 3;
t.y = d1.y * ... | #include <math.h>
#include <stdio.h>
struct dot {
double x;
double y;
};
void koch(struct dot d1, struct dot d2, int n) {
if (n == 0) {
return;
}
struct dot s;
s.x = d1.x * 2 / 3 + d2.x * 1 / 3;
s.y = d1.y * 2 / 3 + d2.y * 1 / 3;
struct dot t;
t.x = d1.x * 1 / 3 + d2.x * 2 / 3;
t.y = d1.y * ... | [["-", 31, 16, 12, 16, 31, 16, 31, 118, 28, 22], ["+", 31, 16, 12, 16, 31, 16, 31, 118, 28, 22]] | 1 | 419 | 2 |
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#define pi 3.1415926
using namespace std;
struct point {
double x, y;
};
int n;
double th = pi * 60 / 180;
void koch(int n, point a, point b) {
if (n == 0)
return;
point s, t, u;
s.x = (b.x + 2 * a.x) / 3;
s.y = (b.y + 2 * a.y)... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#define pi 3.1415926
using namespace std;
struct point {
double x, y;
};
int n;
double th = pi * 60 / 180;
void koch(int n, point a, point b) {
if (n == 0)
return;
point s, t, u;
s.x = (b.x + 2 * a.x) / 3;
s.y = (b.y + 2 * a.y)... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 391 | 4 |
#include <iostream>
#include <math.h>
using namespace std;
struct Point {
double x, y;
};
void koch(int n, Point a, Point b) {
if (n == 0) {
return;
}
Point s, t, u;
double th = M_PI * 60 / 180;
s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
t.x = (1.0 * a.x + 2.0 * ... | #include <iostream>
#include <math.h>
using namespace std;
struct Point {
double x, y;
};
void koch(int n, Point a, Point b) {
if (n == 0) {
return;
}
Point s, t, u;
double th = M_PI * 60 / 180;
s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
t.x = (1.0 * a.x + 2.0 * ... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]] | 1 | 389 | 2 |
/*
* ALDS1_5_C.cpp
*
* Created on: Apr 30, 2018
* Author: 13743
*/
#include <cmath>
#include <cstdio>
double SQRT3 = sqrt(3);
struct Point {
double x;
double y;
};
void kochCurve(Point p1, Point p2, int n) {
if (n == 0) {
printf("%f %f\n", p1.x, p1.y);
return;
}
double dx = p2.x - p1.x;... | /*
* ALDS1_5_C.cpp
*
* Created on: Apr 30, 2018
* Author: 13743
*/
#include <cmath>
#include <cstdio>
double SQRT3 = sqrt(3);
struct Point {
double x;
double y;
};
void kochCurve(Point p1, Point p2, int n) {
if (n == 0) {
printf("%f %f\n", p1.x, p1.y);
return;
}
double dx = p2.x - p1.x;... | [["-", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 72]] | 1 | 288 | 2 |
#include <cmath>
#include <cstdio>
#include <utility>
using namespace std;
struct Point {
double x, y;
};
void print(Point p) { printf("%f %f\n", p.x, p.y); }
void koch(int d, Point p1, Point p2) {
if (d == 0) {
return;
}
Point s, t, u;
double th = M_PI * 60.0 / 180.0;
s.x = (2.0 * p1.x + 1.0 * p2.... | #include <cmath>
#include <cstdio>
#include <utility>
using namespace std;
struct Point {
double x, y;
};
void print(Point p) { printf("%f %f\n", p.x, p.y); }
void koch(int d, Point p1, Point p2) {
if (d == 0) {
return;
}
Point s, t, u;
double th = M_PI * 60.0 / 180.0;
s.x = (2.0 * p1.x + 1.0 * p2.... | [["-", 0, 1, 0, 11, 12, 16, 12, 118, 119, 120], ["+", 0, 1, 0, 11, 12, 16, 12, 118, 119, 120]] | 1 | 369 | 2 |
#include <math.h>
#include <stdio.h>
struct Point {
double x, y;
};
void koch(int n, Point a, Point b) {
if (n == 0)
return;
Point a1, b1, ab;
double th = M_PI * 60.0 / 180.0;
a1.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
a1.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
b1.x = (1.0 * a.x + b.x * 2.0) / 3.0;
b1.y =... | #include <math.h>
#include <stdio.h>
struct Point {
double x, y;
};
void koch(int n, Point a, Point b) {
if (n == 0)
return;
Point a1, b1, ab;
double th = M_PI * 60.0 / 180.0;
a1.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
a1.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
b1.x = (1.0 * a.x + b.x * 2.0) / 3.0;
b1.y =... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72]] | 1 | 392 | 2 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI M_PI
struct Point {
double x;
double y;
void prt() { printf("%.8f %.8f\n", x, y); }
};
void koch(int n, Point p1, Point p2) {
if (n == 0)
return;
Point s, t, u;
s.x = (2 * p1.x + p2.x) / 3;
s.y = (2 * p1.y + p2.y) / 3;... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI M_PI
struct Point {
double x;
double y;
void prt() { printf("%.8f %.8f\n", x, y); }
};
void koch(int n, Point p1, Point p2) {
if (n == 0)
return;
Point s, t, u;
s.x = (2 * p1.x + p2.x) / 3;
s.y = (2 * p1.y + p2.y) / 3;... | [["-", 12, 16, 31, 23, 0, 16, 31, 118, 119, 120], ["+", 12, 16, 31, 23, 0, 16, 31, 118, 119, 120]] | 1 | 349 | 2 |
#define _USE_MATH_DEFINES // used before importing cmath to enable math constant
// M_PI
#include <cmath>
#include <iomanip>
#include <iostream>
struct Point {
double x;
double y;
};
void koch(int depth, Point start, Point end) {
using namespace std;
cout.precision(8);
cout << std... | #define _USE_MATH_DEFINES // used before importing cmath to enable math constant
// M_PI
#include <cmath>
#include <iomanip>
#include <iostream>
struct Point {
double x;
double y;
};
void koch(int depth, Point start, Point end) {
using namespace std;
cout.precision(8);
cout << std... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["-", 8, 9, 0, 1, 0, 34, 31, 11, 12, 13], ["+", 8, 9, 0, 1, 0, 34, 31, 11, 12, 13], ["-", 8, 9, 0, 1, 0, 34, 12, 11, 12, 13], ["+", 8, 9, 0, 1, 0, 34, 12, 11, 12, 13]] | 1 | 414 | 6 |
#include <bits/stdc++.h>
using namespace std;
struct Point {
double x, y;
};
int N;
void dfs(int n, Point p1, Point p2) {
if (n == N)
return;
double th = M_PI * 60.0 / 180.0;
Point s = {(2.0 * p1.x + p2.x) / 3.0, (2.0 * p1.y + p2.y) / 3.0};
Point t = {(p1.x + 2.0 * p2.x) / 3.0, (p1.y + 2.0 * p2.y) / 3... | #include <bits/stdc++.h>
using namespace std;
struct Point {
double x, y;
};
int N;
void dfs(int n, Point p1, Point p2) {
if (n == N)
return;
double th = M_PI * 60.0 / 180.0;
Point s = {(2.0 * p1.x + p2.x) / 3.0, (2.0 * p1.y + p2.y) / 3.0};
Point t = {(p1.x + 2.0 * p2.x) / 3.0, (p1.y + 2.0 * p2.y) / 3... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 337 | 4 |
$n = 0
def merge(sorted_left, sorted_right)
arr = []
l_p = r_p = 0
max = 1000000000
sorted_left.push(max)
sorted_right.push(max)
l_v = r_v = 0
while l_v != max && r_v != max
flag = true
l_v = sorted_left[l_p].to_i
while flag
r_v = sorted_right[r_p].to_i
if l_v == max && r_v == max... | $n = 0
def merge(sorted_left, sorted_right)
arr = []
l_p = r_p = 0
max = 1000000000
sorted_left.push(max)
sorted_right.push(max)
l_v = r_v = 0
while l_v != max || r_v != max
flag = true
l_v = sorted_left[l_p].to_i
while flag
r_v = sorted_right[r_p].to_i
if l_v == max && r_v == max... | [["-", 0, 735, 8, 736, 0, 89, 15, 738, 17, 98], ["+", 0, 735, 8, 736, 0, 89, 15, 738, 17, 106]] | 4 | 212 | 2 |
#
# def merge_sort(s)
# tmp = s
# return tmp if tmp.length <= 1
# half(s).map { |e| e.merge_sort }
# merge(a, b)
# end
#
# def half(s)
# length = s.length
# mid = (length/2)
# a = s.slice!(0...mid)
# b = s.slice!(mid..-1)
# return [a, b]
# end
#
# def merge(a, b)
# output = []
# until a.empty? && ... | #
# def merge_sort(s)
# tmp = s
# return tmp if tmp.length <= 1
# half(s).map { |e| e.merge_sort }
# merge(a, b)
# end
#
# def half(s)
# length = s.length
# mid = (length/2)
# a = s.slice!(0...mid)
# b = s.slice!(mid..-1)
# return [a, b]
# end
#
# def merge(a, b)
# output = []
# until a.empty? && ... | [["+", 0, 493, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 4 | 253 | 7 |
def merge( tS, left, mid, right ):
global cnt
n1 = mid - left;
n2 = right - mid;
tL = tS[ left : mid ];
tR = tS[ mid : right ];
tL.append( 1000000001 )
tR.append( 1000000001 )
i = j = 0
for k in range( left, right ):
cnt += 1
if tL[i] <= tR[j]:
tS[k] = tL[i]
i += 1
else:
tS[k] = tR[j]
j += 1... | def merge( tS, left, mid, right ):
global cnt
n1 = mid - left;
n2 = right - mid;
tL = tS[ left : mid ];
tR = tS[ mid : right ];
tL.append( 1000000001 )
tR.append( 1000000001 )
i = j = 0
for k in range( left, right ):
cnt += 1
if tL[i] <= tR[j]:
tS[k] = tL[i]
i += 1
else:
tS[k] = tR[j]
j += 1... | [["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 676]] | 5 | 223 | 2 |
m=0
def merge(a,left,mid,right):
n1=mid-left
n2=right-mid
el=list(range(0,n1+1))
ar=list(range(0,n2+1))
for i in range(n1):
el[i]=a[left+i]
for i in range(n2):
ar[i]=a[mid+i]
el[n1]=float("inf")
ar[n2]=float("inf")
i=0
j=0
for k in range(left,right):
g... | m=0
def merge(a,left,mid,right):
n1=mid-left
n2=right-mid
el=list(range(0,n1+1))
ar=list(range(0,n2+1))
for i in range(n1):
el[i]=a[left+i]
for i in range(n2):
ar[i]=a[mid+i]
el[n1]=float("inf")
ar[n2]=float("inf")
i=0
j=0
for k in range(left,right):
g... | [["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 340 | 3 |
INFTY = 10 ** 10
def merge(A, left, mid, right):
global count
n1 = mid - left;
n2 = right - mid;
L = []
R = []
L = A[left:left+n1]
R = A[mid:mid+n2]
L.append(INFTY)
R.append(INFTY)
i = 0
j = 0
for k in range(left, right):
count = count + 1
if L[i] <= R[j]:
A[k] = L[i]
i ... | count = 0
INFTY = 10 ** 10
def merge(A, left, mid, right):
global count
n1 = mid - left;
n2 = right - mid;
L = []
R = []
L = A[left:left+n1]
R = A[mid:mid+n2]
L.append(INFTY)
R.append(INFTY)
i = 0
j = 0
for k in range(left, right):
count = count + 1
if L[i] <= R[j]:
A[k] = L[... | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]] | 5 | 261 | 3 |
def merge_sort(A):
if len(A) <= 1:
return A, 0
mid = len(A) // 2
left, lcount = merge_sort(A[:mid])
right, rcount = merge_sort(A[mid:])
merged, count = merge(left, right)
return merged, lcount + rcount + count
def merge(left, right):
lpos = 0
rpos = 0
#lcount = 0
#rcount... | def merge_sort(A):
if len(A) <= 1:
return A, 0
mid = len(A) // 2
left, lcount = merge_sort(A[:mid])
right, rcount = merge_sort(A[mid:])
merged, count = merge(left, right)
return merged, lcount + rcount + count
def merge(left, right):
lpos = 0
rpos = 0
#lcount = 0
#rcount... | [["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 252 | 4 |
def merge(a, left, mid, right):
global cnt
l = a[left:mid] + [10**9 + 1]
r = a[mid:right] + [10**9 + 1]
i = 0
j = 0
for k in range(left, right):
cnt += 1
if l[i] <= r[j]:
a[k] = l[i]
i += 1
else:
a[k] = r[j]
j += 1
def me... | def merge(a, left, mid, right):
global cnt
l = a[left:mid] + [10**9 + 1]
r = a[mid:right] + [10**9 + 1]
i = 0
j = 0
for k in range(left, right):
cnt += 1
if l[i] <= r[j]:
a[k] = l[i]
i += 1
else:
a[k] = r[j]
j += 1
def me... | [["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]] | 5 | 199 | 1 |
def merge_sort(A, left, right):
if left + 1 < right:
mid = (left + right) // 2
merge_sort(A, left, mid)
merge_sort(A, mid, right)
merge_with_array(A, left, mid, right)
def merge(A, left, mid, right):
global Comp_count
n1 = mid - left
n2 = right - mid
L = A[left:mid]... | def merge_sort(A, left, right):
if left + 1 < right:
mid = (left + right) // 2
merge_sort(A, left, mid)
merge_sort(A, mid, right)
merge(A, left, mid, right)
def merge(A, left, mid, right):
global Comp_count
n1 = mid - left
n2 = right - mid
L = A[left:mid]
R = A[... | [["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22]] | 5 | 554 | 2 |
from collections import deque
count = 0
def merge(A,left,mid,right):
L = deque(A[left:mid])
R = deque(A[mid:right])
L.append(10**9)
R.append(10**9)
global count
for k in range(left,right):
count +=1
if L[0] <= R[0]:
A[k] = L.popleft()
else:
... | from collections import deque
count = 0
def merge(A,left,mid,right):
L = deque(A[left:mid])
R = deque(A[mid:right])
L.append(10**9)
R.append(10**9)
global count
for k in range(left,right):
count +=1
if L[0] <= R[0]:
A[k] = L.popleft()
else:
... | [["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 203 | 18 |
def merge(A,left,mid,right):
global cnt
L = A[left:mid]
R = A[mid:right]
L.append(float("inf"))
R.append(float("inf"))
i = 0
j = 0
for k in range(left, right):
cnt += 1
if L[i] <=R[j]:
A[k] = L[i]
i += 1
else:
A[k] = R[j]
... | def merge(A,left,mid,right):
global cnt
L = A[left:mid]
R = A[mid:right]
L.append(float("inf"))
R.append(float("inf"))
i = 0
j = 0
for k in range(left, right):
cnt += 1
if L[i] <=R[j]:
A[k] = L[i]
i += 1
else:
A[k] = R[j]
... | [["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]] | 5 | 213 | 5 |
n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0
def merge(S, left, mid, right):
L = S[left:mid] + [SENTINEL]
R = S[mid:right] + [SENTINEL]
i = j = 0
for k in range(left, right):
if (L[i] <= R[j]):
S[k] = L[i]
i += 1
else:
... | n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 10 + 1
count = 0
def merge(S, left, mid, right):
L = S[left:mid] + [SENTINEL]
R = S[mid:right] + [SENTINEL]
i = j = 0
global count
for k in range(left, right):
if (L[i] <= R[j]):
S[k] = L[i]
i += 1... | [["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["+", 0, 656, 0, 14, 8, 196, 0, 299, 0, 636], ["+", 0, 656, 0, 14, 8, 196, 0, 299, 0, 22]] | 5 | 201 | 4 |
def g(A,l,m,r):
global c
L=A[l:m]+[1e10]
R=A[m:r]+[1e10]
i=j=0
for k in range(l,r):
if L[i]<R[j]:A[k]=L[i];i+=1
else:A[k]=R[j];j+=1
c+=1
def s(A,l,r):
if l+1<r:
m=(l+r)//2
s(A,l,m)
s(A,m,r)
g(A,l,m,r)
c=0
n=int(input())
A=list(map(int,input().split()))
s(A,0,n)
print(*A)
| def g(A,l,m,r):
global c
L=A[l:m]+[1e10]
R=A[m:r]+[1e10]
i=j=0
for k in range(l,r):
if L[i]<R[j]:A[k]=L[i];i+=1
else:A[k]=R[j];j+=1
c+=1
def s(A,l,r):
if l+1<r:
m=(l+r)//2
s(A,l,m)
s(A,m,r)
g(A,l,m,r)
c=0
n=int(input())
A=list(map(int,input().split()))
s(A,0,n)
print(*A)
print(c)
| [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 188 | 10 |
def m(L,R):
global c;c+=len(L)+len(R)
T=[]
for l in L[::-1]:
while R and R[-1]>l:T+=[R.pop()]
T+=[l]
T+=R
return T[::-1]
def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A
c=0
input()
print(*d(list(map(int,input().split()))))
print(c)
| def m(L,R):
global c;c+=len(L)+len(R)
T=[]
for l in L[::-1]:
while R and R[-1]>l:T+=[R.pop()]
T+=[l]
T+=R[::-1]
return T[::-1]
def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A
c=0
input()
print(*d(list(map(int,input().split()))))
print(c)
| [["+", 8, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["+", 0, 1, 0, 677, 12, 206, 206, 663, 0, 102], ["+", 0, 677, 12, 206, 206, 663, 0, 664, 17, 33], ["+", 0, 677, 12, 206, 206, 663, 0, 664, 28, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 0, 73]] | 5 | 150 | 16 |
cnt = 0
INFTY=10**10
def merge_sort(a,left,right):
if left+1<right:
mid=(left+right)//2
merge_sort(a,left,mid)
merge_sort(a,mid,right)
merge(a,left,mid,right)
def merge(a,left,mid,right):
L=a[left:mid]
R=a[mid:right]
L.append(INFTY)
R.append(INFTY)
global cnt
i=0
j=0
for k in range(left,right):
cnt+... | cnt = 0
INFTY=10**10
def merge_sort(a,left,right):
if left+1<right:
mid=(left+right)//2
merge_sort(a,left,mid)
merge_sort(a,mid,right)
merge(a,left,mid,right)
def merge(a,left,mid,right):
L=a[left:mid]
R=a[mid:right]
L.append(INFTY)
R.append(INFTY)
global cnt
i=0
j=0
for k in range(left,right):
cnt+... | [["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]] | 5 | 205 | 1 |
import math
sentinel = 1e9 + 1
counter = 0
def merge(a, left, mid, right):
global counter
L = a[left:mid] + [SEN]
R = a[mid:right] + [SEN]
i,j = 0,0
for k in range(left, right):
if(L[i] <= R[j]):
a[k] = L[i]
i += 1
else:
a[k] = R[j]
j +... | import math
sentinel = 1e9 + 1
counter = 0
def merge(a, left, mid, right):
global counter
L = a[left:mid] + [sentinel]
R = a[mid:right] + [sentinel]
i,j = 0,0
for k in range(left, right):
if(L[i] <= R[j]):
a[k] = L[i]
i += 1
else:
a[k] = R[j]
... | [["-", 0, 1, 0, 662, 12, 657, 12, 634, 0, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 22]] | 5 | 203 | 4 |
def merge(a, left, mid, right):
global count
n1 = mid - left
n2 = right - mid
L = a[left:left + n1] + SENTINEL
R = a[mid:mid + n2] + SENTINEL
i = j = 0
for k in range(left, right):
if L[i] <= R[j]:
a[k] = L[i]
i += 1
else:
a[k] = R[j]
... | def merge(a, left, mid, right):
global count
n1 = mid - left
n2 = right - mid
L = a[left:left + n1] + [SENTINEL]
R = a[mid:mid + n2] + [SENTINEL]
i = j = 0
for k in range(left, right):
if L[i] <= R[j]:
a[k] = L[i]
i += 1
else:
a[k] = R[j]
... | [["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 70], ["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 73]] | 5 | 223 | 4 |
#include <iostream>
#include <limits>
#include <vector>
using namespace std;
void merge(vector<int> &A, int left, int mid, int right, long long int &count) {
int n1 = mid - left;
int n2 = right - mid;
vector<int> L, R;
L.resize(n1 + 1);
R.resize(n2 + 1);
for (int i = 0; i < n1; i++) {
L[i] = A[left + i... | #include <iostream>
#include <limits>
#include <vector>
using namespace std;
void merge(vector<int> &A, int left, int mid, int right, long long int &count) {
int n1 = mid - left;
int n2 = right - mid;
vector<int> L, R;
L.resize(n1 + 1);
R.resize(n2 + 1);
for (int i = 0; i < n1; i++) {
L[i] = A[left + i... | [["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]] | 1 | 400 | 2 |
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
//#include <Windows.h>
//#include "Library.h"
//#include "Math.h"
usin... | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
//#include <Windows.h>
//#include "Library.h"
//#include "Math.h"
usin... | [["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["+", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 322 | 5 |
#include <algorithm>
#include <assert.h>
#include <iostream>
using namespace std;
int tempmarge[1000100];
int N, A[10000000];
bool bsearch(const int array[], int left, int right, int value) {
while (left + 1 < right) {
int med = (left + right) / 2;
if (array[med] > value)
right = med;
else
... |
#include <algorithm>
#include <assert.h>
#include <iostream>
using namespace std;
int tempmarge[1000100];
int N, A[10000000];
bool bsearch(const int array[], int left, int right, int value) {
while (left + 1 < right) {
int med = (left + right) / 2;
if (array[med] > value)
right = med;
else
... | [["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 8, 1, 0, 16, 12, 69, 341, 342, 0, 22]] | 1 | 351 | 6 |
#include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 100000;
static const int sentinel = 1000000000;
int ninvention = 0;
int merge(int A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 = right - mid;
int L[n1 + 1], R[n2 + 1];
for (int i = 0; i < n1; i++)
L[i]... | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
static const int sentinel = 1000000000;
long int ninvention = 0;
int merge(int A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 = right - mid;
int L[n1 + 1], R[n2 + 1];
for (int i = 0; i < n1; i++)
... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22]] | 1 | 343 | 5 |
#include "bits/stdc++.h"
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
llong merge(int A[], int n, int left, int mid, int right) {
int i, j, k;
llong cnt = 0;
int n1 = mid - left;
int n2 = right - mid;
for (i = 0; i < n1; ++... | #include "bits/stdc++.h"
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
llong merge(int A[], int n, int left, int mid, int right) {
int i, j, k;
llong cnt = 0;
int n1 = mid - left;
int n2 = right - mid;
for (i = 0; i < n1; ++... | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22]] | 1 | 390 | 3 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int inf = 1000000000;
int count(vector<int> a) {
int cnt = 0;
int n = a.size... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int inf = 1000000000;
long long count(vector<int> &a) {
long long cnt = 0;
i... | [["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["+", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 299 | 7 |
#include <cinttypes>
#include <cstdint>
#include <cstdio>
const int kMaxN = 200000;
const int kMaxAi = 1000000000;
const int kSentinel = kMaxAi + 1;
void Merge(int A[], int left, int mid, int right, int L[], int R[],
std::int64_t cnt) {
int i, j, k;
int n1 = mid - left;
int n2 = right - mid;
for (i... | #include <cinttypes>
#include <cstdint>
#include <cstdio>
const int kMaxN = 200000;
const int kMaxAi = 1000000000;
const int kSentinel = kMaxAi + 1;
void Merge(int A[], int left, int mid, int right, int L[], int R[],
std::int64_t *cnt) {
int i, j, k;
int n1 = mid - left;
int n2 = right - mid;
for (... | [["+", 49, 53, 54, 55, 0, 56, 49, 84, 0, 48], ["+", 0, 9, 0, 1, 0, 11, 31, 66, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 42, 0, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 42, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 61, 0, 22], ["+", 0, 2, 3, 4, 0, 61, 0, 5, 0, 62], ... | 1 | 425 | 10 |
// ALDS1_5_B.cpp
// Divide and Conquer - Merge Sort
// ???????????????
// 1. ?????????L???R????????°??´???????????????????????¨???
// 2. ??????????¬???°??¶??????cnt++??????if??????if?????????????????¨?????????
// 3. vector????§??????????????????°???vector<int> nums'(n)'!
#include <iostream>
#include <vector>
using nam... | // ALDS1_5_B.cpp
// Divide and Conquer - Merge Sort
// ???????????????
// 1. ?????????L???R????????°??´???????????????????????¨???
// 2. ??????????¬???°??¶??????cnt++??????if??????if?????????????????¨?????????
// 3. vector????§??????????????????°???vector<int> nums'(n)'!
#include <iostream>
#include <vector>
using nam... | [["-", 0, 14, 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], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 382 | 5 |
#include <iostream>
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
llong merge(int A[], int left, int mid, int right) {
int i, j, k;
llong cnt = 0;
int n1 = mid - left;
int n2 = right - mid;
for (i = 0; i < n1; i++)
L[i] ... | #include <iostream>
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
llong merge(int A[], int left, int mid, int right) {
int i, j, k;
llong cnt = 0;
int n1 = mid - left;
int n2 = right - mid;
for (i = 0; i < n1; i++)
L[i] ... | [["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 22]] | 1 | 364 | 4 |
#include <iostream>
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
llong merge(int A[], int left, int right, int mid) {
int i = 0, j = 0;
int n1 = mid - left, n2 = right - mid;
llong cnt = 0;
for (int k = 0; k < n1; k++)
L[k]... | #include <iostream>
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
llong merge(int A[], int left, int right, int mid) {
int i = 0, j = 0;
int n1 = mid - left, n2 = right - mid;
llong cnt = 0;
for (int k = 0; k < n1; k++)
L[k]... | [["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152]] | 1 | 365 | 4 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
template <typename T> struct BIT {
int n;
vector<T> bit;
// 1-indexed
BIT() : n(-1) {}
BIT(int n_, T d) : n(n_), bit(n_ + 1, d) {}
T sum(int i) {
T s = bit[0];
for (int x = i; x > 0; x -= (x & -x))
s += bit[x];
return s... | #include <bits/stdc++.h>
using namespace std;
#define int long long
template <typename T> struct BIT {
int n;
vector<T> bit;
// 1-indexed
BIT() : n(-1) {}
BIT(int n_, T d) : n(n_), bit(n_ + 1, d) {}
T sum(int i) {
T s = bit[0];
for (int x = i; x > 0; x -= (x & -x))
s += bit[x];
return s... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]] | 1 | 561 | 2 |
#include <iostream>
#include <set>
using namespace std;
int main() {
int n;
cin >> n;
set<string> st;
for (int i = 0; i < n; ++i) {
string command, str;
cin >> command;
if (command[0] == 'i') {
st.insert(str);
} else {
if (st.find(str) != st.end()) {
cout << "yes" << endl;
... | #include <iostream>
#include <set>
using namespace std;
int main() {
int n;
cin >> n;
set<string> st;
for (int i = 0; i < n; ++i) {
string command, str;
cin >> command >> str;
if (command[0] == 'i') {
st.insert(str);
} else {
if (st.find(str) != st.end()) {
cout << "yes" << e... | [["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 114 | 2 |
#include <stdio.h>
#include <string.h>
using namespace std;
#define LIM 419430400
#define LEN 13
char H[LIM][LEN];
int toInt(char str) {
if (str == 'A')
return 1;
else if (str == 'C')
return 2;
else if (str == 'G')
return 3;
else if (str == 'T')
return 4;
else
return 0;
}
long long get... | #include <stdio.h>
#include <string.h>
using namespace std;
#define LIM 19430400
#define LEN 13
char H[LIM][LEN];
int toInt(char str) {
if (str == 'A')
return 1;
else if (str == 'C')
return 2;
else if (str == 'G')
return 3;
else if (str == 'T')
return 4;
else
return 0;
}
long long getK... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 108], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 484 | 8 |
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i)
#define repprev(i, a, b) for (ll i = b - 1; i >= a; i--)
#define reprev(i, n) repprev(i, 0, n)
u... | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i)
#define repprev(i, a, b) for (ll i = b - 1; i >= a; i--)
#define reprev(i, n) repprev(i, 0, n)
u... | [["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 73]] | 1 | 1,473 | 6 |
#include <stdio.h>
#include <string.h>
// study of Hash table.
#define M 1020001 // large prime number.
#define L 14 // length of term.
char H[M][L]; // Hash table.
int getnum(char ch) // character to number.
{
if (ch == 'A') {
return 1;
} else if (ch == 'C') {
return 2;
} else if (ch == 'G') {
... | #include <stdio.h>
#include <string.h>
// study of Hash table.
#define M 1020001 // large prime number.
#define L 14 // length of term.
char H[M][L]; // Hash table.
int getnum(char ch) // character to number.
{
if (ch == 'A') {
return 1;
} else if (ch == 'C') {
return 2;
} else if (ch == 'G') {
... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22]] | 1 | 509 | 4 |
#include <cstring>
#include <iostream>
#include <memory>
#include <string>
/**
@note prime number and less than 1,000,000
*/
constexpr int max_size() { return 1000003; }
/**
@note 5^12
*/
constexpr int max_size2() { return 244140625; }
constexpr int null_val() { return -1; }
class dictionary {
public:
dictionary(... | #include <cstring>
#include <iostream>
#include <memory>
#include <string>
/**
@note prime number and less than 1,000,000
*/
constexpr int max_size() { return 1000003; }
/**
@note 5^12
*/
constexpr int max_size2() { return 244140625 / 8; }
constexpr int null_val() { return -1; }
class dictionary {
public:
diction... | [["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 85], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 12, 13], ["-", 8, 9, 0, 37, 0, 16, 12, 2, 63, 22], ["+", 8, 9, 0, 37, 0, 16, 12, 2, 63, 22], ["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["-", 0, 43, 49, 50, 51, 16, 12, 2, 63, 22], ["+", 0, 43, 49,... | 1 | 1,174 | 9 |
#include <cstring>
#include <iostream>
using namespace std;
char a[1000000][13];
void init() {
for (int i = 0; i < 1000000; i++)
a[i][0] = '\0';
}
int getkey(char s[]) {
int i = 0, key = 0, mul = 1, j;
for (i = 0; s[i] != '\0'; i++) {
switch (s[i]) {
case 'A':
j = 1;
break;
case 'G':
... | #include <cstring>
#include <iostream>
using namespace std;
char a[1000000][13];
void init() {
for (int i = 0; i < 1000000; i++)
a[i][0] = '\0';
}
int getkey(char s[]) {
int i = 0, key = 0, mul = 1, j;
for (i = 0; s[i] != '\0'; i++) {
switch (s[i]) {
case 'A':
j = 1;
break;
case 'G':
... | [["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 474 | 25 |
#include <iostream>
#include <list>
#include <set>
#include <stdio.h>
#include <string>
using namespace std;
set<string> lst;
int main() {
int dataset;
scanf("%d", &dataset);
for (int i = 0; i < dataset; i++) {
cout << "a";
string order;
cin >> order;
if (order[0] == 'i') {
string a;
... | #include <iostream>
#include <list>
#include <set>
#include <stdio.h>
#include <string>
using namespace std;
set<string> lst;
int main() {
int dataset;
scanf("%d", &dataset);
for (int i = 0; i < dataset; i++) {
string order;
cin >> order;
if (order[0] == 'i') {
string a;
cin >> a;
... | [["-", 0, 7, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 7, 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, 6], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]] | 1 | 144 | 6 |
// #include <bits/stdc++.h>
// using namespace std;
// map<string, bool> record;
// int main(int argc, char const *argv[])
// {
// int n;
// string oper, s;
// while (~scanf("%d", &n))
// {
// record.clear();
// for (int i = 0; i < n; ++i)
// {
// cin >> oper >> s;... |
#include <stdio.h>
#include <string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch) {
if ('A' == ch)
return 1;
else if ('C' == ch)
return 2;
else if ('G' == ch)
return 3;
else if ('T' == ch)
return 4;
else
return 0;
}
long long getKey(char str[]) ... | [["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 13]] | 1 | 533 | 2 |
#include <stdio.h>
#include <string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch) {
if (ch == 'A')
return 1;
else if (ch == 'C')
return 2;
else if (ch == 'G')
return 3;
else if (ch == 'T')
return 4;
else
return 0;
}
long long getKey(char str[]) {... | #include <stdio.h>
#include <string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch) {
if (ch == 'A')
return 1;
else if (ch == 'C')
return 2;
else if (ch == 'G')
return 3;
else if (ch == 'T')
return 4;
else
return 0;
}
long long getKey(char str[]) {
... | [["-", 8, 9, 0, 37, 0, 16, 12, 23, 0, 24], ["-", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 48]] | 1 | 508 | 4 |
#include <iostream>
#include <map>
using namespace std;
int main() {
map<string, bool> dict;
int n;
string x, y;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x == "insert")
dict[x] = 1;
else {
if (dict[y] == 1)
cout << "yes" << endl;
else
cout << "n... |
#include <iostream>
#include <map>
using namespace std;
int main() {
map<string, bool> dict;
int n;
string x, y;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (x == "insert")
dict[y] = 1;
else {
if (dict[y] == 1)
cout << "yes" << endl;
else
cout << "n... | [["-", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22]] | 1 | 100 | 2 |
#include <iostream>
#include <string>
using namespace std;
const int M = 1046527;
string table[M];
int get_char(char c) {
if (c == 'A')
return 1;
else if (c == 'C')
return 2;
else if (c == 'G')
return 3;
else if (c == 'T')
return 4;
else
return 0;
}
long long get_key(string &text) {
... | #include <iostream>
#include <string>
using namespace std;
const int M = 1046527;
string table[M];
int get_char(char c) {
if (c == 'A')
return 1;
else if (c == 'C')
return 2;
else if (c == 'G')
return 3;
else if (c == 'T')
return 4;
else
return 0;
}
long long get_key(string &text) {
... | [["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 75, 76, 0, 57, 15, 339, 51, 91, 17, 111]] | 1 | 424 | 7 |
def merge(a, left, mid, right)
n1 = mid - left
n2 = right - mid
_L = a[left..mid-1]
_R = a[mid..right-1]
_L[n1] = _R[n2] = 1.0 / 0.0
i = j = 0
cnt = 0
left.upto(right-1){|k|
if _L[i] <= _R[j] then
a[k] = _L[i]
i += 1
else
a[k] = _R[j]
j += 1
cnt += 1
end
}
r... | def merge(a, left, mid, right)
n1 = mid - left
n2 = right - mid
_L = a[left..mid-1]
_R = a[mid..right-1]
_L[n1] = _R[n2] = 1.0 / 0.0
i = j = 0
cnt = 0
left.upto(right-1){|k|
if _L[i] <= _R[j] then
a[k] = _L[i]
i += 1
else
a[k] = _R[j]
j += 1
cnt += n1 - i
end
... | [["-", 8, 734, 0, 121, 75, 95, 0, 755, 12, 612], ["+", 0, 121, 75, 95, 0, 755, 12, 738, 31, 22], ["+", 0, 121, 75, 95, 0, 755, 12, 738, 17, 33], ["+", 0, 121, 75, 95, 0, 755, 12, 738, 12, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 738, 17, 33], ["-", 0, 493, 0, 652, 3, 4, 0, 738, 12, 612]] | 4 | 213 | 6 |
def merge(A, left, mid, right):
n1 = mid-left
n2 = right-mid
#L = [0 for i in range(n1+1)]
#R = [0 for i in range(n2+1)]
#for i in range(n1):
# L[i] = A[left+i]
#for i in range(n2):
# R[i] = A[mid+i]
L = A[left:mid]
R = A[mid:right]
L.append(float('inf'))
R.append(... | def merge(A, left, mid, right):
n1 = mid-left
n2 = right-mid
#L = [0 for i in range(n1+1)]
#R = [0 for i in range(n2+1)]
#for i in range(n1):
# L[i] = A[left+i]
#for i in range(n2):
# R[i] = A[mid+i]
L = A[left:mid]
l = len(L)
R = A[mid:right]
L.append(float('inf')... | [["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 230 | 6 |
input()
a = list(map(int, input().split()))
def merge_and_count(a, b):
i, j = 0, 0
count = 0
m = []
while i < len(a) and j < len(b):
if a[i] <= b[j]:
m.append(a[i])
i += 1
else:
count += len(a)-i
m.append(b[j])
j += 1
if i... | input()
a = list(map(int, input().split()))
def merge_and_count(a, b):
i, j = 0, 0
count = 0
m = []
while i < len(a) and j < len(b):
if a[i] <= b[j]:
m.append(a[i])
i += 1
else:
count += len(a)-i
m.append(b[j])
j += 1
if i... | [["-", 64, 196, 0, 37, 0, 432, 0, 634, 0, 70], ["-", 64, 196, 0, 37, 0, 432, 0, 634, 0, 73], ["+", 0, 57, 64, 196, 0, 37, 0, 432, 0, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]] | 5 | 226 | 7 |
INF = float("inf")
cnt = 0
def merge(A, left, mid, right):
global cnt
L = A[left: mid] + [INF]
R = A[mid: right] + [INF]
i = j = 0
for k in range(left, right):
if L[i] <= R[j]:
A[k] = L[i]
cnt += j
i += 1
else:
A[k] = R[j]
j... | INF = float("inf")
cnt = 0
def merge(A, left, mid, right):
global cnt
L = A[left: mid] + [INF]
R = A[mid: right] + [INF]
i = j = 0
for k in range(left, right):
if L[i] <= R[j]:
A[k] = L[i]
cnt += j
i += 1
else:
A[k] = R[j]
j... | [["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 198 | 5 |
# Merge Sortを元に分割統治で反転数を求める
cnt = -1 # 反転数 Lの最後の要素は必ず無限大であり,反転とカウントされてしまうので1減らしておく
def merge(A, left, mid, right):
global cnt
n1 = mid - left
n2 = right - mid
L = [A[i] for i in range(left, mid)]
R = [A[i] for i in range(mid, right)]
L.append(float("inf"))
R.append(float("inf"))
i = j = ... | # Merge Sortを元に分割統治で反転数を求める
cnt = 0
def merge(A, left, mid, right):
global cnt
n1 = mid - left
n2 = right - mid
L = [A[i] for i in range(left, mid)]
R = [A[i] for i in range(mid, right)]
L.append(float("inf"))
R.append(float("inf"))
i = j = 0
for k in range(left, right):
if L... | [["-", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 75, 76, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 2... | 5 | 228 | 7 |
cnt = 0
def merge(A,left,mid,right):
global cnt
n1 = mid - left
n2 = right - mid
L = [A[i] for i in range(left, mid)]
R = [A[i] for i in range(mid, right)]
L.append(float("inf"))
R.append(float("inf"))
i = 0
j = 0
for k in range(left, right):
if L[i] <= R[j]:
... | cnt = 0
def merge(A,left,mid,right):
global cnt
n1 = mid - left
n2 = right - mid
L = [A[i] for i in range(left, mid)]
R = [A[i] for i in range(mid, right)]
L.append(float("inf"))
R.append(float("inf"))
i = 0
j = 0
for k in range(left, right):
if L[i] <= R[j]:
... | [["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22]] | 5 | 228 | 2 |
#16D8103010K Ko Okasaki
#ALDS_5_D
global cnt
cnt=0
def merge(A,left,mid,right):
L=A[left:mid]
R=A[mid:right]
L.append(float("inf"))
R.append(float("inf"))
i=0
j=0
for k in range(left,right):
global cnt
if L[i]<=R[j]:
A[k]=L[i]
i=i+1
else... | global cnt
cnt=0
def merge(A,left,mid,right):
L=A[left:mid]
R=A[mid:right]
L.append(float("inf"))
R.append(float("inf"))
i=0
j=0
for k in range(left,right):
global cnt
if L[i]<=R[j]:
A[k]=L[i]
i=i+1
else:
A[k]=R[j]
... | [["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 222 | 5 |
def merge(a, left, mid, right):
INF = int(1e+11)
l = a[left:mid]
r = a[mid:right]
l.append(INF)
r.append(INF)
i = 0
j = 0
ans = 0
for k in range(left, right):
if l[i] <= r[j]:
a[k] = l[i]
i += 1
else:
a[k] = r[j]
j += ... | def merge(a, left, mid, right):
INF = int(1e+11)
l = a[left:mid]
r = a[mid:right]
l.append(INF)
r.append(INF)
i = 0
j = 0
ans = 0
for k in range(left, right):
if l[i] <= r[j]:
a[k] = l[i]
i += 1
else:
a[k] = r[j]
j += ... | [["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 657, 31, 22], ["+", 0, 1, 0, 677, 12, 657, 31, 657, 17, 33], ["+", 0, 1, 0, 677, 12, 657, 31, 657, 12, 22], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 12, 22]] | 5 | 218 | 6 |
var n;
function CS(a, b, k) {
var c = new Array(k + 1);
for (var i = 0; i <= k; i++)
c[i] = 0;
for (var j = 0; j < n; j++)
c[a[j]]++;
for (var i = 1; i <= k; i++)
c[i] += c[i - 1];
for (var j = 0; j < n; j++)
b[-1 + c[a[j]]--] = a[j];
}
function Main(input) {
input = input.split("\n");
n... | var n;
function CS(a, b, k) {
var c = new Array(k + 1);
for (var i = 0; i <= k; i++)
c[i] = 0;
for (var j = 0; j < n; j++)
c[a[j]]++;
for (var i = 1; i <= k; i++)
c[i] += c[i - 1];
for (var j = 0; j < n; j++)
b[-1 + c[a[j]]--] = a[j];
}
function Main(input) {
input = input.split("\n");
n... | [["-", 8, 556, 0, 1, 0, 2, 3, 3, 0, 555], ["+", 8, 556, 0, 1, 0, 2, 3, 3, 0, 555]] | 2 | 297 | 2 |
function sort(A, B, k) {
var C = [];
for (var i = 0; i <= k; i++) {
C[i] = 0;
}
for (var j = 0; j <= A.length; j++) {
C[A[j]]++;
}
for (var i = 1; i <= k; i++) {
C[i] += C[i - 1];
}
for (var j = A.length - 1; j >= 0; j--) {
B[C[A[j]] - 1] = A[j];
C[A[j]]--;
}
}
var input = require... | function sort(A, B, k) {
var C = [];
for (var i = 0; i <= k; i++) {
C[i] = 0;
}
for (var j = 0; j <= A.length; j++) {
C[A[j]]++;
}
for (var i = 1; i <= k; i++) {
C[i] += C[i - 1];
}
for (var j = A.length - 1; j >= 0; j--) {
B[C[A[j]] - 1] = A[j];
C[A[j]]--;
}
}
var input = require... | [["-", 0, 493, 0, 1, 0, 2, 3, 3, 0, 22], ["+", 0, 493, 0, 1, 0, 2, 3, 3, 0, 555]] | 2 | 244 | 2 |
#include <array>
#include <cstdio>
using namespace std;
typedef array<int, 10001> v;
static inline int in() {
int c, n = 0;
while ((c = getchar_unlocked()) >= '0' && c <= '9')
n = 10 * n + (c - '0');
return n;
}
int main() {
int n = in(), c = n;
v b = {};
while (n--)
b[in()]++;
bool f = true... | #include <array>
#include <cstdio>
using namespace std;
typedef array<int, 10001> v;
static inline int in() {
int c, n = 0;
while ((c = getchar_unlocked()) >= '0' && c <= '9')
n = 10 * n + (c - '0');
return n;
}
int main() {
int n = in(), c = n;
v b = {};
while (n--)
b[in()]++;
bool f = true... | [["-", 0, 14, 8, 9, 0, 7, 15, 27, 17, 68], ["+", 0, 7, 8, 52, 8, 1, 0, 34, 0, 21], ["+", 8, 52, 8, 1, 0, 34, 12, 27, 28, 22], ["+", 8, 52, 8, 1, 0, 34, 12, 27, 17, 68]] | 1 | 161 | 4 |
#include <iostream>
using namespace std;
int n;
int C[10000];
int CountingSort(int A[], int B[], int k) {
for (int i = 0; i < k + 1; i++) {
C[i] = 0;
}
for (int j = 1; j < n + 1; j++) {
C[A[j]]++;
}
for (int i = 1; i < k + 1; i++) {
C[i] = C[i] + C[i - 1];
}
for (int j = n; j > -1; j--) {
... | #include <iostream>
using namespace std;
int n;
int C[10000];
int CountingSort(int A[], int B[], int k) {
for (int i = 0; i < k + 1; i++) {
C[i] = 0;
}
for (int j = 1; j < n + 1; j++) {
C[A[j]]++;
}
for (int i = 1; i < k + 1; i++) {
C[i] = C[i] + C[i - 1];
}
for (int j = n; j > 0; j--) {
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 283 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
int main() {
int n, i, max;
scanf("%d", &n);
int A[n + 1];
int B[n + 1];
max = (1 << 30) * -1;
for (i = 0; i < n; i++) {
scanf("%hu", &A[i + 1]);
max = MAX(max, A[i + 1]);
}
int C[max + 1];... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
int main() {
int n, i, max;
scanf("%d", &n);
unsigned short A[n + 1];
unsigned short B[n + 1];
max = (1 << 30) * -1;
for (i = 0; i < n; i++) {
scanf("%hu", &A[i + 1]);
max = MAX(max, A[i + 1]);... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 133]] | 1 | 265 | 6 |
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <typeinfo>
#define MAX 2000001
#define VMAX 10000
using namespace std;
int main() {
unsigned short *A, *B;
int C[VMAX + 1];
int n, i, j;
cin >> n;
A = static_cast<unsigned short *>(malloc(sizeof(short) * n + 1));
B = stati... | #include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <typeinfo>
#define MAX 2000001
#define VMAX 10000
using namespace std;
int main() {
unsigned short *A, *B;
int C[VMAX + 1];
int n, i, j;
cin >> n;
A = static_cast<unsigned short *>(malloc(sizeof(short) * n + 1));
B = stati... | [["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 265 | 2 |
#include <iostream>
using namespace std;
#define VMAX 10000
void counting_sort(int A[], int B[], int C[], int k, int n) {
// init C (counter) array
for (int i = 0; i <= k; i++) {
C[i] = 0;
}
// count the number of A[j] into C
for (int j = 1; j <= n; j++) {
C[A[j]]++;
}
// set the number which ... | #include <iostream>
using namespace std;
#define VMAX 10000
void counting_sort(int A[], int B[], int C[], int k, int n) {
// init C (counter) array
for (int i = 0; i <= k; i++) {
C[i] = 0;
}
// count the number of A[j] into C
for (int j = 1; j <= n; j++) {
C[A[j]]++;
}
// set the number which ... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 301 | 45 |
#include <bits/stdc++.h>
using namespace std;
void CountingSort(vector<int> &A, vector<int> &B, vector<int> &C) {
int n = A.size();
for (int i = 0; i < n; i++) {
C[A[i]]++;
}
for (int i = 1; i < 10001; i++) {
C[i] = C[i] + C[i - 1];
}
for (int i = n - 1; i >= 0; i--) {
B[C[A[i]] - 1] = A[i];
... | #include <bits/stdc++.h>
using namespace std;
void CountingSort(vector<int> &A, vector<int> &B, vector<int> &C) {
int n = A.size();
for (int i = 0; i < n; i++) {
C[A[i]]++;
}
for (int i = 1; i < 10001; i++) {
C[i] = C[i] + C[i - 1];
}
for (int i = n - 1; i >= 0; i--) {
B[C[A[i]] - 1] = A[i];
... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 269 | 2 |
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i)
#define repprev(i, a, b) for (ll i = b - 1; i >= a; i--)
#define reprev(i, n) repprev(i, 0, n)
u... | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i)
#define repprev(i, a, b) for (ll i = b - 1; i >= a; i--)
#define reprev(i, n) repprev(i, 0, n)
u... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 1,176 | 2 |
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <... | #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20]] | 1 | 348 | 2 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ctype.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#includ... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ctype.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#includ... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 316 | 4 |
#include <iostream>
using namespace std;
int main(void) {
unsigned short A[2000001], B[2000001];
int C[10001], n;
cin >> n;
for (int i = 0; i <= 10000; i++) {
C[i] = 0;
}
for (int i = 0; i < n; i++) {
cin >> A[i + 1];
C[A[i + 1]]++;
}
for (int i = 1; i <= 10000; i++)
C[i] += C[i - 1];... | #include <iostream>
using namespace std;
int main(void) {
unsigned short A[2000001], B[2000001];
int C[10001], n;
cin >> n;
for (int i = 0; i <= 10000; i++) {
C[i] = 0;
}
for (int i = 0; i < n; i++) {
cin >> A[i + 1];
C[A[i + 1]]++;
}
for (int i = 1; i <= 10000; i++)
C[i] += C[i - 1];... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 205 | 4 |
#include <algorithm>
#include <iostream>
#include <vector>
#define MAXVALUE 10000
#define rep(i, a) for (i = 0; i < a; i++)
using namespace std;
void CountingSort(vector<int> &A, vector<int> &B, int k) {
int i, j;
vector<int> C(k, 0);
for (j = 0; j < A.size(); j++) {
C[A[j]]++;
}
for (i = 1; i <= k; i++... | #include <algorithm>
#include <iostream>
#include <vector>
#define MAXVALUE 10000
#define rep(i, a) for (i = 0; i < a; i++)
using namespace std;
void CountingSort(vector<int> &A, vector<int> &B, int k) {
int i, j;
vector<int> C(k + 1, 0);
for (j = 0; j < A.size(); j++) {
C[A[j]]++;
}
for (i = 1; i <= k;... | [["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 296 | 6 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define pi 3.141592653589793
void Counting... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define pi 3.141592653589793
void Counting... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 316 | 4 |
#include <iostream>
using namespace std;
int main() {
// your code goes here
int n, l, ma = 0;
cin >> n;
int a[10010] = {0};
for (int i = 0; i < n; i++) {
cin >> l;
a[l]++;
if (l > ma)
ma = l;
}
for (int i = 0; i < 10010; i++) {
if (a[i] == 0)
continue;
if (i != l) {
... | #include <iostream>
using namespace std;
int main() {
// your code goes here
int n, l, ma = 0;
cin >> n;
int a[10010] = {0};
for (int i = 0; i < n; i++) {
cin >> l;
a[l]++;
if (l > ma)
ma = l;
}
for (int i = 0; i < 10010; i++) {
if (a[i] == 0)
continue;
if (i != ma) {
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]] | 1 | 168 | 5 |
#include <algorithm>
#include <cstdio>
using namespace std;
int x[2000003], p[10003], n;
int main() {
scanf("%d", &n);
getchar_unlocked();
for (int i = 0; i < n; i++) {
while (true) {
char c = getchar_unlocked();
if ('0' <= c && c <= '9') {
x[i] = x[i] * 10 + (c - '0');
} else {
... | #include <algorithm>
#include <cstdio>
using namespace std;
int x[2000003], p[10003], n;
int main() {
scanf("%d", &n);
getchar_unlocked();
for (int i = 0; i < n; i++) {
while (true) {
char c = getchar_unlocked();
if ('0' <= c && c <= '9') {
x[i] = x[i] * 10 + (c - '0');
} else {
... | [["+", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]] | 1 | 190 | 3 |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
int n, k, A[2000000], B[2000001], C[10001];
int main(void) {
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
scanf("%d", &A[i]);
if (A[i] > k) {
k = A[i];
}
}
for (int i = 0; i < n; ++i) {
... | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
int n, k, A[2000000], B[2000001], C[10001];
int main(void) {
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
scanf("%d", &A[i]);
if (A[i] > k) {
k = A[i];
}
}
for (int i = 0; i < n; ++i) {
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 242 | 2 |
#include "iostream"
using namespace std;
int main() {
int in[2000000];
int ans[2000000];
int co[10001];
int n;
cin >> n;
for (int i = 0; i <= 10000; i++) {
co[i] = 0;
}
for (int i = 0; i < n; i++) {
cin >> in[i];
co[in[i]]++;
}
co[0]--;
for (int i = 1; i <= 10000; i++) {
co[... | #include "iostream"
using namespace std;
int main() {
short in[2000000];
short ans[2000000];
int co[10001];
int n;
cin >> n;
for (int i = 0; i <= 10000; i++) {
co[i] = 0;
}
for (int i = 0; i < n; i++) {
cin >> in[i];
co[in[i]]++;
}
co[0]--;
for (int i = 1; i <= 10000; i++) {
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 133]] | 1 | 213 | 4 |
#include <algorithm>
#include <iostream>
#include <vector>
typedef std::vector<int> TList;
void CountingSort(const TList &A, TList &B, int k) {
std::vector<int> C(k, 0);
/* C[i] ??? i ???????????°????¨?????????? */
for (int j = 1; j < A.size(); ++j) {
C[A[j]]++;
}
/* C[i] ??? i ??\????????°???????????°... | #include <algorithm>
#include <iostream>
#include <vector>
typedef std::vector<int> TList;
void CountingSort(const TList &A, TList &B, int k) {
std::vector<int> C(k + 1, 0);
/* C[i] ??? i ???????????°????¨?????????? */
for (int j = 0; j < A.size(); ++j) {
C[A[j]]++;
}
/* C[i] ??? i ??\????????°????????... | [["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]] | 1 | 296 | 6 |
#include <iostream>
#include <vector>
const int N_MAX = 10000;
int main(void) {
std::ios_base::sync_with_stdio(false);
int n = 0;
std::cin >> n;
std::vector<int> *v = new std::vector<int>(N_MAX + 1, -1);
for (int i = 0; i < n; i++) {
int a = 0;
std::cin >> a;
if (v->at(a) < 0) {
v->a... | #include <iostream>
#include <vector>
const int N_MAX = 10000;
int main(void) {
std::ios_base::sync_with_stdio(false);
int n = 0;
std::cin >> n;
std::vector<int> *v = new std::vector<int>(N_MAX + 1, -1);
for (int i = 0; i < n; i++) {
int a = 0;
std::cin >> a;
if (v->at(a) < 0) {
v->a... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 228 | 2 |
#include <iostream>
#include <vector>
typedef std::vector<int> Ints;
void CountingSort(const Ints &A, Ints &B, int k) {
Ints C(k, 0);
// C[i] ??? i ???????????°????¨??????????
for (unsigned int j = 0; j < A.size(); j++) {
C[A[j]]++;
}
// C[i] ??? i ??\????????°???????????°????¨??????????
for (int i =... | #include <iostream>
#include <vector>
typedef std::vector<int> Ints;
void CountingSort(const Ints &A, Ints &B, int k) {
Ints C(k + 1, 0);
// C[i] ??? i ???????????°????¨??????????
for (unsigned int j = 0; j < A.size(); j++) {
C[A[j]]++;
}
// C[i] ??? i ??\????????°???????????°????¨??????????
for (int... | [["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]] | 1 | 284 | 6 |
class Koch
DEG = (60 * Math::PI / 180.0)
def initialize
end
class Point
attr_accessor :x, :y
def initialize(x = 0.0, y = 0.0)
@x = x
@y = y
end
def dump
puts "%.5f %.5f" % [@x, @y]
end
end
def solve(d, p1, p2)
return if d==0
s = Point.new
s.x = (2*p1.x... | class Koch
DEG = (60 * Math::PI / 180.0)
def initialize
end
class Point
attr_accessor :x, :y
def initialize(x = 0.0, y = 0.0)
@x = x
@y = y
end
def dump
puts "%.5f %.5f" % [@x, @y]
end
end
def solve(d, p1, p2)
return if d==0
s = Point.new
s.x = (2*p1.x... | [["-", 31, 738, 31, 739, 0, 738, 31, 652, 735, 22], ["+", 31, 738, 31, 739, 0, 738, 31, 652, 735, 22], ["-", 31, 738, 31, 739, 0, 738, 12, 652, 735, 22], ["+", 31, 738, 31, 739, 0, 738, 12, 652, 735, 22]] | 4 | 338 | 4 |
def third_points(points)
point_one = {x: (points[1][:x] + 2.0 * points[0][:x]) / 3.0, y: (points[1][:y] + 2.0 * points[0][:y]) / 3.0}
point_two = {x: (points[0][:x] + 2.0 * points[1][:x]) / 3.0, y: (points[0][:y] + 2.0 * points[1][:y]) / 3.0}
[point_one, point_two]
end
def triangle(points)
x = points[0][:x] + ... | def third_points(points)
point_one = {x: (points[1][:x] + 2.0 * points[0][:x]) / 3.0, y: (points[1][:y] + 2.0 * points[0][:y]) / 3.0}
point_two = {x: (points[0][:x] + 2.0 * points[1][:x]) / 3.0, y: (points[0][:y] + 2.0 * points[1][:y]) / 3.0}
[point_one, point_two]
end
def triangle(points)
x = points[0][:x] + ... | [["-", 31, 738, 12, 738, 31, 739, 0, 738, 17, 72], ["+", 31, 738, 12, 738, 31, 739, 0, 738, 17, 33]] | 4 | 396 | 2 |
n = gets.to_i
rot = ->(v, θ) {
t = θ / 180.0 * PI
Matrix[[cos(t), -sin(t)], [sin(t), cos(t)]] * v
}
result = []
koch_curve = ->(p1, p2, level) {
if level == n
result << p1
result << p2
else
l1 = (p2 - p1) / 3
l2 = rot.(l1, 60)
koch_curve.(p1, p3 = p1 + l1, level + 1)
koch_curve.(p3, p4 ... | require 'matrix'
include Math
n = gets.to_i
rot = ->(v, θ) {
t = θ / 180.0 * PI
Matrix[[cos(t), -sin(t)], [sin(t), cos(t)]] * v
}
result = []
koch_curve = ->(p1, p2, level) {
if level == n
result << p1
result << p2
else
l1 = (p2 - p1) / 3
l2 = rot.(l1, 60)
koch_curve.(p1, p3 = p1 + l1, lev... | [["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 0, 493, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 743]] | 4 | 217 | 6 |
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_C&lang=jp
#整数nを入力し、深さnの再帰呼び出しによって作成されるコッホ曲線の頂点の座標を出力するプログラムを作成してください
# 入力 一つの整数nが与えられます
# 1など
# 出力 コッホ曲線の各頂点の座標(x,y)を出力してください
# 一行に一点の座標を出力してください
# 端点の一つ
def koch(n,a,b)
if n == 0
return
end
s = [(2*a[0]+1*b[0])/3.to_f,(2*a[1]+1*b[1])/3.to_f... | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_C&lang=jp
#整数nを入力し、深さnの再帰呼び出しによって作成されるコッホ曲線の頂点の座標を出力するプログラムを作成してください
# 入力 一つの整数nが与えられます
# 1など
# 出力 コッホ曲線の各頂点の座標(x,y)を出力してください
# 一行に一点の座標を出力してください
# 端点の一つ
def koch(n,a,b)
if n == 0
return
end
s = [(2*a[0]+1*b[0])/3.to_f,(2*a[1]+1*b[1])/3.to_f... | [["-", 0, 652, 486, 739, 0, 738, 12, 738, 17, 48], ["+", 12, 516, 0, 652, 486, 739, 0, 738, 17, 72]] | 4 | 418 | 2 |
include Math
class Point
def initialize(x, y)
@x = x.to_f
@y = y.to_f
end
def distance(p)
dx = @x - p.x
dy = @y - p.y
sqrt(dx * dx + dy * dy).to_f
end
def getX()
@x
end
def getY()
@y
end
def internally_dividing_point(p,m,n)
Point.new(((n*@x+m*p.x)/(m+n)).to_f,((n*@y+m*p... | include Math
class Point
def initialize(x, y)
@x = x.to_f
@y = y.to_f
end
def distance(p)
dx = @x - p.x
dy = @y - p.y
sqrt(dx * dx + dy * dy).to_f
end
def getX()
@x
end
def getY()
@y
end
def internally_dividing_point(p,m,n)
Point.new(((n*@x+m*p.x)/(m+n)).to_f,((n*@y+m*p... | [["-", 486, 739, 0, 738, 31, 739, 0, 738, 17, 33], ["+", 486, 739, 0, 738, 31, 739, 0, 738, 17, 72]] | 4 | 460 | 2 |
import math
class Point:
def __init__(self,x,y):
self.x=x
self.y=y
def __str__(self):
return str(self.x)+' '+str(self.y)
def koch(n,a,b):
if n==0: return
s=Point(0,0)
t=Point(0,0)
u=Point(0,0)
th=math.pi*60/180
s.x=(2*a.x+1*b.x)/3
s.y=(2*a.y+1*b.y)/3
t.x=(1*a.x+2*b.x)/3
t.y=(1*a.y+2*b.y)/3
u.x=(t.x-... | import math
class Point:
def __init__(self,x,y):
self.x=x
self.y=y
def __str__(self):
return str(self.x)+' '+str(self.y)
def koch(n,a,b):
if n==0: return
s=Point(0,0)
t=Point(0,0)
u=Point(0,0)
th=math.pi*60/180
s.x=(2*a.x+1*b.x)/3
s.y=(2*a.y+1*b.y)/3
t.x=(1*a.x+2*b.x)/3
t.y=(1*a.y+2*b.y)/3
u.x=(t.x-... | [["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 33], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 72]] | 5 | 348 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.