Source
stringclasses
1 value
Date
int64
2.01k
2.02k
Text
stringlengths
22
783k
Token_count
int64
20
394k
Project_CodeNet
2,018
#include <bits/stdc++.h> #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)(n);++i) #define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i) #define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i) #define each(a,b) for(auto (a): (b)) #define all(v) (v).begin...
791
Project_CodeNet
2,018
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { const int max_p = 1 << 18; int l, r; cin >> l >> r; vector<int> ns(r - l + 1); for(int i = 0; i <= r - l; ++i) { ns[i] = i + l; } vector<int> cnt(r - l + 1); vector<bool> is_prime(max_p, true); i...
307
Project_CodeNet
2,019
#include<bits/stdc++.h> using namespace std; const int SIZE=1e6; int main(){ int l,r; cin>>l>>r; r++; vector<int> cnt(r-l); vector<int> v(r-l); for(int i=0;i<r-l;i++) v[i]=i+l; vector<int> isPrime(SIZE,true); isPrime[0]=isPrime[1]=false; for(int i=2;i<SIZE;i++){ if(isPrime[i...
226
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; int main(){ int l, r; cin >> l >> r; int c = r - l + 1; vector<int> num(c); for (int i = 0; i < c; i++){ num[i] = l + i; } vector<int> cnt(c, 0); for (int i = 2; i * i <= r; i++){ for (int j = (l + i - 1) / i * i; j <= r; j += i){ while (num[j ...
304
Project_CodeNet
2,018
#include "bits/stdc++.h" #pragma warning(disable:4996) using namespace std; using ld =long double; string st; int a=0; struct game { shared_ptr<game>l; shared_ptr<game>r; char name; game(char a) :name(a){ } game():name('A') { } }; game get_game() { game now_game; if (st[a] == '[') { a++; auto l_game...
731
Project_CodeNet
2,019
#include "bits/stdc++.h" using namespace std; const int MOD = 1e9 + 7; typedef long long lint; const int INF = 1e7; #define rep(i, n) for (lint i = 0; i < (n); ++i) #define repi(i, k, n) for (int i = (k); i < (int)(n); ++i) typedef pair<int, int> P; typedef vector<lint> vi; typedef vector<vi> vvi; #define all(x) (x).be...
478
Project_CodeNet
2,018
#include<bits/stdc++.h> using namespace std; using LL=long long; #define rep(i,n) for(int i=0; i<n; i++) #define rep1(i,n) for(int i=1; i<n; i++) #define all(a) (a).begin(),(a).end(); bool isp[401010]; int now[1010101], cnt[1010101]; int l, r; vector<int> build(){ vector<int> p; for(int i=0; i*i<=r; i++){ is...
387
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; using ll = long long int; vector<bool> IsPrime; vector<int> primes; void sieve(int max) { IsPrime.resize(max + 1, true); IsPrime[0] = IsPrime[1] = false; for (int i = 2; i * i <= max; ++i){ if (IsPrime[i]){ for (int j = i * i; j <= max; j...
323
Project_CodeNet
2,017
#include <stdio.h> #include <cmath> #include <algorithm> #include <cfloat> #include <stack> #include <queue> #include <vector> #include <string> #include <iostream> #include <set> #include <map> #include <time.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
519
Project_CodeNet
2,019
#if __has_include("../library/Basic/Debug.hpp") #include "../library/Basic/Debug.hpp" #else /* ----- Header Files ----- */ // IO #include <cstdio> #include <iomanip> #include <ios> #include <iostream> // algorithm #include <algorithm> #include <cmath> #include <numeric> // container #include <vector> #include <str...
984
Project_CodeNet
2,020
// >>> TEMPLATES #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using i32 = int32_t; using i64 = int64_t; using u32 = uint32_t; using u64 = uint64_t; #define int ll #define double ld #define rep(i,n) for (int i = 0; i < (int)(n); i++) #define rep1(i,n) for (int i = 1; i <= (...
1,911
Project_CodeNet
2,020
#include <bits/stdc++.h> #define syosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef pair<double,double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double>...
497
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; int v[1000005], v2[1000005]; int sieve1[100005]; void precomp() { sieve1[0] = 0; si...
377
Project_CodeNet
2,019
#include <iostream> #include <vector> #include <cmath> #include <string> #include <climits> #include <iomanip> #include <algorithm> #include <queue> #include <map> #include <tuple> #include <iostream> #include <deque> #include <array> #include <set> #include <functional> #include <memory> #include <stack> #include <uno...
446
Project_CodeNet
2,019
#include <iostream> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using u32 = uint32_t; using namespace std; template<class T> constexpr T INF = ::nu...
394
Project_CodeNet
2,017
#include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <iostream> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <complex> #include <functional> #include <ca...
457
Project_CodeNet
2,019
// #define _GLIBCXX_DEBUG // for STL debug (optional) #include <iostream> #include <iomanip> #include <cstdio> #include <string> #include <cstring> #include <deque> #include <list> #include <queue> #include <stack> #include <vector> #include <utility> #include <algorithm> #include <map> #include <set> #include <complex...
622
Project_CodeNet
2,019
#include<deque> #include<queue> #include<vector> #include<algorithm> #include<iostream> #include<set> #include<cmath> #include<tuple> #include<string> #include<chrono> #include<functional> #include<iterator> #include<random> #include<unordered_set> #include<array> #include<map> #include<iomanip> #include<assert.h> #inc...
716
Project_CodeNet
2,019
#include<iostream> #include<vector> using namespace std; int main(){ vector<int> p; bool nonp[1000000] = {}; nonp[0] = nonp[1] = true; for(int i = 2; i < 1000000; i++){ if(nonp[i]) continue; p.push_back(i); for(int j = i+i; j < 1000000; j += i) nonp[j] = true; } int l,...
292
Project_CodeNet
2,019
#include <stdio.h> #include <cmath> #include <algorithm> #include <cfloat> #include <stack> #include <queue> #include <vector> #include <string> #include <iostream> #include <set> #include <map> #include <time.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
519
Project_CodeNet
2,020
#include <cstdio> #include <iostream> #include <string> #include <sstream> #include <stack> #include <algorithm> #include <cmath> #include <queue> #include <map> #include <set> #include <cstdlib> #include <bitset> #include <tuple> #include <assert.h> #include <deque> #include <bitset> #include <iomanip> #include <limit...
670
Project_CodeNet
2,019
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; } template<c...
725
Project_CodeNet
2,019
#include<iostream> #include<string> #include<cstdio> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> usi...
614
Project_CodeNet
2,017
// AOJ 2858: Prime-Factor Prime // 2017.11.25 bal4u@uu #include <stdio.h> #include <string.h> #include <math.h> #define MAX 31623 // sqrt(1e9) char tbl[MAX+3]; int sz; // max sz = 3402, prime[0] = 2, prime[3401] = 31623 int prime[3500] = { // prime[40] = 179, 179^2 = 32041 2, 3, 5, 7, 11, 13, 17, 19, ...
879
Project_CodeNet
2,019
#include <stdio.h> #define SMAX 100000 #define PMAX 1000000 int minfactor[SMAX], pfactor[PMAX], pcount[PMAX]; void small_sieve(int l, int r); void factorization(int n, int l, int r); int main(void) { int i, l, r, ans = 0; scanf("%d %d", &l, &r); small_sieve(l, r); minfactor[0] = minfactor[1] = -1; for (i = l;...
428
Project_CodeNet
2,015
public class Main{ public void run(java.io.InputStream in, java.io.PrintStream out){ java.util.Scanner sc = new java.util.Scanner(in); /*answer*/ double xp0, xp1, yp0, yp1, xp2, yp2, xp3, yp3; int q; int i; double min, d; q = sc.nextInt(); for(i = 0;i < q;i++){ xp0 = sc.nextDouble()...
1,365
Project_CodeNet
2,017
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; public class Main { private static FastScanner sc = new FastScanner(); public static void main(String[] args) { int q = sc.nextInt(); StringBuilder ans = new StringBuilder(); for(int i=0; i<q; i++) { double min...
1,826
Project_CodeNet
2,018
import java.util.Scanner; public class Main { static final double EPS = 0.00000000001; static final int COUNTER_CLOCKWISE = 1; static final int CLOCKWISE = -1; static final int ONLINE_BACK = 2; static final int ONLINE_FRONT = -2; static final int ON_SEGMENT = 0; public static void main(String[] args) { Scanne...
1,082
Project_CodeNet
2,015
import java.util.*; import java.math.BigDecimal; class Main{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int q = stdIn.nextInt(); for(int i=0;i<q;i++){ double x0 = stdIn.nextDouble(); double y0 = stdIn.nextDouble(); double x1 = stdIn.nextDouble(); double y1 = std...
2,650
Project_CodeNet
2,014
import java.awt.geom.Line2D; import java.util.*; public class Main { Scanner in = new Scanner(System.in); public static void main(String[] args) { new Main(); } public Main() { int q = in.nextInt(); for(int i=0;i<q;i++)new CGL_2B().doIt(); } class CGL_2B{ double segSegDist(Line2D l1,Line2D l2){ retur...
244
Project_CodeNet
2,015
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.p1).abs();} stati...
1,094
Project_CodeNet
2,020
import java.awt.geom.Line2D; import java.util.Arrays; import java.util.Scanner; public class Main { class P { double x, y; P(double x_, double y_) { x = x_; y = y_; } P add(P p) { return new P(x + p.x, y + p.y); } ...
820
Project_CodeNet
2,019
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.math.BigInteger; public class Main implements Runnable { static int mod = 1000000007; public static void main(String[] args) { new Thread(null, new Main(), "", 1024 * 1024 * 1024).start();...
3,826
Project_CodeNet
2,015
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for (int i = 0; i < q; i++) { int xp0 = sc.nextInt(); int yp0 = sc.nextInt(); int xp1 = sc.nextInt(); int yp1 = sc.nextInt(); int xp2 = sc.nextInt()...
1,948
Project_CodeNet
2,017
import java.awt.geom.Line2D; import java.util.Arrays; import java.util.Scanner; public class Main { class P { double x, y; P(double x_, double y_) { x = x_; y = y_; } P add(P p) { return new P(x + p.x, y + p.y); } P sub(P p) { return new P(x - p.x, y - p.y); } P mul(double v) { ret...
809
Project_CodeNet
2,019
import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamRead...
344
Project_CodeNet
2,015
#include <complex> #include <vector> #include <map> #include <iostream> #include <cstdio> #include <cassert> using namespace std; #define REP(i,n) for(int i = 0; i < (int)(n); ++i) #define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i) #define ALL(c) (c).begin(), (c).end() #define SIZE(v) ((int)v.size()) const doubl...
1,674
Project_CodeNet
2,018
#include<iostream> #include<cstdio> #include<cmath> #include<vector> using namespace std; static const long double EPS = 1e-10; static const int COUNTER_CLOCKWISE = 1; static const int CLOCKWISE = -1; static const int ONLINE_BACK = 2; // p2→p0→p1 static const int ONLINE_FRONT = -2; static const int ON_SEGMENT = 0; c...
881
Project_CodeNet
2,019
#include <bits/stdc++.h> using namespace std; struct Point { int x, y; Point() = default; Point(int x, int y) : x(x), y(y) {} Point operator+(const Point &rhs) const { return Point(x + rhs.x, y + rhs.y); } Point operator-(const Point &rhs) const { return Point(x - rhs.x, y - ...
884
Project_CodeNet
2,019
#include <iostream> #include <limits> #include <cmath> #include <cstdio> using namespace std; #define EPS (numeric_limits<double>::epsilon()) #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+(const Point &p)...
1,179
Project_CodeNet
2,019
#include <bits/stdc++.h> #define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i)) #define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i)) #define rep(i, n) For((i), 0, (n)) #define rrep(i, n) rFor((i), (n), 0) #define fi first #define se second using namespace std; typedef long long lint; typedef unsigned long long ulin...
1,239
Project_CodeNet
2,020
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
2,181
Project_CodeNet
2,015
#include <algorithm> #include <vector> #include <cfloat> #include <string> #include <cmath> #include <set> #include <cstdlib> #include <map> #include <ctime> #include <iomanip> #include <functional> #include <deque> #include <iostream> #include <cstring> #include <queue> #include <cstdio> #include <stack> #include <cli...
1,085
Project_CodeNet
2,017
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cassert> #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define rep(i,n) FOR(i,0,n) #define DEBUG(x) cout<<#x<<": "<<x<<endl #define vint vector<int> #define vdouble vector<double> #define vs...
1,818
Project_CodeNet
2,019
#include<iostream> #include<vector> #include<iomanip> #include<cmath> #include<algorithm> using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) struct Point; typedef Point Vector; struct Segment; typedef Segment Line; double norm(Point a); double abs(Point a); double dot(Vector a, Vect...
1,491
Project_CodeNet
2,016
#include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<cmath> #include<vector> #include<stack> #include<climits> #include<cstring> #include<queue> using namespace std; const int INF = INT_MAX / 3; #define REP(i,n) for(int i=0;i<(int)n;i++) #define FOR(i,c) for(__typeof((c).begin())i=(c).beg...
815
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; const double PI = asinl(1) * 2; 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 Point(x*...
1,213
Project_CodeNet
2,015
#include<iostream> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<vector> #include<cmath> #include<cstdio> #include<complex> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define it ::iterator #define all(in)...
1,097
Project_CodeNet
2,016
#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <deque> #include <list> #include <queue> #include <stack> #include <vector> #include <utility> #include <algorithm> #include <map> #include <set> #include <complex> #include <cmath> #include <limits> #include <climits> #include <ctime> ...
911
Project_CodeNet
2,016
#include<iostream> #include<iomanip> #include<algorithm> #define _USE_MATH_DEFINES #include<math.h> #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) :x(x), y(y) {} Point operator + (Point p) { return Point(...
1,021
Project_CodeNet
2,016
#include <cstdio> #include <utility> #include <vector> #include <complex> #include <cmath> using namespace std; static const double EPS=1e-12; static const double INF=1e24; using Point=complex<double>; using Plane=vector<Point>; bool operator<(const Point &a, const Point &b) { return real(a)!=real(b)? real(a)<r...
978
Project_CodeNet
2,018
#include<bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; typedef long long ll; typedef long double ld; typedef unsigned long long ull; template <typename T> void chkmax(T &x, T y) {x = max(x, y); } template <typename T> void chkmin(T &x, T y) {x = min(x, y); } template <typename T> void read(T &x) { x =...
1,217
Project_CodeNet
2,018
// 射影 正射影ベクトル #include<cstdio> #include<cstdlib> #include<cstring> #include<stack> #include<algorithm> #include<iostream> #include<cmath> #include<vector> #include<queue> using namespace std; // 浮動小数点のゼロ判定 #define EPS (1e-10) #define equals(a, b) ( fabs((a) - (b)) < EPS ) // 点を表すクラス class Point { public: ...
1,404
Project_CodeNet
2,017
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8; const double INF = 1e12; //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); } } double cross(const P& a, const P& b) { return imag(c...
1,180
Project_CodeNet
2,020
#include "bits/stdc++.h" using namespace std; #define pb push_back #define fst first #define snd second #define fr(i,n) for (int i = 0; i < n; i++) #define frr(i,n) for (int i = 1; i <= n; i++) #define endl '\n' #define gnl cout << endl #define chapa cout << "oi meu chapa" << endl #define fastio ios_base::syn...
1,280
Project_CodeNet
2,015
#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 = (j); i < (k); i++) #de...
2,615
Project_CodeNet
2,020
#include <cassert> #include <cmath> #include <algorithm> #include <iostream> #include <iomanip> #include <limits.h> #include <map> #include <queue> #include <set> #include <string.h> #include <vector> using namespace std; typedef long long ll; const double EPS = 1e-9; static const int COUNTER_CLOCKWISE = 1; static co...
1,203
Project_CodeNet
2,019
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string> #ifndef NULL #define NULL 0 #endif using namespace std; const int MAXN = 50000 + 10; const double pi = acos(-1.0); const double inf = 1e100; const double eps = 1e-12; inline double read(...
2,236
Project_CodeNet
2,019
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<cmath> #include<vector> #include<queue> using namespace std; typedef long long LL; const double Pi = acos(-1.0); const int INf = 0x7fffffff; const double eps = 1e-9; int sgn(double d) { if(fabs(d) < eps) return 0; if(d...
1,435
Project_CodeNet
2,020
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b)) < EPS) // cout<<fixed<<setprecision(15) static const int COUNTER_CLOCKWISE=1; static const int CLOCKWISE=-1...
1,167
Project_CodeNet
2,019
// {{{ header #include <bits/stdc++.h> using namespace std; using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using i128 = __int128_t; using u128 = __uint128_t; using f32 = float; using f64...
2,975
Project_CodeNet
2,017
#include<iostream> #include<cstdio> #include<cmath> #include<vector> using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) static const int COUNTER_CLOCKWISE = 1; static const int CLOCKWISE = -1; static const int ONLINE_BACK = 2; static const int ONLINE_FRONT = -2; static const int ON_S...
931
Project_CodeNet
2,016
#include <cstdio> // printf(), scanf() #include <cmath> // fabs(), sqrt() #include <algorithm> // min() 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 i...
944
Project_CodeNet
2,020
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) #define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++) #define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend...
1,870
Project_CodeNet
2,019
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i) #define ALL(v) (v).begin(),(v).end() #define CLR(t,v) memset(t,(v),sizeof(t)) template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< "...
2,214
Project_CodeNet
2,018
#include<bits/stdc++.h> using namespace std; #define EPS (1e-10) //誤差 typedef complex<double> P; //実数同士の比較 bool EQ(double a, double b){ return (abs(a - b) < EPS); } //二つのベクトルが等しいかどうか bool EQV(P a, P b){ return (EQ(a.real(), b.real()) && EQ(a.imag(), b.imag())); } //内積 double dot(P a, P b){ return (a.r...
904
Project_CodeNet
2,017
#include<bits/stdc++.h> #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) for(int i = 0; i < (b); i++) #define all(a) (a).begin(), (a).end() #define show(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; const i...
3,149
Project_CodeNet
2,019
#define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) #include <iostream> #include <cmath> #include <iomanip> 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); } Point operator - (P...
944
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return 1; } return 0; } typedef long long int ll; #defi...
2,472
Project_CodeNet
2,019
#include<bits/stdc++.h> #define lb long double #define eps 1e-10 using namespace std; struct Po{lb x,y;}p0,p1,q0,q1; int t; void get(Po &x){scanf("%Lf %Lf",&x.x,&x.y);} Po operator -(Po x,Po y){return (Po){x.x-y.x,x.y-y.y};} Po operator +(Po x,Po y){return (Po){x.x+y.x,x.y+y.y};} lb operator *(Po x,Po y){return x.x*y.y...
588
Project_CodeNet
2,013
#include<cmath> #include<algorithm> #include<iostream> #include<vector> #include<climits> #include<cfloat> #include<cstdio> #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; double EPS = 1e-10; const double PI = acos(-1); ...
721
Project_CodeNet
2,017
#include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<climits> #include<iomanip> #include<cstdio> #include<vector> #include<queue> #include<stack> #include<cmath> #include<list> #include<map> #include<set> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector...
1,319
Project_CodeNet
2,018
#include <bits/stdc++.h> using namespace std; #define TemplateVersion "3.4.0" // Useful Marcos //====================START===================== // Compile use C++11 and above #ifdef LOCAL #define debug(args...) \ { \ string _s = #args; ...
2,936
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; using Point = complex< double >; const double EPS = 1e-10, PI = acos(-1); bool eq(double a, double b){ return fabs(a-b) < EPS; } istream &operator>> (istream &is, Point &p) { double a, b; is >> a >> b; p = Point(a, b); return is; } ostream &operator<< (ostream &...
1,556
Project_CodeNet
2,020
#include<bits/stdc++.h> #define db double using namespace std; int n; db xp1,xp2,xp3,xp4,yp1,yp2,yp3,yp4; db sum1,sum2,xa,xb,xc,xd,ya,yb,yc,yd; db len(db xp1,db yp1,db xp2,db yp2,db xp3,db yp3){ db l1=xp2-xp1,r1=yp2-yp1,l2=xp3-xp1,r2=yp3-yp1; if(l1*l2+r1*r2>=0&&abs((l1*l2+r1*r2)/sqrt(l1*l1+r1*r1))<=sqrt(l1*l1+r1*r1))...
780
Project_CodeNet
2,017
#include <bits/stdc++.h> using namespace std ; #define pb(n) push_back(n) #define fi first #define se second #define all(r) begin(r),end(r) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout<<#x<<": "<<x<<endl #define fcout(n) cout<<fixed<<setprecision((n)) #define ...
1,950
Project_CodeNet
2,020
#include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <ostream> #include <vector> const double kEpsilon = 1e-10; inline bool equals(double a, double b) { return fabs(a - b) < kEpsilon; } class Point { public: double x, y; Point() = default; Point(double x, double y) :...
1,178
Project_CodeNet
2,018
#include <iostream> #include <iomanip> #include <limits> #include <algorithm> #include <vector> #include <deque> #include <queue> #include <list> #include <stack> #include <string> #include <functional> #include <numeric> #include <map> #include <set> #include <cstdlib> #include <bitset> #include <unordered_map> #inclu...
2,041
Project_CodeNet
2,016
#include "bits/stdc++.h" #include<unordered_map> #include<unordered_set> #pragma warning(disable:4996) using namespace std; using ld = long double; template<class T> using Table = vector<vector<T>>; const ld eps=1e-9; //// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Downloa...
5,750
Project_CodeNet
2,019
#include <bits/stdc++.h> #define EPS 1e-10 #define equals(a,b) (fabs((a)-(b)) < EPS) #define rep(i,n) for(int i=0;i<n;++i) typedef long long ll; using namespace std; static const int COUNTER_CLOCKWISE = 1; static const int CLOCKWISE = -1; static const int ONLINE_BACK = 2; static const int ONLINE_FRONT = -2; static con...
1,703
Project_CodeNet
2,020
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) using ll = long long; using namespace std; const int INF = 1e9; //https://dai1741.github.io/maximum-algo-2012/cpp/geometry/geometries2d.h typedef double D; typedef complex<D> P; typedef pair<P, P> L; typedef vector<P> VP; const D EPS = 1e-9; #defi...
4,679
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; } template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } return false; } // std::vector Declaration template<typename T> vector<T> ...
2,245
Project_CodeNet
2,017
#include <iostream> #include <iomanip> #include <cmath> 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; Vector() {} V...
1,142
Project_CodeNet
2,018
//be naame khodaa #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair <int, int> pii; typedef complex<ld> PT; typedef pair<PT, PT> LS; #define F first #define S second #define X real() #define Y imag() inline int in(){int x, y; y = scanf("%d", &x); return x; } co...
1,062
Project_CodeNet
2,019
#include<bits/stdc++.h> #define rep(i, n) for(int i=0;i<(n);++i) #define per(i, n) for(int i=(n)-1;i>=0;--i) #define repa(i, n) for(int i=1;i<(n);++i) #define foreach(i, n) for(auto &i:(n)) #define pii pair<int, int> #define pll pair<long long, long long> #define all(x) (x).begin(), (x).end() #define bit(x) (1ll << (x)...
1,727
Project_CodeNet
2,017
#include<bits/stdc++.h> using namespace std; struct CWW{ CWW(){ cin.tie(0); ios_base::sync_with_stdio(0); cout<<fixed<<setprecision(15); } }STAR; using D=double; const D EPS=1e-8; const D INF=1e9; const int COUNTER_CLOCKWISE=1; const int CLOCKWISE=-1; const int ONLINE_FRONT=2; const ...
1,247
Project_CodeNet
2,019
#include<bits/stdc++.h> #define mm(a,b) memset(a,b,sizeof(a)) #define ACCELERATE (ios::sync_with_stdio(false),cin.tie(0)) #define pii pair<int,int> #define pdd pair<double,double> #define pll pair<long long,long long> #define mp make_pair #define pb push_back #define fi first #define se second #define rep(i,a,b) for(in...
2,166
Project_CodeNet
2,020
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <cmath> #include <complex> #include <cstring> #include <functional> #include <fstream> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <math.h> #include <numeric> #include <ostream> ...
1,542
Project_CodeNet
2,016
#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) * b...
862
Project_CodeNet
2,018
#include <iostream> #include <iomanip> #include <cmath> #include <algorithm> using namespace std; double dis(double x1, double y1, double x2, double y2) { return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)); } double ldis(double x1, double y1, double x2, double y2, double x3, double y3) { if ((x1 - x2) * (x3 - x2) + (y...
944
Project_CodeNet
2,018
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <queue> #include <cmath> using namespace std; #define EPS (1e-10) #define equals(a,b) (fabs((a) - (b)) < EPS) // 点类 class Point { public : double x, y; Point() {}; Point(double x, double y) :x(x), y(y) {} Point operator + (Poin...
2,476
Project_CodeNet
2,018
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <vector> #include <string> #include <set> #include <math.h> #include <iostream> #include <random> #include...
730
Project_CodeNet
2,019
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repr(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define FORR(i, m, n) for (int i = (m); i >= (n); --i) #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef long long ll; c...
1,014
Project_CodeNet
2,020
#include<bits/stdc++.h> using namespace std; #define EPS (1e-10) #define equal(x,y) (fabs(x-y)<EPS) enum Status{ COUNTER_CLOCKWISE=1,CLOCKWISE=-1,ONLINE_BACK=2,ONLINE_FRONT=-2,ON_SEGMENT=0 }; struct Point{ double x,y; Point(double _x=0,double _y=0): x(_x),y(_y){ } Point operator+(const Point & p){ return Point(x...
994
Project_CodeNet
2,016
#include <iostream> #include <vector> #include <string> #include <cstring> #include <algorithm> #include <sstream> #include <map> #include <set> #include <cmath> #define REP(i,k,n) for(int i=k;i<n;i++) #define rep(i,n) for(int i=0;i<n;i++) #define INF 1<<30 #define pb push_back #define mp make_pair #define EPS 1e-8 #d...
1,539
Project_CodeNet
2,016
#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 a+b*real(c/b);} P reflect(P a,P b,P c){b-=a;...
511
Project_CodeNet
2,016
#include<iostream> #include<iomanip> #include<algorithm> #include<bitset> #include<cctype> #include<cmath> #include<cstdio> #include<cstring> #include<functional> #include<limits> #include<list> #include<map> #include<set> #include<stack> #include<string> #include<sstream> #include<queue> #include<vector> using namespa...
1,528
Project_CodeNet
2,019
#ifndef ___GEOMETRY_LIBRARY #define ___GEOMETRY_LIBRARY #include <vector> #include <algorithm> template<class type> class point2d { public: type x, y; point2d() : x(type(0)), y(type(0)) {}; point2d(type x_, type y_) : x(x_), y(y_) {}; bool operator==(const point2d& p) { return x == p.x && y == p.y; } bool operat...
1,313
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; using ll = long long; using u64 = uint_fast64_t; using pii = pair<int, int>; using pll = pair<long long, long long>; #define rep(i, n) for(int i = 0; i < (n); ++i) #define all(x) (x).begin(),(x).end() constexpr char ln = '\n'; ///////////////////////////////////////////...
4,582
Project_CodeNet
2,018
#include<iostream> #include<math.h> #include<float.h> #include<cstdio> using namespace std; #define EPS (1e-10) #define equals(a,b) fabs((a)-(b))<DBL_EPSILON*fmax(1,fmax(fabs(a),fabs(b))) //点のクラス class Point{ public: double x,y; Point(double x=0,double y=0):x(x),y(y){} Point operator + (Poi...
1,420