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> using namespace std; const int N=1e5+5; void solve() { int n; cin>>n; vector<int> v(n); vector<int> vc[n+10]; for(int i=0;i<n;i++){ cin>>v[i]; vc[v[i]].push_back(i); } for(int i =1;i<=n;i++){ if(vc[i].size()) { int m=0,mx=1; for( int j=1;j<vc[i].siz...
C++
c63640fd70e0268f03cb4eec18540f3a
0d98cfd30cb57536274f5818d52107f6
1,100
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; void solve() { int n; cin>>n; vector<int> v(n); vector<int> vc[n+1]; for(int i=0;i<n;i++){ cin>>v[i]; vc[v[i]].push_back(i); } for(int i =1;i<=n;i++){ if(vc[i].size()) { int m=0,mx=1; for( int j=1;j<vc[i].siz...
C++
c63640fd70e0268f03cb4eec18540f3a
cfb817a19b7491a3ca24de3f2a811554
1,100
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; void solve() { int n; cin>>n; vector<int> v(n); vector<int> vc[n+1]; for(int i=0;i<n;i++){ scanf("%d",&v[i]); vc[v[i]].push_back(i); } for(int i =1;i<=n;i++){ if(vc[i].size()) { int m=0,mx=1; for( int j=1;j<v...
C++
c63640fd70e0268f03cb4eec18540f3a
6590041188c962ac7ab287337a9359a4
1,100
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; void solve() { int n; cin>>n; int v[n]; vector<int> vc[n+1]; for(int i=0;i<n;i++){ scanf("%d",&v[i]); vc[v[i]].push_back(i); } for(int i =1;i<=n;i++){ if(vc[i].size()) { int m=0,mx=1; for( int j=1;j<vc[i].siz...
C++
c63640fd70e0268f03cb4eec18540f3a
9528f587c02ab5fba1d3fc987a749880
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; int main() { int i,j,k,n,t; cin>>t; while(t--) { cin>>n; int a[n]; vector<int> pos[n+1]; for(i=0; i<n; i++) { scanf("%d",&a[i]); pos[a[i]].push_back(i);...
C++
c63640fd70e0268f03cb4eec18540f3a
5dc5097478923a747e354b41b3322290
1,100
PASSED
#include<bits/stdc++.h> #include<iostream> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma GCC optimize("unroll-loops") #define ios ios_base::sync_with_stdio(false);cin.tie(NULL); #define no cout<<"NO"<<endl; #defi...
C++
c63640fd70e0268f03cb4eec18540f3a
e5851745ca63c6ca49b22a8f8070d5b5
1,100
PASSED
#include <iostream> #include <queue> #include <stack> #include <algorithm> #include <string.h> #include <numeric> #define task "tam" #define size() size() * 1ll #define all(x) (x).begin(), (x).end() #define allr(x, sz) (x) + 1, (x) + 1 + sz #define pb push_back #define pii pair<int, int> #define fi first ...
C++
a365055f2d1c836fd50aed9090db1072
fae26900692b4eb231d1fe07a929a2df
2,300
PASSED
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; const int M=2e5+10; int T,cnt; int n,m,q,rt; struct edge{ int to,nxt; }e[M<<1]; struct node{ int maxn; int left,right; }tree[N<<1]; int a[N<<1],fa[N<<1]; int val[N<<1],dep[N<<1]; int head[N<<1],f[N<<1][30]; int read(){ int r=0,f=1; ...
C++
a365055f2d1c836fd50aed9090db1072
6752cc7e6acffda0c27c98527c9d9103
2,300
PASSED
#include<bits/stdc++.h> #define ll long long #define db double #define file(a) freopen(#a".in","r",stdin),freopen(#a".out","w",stdout) #define sky fflush(stdout) #define Better_IO true namespace IO{ #if Better_IO==true char buf[(1<<20)+3],*p1(buf),*p2(buf); const int lim=1<<20; inline char gc(){ if...
C++
a365055f2d1c836fd50aed9090db1072
39fff5b0fc8959f9470624091fd48a4c
2,300
PASSED
#include <bits/stdc++.h> #define int long long #define ent std::cout << '\n' #define tab std::cout << ' ' #define Arr std::vector #define Ptn std::pair #define de put(114514) const int N = 2e5 + 5; int st1[N][25], st2[N][25]; int T, n, m, q, fa[N], val[N], f[N][25], fat[N], dep[N], dfn[N], rnk[N], par[N], cur;...
C++
a365055f2d1c836fd50aed9090db1072
746b28d938f05634665e56a534ab0bad
2,300
PASSED
#include <bits/stdc++.h> #define lson k << 1 #define rson k << 1 | 1 #define int long long using namespace std; const int maxn = 2e5 + 10; int n, m, q; int a[maxn]; int dep[maxn], fa[maxn][30]; int f[maxn]; int mx[maxn][30]; // 到第 2^i 个父亲路径的最大边权 struct node { int l, r; int x; }A[maxn << 2]; struct edge...
C++
a365055f2d1c836fd50aed9090db1072
97d4a42db1a07e71aa312d35d9af339b
2,300
PASSED
#include<iostream> #include<cstring> using namespace std; typedef long long LL; const int maxn = 1e5 + 5, INF = 0x3f3f3f3f; int p[maxn], f[maxn][20]; int h[maxn], e[maxn * 2], ne[maxn * 2], w[maxn * 2], idx; int q[maxn], depth[maxn], fa[maxn][20], maxd[maxn][20]; void add(int a, int b, int c){ e[idx] = b...
C++
a365055f2d1c836fd50aed9090db1072
26d14f0dab396b6a344a5a98a0fcd9a0
2,300
PASSED
#include<bits/stdc++.h> using namespace std; inline int read(){ int res=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ res=res*10+ch-'0'; ch=getchar(); } return res*f; } const int ...
C++
a365055f2d1c836fd50aed9090db1072
3189248b64869857bb461785ef75af93
2,300
PASSED
#include<bits/stdc++.h> using namespace std; inline int read(){ int res=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ res=res*10+ch-'0'; ch=getchar(); } return res*f; } const int ...
C++
a365055f2d1c836fd50aed9090db1072
9213c45d182820f43760f0ce405bb860
2,300
PASSED
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define max_n 200000 int t; int n; int m; int q; struct L{ int u,v,w; }l[max_n+2]; int fa[max_n<<2]; int fi; int w[max_n<<2]; struct E{ int v,nx; }e[max_n<<2]; int ei; int fir[max_n<<2]; bool vis[max_n<<2]; int de[max_n<<...
C++
a365055f2d1c836fd50aed9090db1072
e362670ac3287056492ce171fafb52b3
2,300
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; template<typename T> inline void in(T &x) { x=0; T f=1; char c=getchar(); while(!isdigit(c)){if(!isspace(c))f=-1; c=getchar();} while(isdigit(c)){x=x*10+(c^48); c=getchar();} x*=f; return; } template<typename T,typename... Arg...
C++
a365055f2d1c836fd50aed9090db1072
5c10bc1d32b5a4a4cdd74ef54aa8baf9
2,300
PASSED
#include <iostream> #include <vector> #include <set> #include <map> #include <cmath> #include <stack> #include <queue> #include <algorithm> #include <iomanip> #include <cassert> #define ll long long #define pip pair <ll, int> #define strings pair <string, string> #define mp(a,b) make_pair(a,b) #define pb(a) push_back(a...
C++
a7ae834884ce801ffe111bd8161e89d2
ec397211ba10f2fe0d255e68d82f0a8c
2,400
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <iomanip> #include <map> #include <set> #include <fstream> #include <string> #include <bitset> #include <ctime> #include <random> #include <iterator> #include <cmath> #include <queue> #include <deque> using namespace std; #define al...
C++
a7ae834884ce801ffe111bd8161e89d2
8a498e1a62147ef53ffecff4ec76c043
2,400
PASSED
#include <locale.h> #include <iostream> #include <fstream> #include <algorithm> #include <vector> #include <numeric> #include <iterator> #include <sstream> #include <map> #include <math.h> #include <stdio.h> #include <stack> #include <random> #include <ctime> #include <queue> #include <set> using na...
C++
a7ae834884ce801ffe111bd8161e89d2
b7f11a61c26aa8510b91d5064b109641
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define sz 100009 int arr[sz],brr[sz]; std::vector<int> v[sz]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int test_case=1; cin>>test_case; for(int cs=1;cs<=test_case;cs++) { int n,k; cin>>n>>k; int mn=1; ...
C++
a7ae834884ce801ffe111bd8161e89d2
13c66982c29a9640b84c90b8eabb6ebb
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define sz 100009 int arr[sz],brr[sz]; std::vector<int> v[sz]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int test_case=1; cin>>test_case; for(int cs=1;cs<=test_case;cs++) { int n,k; cin>>n>>k; int mn=1; ...
C++
a7ae834884ce801ffe111bd8161e89d2
6adeff8ad86bee95b15480ac4ef26578
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define sz 100009 #define sz1 100000 int arr[sz],brr[sz],crr[sz]; void add(int l,int val) { if(val<l) return; crr[l]++; crr[val+1]--; brr[l]=max(brr[l],val); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int test_case=1; ...
C++
a7ae834884ce801ffe111bd8161e89d2
56e8d3cadf1ff4e20674a2b383781cfb
2,400
PASSED
#include <bits/stdc++.h> //tle using ll = long long; const long long N = 1e5 + 10, M = 28, P = 998244353, inf = (1ll << 60) - 1; typedef unsigned long long ull; typedef unsigned int uint; typedef std::pair<ll, ll> PII; typedef std::pair<int, double> PID; typedef std::pair<double, double> PDD; #define endl '\...
C++
a7ae834884ce801ffe111bd8161e89d2
773c33bca421f22877c38bb9ad2183a8
2,400
PASSED
/* name: 1706D * author: 5ab * created at: 22-07-18 23:02 */ #include <iostream> #include <queue> using namespace std; typedef long long ll; const int max_n = 100000; struct nd { int id, vl; nd(int _i = 0, int _v = 0) : id(_i), vl(_v) { } bool operator<(const nd& n) const { return vl < n.vl;...
C++
a7ae834884ce801ffe111bd8161e89d2
66798933e7938130438d499ec9eb67d8
2,400
PASSED
#include <iostream> #include <cmath> #include <algorithm> #include <queue> using namespace std; int nex(int n, int k) { if (n / k == 0) { return 1e5 + 1; } return max(n / (n / k), k) + 1; } signed main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin ...
C++
a7ae834884ce801ffe111bd8161e89d2
0b12999d6dec58a68d51d4667c634a6f
2,400
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> #include <numeric> #include <set> #include <queue> #include <random> #include <assert.h> #include <math.h> #include <time.h> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x)....
C++
a7ae834884ce801ffe111bd8161e89d2
a291d20e1c4b5cfe58cb26ec26758075
2,400
PASSED
#include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0;i<int(n);i++) #define out cout<< #define in cin>> #define endl "\n" #define ll long long #define tt int t;cin>>t;while(t--) #define FIFO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); void solve() { tt { int a,b,a...
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
28eb33c371238fa51daef00d0d9f5425
800
PASSED
#include <bits/stdc++.h> #define ll long long #define str string #define pb push_back #define kick(x) cout << x << "\n"; #define loop(i, a, b) for (int i = a; i < b; i++) #define loope(i, a, b) for (int i = a; i <= b; i++) #define loopr(i, a, b) for (int i = a; i >= b; i--) using namespace std; int main() { ll t,...
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
603bdaadb81dcc893203ceb3664769d4
800
PASSED
#include<bits/stdc++.h> #include<iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> #include<queue> #define ll long long #define nl "\n" using namespace std; long long gcd(ll a , ll b) { while(b!=0) { int z=a; a=b; b=z%b; } return a; } ll lcm(ll a , ll b) { return a/gcd(a,b)*b; ...
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
54682f422ad037ca1429f975d7851eda
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef unsigned int uint; #define ss " " #define el "\n" #define cel cout <<"\n"; #define pb push_back #define arrlen(n) sizeof(n)/sizeof(n[0]) #define chartoint(c) (c -'0') #define CHAR_TO_LOW...
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
6c3d38ef7f9fee871640a38d6cc3d442
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t,n,m; cin>>t; for(int i=0;i<t;i++){ cin>>n>>m; cout<<min({(m+n)/4,n,m})<<endl; } }
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
49a0c9bed92da0a109c058d82f3dcd8c
800
PASSED
# include <bits/stdc++.h> using namespace std ; int main () { int T ; cin >> T ; for ( long long a, b, t; T --; cout << ( a <= b && a <= t? a: b <= a && b <= t? b: t ) << endl ) cin >> a >> b, t = a + b >> 2 ; return 0; }
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
8caf4506608d812180823ea857791ac0
800
PASSED
#include <cmath> #include <string> #include <iostream> #include <algorithm> #include <vector> #include <cstdlib> #include <map> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; int x = min(a, b); int y = max(a, b); int z=(x+y)/4; if(x<=z) cout<<x<<endl; else...
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
7fc77ff93a160cb00db0418310f8cd3c
800
PASSED
#include<stdio.h> main() { int tt; scanf("%d",&tt); while(tt--) { long long int p,m,count=0; scanf("%lld %lld",&p,&m); long long int min,max; min=(p<m)?p:m; max=(p>m)?p:m; if(min*3<=max) printf("%lld\n",min); else printf("%l...
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
e3777da9616e0b8a515c789e51d4b394
800
PASSED
#include<bits/stdc++.h> #define x first #define gcfx main #define y second #define mak make_pair #define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define debug(a) cout<<a<<'\n' #define endl '\n' #define umap unordered_map using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef p...
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
9845371c0b7b3c8a673fa71b9e8253aa
800
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int void speed() { ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); } int main() { speed(); int n; cin>>n; while(n--) { ll a,b; cin>>a>>b; if(a==b) cout<<a/2<<'\n'; else { //...
C++
8a1ceac1440f7cb406f12d9fc2ca0e20
07a461df749cc623a33b1dd604702d32
800
PASSED
#include<bits/stdc++.h> // #pragma GCC optimize("Ofast") // #pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") // #pragma GCC optimize("unroll-loops") #define ll long long int #define ld long double #define ff first #define ss second #define all(x) (x).begin(), (x).end() #de...
C++
09a0bad93090b65b5515abf0ccb96bd4
66112c8be29ae62714c850f02e7fc190
1,900
PASSED
#include<bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma GCC optimize("unroll-loops") #define ll long long int #define ld long double #define ff first #define ss second #define all(x) (x).begin(), (x).end() #define scan...
C++
09a0bad93090b65b5515abf0ccb96bd4
a315fab92d1ca120c7d849fe1af8b432
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int LOG = 18; struct lowest_common_ancestor{ vector<int> d; vector<vector<int>> pp; lowest_common_ancestor(vector<int> &p, vector<int> &d): d(d){ int N = p.size(); pp = vector<vector<int>>(LOG, vector<int>(N, -1)); pp[0] = p; for (int i...
C++
09a0bad93090b65b5515abf0ccb96bd4
5191dc48b7216409c1b6c166779cc405
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false) ,cin.tie(0), cout.tie(0); //#pragma GCC optimize(3,"Ofast","inline") #define ll long long #define PII pair<int, int> //#define int long long const int N = 2e5 + 5; const int M = 1e5 + 5; const int INF = 0x3f3f3f3f; const ll L...
C++
09a0bad93090b65b5515abf0ccb96bd4
05d6094ca5c362d4eedbdece8d9cf24b
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false) ,cin.tie(0), cout.tie(0); //#pragma GCC optimize(3,"Ofast","inline") #define ll long long #define PII pair<int, int> //#define int long long const int N = 2e5 + 5; const int M = 1e5 + 5; const int INF = 0x3f3f3f3f; const ll L...
C++
09a0bad93090b65b5515abf0ccb96bd4
cea3312be6ae28db05346a5c9a17120a
1,900
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #ifdef LOCAL #include "../debug.h" #define fstart cout.setf(ios::fixed); cout.precision(10); int START = clock(); ifstream cin("../input.txt") #define finish cout << "\ntime: " << setprecision(4) << (clock()...
C++
09a0bad93090b65b5515abf0ccb96bd4
58e9177760eac5c83a41ed8c652e7e35
1,900
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #ifdef LOCAL #include "../debug.h" #define fstart cout.setf(ios::fixed); cout.precision(10); int START = clock(); ifstream cin("../input.txt") #define finish cout << "\ntime: " << setprecision(4) << (clock()...
C++
09a0bad93090b65b5515abf0ccb96bd4
224a29341854aeec68297b6612577a0c
1,900
PASSED
#include <iostream> #include <cmath> #include <vector> #include <set> #include <chrono> #include <random> #include <queue> #include <cassert> #include <map> #include <algorithm> #define ll long long using namespace std; struct Tree { vector<vector<int>> adj; vector<int> parent; vector<vector<...
C++
09a0bad93090b65b5515abf0ccb96bd4
40b7891fa88dcc3d4d00c417966d4d49
1,900
PASSED
#include <iostream> #include <cmath> #include <vector> #include <set> #include <chrono> #include <random> #include <queue> #include <cassert> #include <map> #include <algorithm> #define ll long long using namespace std; bool solve (int N, int K, vector<int> x, vector<vector<int>> adj) { assert(x.size()...
C++
09a0bad93090b65b5515abf0ccb96bd4
9425101d8c1242419cabe78a23de4014
1,900
PASSED
#include <iostream> #include <cmath> #include <vector> #include <set> #include <chrono> #include <random> #include <queue> #include <cassert> #include <map> #include <algorithm> #define ll long long using namespace std; bool solve (int N, int K, vector<int> x, vector<vector<int>> adj) { assert(x.size()...
C++
09a0bad93090b65b5515abf0ccb96bd4
805cfae65048f2413e0c636729620743
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define all(x) begin(x), end(x) #define sz(x) int((x).size()) #define pb push_back #define F first #define S second using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; template<class T> using V = vector<T>; template<class T> using pq...
C++
bf89bc12320f635cc121eba99c542444
965a6d8ecf05297442431f67056094a5
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define all(x) begin(x), end(x) #define sz(x) int((x).size()) #define pb push_back #define F first #define S second using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; template<class T> using V = vector<T>; template<class T> using...
C++
bf89bc12320f635cc121eba99c542444
d28af1f2a32a62777060901a5faa637c
1,700
PASSED
#include<bits/stdc++.h> using namespace std; vector<int> adj[200005]; void addEdge(int x,int y) { adj[x].push_back(y); adj[y].push_back(x); } vector<int> fr; bool roots; bool visited[200005]; int level[200005]; void bfs() { queue<int > q1; q1.push(1); visited[1]=true; level[1]=0...
C++
bf89bc12320f635cc121eba99c542444
a5aeca5889cb068938eb69a356624635
1,700
PASSED
// #pragma GCC optimize("Ofast") // #pragma GCC target("avx") using namespace std; #define ll long long // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>ordered...
C++
bf89bc12320f635cc121eba99c542444
4a82b9c059f2eed7be1d77f0959c9829
1,700
PASSED
// #pragma GCC optimize("Ofast") // #pragma GCC target("avx") using namespace std; #define ll long long // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>ordered...
C++
bf89bc12320f635cc121eba99c542444
e0a8d8e2e498683e1d77838fda64465f
1,700
PASSED
// #pragma GCC optimize("Ofast") // #pragma GCC target("avx") using namespace std; #define ll long long // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>ordered...
C++
bf89bc12320f635cc121eba99c542444
666f4b066938c0b0d3e76849325f4fc1
1,700
PASSED
#include <iostream> #include <vector> using namespace std; int t, n, m, x, a, b, ans; vector<int>ro[200010]; int te[200010]; int k[200010]; int dq[200010], du[200010]; int ddep[200010]; void bfs() { int l = 1, r = 0; for (int i = 1; i <= n; i++) if (te[i] == 1) dq[++r] = i, k[i] = 0; while (l <=...
C++
bf89bc12320f635cc121eba99c542444
494685303ce94a40cc7bf4787465bd27
1,700
PASSED
#include <iostream> #include <vector> using namespace std; int t, n, m, x, a, b, ans; vector<int>ro[200010]; int te[200010]; int k[200010]; int dq[200010], du[200010]; void bfs() { int l = 1, r = 0; for (int i = 1; i <= n; i++) if (te[i] == 1) dq[++r] = i, k[i] = 0; while (l <= r) { int x = dq...
C++
bf89bc12320f635cc121eba99c542444
62959da813b03bcfa60c73a8da4041dd
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef vector<int> vint; typedef vector<vector<int>> vvint; typedef deque<int> dqint; #define endl '\n' #define all(v) v.begin(), v.end() #define bsl lower_bound #define bsr upper_bound #define loopin(n) for (int i = 0; i < n; i++) #define loopisn(s, n) for (...
C++
bf89bc12320f635cc121eba99c542444
2a7d53215a83acab444901016767e357
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef vector<int> vint; typedef vector<vector<int>> vvint; typedef deque<int> dqint; #define endl '\n' #define all(v) v.begin(), v.end() #define bsl lower_bound #define bsr upper_bound #define loopin(n) for (int i = 0; i < n; i++) #define loopisn(s, n) for (...
C++
bf89bc12320f635cc121eba99c542444
4d6af5f868cbc9174a4981bf370ac096
1,700
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> b(n), p(n), dis(n, -1); for (int i = 0; i < n; i++) { cin >> b[i]; ...
C++
4b512c39e71e34064c820958dde9f4a1
b73d3429ac83bd1a987c59d34abb7dd2
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> b(n), p(n), dis(n, -1); for (int i = 0; i < n; i++) { cin >> b[i]; ...
C++
4b512c39e71e34064c820958dde9f4a1
0071a293c9db4787c5dffa94186e6099
1,500
PASSED
#include <bits/stdc++.h> #define int long long #define endl '\n' #define LL __int128 using namespace std; int qpow(int a, int b, int p) {int ret = 1; for(a %= p; b; b >>= 1, a = a * a % p) if(b & 1) ret = ret * a % p; return ret; } int qpow(int a,int b) {int ret = 1; for(; b; b >>= 1, a *= a) if(b & 1) ret *= a; ...
C++
4b512c39e71e34064c820958dde9f4a1
f4d71fe35998a20db4b878e8b589a50c
1,500
PASSED
#include <bits/stdc++.h> #define int long long #define endl '\n' #define LL __int128 using namespace std; int qpow(int a, int b, int p) {int ret = 1; for(a %= p; b; b >>= 1, a = a * a % p) if(b & 1) ret = ret * a % p; return ret; } int qpow(int a,int b) {int ret = 1; for(; b; b >>= 1, a *= a) if(b & 1) ret *= a; ...
C++
4b512c39e71e34064c820958dde9f4a1
6375aa317c381d61f27b9783693ea8b6
1,500
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define int ...
C++
4b512c39e71e34064c820958dde9f4a1
8e656435d4e1ad4e73a83bf3e9e10466
1,500
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define int ...
C++
4b512c39e71e34064c820958dde9f4a1
6279f0038bba369f6d3065b85b2672ec
1,500
PASSED
#include <bits/stdc++.h> #define mp make_pair #define F first #define S second #define pb push_back #define YES cout << "YES"; #define NO cout << "NO"; #define PI 3.14159265 typedef long long ll; const int N = 100500; const int INF = 1000000000; const ll MOD = 1e9 + 7; const ll p1 = 1987; using namespace s...
C++
4b512c39e71e34064c820958dde9f4a1
589d1ef82eb42c88e3bc88a0b09f1f30
1,500
PASSED
#include<bits/stdc++.h> #define ll long long #define ld long double #define mod 1000000007 #define endl "\n"; using namespace std; int main() { #ifndef ONLINE_JUDGE freopen("cfi.txt","r",stdin); freopen("cpp.txt","w",stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL...
C++
4b512c39e71e34064c820958dde9f4a1
b0bcdb1a77d7060ca38e8a1e6ee8f75c
1,500
PASSED
/* بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ Iftekhar Md. Shishir Dept. of Information and Communication Engineering University of Rajshahi */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tre...
C++
4b512c39e71e34064c820958dde9f4a1
94cb298bd75ef09533930a7a7e6e0797
1,500
PASSED
/* بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ Iftekhar Md. Shishir Dept. of Information and Communication Engineering University of Rajshahi */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tre...
C++
4b512c39e71e34064c820958dde9f4a1
d8a0391b67226aa93cf50acc0e5997ef
1,500
PASSED
#include<bits/stdc++.h> #define ll long long #define vll vector<ll> #define pb push_back #define srt(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define yes printf("YES\n") #define no printf("NO\n") #define mod 1000000007 using namespace std; int main() { ll n,m,i,j,k,x,y,...
C++
69bbc06c385d51f78ce1f64afffb4cf1
0846bf595b65dfd4ecd7f80470180f4e
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { int t; cin>>t; while(t--) { int n; cin>>n; vector<int>arr; int mx=-1; int y; for(int i=0; i<n; i++) { int x; cin>>x; ...
C++
69bbc06c385d51f78ce1f64afffb4cf1
4f0e51f391e470967d703db78d4dcc52
1,000
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { int t; cin>>t; while(t--) { int n; cin>>n; vector<int>arr(n); int mx=-1; int y; for(int i=0; i<n; i++) { cin>>arr[i]; /* mx=...
C++
69bbc06c385d51f78ce1f64afffb4cf1
f09b502c5d26fe40614fe8b93dcadb8c
1,000
PASSED
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define endl '\n' #define print(b) for(auto a:b) cout<<a<<' '; #define printN(b) for(auto a:b) cout<<a<<endl; #define fin freopen("D://input.txt", "r", stdin) #define fout freopen("D://output.txt", "w", s...
C++
69bbc06c385d51f78ce1f64afffb4cf1
d6bf7644700c4fee7a65f016fc8dcb1b
1,000
PASSED
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define endl '\n' #define print(b) for(auto a:b) cout<<a<<' '; #define printN(b) for(auto a:b) cout<<a<<endl; #define fin freopen("D://input.txt", "r", stdin) #define fout freopen("D://output.txt", "w", s...
C++
69bbc06c385d51f78ce1f64afffb4cf1
a94032358b3b596ebff53031801abed9
1,000
PASSED
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define endl '\n' #define print(b) for(auto a:b) cout<<a<<' '; #define printN(b) for(auto a:b) cout<<a<<endl; #define fin freopen("D://input.txt", "r", stdin) #define fout freopen("D://output.txt", "w", s...
C++
69bbc06c385d51f78ce1f64afffb4cf1
83d83f22f0829aa4a26eda8cb2896d2c
1,000
PASSED
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define endl '\n' #define print(b) for(auto a:b) cout<<a<<' '; #define printN(b) for(auto a:b) cout<<a<<endl; #define fin freopen("D://input.txt", "r", stdin) #define fout freopen("D://output.txt", "w", s...
C++
69bbc06c385d51f78ce1f64afffb4cf1
8f8c2a95d03182b877dbe084968918ba
1,000
PASSED
#include "bits/stdc++.h" #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define int long long #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 all(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define trav(a,x)...
C++
69bbc06c385d51f78ce1f64afffb4cf1
f18e39886571ff0a7f147f4883c46325
1,000
PASSED
#include "bits/stdc++.h" #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define int long long #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 all(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define trav(a,x)...
C++
69bbc06c385d51f78ce1f64afffb4cf1
c847fe67b0a56954701f8d68b7a3f52e
1,000
PASSED
#include "bits/stdc++.h" //#pragma GCC optimize ("O3") //#pragma GCC target ("sse4") using namespace std; #define int long long #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 all(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define trav(...
C++
69bbc06c385d51f78ce1f64afffb4cf1
db014f097d16e43806c886837909c748
1,000
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; ll a[105],b[105],ans[105]; int main() { ll t; cin>>t; while(t--) { ll num; cin>>num; ll cnt=0,flag=0; while(num) { cnt++; a[cnt]=num%10; num/=10; if(a[cnt]%2==0) { flag=1; } } if(a[1]%2==0) cout<<0<<endl; ...
C++
03e5f71810b10318fed344878d226a10
8ef0e92e21a9c5499162651f88fa23ae
800
PASSED
#include<iostream> #include<algorithm> using namespace std; int main() { int t; string s; cin >> t; for (int i = 0; i < t; ++i) { cin >> s; if ((s[s.length() - 1] - 48) % 2 == 0) cout << 0 << endl; else if ((s[0] - 48) % 2 == 0) cout << 1 << endl; else if (s.find('0') != -1 || s.find('2') != -1 || s.find('...
C++
03e5f71810b10318fed344878d226a10
67a1a3ca3b7017331d8a532384468a61
800
PASSED
#include <bits/stdc++.h> using namespace std; #define FastIO ios_base::sync_with_stdio(0), cin.tie(0) #define f0(i, n) for (int i = 0; i < n; i++) #define f1(i, n) for (int i = 1; i <= n; i++) #define f2(i, n) for (int i = 1; i < n; i++) #define endl "\n" #define pb push_back #define mp make_pair #define vi vector<int...
C++
03e5f71810b10318fed344878d226a10
cffd873b8a6b5af9267035c2d6e8bd4a
800
PASSED
#include<bits/stdc++.h> using namespace std; void solve() { string s; cin>>s; int lens=s.length(); if((s[lens-1]-'0')%2==0) { cout<<"0"<<endl; return; } bool que=false; for(int i=0;i<lens;i++) { if((s[i]-'0')%2==0) { que=true; break; } } if(!que) cout<<"-1"<<endl; else { if((s[0]-'0')%2...
C++
03e5f71810b10318fed344878d226a10
d476473102aab3aa5dc3f0e977420d1c
800
PASSED
#include <iostream> #include<cmath> #include<cstring> using namespace std; long long n,i,flag; long long wei(long long n) { long long t; for(t=0;n>0;t++) { n/=10; } return t; } int main() { long long t; long long x,y,z; int min; cin>>t; while(t--) { min=1; cin>>n; long long len...
C++
03e5f71810b10318fed344878d226a10
e6f96f99e81ff7fbca95daabc04cbb7c
800
PASSED
#include<iostream> #include<string> using namespace std; int main() { ios::sync_with_stdio(false); int n; cin>>n; string p; while(n--) { cin>>p; int sum=0; for(int i=0;i<p.size();i++) { if(p[i]%2==0) { sum++; } } if(sum==0)cout<<"-1\n"; else if(p[p.size()-1]%2==0)cout<<"0\n"; else if(...
C++
03e5f71810b10318fed344878d226a10
58409bfe2d9e1829c11572e506455edc
800
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <stack> #include <vector> #include <map> #include <queue> #include <cstring> #include <cmath> #include <set> #include <iterator> #include <numeric> using namespace std; typedef long long ll; #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie...
C++
03e5f71810b10318fed344878d226a10
4a2822f34bd7dfcf66f1510dbb5d1eab
800
PASSED
#include<bits/stdc++.h> using namespace std; int t; string s; int main() { cin>>t; while(t--) { cin>>s; int f=0; for(int i=0;i<s.size();i++) { if((s[i]-'0')%2==1) f++; } if(f==s.size()) { cout<<-1<<endl; continue; } if((s[s.size()-1]-'0')%2==0) { cout<<0<<endl; continue; } ...
C++
03e5f71810b10318fed344878d226a10
8eaea8ae9f045a11f3d64c27010d53fe
800
PASSED
#include<bits/stdc++.h> using namespace std; int t,l,ans; string s; int main() { cin>>t; while(t--) { ans=-1; cin>>s; l=s.length()-1; if((s[l]-'0')%2==0) ans=0; else if((s[0]-'0')%2==0) ans=1; else for(int i=1; i<l; i++) if((s[i]-'0')%2==0) ans=2; cout<<ans<<endl; } return 0; } /* 4 3876...
C++
03e5f71810b10318fed344878d226a10
84a9a4718c55b89f560e213274061b27
800
PASSED
#include<iostream> #include<string> using namespace std; int main() { int t; while(cin>>t) while(t--) { string temp; cin>>temp; int i; int count=-1; for(i=0;i<temp.size();i++) { if((temp[i]-'0')%2==0) { if(i==0) ...
C++
03e5f71810b10318fed344878d226a10
d7354bf4feff33445d10f1cf8cecaf27
800
PASSED
from itertools import accumulate from math import log import sys input = sys.stdin.buffer.readline def parent(i): return i//2 def left_c(i): return i*2 def right_c(i): return i*2+1 def fill_tree(i, fro, to): if fro == to: tr[i] = pf[fro] d[fro] = i di[i] = fro else: tr[i] = min(fill...
Python
034536fc950299cb6b09675757ca77aa
399f8f73068ed58ac2479755c009bf8c
1,800
PASSED
from itertools import accumulate from math import log import sys input = sys.stdin.buffer.readline def parent(i): return i//2 def left_c(i): return i*2 def right_c(i): return i*2+1 def fill_tree(i, fro, to): if fro == to: tr[i] = pf[fro] d[fro] = i di[i] = fro else: tr[i] = min(fill...
Python
034536fc950299cb6b09675757ca77aa
076a127e9d0aed41717c1c18f0b9ff4a
1,800
PASSED
from itertools import accumulate from math import log import sys input = sys.stdin.buffer.readline def parent(i): return i//2 def left_c(i): return i*2 def right_c(i): return i*2+1 def fill_tree(i, fro, to): if fro == to: tr[i] = pf[fro] d[fro] = i di[i] = fro else: tr[i] = min(fill...
Python
034536fc950299cb6b09675757ca77aa
dccf52df0f48fd0d0e58eee0f84a8e13
1,800
PASSED
from itertools import accumulate from math import log import sys input = sys.stdin.buffer.readline def parent(i): return i//2 def left_c(i): return i*2 def right_c(i): return i*2+1 def fill_tree(i, fro, to): if fro == to: tr[i] = pf[fro] d[fro] = i di[i] = fro else: tr[i] = min(fill...
Python
034536fc950299cb6b09675757ca77aa
cbe02991a3bc6e5d9c5bfb7e470f38e4
1,800
PASSED
#!/usr/bin/env python import os import sys from io import BytesIO, IOBase INF = 10 ** 15 class SegmentTree: def __init__(self, data, default=INF, func=min): """initialize the segment tree with data""" self._default = default self._func = func self._len = len(data) self._si...
Python
034536fc950299cb6b09675757ca77aa
6bee8a78a78f9eea0e63004eacf5b7a5
1,800
PASSED
#!/usr/bin/env python import os import sys from io import BytesIO, IOBase INF = 10 ** 15 class RangeQuery: def __init__(self, data, func=min): self.func = func self._data = _data = [list(data)] i, n = 1, len(_data[0]) while 2 * i <= n: prev = _data[-1] _dat...
Python
034536fc950299cb6b09675757ca77aa
ece8630ba4472cbb04b50e22ee81f882
1,800
PASSED
# RANK1ZEN; 3966 PEAK NA FLEX SUPPORT; Battlenet ID: Knuckles#11791 # region -----------------------------------------------------------------------------------------| # oooo+oshdy+/smooyNMNNMMMmo/::----/dNsomMMMNNMy/::--::/mNoodNdmdo/:-://////::::::::. # ooooyNMMMyssNyosmMMMMMMNs+::----::++//+oooooo/::----:...
Python
034536fc950299cb6b09675757ca77aa
05a79e6f3b118fa5c733e8a4108c0a2e
1,800
PASSED
import sys inpu = sys.stdin.readline prin = sys.stdout.write for _ in range(int(inpu())) : n, s = map(int, inpu().split()) lis = list(map(int, inpu().split(' '))) su = [0]*(n + 1) for i in range(1, n + 1) : su[i] = su[i - 1] + lis[i - 1] start = 0 end = n l = -1 r = -...
Python
034536fc950299cb6b09675757ca77aa
eabb8877d3096efd3c55e44f5303d9fc
1,800
PASSED
if __name__ == "__main__": for _ in range(int(input())): n, s = map(int, input().split()) a, l, r, idx, cur_sum = list(map(int, input().split())), -1, -2, 0, s for i in range(n): cur_sum += a[i] while idx <= i and cur_sum < 0: cur_sum -= a[idx] ...
Python
034536fc950299cb6b09675757ca77aa
1292bf1a1a500f0fd441c298060e1a39
1,800
PASSED
from itertools import accumulate def _n(): return int(input()) def _nA(): return list(map(int, input().split())) def _sA(): return input().split() def solve(arr, s): l, r = 0, 0 ll, rr = -1, -1 preSum = [0]+list(accumulate(arr)) while r < len(arr): if r<...
Python
034536fc950299cb6b09675757ca77aa
af752430cce9c9d112225550eb4621b6
1,800
PASSED
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector") #include <bits/stdc++.h> using namespace std; #define fore(i, l, r) for (auto i = (l) - ((l) > (r)); i != (r) - ((l) > (r)); i += 1 - 2 * ((l) > (r))) #define sz(x) int(x.size()) #define all(x) begin(x), end(x) #define f first #define s second #define pb pu...
C++
4c69abbf5bab5d01d6fb6b4316900026
edb194ceae8182638f790979634d2b91
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define ll int typedef pair<ll,ll> pi; typedef vector <int> vi; typedef vector <pi> vpi; typedef pair<pi, ll> pii; typedef set <ll> si; typedef long double ld; #define f first #define s second #define mp make_pair #define FOR(i,s,e) for(...
C++
4c69abbf5bab5d01d6fb6b4316900026
efb915580f2043bc75372266e5cd5607
2,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; template<typename T> int lis(vector<T> a) { vector<T> dp; for(auto x : a) { auto it = lower_bound(dp.begin(), dp.end(), x); // > : lower, >= : upper if(it == dp.end()) dp.push_back(x); else *it = x; } ...
C++
4c69abbf5bab5d01d6fb6b4316900026
67d2eb4427d4d88f92159c9247b07142
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int STORTTAL = 19203890; void solve(){ int n, m; cin >> n >> m; vector<string> gr(n); for(auto &x : gr)cin >> x; if(n == 1){ int ans = 0; for(int i = 0; i < m; ++i)ans+=gr[0][i]-'0'; cout << ans << '\n'; return; } multiset<pair<int,int>> ino; // end , ...
C++
4c69abbf5bab5d01d6fb6b4316900026
ac39faf6334734ffb2d521c5e7cc6d97
2,500
PASSED