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 <cstdio> #include <cstdlib> #include <algorithm> using namespace std; #define zero(x) (((x)>0?(x):-(x))<eps) #define eps 1.0E-8 #define MAX_POINT_NUM 0 #define D(x) //int double_cmp(double a) //{ // if (zero(a)) // return 0; // return a > 0 ? 1 : -1; //} struct Point { int x, y, z; Point() { x = y = ...
C++
55da4611bc78d55c228d0ce78bd02fd3
23bb0081e973db19b80a8844618d7522
2,000
PASSED
#include <cstdio> #include <cstdlib> #include <algorithm> using namespace std; #define zero(x) (((x)>0?(x):-(x))<eps) #define eps 1.0E-8 #define MAX_POINT_NUM 0 #define D(x) struct Point { int x, y, z; Point() { x = y = z = 0; } Point(int x, int y, int z): x(x), y(y), z(z) {} Point operator - (const Point...
C++
55da4611bc78d55c228d0ce78bd02fd3
b2808603167943755ba04bc7c8fc39f6
2,000
PASSED
#include <cstdio> #include <cstdlib> #include <algorithm> using namespace std; #define zero(x) (((x)>0?(x):-(x))<eps) #define eps 1.0E-8 #define MAX_POINT_NUM 0 #define D(x) //int double_cmp(double a) //{ // if (zero(a)) // return 0; // return a > 0 ? 1 : -1; //} struct Point { long long x, y, z; Point() { x ...
C++
55da4611bc78d55c228d0ce78bd02fd3
a97c688ee7777c8c28931305b21c1ea3
2,000
PASSED
//BISMILLAHIR RAHMANIR RAHIM // OUM NAMA MA SWARASATI #include<cmath> #include<cstdio> #include<cstring> #include<cstdlib> #include<cctype> #include<fstream> #include<string> #include<vector> #include<queue> #include<map> #include<set> #include<sstream> #include<stack> #include<stdlib.h> #include<iostream> #include<al...
C++
55da4611bc78d55c228d0ce78bd02fd3
c37604542d3922c085a746180a421665
2,000
PASSED
//BISMILLAHIR RAHMANIR RAHIM // OUM NAMA MA SWARASATI #include<cmath> #include<cstdio> #include<cstring> #include<cstdlib> #include<cctype> #include<fstream> #include<string> #include<vector> #include<queue> #include<map> #include<set> #include<sstream> #include<stack> #include<stdlib.h> #include<iostream> #include<al...
C++
55da4611bc78d55c228d0ce78bd02fd3
3ecd0eec2ea9bf90665bb218fdd81410
2,000
PASSED
#include <bits/stdc++.h> #define x first #define y second #define sq(_) ((_)*(_)) #define eps 1e-8 #define pb push_back #define mod 1000000007 #define inf 0x3f3f3f3f #define INF 0x3f3f3f3f3f3f3f3fLL #define bit(x, y) (((x)>>(y))&1) #define bctz(x) (__builtin_ctz(x)) #define bclz(x) (__builtin_clz(x)) #def...
C++
55da4611bc78d55c228d0ce78bd02fd3
d817f10f960de15c71b438f4291d1cc9
2,000
PASSED
#include <bits/stdc++.h> #define x first #define y second #define sq(_) ((_)*(_)) #define eps 1e-8 #define pb push_back #define mod 1000000007 #define inf 0x3f3f3f3f #define INF 0x3f3f3f3f3f3f3f3fLL #define bit(x, y) (((x)>>(y))&1) #define bctz(x) (__builtin_ctz(x)) #define bclz(x) (__builtin_clz(x)) #def...
C++
55da4611bc78d55c228d0ce78bd02fd3
8ad56f6dda2b5eb402d64324dddb737c
2,000
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define pii pair<int,int> #define pll pair<ll,ll> #define pdd pair<ld,ld> #define ff first #define ss second #define pb push_back #define mp make_pair #define MAXINT ((~0) ^ (1 << 31)) #define MAXLL ((~0) ^ ((ll)1 << 63)) #define INF ((int)2e9) #defi...
C++
55da4611bc78d55c228d0ce78bd02fd3
dcaafe21038d9155d097e1dc4f1bd619
2,000
PASSED
#include <bits/stdc++.h> #define I inline #define fi first #define se second #define LL long long #define mp make_pair #define reg register int #define pii pair<int,int> #define fo(i, a, b) for(reg i = a; i <= b; i++) #define fd(i, a, b) for(reg i = a; i >= b; i--) #define cr const reg& using namespace std; const int ...
C++
c92a904e2a3d335ad34cd016e4b99f40
f85ec2857664c39de4f6730b71b7dd85
3,500
PASSED
#include <iostream> #include <cmath> #include <vector> #include <algorithm> #include <set> #include <cstdio> #include <map> #include <queue> #define ll long long #define S second #define F first using namespace std; ll a, b, c, d, e, f, cycle, st, fin; vector <vector <ll> > arr, arr1; struct About { ll x, y, n...
C++
f8a8bda80a75ed430465605deff249ca
47b6ac6f448b036626ffd018a328fc3e
1,100
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #define int long long #define pii pair<int, int> #define f first #define s second #define fn for (int i = 0; i < n; n++) using namespace std; cinV(vector<int> &v){ for (int i = 0; i < v.size(); ++i){ cin >> v[i];...
C++
f8a8bda80a75ed430465605deff249ca
2fb5aae8e3461303cfdc5e5128e61422
1,100
PASSED
#include <iostream> #include <cmath> using namespace std; int main() { long long t; cin >> t; long long o[t]; long long n; long long a, b; long long ma = -9999999999, mi = 999999999999; for (int i = 0; i < t; i++) { cin >> n; for (int y = 1; y <= n; y++) ...
C++
f8a8bda80a75ed430465605deff249ca
775c714dbb0a5b08622c1b54f959779e
1,100
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; bool comp(pair<int, int> a, pair<int, int> b){ return a.second < b.second; } int main() { int t; cin >> t; for (int i = 0; i < t; i++){ int n; cin >> n; vector<pair<int, int>> A(n)...
C++
f8a8bda80a75ed430465605deff249ca
6c2d0fe4ef956560f8304c1d6a86bcf0
1,100
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <set> #include <cmath> #include <string> using namespace std; bool is_prime(int n) { for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } int main() { int t; cin >> t; for (int i = 0; ...
C++
f8a8bda80a75ed430465605deff249ca
36814b42fa6372e1ada293d65ac8977e
1,100
PASSED
#include<iostream> #include<vector> using namespace std; int max_length(vector<int> &starts, vector<int> &ends){ int maxstart=starts[0], minend=ends[0]; for(int i=1;i<starts.size();i++){ if(starts[i]>maxstart) maxstart=starts[i]; if(ends[i]<minend) minend=ends[i]; } return (maxstart<minend?0:maxstart-minend);...
C++
f8a8bda80a75ed430465605deff249ca
bd832effd29dc8afb061364677cfc4f5
1,100
PASSED
#include<iostream> #include<limits> using namespace std; /* int max_length(vector<int> &starts, vector<int> &ends){ int maxstart=starts[0], minend=ends[0]; for(int i=1;i<starts.size();i++){ if(starts[i]>maxstart) maxstart=starts[i]; if(ends[i]<minend) minend=ends[i]; } return (maxstart<minend?0:maxstart-minend...
C++
f8a8bda80a75ed430465605deff249ca
5ffe6217ef3b8550009c9ec6a9410f8b
1,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int SZ = 1e5 + 5, INF = 1e9; int main() { /*ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);*/ int t, n, x, y, cnt = 0; cin >> t; vector<pair<int, int>> a; for (int i = 0; i < t; i++) { cin >> n; int max_x = 1, min_y = 1e...
C++
f8a8bda80a75ed430465605deff249ca
e135883754a5f38890757ad5a9a6ceb3
1,100
PASSED
#include<bits/stdc++.h> #include<string> #include<cmath> #include<iomanip> #define fast ios_base::sync_with_stdio(0) #define fast_in cin.tie(0) #define fast_out cout.tie(0) #define ll long long #define MAX 1000000 #define MAX_MAX 10000000000 #define pb push_back #define mp make_pair #define fir first #define sec second...
C++
f8a8bda80a75ed430465605deff249ca
c7480132a11e18edf3eb35811134fb9b
1,100
PASSED
#include <iostream> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <random> #include <ctime> #include <iomanip> #define re return #define fi first #define se second #define pb push_back #define sz size typedef long l...
C++
f8a8bda80a75ed430465605deff249ca
cd4492a4a7aa1c4ba097c7a2c290b63f
1,100
PASSED
#include <iostream> #include <cstdlib> #include <string> #include <cctype> #include <vector> #include <set> #include <algorithm> /* max, transform, sort, upper_bound */ #include <functional> /* greater */ #include <iterator> /* std::ostream_iterator */ // #include <regex> // XXX #include <limits> using namespace...
C++
0ff4ac859403db4e29554ca7870f5490
32706d1d790942a4951600d979d3d860
1,300
PASSED
#include <iostream> #include <cstdlib> #include <string> #include <cctype> #include <vector> #include <set> #include <algorithm> /* max, transform, sort, upper_bound */ #include <functional> /* greater */ #include <iterator> /* std::ostream_iterator */ // #include <regex> // XXX #include <limits> using namespace...
C++
0ff4ac859403db4e29554ca7870f5490
1e422d7da48304d6c215f0a0a7da35f1
1,300
PASSED
#include <iostream> #include <cstdlib> #include <string> #include <cctype> #include <vector> #include <set> #include <algorithm> /* max, transform, sort, upper_bound */ #include <functional> /* greater */ #include <iterator> /* std::ostream_iterator */ // #include <regex> // XXX #include <limits> using namespace...
C++
0ff4ac859403db4e29554ca7870f5490
35b25ae8897dcde0c679e53f8d59ffe0
1,300
PASSED
#include<stdio.h> #include<iostream> #include<vector> #include<cmath> #include<algorithm> #include<memory.h> #include<map> #include<set> #include<queue> #include<list> #include<sstream> #define mp make_pair #define pb push_back #define F first #define S second #define SS stringstream #define sqr(x) ((x)*(x)) #define m0...
C++
0ff4ac859403db4e29554ca7870f5490
186c2316669877a0528d302533774da3
1,300
PASSED
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin>>n; vector<int> vec(n); long long max=0; for (int i=0;i<n;i++) {cin>>vec[i];max+=vec[i];} vector<int> d; for (int i=2;i<=n/3;i++) { if (n%i==0) d.push_back(n/i); } in...
C++
0ff4ac859403db4e29554ca7870f5490
6e4acd5318a80589ba9bb863ad03807f
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define what_is(x) cout << #x << " is " << x << endl; template <typename T> string toString(T t) { stringstream ss; ss << t; return ss.str(); } #define int64 long long int64 f(int64 n) { return n * (n - 1) / 2; } int next(std::vector<int> &v, int i) { f...
C++
0ff4ac859403db4e29554ca7870f5490
70402d02bce8e02570bebf1f28e8a625
1,300
PASSED
/* AUTHOR : VUAcoder LANGUAGE : C++ PROBLEM : */ #include<iostream> #include<stdio.h> #include<math.h> #include<string.h> #include<algorithm> #include<string> #include<vector> #include<map> #include<queue> #include<stack> #include<sstream> #include<set> #include<fstream> #include<cfloat> using namespace std; #define PI...
C++
0ff4ac859403db4e29554ca7870f5490
68ea2f8122c0ba299852ac551dc368cd
1,300
PASSED
#include <cstdio> int main(){ int n; scanf("%d", &n); long *value = new long[n]; for(int k = 0; k < n; k++){scanf("%ld", value + k);} long output = 0, currentMax = - 30000000; for(int div = 1; div <= n / 3 ; div++){ // Minimum allowed triangle; If one or two vertices allowed, upper bound should be...
C++
0ff4ac859403db4e29554ca7870f5490
6f03c6884ceba421332164fb7c4dbf9b
1,300
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <c...
C++
0ff4ac859403db4e29554ca7870f5490
5a6decd63b15b853d371956f2dbfab51
1,300
PASSED
#include <bits/stdc++.h> using namespace std; short a[20005]; int main(){ /*freopen("out", "w", stdout); for(int i = 0; i < 20000; i++) cout << ((rand() & 1) ? 1 : -1) * rand() % 1001 << endl; */ int mx = -123456789; int n; cin >> n; for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 1; i <= ...
C++
0ff4ac859403db4e29554ca7870f5490
b2ba0d5f403e65d8dec6366967901b75
1,300
PASSED
#include <iostream> #include <vector> #include <algorithm> using namespace std; int Min(int a, int b) { if (a < b) return a; return b; } int main() { int n, m; vector<int> q, a; cin >> m; q.resize(m); for (int i = 0; i < m; ++i) cin >> q[i]; cin >> n; a.resize(n);...
C++
08803b63ae803e4a76afe7258a4004aa
ff56b84d4ae7b8508991eaef107d64a3
1,400
PASSED
#include <iostream> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> using namespace std; const int M = 100010; int n,m,q,a[M]; bool cmp(int a,int b){ return a>b; } int main(){ while(cin>>m){ int q=M; while(m--){ int x; cin>>x; q=min(q,x); } cin>>n; for(int i=0;i<n;i++) ...
C++
08803b63ae803e4a76afe7258a4004aa
7a5c0168dc1eda10d8e3bf66a77923c8
1,400
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <climits> using namespace std; inline void readint(int* x) { register char c = 0; while(c<33) c = getchar(); *x = 0; while(c > 33) { *x = *x...
C++
08803b63ae803e4a76afe7258a4004aa
01f1426fe2404bddc3bf5c5b21962985
1,400
PASSED
# include <iostream> # include <algorithm> using namespace std; long long a,d,q; long long b[100009]; long long c[100009]; int main() { cin>>a; for(int i=0;i<a;i++) cin>>b[i]; cin>>d; for(int i=0;i<d;i++) cin>>c[i]; sort(b,b+a); sort(c,c+d); for(int i=d-1;i>=0;i=i-b[0]-2) { long long t=i-b[0];...
C++
08803b63ae803e4a76afe7258a4004aa
7e54be976f76dedfd71cc6e911535f70
1,400
PASSED
#include <iostream> #include <algorithm> using namespace std; int main(){ int m; cin >> m; int min; cin >> min; int tmp; for (int i = 0; i < m-1; i++) { cin >> tmp; if (tmp < min) { min = tmp; } } int n; cin >> n; int *goods = new...
C++
08803b63ae803e4a76afe7258a4004aa
2f7b811adbd2aec77cc20b759c2ad8ed
1,400
PASSED
#include <iostream> #include <algorithm> using namespace std; int main(){ int m; cin >> m; int *dis = new int[m]; int min; cin >> min; for (int i = 0; i < m-1; i++) { cin >> dis[i]; if (dis[i] < min) { min = dis[i]; } } int n; cin >> ...
C++
08803b63ae803e4a76afe7258a4004aa
33d7131055fe7bad1265a6fb0f32c5d0
1,400
PASSED
#include <iostream> #include <algorithm> using namespace std; int main(){ int m; cin >> m; int *dis = new int[m]; for (int i = 0; i < m; i++) { cin >> dis[i]; } int n; cin >> n; int *goods = new int[n]; for (int i = 0; i < n; i++) { cin >> goods[i]; } sort(goods, goods + n); sort(dis, dis + m); r...
C++
08803b63ae803e4a76afe7258a4004aa
43d8aeaccf82a806e02a68c4dd949031
1,400
PASSED
#include <iostream> #include <algorithm> using namespace std; int main(){ int m; cin >> m; int min; cin >> min; int tmp; for (int i = 0; i < m-1; i++) { cin >> tmp; if (tmp < min) { min = tmp; } } int n; cin >> n; int *goods = new ...
C++
08803b63ae803e4a76afe7258a4004aa
99ba8cfba77c27a566232e996a082c5c
1,400
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <string> #include <vector> #include <deque> #include <list> #include <algorithm> #include <numeric> #include <functional> #include <cmath> #include <cstring> #include <cctype> #include <sstream> #include <set> #include <map> #include <queue> #include <co...
C++
08803b63ae803e4a76afe7258a4004aa
bc3ee952e18629cf0992141ab8f4fab7
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int a[100000]; int n,m,k1,k2,mink,v,ans; int main() { cin>>m; mink=10000000; for(int i=0;i<m;++i) { cin>>v; mink=min(v,mink); } cin>>n; for(int i=0;i<n;++i) cin>>a[i]; sort(a,a+n); for(int i=n-1;i>-1;--i) { int j; for(j=i;j>i-min...
C++
08803b63ae803e4a76afe7258a4004aa
f4917659b7e64dea9c9872fbc18f0bd1
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int maxSub; void maxSubseqBinArray(vector<int> &binArr) { int l = 0, r = (int)binArr.size() - 1, x = 0, s = 0; for (int a : binArr) s += a; maxSub = max(s, maxSub); while (1) { ++x; bool bl = 0, br = 0; while (l <= r &&...
C++
2c1ee398ea86209335c2248eaa723aca
78450d80fcefc5cda3e0e21551fe901e
1,800
PASSED
#include <bits/stdc++.h> using namespace std; int maxSub; void maxSubseqBinArray(vector<int> &binArr) { int l = 0, r = (int)binArr.size() - 1, x = 0, s = 0; for (int a : binArr) s += a; maxSub = max(s, maxSub); while (1) { ++x; bool bl = 0, br = 0; while (l <= r &&...
C++
2c1ee398ea86209335c2248eaa723aca
296efaa11c15c606df0e69d7ed49c128
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int mxN = 2e5; int n, a[mxN], ans; vector<int> occ[200], v; void solve() { int l = 0, r = (int)v.size() - 1, x = 0, s = 0; for (int a : v) s += a; ans = max(s, ans); while (1) { ++x; bool bl = 0, br = 0; while (l ...
C++
2c1ee398ea86209335c2248eaa723aca
6e7a263b34f791e0e1f8c21115bafd2e
1,800
PASSED
#include<bits/stdc++.h> #define ll long long int #define pb push_back #define mpp make_pair using namespace std; const int N=2e5+5; const ll infi=1e18+5; const ll mod=1e9+7; const ll modi=1e9+6; //int pre[205][N]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int t; cin>>t; while(t--)...
C++
2c1ee398ea86209335c2248eaa723aca
b3651c5b5e24ab1beb14857786aa626b
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t,n; scanf("%d",&t); while(t--){ scanf("%d",&n); vector<vector<int> >a(201,vector<int>(n+1)); vector<vector<int> >p(201);//储存每个数的位置. for(int i=1,x;i<=n;i++) { scanf("%d",&x); for(int j=1;j<=200;j++) //前缀和 a[j][i]=a[j][i-1]+(x==j); ...
C++
2c1ee398ea86209335c2248eaa723aca
11dac2fa61972da9288d4a1a55620f1c
1,800
PASSED
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
C++
2c1ee398ea86209335c2248eaa723aca
0bbcfe053f79ad580df6144c8ba2afc8
1,800
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <map> using namespace std; int check(const vector<int>& arr){ int mx = -1; for(int i : arr){ mx = max(mx, i); } return mx; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin...
C++
2c1ee398ea86209335c2248eaa723aca
1a5a1c6d4aae77036c62b00edf667b7e
1,800
PASSED
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) #define FORX(i, a, b, x) FOR (ll i = (a); i <= (b); i+=x) #define debug(x) cerr << #x << " is= " << x << endl; //use FOR debugging #define read(a) int a; cin >> a; #d...
C++
2c1ee398ea86209335c2248eaa723aca
85873999dfaf749ea7c0bae988bbba33
1,800
PASSED
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) #define FORX(i, a, b, x) FOR (ll i = (a); i <= (b); i+=x) #define debug(x) cerr << #x << " is= " << x << endl; //use FOR debugging #define read(a) int a; cin >> a; #d...
C++
2c1ee398ea86209335c2248eaa723aca
716afa3deb86e73da5fdb8d11516e478
1,800
PASSED
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) #define FORX(i, a, b, x) FOR (ll i = (a); i <= (b); i+=x) #define debug(x) cerr << #x << " is= " << x << endl; //use FOR debugging #define read(a) int a; cin >> a; #d...
C++
2c1ee398ea86209335c2248eaa723aca
6b5994867fa3d3e7f306fd9b36c43c47
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; int a,b; int a1=INT_MIN,b1=INT_MIN,chek=0; for(int i=0; i<n; i++) { cin>>a>>b; if(a<b || b<b1 || a<a1 || ((a-a1) < (b-b1)) ) ...
C++
714834defd0390659f6ed5bc3024f613
16b2c058201e8356e9a9b766302c049b
1,200
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<pair<int,int>> vec(n); for (int i = 0; i < n; i++) ci...
C++
714834defd0390659f6ed5bc3024f613
f75b4be4e0a340e5a43bcc1b16e671cf
1,200
PASSED
#include <bits/stdc++.h> int main() { int test, t,p[1050],c[1050],a,b,i,n,l; scanf("%d",&test); for(t=1; t<=test; t++){ scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&p[i],&c[i]); } a=0; b=0; l=1; if(a>p[0] || b>c[0] || c[0]-b>p[0]-a){ ...
C++
714834defd0390659f6ed5bc3024f613
18e930d6b216544f5121906b217a9322
1,200
PASSED
/************************************ PALESTINE ***************************************** Suhaib ________ | | | | /\ _______ _______ صهيب صوالحه | | | | | / \ | | | |_______ | | |_____| /____\ | ...
C++
714834defd0390659f6ed5bc3024f613
47899810883cf28990a63164eb4fa058
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define ld double #define fi first #define se second #define pb push_back #define pii pair<int,int> #define all(x) (x).begin(), (x).end() const int MOD =1e9+7; int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b...
C++
714834defd0390659f6ed5bc3024f613
4ac36630b3aeaafb337cc4880b3d7a48
1,200
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; using pii = pair < int, int >; using pll = pair < ll, ll >; const int N = 2e5 + 10; const ll inf = 1e15 + 42; #define endl "\n" const ll mod = 1000000007; void testCase() { int t; cin >> t; while (t--) { int n...
C++
714834defd0390659f6ed5bc3024f613
eb5ff97886d7753d52e30b6f190b5d64
1,200
PASSED
/* lakshaygpt28 Lakshay Gupta */ #include <bits/stdc++.h> using namespace std; string to_string(char ch) { return "'" + string(1, ch) + "'"; } string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ...
C++
714834defd0390659f6ed5bc3024f613
8691998db489836288845f56de1d6843
1,200
PASSED
#include <iostream> using namespace std; #include<bits/stdc++.h> typedef long long ll; #define int long long #define ff first #define ss second #define md 1000000007 #define md1 998244353 #define pb push_back #define in insert #define mkp make_pair #define f(i,yha,wha) for(ll i=yha;i<wha;i++) #define rf(i,wha,yha) for...
C++
714834defd0390659f6ed5bc3024f613
d7dd2db5080ca857b8ca08f691da9ec5
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long using ldb = long double; using pa = pair < int, int >; #define F first #define S second #define f(i,x,n) for(int i=x;i<n;i++) #define all(c) c.begin(),c.end() const int MOD = 1e9 + 7, INF = INT_MAX, N = 5e5 + 10; const double PI = acos(-1); const ...
C++
714834defd0390659f6ed5bc3024f613
3b0676b94cc287b551278218a50f49e6
1,200
PASSED
//https://codeforces.com/contest/1334/problem/0 #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define M1 1000000007 #define M2 998244353 #define ll long long #define pll pair<ll,ll> #define REP(i,a,b) for(ll i=a;i<...
C++
714834defd0390659f6ed5bc3024f613
1616d2123a9aa5a30efa0fb276bac6d8
1,200
PASSED
#include<iostream> using namespace std; int main() { int t; cin>>t; while(t--) { int n,count=0,c=0; cin>>n; char s[n]; cin>>s; for(int i=0;i<n;i++) { if(s[i]=='(') count++; else if(s[i]==')' && count!=0) ...
C++
7a724f327c6202735661be25ef9328d2
c5b4b23c6d957d026b9cd5d12acca373
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t,n,i,j,c=0,d=0,k; cin>>t; string s; while(t--) { cin>>n; cin>>s; for(i=0; i<s.size(); i++) { if(s[i]=='(') { c++; } else if(c<=0 && s[i]==')'...
C++
7a724f327c6202735661be25ef9328d2
0177fd4916e8f30fd0bb7ea3b94afc3a
1,000
PASSED
#include <bits/stdc++.h> using namespace std; int main(void) { int t; cin>>t; while(t--) { int n; cin>>n; string s; cin>>s; int o=0,c=0; for(int i=0;i<n;i++) { if(s[i]=='(') o++; else { ...
C++
7a724f327c6202735661be25ef9328d2
822ab1d0de70f3c1e1f2ad7582ec2666
1,000
PASSED
#include<bits/stdc++.h> using namespace std; void solve() { int n,flag = 1,cnt = 0,cnt1 =0; cin>>n; string str; cin>>str; for(int i=0; i<n; i++) { if(str[i]=='(') { flag = 0; cnt++; } if(flag == 0 &&str[i]==')') { cnt -...
C++
7a724f327c6202735661be25ef9328d2
c970b04ad46564399f0e099f61856fb7
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; int q = 0, ans = 0; string s; cin >> s; for(auto c: s) { if(c == '(') q++; if(c == ')') q--; if(q < 0) { ans++; q++; } } cout << ans << endl; }...
C++
7a724f327c6202735661be25ef9328d2
acbeb25b9be39ec3f926b61f958b0eb7
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t,n,l=0,k=0,cn=0,w; string s; cin>>t; for(int z=0;z<t;z++) { cin>>n; cin>>s; l=0; k=0; for(int i=0;i<n;i++) { if(s[i]=='(') { l++; } e...
C++
7a724f327c6202735661be25ef9328d2
7f32ccb676f5c45f30819d747e286cfa
1,000
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; char a[100]; bool book[55]; while(n--) { int t,ans=0; cin>>t; for(int i=0;i<t;i++) book[i]=false; for(int i=0;i<t;i++) { cin>>a[i]; } for(int i=0;i<t;i++...
C++
7a724f327c6202735661be25ef9328d2
33062d964c3be7bb28f45e4968bb2024
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while (t--) { stack<char > sta; int n; cin>>n; string s; cin>>s; int cnt=0; for(int i =0 ;i<n;i++) { if(s[i]=='(') sta.push('('); ...
C++
7a724f327c6202735661be25ef9328d2
456fdf3bcf6787ac3cf850d0db39128d
1,000
PASSED
#include<iostream> using namespace std; int main() { int t; cin>>t; while(t--) { int n,ul=0,ans=0,cl=0; cin>>n; string s; cin>>s; for(int i=0;i<s.size();i++) { if(s[i]=='(') { if(cl<0) cl=0; ...
C++
7a724f327c6202735661be25ef9328d2
c75fbdde6eec8ae0417eb6f743ec01c3
1,000
PASSED
#include<bits\stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; char a[50]; int ans=0,ball=0; cin>>n>>a; for(int i=0;i<n;i++) { if(a[i]=='(') ball++; else{ ball--; } if(ball<0) { ans++; ball=0; } } cout<<ans<<endl; } return 0; ...
C++
7a724f327c6202735661be25ef9328d2
f53bed5090534bfb7a02020cc12757e8
1,000
PASSED
//Vivek #pragma optimize("", off) #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma comment(linker, "/STACK:36777216") #include <bits/stdc++.h> #define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #def...
C++
4278fece7812148863688c67218aca7b
7884f37fdfc0dd0892368c4577da3ce7
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define S scanf #define P printf #define G getline #define SZ size() #define C clear() #define B begin() #define F front() #define T top() #define E end() #define EM empty() #define V vector #define Q queue #define DQ deque #define PQ priority_queue #define ST stack #defin...
C++
4278fece7812148863688c67218aca7b
6499fa474a92ab3206b1f36194a09130
1,700
PASSED
#include <bits/stdc++.h> using namespace std; //Utility functions #define pb push_back #define sz size() #define fi first #define se second #define all(c) (c).begin(),(c).end() //Constants #define EPS 1e-6 #define INF INT_MAX //Printing #define coutRV(a,L,R) FE(i,L,R) cout<<a[i]<<" \n"[i==R] ; #define coutV(a) c...
C++
4278fece7812148863688c67218aca7b
19a0e319ca72491830dca5a6a1150072
1,700
PASSED
#include <bits/stdc++.h> using namespace std; //Utility functions #define pb push_back #define sz size() #define fi first #define se second #define all(c) (c).begin(),(c).end() //Constants #define EPS 1e-6 #define INF INT_MAX //Printing #define coutRV(a,L,R) FE(i,L,R) cout<<a[i]<<" \n"[i==R] ; #define coutV(a) c...
C++
4278fece7812148863688c67218aca7b
372ce9adcdf8e3036a19eeeb488a1a24
1,700
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<vector> #include<map> #include<set> #define mp make_pair #define de(x) cout<<#x<<" = "<<x<<endl #define dd(x) cout<<#x<<" = "<<x<<" " typedef long long ll; using namespace std; const int maxn=2e5+10,INF=0x3f3f3f3f; int d...
C++
4278fece7812148863688c67218aca7b
5410e36e769b45efbb4241b3610f8716
1,700
PASSED
//14-18 #include <bits/stdc++.h> #define REP(i,n) for (int i=0;i<n;i++) #define FOR(i,a,b) for (int i=a;i<=b;i++) #define pb push_back #define mp make_pair using namespace std; typedef long long ll; ll n,c[300030],a[300030],vis[300030],ans=0,INF=1e17; void kil (int x) {//cout<<"KILL "<<x<<endl; ll val=c[x],cur=x,tm...
C++
4278fece7812148863688c67218aca7b
e2dd645893c0f4ec04448637c933f1e5
1,700
PASSED
//14-18 #include <bits/stdc++.h> #define REP(i,n) for (int i=0;i<n;i++) #define FOR(i,a,b) for (int i=a;i<=b;i++) #define pb push_back #define mp make_pair using namespace std; typedef long long ll; ll n,c[300030],a[300030],vis[300030],ans=0,INF=1e17; void kil (int x) {//cout<<"KILL "<<x<<endl; ll val=c[x],cur=x,tm...
C++
4278fece7812148863688c67218aca7b
c19be348bd84bf2dc0190f06845cb4d1
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define fore(i, l, r) for(int i = int(l); i < int(r); i++) #define forn(i, n) fore(i, 0, n) #define mp make_pair #define pb push_back #define sz(a) int((a).size()) #define all(a) (a).begin(), (a).end() #define sqr(a) ((a) * (a)) #define x first #define y second typedef...
C++
4278fece7812148863688c67218aca7b
c683c06e275e7ee3fe862e781e646bc1
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=2e5+10; int n,a[maxn+2],c[maxn+6]; int cnt;//cnt个cycle vector<int>cycle[maxn+5]; int vis[maxn+3];//为0未访问 为1在栈中 为2已访问 int path[maxn+4],tot,tmp; int mn,len,v; ll ans; void dfs(int u) { path[++tot]=u;//记录当前路径,入栈 vis[u]=1; int v=a[u];//...
C++
4278fece7812148863688c67218aca7b
fe455ae3f7e03663d5eb8dba7e853671
1,700
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=2e5+10; int n,a[maxn+2],c[maxn+6]; int cnt;//cnt��cycle vector<int>cycle[maxn+5]; int vis[maxn+3];//Ϊ0δ���� Ϊ1��ջ�� Ϊ2�ѷ��� int path[maxn+4],tot,tmp; int mn,len,v,ans; void dfs(int u) { path[++tot]=u;//��¼��ǰ·��,��ջ vis[u]=1; int v=a[u];//ʵ�ʲ��ý�ͼ,�Һ�̼��...
C++
4278fece7812148863688c67218aca7b
cf534bb10df74578b96334ce35ea13c4
1,700
PASSED
#include <fstream> #include <iostream> #include <sstream> #include <stdlib.h> #include <stdio.h> #include <math.h> #include <string.h> #include <queue> #include <set> #include <map> #include <stack> #include <vector> #include <climits> #include <algorithm> #include <ctime> #include <stdarg.h> #define sqr(x) ((x)*(x)) ...
C++
c39db222c42d8e85dee5686088dc3dac
71490291c56b636ab9bdb36670b899c8
1,700
PASSED
#include <iostream> #include <cstring> #include <cstdio> #include <cmath> #include <vector> #include <algorithm> using namespace std; int a[100010],up[100010],down[100010],d,e,f,g,h,i,j,k,m,n; int main() { scanf("%d%d",&n,&m); for (i=1; i<=n; i++) scanf("%d",&a[i]); up[1]=1; down[1]=1; for (i=2; i<=...
C++
c39db222c42d8e85dee5686088dc3dac
b1a216a60cb7b2f1a615743acad9f7b8
1,700
PASSED
#include "iostream" #include "stdlib.h" #include "cstdio" #include "cmath" #include "cstring" #include "algorithm" using namespace std; int state,pre,cur;//0 up ,1 down; int in[100010]; int str1[100010],str2[100010]; int n,m,cnt,l,r; bool ok(int a,int b) { if(state==0) { if(a>b) return fals...
C++
c39db222c42d8e85dee5686088dc3dac
19199acd5d6d52e9daf55b125667ee1f
1,700
PASSED
#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <iostream> #include <map> #include <set> #include <queue> #include <list> using namespace std; #define PB push_back #define MP make_pair #define A first #define B...
C++
c39db222c42d8e85dee5686088dc3dac
28ae070bc4bbdcf93bebfeb27d66a181
1,700
PASSED
#include<stdio.h> #define X 100010 int a[X],l[X],r[X]; int main(){ int i,j,n,m,x,y; scanf("%d%d",&n,&m); for(i=1;i<=n;i++) scanf("%d",&a[i]); for(i=j=1;i<=n;i++){ if(a[i]>a[i-1])j=i; l[i]=j; } r[n+1]=1<<30; for(i=j=n;i>=1;i--){ if(a[i]>a[i+1])j=i; r[i]=j; } for(i=0;i<m;i++){ scanf("%d%d",&x,&y);...
C++
c39db222c42d8e85dee5686088dc3dac
643e255377cac68c9eda3f1ff1596f2c
1,700
PASSED
#include <cstdio> #include <cmath> #include <cstdlib> #include <cstring> #include <iostream> #include <algorithm> #include <string> #include <map> #include <queue> #include <vector> #include <set> using namespace std; #define N 100100 #define M 100100 #define LEN 1000100 #define KIND 26 #define INF 1023456789 #define ...
C++
c39db222c42d8e85dee5686088dc3dac
65048d892cd35e3adb5d886f213afee1
1,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n, un, a[100010], d[100010], cnt[100010], scnt[100010]; int r[100010]; int getr(int l) { bool dec = false; for (int r = l; r < un; r++) { if (a[r] < a[r + 1] && dec) return r; if (a[r] > ...
C++
c39db222c42d8e85dee5686088dc3dac
5c20742b81c9eb24358102a0f100249b
1,700
PASSED
//HighFlow #include <cstdio> #include <vector> #include <string> #include <bitset> #include <fstream> #include <string.h> #include <cmath> #include <algorithm> #define fcat(c) while (c!='\n') fscanf(f,"%c",&c) #define cat(c) while (c!='\n') scanf("%c",&c) #define For(i,st,dr,k) for (int i=st;i<=dr;i+=k) #define ll (lon...
C++
c39db222c42d8e85dee5686088dc3dac
0dc8cce0b372654326507710aa5e355c
1,700
PASSED
#include<iostream> #include<cstdio> using namespace std; int a[100005], u[100005], d[100005]; int i, n, m, j; int main() { cin >> n >> m; for (i = 1; i <= n; i++) cin >> a[i]; for (i = 1; i <= n; i++) if (a[i - 1] >= a[i]) u[i] = u[i - 1] + 1; else u[i] = 1; for (i = n; i; i--) if (a[i + 1] >= a[i])...
C++
c39db222c42d8e85dee5686088dc3dac
cbe345d14e9d3ed0df0787e620a88e66
1,700
PASSED
#include <iostream> #include <stdio.h> #include <string.h> #include <math.h> #include <algorithm> #include <vector> #include <queue> #include <map> //#include <conio.h> using namespace std; int main() { int n,q,i,incstart,sameval; ios::sync_with_stdio(false); cin>>n>>q; long long int a,last; bool pr...
C++
c39db222c42d8e85dee5686088dc3dac
5d26757d4eabfd90e473e56f08596bd9
1,700
PASSED
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define f first #define s second #define _ ios::sync_with_stdio(false);cin.tie(0); #define aa cout<<"aaaaaaaa"<<endl; using namespace std; typedef long long int ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef vec...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
133548b9f83f7be2042fa6d8272be490
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int n,i,j,r1,c1,r2,c2,x,z,r=1e9, dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1}, u[100][100]; string s[99]; struct P{int x,y;}; vector<P> c,cc; void df(P v){ c.push_back(v); u[v.x][v.y]=1; for(int d=0;d<4;d++){ P p={v.x+dx[d],v.y+dy[d]}; if(s[p.x][p.y]=='0'&&u[p.x][p.y]==0) df...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
a0927a7eb3db2ac082a245ad6e110cd7
1,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll a[60][60],vis[60][60]; vector<pair<ll,ll>> A,B; void dfs1(ll n, ll m) { if(vis[n][m] || !a[n][m]) return; A.push_back({n,m}); vis[n][m] = 1; dfs1(n+1,m); dfs1(n-1,m); dfs1(n,m+1); dfs1(n,m-1); } void dfs2(ll n, ll m) { if(vis[n][m...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
1ed9f65428c2f5b7a1084fb0301ec324
1,400
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<queue> using namespace std; char mpt[55][55]; int vis[55][55]={0}; int dir[4][2]={1, 0, -1, 0, 0, 1, 0, -1}; int c,r,cc,rr,n; struct node{ int x,y; }; void bfs(int x,int y,int v){ queue<node>q; node a; a.x=x,a.y=y; q.push(a); vis[x][y]...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
ba8974d639d2100418a0937049e1b831
1,400
PASSED
#include<stdio.h> #include<iostream> #include<algorithm> #include<string.h> #include<math.h> #include<map> using namespace std; typedef long long ll; int n,x[2],y[2]; char mpt[55][55]; int vis[2][55][55]; int ans=10000001; void dfs(int a,int b,int c) { if(vis[c][a][b]) { return ; } vis[c][a][b]=1; if(mpt[a+1][b]...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
e979cf0157f25fd2e0301d7cf76343d0
1,400
PASSED
#include<bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; int n, r1, c1, r2, c2, vis[100][100], mp[100][100], sum, ans = INF; char arr[100][100]; int net[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; struct node { int x, y; node(int _x, int _y): x(_x), y(_y) {} }; int check(int x, int y) { if(x < 0 ...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
ed4bac8cd94e5b88ea93be82027b5df7
1,400
PASSED
#include<iostream> #include<algorithm> #include<cstdio> #include<cstring> #include<string> #include<functional> #include<queue> #include<vector> using namespace std; int n, bx, by, ex, ey; char map[55][55]; int vis[55][55],mp[55][55];//分别为标记,判断联通块 int dir[4][2] = { 0, 1, 0, -1, 1, 0, -1, 0 }; struct node{ int x, y; };...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
f4603431137dcf036d31a4c30a58bc30
1,400
PASSED
#include<iostream> #include<algorithm> #include<cstdio> #include<cstring> #include<string> #include<functional> #include<queue> #include<vector> using namespace std; int n, bx, by, ex, ey; char map[55][55]; int vis[55][55],mp[55][55]; int dir[4][2] = { 0, 1, 0, -1, 1, 0, -1, 0 }; struct node{ int x, y; }; bool checked...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
4623bc27b442a60ec6c6deb07b45a32b
1,400
PASSED
#include<bits/stdc++.h> #define int long long #define IOS ios::sync_with_stdio(0); cin.tie(0); #define pi pair<int,int> #define pb emplace_back #define SZ(v) (int)(v).size() #define all(v) (v).begin(),(v).end() #define REP(i, j, k) for (int i = j; i < k; ++i) #define debug(a) cout << #a << " = " << a << endl; #define ...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
326bc3adac71c8203ff6bef967fae889
1,400
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; int n; int map[50][50]; char A[50][50]; int visit[50][50]; struct point { int x,y; }p1[1250],p2[1250]; int cal(point a,point b) { return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y); } void unite(int...
C++
6fe23a0ecc1c05e89d5680aa2ec6cb05
4f092a98f18a5fa6957e90d7bfa29b92
1,400
PASSED
//1020A //SISBuilding import java.io.*; import java.util.*; public class SISBuilding { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int tow = sc.nextInt(); int flo = sc.nextInt();...
Java
bdce4761496c88a3de00aa863ba7308d
de9a5fc0ca8a2f55348e28e047cb3bc3
1,000
PASSED