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; vector<int> v, vp, v0; int main() { int n, arr[110], neg(0), zero(0); scanf("%d",&n); for(int i = 0; i < n; i++) { scanf("%d",&arr[i]); } for(int i = 0; i < n; i++) { if(arr[i] < 0) { v.push_back(arr[i]); ...
C++
03cf2cc26c84aab685ee78a1d6318b30
03b85a4f0bcb05e1f3fcd0b4d0816a6d
1,100
PASSED
#include <bits/stdc++.h> #define endl '\n' #define all(v) ((v).begin()),((v).end()) #define rall(v) ((v).rbegin()),((v).rend()) #define F first #define S second #define pb push_back using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; void me() { ios::sync_with_stdio(0); ...
C++
03cf2cc26c84aab685ee78a1d6318b30
a3a40465838ff9023ee68de0750fc8fb
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int as[5000]; main() { int n; while(cin>>n) { int i, pos=0, neg=0; for(i=0; i<n; i++) { cin>>as[i]; if(as[i]>0)pos++; else if(as[i]<0)neg++; } sort(as, as+n); cout<<1<<" "<<as[0]<<endl; ...
C++
03cf2cc26c84aab685ee78a1d6318b30
15a047a7b05cef508d6d21bd74091721
1,100
PASSED
#include <cstdio> #include <map> int l[32],n,a[100005]; long long m; std::map<int,int> cnt; int main() { scanf("%d",&n); for (int i=0;i<n;i++) { scanf("%d",a+i); cnt[a[i]]++; } l[0]=2; for (int i=1;i<30;i++) l[i]=l[i-1]<<1; for (int i=0;i<n;i++) { cnt[a[i]]--; for (int j=29;j>=0;j--) { if (l[j]<a[i])...
C++
b812d2d3a031dadf3d850605d2e78e33
695a05ef3e40cc6b53154b05cccaff50
1,500
PASSED
#include <cstdio> #include <map> int l[32],n,a[100005]; long long m; std::map<int,int> cnt; int main() { scanf("%d",&n); for (int i=0;i<n;i++) { scanf("%d",a+i); cnt[a[i]]++; } l[0]=2; for (int i=1;i<31;i++) l[i]=l[i-1]<<1; for (int i=0;i<n;i++) { cnt[a[i]]--; for (int j=0;j<31;j++) if (l[j]>a[i]&&cn...
C++
b812d2d3a031dadf3d850605d2e78e33
ac1a3b56b5b5a715475c3661a901a26b
1,500
PASSED
#include <bits/stdc++.h> using namespace std; long long n,a[100005],ans; map<long long,long long> cnt; int main() { scanf("%lld",&n); for (int i=0;i<n;i++) { scanf("%lld",&a[i]); cnt[a[i]]++; } for (int i=0;i<n-1;i++) { cnt[a[i]]--; for (int j=1;j<32;j++) ans+=cnt[(1LL << j) - a[i]]; } printf("%lld\n",a...
C++
b812d2d3a031dadf3d850605d2e78e33
59aadeab0b91f1563addd93442dd9ab7
1,500
PASSED
#include <cstdio> #include <map> int l[32],n,a,t; long long m; std::map<int,int> cnt; int main() { scanf("%d",&n); l[0]=2; for (int i=1;i<30;i++) l[i]=l[i-1]<<1; for (int i=0;i<n;i++) { scanf("%d",&a); for (int j=29;j>=0;j--) { if (l[j]<a) break; t=l[j]-a; if (cnt.find(t)!=cnt.end()) m+=cnt[t]; } ...
C++
b812d2d3a031dadf3d850605d2e78e33
d29b8499f1550167cd95a510a5ba301f
1,500
PASSED
#include <cstdio> #include <map> int n,a[100005]; long long m,l[32]; std::map<int,int> cnt; int main() { scanf("%d",&n); for (int i=0;i<n;i++) { scanf("%d",a+i); cnt[a[i]]++; } l[0]=2; for (int i=1;i<31;i++) l[i]=l[i-1]<<1; for (int i=0;i<n;i++) { cnt[a[i]]--; for (int j=30;j>=0;j--) { if (l[j]<a[i])...
C++
b812d2d3a031dadf3d850605d2e78e33
eb4a53aebfc8e06e2b7245273e8d5e13
1,500
PASSED
#include <cstdio> #include <map> int l[32],n,a[100005]; long long m; std::map<int,int> cnt; int main() { scanf("%d",&n); for (int i=0;i<n;i++) { scanf("%d",a+i); cnt[a[i]]++; } l[0]=2; for (int i=1;i<31;i++) l[i]=l[i-1]<<1; for (int i=0;i<n;i++) { cnt[a[i]]--; for (int j=0;j<31;j++) if (l[j]>a[i]) m+...
C++
b812d2d3a031dadf3d850605d2e78e33
2be7e09c6ecdaa7c89958ebad9ff4025
1,500
PASSED
#include <bits/stdc++.h> using namespace std; long long niz[1000000]; map <long long, long long> br; long long brovi[31]; int main() { long long n,i,prn=0,bro=0,x,j; cin>>n; brovi[0]=1; for(i=1;i<=30;i++){ brovi[i]=brovi[i-1]*2; } for(i=0;i<n;i++){ cin>>x; br[x]++; ...
C++
b812d2d3a031dadf3d850605d2e78e33
65426fa3a929e5fb72f54d24539ad3b9
1,500
PASSED
#include<bits/stdc++.h> using namespace std; const int N =1e6+5; const long long M = (long long)1e9+7; #define ll long long #define ull unsigned long long int Int() { int x; scanf("%d",&x); return x; } ll Long() { ll x; scanf("%I64d",&x); return x; } void Char(char* ch) { sc...
C++
b812d2d3a031dadf3d850605d2e78e33
7d95285c74978c957f43fa4b80a9dd34
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define sd(a) cin >> a; #define sd2(a,b) cin >> a >> b #define sd3(a,b,c) cin >> a >> b >> c #define vi vector<long long int > #define pii pair<long long int ,long long int > #define lc cout << endl; #define sp cout << " "; int main() { ll n; ...
C++
b812d2d3a031dadf3d850605d2e78e33
0ad41fe5c51b982e3f8e506ea6c4c27e
1,500
PASSED
#include <stdio.h> #include <algorithm> #define MLen 100002 #define P2 32 long long int memo[P2+2],input[MLen],len,out=0; using namespace std; void power() { memo[0]=1; memo[1]=2; for(int i=2;i<=P2;i++) memo[i]=memo[i-1]*2; } int main() { power(); scanf("%lld",&len); for(int i=0;i<l...
C++
b812d2d3a031dadf3d850605d2e78e33
5f4656c5f13acdfe65c7c8ba676e39c9
1,500
PASSED
#include <bits/stdc++.h> #define Max 100009 #define ll long long using namespace std; ll n,m; vector < ll > arr,arr2; ll ans=0; ll ind=n-1; bool chk( ){ while( !arr[ind] ) ind--; if( ind < 0 ) return 1; return 0; } bool can( ll t){ arr = arr2; ind=n-1; if( chk() == 1 ) return 1; ll gal=0; ...
C++
ed0a8a10e03de931856e287f9e650e1a
3d76348a392fcbaae878df9ea412ad9d
2,200
PASSED
#include <bits/stdc++.h> #define Max 100009 #define ll long long using namespace std; ll n,m; vector < ll > arr,arr2; ll ans=0; ll ind=n-1; bool chk( ){ while( !arr[ind] ) ind--; if( ind < 0 ) return 1; return 0; } bool can( ll t){ arr = arr2; ind=n-1; if( chk() == 1 ) return 1; ll gal=0; ...
C++
ed0a8a10e03de931856e287f9e650e1a
d0986af3ffbfa7f22fdef9e1389ae3c8
2,200
PASSED
#include <bits/stdc++.h> #define LL long long #define pb push_back #define mp make_pair #define INF 0x3f3f3f3f #define Inf 1000000000000000000LL // #define int long long using namespace std; typedef pair<int,int>pii; LL n,m; LL a[100010]; LL ll=0,rr; bool check(LL x){ int j=n; LL k=a[j]; for(int i=1;i<=m;i++){ LL ...
C++
ed0a8a10e03de931856e287f9e650e1a
6197fddccefa7837dec301d320fe1af9
2,200
PASSED
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; typedef long long LL; const int maxn = 100005, maxm = 100005; int aa[maxn]; int now[maxn]; int n, m; inline bool pan(LL x) { for(int i = 1; i <= n; ++i) now[i] = aa[i]; int noww = n; for(int i = 1; i <= m; ++i) { LL tx = x; w...
C++
ed0a8a10e03de931856e287f9e650e1a
f1d08db359e76bca2fb137cac3092a63
2,200
PASSED
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; #define int long long const int maxn = 100005, maxm = 100005; int aa[maxn]; int now[maxn]; int n, m; inline bool pan(int x) { for(int i = 1; i <= n; ++i) now[i] = aa[i]; int noww = n; for(int i = 1; i <= m; ++i) { int tx = x; ...
C++
ed0a8a10e03de931856e287f9e650e1a
3c87a497a32a12761bde8c0d0e43995f
2,200
PASSED
#include<iostream> #include <stdio.h> using namespace std; int boxs[100005]; int piles,totBox, studLen; //贪心算法判断该时间是否满足移动箱子 int check(long long x) { int cnt = studLen; int i, j, k; long long s = 0; for (i = 1; i <= totBox; i++) { s += boxs[i]; while (s + i >= x)//移动箱子加移动路程的总时间超过了x { s -= x - i;//对于已走的路...
C++
ed0a8a10e03de931856e287f9e650e1a
a85682dbfd4671350b4237449446d84b
2,200
PASSED
#include<iostream> using namespace std; int boxs[100005]; int piles, totBox, studLen; long long sum, l, r, mid, ans; //贪心算法判断该时间是否满足移动箱子 bool check(long long mid) { int cnt = studLen; int i; sum = 0; for (i = 1; i <= totBox; i++) { sum += boxs[i]; while (sum + i >= mid) { //对于已走的路程i,那么一个人有mid-i个时间来搬箱子,所...
C++
ed0a8a10e03de931856e287f9e650e1a
c166e6be9128d8c078a3d64cd1d23bf3
2,200
PASSED
#include<iostream> #include <stdio.h> using namespace std; int boxs[100005]; int piles,totBox, studLen; //贪心算法判断该时间是否满足移动箱子 int check(long long x) { int cnt = studLen; int i, j, k; long long s = 0; for (i = 1; i <= totBox; i++) { s += boxs[i]; while (s + i >= x)//移动箱子加移动路程的总时间超...
C++
ed0a8a10e03de931856e287f9e650e1a
f2719aeb118643719eddbb4cfd721623
2,200
PASSED
#include<iostream> #include<string.h> using namespace std; long long pilesCount[100005]; int n, m; int road = 0; long long sum = 0; long long totalTime = 0; int main() { while (cin >> n) { cin >> m; road = 0; sum = 0; totalTime = 0; for (int i = 1; i <= n; i++) { cin >> pilesCount[i]; sum += pilesCoun...
C++
ed0a8a10e03de931856e287f9e650e1a
04ee4585b7faa96e82b53eee19a13ca5
2,200
PASSED
/* #include <iostream> #include <vector> using namespace std; #define MAXLENGTH 100005 int a[MAXLENGTH], b[MAXLENGTH]; typedef long long ll; bool check(long long m_time, int n, int m, int end ){ for(auto i = 1; i <= n; i++){ b[i] = a[i]; } for(auto i = 1; i <= m; i++ ){ long long test_tim...
C++
ed0a8a10e03de931856e287f9e650e1a
3dabbd064def590d3d79cf092f39f24c
2,200
PASSED
#include <vector> #include <stack> #include <iostream> #include <cstdio> #include <string> #include <cmath> #include <algorithm> #include <map> #include <functional> #include <set> #include <cstring> #include <queue> #include <stdlib.h> #include <time.h> #include <complex> #include <iterator> #include <regex> #include ...
C++
09890f75bdcfff81f67eb915379b325e
60ab75f773d4a197956e35ae6311553e
2,200
PASSED
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define pii pair<int,int> #define pb push_back #define mp make_pair #define mt make_tuple #define DEBUG 1 #define cerr if (DEBUG) cerr #define fprintf...
C++
09890f75bdcfff81f67eb915379b325e
7a2c2990cda8f7a205c833ec261b627c
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pb push_back #define mp make_pair #define ms(a, b) memset((a), (b), sizeof(a)) #define len(a) (int)((a).size()) #define all(a) (a).begin(), (a).end() #define lb lower_bound #define ub upper_bound #define fore...
C++
09890f75bdcfff81f67eb915379b325e
d057d490ddfbd7cdf5bbd1d1f1183bec
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pb push_back #define mp make_pair #define ms(a, b) memset((a), (b), sizeof(a)) #define len(a) (int)((a).size()) #define all(a) (a).begin(), (a).end() #define lb lower_bound #define ub upper_bound #define fore...
C++
09890f75bdcfff81f67eb915379b325e
65adb8fbf73508d8f136701cd3e89e61
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() const long double EPS = 1e-14; const int maxn = 10050; const int mod = 1e9 + 7; bool in[maxn]; struct BIT{ private: long long tree[maxn + 10]; public: void add(int x, long l...
C++
09890f75bdcfff81f67eb915379b325e
be34d72cea0d3376546d073d8db9cf76
2,200
PASSED
#include <bits/stdc++.h> using namespace std; const int MX=5001; pair<int,int> a[MX]; vector<pair<int,int>> bb[MX*2]; int n1,n2; struct Vseg{ int lo,hi,x; bool operator <(const Vseg&r){ return lo<r.lo; } }c[MX]; struct Hseg{ int lef,rig,y; bool operator <(const Hseg&r){ return y<r.y;...
C++
09890f75bdcfff81f67eb915379b325e
4a44d627d6ee773a3acc12d269eaa048
2,200
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int M=5e3+1,N=1e4+1; vector<array<int,3> >V,H; int T[N+10]; int lowbit(int x){return x&(-x);} void add(int x,int val){for(;x<=N;x+=lowbit(x))T[x]+=val;} int ask(int x){ int ans=0; for(;x;x-=lowbit(x))ans+=T[x]; return ans; } int main()...
C++
09890f75bdcfff81f67eb915379b325e
260fb5ffea55a36e90884f8b291dbd2a
2,200
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; using ll = long long; const int mxn = 10010; const int base = 5000; struct Hline { int y, x1, x2; }; struct Vline { int x, y1, y2; }; struct cmp { bool operator() (const Hline &A, const Hline &B) c...
C++
09890f75bdcfff81f67eb915379b325e
bb8cc023e912f41fdf21ccde9595decf
2,200
PASSED
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int N = 1e5 + 5; const int R = 1e4 + 1; ll c[N]; int lb(int x) { return x & (-x); } void add(int x,int v){ for (int i = x; i <= R; i += lb(i)) { c[i] += v; } } ll query(int x){ ll sum = 0; for (int i = x; i > 0; i -= l...
C++
09890f75bdcfff81f67eb915379b325e
2e8b4806096f02144545c5b5bfc2e271
2,200
PASSED
#include <map> #include <set> #include <cmath> #include <deque> #include <queue> #include <stack> #include <cstdio> #include <string> #include <vector> #include <complex> #include <cstring> #include <iomanip> #include <utility> #include <iostream> #include <algorithm> using namespace std; typedef long long ll; typede...
C++
09890f75bdcfff81f67eb915379b325e
3d3b5c6f324ecd01b1c033c4d008fc4c
2,200
PASSED
//God & me //be konkoor salami dobare bayad kard ;) #include <bits/stdc++.h> #define pb push_back #define X first #define Y second #define int long long using namespace std; template <class T, class L> bool smax(T &x,L y){ return x < y ? (x = y, 1) : 0; } template <class T, class L> bool smin(T &x,L y){ return y < x...
C++
e54f8aff8ede309bd591cb9fbd565d1f
f86cba956b9c7e4e1135cf919b9a954c
2,600
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <cmath> #include <ctime> #include <cassert> #include <iostream> #include <iomanip> #include <string> #include <vector> #include <set> #include <map> #include <queue> #include <deque> #include <bitset> #include <algorithm> #define MST(a,...
C++
e54f8aff8ede309bd591cb9fbd565d1f
b0eb1a575ee7412c9fdd62e08f828d18
2,600
PASSED
#include <iostream> #include <vector> #include <chrono> #include <random> #include <algorithm> #include <map> std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count()); long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } struct Fraction { typedef long long T; T...
C++
e54f8aff8ede309bd591cb9fbd565d1f
744cb2ffb04863b179586f36525b6931
2,600
PASSED
#include <bits/stdc++.h> #define snuke(i,x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i) #define OUT(x) std::cout<<(#x)<<":"<<(x)<<std::endl #define ALL(v) (v).begin(), (v).end() #define SZ(v) ((int)(v).size()) template<class T> void Read(T&ret){ret=0;bool ok=0,u=0;for(;;){int c=getchar();if(c>='0'&...
C++
e54f8aff8ede309bd591cb9fbd565d1f
b486b71f6a0acf17e5a2af82f16b4f1a
2,600
PASSED
#include <cstdio> #include <cstdlib> #include <cassert> #include <iostream> #include <set> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <numeric> #include <cmath> #include <complex> #include <map> #include <queue> using namespace std; typedef long long ll; typedef vector<int> vi;...
C++
e54f8aff8ede309bd591cb9fbd565d1f
af46721012cb562df493afc50049f5e9
2,600
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include <cmath> #include <map> using namespace std; #define mp make_pair #define pb push_back #define ll long long #define maxN 200011 struct frac { ll a, b; bool operator<(const frac& who)const { retur...
C++
e54f8aff8ede309bd591cb9fbd565d1f
dbb70982cfc075224966e361bcc21d22
2,600
PASSED
#include <algorithm> #include <iostream> #include <assert.h> #include <sstream> #include <complex> #include <numeric> #include <cstring> #include <vector> #include <string> #include <cstdio> #include <queue> #include <cmath> #include <map> #include <set> using namespace std; #define all(a) (a).begin(), (a).end() #d...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
c8f429a2907d9d5c75c965dad50ebf65
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #ifdef SG #include <debug.h> #else #define show(...) #define debug(...) #define deepen(...) #define timer(...) #endif #define forn(i,n) for (int i = 0; i < int(n); ++i) #define ford(i,n) for (int i = int(n) - 1; i >= 0; --i) #define forv(i,v) for (auto i = v.begin();...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
746dc2345e452ce52877521be41d4256
2,500
PASSED
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++) #define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--) #define REP(i,a) for(int i=0,_a=(a); i<_a; i++) #define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it) #define DEBUG(x) { cout << #x << " = "; cout << (x) << en...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
f0e9679277f984a73dc8db209d792886
2,500
PASSED
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstdarg> #include <cassert> #include <climits> #include <cstring> #include <complex> #include <cstdio> #include <vector> #include <string> #include <queue> #include <cmath> #include <ctime> #include <set> #include <map> using namespace std; typedef...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
12624b29bb8df6fe491a6792420b08d9
2,500
PASSED
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstdarg> #include <cassert> #include <climits> #include <cstring> #include <complex> #include <cstdio> #include <vector> #include <string> #include <queue> #include <cmath> #include <ctime> #include <set> #include <map> using namespace std; typedef...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
21b5c59193f0a732963e5e5f131b2e87
2,500
PASSED
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstdarg> #include <cassert> #include <climits> #include <cstring> #include <complex> #include <cstdio> #include <vector> #include <string> #include <queue> #include <cmath> #include <ctime> #include <set> #include <map> using namespace std; typedef...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
636af5ab6a59d8d31681a27c627b82cd
2,500
PASSED
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstdarg> #include <cassert> #include <climits> #include <cstring> #include <complex> #include <cstdio> #include <vector> #include <string> #include <queue> #include <cmath> #include <ctime> #include <set> #include <map> using namespace std; typedef...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
0b71203cb1cac9aae862be7a38a911a2
2,500
PASSED
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstdarg> #include <cassert> #include <climits> #include <cstring> #include <complex> #include <cstdio> #include <vector> #include <string> #include <queue> #include <cmath> #include <ctime> #include <set> #include <map> using namespace std; typedef...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
41830643e25d8198f19248bc3d9736bc
2,500
PASSED
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstdarg> #include <cassert> #include <climits> #include <cstring> #include <complex> #include <cstdio> #include <vector> #include <string> #include <queue> #include <cmath> #include <ctime> #include <set> #include <map> using namespace std; typedef...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
a4926f90f9a419845cdc86626b74b3dc
2,500
PASSED
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstdarg> #include <cassert> #include <climits> #include <cstring> #include <complex> #include <cstdio> #include <vector> #include <string> #include <queue> #include <cmath> #include <ctime> #include <set> #include <map> using namespace std; typedef...
C++
11870e3fb1aaad9bf15dc505aa9cd0f5
37deb60474e2f647c605ffc384416fbc
2,500
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <numeric> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <c...
C++
a1ea9eb8db25289958a6f730c555362f
e8013d424cf99fc6fd2f5a3572cb7361
1,300
PASSED
#include <bits/stdc++.h> #define ll long long int #define fp freopen("in.txt","r",stdin) using namespace std; map<int,int>mp; struct contest { char name[100]; int m; int n; //char name[100]; }; bool comp(contest a,contest b) { int x=a.m; int y=b.m; if(a.m==b.m) { //if(a.n>b...
C++
a1ea9eb8db25289958a6f730c555362f
3784703230664bb7ff72c12188396a0c
1,300
PASSED
#include <bits/stdc++.h> #define ll long long int #define fp freopen("in.txt","r",stdin) using namespace std; map<int,int>mp;//map for tracking how many of those regions are present.. struct contest { char name[100]; int m; int n; }; bool comp(contest a,contest b) { int x=a.m; int y=b.m; if...
C++
a1ea9eb8db25289958a6f730c555362f
c5e8dc9eecb4079e0a4bd41d90600a38
1,300
PASSED
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define mp make_pair #define INF 0x3f3f3f3f #define endl '\n' #define PI acos(-1) #define N 10002 #define int long long using namespace std; int n, m; priority_queue<pair<int,string> > v[N]; main (){ ios_base::sync_with_stdio(0); ...
C++
a1ea9eb8db25289958a6f730c555362f
2034d69f46a68f70c5bcaf79d5d875f3
1,300
PASSED
#include <bits/stdc++.h> #define fi first #define se second using namespace std; int main () { int a,b,c[10005]={},i; vector < pair <int , string> > my[100005]; cin>>a>>b; for (i=1;i<=a;i++) { string m; int d,e; cin>>m>>d>>e; my[d].push_back(make_pair(e,m)); } for (i=1;i<=b;i++) { sort (my[i].begin(),my[i].end()); ...
C++
a1ea9eb8db25289958a6f730c555362f
0a393a356eb2c815ab853c5b6d32a262
1,300
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using namespace std; const int MAXN = 1e5+5; struct sa { int id, sc; char name[105]; } arr[MAXN]; bool cmp(sa a, sa b) { if(a.id == b.id) return a.sc > b.sc; return a.id < b.id; } int main() { in...
C++
a1ea9eb8db25289958a6f730c555362f
977ee0d6deeb1fede6577a1535a7a4ce
1,300
PASSED
#include <stdio.h> #include <algorithm> using namespace std; struct people{ char num[100]; int et; int score; }; bool cmp(people c,people d) { if (c.et < d.et) return true; else if (c.et == d.et&&c.score > d.score) return true; else return false; } struct people a[1...
C++
a1ea9eb8db25289958a6f730c555362f
67f2d09a0aa10457d118a1010d3d4add
1,300
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <string> #include <cmath> #include <stack> #include <queue> using namespace std; #define vec vector #define rep(k, l, r) for (int k = (int)(l); k < (int)(r); k++) const int INF = 1e9; struct node { string s; int num, val; node() {}...
C++
a1ea9eb8db25289958a6f730c555362f
1020d18e8e6b3c5b359b4bdf1cd7f004
1,300
PASSED
#include <string.h> #include <iostream> #include <algorithm> using namespace std; struct student{ string name; int id, ball; }a[111111]; bool comp(student x, student y){ return x.id < y.id ? true : x.id == y.id ? x.ball > y.ball : false; } int n, m, res; int main(){ cin >> n >> m; for(int i = 1; i <= n; ++ i){ c...
C++
a1ea9eb8db25289958a6f730c555362f
58077f21784a589ed088df97b130be03
1,300
PASSED
#include <string.h> #include <iostream> #include <algorithm> using namespace std; struct student{ string name; int id, ball; }a[111111]; bool comp(student x, student y){ return x.id < y.id ? true : x.id == y.id ? x.ball > y.ball : false; } int n, m, res; int main(){ cin >> n >> m; for(int i = 1; i <= n; ++ i){ c...
C++
a1ea9eb8db25289958a6f730c555362f
217731eceeca72a8a399f0e9c555e376
1,300
PASSED
#include <iostream> #include <vector> #include <algorithm> int main(){ int t; std::cin >> t; for(int u = 0; u < t; ++u){ int n; std::cin >> n; std::vector<int> a; for(int i = 0; i < n; ++i){ int b; std::cin >> b; a.push_back(b); } ...
C++
e26b0b117593c159b7f01cfac66a71d1
f27a988ce8f93968903a902ee7aa0f6a
900
PASSED
#include<iostream> using namespace std; int count(int arr[],int size,int x) { int freq=0; for(int i=0;i<size;i++) { if(arr[i]==x) freq++; } return freq; } int main(){ int t; cin>>t; while(t--) { int n; cin>>n; int i; int a[110];...
C++
e26b0b117593c159b7f01cfac66a71d1
a8e8c47073039cca1b0449c9f377a228
900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; std::istream& in(std::cin); std::ostream& out(std::cout); const int inf = 1e9; int n, m, tt; int solve(vector<int> & vec){ int res = 0; set<int> s; int a, b; a = b = 0; sort(vec.begin(), vec.end()); for(auto y :...
C++
e26b0b117593c159b7f01cfac66a71d1
42ebdf337bd89267cbc55527dcbb676e
900
PASSED
#include<bits/stdc++.h> using namespace std; map<int,int>mp;// ele,cnt vector<int>A; vector<int>B; int main() { int t,n,ele; cin>>t; while(t--) { A.clear(); B.clear(); mp.clear(); cin>>n; for(int i=0; i<n; i++) { cin>>ele; mp[ele...
C++
e26b0b117593c159b7f01cfac66a71d1
e56f574d1caffee6c5624c53099b2d23
900
PASSED
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; typedef unsigned long long ull; # define M_PI 3.14159265358979323846 const int M=1e9+7; long long mod(long long x){ return ((x%M + M)%M); } long long add(long long a, long long b){ ...
C++
e26b0b117593c159b7f01cfac66a71d1
df6a7ef3b8073f9ee9bec0b90bfd74fe
900
PASSED
#include <iostream> using namespace std; int main() { int t;cin >> t; while(t--) { int n,a; cin >> n; int cnt[101] = {0}; for(int i = 0; i < n; i++) { cin >> a; cnt[a]++; } int mexa , mexb; for(int i = 0; i <=100; i++) ...
C++
e26b0b117593c159b7f01cfac66a71d1
d2d3e307103009ffeabdfea52bfcf815
900
PASSED
#include<iostream> // #include<cstring> // #include<queue> // #include<vector> // #include<utility> using namespace std; int inf=1e9; //vector<int>adj[10000]; int a[105]; int main() { int t; cin>>t; while(t--) { int n,x,p,k=0,ans=0; cin>>n; for(int i=0;i<=n+1;i++) a[i]=0; for(int i=0;i<n;i++) { cin>...
C++
e26b0b117593c159b7f01cfac66a71d1
755e625eead4c765d7c46622da5b9994
900
PASSED
#include <cstdio> #include <iostream> using namespace std; long long angka[105]; long long banyak[105]; int main(){ long long tc,mulai,isi1,isi2,i,j,banyak1,tampung,jawaban,salah; scanf("%lld", &tc); getchar(); for(i=0;i<tc;i++){ scanf("%lld", &banyak1); getchar(); for(j=0;j<=1...
C++
e26b0b117593c159b7f01cfac66a71d1
e3ae9ae74ad72b4490b1f684299bbaf3
900
PASSED
#include <bits/stdc++.h> using namespace std; //__gcd(m, n) int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long long t; cin >> t; while(t--) { long long n; cin >> n; map<int,int> a; for(int i=0;i<n;i++) { int x; ...
C++
e26b0b117593c159b7f01cfac66a71d1
a2ab1b3bee4b3c7e1fa86ac7d2f13990
900
PASSED
#include<bits/stdc++.h> using namespace std; #define fo(i,n) for(int32_t i=0;i<n;i++) #define endl "\n" #define pb push_back typedef int64_t tt; /* tt fun_ceil(tt n,tt k){ if(n%k==0){ return n/k; } else { tt x = (n/k)+1; return x; } } */ int main(){ ios_base::sync_with_st...
C++
e26b0b117593c159b7f01cfac66a71d1
d7a818429935d4c678bb20d490049494
900
PASSED
#include <bits/stdc++.h> using namespace std; const int sz=1e5+9; long long a[sz]; int n,h; long long ans,tmp; int rem; vector<pair<int,int>> org; deque<long long> dq; vector<long long> v1; long long calc(){ long long mn=1e9; long long mx=-1; if(v1.size()>=2){ mn=min(mn,v1.back()+v1[v1.size()-2]); ...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
56dd5d69721a2406af88ddc67ece3519
1,800
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; vector<pair<ll int, ll int > > v; ll int a[100010]; int main() { ll int n,h,i,j; // freopen("input.txt","r",stdin); cin>>n>>h; v.push_back(make_pair(0,0)); for(i=1;i<=n;i++){ cin>>a[i]; v.push_back(make_pair(a[i], i)); } //ll int l = f...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
c1b575a7ef996010abb0cd7a4b0e2dc3
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int n,h,a[100020],v; int main(){ cin>>n>>h; for(int i=0;i<n;i++)cin>>a[i]; int p = min_element(a,a+n)-a; sort(a,a+n); int t1=a[n-1]+a[n-2]-a[0]-a[1],t2=max(a[n-1]+a[n-2],a[0]+a[n-1]+h)-min(a[0]+a[1]+h,a[1]+a[2]); if(n<3||t2>t1)p=n; cout<<min(t1,t2)<<endl; for(int i=0...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
0f56fa6cf3d71d6e412e818ac95e417b
1,800
PASSED
#include <iostream> #include <cstdio> #include <string> #include <string.h> #include <queue> #include <math.h> #include <cmath> #include <map> #include <set> #include <vector> #include <algorithm> #include <bitset> #include <list> #include <ctype.h> #include <cassert> #include <stack> #include <fstream> #include <unord...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
f558821f400024b73dba013f758ca871
1,800
PASSED
#include <iostream> #include <algorithm> #include <stdio.h> #include <set> #include <string.h> #include <string> #include <vector> #include <unordered_map> #include <queue> #include <iomanip> #include <fstream> #include <map> using namespace std; typedef vector<int> vi; typedef pair<int,int> ii; typedef long long ll; ...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
cf6551889b6f1eb641daa0a811857317
1,800
PASSED
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define ff first #define ss second ll mod = 1000000007; using namespace std; vector<int>ar; map<int, int>I; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, h; cin >> n >> h; ar.resize(n + 1); ar[0] = -1; ...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
e789f2fd28e5bff119a79a2b80db1291
1,800
PASSED
/* *Author - Abhas Jain */ #include <bits/stdc++.h> #define F first #define S second #define all(c) c.begin(), c.end() #define endl '\n' #define pb push_back typedef long long ll; typedef long double ld; using namespace std; mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count()); const ld...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
53dcb296f3ec6b2812392e8efce578de
1,800
PASSED
#include<stdio.h> #include<algorithm> using namespace std; int n,h,a[100020],b[100020],v; int main() { scanf("%d %d",&n,&h); for(int i=0;i<n;i++) scanf("%d",a+i); int p=min_element(a,a+n)-a; sort(a,a+n); int t1=a[n-1]+a[n-2]-a[0]-a[1],t2=max(a[n-1]+a[n-2],a[0]+a[n-1]+h)-min(a[0]+a[1]+h,a[1]+a[2]); if(n<3||t2>t1...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
9292163b07e9d8deddfba04b7cb7ceb3
1,800
PASSED
#include <stdio.h> #include <vector> #include <algorithm> #define pb push_back using namespace std; const int MAXN = (int)1e5 + 5; int ans[MAXN]; int main(void) { int n, h; int a; vector <pair <int, int> > v; scanf(" %d %d", &n, &h); if (n == 2) { printf("0\n"); printf("1 1\n"); ...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
022be0324b0a42d609195bcc22aba5d5
1,800
PASSED
#include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <iomanip> #include <string> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <list> #include <algorithm> using namespace std; #define nln ...
C++
d98dfee0f6998a1bb0d00c7e4e7de7f6
fab9e56b3d7a998cf9bd1914d9b12ec1
1,800
PASSED
#include<stdio.h> #include<math.h> #include<queue> #include<stack> #include<string.h> #include<algorithm> #include<cctype> #include<map> #include<set> typedef long long ll; using namespace std; int a[200005],b[1000005]; int main() { int t,n,k,d,minn=0,mm=0; scanf("%d",&t); while(t--){ minn=0;mm=0; scanf("%d%d%d"...
C++
56da4ec7cd849c4330d188d8c9bd6094
28e6050a6b9c6c6711e5b9f4d36e5824
1,300
PASSED
#include<stdio.h> #include<math.h> #include<queue> #include<stack> #include<string.h> #include<algorithm> #include<cctype> #include<map> #include<set> typedef long long ll; using namespace std; int a[200005],b[1000005]; int main() { int t,n,k,d,minn=0,mm=0; scanf("%d",&t); while(t--){ minn=0;mm=0; scanf("%d%d%d"...
C++
56da4ec7cd849c4330d188d8c9bd6094
ea45ae961d22800ccbf40b5cffe922d7
1,300
PASSED
#include<stdio.h> #include<math.h> #include<queue> #include<stack> #include<string.h> #include<algorithm> #include<cctype> #include<map> #include<set> typedef long long ll; using namespace std; int a[200005],b[1000005]; int main() { int t,n,k,d,minn=0,mm=0; scanf("%d",&t); while(t--){ minn=0;mm=0; scanf("%d%d%d"...
C++
56da4ec7cd849c4330d188d8c9bd6094
5ee3d3ae47df66f6e036b02e2f782e54
1,300
PASSED
#include<stdio.h> #include<math.h> #include<queue> #include<stack> #include<string.h> #include<algorithm> #include<cctype> #include<map> #include<set> typedef long long ll; using namespace std; int a[200005],b[1000005]; int main() { int t,n,k,d,minn=0,mm=0; scanf("%d",&t); while(t--){ minn=0;mm=0; scanf("%d%d%d"...
C++
56da4ec7cd849c4330d188d8c9bd6094
c5f0fd0ffed18ba8c48e64504174be55
1,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,T; int a[1111111]; int s[1111111]; int main() { ios::sync_with_stdio(0); cin>>T; for(int i=1;i<=T;i++) { int n,k,d,l=2147483647; cin>>n>>k>>d; memset(a,0,sizeof(a)); for(int j=1;j<=n;j++)cin>>s[j...
C++
56da4ec7cd849c4330d188d8c9bd6094
ad00d0c34e311f68711b70801cfa212a
1,300
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long map<ll,ll>mp; ll ar[1234567]; int main() { ll t,n,m,a,b,c,ok=0,ans,res,k,i; cin>>t; while(t--) { ans=1e9; ok=0; cin>>n>>m>>k; for(i=1; i<=n; i++) { cin>>ar[i]; } for(i=1...
C++
56da4ec7cd849c4330d188d8c9bd6094
fdde8c869cbcc4d8970e69a88b0dc6e7
1,300
PASSED
#include <bits/stdc++.h> #define ull unsigned long long #define ll long long #define pb push_back #define mp make_pair #define mod 1000000007 #define line cout<<"------------------------"<<endl; #define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); #define filein freopen("input.txt","r",stdin) #define ...
C++
56da4ec7cd849c4330d188d8c9bd6094
f91a2ca21f4f7549316070da0e2e5a29
1,300
PASSED
#include <bits/stdc++.h> #define maxN 200005 using namespace std; int n,k,dem[1000005], ntest, a[maxN],d,res,cnt; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //eopen("in.txt" , "r" , stdin); cin >> ntest; for (int t=1; t<=ntest; t++){ cin >> n >> k >> d; for...
C++
56da4ec7cd849c4330d188d8c9bd6094
351fabeba8c3307547233a0629ad5f8e
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define mid ((l+r)>>1) const int maxn = 2e5+10; const int maxk = 1e6+10; int n[maxn]; int N,K,D; int tree[maxk<<2]; int num[maxk<<2]; inline int Ls(int p){return p<<1;} inline int Rs(int p){return (p<<1)|1;} inline void push_up(int p){tree[p]=tree[Ls(p)]+tree[Rs(p)];} void...
C++
56da4ec7cd849c4330d188d8c9bd6094
5e4022b46f804bda0d37301eb47a42e6
1,300
PASSED
#include<bits/stdc++.h> #define ll long long int #define pb push_back #define endl "\n" #define gcd(a, b) __gcd(a, b) #define lcm(a, b) ((a*b)/gcd(a, b)) #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; ///dfs move int X[] = {0, 1, 0, -1}; int Y[] = {-1, 0, 1, 0}; /*if direction ...
C++
56da4ec7cd849c4330d188d8c9bd6094
6c3b4c599f5b2cd080f470280781d6bb
1,300
PASSED
#include <bits/stdc++.h> #define ff first #define ss second #define pp pop_back #define mp make_pair #define pb push_back #define lld long long #define mid(x, y) (x+y)/2 #define pii pair <int, int> #define sz(x) (int)x.size() #define gcd(x, y) __gcd (x, y) #define all(x) x.begin(), x.end() #define foreach(i, x) for(au...
C++
ee34d1e5a9efdcb7578b28b85819c5e7
20787fe3e2ecec928ce5abb7941aaa4a
3,000
PASSED
/* I will chase the meteor for you, a thousand times over. Please wait for me, untill I fade forever. Just 'coz GEOTCBRL. */ #include <bits/stdc++.h> using namespace std; #define fore(i,u) for (int i = head[u] ; i ; i = nxt[i]) #define rep(i,a,b) for (int i = a , _ = b ; i <= _ ; i ++) #define per(i,a,b) for (int i...
C++
ee34d1e5a9efdcb7578b28b85819c5e7
e2846a81aabfde55d23c37b28fb5e924
3,000
PASSED
// Author -- Frame #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #pragma GCC optimize("no-stack-protector") #include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<algorithm> #include<vector> #include<iostream> #define lowbit(x) ((x)&(-x)) #define Finline __inline__ __attribute__ ((...
C++
ee34d1e5a9efdcb7578b28b85819c5e7
b968170be8e44a9322aeba6d099bbccc
3,000
PASSED
// Author -- Frame #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #pragma GCC optimize("no-stack-protector") #include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<algorithm> #include<vector> #include<iostream> #define lowbit(x) ((x)&(-x)) #define Finline __inline__ __attribute__ (...
C++
ee34d1e5a9efdcb7578b28b85819c5e7
87e4e34a97600e5fbc56ab1a8f6b61b6
3,000
PASSED
#pragma GCC optimize(2) #include <iostream> #include <cstdio> #include <cmath> #define N 300002 using namespace std; const int mod=1000000007; struct node{ int l,r; }s[2][N],tmp1[N],tmp2[N]; struct Hash{ long long h1,h2; }Mod,p[N],H1[N],H2[N]; Hash operator + (Hash a,Hash b){return (Hash){(a.h1+b.h1)%mod,(a.h2+b.h2)%...
C++
ee34d1e5a9efdcb7578b28b85819c5e7
8581d579a585b47a5d317f3d175abdd7
3,000
PASSED
#pragma GCC optimize(2) #include <iostream> #include <cstdio> #include <cmath> #define N 300002 using namespace std; const int mod=1000000007; struct node{ int l,r; }s[2][N],tmp1[N],tmp2[N]; struct Hash{ long long h1,h2; }Mod,p[N],H1[N],H2[N]; Hash operator + (Hash a,Hash b){return (Hash){(a.h1+b.h1)%mod,(a.h2+b.h2)%...
C++
ee34d1e5a9efdcb7578b28b85819c5e7
d67fd6e1931619febde5cb5053d30d2c
3,000
PASSED
#include<bits/stdc++.h> using namespace std; #define nn 300003 #define ll long long ll mod=1000000007,hp=1047; char str[nn];int n; vector<int> v[nn];int pa[nn];int son[nn],siz[nn]; ll pre[nn],suf[nn];//top is front int dep[nn],top[nn],con[nn]; int dfn[nn],rdfn[nn],DFN; ll qp[nn]; void dfs1(int x,int p) { pa[x]=p;dep[...
C++
ee34d1e5a9efdcb7578b28b85819c5e7
8bd7d5cccea8d0e8d08c946cdfc24d8e
3,000
PASSED
/* Compete against Yourself. Author - Aryan Choudhary (@aryanc403) */ #pragma GCC optimize ("Ofast") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize ("-ffloat-store") #include<iostream> #include<bits/stdc++.h> using namespace std; #define fo(i,n) for(i=0;i<(n)...
C++
14ad30e33bf8cad492e665b0a486008e
5252b3faa945f38962de9ed8f0aafb23
1,500
PASSED
#include <bits/stdc++.h> using namespace std; using ll=long long; using ld=long double; using ull=unsigned long long; using uint=unsigned int; using pcc=pair<char,char>; using pii=pair<int,int>; using pll=pair<ll,ll>; using pdd=pair<double,double>; using tuplis=pair<ll,pll>; using tuplis2=pair<pll,ll>; template<class T...
C++
14ad30e33bf8cad492e665b0a486008e
cbe426531edb766b654813e1af7610a3
1,500
PASSED
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #include <bits/stdc++.h> using namespace std; #define sqr 500 #define mid (l+r)/2 #define pb push_back #define ppb pop_back #define fi first #define se second #define lb lower_bound #define ub upper_bound #define ins insert #define era erase #define C con...
C++
14ad30e33bf8cad492e665b0a486008e
0b00452954c9b3a1a424a84cdb14ce32
1,500
PASSED
#include <fstream> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <c...
C++
14ad30e33bf8cad492e665b0a486008e
040a4c3b27168d32ba5f511e34932aa9
1,500
PASSED