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<stdio.h> #include<string.h> #include<immintrin.h> #include<emmintrin.h> #pragma GCC optimize("O2") #pragma GCC target("avx2") #pragma GCC optimize("-fno-strict-aliasing") #define U unsigned #define LL long long #define UL U LL #define mod 1000000007u #define dmod 2000000016u #define ymm __m256i ...
C++
4f7ff35e722fc447cad3da41d5b59cb7
5f69a158c6d51a895cce39a990b088b8
3,200
PASSED
#include<stdio.h> #include<string.h> #include<immintrin.h> #include<emmintrin.h> #pragma GCC optimize("O2") #pragma GCC target("avx2") #pragma GCC optimize("-fno-strict-aliasing") #define U unsigned #define LL long long #define UL U LL #define mod 1000000007u #define dmod 2000000016u #define ymm __m256i ...
C++
4f7ff35e722fc447cad3da41d5b59cb7
290849aaa82d16f7db592754d5cee348
3,200
PASSED
#include<stdio.h> #include<string.h> #include<immintrin.h> #include<emmintrin.h> #pragma GCC optimize("O2") #pragma GCC target("avx2") #pragma GCC optimize("-fno-strict-aliasing") #define U unsigned #define LL long long #define UL U LL #define mod 1000000007u #define dmod 2000000016u #define ymm __m256i ...
C++
4f7ff35e722fc447cad3da41d5b59cb7
b16282b514e65bae86b71ac4bc29beed
3,200
PASSED
#include<stdio.h> #include<string.h> #include<immintrin.h> #include<emmintrin.h> #pragma GCC optimize("O2") #pragma GCC target("avx2") #pragma GCC optimize("-fno-strict-aliasing") #define U unsigned #define LL long long #define UL U LL #define mod 1000000007u #define dmod 2000000016u #define ymm __m256i ...
C++
4f7ff35e722fc447cad3da41d5b59cb7
92ebd98f2f1afca130eff84bd75e52ed
3,200
PASSED
#include<stdio.h> #include<string.h> #include<immintrin.h> #include<emmintrin.h> #pragma GCC optimize("O2") #pragma GCC target("avx2") #pragma GCC optimize("-fno-strict-aliasing") #define U unsigned #define LL long long #define UL U LL #define mod 1000000007u #define dmod 2000000016u #define ymm __m256i ...
C++
4f7ff35e722fc447cad3da41d5b59cb7
7627365fa7afc3a85697e16b4e8a1ec7
3,200
PASSED
#include<stdio.h> #include<string.h> #include<immintrin.h> #include<emmintrin.h> #pragma GCC optimize("O2") #pragma GCC target("avx2") #pragma GCC optimize("-fno-strict-aliasing") #define U unsigned #define LL long long #define UL U LL #define mod 1000000007u #define dmod 2000000016u #define ymm __m256i ...
C++
4f7ff35e722fc447cad3da41d5b59cb7
8102ba66da013a8b885b60726d0a470f
3,200
PASSED
#include<stdio.h> #include<string.h> #include<immintrin.h> #include<emmintrin.h> #pragma GCC optimize("O2") #pragma GCC target("avx2") #pragma GCC optimize("-fno-strict-aliasing") #define U unsigned #define LL long long #define UL U LL #define mod 1000000007u #define dmod 2000000016u #define ymm __m256i ...
C++
4f7ff35e722fc447cad3da41d5b59cb7
63a36a225c965aa1e8fa498ba6ba0aab
3,200
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = long double; // or double, if TL is tight using str = string; // yay python! // pairs using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; #define mp make_pair #define f first #define s second #define...
C++
4f7ff35e722fc447cad3da41d5b59cb7
57bf83445907c1d49757034f21e048b3
3,200
PASSED
#include <bits/stdc++.h> // tiom4eg's precompiler options // POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS POGGERS // Flags #define MAXMIN #define ENDL //#define AVX2 //#define PBDS // IO settings #define fastIO ios_base::sync_with_stdio(false); cin.tie(0) // Quick types #define ll long long #define ld lo...
C++
4f7ff35e722fc447cad3da41d5b59cb7
555dced64f93756953753c9fc6f702a0
3,200
PASSED
#include<stdio.h> int main() { int b,c[1000],g=0,e=0; int a[200][100]; int d[200][100]; scanf("%d",&b); int f=b; while(b--) { scanf("%d",&c[e++]); for(int i=0;i<=c[e-1]-1;i++) { scanf("%d",&a[b+1][i]); } } while(f--) { if(c[g]>1) { for(int t=0;t<c[g];t=t+1) { ...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
7c77d6c61168d925da923c1b6937c2f2
900
PASSED
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--){ int n; cin >> n; vector<int>v(n); for(int i=0;i<n;i++)cin >> v[i]; vector<int>store ; for(int i=1;i<=n;i++)store.push_back(i); if(n==1)cout << -1 << endl; else{ ...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
e679cff8dbf21fa708c18b9718d308bd
900
PASSED
#include <bits/stdc++.h> #define kareem ios_base::sync_with_stdio(false);cin.tie(0); #define BIG 9223372036854775807 #define mod 1000000007 typedef long long ll; using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tr...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
f4ae7afb03b64b3b02b16209161e93a6
900
PASSED
/** author: kicker * created: 07-09-2022 10:47 **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; #define line << endl #define sep << " " << #define sp << " " #define...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
a5eb94297afb4eadf6392e58f502aff9
900
PASSED
/** author: kicker * created: 07-09-2022 10:47 **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; #define line << endl #define sep << " " << #define sp << " " #define...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
15c4984c683b4f875a3706e19bf83f8c
900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int #define str string #define pb(x) push_back(x) #define ppb(x) pop_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long int> #define vc vector<char> #define all(v) v.begin(), v.end() #define vsz v.size() #d...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
e60e9b65fc39ce42f6c307b709827a4a
900
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; int arr[n]; set<int> s; for(int i=0;i<n;i++){ cin>>arr[i]; s.insert(arr[i]); } if(n==1){ cout<<-1<<"\n"; continue; ...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
109b8b29ff86200e6c83b7263a50b579
900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; void f() { int n; cin >> n; vector<int> arr(n + 1), res(n + 1, -1); vector<int> mp(1001, -1); for(int i {1}; i <= n; i++) { cin >> arr[i]; } if(n == 1) { ...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
dbcfa644b69914a81bde9740035acd77
900
PASSED
#include <iostream> #include <stdlib.h> #include <stdbool.h> #define report(x) cout << x << endl; #define endl "\n" using namespace std; int cmp( const void *a, const void *b ) { return *(int *)a - *(int *)b; } bool solve() { int n; cin >> n; int listA[ 1000 ]; int listB[ 1000 ]; ...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
ed27c41ce608f435eb62ebb76ac3b80a
900
PASSED
#include <iostream> #include <stdlib.h> #include <stdbool.h> #define report(x) cout << x << endl; using namespace std; int cmp( const void *a, const void *b ) { return *(int *)a - *(int *)b; } bool solve() { int n; cin >> n; int listA[ 1000 ]; int listB[ 1000 ]; bool taken[ 1000 ] ...
C++
1bf5b7d3dff2d9d917563e5c8aa32675
f2562634ae8e46ef652247cf6ad9730e
900
PASSED
#include<iostream> using namespace std; const int N = 3e5 + 10, M = 6e5 + 10; int n; int he[N], ne[M], v[M], idx; int dp[N], siz[N]; void add(int a, int b) { v[idx] = b; ne[idx] = he[a]; he[a] = idx++; } void dfs(int now, int pre) { siz[now] = 1; int a = -1, b = -1; for (int i = he[now]; ~i; i = ne[i]) { ...
C++
11452ff3750578d8b2ac5b76ba2749fd
98ee5c01a25cb615044910b4b0886164
1,600
PASSED
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define print(v) for(auto it : v) cout << it << ' '; cout << endl; #define valid(i, j, n, m) (i >= 0 && i < n && j >= 0 && j < m) #define all(x) (x)...
C++
11452ff3750578d8b2ac5b76ba2749fd
016e9aef12eb487b4ed96d38e2d70eac
1,600
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <cmath> #include <cstring> #include <queue> #include <map> #include <unordered_map> #include <set> #define ll long long #define ull unsigned long long #define ci const int #define PLL pair<ll, ll> #define PII pair<int, int> #define PS...
C++
11452ff3750578d8b2ac5b76ba2749fd
b6a49c1f23d39b448a8ceb6251ea37c4
1,600
PASSED
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int l[300005],r[300005]; int lk[300005][7],lkl[300005]; int used[300005]; int dp[300005]; int q[300005],h,_l; int n; int cal(int p) { if(p==0) return 0; if(dp[p]) return dp[p]; dp[p]=cal(l[p])+cal(r[p])+1; return dp[p]; } int fl(int...
C++
11452ff3750578d8b2ac5b76ba2749fd
5eedb7d1a1a7aa85718fcf79de24cc08
1,600
PASSED
#include<bits/stdc++.h> #define rg register #define R rg int #define go(i,a,b) for(R i=a;i<=b;i++) #define og(i,a,b) for(R i=a;i>=b;i--) #define ok osss using namespace std; inline int rd(){ R x=0,f=1;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();} while(c>='0'&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=...
C++
11452ff3750578d8b2ac5b76ba2749fd
3dbcec24b4628edbb777fb513b528a8b
1,600
PASSED
#include<iostream> #include<cstring> #include<cmath> #include<cstdio> #include<string> #include<cstdlib> #include<ctime> #include<algorithm> #include<iomanip> #include<bitset> #include<map> #include<queue> #include<bitset> #include<deque> #include<vector> #define _f(i,a,b) for(register int i=a;i<=b;++i) #define f_(i,...
C++
11452ff3750578d8b2ac5b76ba2749fd
463ac4a26be6338475de66c383f01956
1,600
PASSED
#include <cstdio> #include <cstring> #include <cctype> #include <iostream> #include <sstream> #include <stack> #include <cmath> #include <algorithm> #include <map> #include <queue> #include <list> #include <set> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; /* 3 3...
C++
11452ff3750578d8b2ac5b76ba2749fd
cc7da8127992be7faeb08ad632f67d5e
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define endl '\n' typedef long long ll; const int N=3e5+5; vector<int>to[N]; int son[N]; int dp[N][2]; inline int dfs(int x,int fa){ son[x]=0; dp[x][1]=dp[x][0]=0; int res=0; for(auto y:to[x]){ if(y==fa)continue; son[x]+=dfs(y,x); res+=dp[y][0]; } for(auto y:to[x...
C++
11452ff3750578d8b2ac5b76ba2749fd
62e1d62dc37818a5bda971b4d3f50baa
1,600
PASSED
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int l[300005],r[300005]; int lk[300005][7],lkl[300005]; int used[300005]; int dp[300005]; int q[300005],h,_l; int n; int cal(int p) { if(p==0) return 0; if(dp[p]) return dp[p]; dp[p]=cal(l[p])+cal(r[p])+1; return dp[p]; } int fl(int...
C++
11452ff3750578d8b2ac5b76ba2749fd
da2be925c781f54614026a59546976e4
1,600
PASSED
#include<cstdio> using namespace std; struct node{ int to[3],sum; }; int t,n,tool1,tool2,save[300010],num[300010]; node a[300010]; void putin(int x,int y){ bool flag=true; for(int i=0;i<a[x].sum;i++){ if(a[x].to[i]==y) flag=false; } if(flag){a[x].to[a[x].sum]=y;a[x].sum++;} return; } void dfs(int now,int father...
C++
11452ff3750578d8b2ac5b76ba2749fd
6fcb61aeaec1ce422cdca421e6326227
1,600
PASSED
#include <bits/stdc++.h> using namespace std; string eliminate(int maxl,string &str, int indx){ string c=""; for (int i = 0; i <maxl; ++i) { str.erase(str.find('a'+indx),1); c+=('a'+indx); if(str.find('a'+indx)==-1)break; } return c; } string solve(string a,string ...
C++
1d46a356c5515f8894cbb83e438cc544
babcd09694664a5e2a6560ce14f6e0c5
800
PASSED
#include <bits/stdc++.h> #define endl '\n' using namespace std; typedef long long ll; void solve(){ int n,m,k; cin >> n >> m >> k; string a,b; cin >> a >> b; vector<char> c; sort(begin(a),begin(a)+n); sort(begin(b),begin(b)+m); map<int,int> temp; int oka =0,okb=0; int usa...
C++
1d46a356c5515f8894cbb83e438cc544
2a8f81b2c6fa2691f1eadf54bcbb08cf
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t,ll; cin >> t; ll=t; while(t--){ int x,y,z; cin >> x >> y >> z; string str1,str2; cin >> str1 >> str2; if(ll==100){ } sort(str1.begin(), str1.end()); ...
C++
1d46a356c5515f8894cbb83e438cc544
7afffa9e9584d06394ae1723598474e4
800
PASSED
// Newbie Contestant #include <bits/stdc++.h> using namespace std ; typedef long long ll ; void es (){ int n , m , k; cin >> n >> m >> k; string w , ww , c; cin >> w >> ww ; sort (w.begin() , w.end()) ; sort (ww.begin() , ww.end()) ; bool rr ; int a = 0, b = 0; while (w....
C++
1d46a356c5515f8894cbb83e438cc544
86ea5243870c3d7695f595c8650fe3d4
800
PASSED
#include <bits/stdc++.h> #include <iostream> using namespace std; using ll= long long; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; void solve() { int n,m,k; string s, b; cin >> n >> m >> k; cin >> s; cin >> b; string ans=""; int countn=0; int countm...
C++
1d46a356c5515f8894cbb83e438cc544
1f987736aa738c2bfb0d65a0d0639b69
800
PASSED
#include <bits/stdc++.h> using namespace std; void recursiveSolution(string_view s1, int p1, string_view s2, int p2, int m, int n, int k) { if(p1 == s1.size() || p2 == s2.size()) { cout << "\n"; return; } if(m == k) { cout << s2[p2]; m = 0; n = 1; recursiveSolution(s1,p1,s2,p2+1,m,n,k); ...
C++
1d46a356c5515f8894cbb83e438cc544
69d79d22e20703d8c3756b28407f944b
800
PASSED
#include <bits/stdc++.h> using namespace std; void recursiveSolution(string_view s1, int p1, string_view s2, int p2, int m, int n, int k) { if(p1 == s1.size() || p2 == s2.size()) { cout << "\n"; return; } if(m == k) { cout << s2[p2]; m = 0; n = 1; recursiveSolution(s1,p1,s2,p2+1,m,n,k); ...
C++
1d46a356c5515f8894cbb83e438cc544
389cf059500fa7c3c940e3108fa4fe64
800
PASSED
#include <bits/stdc++.h> using namespace std; void dfs(string_view s1, int p1, string_view s2, int p2, int m, int n, int k) { if(p1 == s1.size() || p2 == s2.size()) { cout << "\n"; return; } if(m == k) { cout << s2[p2]; m = 0; n = 1; dfs(s1,p1,s2,p2+1,m,n,k); return; } if(n == k...
C++
1d46a356c5515f8894cbb83e438cc544
24defd7c526a27c1fb06dcd74bd218ea
800
PASSED
#include <bits/stdc++.h> using namespace std; void dfs(string_view s1, int p1, string_view s2, int p2, int m, int n, int k) { if(p1 == s1.size() || p2 == s2.size()) { cout << "\n"; return; } if(m == k) { cout << s2[p2]; m = 0; n = 1; dfs(s1,p1,s2,p2+1,m,n,k); return; } if(n == k...
C++
1d46a356c5515f8894cbb83e438cc544
5ce708b97ba4a4aab03e8785de8580e3
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; for(int i=0;i<t;i++){ int x,y,k; cin>>x>>y>>k; string a,b; char c[x+y]; cin>>a>>b; sort(a.begin(),a.end()); sort(b.begin(),b.end()); int p=0,j=0,q=0; while(a.size()!=0&&b.size()!=0){ ...
C++
1d46a356c5515f8894cbb83e438cc544
ae3f5f52ae8ea690496029bb30dd1d5c
800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int void solve(){ ll n, m; cin >> n >> m; vector<string> a (n); for (ll i = 0; i < n; i++) { cin >> a[i]; } pair<ll, ll> lu = {INT_MAX, INT_MAX}, ln = {-1, INT_MAX}, ru = {INT_MAX, -1}, rn = {-1...
C++
cffcbdd58cc02f96d70d0819fef5131d
7f724f72ed877e5cd9731d8a2fb3adf0
1,900
PASSED
#include<bits/stdc++.h> using namespace std; template <class T> istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e;} return in;} template <class T> istream& operator >> (istream& in, pair<T, T> &v){ in >> v.first >> v.second; return in;} // #define int long long #define pb push_bac...
C++
cffcbdd58cc02f96d70d0819fef5131d
1c22c1017d1e13d4f1f644e9e8a9c23f
1,900
PASSED
#include<bits/stdc++.h> #define debug(x) cerr << __LINE__ << " : "<<#x<<" is "<<x<<endl #define fi first #define se second #define pb push_back #define mp make_pair #define DBG 0 #define SZ(x) ((int)(x.size())) #define lc(x) (x<<1) #define rc(x) ((x << 1) | 1) const int N = 2e5 + 5; typedef long long ll; ty...
C++
cffcbdd58cc02f96d70d0819fef5131d
910b30bb86bc766eb283686e63f87fa4
1,900
PASSED
#include<bits/stdc++.h> #define debug(x) cerr << __LINE__ << " : "<<#x<<" is "<<x<<endl #define fi first #define se second #define pb push_back #define mp make_pair #define DBG 0 #define SZ(x) ((int)(x.size())) #define lc(x) (x<<1) #define rc(x) ((x << 1) | 1) const int N = 2e5 + 5; typedef long long ll; ty...
C++
cffcbdd58cc02f96d70d0819fef5131d
a8f13048f11b071890eba7ad488d5085
1,900
PASSED
#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 faster() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); #define mp make_pair #define pb push_back #define fi first #define se second #define ...
C++
cffcbdd58cc02f96d70d0819fef5131d
0f59e6f41dec5473982736e21a2afff9
1,900
PASSED
#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 faster() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); #define mp make_pair #define pb push_back #define fi first #define se second #define ...
C++
cffcbdd58cc02f96d70d0819fef5131d
ce2f5e8da89a67afa60b1febad11dbcf
1,900
PASSED
#include <bits/stdc++.h> using namespace std; bool cmp(pair<int, int> a, pair<int, int> b) { return a.first + a.second < b.first + b.second; } bool cmp2(pair<int, int> a, pair<int, int> b) { return -a.first + a.second < -b.first + b.second; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr...
C++
cffcbdd58cc02f96d70d0819fef5131d
d0707d69a7afd7e495cd1418b34455f4
1,900
PASSED
#include<iostream> #include<cstdio> int mp[1021][1021],n,m,t,dpl[4][1021][1021]; char a1[1001]; using namespace std; int main() { scanf("%d",&t); for(int j=1;j<=t;j++) { scanf("%d %d",&n,&m); for(int i=1;i<=n;i++) { scanf("%s",a1+1); //if(j==5130) //cout<<(a1+1); for(int j=1;j<=m;j++) { mp[i][j]=0; ...
C++
cffcbdd58cc02f96d70d0819fef5131d
fb53b119f1e36af8d5ed80e21419f5fb
1,900
PASSED
#pragma GCC optimize(2) #include<bits/stdc++.h> #define int long long #define endl "\n" using namespace std; typedef pair<int,int> PII; const int N = 1005,mod = 998244353,INF = 0x3f3f3f3f; int n,m,k,a[N]; void NO() {cout<<"NO"<<endl;} void YES() {cout<<"YES"<<endl;} vector<PII> v,fin,tmp; set<PII> pt; cha...
C++
cffcbdd58cc02f96d70d0819fef5131d
7ef959edaedf7d4c0318ab39f1da0079
1,900
PASSED
#include<bits/stdc++.h> #define pw(a) (1LL<<(a)) #define L ((p)<<1) #define R ((p)<<1|1) #define endl '\n' using namespace std; typedef long long LL; typedef double DD; typedef pair<int,int> PR; const int inf=0x3f3f3f3f; const int mod=998244353; const int N=1000+10; int n,m,t; char s[N][N]; #u...
C++
cffcbdd58cc02f96d70d0819fef5131d
8955292cb2e73872114d20ff69f2cf7f
1,900
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <map> using namespace std; typedef long long ll; //#define int long long const int maxn = 2003; const int mod = 998244353; const int INF = 0x3fffffff; int T, m, fa[maxn], a[maxn]; inline int read() { int x =...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
ac523bf41dd43dd1f8399cd8d9da5cc7
2,500
PASSED
#include<iostream> #include<cmath> #include<cstring> #include<cstdio> #include<algorithm> #include<stack> #include<queue> #include<vector> #define lmizukimiuna return 0 #define LRH MizukiMiuna #define _ read() using namespace std; namespace LRH { template <typename Mizuki>inline void in(Mizuki &x) { ...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
dc5192b8fa26c744df4ef943b0e82844
2,500
PASSED
#include<iostream> #include<cstring> #include<cmath> #include<cstdio> #include<string> #include<cstdlib> #include<ctime> #include<algorithm> #include<iomanip> #include<bitset> #include<map> #include<queue> #include<bitset> #include<deque> #include<vector> #define _f(i,a,b) for(register int i=a;i<=b;++i) #define f_(i,...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
00016d5bde42a2922dcc6b3753e47f01
2,500
PASSED
#include<cstdio> #include<cstring> #include<string> #include<iostream> #include<algorithm> #define int long long #define WR WinterRain using namespace std; const int WR=5010,mod=1e9+7; int t; int n,ans,a[WR]; int bit[WR/50][WR]; bool flag[WR/50]; int read(){ int s=0,w=1; char ch=getchar(); while(ch>'9'||ch<...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
0766229b5fa0e1e610447a56db85592f
2,500
PASSED
#include<cassert> #include<cctype> #include<cerrno> #include<cfloat> #include<ciso646> #include<climits> #include<clocale> #include<cmath> #include<csetjmp> #include<csignal> #include<cstdarg> #include<cstddef> #include<cstdio> #include<cstdlib> #include<cstring> #include<ctime> #include<algorithm> #in...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
eee9628b541edbf1f9c6ed61a5c5f8e0
2,500
PASSED
//We'll be counting stars. #include<bits/stdc++.h> using namespace std; #define For(i,j,k) for(int i=(j),i##_=(k);i<=i##_;i++) #define Rof(i,j,k) for(int i=(j),i##_=(k);i>=i##_;i--) #define N 2022 int n,a[N],ans,f[N],cnt,mx,qwq; int pre[N],suf[N],pos[N],tot; inline int low(int x){ return x&(-x); } inline int g...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
22a47f3ce522f52d39dbf3722d4075a6
2,500
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <algorithm> #define il inline #define rg register int #define ll long long using namespace std; il ll read() { ll x = 0; char c; bool f = false; while (!isdigit(c = getchar())); do { x = (x << 1) + (x << 3) + (c ^ 48); }while (isdigit (c = getcha...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
47daa4fd9212da7b90cc0bf79a364086
2,500
PASSED
#include<iostream> #include<cstdio> using namespace std; const int MAX = 2004; int T; int n,a[MAX],maxbit,res,fa[MAX]; int w[MAX],cnt; inline int lowbit(int x){ return x&(-x); } inline int find(int x){ return fa[x]==x ? x : fa[x]=find(fa[x]); } inline void merge(int x,int y){ if(x<y) swap(x,y); int fx = find(x); i...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
9bd1911f9eb2f86f37872d8239474dd5
2,500
PASSED
#include <cstdio> #include <cctype> #include <cstring> using namespace std; inline int max(int &a, int b){return a > b ? a : b;} int _; char __; inline int read() { _ = 0; while(!isdigit(__ = getchar())); do{ _ = (_ << 1) + (_ << 3) + (__ ^ 48); }while(isdigit(__ = getchar())); return _; } int top = 0, stk[20]...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
bb405f8b5f8908915af88451af3cfc09
2,500
PASSED
#include <cstdio> #include <vector> using namespace std; const int MAX = 2040,inf = 1005,maxn = ( 1 << 30 ); #define lowbit(now) ( now & ~( now - 1 ) ) int T = 0,n = 0,a[MAX] = { 0 },father[MAX] = { 0 },ans = 0; int get_father ( int now ) { if ( father[now] != now ) father[now] = get_father(father[now]); return...
C++
4d0b2fe22b4870b15d63e9fb778bcb7b
c8d0abd9312c8855cfd94ee8de3e64a5
2,500
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int tt; cin >> tt; while (tt--){ int n; cin >> n; vector <int> tree(n - 1), cnt(n + 1), v, a; priority_queue <int> pq; for (int i = 0; i < n - 1; i++) { cin >> tree[i]; cnt[tree[i]]++; } for (int i...
C++
3ca37d1209b487a383b56ba4b7c1e872
88020039c196e40bc59cbe5efc04acde
1,600
PASSED
#include<iostream> #include<algorithm> #include<iomanip> #include<math.h> #include<string.h> #include<queue> #include<vector> #define pii pair<pair<int,int>,int> #include<map> #include<set> #include<string> #include<stack> #include<deque> #define endl '\n' #define ll long long #pragma GCC optimize(2) #...
C++
3ca37d1209b487a383b56ba4b7c1e872
8b380762709ed67c4dba03cbd4667007
1,600
PASSED
#include<iostream> #include<algorithm> #include<iomanip> #include<math.h> #include<string.h> #include<queue> #include<vector> #define pii pair<pair<int,int>,int> #include<map> #include<set> #include<string> #include<stack> #include<deque> #define endl '\n' #define ll long long #pragma GCC optimize(2) #...
C++
3ca37d1209b487a383b56ba4b7c1e872
aa51305b429884af36c48dff4d1c0e20
1,600
PASSED
#include<iostream> #include<algorithm> #include<iomanip> #include<math.h> #include<string.h> #include<queue> #include<vector> #define pii pair<pair<int,int>,int> #include<map> #include<set> #include<string> #include<stack> #include<deque> #define endl '\n' #define ll long long #pragma GCC optimize(2) #...
C++
3ca37d1209b487a383b56ba4b7c1e872
2a3f1386007ab34787b3ea829cede0ca
1,600
PASSED
#include <bits/stdc++.h> #define ll long long #define pair pair<ll, ll> #define f first #define s second using namespace std; ll a,b[2000001],t,n,i,j,m,l,r,k; ll f(ll x) { ll ans=0; for (ll i1=0;i1<k;i1++) { ans+=max(0ll,b[i1]-x); } return ans; } int main(){ //ios_base...
C++
3ca37d1209b487a383b56ba4b7c1e872
aa978233aff872f594ac91382567bfe2
1,600
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 3e5 + 10; int n; int a[N], ans; int main() { int t; cin >> t; while (t -- ) { ans = 1; scanf("%d", &n); for (int i = 2; i <= n; i ++ ) { int x; scanf("%d",&x); a[x] ++ ; } sort(a+1, a+1+n,greater<int>())...
C++
3ca37d1209b487a383b56ba4b7c1e872
48dd65298403562d6ffe1c2fdf6ccaed
1,600
PASSED
#include <iostream> #include <vector> int n; using namespace std; void pop_td(vector<int>& ls) { while (!ls.empty() && ls.back() < 1) ls.pop_back(); } void AncestryIn(vector<int>& ls, int *res) { int f = ls.size(); for(int x = 0; x < f; x++) { ls[x] = ls[x] - (f - x); // Injection ...
C++
3ca37d1209b487a383b56ba4b7c1e872
c8432b5ac4c3091f650725e6b989096d
1,600
PASSED
// TreeInfection.cpp : Este archivo contiene la función "main". La ejecución del programa comienza y termina ahí. // #include <iostream> #include <algorithm> #include <vector> #include <queue> int n; using namespace std; void print(vector<int> ls) { for (int i = 0; i < ls.size(); i++) { cout << ls[i] << " "; } ...
C++
3ca37d1209b487a383b56ba4b7c1e872
6e86936c5855409df8408e340b8ba08e
1,600
PASSED
// TreeInfection.cpp : Este archivo contiene la función "main". La ejecución del programa comienza y termina ahí. // #include <iostream> #include <algorithm> #include <vector> #include <queue> int n; using namespace std; void print(vector<int> ls) { for (int i = 0; i < ls.size(); i++) { cout << ls[i] << " "; } ...
C++
3ca37d1209b487a383b56ba4b7c1e872
26c91745d66535d73775822170549f74
1,600
PASSED
// TreeInfection.cpp : Este archivo contiene la función "main". La ejecución del programa comienza y termina ahí. // #include <iostream> #include <algorithm> #include <vector> #include <queue> int n; using namespace std; void print(vector<int> ls) { for (int i = 0; i < ls.size(); i++) { cout << ls[i] << " "; } ...
C++
3ca37d1209b487a383b56ba4b7c1e872
64a44dd1821168da8516e81766bfd5b4
1,600
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t=1; ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >>t; while(t--) { int n; int a[100000]{}; cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } ...
C++
b4fcfedc8e76afd0043b026eb3132582
dcfbe6fa7898c450b4ac130f3d4ea8cb
900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t=1; ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >>t; while(t--) { int n; int a[100000]{}; cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } ...
C++
b4fcfedc8e76afd0043b026eb3132582
a537081e830e1bdf48b2866ea0aadb3e
900
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int n,t,cnt,A; signed main() { ios::sync_with_stdio(0); cin.tie(0); cin >> t; while(t--){ cin >> n; A=1; map<int,int> a; for(int i=0;i<n;i++){ ...
C++
b4fcfedc8e76afd0043b026eb3132582
a79bd27b384f57cfa92b69290f4c7865
900
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int n,t,cnt,A; signed main() { ios::sync_with_stdio(0); cin.tie(0); cin >> t; while(t--){ cin >> n; A=1; map<int,int> a; for(int i=0;i<n;i++){ ...
C++
b4fcfedc8e76afd0043b026eb3132582
394d7800d97cea7e871f9c2646b81a12
900
PASSED
/* author: salmo status: Done */ #include<iostream> #include<cmath> #include<algorithm> #include<map> using namespace std; #define i32 int32_t #define ui32 uint32_t ui32 find_mininal_num_opertions(ui32 const n, ui32 max_Frequency); ui32 find_Max_Frequency_in1D_Arr(i32 a[], ui32 const n); ...
C++
b4fcfedc8e76afd0043b026eb3132582
977d23df48c33c7c1142c076398a9503
900
PASSED
/* author: salmo */ // NOT done yet #include<iostream> #include<cmath> #include<algorithm> #include<map> using namespace std; #define i32 int32_t #define ui32 uint32_t ui32 find_mininal_num_opertions(ui32 const n, ui32 max_Frequency); ui32 find_Max_Frequency_in1D_Arr(i32 a[], ui32 const n); ...
C++
b4fcfedc8e76afd0043b026eb3132582
72c753b3236316f9b22e406465c30050
900
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(){ int n; cin>>n; ll a[n]; for(int i=0;i<n;i++) cin>>a[i]; sort(a,a+n); ll k=1; ll m=1; for(int i=0;i<n-1;i++){ if(a[i]==a[i+1]) m++; else{ if(...
C++
b4fcfedc8e76afd0043b026eb3132582
6d7494e4386be8f2e47f64b296153979
900
PASSED
#include <bits/stdc++.h> using namespace std; int n,u,x; main() { for(cin>>n;cin>>n;) { map<int,int>p; for(int i=1;i<=n;i++) cin>>x,u=max(u,++p[x]); cout<<n-u+__lg((n-1)/u)+(n!=u)<<'\n',u=0; } }
C++
b4fcfedc8e76afd0043b026eb3132582
1aa075fcc2c8f17eee9351bc2a0f7561
900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; while(n) { n -= 1; int o; cin >> o; int m_x =0; unordered_map<int, int> numbers; for(int i =0; i <o;++i) { int val; cin>>val; ++numbers[val]; m_x = max(m_x, number...
C++
b4fcfedc8e76afd0043b026eb3132582
f8a501a7d2f6d77e0cdbfbfd87f2aa13
900
PASSED
#include<bits/stdc++.h> using namespace std; int T,n; const int N = 1e5+10; int a[N],m; int main() { cin >> T; while(T--) { int m=1,ans=0; cin >> n; for(int i = 0; i < n; i++) { cin >> a[i]; } sort(a,a+n); int d = 1; for(int i = 0; i < n-1; i++) { if(a[i] == a[i+1]) d++; ...
C++
b4fcfedc8e76afd0043b026eb3132582
80f4844df9f1771e0f1e360c41dd28ca
900
PASSED
#include <iostream> #include <vector> using namespace std; const int s=1e6+12; long long A[s]; int main() { int t=0; long long a,b,c,d; cin>>t; for(int i=0;i<t;i++) { cin>>A[i]; } for(int i=0;i<t;i++) { if(A[i]%2==1) { a=(A[i]-1)/2; ...
C++
f9f803c6850da1838d62a0cf85bb13f2
bf32ea0e73f2cf6743e6ad7d9681853d
800
PASSED
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define ll long long #define pb push_back #define lop(i,n) for(int i=0;i<n;i++) #define lop1(i,n) for(int i=1;i<=n;i++) #define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); #define mem(b,a) memset(a,b,sizeof(a)) #define ...
C++
f9f803c6850da1838d62a0cf85bb13f2
7335ff9f1bd5808f7f121958c3020fcd
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; cout<<1<<" "<<n-3<<" "<<1<<" "<<1<<endl; } return 0; }
C++
f9f803c6850da1838d62a0cf85bb13f2
f4cafef21c6a23dc32ad2b9fc66d52f5
800
PASSED
#include <iostream> using namespace std; typedef long long ll; int main() { ll t,n; cin>>t; while(t--) { cin>>n; cout<<"1 "<<n-3<<" 1"<<" 1"<<endl; } return 0; }
C++
f9f803c6850da1838d62a0cf85bb13f2
391c9da951d6972ebe2edce705fe8d79
800
PASSED
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int n, b, f[105], num[105], cnt = 0; int i, j, ans = 0, a1 = 0, a2 = 0; int main() { scanf("%d", &n); for (i = 1; i <= n; i++) { scanf_s("%d", &b); printf("%d 1 1 1\n", b - 3); } return 0; }
C++
f9f803c6850da1838d62a0cf85bb13f2
1bfb6f54f60d28b5100331207f549ea9
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; scanf("%d",&t); while(t--){ int n; scanf("%d",&n); printf("%d %d %d %d\n",1,n-3,1,1); } return 0; }
C++
f9f803c6850da1838d62a0cf85bb13f2
8fc625532f6225f697401a0670540a1c
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int T; scanf("%d", &T); while (T--) { int n; scanf("%d", &n); printf("%d 1 1 1\n", n - 3); } return 0; }
C++
f9f803c6850da1838d62a0cf85bb13f2
dddad57fe7edadc91c30b143313e78fd
800
PASSED
// // Created by A on 2022/4/15. // # include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); ll t, n; cin >> t; while(t--){ cin >> n; cout << n-3 << " " << 1 << " " << 1 << " " << 1 << ...
C++
f9f803c6850da1838d62a0cf85bb13f2
4efb77959297a541b2f45cdb1111966a
800
PASSED
#include <iostream> #include <string.h> using namespace std; int main(int argc, char** argv) { int t,n; cin >> t; int i,j; for(i=0;i<t;i++) { cin >> n; cout << n-3 << " " << 1 << " " << 1 << " " << 1 <<" " <<endl; } return 0; }
C++
f9f803c6850da1838d62a0cf85bb13f2
bd0b23a8f96df241ef5da7fc3cef732f
800
PASSED
#include<iostream> using namespace std; int T,n; int main(){ cin>>T; while(T--){ cin>>n; switch(n%4){ case 0 : for (int i = 0;i < 4;++i) cout<<n/4<<' '; break; case 1 : cout<<n/4<<' '<<n/2<<' '<<n/4<<' '<<1; break; case 2 : cout<<n/2-2<<' '<<n/2<<" 1 1"; br...
C++
f9f803c6850da1838d62a0cf85bb13f2
fae999a3f55c223379872fc57fa9e6af
800
PASSED
#include<bits/stdc++.h> #include<numeric> using namespace std; // #define endl "\n" #define ll long long #define ff first #define ss second #define vc vector<ll> #define vcc vector<vector<ll>> #define vp vector<pair<ll,ll>> #define pb(a) push_back(a) #define mp(a,b) make_pair(a,b) #define ist(a) insert(a) ...
C++
442015fe13f7f75876d7163f438960d8
b6bb0baa43e74c37e827f9fa0e132dce
2,000
PASSED
#include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<map> #include<queue> #include<iostream> using namespace std; const int maxn=2e5+10; long long query(long long a,long long b){ long long ans; cout<<"? "<<a<<" "<<b<<endl; cin>>ans; return ans; } int main(){ ...
C++
442015fe13f7f75876d7163f438960d8
6e0bdbe9915608563079330e12bdd3ce
2,000
PASSED
#include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<map> #include<queue> #include<iostream> using namespace std; const int maxn=2e5+10; long long query(long long a,long long b){ long long ans; cout<<"? "<<a<<" "<<b<<endl; cin>>ans; return ans; } int main(){ ...
C++
442015fe13f7f75876d7163f438960d8
a2b8f680ac79f767d1060aa50ae2a768
2,000
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int mod=1e9+7; ll mod_pow(ll a,ll n) { ll res=1; while(n>0){ if(n&1){ res=res*a; } a=a*a; n>>=1; } return res; } void solve() { ll res=0; ll a; for(int i=1;i<=30;i++){ cout<<"? "<<(1<<i-1)-res<<" "...
C++
442015fe13f7f75876d7163f438960d8
c01ea41b91d223414087494d93b38943
2,000
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int mod=1e9+7; ll mod_pow(ll a,ll n) { ll res=1; while(n>0){ if(n&1){ res=res*a; } a=a*a; n>>=1; } return res; } void solve() { ll res=0; ll a; for(int i=1;i<=30;i++){ cout<<"? "<<(1<<(i-1))-res<<"...
C++
442015fe13f7f75876d7163f438960d8
4f925264c925fd88b842f68d06ff406e
2,000
PASSED
#include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<string.h> #include<utility> #include<vector> #include<cstring> #include<queue> #include<cmath> #include<math.h> #include<stack> #include<map> #include<set> #include<cstdlib> #include<bitset> using namespace std; #define FOR(i,j,k) f...
C++
442015fe13f7f75876d7163f438960d8
b1711d5e547fef9fca47c5d3f69dd197
2,000
PASSED
#include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<string.h> #include<utility> #include<vector> #include<cstring> #include<queue> #include<cmath> #include<math.h> #include<stack> #include<map> #include<set> #include<cstdlib> #include<bitset> using namespace std; #define FOR(i,j,k) f...
C++
442015fe13f7f75876d7163f438960d8
32a5346b8bd7aadf205b515228c7ff85
2,000
PASSED
#include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<string.h> #include<utility> #include<vector> #include<cstring> #include<queue> #include<cmath> #include<math.h> #include<stack> #include<map> #include<set> #include<cstdlib> #include<bitset> using namespace std; #define FOR(i,j,k) f...
C++
442015fe13f7f75876d7163f438960d8
9228010e96d8550941b38e3aab83ae4e
2,000
PASSED
#include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<string.h> #include<utility> #include<vector> #include<cstring> #include<queue> #include<cmath> #include<math.h> #include<stack> #include<map> #include<set> #include<cstdlib> #include<bitset> using namespace std; #define FOR(i,j,k) f...
C++
442015fe13f7f75876d7163f438960d8
12969cb030c9a4b56b2658be0de33ee4
2,000
PASSED
#include <bits/stdc++.h> #define int long long #define SUNSHINE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);srand(time(0)) ; using namespace std; int factmod (int n, int p) { int res = 1; while (n > 1) { res = (res * ((n / p) % 2 ? p - 1 : 1)) % p; for (int i = 2; i <= n % p; i++) res = ...
C++
442015fe13f7f75876d7163f438960d8
3f924de10f90cef731fff87bf82b2c3e
2,000
PASSED
#include<cstdio> #include<algorithm> #include<cstring> #define rep(x,y,z) for(int x=y;x<=z;x++) #define pre(x,y,z) for(int x=z;x>=y;x--) using namespace std; const int N=2e5+10,M=N*30; int tr[M][2],root[N],sum[M],idx; void Insert(int pos,int pre,int p,int x) { tr[p][0]=tr[pre][0]; tr[p][1]=tr[pre][1]; su...
C++
e83fa9011ace93a63b954f079e3387ba
060d479773b7264a845ec84500fcb65f
2,500
PASSED