buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; class Main { static int n; static double[] x1, y1, x2, y2; static double sx, sy, gx, gy; static ArrayList<Integer>[] g; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); ...
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; class Main { static int n; static double[] x1, y1, x2, y2; static double sx, sy, gx, gy; static ArrayList<Integer>[] g; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); ...
[["-", 0, 57, 75, 37, 0, 16, 31, 16, 17, 48], ["+", 0, 57, 75, 37, 0, 16, 31, 16, 17, 19], ["+", 0, 57, 75, 37, 0, 16, 31, 16, 12, 499], ["+", 8, 196, 0, 57, 75, 37, 0, 16, 17, 98], ["-", 8, 196, 0, 57, 75, 37, 0, 16, 17, 18], ["+", 0, 57, 75, 37, 0, 16, 12, 16, 17, 19]]
3
664
6
#include <bits/stdc++.h> #define ll long long //#define int long long #define inf 0x3f3f3f3f #define fi first #define se second #define pb push_back #define pa pair<int, int> #define mkp(a, b) make_pair(a, b) const int N = 2e5 + 10; const int mod = 998244353; using namespace std; struct Point { int x, y; Point() {...
#include <bits/stdc++.h> #define ll long long //#define int long long #define inf 0x3f3f3f3f #define fi first #define se second #define pb push_back #define pa pair<int, int> #define mkp(a, b) make_pair(a, b) const int N = 2e5 + 10; const int mod = 998244353; using namespace std; struct Point { int x, y; Point() {...
[["-", 51, 16, 31, 16, 31, 16, 31, 16, 17, 19], ["+", 51, 16, 31, 16, 31, 16, 31, 16, 17, 18], ["-", 51, 16, 31, 16, 31, 16, 12, 16, 17, 20], ["+", 51, 16, 31, 16, 31, 16, 12, 16, 17, 47], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 19], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 18], ["-", 0, 57, 15, 339, 51, 16, 12, 1...
1
573
8
#include <cmath> #include <complex> #include <iomanip> #include <iostream> using namespace std; typedef complex<double> xy; double eps = 1e-9; double dot_product(xy a, xy b) { return (conj(a) * b).real(); } double cross_product(xy a, xy b) { return (conj(a) * b).imag(); } xy projection(xy p, xy b) { return b * dot_prod...
#include <cmath> #include <complex> #include <iomanip> #include <iostream> using namespace std; typedef complex<double> xy; double eps = 1e-9; double dot_product(xy a, xy b) { return (conj(a) * b).real(); } double cross_product(xy a, xy b) { return (conj(a) * b).imag(); } xy projection(xy p, xy b) { return b * dot_prod...
[["-", 0, 37, 0, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 37, 0, 16, 31, 16, 31, 2, 63, 22], ["-", 0, 37, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 37, 0, 16, 31, 16, 12, 2, 63, 22], ["-", 0, 37, 0, 16, 12, 16, 31, 2, 63, 22], ["+", 0, 37, 0, 16, 12, 16, 31, 2, 63, 22]]
1
426
6
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) begin(a), end(a) #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> P; ty...
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) begin(a), end(a) #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> P; ty...
[["-", 0, 37, 0, 23, 0, 16, 31, 16, 17, 20], ["+", 0, 37, 0, 23, 0, 16, 31, 16, 17, 19], ["-", 0, 37, 0, 23, 0, 16, 12, 16, 17, 20], ["+", 0, 37, 0, 23, 0, 16, 12, 16, 17, 19]]
1
879
4
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; double eps = 1e-7; bool eq(double a, double b) { return (b - a < eps && a - b < eps); } double cross(P a, P b) { return real(b * conj(a)); } double dot(P a, P b) { return imag(b * conj(a)); } P project(P a, P b, P c) { b -= a; c -= a; return...
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; double eps = 1e-7; bool eq(double a, double b) { return (b - a < eps && a - b < eps); } double cross(P a, P b) { return real(b * conj(a)); } double dot(P a, P b) { return imag(b * conj(a)); } P project(P a, P b, P c) { b -= a; c -= a; return...
[["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 33]]
1
622
1
#include <bits/stdc++.h> #define _overload(_1, _2, _3, name, ...) name #define _rep(i, n) _range(i, 0, n) #define _range(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__) #define _rrep(i, n) _rrange(i, n, 0) #define _rrange(i, a, b) for (ll i = int(a) ...
#include <bits/stdc++.h> #define _overload(_1, _2, _3, name, ...) name #define _rep(i, n) _range(i, 0, n) #define _range(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__) #define _rrep(i, n) _rrange(i, n, 0) #define _rrange(i, a, b) for (ll i = int(a) ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 12, 22]]
1
1,257
6
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) //??? class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Poin...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) //??? class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Poin...
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22]]
1
1,415
2
#!/usr/bin/ruby def heappush(heap, item) heap.push(item) _siftdown(heap, 0, heap.size-1) end def heappop(heap) lastelt = heap.pop if !heap.empty? returnitem = heap[0] heap[0] = lastelt _siftup(heap, 0) else returnitem = lastelt end returnitem end def heappushpop(heap, item) if !heap.empty? && (heap[0]...
#!/usr/bin/ruby def heappush(heap, item) heap.push(item) _siftdown(heap, 0, heap.size-1) end def heappop(heap) lastelt = heap.pop if !heap.empty? returnitem = heap[0] heap[0] = lastelt _siftup(heap, 0) else returnitem = lastelt end returnitem end def heappushpop(heap, item) if !heap.empty? && (heap[0]...
[["+", 64, 749, 0, 652, 3, 4, 0, 748, 17, 33], ["+", 75, 95, 0, 652, 3, 4, 0, 748, 17, 33]]
4
352
2
import heapq q=[] b=True while b: n=input() if n=="end": b=False break elif n=="extract": i=heapq.heappop(q) print(-int(i)) else: a,b=n.split() b=int(b) heapq.heappush(q,-b)
import heapq q=[] bool1=True while bool1: n=input() if n=="end": bool1=False break elif n=="extract": i=heapq.heappop(q) print(-int(i)) else: a,b=n.split() b=int(b) heapq.heappush(q,-b)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 52, 15, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 15, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22]]
5
77
6
import sys from heapq import * H,O=[],[] for e in sys.stdin: c=e[1] if'n'==c:heappush(H,-int(e[7:])) elif'x'==c:O+=[-heappop(H)] print('\n'.join(map(str,O)))
import sys from heapq import * H,O=[],[] for e in sys.stdin: c=e[2] if's'==c:heappush(H,-int(e[7:])) elif't'==c:O+=[-heappop(H)] print('\n'.join(map(str,O)))
[["-", 8, 196, 0, 1, 0, 662, 12, 206, 206, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 206, 612], ["-", 8, 196, 0, 57, 15, 666, 0, 557, 0, 6], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 6], ["-", 0, 57, 75, 665, 15, 666, 0, 557, 0, 6], ["+", 0, 57, 75, 665, 15, 666, 0, 557, 0, 6]]
5
81
6
import java.util.Scanner; public class Main { static double EPS = 0.0000000001; public static void main(String[] args) { Scanner sc = new Scanner(System.in); Segment seg = new Segment(new Point(sc.nextInt(), sc.nextInt()), new Point(sc.nextInt(), sc.nextInt())); int q = ...
import java.util.Scanner; public class Main { static double EPS = 0.0000000001; public static void main(String[] args) { Scanner sc = new Scanner(System.in); Segment seg = new Segment(new Point(sc.nextInt(), sc.nextInt()), new Point(sc.nextInt(), sc.nextInt())); int q = ...
[["+", 0, 230, 3, 4, 0, 16, 12, 509, 500, 22], ["+", 0, 230, 3, 4, 0, 16, 12, 509, 0, 131]]
3
690
2
#include <bits/stdc++.h> using namespace std; using ld = long double; const ld eps = 1e-8, pi = acos(-1.0); bool eq(ld a, ld b) { return abs(a - b) < eps; } using Point = complex<ld>; class Line { public: Point a, b; }; class Circle { public: Point p; ld r; }; ld dot(Point a, Point b) { return real(conj(a) * ...
#include <bits/stdc++.h> using namespace std; using ld = long double; const ld eps = 1e-8, pi = acos(-1.0); bool eq(ld a, ld b) { return abs(a - b) < eps; } using Point = complex<ld>; class Line { public: Point a, b; }; class Circle { public: Point p; ld r; }; ld dot(Point a, Point b) { return real(conj(a) * ...
[["-", 0, 37, 0, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 37, 0, 16, 31, 16, 31, 2, 63, 22], ["-", 0, 37, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 37, 0, 16, 31, 16, 12, 2, 63, 22], ["-", 8, 9, 0, 37, 0, 16, 12, 2, 63, 22], ["+", 8, 9, 0, 37, 0, 16, 12, 2, 63, 22]]
1
679
6
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) //????????????????????????????????? //??????p0,p1,p2???????????? #define COUNTER_CLOCKWISE 1 //???????????§???????¨????????????´??? #de...
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) //????????????????????????????????? //??????p0,p1,p2???????????? #define COUNTER_CLOCKWISE 1 //???????????§???????¨????????????´??? #de...
[["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]]
1
1,451
2
#include <cmath> #include <iostream> using namespace std; const double EPS = 1e-8; int dcmp(double d) { if (fabs(d) < EPS) { return 0; } return d < 0 ? -1 : 1; } struct Vector { double x, y; Vector(double x = 0, double y = 0) : x(x), y(y) {} }; typedef Vector Point; double dot(const Vector &a, const...
#include <cmath> #include <iostream> using namespace std; const double EPS = 1e-8; int dcmp(double d) { if (fabs(d) < EPS) { return 0; } return d < 0 ? -1 : 1; } struct Vector { double x, y; Vector(double x = 0, double y = 0) : x(x), y(y) {} }; typedef Vector Point; double dot(const Vector &a, const...
[["-", 8, 9, 0, 37, 0, 16, 12, 16, 17, 18], ["+", 8, 9, 0, 37, 0, 16, 12, 16, 17, 19]]
1
547
2
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; // using ll=long long; const double EPS = 1e-10; inline bool equals(double a, double b) { return fabs(a - b) < EPS; } const double PI = 3.141592653589793238; class Point { public: double x, y; Point(double x, double y) : x(x), y(y) {} P...
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; // using ll=long long; const double EPS = 1e-10; inline bool equals(double a, double b) { return fabs(a - b) < EPS; } const double PI = 3.141592653589793238; class Point { public: double x, y; Point(double x, double y) : x(x), y(y) {} P...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
754
4
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> using namespace std; const double kEps = 1e-10; const double kInf = 1e15; int dcmp(double x) { if (fabs(x) < kEps) return 0; return x < 0 ? -1 : 1; } struct Vector { double x, y; Vector() {} Vector(double x, double y) : x(x),...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> using namespace std; const double kEps = 1e-10; const double kInf = 1e15; int dcmp(double x) { if (fabs(x) < kEps) return 0; return x < 0 ? -1 : 1; } struct Vector { double x, y; Vector() {} Vector(double x, double y) : x(x),...
[["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
1,321
5
#include <bits/stdc++.h> using namespace std; #define eps (1e-10) struct point { double x, y; point() {} point(double x, double y) : x(x), y(y) {} point operator+(point &p) { return point(x + p.x, y + p.y); } point operator-(point &p) { return point(x - p.x, y - p.y); } point operator*(double k) { return...
#include <bits/stdc++.h> using namespace std; #define eps (1e-10) struct point { double x, y; point() {} point(double x, double y) : x(x), y(y) {} point operator+(point &p) { return point(x + p.x, y + p.y); } point operator-(point &p) { return point(x - p.x, y - p.y); } point operator*(double k) { return...
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22]]
1
598
2
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); } template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; using D = double; const D PI = acos(D(-1)), E...
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); } template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; using D = double; const D PI = acos(D(-1)), E...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
1,441
5
class Point attr_reader :x, :y def initialize(x, y) @x = x @y = y end end class Line attr_reader :p1, :p2, :maxx, :minx, :maxy, :miny, :x, :y def initialize(x1, y1, x2, y2) @p1 = Point.new(x1, y1) @p2 = Point.new(x2, y2) @maxx = (x1 > x2)? x1 : x2 @minx = (x1 > x2)? x2 : x1 @maxy =...
class Point attr_reader :x, :y def initialize(x, y) @x = x @y = y end end class Line attr_reader :p1, :p2, :maxx, :minx, :maxy, :miny, :x, :y def initialize(x1, y1, x2, y2) @p1 = Point.new(x1, y1) @p2 = Point.new(x2, y2) @maxx = (x1 > x2)? x1 : x2 @minx = (x1 > x2)? x2 : x1 @maxy =...
[["-", 0, 4, 0, 738, 12, 739, 0, 738, 31, 22], ["+", 0, 4, 0, 738, 12, 739, 0, 738, 31, 22], ["-", 12, 738, 31, 739, 0, 738, 12, 652, 735, 22], ["+", 12, 738, 31, 739, 0, 738, 12, 652, 735, 22]]
4
591
4
require 'matrix' q = gets.to_i def cross(p1, p2) return p1[0] * p2[1] - p1[1] * p2[0] end q.times do p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y = gets.split.map &:to_i p0 = Vector[ p0x, p0y ] p1 = Vector[ p1x, p1y ] p2 = Vector[ p2x, p2y ] p3 = Vector[ p3x, p3y ] if cross(p1-p0, p2-p0) * cross(p1-p0, p3-p0...
require 'matrix' q = gets.to_i def cross(p1, p2) return p1[0] * p2[1] - p1[1] * p2[0] end q.times do p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y = gets.split.map &:to_i p0 = Vector[ p0x, p0y ] p1 = Vector[ p1x, p1y ] p2 = Vector[ p2x, p2y ] p3 = Vector[ p3x, p3y ] if cross(p1-p0, p2-p0) * cross(p1-p0, p3-p0...
[["-", 31, 739, 0, 738, 31, 738, 12, 738, 17, 47], ["+", 31, 739, 0, 738, 31, 738, 12, 738, 17, 20], ["-", 12, 739, 0, 738, 31, 738, 12, 738, 17, 47], ["+", 12, 739, 0, 738, 31, 738, 12, 738, 17, 20]]
4
339
8
from itertools import starmap def cross(a, b): return a.real * b.imag - a.imag * b.real q = int(input()) while q: q -= 1 p0, p1, p2, p3 = starmap(complex, zip(*[map(int, input().split())] * 2)) max_x1, min_x1 = (p0.real, p1.real) if p0.real > p1.real else (p1.real, p0.real) max_y1, min_y1 = (p0....
from itertools import starmap def cross(a, b): return a.real * b.imag - a.imag * b.real q = int(input()) while q: q -= 1 p0, p1, p2, p3 = starmap(complex, zip(*[map(int, input().split())] * 2)) max_x1, min_x1 = (p0.real, p1.real) if p0.real > p1.real else (p1.real, p0.real) max_y1, min_y1 = (p0....
[["-", 0, 662, 12, 41, 0, 660, 0, 319, 500, 22], ["+", 0, 662, 12, 41, 0, 660, 0, 319, 500, 22]]
5
279
8
class Line: def __init__(self,p1,p2): if p1[1] < p2[1]:self.s=p2;self.e=p1 elif p1[1] > p2[1]:self.s=p1;self.e=p2 else: if p1[0] < p2[0]:self.s=p1;self.e=p2 else:self.s=p2;self.e=p1 def dot(a,b):return a[0]*b[0] + a[1]*b[1] def cross(a,b):return a[0]*b[1] - a[1]*b[0] ...
class Line: def __init__(self,p1,p2): if p1[1] < p2[1]:self.s=p2;self.e=p1 elif p1[1] > p2[1]:self.s=p1;self.e=p2 else: if p1[0] < p2[0]:self.s=p1;self.e=p2 else:self.s=p2;self.e=p1 def dot(a,b):return a[0]*b[0] + a[1]*b[1] def cross(a,b):return a[0]*b[1] - a[1]*b[0] ...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
516
6
from math import sqrt q = int(input()) def norm(a): return sqrt(a[0] ** 2 + a[1] ** 2) def dot(a, b): return sum([i * j for i,j in zip(a, b)]) def sub(a, b): return [a[0] - b[0],a[1] - b[1]] def cross(a, b): return a[0] * b[1] - a[1] * b[0] def ccw(a, b, c): x = sub(b, a) y = sub(c, a) ...
from math import sqrt q = int(input()) def norm(a): return sqrt(a[0] ** 2 + a[1] ** 2) def dot(a, b): return sum([i * j for i,j in zip(a, b)]) def sub(a, b): return [a[0] - b[0],a[1] - b[1]] def cross(a, b): return a[0] * b[1] - a[1] * b[0] def ccw(a, b, c): x = sub(b, a) y = sub(c, a) ...
[["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22]]
5
322
4
import java.io.IOException; import java.io.InputStream; import java.text.DecimalFormat; import java.util.NoSuchElementException; public class Main { static FastScanner sc = new FastScanner(); public static void main(String[] args) { int q = sc.nextInt(); StringBuilder ans = new StringBuilder(); for (...
import java.io.IOException; import java.io.InputStream; import java.text.DecimalFormat; import java.util.NoSuchElementException; public class Main { static FastScanner sc = new FastScanner(); public static void main(String[] args) { int q = sc.nextInt(); StringBuilder ans = new StringBuilder(); for (...
[["-", 0, 492, 3, 4, 0, 492, 3, 4, 0, 22], ["+", 0, 492, 3, 4, 0, 492, 3, 4, 0, 22]]
3
644
2
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) #define reg(i, a, b) for (int i = ((int)(a)); i <= ((int)(b)); i++)...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) #define reg(i, a, b) for (int i = ((int)(a)); i <= ((int)(b)); i++)...
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22]]
1
1,987
6
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, a, n) for (int i = n - 1; i >= a; i--) #define pb push_back #define mp make...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, a, n) for (int i = n - 1; i >= a; i--) #define pb push_back #define mp make...
[["-", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["-", 12, 23, 0, 16, 12, 23, 0, 16, 31, 22], ["-", 12, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["-", 0, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+"...
1
1,330
12
#include <bits/stdc++.h> using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; #define P(x) cout << (x) << "\n" #define p(x) cout << (x) #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() #define vv(type, c, m, n, i) vector<vector<type>> c(m...
#include <bits/stdc++.h> using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; #define P(x) cout << (x) << "\n" #define p(x) cout << (x) #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() #define vv(type, c, m, n, i) vector<vector<type>> c(m...
[["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 44], ["+", 8, 9, 0, 9, 0, 1, 0, 16, 12, 22]]
1
1,512
8
#include <cmath> #include <iomanip> #include <iostream> using namespace std; const double EPS = 1e-8; int dcmp(double d) { if (fabs(d) < EPS) { return 0; } return d < 0 ? -1 : 1; } struct Vector { double x, y; Vector(double x = 0, double y = 0) : x(x), y(y) {} }; typedef Vector Point; double dot(con...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; const double EPS = 1e-8; int dcmp(double d) { if (fabs(d) < EPS) { return 0; } return d < 0 ? -1 : 1; } struct Vector { double x, y; Vector(double x = 0, double y = 0) : x(x), y(y) {} }; typedef Vector Point; double dot(con...
[["-", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120]]
1
676
2
# -*- coding: utf-8 -*- import collections import math class Vector2(collections.namedtuple("Vector2", ["x", "y"])): def __add__(self, other): return Vector2(self.x + other.x, self.y + other.y) def __sub__(self, other): return Vector2(self.x - other.x, self.y - other.y) def __mul__(se...
# -*- coding: utf-8 -*- import collections import math class Vector2(collections.namedtuple("Vector2", ["x", "y"])): def __add__(self, other): return Vector2(self.x + other.x, self.y + other.y) def __sub__(self, other): return Vector2(self.x - other.x, self.y - other.y) def __mul__(se...
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22]]
5
691
4
import java.util.Scanner; public class Main { static double EPS = 0.0000000001; static double getDistance(Point p1, Point p2) { return p1.diff(p2).abs(); } static double getDistance(Line l, Point p) { return l.p2.diff(l.p1).crossProduct(p.diff(l.p1)) / l.p2.diff(l.p1).abs(); } static double getDistance(S...
import java.util.Scanner; /* 1 0 0 4 0 0 -1 0 -2 */ public class Main { static double EPS = 0.0000000001; static double getDistance(Point p1, Point p2) { return p1.diff(p2).abs(); } static double getDistance(Line l, Point p) { return Math.abs(l.p2.diff(l.p1).crossProduct(p.diff(l.p1))) / l.p2.diff(l...
[["+", 8, 196, 0, 37, 0, 16, 31, 492, 500, 22], ["+", 8, 196, 0, 37, 0, 16, 31, 492, 0, 131], ["+", 8, 196, 0, 37, 0, 16, 31, 492, 141, 22], ["+", 0, 37, 0, 16, 31, 492, 3, 4, 0, 24], ["+", 0, 492, 3, 4, 0, 492, 3, 4, 0, 25]]
3
1,219
5
#include <bits/stdc++.h> using namespace std; #define EPS 1e-10 #define equals(a, b) (fabs((a) - (b)) < EPS) typedef struct point { double x, y; point(){}; point(double x, double y) : x(x), y(y){}; point operator+(point &p) { return point(x + p.x, y + p.y); } point operator-(point &p) { return point(x - p.x, ...
#include <bits/stdc++.h> using namespace std; #define EPS 1e-10 #define equals(a, b) (fabs((a) - (b)) < EPS) typedef struct point { double x, y; point(){}; point(double x, double y) : x(x), y(y){}; point operator+(point &p) { return point(x + p.x, y + p.y); } point operator-(point &p) { return point(x - p.x, ...
[["+", 0, 37, 0, 23, 0, 16, 12, 16, 17, 19], ["+", 0, 37, 0, 23, 0, 16, 12, 16, 12, 13]]
1
1,269
2
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8, PI = acos(-1); inline bool eq(double a, double b) { return abs(b - a) < EPS; } #define curr(P, i) P[i] #define next(P, i) P[(i + 1) % P.size()] #define prev(P, i) P[(i + P.size() - 1) % P.size()] enum { OUT, ON, IN }; struct Geometory { // Geometo...
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8, PI = acos(-1); inline bool eq(double a, double b) { return abs(b - a) < EPS; } #define curr(P, i) P[i] #define next(P, i) P[(i + 1) % P.size()] #define prev(P, i) P[(i + P.size() - 1) % P.size()] enum { OUT, ON, IN }; struct Geometory { // Geometo...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 28, 22], ["-", 63, 118, 28, 23, 0, 16, 31, 118, 119, 120], ["+", 63, 118, 28, 23, 0, 16, 31, 118, 119, 120]]
1
2,924
7
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> using namespace std; #define equals(a, b) (fabs((a) - (b)) < EPS) const double EPS = (1e-10); class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p....
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> using namespace std; #define equals(a, b) (fabs((a) - (b)) < EPS) const double EPS = (1e-10); class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p....
[["-", 3, 4, 0, 2, 3, 4, 0, 118, 119, 120], ["+", 3, 4, 0, 2, 3, 4, 0, 118, 119, 120]]
1
888
2
#include <bits/stdc++.h> using namespace std; const int dx[] = {0, 1, 0, -1, 1, -1, -1, 1}; const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1}; const int INF = 1 << 30; const double EPS = 1e-15; #define PB push_back #define mk make_pair #define fi first #define se second #define ll long long #define reps(i, j, k) for (int i ...
#include <bits/stdc++.h> using namespace std; const int dx[] = {0, 1, 0, -1, 1, -1, -1, 1}; const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1}; const int INF = 1 << 30; const double EPS = 1e-8; #define PB push_back #define mk make_pair #define fi first #define se second #define ll long long #define reps(i, j, k) for (int i =...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
2,448
4
#include <algorithm> #include <array> #include <climits> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define ALL(v) (v).begin(), (v).end() #define REP(i, p, n) for (int i ...
#include <algorithm> #include <array> #include <climits> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define ALL(v) (v).begin(), (v).end() #define REP(i, p, n) for (int i ...
[["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 25], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
1,697
4
#include <bits/stdc++.h> using namespace std; namespace arithmetic { template <typename T> class Addition { public: template <typename V> T operator+(const V &v) const { return T(static_cast<const T &>(*this)) += v; } }; template <typename T> class Subtraction { public: template <typename V> T operator-(co...
#include <bits/stdc++.h> using namespace std; namespace arithmetic { template <typename T> class Addition { public: template <typename V> T operator+(const V &v) const { return T(static_cast<const T &>(*this)) += v; } }; template <typename T> class Subtraction { public: template <typename V> T operator-(co...
[["-", 3, 4, 0, 2, 3, 4, 0, 118, 119, 120], ["+", 3, 4, 0, 2, 3, 4, 0, 118, 119, 120]]
1
2,460
4
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; double eps = 1e-7; bool eq(double a, double b) { return (b - a < eps && a - b < eps); } double cross(P a, P b) { return real(b * conj(a)); } double dot(P a, P b) { return imag(b * conj(a)); } P project(P a, P b, P c) { b -= a; c -= a; return...
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; double eps = 1e-7; bool eq(double a, double b) { return (b - a < eps && a - b < eps); } double cross(P a, P b) { return imag(b * conj(a)); } double dot(P a, P b) { return real(b * conj(a)); } P project(P a, P b, P c) { b -= a; c -= a; return...
[["-", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22]]
1
642
4
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) //??? class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Poin...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) //??? class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Poin...
[["-", 0, 37, 0, 2, 3, 4, 0, 118, 119, 120], ["+", 0, 37, 0, 2, 3, 4, 0, 118, 119, 120]]
1
1,447
2
#include <algorithm> #include <cmath> #include <cstdio> using namespace std; #define EPS (1e-10) #define equals(A, B) (fabs((A) - (B)) < EPS) class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point...
#include <algorithm> #include <cmath> #include <cstdio> using namespace std; #define EPS (1e-10) #define equals(A, B) (fabs((A) - (B)) < EPS) class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point...
[["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 25]]
1
1,015
3
#include <algorithm> #include <array> #include <cmath> #include <iomanip> #include <iostream> using Number = double; const Number EPS = 1e-10; const Number INF = 1e10; const Number PI = acos(-1.0); inline int sign(Number x) { return (x < -EPS) ? -1 : (x > EPS) ? +1 : 0; } inline bool equal(Number a, Number b) { retu...
#include <algorithm> #include <array> #include <cmath> #include <iomanip> #include <iostream> using Number = double; const Number EPS = 1e-10; const Number INF = 1e10; const Number PI = acos(-1.0); inline int sign(Number x) { return (x < -EPS) ? -1 : (x > EPS) ? +1 : 0; } inline bool equal(Number a, Number b) { retu...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 28, 22]]
1
2,036
5
#include <algorithm> // min() #include <cmath> // fabs(), sqrt() #include <cstdio> // printf(), scanf() using namespace std; #define equals(a, b) (fabs((a) - (b)) < EPS) static const double EPS = 1e-10; static const int COUNTER_CLOCKWISE = 1; static const int CLOCKWISE = -1; static const int ONLINE_BACK = 2; s...
#include <algorithm> // min() #include <cmath> // fabs(), sqrt() #include <cstdio> // printf(), scanf() using namespace std; #define equals(a, b) (fabs((a) - (b)) < EPS) static const double EPS = 1e-10; static const int COUNTER_CLOCKWISE = 1; static const int CLOCKWISE = -1; static const int ONLINE_BACK = 2; s...
[["-", 31, 2, 3, 4, 0, 16, 31, 118, 119, 120], ["+", 31, 2, 3, 4, 0, 16, 31, 118, 119, 120]]
1
808
2
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef complex<double> V; typedef vector<P> vecP; typedef pair<P, P> L; typedef pair<P, P> S; typedef pair<P, double> C; const double eps = 1e-8; const double PI = acos(-1); const double PI2 = PI * 2.0; namespace std { bool operator<(const P &a,...
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef complex<double> V; typedef vector<P> vecP; typedef pair<P, P> L; typedef pair<P, P> S; typedef pair<P, double> C; const double eps = 1e-8; const double PI = acos(-1); const double PI2 = PI * 2.0; namespace std { bool operator<(const P &a,...
[["-", 3, 4, 0, 2, 3, 4, 0, 118, 28, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 118, 28, 22]]
1
3,527
2
#include <bits/stdc++.h> using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; #define P(x) cout << (x) << "\n" #define p(x) cout << (x) #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() #define vv(type, c, m, n, i) vector<vector<type>> c(m...
#include <bits/stdc++.h> using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; #define P(x) cout << (x) << "\n" #define p(x) cout << (x) #define all(c) (c).begin(), (c).end() #define rall(c) (c).rbegin(), (c).rend() #define vv(type, c, m, n, i) vector<vector<type>> c(m...
[["-", 31, 2, 3, 4, 0, 16, 12, 118, 119, 120], ["+", 31, 2, 3, 4, 0, 16, 12, 118, 119, 120], ["-", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67]]
1
873
4
// #include {{{ #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector>...
// #include {{{ #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector>...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38]]
1
1,019
5
#include <cmath> #include <iomanip> #include <iostream> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORR(i, a, b) for (int i = (a); i >= (b); i--) typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const double EPS = 1e-9; struct Vector { double x, y; Vecto...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORR(i, a, b) for (int i = (a); i >= (b); i--) typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const double EPS = 1e-9; struct Vector { double x, y; Vecto...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
988
2
#include <cmath> #include <iomanip> #include <iostream> using namespace std; struct Point { double x; double y; Point(double x, double y) : x(x), y(y) {} Point operator-(Point p) { return Point(x - p.x, y - p.y); } }; typedef Point Vector; double dot(Vector v1, Vector v2) { return v1.x * v2.x + v1.y * v2.y; } ...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; struct Point { double x; double y; Point(double x, double y) : x(x), y(y) {} Point operator-(Point p) { return Point(x - p.x, y - p.y); } }; typedef Point Vector; double dot(Vector v1, Vector v2) { return v1.x * v2.x + v1.y * v2.y; } ...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]]
1
779
3
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; //点を表す構造体 class Point { public: double x, y; Point(double x = 0, double y = 0) { this->x = x; this->y = y; } Point operat...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; //点を表す構造体 class Point { public: double x, y; Point(double x = 0, double y = 0) { this->x = x; this->y = y; } Point operat...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
1,514
2
def is_intersection(x0, y0, x1, y1, x2, y2, x3, y3) if x0 < x1 && ((x2 < x0 && x3 < x0) || (x1 < x2 && x1 < x3)) return false elsif x1 <= x0 && ((x2 < x1 && x3 < x1) || (x0 < x2 && x0 < x3)) return false elsif y0 < y1 && ((y2 < y0 && y3 < y0) || (y1 < y2 && y1 < y3)) return false elsif y1 <= y0 && (...
def is_intersection(x0, y0, x1, y1, x2, y2, x3, y3) if x0 < x1 && ((x2 < x0 && x3 < x0) || (x1 < x2 && x1 < x3)) return false elsif x1 <= x0 && ((x2 < x1 && x3 < x1) || (x0 < x2 && x0 < x3)) return false elsif y0 < y1 && ((y2 < y0 && y3 < y0) || (y1 < y2 && y1 < y3)) return false elsif y1 <= y0 && (...
[["-", 0, 121, 75, 95, 0, 38, 0, 4, 0, 146], ["+", 0, 121, 75, 95, 0, 38, 0, 4, 0, 147], ["-", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["-", 8, 734, 0, 121, 75, 95, 0, 652, 735, 22], ["+", 8, 734, 0, 121, 75, 95, 0, 652, 735, 22]]
4
576
6
from sys import stdin import math EPS = 1e-10 class Vector: def __init__(self, x=None, y=None): self.x = x self.y = y def __add__(self, other): return Vector(self.x + other.x, self.y + other.y) def __sub__(self, other): return Vector(self.x - other.x, self.y - other.y) ...
from sys import stdin import math EPS = 1e-10 class Vector: def __init__(self, x=None, y=None): self.x = x self.y = y def __add__(self, other): return Vector(self.x + other.x, self.y + other.y) def __sub__(self, other): return Vector(self.x - other.x, self.y - other.y) ...
[["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 0, 612]]
5
974
2
from sys import stdin readline = stdin.readline def main(): q = int(readline()) for i in range(q): xy = map(int, readline().split()) p0, p1, p2, p3 = [x + y * 1j for x, y in zip(*[xy] * 2)] print('{:.10f}'.format(distance(p0, p1, p2, p3))) def lt(a, b): if a.real != b.real: ...
from sys import stdin readline = stdin.readline def main(): q = int(readline()) for i in range(q): xy = map(int, readline().split()) p0, p1, p2, p3 = [x + y * 1j for x, y in zip(*[xy] * 2)] print('{:.10f}'.format(distance(p0, p1, p2, p3))) def lt(a, b): if a.real != b.real: ...
[["-", 0, 57, 64, 196, 0, 37, 0, 666, 667, 18], ["+", 0, 57, 64, 196, 0, 37, 0, 666, 667, 19], ["-", 31, 23, 0, 679, 31, 652, 3, 4, 0, 22], ["+", 31, 23, 0, 679, 31, 652, 3, 4, 0, 22], ["-", 31, 23, 0, 679, 12, 652, 3, 4, 0, 22], ["+", 31, 23, 0, 679, 12, 652, 3, 4, 0, 22], ["-", 12, 23, 0, 679, 31, 652, 3, 4, 0, 22], ...
5
623
10
from math import sqrt for t in range(eval(input())): x0, y0, x1, y1, x2, y2, x3, y3 = list(map(int, input().split())) dx0 = x1 - x0 dy0 = y1 - y0 dx1 = x3 - x2 dy1 = y3 - y2 s = (y0-y2)*dx1 - (x0-x2)*dy1 sm = dx0*dy1 - dy0*dx1 if s < 0: s = -s sm = -sm t = (y2-y0)*dx...
from math import sqrt for t in range(eval(input())): x0, y0, x1, y1, x2, y2, x3, y3 = list(map(int, input().split())) dx0 = x1 - x0 dy0 = y1 - y0 dx1 = x3 - x2 dy1 = y3 - y2 s = (y0-y2)*dx1 - (x0-x2)*dy1 sm = dx0*dy1 - dy0*dx1 if s < 0: s = -s sm = -sm t = (y2-y0)*dx...
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22]]
5
694
1
from math import sqrt q = int(input()) class Segment(): pass def dot(a, b): return sum([i * j for i,j in zip(a, b)]) def sub(a, b): return [a[0] - b[0],a[1] - b[1]] def cross(a, b): return a[0] * b[1] - a[1] * b[0] def norm(a): return sqrt(a[0] ** 2 + a[1] ** 2) def ccw(a, b, c): x = sub(b, a...
from math import sqrt q = int(input()) class Segment(): pass def dot(a, b): return sum([i * j for i,j in zip(a, b)]) def sub(a, b): return [a[0] - b[0],a[1] - b[1]] def cross(a, b): return a[0] * b[1] - a[1] * b[0] def norm(a): return sqrt(a[0] ** 2 + a[1] ** 2) def ccw(a, b, c): x = sub(b, a...
[["-", 0, 37, 0, 679, 31, 666, 0, 657, 17, 578], ["+", 0, 37, 0, 679, 31, 666, 0, 657, 17, 48], ["-", 0, 37, 0, 679, 12, 666, 0, 657, 17, 578], ["+", 0, 37, 0, 679, 12, 666, 0, 657, 17, 48]]
5
558
4
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String... args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int x[] = new int[n]; int y[] = new int[n];...
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String... args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int x[] = new int[n]; int y[] = new int[n];...
[["-", 0, 7, 8, 196, 0, 1, 0, 27, 0, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 27, 0, 29], ["-", 8, 196, 0, 7, 8, 196, 0, 1, 0, 35]]
3
230
3
#include <math.h> #include <stdio.h> #define EPS 0.0000000002 #define MAX 1010001000 typedef struct point { double x, y; } point; typedef struct line { point st, en; } line; double norm(point a); double norm2(point a); double distans(point a, point b); point sum_vector(point a, point b); point diff_vector(point ...
#include <math.h> #include <stdio.h> #define EPS 0.0000000002 #define MAX 1010001000 typedef struct point { double x, y; } point; typedef struct line { point st, en; } line; double norm(point a); double norm2(point a); double distans(point a, point b); point sum_vector(point a, point b); point diff_vector(point ...
[["-", 12, 2, 3, 4, 0, 69, 71, 16, 17, 72], ["+", 12, 2, 3, 4, 0, 69, 71, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
1,458
4
#define cross(a1, b1, a2, b2) ((a1) * (b2) - (a2) * (b1)) int main() { double a[100], b[100], s, t, x; int n, c = 1, i; for (; ~scanf("%d", &n); printf("%d %.1lf\n", c, fabs(s - t)), c++) { for (i = 0; i < n; i++) scanf("%lf%lf", a + i, b + i); for (i = s = t = 0; i < n - 1; i++) { if ((x = cr...
#define cross(a1, b1, a2, b2) ((a1) * (b2) - (a2) * (b1)) int main() { double a[100], b[100], s, t, x; int n, c = 1, i; for (; ~scanf("%d", &n); printf("%.1lf\n", fabs(s - t)), c++) { for (i = 0; i < n; i++) scanf("%lf%lf", a + i, b + i); for (i = s = t = 0; i < n - 1; i++) { if ((x = cross(a[...
[["-", 26, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 26, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 7, 26, 34, 31, 2, 3, 4, 0, 21], ["-", 0, 7, 26, 34, 31, 2, 3, 4, 0, 22]]
0
238
4
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < (int)b; i++) #define rep(i, n) REP(i, 0, n) int main() { int N; cin >> N; double x[N], y[N]; rep(i, N) { cin >> x[i] >> y[i]; } double sum = 0; rep(i, N) { sum += (x[i] - x[(i + 1) % N]) * (y[i] + y[(i + 1) % N]); }...
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < (int)b; i++) #define rep(i, n) REP(i, 0, n) int main() { int N; cin >> N; double x[N], y[N]; rep(i, N) { cin >> x[i] >> y[i]; } double sum = 0; rep(i, N) { sum += (x[i] - x[(i + 1) % N]) * (y[i] + y[(i + 1) % N]); }...
[["-", 0, 2, 3, 4, 0, 16, 31, 91, 17, 33]]
1
135
1
#include <bits/stdc++.h> using namespace std; const int dx[] = {0, 1, 0, -1, 1, -1, -1, 1}; const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1}; const int INF = 1 << 30; const double EPS = 1e-15; #define PB push_back #define mk make_pair #define fi first #define se second #define ll long long #define reps(i, j, k) for (int i ...
#include <bits/stdc++.h> using namespace std; const int dx[] = {0, 1, 0, -1, 1, -1, -1, 1}; const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1}; const int INF = 1 << 30; const double EPS = 1e-15; #define PB push_back #define mk make_pair #define fi first #define se second #define ll long long #define reps(i, j, k) for (int i ...
[["-", 8, 9, 0, 37, 0, 16, 31, 2, 63, 22], ["-", 0, 37, 0, 16, 31, 2, 3, 4, 0, 24], ["-", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
897
3
#include <algorithm> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <vector> using namespace std; template <class T> ostream &operator<<(ostream &os, const vector<T> &vs) { if (vs.empty()) return os << "[]"; os << "[" << vs[0]; for (int i = 1; i < vs.size(); i++) os ...
#include <algorithm> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <vector> using namespace std; template <class T> ostream &operator<<(ostream &os, const vector<T> &vs) { if (vs.empty()) return os << "[]"; os << "[" << vs[0]; for (int i = 1; i < vs.size(); i++) os ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
575
2
#include <bits/stdc++.h> #define f first #define s second #define mp make_pair #define eps (1e-11) #define equals(a, b) (fabs((a) - (b)) < eps) using namespace std; class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } ...
#include <bits/stdc++.h> #define f first #define s second #define mp make_pair #define eps (1e-11) #define equals(a, b) (fabs((a) - (b)) < eps) using namespace std; class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
433
2
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; // ------ Classes ------ // class Point { public: long double px, py; Point() : px(0), py(0){}; Point(long double px_, long double py_) : px(px_), py(py_){}; friend bool operator==(const Point &p1, const Point &p2) ...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; // ------ Classes ------ // class Point { public: long double px, py; Point() : px(0), py(0){}; Point(long double px_, long double py_) : px(px_), py(py_){}; friend bool operator==(const Point &p1, const Point &p2) ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
790
2
#include <bits/stdc++.h> using namespace std; typedef double ll; struct Point { ll x, y; Point() { x = y = 0.0; } Point(ll _x, ll _y) : x(_x), y(_y) {} Point operator+(Point p) { return Point(p.x + x, p.y + y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } ll operator*(Point p) { retu...
#include <bits/stdc++.h> using namespace std; typedef double ll; struct Point { ll x, y; Point() { x = y = 0.0; } Point(ll _x, ll _y) : x(_x), y(_y) {} Point operator+(Point p) { return Point(p.x + x, p.y + y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } ll operator*(Point p) { retu...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
326
2
#include <math.h> #include <stdio.h> #include <stdlib.h> #define max(a, b) a < b ? b : a #define min(a, b) a < b ? a : b #define POW2(a) a *a #define ROOP(i, n) for (i = 0; i < n; i++) #define _USE_MATH_DEFINES typedef struct POINT { double x; double y; } POINT; typedef struct LINE { POINT s; // start point PO...
#include <math.h> #include <stdio.h> #include <stdlib.h> #define max(a, b) a < b ? b : a #define min(a, b) a < b ? a : b #define POW2(a) a *a #define ROOP(i, n) for (i = 0; i < n; i++) #define _USE_MATH_DEFINES typedef struct POINT { double x; double y; } POINT; typedef struct LINE { POINT s; // start point PO...
[["+", 31, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 31, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
0
2,006
2
#include <bits/stdc++.h> #define f first #define s second #define mp make_pair #define pi M_PI #define inf 1 << 30 #define eps (1e-11) #define equals(a, b) (fabs((a) - (b)) < eps) using namespace std; class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) {...
#include <bits/stdc++.h> #define f first #define s second #define mp make_pair #define pi M_PI #define inf 1 << 30 #define eps (1e-11) #define equals(a, b) (fabs((a) - (b)) < eps) using namespace std; class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) {...
[["+", 51, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 51, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
528
4
#include <iostream> using namespace std; #include <cmath> #include <cstdio> int main() { double dx, dy, d; double c1x, c1y, c1r, c2x, c2y, c2r; scanf("%lf %lf %lf %lf %lf %lf", &c1x, &c1y, &c1r, &c2x, &c2y, &c2r); dx = c1x - c2x; dy = c1y - c2y; d = sqrt(dx * dx + dy * dy); if (d < c1r + c2r) { print...
#include <iostream> using namespace std; #include <cmath> #include <cstdio> int main() { double dx, dy, d; double c1x, c1y, c1r, c2x, c2y, c2r; scanf("%lf %lf %lf %lf %lf %lf", &c1x, &c1y, &c1r, &c2x, &c2y, &c2r); dx = c1x - c2x; dy = c1y - c2y; d = sqrt(dx * dx + dy * dy); if (d > c1r + c2r) { print...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
190
2
#include <bits/stdc++.h> using namespace std; typedef complex<double> Point; struct Segment { Point p1, p2; Segment(const Point &p1 = Point(), const Point &p2 = Point()) : p1(p1), p2(p2) {} }; struct Circle { Point p; double r; Circle(const Point &p = Point(), double r = 0.0) : p(p), r(r) {} }; type...
#include <bits/stdc++.h> using namespace std; typedef complex<double> Point; struct Segment { Point p1, p2; Segment(const Point &p1 = Point(), const Point &p2 = Point()) : p1(p1), p2(p2) {} }; struct Circle { Point p; double r; Circle(const Point &p = Point(), double r = 0.0) : p(p), r(r) {} }; type...
[["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
1,604
1
#include <cmath> #include <cstdio> #include <iostream> #include <vector> #define f first #define s second #define mp make_pair #define eps (1e-11) #define equals(a, b) (fabs((a) - (b)) < eps) using namespace std; class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator...
#include <cmath> #include <cstdio> #include <iostream> #include <vector> #define f first #define s second #define mp make_pair #define eps (1e-11) #define equals(a, b) (fabs((a) - (b)) < eps) using namespace std; class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
1,393
2
#include <bits/stdc++.h> using namespace std; using ld = long double; const ld eps = 1e-8, pi = acos(-1.0); bool eq(ld a, ld b) { return abs(a - b) < eps; } using Point = complex<ld>; class Line { public: Point a, b; }; ld dot(Point a, Point b) { return real(conj(a) * b); } ld cross(Point a, Point b) { return ima...
#include <bits/stdc++.h> using namespace std; using ld = long double; const ld eps = 1e-8, pi = acos(-1.0); bool eq(ld a, ld b) { return abs(a - b) < eps; } using Point = complex<ld>; class Line { public: Point a, b; }; ld dot(Point a, Point b) { return real(conj(a) * b); } ld cross(Point a, Point b) { return ima...
[["-", 15, 16, 31, 16, 12, 2, 63, 118, 28, 22], ["+", 15, 16, 31, 16, 12, 2, 63, 118, 28, 22]]
1
1,438
2
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef complex<double> V; typedef vector<P> vecP; typedef pair<P, P> L; typedef pair<P, P> S; typedef pair<P, double> C; const double eps = 1e-8; const double PI = acos(-1); const double PI2 = PI * 2.0; namespace std { bool operator<(const P &a,...
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef complex<double> V; typedef vector<P> vecP; typedef pair<P, P> L; typedef pair<P, P> S; typedef pair<P, double> C; const double eps = 1e-8; const double PI = acos(-1); const double PI2 = PI * 2.0; namespace std { bool operator<(const P &a,...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
3,693
2
#include <bits/stdc++.h> using namespace std; // point typedef complex<double> P; namespace std { bool operator<(const P &a, const P &b) { return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b); } bool cmp_y(const P &a, const P &b) { return a.imag() != b.imag() ? a.imag() < b.imag() : a.real() < b.real(...
#include <bits/stdc++.h> using namespace std; // point typedef complex<double> P; namespace std { bool operator<(const P &a, const P &b) { return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b); } bool cmp_y(const P &a, const P &b) { return a.imag() != b.imag() ? a.imag() < b.imag() : a.real() < b.real(...
[["+", 49, 50, 51, 16, 31, 16, 12, 2, 63, 22]]
1
715
1
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define INF 1 << 30 #define LINF 1LL << 60 typedef long double ld; typedef complex<ld> Point; const ld eps = 1e-9, pi = acos(-1.0); namespace std { bool operator<(const Point &lhs, const Point &rhs...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define INF 1 << 30 #define LINF 1LL << 60 typedef long double ld; typedef complex<ld> Point; const ld eps = 1e-9, pi = acos(-1.0); namespace std { bool operator<(const Point &lhs, const Point &rhs...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]]
1
1,440
2
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main() { double cx = 0, cy = 0, r = 0; int q = 0; int x1 = 0, y1 = 0, x2 = 0, y2 = 0; cin >> cx >> cy >> r >> q; for (int i = 0; i < q; i++) { cin >> x1 >> y1 >> x2 >> y2; double a = 0, b = 0, s = 0, t = 0, u = 0, v1 ...
#include <cmath> #include <iomanip> #include <iostream> using namespace std; int main() { double cx = 0, cy = 0, r = 0; int q = 0; double x1 = 0, y1 = 0, x2 = 0, y2 = 0; cin >> cx >> cy >> r >> q; for (int i = 0; i < q; i++) { cin >> x1 >> y1 >> x2 >> y2; double a = 0, b = 0, s = 0, t = 0, u = 0, ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
362
2
#include <cmath> #include <cstdio> #include <iostream> using namespace std; typedef long long ll; ll read() { ll x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar...
#include <cmath> #include <cstdio> #include <iostream> using namespace std; typedef long long ll; ll read() { ll x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar...
[["-", 0, 37, 0, 16, 31, 16, 12, 118, 28, 22], ["+", 0, 37, 0, 16, 31, 16, 12, 118, 28, 22], ["-", 0, 37, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 37, 0, 16, 31, 16, 12, 118, 119, 120]]
1
684
4
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG_MODE #define DBG(n) n; #else #define DBG(n) ; #endif #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define rep(i, s, g) for (ll(i) = (s); (i) < (g); ++i) #define rrep(i, s, g) for (ll(i) = (s); i >= (g); --(i)) #define PB push_back #define MP make_pair ...
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG_MODE #define DBG(n) n; #else #define DBG(n) ; #endif #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define rep(i, s, g) for (ll(i) = (s); (i) < (g); ++i) #define rrep(i, s, g) for (ll(i) = (s); i >= (g); --(i)) #define PB push_back #define MP make_pair ...
[["-", 15, 339, 51, 41, 15, 16, 31, 118, 119, 120], ["-", 0, 57, 15, 339, 51, 41, 15, 16, 17, 60], ["+", 15, 339, 51, 41, 15, 16, 31, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 41, 15, 16, 17, 79], ["-", 15, 339, 51, 41, 15, 16, 12, 118, 119, 120], ["+", 15, 339, 51, 41, 15, 16, 12, 118, 119, 120]]
1
2,656
6
#include <algorithm> #include <bitset> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> #define _USE_MATH_DEFINES using namespace std; typedef long long ll; ...
#include <algorithm> #include <bitset> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> #define _USE_MATH_DEFINES using namespace std; typedef long long ll; ...
[["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]]
1
797
4
from functools import reduce def cross(a, b): return a.real * b.imag - a.imag * b.real def graham_scan(points): points.sort(key=lambda p: (p.real, p.imag)) lh = reduce(keep_left, points, []) uh = reduce(keep_left, reversed(points), []) lh.extend(uh[1:-1]) return lh def keep_left(hull, r): ...
from functools import reduce def cross(a, b): return a.real * b.imag - a.imag * b.real def graham_scan(points): points.sort(key=lambda p: (p.imag, p.real)) lh = reduce(keep_left, points, []) uh = reduce(keep_left, reversed(points), []) lh.extend(uh[1:-1]) return lh def keep_left(hull, r): ...
[["-", 0, 653, 51, 670, 8, 660, 0, 319, 319, 22], ["+", 0, 653, 51, 670, 8, 660, 0, 319, 319, 22]]
5
245
4
def isCLKWISE(ph): if (ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) > 0 : return True return False def ConvexHullScan(P): P = sorted(P) phU = [P[0],P[1]] for p in P[2:]: phU.append(p) while(True): if isCLKWIS...
#CGL_4-A Convex Polygon - Convex Hull def isCLKWISE(ph): if (ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0 : return False return True def ConvexHullScan(P): P = sorted(P) phU = [P[0],P[1]] for p in P[2:]: phU.append(p) ...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 146], ["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38], ["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 146]]
5
368
2
def isCLKWISE(ph): if (ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) > 0 : return True return False def ConvexHullScan(P): P = sorted(P) phU = [P[0],P[1]] for p in P[2:]: phU.append(p) while(True): if isCLKWIS...
def isCLKWISE(ph): if (ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) >= 0 : return True return False def ConvexHullScan(P): P = sorted(P) phU = [P[0],P[1]] for p in P[2:]: phU.append(p) while(True): if isCLKWI...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20]]
5
368
2
def isCLKWISE(ph): return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0) def ConvexHullScan(P): P.sort() phU = [P[0],P[1]] for p in P[2:]: phU.append(p) while(True): if isCLKWISE(phU) : break ...
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0) def ConvexHullScan(P): P = sorted(P) phU = [P[0],P[1]] for p in P[2:]: phU.append(p) while(True): if isCLKWISE(phU) : break ...
[["-", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 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, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22]]
5
364
6
from math import sqrt from collections import deque def sub(a, b): return [a[0] - b[0],a[1] - b[1]] def cross(a, b): return a[0] * b[1] - a[1] * b[0] def ccw(a, b, c): x = sub(b, a) y = sub(c, a) return cross(x, y) > 0 n = int(input()) c = [list(map(int, input().split())) for i in range(n)] c.s...
from math import sqrt from collections import deque def sub(a, b): return [a[0] - b[0],a[1] - b[1]] def cross(a, b): return a[0] * b[1] - a[1] * b[0] def ccw(a, b, c): x = sub(b, a) y = sub(c, a) return cross(x, y) > 0 n = int(input()) c = [list(map(int, input().split())) for i in range(n)] c.s...
[["-", 0, 7, 12, 657, 31, 206, 206, 663, 0, 102], ["+", 0, 7, 12, 657, 31, 206, 206, 663, 0, 102], ["-", 0, 7, 12, 657, 12, 206, 206, 663, 0, 22], ["+", 0, 7, 12, 657, 12, 206, 206, 663, 0, 22]]
5
404
4
#include <bits/stdc++.h> using namespace std; #define EPS 1e-10 #define equal(a, b) (fabs(a - b) < EPS) #define not_equal(a, b) (!equal(a, b)) #define lt(a, b) (a - b < -EPS) struct Point { double x, y; Point() {} Point(double x, double y) : x(x), y(y) {} Point operator+(const Point &p) const { return Poin...
#include <bits/stdc++.h> using namespace std; #define EPS 1e-10 #define equal(a, b) (fabs(a - b) < EPS) #define not_equal(a, b) (!equal(a, b)) #define lt(a, b) (a - b < -EPS) struct Point { double x, y; Point() {} Point(double x, double y) : x(x), y(y) {} Point operator+(const Point &p) const { return Poin...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 2, 63, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 2, 63, 22]]
1
1,009
4
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef vector<P> vec; namespace std { bool operator<(const P &a, const P &b) { return (a.imag() == b.imag() ? a.real() < b.real() : a.imag() < b.imag()); } }; // namespace std double eps = 1e-8; double PI = acos(-1); bool eq(double a, double...
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef vector<P> vec; namespace std { bool operator<(const P &a, const P &b) { return (a.imag() == b.imag() ? a.real() < b.real() : a.imag() < b.imag()); } }; // namespace std double eps = 1e-8; double PI = acos(-1); bool eq(double a, double...
[["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,494
4
#include <bits/stdc++.h> using namespace std; using db = double; const db eps = 1e-9; int sgn(db a, db b = 0) { a -= b; return (a > eps) - (a < -eps); } struct poi { db x, y; poi operator-(poi p) { return {x - p.x, y - p.y}; } bool operator<(poi p) const { return tie(x, y) < tie(p.x, p.y); } db cross(poi ...
#include <bits/stdc++.h> using namespace std; using db = double; const db eps = 1e-9; int sgn(db a, db b = 0) { a -= b; return (a > eps) - (a < -eps); } struct poi { db x, y; poi operator-(poi p) { return {x - p.x, y - p.y}; } bool operator<(poi p) const { return tie(x, y) < tie(p.x, p.y); } db cross(poi ...
[["-", 8, 9, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
634
4
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef complex<double> V; typedef vector<P> vecP; typedef pair<P, P> L; typedef pair<P, P> S; typedef pair<P, double> C; const double eps = 1e-8; const double PI = acos(-1); const double PI2 = PI * 2.0; namespace std { bool operator<(const P &a,...
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef complex<double> V; typedef vector<P> vecP; typedef pair<P, P> L; typedef pair<P, P> S; typedef pair<P, double> C; const double eps = 1e-8; const double PI = acos(-1); const double PI2 = PI * 2.0; namespace std { bool operator<(const P &a,...
[["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 25]]
1
3,493
3
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() #define scanf nope typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; template <class T> struct P...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() #define scanf nope typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; template <class T> struct P...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 51, 16, 12, 23, 0, 16, 12, 16, 17, 47], ["+", 51, 16, 12, 23, 0, 16, 12, 16, 12, 13]]
1
1,113
4
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG_MODE #define DBG(n) n; #else #define DBG(n) ; #endif #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define rep(i, s, g) for (ll(i) = (s); (i) < (g); ++i) #define rrep(i, s, g) for (ll(i) = (s); i >= (g); --(i)) #define PB push_back #define MP make_pair ...
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG_MODE #define DBG(n) n; #else #define DBG(n) ; #endif #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define rep(i, s, g) for (ll(i) = (s); (i) < (g); ++i) #define rrep(i, s, g) for (ll(i) = (s); i >= (g); --(i)) #define PB push_back #define MP make_pair ...
[["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 31, 16, 12, 22]]
1
2,749
5
from sys import stdin readline = stdin.readline def cross(a, b): return a.real * b.imag - a.imag * b.real def dot(a, b): return a.real * b.real + a.imag * b.imag def diff(p, i): return p[(i + 1) % len(p)] - p[i] # http://www.prefield.com/algorithm/geometry/convex_diameter.html def convex_diameter(p)...
from sys import stdin readline = stdin.readline def cross(a, b): return a.real * b.imag - a.imag * b.real def dot(a, b): return a.real * b.real + a.imag * b.imag def diff(p, i): return p[(i + 1) % len(p)] - p[i] # http://www.prefield.com/algorithm/geometry/convex_diameter.html def convex_diameter(p):...
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
317
2
#include <math.h> #include <stdio.h> #include <stdlib.h> struct Point { double x; double y; }; struct Line { struct Point s; struct Point e; }; double convex_cut(int size, struct Point *p); int main(void) { int i, n, q; struct Point *p; scanf("%d", &n); p = (struct Point *)malloc(sizeof(struct Point) * ...
#include <math.h> #include <stdio.h> #include <stdlib.h> struct Point { double x; double y; }; struct Line { struct Point s; struct Point e; }; double convex_cut(int size, struct Point *p); int main(void) { int i, n, q; struct Point *p; scanf("%d", &n); p = (struct Point *)malloc(sizeof(struct Point) * ...
[["-", 3, 4, 0, 16, 12, 23, 0, 16, 12, 13], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 13]]
0
771
2
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; #define INF 0x7FFFFFFF const double EPS = 1e-10; inline bool eq(double a, double b) { return fabs(b - a) < EPS; } struct p_t { double x; double y; double norm() { return x * x +...
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <vector> using namespace std; #define INF 0x7FFFFFFF const double EPS = 1e-10; inline bool eq(double a, double b) { return fabs(b - a) < EPS; } struct p_t { double x; double y; double norm() { return x * x +...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
1,028
2
def area(p) x, y = p[0] s = 0.0 oldV = [p[1][0]-x, p[1][1]-y] p[2..-1].each do |x1, y1| # 点の数が3以上であることに依存 va = [x1-x, y1-y] s += triangleArea(va, oldV) oldV = va end s end def triangleArea(a, b) ((a[0] * b[1] - a[1] * b[0])/2.0).abs end if __FILE__ == $0 points = gets.to_i.times.map{ gets....
def area(p) x, y = p[0] s = 0.0 oldV = [p[1][0]-x, p[1][1]-y] p[2..-1].each do |x1, y1| # 点の数が3以上であることに依存 va = [x1-x, y1-y] s += triangleArea(va, oldV) oldV = va end s.abs end def triangleArea(a, b) (a[0] * b[1] - a[1] * b[0])/2.0 end if __FILE__ == $0 points = gets.to_i.times.map{ gets.sp...
[["+", 0, 493, 0, 735, 8, 736, 0, 652, 17, 131], ["+", 0, 493, 0, 735, 8, 736, 0, 652, 735, 22], ["-", 0, 735, 8, 736, 0, 652, 486, 739, 0, 24], ["-", 0, 735, 8, 736, 0, 652, 486, 739, 0, 25], ["-", 0, 493, 0, 735, 8, 736, 0, 652, 17, 131], ["-", 0, 493, 0, 735, 8, 736, 0, 652, 735, 22]]
4
145
6
n = int(input()) P =[] s = 0 for i in range(n):P.append([int(i) for i in input().split()]) P.append(P[0]) for i in range(n): a = P[i][0] ; b = P[i][1]; c = P[i+1][0] ; P[i+1][1] s += a * d - b * c print(abs(s)*0.5)
n = int(input()) P =[] s = 0 for i in range(n):P.append([int(i) for i in input().split()]) P.append(P[0]) for i in range(n): a = P[i][0] ; b = P[i][1]; c = P[i+1][0] ; d = P[i+1][1] s += a * d - b * c print(abs(s)*0.5)
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32]]
5
120
2
n = int(input()) P =[] s = 0 x0,y0 = [int(i) for i in input().split()] for i in range(n): x,y = [int(i) for i in input().split()] P.append([x-x0,y-y0]) for i in range(n-2): s += P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0] print(abs(s)*0.5)
n = int(input()) P =[] s = 0 x0,y0 = [int(i) for i in input().split()] for i in range(n-1): x,y = [int(i) for i in input().split()] P.append([x-x0,y-y0]) for i in range(n-2): s += P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0] print(abs(s)*0.5)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
133
2
n = int(input()) P =[] s = 0 for i in range(n):P.append([int(i) for i in input().split()]) P.append(P[0]) for i in range(n-2): s += P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0] print(abs(s)*0.5)
n = int(input()) P =[] s = 0 for i in range(n):P.append([int(i) for i in input().split()]) P.append(P[0]) for i in range(n):s += (P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0]) print(abs(s)*0.5)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 23, 0, 24], ["+", 8, 196, 0, 1, 0, 677, 12, 23, 0, 25]]
5
109
17
n = int(input()) P =[] s = 0 for _ in range(n):P.append([int(i) for i in input().split()]) P.append(P[0]) for j in range(n):s += P[j][1]*P[j+1][0] - P[j+1][1] * P[j][0] print(s*0.5)
n = int(input()) P =[] s = 0 for _ in range(n):P.append([int(i) for i in input().split()]) P.append(P[0]) for j in range(n):s += P[j][1]*P[j+1][0] - P[j+1][1] * P[j][0] print(s*-0.5)
[["+", 0, 652, 3, 4, 0, 657, 12, 664, 17, 33]]
5
104
9
n = int(input()) x = range(n) P =[] s = 0 for _ in x:P.append([int(i) for i in input().split()]) P+=P[0] for j in x:s += P[j][0]*P[j+1][1] - P[j][1]*P[j+1][0] print(s*0.5)
n = int(input()) x = range(n) P =[] s = 0 for _ in x:P.append([int(i) for i in input().split()]) P+=[P[0]] for j in x:s += P[j][0]*P[j+1][1] - P[j][1]*P[j+1][0] print(s*0.5)
[["+", 0, 656, 0, 1, 0, 677, 12, 634, 0, 70], ["+", 0, 1, 0, 677, 12, 634, 0, 206, 0, 73]]
5
101
2
x=range(int(input()),0,-1) P=[] for _ in x:P+=[[int(i) for i in input().split()]] P+=[P[0]] for j in x:_+=P[j-1][0]*P[j][1]-P[j-1][1]*P[j][0] print(_*0.5)
x=range(int(input()),0,-1) P=[] for _ in x:P+=[[int(i) for i in input().split()]] P+=[P[0]] for j in x:_+=P[j-1][0]*P[j][1]-P[j-1][1]*P[j][0] print(_*0.5-0.5)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 531]]
5
101
16
import math class Vector(): def __init__(self, x, y): self.x = x self.y = y def inner_product(self, vec): return self.x*vec.x + self.y*vec.y def outer_product(self, vec): return self.x*vec.y - self.y*vec.x def norm(self): return math.sqrt(self.x**2 + self.y**2...
import math class Vector(): def __init__(self, x, y): self.x = x self.y = y def inner_product(self, vec): return self.x*vec.x + self.y*vec.y def outer_product(self, vec): return self.x*vec.y - self.y*vec.x def norm(self): return math.sqrt(self.x**2 + self.y**2...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
278
2
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <vector> using namespace std; typedef complex<double> xy; double eps = 1e-9; double dot_product(xy a, xy b) { return (conj(a) * b).real(); } double cross_product(xy a, xy b) { return (conj(a) * b).imag(); } double d...
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <vector> using namespace std; typedef complex<double> xy; double eps = 1e-9; double dot_product(xy a, xy b) { return (conj(a) * b).real(); } double cross_product(xy a, xy b) { return (conj(a) * b).imag(); } double d...
[["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 33]]
1
727
1
#include <complex> #include <iostream> #include <vector> using namespace std; typedef complex<double> point; double cross(const point &a, const point &b) { return imag(conj(a) * b); } double dot(const point &a, const point &b) { return real(conj(a) * b); } int ccw(point a, point b, point c) { b -= a; c -= a; if ...
#include <complex> #include <iostream> #include <vector> using namespace std; typedef complex<double> point; double cross(const point &a, const point &b) { return imag(conj(a) * b); } double dot(const point &a, const point &b) { return real(conj(a) * b); } int ccw(point a, point b, point c) { b -= a; c -= a; if ...
[["-", 0, 7, 8, 57, 15, 339, 51, 16, 17, 18], ["-", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13]]
1
305
4
#include <complex> #include <iostream> #include <vector> using namespace std; #define X real() #define Y imag() #define EPS (1e-10) typedef complex<double> P; typedef P Vec; double dot(Vec v1, Vec v2) { return (v1 * conj(v2)).X; } double cross(Vec v1, Vec v2) { return (v1 * conj(v2)).Y; } enum { COUNTER_CLOCKWISE,...
#include <complex> #include <iostream> #include <vector> using namespace std; #define X real() #define Y imag() #define EPS (1e-10) typedef complex<double> P; typedef P Vec; double dot(Vec v1, Vec v2) { return (v1 * conj(v2)).X; } double cross(Vec v1, Vec v2) { return (v1 * conj(v2)).Y; } enum { COUNTER_CLOCKWISE,...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
329
4
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <vector> #define curr(P, i) P[(i) % P.size()] #define next(P, i) P[(i + 1) % P.size()] #define prev(P, i) P[(i + P.size() - 1) % P.size()] using namespace std; typedef double Real; Real EPS = 1e-...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <iostream> #include <vector> #define curr(P, i) P[(i) % P.size()] #define next(P, i) P[(i + 1) % P.size()] #define prev(P, i) P[(i + P.size() - 1) % P.size()] using namespace std; typedef double Real; Real EPS = 1e-...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
845
4