source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<bits/stdc++.h> #define endl "\n" using namespace std; using ll = long long; const int maxn = 2e5 + 10; int res[maxn],q1[maxn],q2[maxn],n1,n2,nn1,nn2; vector<int> neg,pos,nres,pres; inline int range(int l,int r,int s) { if(s) { int l1=0,r1=n1-1; if(pos[l1]>r||pos[r1]<l) ...
C++
a2b99448d6267a66bddfdcad9add311b
28473b3368d6440f7f96b51e5114114c
1,900
PASSED
#include <bits/stdc++.h> #define int long long #define inf (1LL << 60) using namespace std; bool correct[200001]; int A[200001], B[200001]; int query(vector<int>& a, vector<int>& b){ int n = a.size(), m = b.size(); // cout << "QUERY " << a.size() << ' ' << b.size() << endl; set<int> S; for(auto i : b)...
C++
a2b99448d6267a66bddfdcad9add311b
af56bba1aaa4d0dbcdeff5e468d0715a
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<algorithm> #include<vector> using namespace std; int a[200007]; int b1[200007], b2[200008],cnt1,cnt2; int pr1[200007], suf1[200078], pr2[200005], suf2[200007]; int main() { int t,x; cin >> t; for (; t--;) { int n, m; cnt1 = cnt2 = 0; s...
C++
a2b99448d6267a66bddfdcad9add311b
7e4fa8ee466c616abbbccd978a5d4a3e
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<algorithm> #include<vector> using namespace std; int a[200007]; int b1[200007], b2[200008],cnt1,cnt2; int pr1[200007], suf1[2000078], pr2[200005], suf2[200007]; int main() { int t,x; cin >> t; for (; t--;) { int n, m; cnt1 = cnt2 = 0...
C++
a2b99448d6267a66bddfdcad9add311b
159dfc11cabaea0dd74829e1ec3bb724
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define YES cout << "YES" << endl #define NO cout << "NO" << endl #define all(_) _.begin(), _.end() #define sz(_) (int)_.size() #define fs first #define se second #define Odd(_x) ((_x) & 1) using i64 = long long; using ll = long long; const int N = 100000; con...
C++
a2b99448d6267a66bddfdcad9add311b
47a387804d4da8524b48e6e8adfc5fc9
1,900
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int maxn = 1e5 + 5, mod = 1e9+7 ; const int N=500+10; int n; int ans=0; int calc(vector<int>a,vector<int>b) { if(!a.size()||!b.size())return 0; map<int,int>mp; int cnt=0,ans=0; for(auto x:b)mp[x]=1; set<int>se; ...
C++
a2b99448d6267a66bddfdcad9add311b
0629597d20369f73da5a660106b79e67
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 4e6+10; const int M = 998244353; const int mod = 998244353; //#define int long long int up(int a,int b){return a<0?a/b:(a+b-1)/b;} #define endl '\n' #define all(x) (x).begin(),(x).end() #define YES cout<<"YES"<<endl; #define NO cout<<"NO"<<endl; #de...
C++
a2b99448d6267a66bddfdcad9add311b
4c8d7fd16d1471e5fb9304fdb097cafc
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 4e6+10; const int M = 998244353; const int mod = 998244353; //#define int long long int up(int a,int b){return a<0?a/b:(a+b-1)/b;} #define endl '\n' #define all(x) (x).begin(),(x).end() #define YES cout<<"YES"<<endl; #define NO cout<<"NO"<<endl; #de...
C++
a2b99448d6267a66bddfdcad9add311b
e16ad2d94446d9d4501863f1fe64f7f8
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define N 200001 set<vector<int>> S; map<pair<int, int>, int> l; int32_t main(){ int n, m; cin >> n >> m; for (int i = 0; i < m; i++){ char op; cin >> op; if (op == '+'){ int u, v; char c; cin >> u >> v >> c; c ...
C++
5afb904f611d963ed3e302faefef3305
f1f011cba3a87259f163baa9512091f7
2,400
PASSED
#include <bits/stdc++.h> using namespace std; bool ok(char c) { return c >= 'a' && c <= 'z'; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, q; cin >> n >> q; map<pair<int, int>, char> m1; map<pair<pair<int, int>, char>, bool> m2; int brojac1 = 0; int broja...
C++
5afb904f611d963ed3e302faefef3305
29ad4b74fc51b79172fc046f677c1641
2,400
PASSED
#pragma GCC optimize("O3") #pragma GCC target("popcnt") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long ...
C++
5afb904f611d963ed3e302faefef3305
fe55315c934fb4dd11e0769bbbb1bbb1
2,400
PASSED
#pragma GCC optimize("O3") #pragma GCC target("popcnt") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long ...
C++
5afb904f611d963ed3e302faefef3305
cf97e6a142c37417c40261d3f1d684f9
2,400
PASSED
#include<stdio.h> #include<map> #include<iostream> using namespace std; const int maxn=200005; int n,T,even,odd,tot; map<int,char>mp[maxn]; string s; int main(){ scanf("%d%d",&n,&T); while(T--){ int x,y; char c; cin>>s; if(s=="+") scanf("%d%d",&x,&y),cin>>c,even+=mp[y].count(x)!=0&&mp[y][x]=...
C++
5afb904f611d963ed3e302faefef3305
5bae7d0a28a46efd0b881c153eebd771
2,400
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <cstring> #include <iomanip> #include <numeric> #include <string> #include <cmath> #include <math.h> #include <set> #include <map> #include <stack> #include <bitset> #define es ios::sync_with_stdio(false);cin.tie(0); //#...
C++
5afb904f611d963ed3e302faefef3305
6f7ca0e535d111a57bf53551d375ffc8
2,400
PASSED
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #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<bitset> ...
C++
5afb904f611d963ed3e302faefef3305
cc353cfc7744915096f60cd0ef8995d5
2,400
PASSED
// CF #include<iostream> #include<stack> #include<list> #include<set> #include<vector> #include<algorithm> #include<math.h> #include<numeric> #include<map> #include<cstring> #include<queue> #include<iomanip> #include<cmath> #include<ctime> #include<random> #include<queue> #include <bitset> #include<...
C++
5afb904f611d963ed3e302faefef3305
58ca395e8ae164376d8f158e673c0d92
2,400
PASSED
#include<bits/stdc++.h> #define sf scanf #define pf printf #define inf 4e18 using namespace std ; typedef long long ll ; typedef pair<int,int> PII ; typedef pair<ll,int> PLI ; typedef pair<ll,ll> PLL ; const int N = 1e6 + 5 , mod = 1e9 + 7 ; const int M = 500 ; const double p_a = acos( -1 ) ; int n ,...
C++
5afb904f611d963ed3e302faefef3305
33aeb89f7089687b3fd7618903ca13c9
2,400
PASSED
#include<bits/stdc++.h> using namespace std; int cnt1,cnt2,n,m; char ch[10]; map<int,int> mp[200010]; inline void work(int x,int y,int s) { if (mp[y][x]) { cnt1+=s; if (mp[y][x]==mp[x][y]) cnt2+=s; } } int main() { scanf("%d%d",&n,&m); while (m--) { int x,y; scanf("%s%d",ch...
C++
5afb904f611d963ed3e302faefef3305
6f604e81804fd34fcb953af40074c416
2,400
PASSED
#include <bits/stdc++.h> #define AIDAR ASADULLIN #define all(x) x.begin(), x.end() using namespace std; const int max_n = 501; const int max_m = 250001; int cost[max_m]; int gr[max_n][max_n]; int timer = 0; struct xor_one_move_5_or_one_move_5{ int x, ind1, ind2; xor_one_move_5_or_one_move_5(int x, int ind1, int ind2...
C++
ff8219b0e4fd699b1898500664087e90
08def02a00e3ec74697c3c0bfec28169
2,300
PASSED
#include <bits/stdc++.h> #define AIDAR ASADULLIN #define all(x) x.begin(), x.end() using namespace std; const int max_m = 2e3 + 3; int cost[max_m]; int timer = 0; struct request{ int x, ind1, ind2; request(int x, int ind1, int ind2): x(x), ind1(ind1), ind2(ind2){ } }; bool comp(request&A, request&B){ if (A.x != ...
C++
ff8219b0e4fd699b1898500664087e90
68421f621ef0171e10cacda854d0d7df
2,300
PASSED
#include <bits/stdc++.h> #define AIDAR ASADULLIN #define all(x) x.begin(), x.end() using namespace std; const int max_m = 2e3 + 3; int cost[max_m]; int timer = 0; struct request{ int x, ind1, ind2; request(int x, int ind1, int ind2): x(x), ind1(ind1), ind2(ind2){ } }; bool comp(request&A, request&B){ return A.x ...
C++
ff8219b0e4fd699b1898500664087e90
33d50b3b489de64e2abce485cb19df42
2,300
PASSED
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); //#define GCC optimize("O3, Ofast") //#define GCC optimize("unroll-loops") #define aidar asadulin #define int long long #define ull long long #define ...
C++
ff8219b0e4fd699b1898500664087e90
8f6f563802f72786065ba59be6016a33
2,300
PASSED
#include<bits/stdc++.h> #define pii pair<int,int> #define mp make_pair #define fi first #define se second using namespace std; const int N=500; struct node {int x,y,v;} qwq[N*N]; int s[N*N],a[N][N],v[N*N],id[N*N],num,cnt; pii ans[N*N]; int qaq[N*N],qoq,quq[N*N]; inline int read() { int ss=0,ww=1; char ch=g...
C++
ff8219b0e4fd699b1898500664087e90
66ad8538069d6da85bc8e5fb3f4c9ef4
2,300
PASSED
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int NN = 555; const int MM = 10101; int root[MM]; int a[NN][NN]; vector<pii> vec[MM]; int ans[MM]; vector<pii> edge; int nn; int find(int u) { return root[u] = root[u] == u ? u : find(root[u]); } int merge(int u, int v, int c) { int ...
C++
ff8219b0e4fd699b1898500664087e90
01bf70aa0516ccb0138a1270f1dd8c4f
2,300
PASSED
#include<bits/stdc++.h> #define NN 510 using namespace std; using INT=long long; using pii = pair <int, int>; int a[NN][NN]; int c[NN*NN]; vector <pii> edge; int val[NN*NN], w[NN*NN]; int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int n; cin >> n; for(int ...
C++
ff8219b0e4fd699b1898500664087e90
926d086fce1f38b439e61e3c7440a4ab
2,300
PASSED
#include<bits/stdc++.h> using namespace std; using pii=pair<int,int>; using pi3=pair<int,pii>; const int NN=727; int a[NN][NN]; int c[NN*NN]; int root[NN*2]; pi3 p[NN*NN]; vector <int> ans[NN*2]; int find_root(int u){ if(u==root[u]) return u; return root[u]=find_root(root[u]); } int main(){ #ifndef ONLINE_JUDGE fr...
C++
ff8219b0e4fd699b1898500664087e90
96ea63d9cc79a379519bff001d14bb76
2,300
PASSED
/****************************************** * AUTHOR: Atharva Sarage * * INSTITUITION: IIT HYDERABAD * ******************************************/ #include<bits/stdc++.h> #warning Check Max_Limit,Overflows using namespace std; # define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(...
C++
ff8219b0e4fd699b1898500664087e90
0e3b9502aea5a5d4b5529c603dcaf391
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define x first #define y second #define pb push_back #define ll long long typedef pair <int,int> ii; const int max6 = 1e6+6; const int oo = 1e9+9; const ll inf = 1e18+18; ////////////////////////// int a[505][505]; int cl[505]; int pre[max6]; int sal[max6];...
C++
ff8219b0e4fd699b1898500664087e90
bb50cd3ca8d8fd86102fc11ea7bc8be3
2,300
PASSED
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; struct Edge { ll to, id; Edge(ll to, ll id) : to(to), id(id) {} }; ll n, m; vector<vector<Edge>> graph; vector<bool> deleted; vector<ll> degree; vector<ll> mark; vector<ll> way; void ...
C++
b6d47e5aecf79efee161afebbf7f6707
25877cb24a2b635155e829fdfcf7e4a0
2,900
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int maxn = 1e5 + 5, mod = 1e9+7 ; const int N=5000+10; int n,m; set<int>e[N],e2[N]; set<int>del; int route[N]; int rcnt=0; void euler(int x){ while(e2[x].size()){ int y=*e2[x].begin(); // cout<<x<<' '<<y<<'\n'; ...
C++
b6d47e5aecf79efee161afebbf7f6707
95be787d396b717b7b4cff967269b5a1
2,900
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int maxn = 1e5 + 5, mod = 1e9+7 ; const int N=5000+10; int n,m; set<int>e[N],e2[N]; set<int>del; int route[N]; int rcnt=0; void euler(int x){ while(e2[x].size()){ int y=*e2[x].begin(); // cout<<x<<' '<<y<<'\n'; ...
C++
b6d47e5aecf79efee161afebbf7f6707
57eccdb00dc9a51ddb82140b307c1b95
2,900
PASSED
#include<iostream> #include<cstdio> #include<set> using namespace std; const int maxn=3010; int n,m; set<int> e[maxn],e2[maxn],del,ep; set<int>::iterator it; int route[maxn],tnt; inline int read(){ int res=0; char ch=getchar(),ch1=ch; while(!isdigit(ch))ch1=ch,ch=getchar(); while(isdigit(ch))res=(res<<...
C++
b6d47e5aecf79efee161afebbf7f6707
405da6c5499a80c0834d8d6b6fd4812e
2,900
PASSED
#include<bits/stdc++.h> #define f first #define s second #define int long long #define pii pair<int,int> using namespace std; const int N = 3e3 + 5, mod = 1e9 + 7; // ! int t, e[N][N]; vector<int> V[N], v, V1[N]; void dfs(int u) { while(V[u].size()) { int v = V[u].back(); V[u].pop_back()...
C++
b6d47e5aecf79efee161afebbf7f6707
f1f0562efbaad6151558afa1e7ad35c2
2,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int LIM=3e3+7; vector<int>euler; vector<pair<int,int>>V[LIM]; pair<int,int...
C++
b6d47e5aecf79efee161afebbf7f6707
cf3514210aa31b9128efba61f0d965c3
2,900
PASSED
#include <algorithm> #include <iostream> #include <vector> #include <algorithm> #include <cassert> #include <vector> namespace atcoder { // Implement (union by size) + (path compression) // Reference: // Zvi Galil and Giuseppe F. Italiano, // Data structures and algorithms for disjoint set union problems struct dsu ...
C++
b6d47e5aecf79efee161afebbf7f6707
81bb318d6a579ef9c2fd2a31dd76092b
2,900
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 300043; int n, m; set<int> g[N]; set<int> g2[N]; vector<int> res; void euler(int x) { while(!g2[x].empty()) { int y = *g2[x].begin(); g2[x].erase(y); g2[y].erase(x); euler(y); } res.push...
C++
b6d47e5aecf79efee161afebbf7f6707
9032fd94c8018115164a51a629f5ec33
2,900
PASSED
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #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<bitset> ...
C++
b6d47e5aecf79efee161afebbf7f6707
3e84276612fcaa4be1890193e5fb8870
2,900
PASSED
// #include "debug.h" #include <bits/stdc++.h> const int N = 3000; const int M = 3000; int n, m, head[N], to[M << 1], next[M << 1], dfn[N], low[N], size[N], child_index[N], number_of_odd, parity[N], dsu[N]; bool used[M], connected[N]; std::vector<int> children[N], plan; void prepare(int &&clock, int...
C++
b6d47e5aecf79efee161afebbf7f6707
86f31c3f54697420422ee812e39b24f3
2,900
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 200005; using ll = long long; int n,q,a[N],p[N],op[N],x[N],y[N],nxt[N],bel[N]; ll sum[N],ans[N];bool vis[N],visc[N];ll tag[N]; int buf[N],ptr; struct Vector { int *p,len; inline void init(int *x) {p = x;} inline void push_back(int x) {p[len++] = ...
C++
174e4e4f6e8aba28f991068ed68617d6
1e3544d99c0db96a10cad10aed5e787e
3,500
PASSED
#include <bits/stdc++.h> #include <memory> using namespace std; using ll = long long; using ld = long double; #define pb push_back #define forn(i, n) for (int i = 0; i < (int)(n); i++) #define forrn(i, s, n) for (int i = (s); i < (int)(n); i++) #define PYMOD(A, M) ((((A) % (M)) + (M)) % (M)) #define all(v) v.begin(),...
C++
174e4e4f6e8aba28f991068ed68617d6
f7a432ecf23bb09479d1ea155a0e817e
3,500
PASSED
#ifndef LOCAL #pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #endif #include <bits/stdc++.h> using namespace std; using ll=long long; #define int ll #define rng(i,a,b) for(int i=int(a);i<int(b);i++) #define rep(i,b) rng(i,0,b) #define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--) #...
C++
174e4e4f6e8aba28f991068ed68617d6
2e050bdad627f18b0ed5f99dc77cb5e9
3,500
PASSED
#pragma GCC optimize("O3") // iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <chrono> #include <random> #include <cstdlib> #include <cmath> #i...
C++
174e4e4f6e8aba28f991068ed68617d6
1a95f3312787094d12bd14c618126fe8
3,500
PASSED
#pragma GCC optimize("O3") // iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <chrono> #include <random> #include <cstdlib> #include <cmath> #i...
C++
174e4e4f6e8aba28f991068ed68617d6
25ea545c1b34f02a7557dfdc7666f6f0
3,500
PASSED
// iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <chrono> #include <random> #include <cstdlib> #include <cmath> #include <ctime> #include <cs...
C++
174e4e4f6e8aba28f991068ed68617d6
1c0d1631484139d0a9e6fe807228de9f
3,500
PASSED
// iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <chrono> #include <random> #include <cstdlib> #include <cmath> #include <ctime> #include <cs...
C++
174e4e4f6e8aba28f991068ed68617d6
0d39bc19fe06ea147f4c3b3b2368b275
3,500
PASSED
// iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <chrono> #include <random> #include <cstdlib> #include <cmath> #include <ctime> #include <cs...
C++
174e4e4f6e8aba28f991068ed68617d6
5dae71b40de1cc0c031f6fd28604ce85
3,500
PASSED
// iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <chrono> #include <random> #include <cstdlib> #include <cmath> #include <ctime> #include <cs...
C++
174e4e4f6e8aba28f991068ed68617d6
58a01d6b8f2657544f089a20c6d2ffe8
3,500
PASSED
// iostream is too mainstream #include <cstdio> // bitch please #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <chrono> #include <random> #include <cstdlib> #include <cmath> #include <ctime> #include <cs...
C++
174e4e4f6e8aba28f991068ed68617d6
4284cbcf86aedc597e29c01903a3594b
3,500
PASSED
#include <cstdio> #include <cmath> #include <algorithm> double pi=acos(-1.0); int n,rr,x[3001],y[3001],num[3001]; double L[3001],R[3001]; bool vis[3001]; bool ins[3001]; int main(){ scanf("%d%d",&n,&rr); for(int i=1;i<=n;++i)scanf("%d%d",x+i,y+i),vis[i]=1,L[i]=-pi-1e-5,R[i]=pi+1e-5,ins[i]=0; for(int i=1...
C++
f14e81618a81946dcaab281e1aa1ff9f
7ed261226e9cdcd6f1c11a0637880095
3,200
PASSED
#include <cmath> #include <cstdio> #include <complex> #include <algorithm> #define double long double #define acos acosl #define atan2 atan2l #define asin asinl #define sqrt sqrtl #define x real #define y imag typedef long long ll; const double PI=atan2(0,-1); const int Maxn=3000; const double eps=1e-9; ...
C++
f14e81618a81946dcaab281e1aa1ff9f
7c7bc40529fca62a126f08956f63e7e7
3,200
PASSED
#pragma GCC optimize("O2") #include<cstdio> #include<cmath> #include<algorithm> #include<vector> #include<queue> using namespace std; const double PI=acos(-1.0),RANG=PI/10,EPS=1e-5; struct pnt { double x,y;pnt(double _x=0,double _y=0):x(_x),y(_y){} }P[4000]; pnt rotate(pnt P,double RANG) { return ...
C++
f14e81618a81946dcaab281e1aa1ff9f
575ea0fe5505fa77a17b8204f5f89f87
3,200
PASSED
#include<bits/stdc++.h> using namespace std; const double pi=acos(-1.0); struct node{ double x,y; }p[3011]; int n,ans; double m,f[3011]; bool fl[3011][3011]; double dis(node a,node b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } void solve(int a){ double xl=0.0,xr=pi,yl=pi,yr=pi+pi,l,r; fo...
C++
f14e81618a81946dcaab281e1aa1ff9f
25591b782149d1eb9d3f0c26ea8a6941
3,200
PASSED
#include<cstdio> #include<cstring> #include<cmath> #define N 3100 using namespace std; typedef long double LF; const LF pi=acos(-1.0),eps=1e-4; template<class T> inline T mymin(T x,T y){return x<y?x:y;} template<class T> inline T mymax(T x,T y){return x>y?x:y;} template<class T> inline void zwap(T &x,T &y){...
C++
f14e81618a81946dcaab281e1aa1ff9f
80f3dcc5517c63d1719ddcb863676ab4
3,200
PASSED
#include<bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define pdd pair<double,double> #define mkp make_pair #define ll long long using namespace std; const int maxn=3200; const double pi=3.1415926535898; int n;ll R; pii b[maxn]; double w[maxn]; pdd p; int bx=0; int g[maxn][...
C++
f14e81618a81946dcaab281e1aa1ff9f
086db349db173f7e3d5ce06cd6f9cbc7
3,200
PASSED
#include <bits/stdc++.h> using namespace std; using i64 = long long; namespace fastr { constexpr int xn = 1 << 20; char b[xn], *s = b, *t = b; char gc() { return s == t and (t = (s = b) + fread(b, 1, xn, stdin)) == b ? EOF : *s++; } struct fstream {} fin; template<class tp> fstream ...
C++
f14e81618a81946dcaab281e1aa1ff9f
8f69796a1f3385c2466f372ff4aecf54
3,200
PASSED
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define fi first #define se second #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)((x).size())) using namespace std; typedef pair<int, int> PII; typedef vector<int> VI; typedef long long int64; typedef unsigned int uint; typedef u...
C++
f14e81618a81946dcaab281e1aa1ff9f
8c2b69bcd62e8296e3aab9070c93cf3e
3,200
PASSED
#include <stdio.h> #include <stdlib.h> #include <math.h> const int MAXN = 3000; const double eps = 1e-12; const double PI = acos(-1); int n; double R; struct Point { double x; double y; }; struct Range { double low; double high; }; Point points[MAXN]; Range intersectRa...
C++
f14e81618a81946dcaab281e1aa1ff9f
2f3e86fa08cf81bef05364ed252f0f4e
3,200
PASSED
#include<bits/stdc++.h> using namespace std; const double pi=acos(-1); int n,R; struct P{ int x,y; }p[3005]; long long sqr(int x){ return 1ll*x*x; } int ok[3005][3005]; void upd(int x){ int fir=0; double pl=0,pr=0; for (int i=1;i<=n;i++) if (i!=x){ long long d=sqr(p[i].x-p[x].x)+sqr(p[i].y...
C++
f14e81618a81946dcaab281e1aa1ff9f
23463f8071fc8a304ac1f475a9a237b3
3,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,x,y,t,r,m,i; cin>>t; while(t--) { x=y=0; m=INT_MIN; cin>>n; int a[n],b[n]; for(i=0; i<n; i++) cin>>a[i]; for(i=0; i<n; i++) { cin>>b[i]; ...
C++
ee40e8b0ed2da53127f53eb694653a30
016cf8209034333e596af0197e4bf23a
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n, j; cin >> n; int a[n]; for (j = 0; j < n; j++) { cin >> a[j]; } int b[n], c = 0; for (j = 0; j...
C++
ee40e8b0ed2da53127f53eb694653a30
1adf7b8b45972fe21cef876af89271ec
800
PASSED
#include<iostream> #include<bits/stdc++.h> #define ll long long using namespace std; int main(){ int t; cin >> t; for(int i= 0; i< t; i++){ int n; cin >> n; vector<int> A(n,0); vector<int> B(n,0); int res = 5; for(int j= 0; j< n; j++){ cin >> A[...
C++
ee40e8b0ed2da53127f53eb694653a30
05a27bd5e775865ae5a2feff929ca088
800
PASSED
///17571@nith.ac.in @Ankit Verma #include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define MP make_pair #define int long long #define ll long long #define inf 0x3f3f3f3f #define MOD 1000000...
C++
ee40e8b0ed2da53127f53eb694653a30
aaf324addc8789baec7b38d534c1bc25
800
PASSED
#include <bits/stdc++.h> #define ing long long using namespace std; int n,a[200005],b[200005]; signed main() { int T;cin>>T; while ( T-- ) { cin>>n; for ( int i=0; i<n; i++ ) scanf("%lld",&a[i]); for ( int i=0; i<n; i++ ) scanf("%lld",&b[i]); int isp = 1, last=-1; for ...
C++
ee40e8b0ed2da53127f53eb694653a30
5d2d71aa731b3f08c3e071941201cd06
800
PASSED
#include<bits/stdc++.h> #define pb emplace_back #define ll long long #define dbl double #define yes cout<<"yes"<<endl; #define no cout<<"no"<<endl; #define Yes cout<<"Yes"<<endl; #define No cout<<"No"<<endl; #define YES cout<<"YES"<<endl; #define NO cout<<"NO"<<endl; #define en "\n\n" #define O_O t-- using namespace st...
C++
ee40e8b0ed2da53127f53eb694653a30
ddd98b3901d1f09aec555f76cf91eafb
800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll t; cin>>t; while(t--){ ll n,counter=0,x=0,target,y=0; cin>>n; ll a[n]; ll b[n]; for(ll i=0;i<n;i++) { cin>>a[i]; } for(ll i=0;i<n;i++) { cin>>b[i]; if(b[i]>0) ...
C++
ee40e8b0ed2da53127f53eb694653a30
5ceb3b947ca81efa02c785a3942e487d
800
PASSED
#include <iostream> #include <iomanip> #include <numeric> #include <utility> #include <limits> #include <chrono> #include <functional> #include <algorithm> #include <istream> #include <ostream> #include <sstream> #include <vector> #include <array> #include <deque> #include <queue> #include <stack> #include <list> #i...
C++
ee40e8b0ed2da53127f53eb694653a30
025e98e151de8d0e6fb19f2ae8ff23b1
800
PASSED
#define _CRT_SECURE_NO_WARNINGS 1 #include <cstdio> #include <algorithm> #include <string> #include <iostream> #include <map> #include<cmath> #include <iomanip> using namespace std; long long read() { //由于输入量过大,最好使用快读 long long x = 0, f = 1; char ch = getchar(); while ((ch < '0' || ch>'9') && ch != '-')...
C++
ee40e8b0ed2da53127f53eb694653a30
900fddd9f99bab82c18aaf01aa90054d
800
PASSED
#include <bits/stdc++.h> using namespace std; #define pii pair<ll,ll> #define ll long long int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); ll t; cin>>t; while(t--){ ll n; cin>>n; vector<ll>a(n); vector<ll>b(n); ll f =0; ...
C++
ee40e8b0ed2da53127f53eb694653a30
1d84c5c627c80d57dc097d9b5d76520c
800
PASSED
#include<bits/stdc++.h> using namespace std; main() { int t; cin >> t; while(t--) { int k,n; cin >> n >> k; char str[n+1]; for(int i=0;i<n;i++) { cin >> str[i]; } int ara[n+1]; memset(ara,0,sizeof(ara)); ...
C++
6e3bacbe61775883599989d0f61367d5
dc474c671e4cb346cd95322cff54a724
1,000
PASSED
#include<bits/stdc++.h> using namespace std; main() { int t; cin >> t; while(t--) { int k,n; cin >> n >> k; char str[n+1]; for(int i=0;i<n;i++) { cin >> str[i]; } int ara[n+1]; memset(ara,0,sizeof(ara)); ...
C++
6e3bacbe61775883599989d0f61367d5
292db616da3453419e4a580462b7d736
1,000
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ int t,a,b; string s; cin>>t; while(t--){ cin>>a>>b; cin>>s; int min=0; for(int i=0;i<b;i++) if(s[i]=='W') min++; int temp=min; for(int i=1;i<=s.size()-b;i++){ ...
C++
6e3bacbe61775883599989d0f61367d5
c3a834dc562b941d0f2bf40f5bc504dd
1,000
PASSED
#include<bits/stdc++.h> using namespace std; char s[2 * 100000 + 10]; void solve() { int n, k; scanf("%d%d", &n, &k); scanf("\n%s", s + 1); vector<int>a(n + 1); for (int i = 1; i <= n; i++) { if (s[i] == 'B')a[i] = 1; a[i] = a[i - 1] + a[i]; } int ans = 1e9 + 10; for (int i = k, j = 0; i <= n; i++, j++) {...
C++
6e3bacbe61775883599989d0f61367d5
f8528bc6b986bb0b9a83bb43db21497d
1,000
PASSED
#include<iostream> #include<vector> using namespace std; int main() { vector<int> c; int t; cin >> t; for (int l = 0; l < t; l++) { int max = 0; int sum = 0; string v; int n; int k; cin >> n >> k; cin >> v; for (int i = 0; i < k; i++) { if (v[i] == 'B') sum++; } if (sum > max) ...
C++
6e3bacbe61775883599989d0f61367d5
39d41ed7b5c25cbf13e1d359caeaaa14
1,000
PASSED
#include<iostream> using namespace std; int sum[3000001]; int getlen(int l,int r) { return sum[r] - sum[l-1]; } void solve() { int n,k; cin>>n>>k; char s[300001]; cin>>s+1; for(int i=1;i<=n;i++) { if(s[i] == 'B') sum[i] = sum[i-1] + 1; else sum[i] = sum[i-1...
C++
6e3bacbe61775883599989d0f61367d5
27ece8a2a03c69f53ba106010b30e106
1,000
PASSED
/*** * Informathons : * @Author: DYM_ * @Date: 2022-08-03 20:25:42 ***/ #include <bits/stdc++.h> #include <iostream> #include <cstdio> #define Buff std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define int long long #define ULL unsigned long long #define INF LLONG_MAX - 1 #define inf -0x3f3f3f3f #define e...
C++
6e3bacbe61775883599989d0f61367d5
0263e1ae5bbebaafac725eab22334392
1,000
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int t; cin>>t; while(t--) { ll n,k; cin>>n>>k; string s; cin>>s; vector<ll>pr(n+1,0); for(int i=0; i<n; i++) { if(s[i]=='W') { p...
C++
6e3bacbe61775883599989d0f61367d5
e32dbb4d5926be855b8b07d93e022fdc
1,000
PASSED
// Mahmoud Zaghloul #include <bits/stdc++.h> #define Mahmoud251 cin.tie(0); ios_base ::sync_with_stdio(0); cout.tie(0); #define SORT sort(v.begin(),v.end()); #define min1 *min_element(v.begin(),v.end()); #define FOR(n) for (int i=0; i<n; i++) #define yes cout << "YES" << endl; #define no cout << "NO" << endl; #define ...
C++
6e3bacbe61775883599989d0f61367d5
9f947e23645994b2c4446f01931076fa
1,000
PASSED
#define _CRT_SECURE_NO_WARNINGS 1 #include <cstdio> #include <algorithm> #include <string.h> #include <iostream> #include <map> #include<cmath> #include <iomanip> using namespace std; long long read() { //由于输入量过大,最好使用快读 long long x = 0, f = 1; char ch = getchar(); while ((ch < '0' || ch>'9') && ch != '-...
C++
6e3bacbe61775883599989d0f61367d5
f32ef43ac148b593d9617bead1fefac6
1,000
PASSED
from collections import * from heapq import * from bisect import * from itertools import * from string import * from math import * def solve(): n = int(input()) s = input() P = list(map(int, input().split())) P = [x - 1 for x in P] seen = set() components = [] def dfs(u, component): ...
Python
f4cf2759d6f6941044f913cb89f39dbe
783d4400ddbe525f2eed42f4a5a0df45
1,700
PASSED
from sys import stdin,setrecursionlimit setrecursionlimit(100000) from math import gcd input=stdin.readline from collections import deque for _ in range(int(input())): n=int(input()) a=list(input().strip()) p=list(map(int,input().split())) ar={i:[] for i in range(n)} for i in range(n): ...
Python
f4cf2759d6f6941044f913cb89f39dbe
f4755740cc0094d681ac3372922a5680
1,700
PASSED
#!/usr/bin/env PyPy3 from collections import Counter, defaultdict, deque import itertools import re import math from functools import reduce import operator import bisect from heapq import * import functools mod=998244353 import sys import os from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): new...
Python
f4cf2759d6f6941044f913cb89f39dbe
ba50abe18d6c322d56ccb1b98ece1794
1,700
PASSED
#!/usr/bin/env PyPy3 from collections import Counter, defaultdict, deque import itertools import re import math from functools import reduce import operator import bisect from heapq import * import functools mod=998244353 import sys import os from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): new...
Python
f4cf2759d6f6941044f913cb89f39dbe
a855073b0bdd7b92023c854195782650
1,700
PASSED
import sys input=sys.stdin.readline from math import gcd def lcm(args): LCM = lambda a, b: a * b // gcd(a, b) res = 1 for i in args: res = LCM(i, res) return res def get_divisors(n): divisors = [] i = 1 while i * i <= n: if n % i == 0: divisors.append(i) ...
Python
f4cf2759d6f6941044f913cb89f39dbe
d94bdff81169edd661b78016184aa6b1
1,700
PASSED
import sys input=sys.stdin.readline from math import gcd def lcm(args): LCM = lambda a, b: a * b // gcd(a, b) res = 1 for i in args: res = LCM(i, res) return res def works(x, repeat_length): comp = x[:repeat_length] for i in range(0, len(x), repeat_length): if x[i: i + rep...
Python
f4cf2759d6f6941044f913cb89f39dbe
247bb4cb23cf731a25527d80231a6e6e
1,700
PASSED
import sys import os from io import BytesIO, IOBase from math import gcd import math # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" no...
Python
f4cf2759d6f6941044f913cb89f39dbe
7018836171f7a1890318c61f2701ad4b
1,700
PASSED
import sys import os from io import BytesIO, IOBase from math import gcd import math # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" no...
Python
f4cf2759d6f6941044f913cb89f39dbe
20447cbfecc0a3cc72422077ef364f79
1,700
PASSED
import sys import os from io import BytesIO, IOBase from math import gcd # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mod...
Python
f4cf2759d6f6941044f913cb89f39dbe
c6e8fa2d6f5692681ce6da077bee3b73
1,700
PASSED
import sys import os from io import BytesIO, IOBase from math import gcd # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mod...
Python
f4cf2759d6f6941044f913cb89f39dbe
9253326f0f256fbde529a8f65f311377
1,700
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; int a=n/3,m=n%3; if(m==0)cout<<a<<' '<<a+1<<' '<<a-1<<endl; if(m==1)cout<<a<<' '<<a+2<<' '<<a-1<<endl; if(m==2)cout<<a+1<<' '<<a+2<<' '<<a-1<<endl; } return 0; } ...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
1340b5f3026ea04a9006f28bb02d880e
800
PASSED
#include <bits/stdc++.h> #include <stack> #include <iostream> #include <string> #include <string.h> #include <queue> #include <vector> #include <set> #include <cmath> #include <list> #include <algorithm> #include <cstdio> #include <map> # include <stdio.h> # include <stack> using namespace std; const int n = 1e5, t = 1...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
8350b81326cad66865f592c314a87865
800
PASSED
#include <iostream> #include <stack> #include <cstdio> using namespace std; int main() { int t,a; cin >> t; while(t--){ scanf("%d",&a); if(a%3 == 0){ a/=3; printf("%d %d %d\n",a,a+1,a-1); continue; } if(a%3 == 1){ a/=3; printf("%d %d %d\n",a,a+2,a-1); continue; } if(a%3 == 2){ a/=3; ...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
23cfc9385ea40bcb1385bc14eab20a7d
800
PASSED
#include <bits/stdc++.h> #define ing long long using namespace std; signed main() { int T;cin>>T; while ( T-- ) { int n;cin>>n; int yu = n%3; int x = n/3; if ( yu==0 ) cout << n/3 << " " << n/3+1 << " " << n/3-1 << endl; else if ( yu==1 ) cout << x << " " << x+2 << " " ...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
a33d9aee3191647a3d5fe1c51cd0fa78
800
PASSED
#include<cstdio> int main(void) { int t; while (scanf("%d", &t) != EOF) { int n; for (int i = 0; i < t; i++) { scanf("%d",&n); int h1, h2, h3; h1 = h2 = h3 = n / 3; int res = n - (h1+h2+h3); if (res > 0) h3 += res; while (h2 >= h1 || h3 >= h2) { while (h3 >= h2) { h2++; ...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
4ee5df299ccae4f209549185f83faec9
800
PASSED
// Starting with the name of Allah #include <bits/stdc++.h> #define ll long long #define nl endl #define Nayon ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a/gcd(a,b))*b #define v_sum(a) accumulate(a.begin(),a.end(),0) #define v_max(a) *m...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
a91fda43a93fe39ef64ad088146299e0
800
PASSED
#include<bits/stdc++.h> using namespace std; bool sortbysec(const tuple<char,long long,long long> &a, const tuple<char,long,long> &b) { return (get<1>(a) > get<1>(b)); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--){ int n; ...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
ad9b1db7a3d9dd210e87ab3ffa492335
800
PASSED
#include<iostream> #include<cmath> #include<cstdio> using namespace std; int T; int main(){ scanf("%d",&T); while(T--) { int n; scanf("%d",&n); for(int i=1;i<=n;i++) { int now=i+i-1; if(n-now<i-1) { if(n-now==0) { cout<<i-2<<" "<<i<<" "<<n-now+1<<endl; } else cout<<i-1<<" "<<i...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
d4a71db7554bdf8adbe3eade053f56e4
800
PASSED
#include <iostream> using namespace std; int main(){ int x, t; cin >> t; while(t--){ cin >> x; if (x == 7){ cout << 2 << " " << 4 << " " << 1 << endl; continue; } if (x % 3 == 0) cout << x/3 << " " << (x/3) + 1 << " " << (x/3) -1 << endl; else if (x%3 == 1) cout << (x/3) + 1 << " " << (x/...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
b6ab92b223adccb72ddfd8aacc89ca66
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t --) { int n , h1 , h2 , h3; cin >> n; int a = n % 3; int b = n / 3; if(a == 0) { h1 = b + 1; h2 = b; h3 = b - 1; } else if(a == 1){ h1 = b + 2; h2 = b + 1; h3 = b - 2; } else{ h1 = b + 2; h...
C++
45cf60f551bd5cbb1f3df6ac3004b53c
f78566d3b375aa50b550c810497b0550
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt; cin>>nt; int n; while(nt--){ cin>>n; int s[n],f[n],d[n]; for(int i=0;...
C++
2fee6c39d4e55f903837ef81e818eb07
70724fdb1e38565c814d709695eeb35e
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); //valid when using only c++ streams cin.tie(0); //not force cout to flush whenever doing cin int nt; cin>>nt; int n; for(int i=0;i<nt;i++){ cin>>n; vector <int> s(n), f(n),d(n); ...
C++
2fee6c39d4e55f903837ef81e818eb07
b9d0c502f3aa16ae597e196e6afe13f8
800
PASSED