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 <iostream> #include <string> #include <algorithm> #include <vector> #include <map> #include <cstdio> #include <cmath> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <complex> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include...
C++
a16febf3b002638f78ba5a32f4b4c4d8
6145fdd537c02bf580a707b7dae534bd
1,800
PASSED
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <map> #include <cstdio> #include <cmath> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <complex> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include...
C++
a16febf3b002638f78ba5a32f4b4c4d8
5e9293705ab18e3c229b176946206e7f
1,800
PASSED
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <map> #include <cstdio> #include <cmath> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <complex> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include...
C++
a16febf3b002638f78ba5a32f4b4c4d8
7c828ccbee1ba1b013d2ad8dad9397f9
1,800
PASSED
// LUOGU_RID: 91279214 #include<bits/stdc++.h> using namespace std; int t,n,cnt,q; //mpvirwmiwriv int a[100100],xo[100100],k[100100],nxt[100100],la[100100]; long long sum[100100]; long long d(int i,int j){ return sum[j]-sum[i-1]-(xo[j]^xo[i-1]); } main(){ // freopen("1.out","w",stdout); cin>>t; while(t-...
C++
a16febf3b002638f78ba5a32f4b4c4d8
c5844e28326e7b1191b282854fb4a9da
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int t,n,q; int a[100100],xo[100100],nxt[100100],la[100100]; long long sum[100100]; long long d(int i,int j){ return sum[j]-sum[i-1]-(xo[j]^xo[i-1]); } int main(){ // freopen("1.out","w",stdout); cin>>t; while(t--){ cin>>n>>q; for(int i=1;i<=n;i++){ sc...
C++
a16febf3b002638f78ba5a32f4b4c4d8
3f6cedd4704c6426c85d26990221162b
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int t,n,q; //ŷ�Ƚ����������ڹ�ũ��ŭ23 int a[200100],xo[200100],nxt[200100],la[200100]; long long sum[200100]; long long d(int i,int j){ return sum[j]-sum[i-1]-(xo[j]^xo[i-1]); } int main(){ // freopen("1.out","w",stdout); cin>>t; while(t--){ cin>>n>>q; for...
C++
a16febf3b002638f78ba5a32f4b4c4d8
877e64eccee507215a6a743cbe22c05d
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int t,n,q; int a[200100],xo[200100],nxt[200100],la[200100]; long long sum[200100]; long long d(int i,int j){ return sum[j]-sum[i-1]-(xo[j]^xo[i-1]); } int main(){ // freopen("1.out","w",stdout); cin>>t; while(t--){ cin>>n>>q; for(int i=1;i<=n;i++){ sc...
C++
a16febf3b002638f78ba5a32f4b4c4d8
0f320fffb005514d87e51e5822f1f1c9
1,800
PASSED
#include<bits/stdc++.h> #define inf 0x3f3f3f3f using namespace std; void slove(){ int n,q; cin>>n>>q; int a[n+5]; for(int i=1;i<=n;i++){ cin>>a[i]; }; int x,y; cin>>x>>y; long long sum[n+5]={0},xsum[n+5]={0}; sum[1]=a[1]; xsum[1]=a[1]; for(int i=2;i<=n;i++){ sum[i]=sum[i-1]+a[i]; x...
C++
a16febf3b002638f78ba5a32f4b4c4d8
d8e3dbca9a1e81361004a7b48aadfce0
1,800
PASSED
#include<bits/stdc++.h> #define ll long long #define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define memst(x,y) memset(x,y,sizeof(x)) using namespace std; const long long N=2e5+5; ll dp[N],a[N],sum[N],summ[N]; void solve(){ long long n,k; cin>>n>>k; dp[0]=0; sum[0]=0; summ[0]=0; for(l...
C++
a16febf3b002638f78ba5a32f4b4c4d8
8f094c2608d83a188c16d91fe84e1c26
1,800
PASSED
//NEWBIE CONTESTANT #include <bits/stdc++.h> #define clo cout << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl; #define NB iostream::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define OUT cout << setprecision(20) << fixed ; #define yes cout << "YES\n" ; #define PI 3.14159...
C++
5278cb48aca6fc84e2df393cd8723ecb
1491ab51988d5a0ec122afff742b9766
900
PASSED
//NEWBIE CONTESTANT #include <bits/stdc++.h> #define clo cout << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl; #define NB iostream::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define OUT cout << setprecision(20) << fixed ; #define yes cout << "YES\n" ; #define PI 3.14159...
C++
5278cb48aca6fc84e2df393cd8723ecb
802fa7bed916417ae940dcd6597390e5
900
PASSED
//NEWBIE CONTESTANT #include <bits/stdc++.h> #define clo cout << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl; #define NB iostream::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define OUT cout << setprecision(20) << fixed ; #define yes cout << "YES\n" ; #define PI 3.14159...
C++
5278cb48aca6fc84e2df393cd8723ecb
a71be7fcc20ec6ce4106aa65f9f17bab
900
PASSED
//NEWBIE CONTESTANT #include <bits/stdc++.h> #define clo cout << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl; #define NB iostream::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define OUT cout << setprecision(20) << fixed ; #define yes cout << "YES\n" ; #define PI 3.14159...
C++
5278cb48aca6fc84e2df393cd8723ecb
256acd1bc34b38b1dacb0a30f9039a0e
900
PASSED
//NEWBIE CONTESTANT #include <bits/stdc++.h> #define clo cout << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl; #define NB iostream::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); #define OUT cout << setprecision(20) << fixed ; #define yes cout << "YES\n" ; #define PI 3.14159...
C++
5278cb48aca6fc84e2df393cd8723ecb
438a8d63bb97a81d12c84952b12e44ce
900
PASSED
#include<bits/stdc++.h> using namespace std; long long n, t, ans; char x; int main() { cin >> t; while(t--) { cin >> n; string s; s += '0'; for(int i = 1; i <= n; i++) { cin >> x; s+=x; if(s[i] != s[0]) { ans++; s[0] = (s[0] == '0' ? '1' : '0'); } } if(ans == 0) { ...
C++
5278cb48aca6fc84e2df393cd8723ecb
164a9b921d98eb722ab0b42fb33eb888
900
PASSED
#include<bits/stdc++.h> using namespace std; long long n, t, ans; char s[200005]; int main() { cin >> t; while(t--) { cin >> n; s[0] = '0'; for(int i = 1; i <= n; i++) { cin >> s[i]; if(s[i] != s[0]) { ans++; s[0] = (s[0] == '0' ? '1' : '0'); } } if(ans == 0) { cout << a...
C++
5278cb48aca6fc84e2df393cd8723ecb
bc8a9e760d5ba50a54c6e79430880d56
900
PASSED
#include<bits/stdc++.h> using namespace std; long long n, t, ans; int main() { cin >> t; while(t--) { cin >> n; string s ; char ch = '0'; cin >> s; for(int i = 0; i < n; i++) { if(s[i] != ch) { ans++; ch = (ch == '0' ? '1' : '0'); } } if(ans == 0) { cout << ans << endl;...
C++
5278cb48aca6fc84e2df393cd8723ecb
658ecea93ceb71f74bcd642cc35c79ed
900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long int main() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); auto start = std::chrono::high_resolution_clock::now(); // Code Start int t; cin >> t; while (t--) { ...
C++
5278cb48aca6fc84e2df393cd8723ecb
d880043d7ec07baecf6b1644490b02e6
900
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int a[N]; char s[N]; signed main() { int T; cin >> T; while (T--) { int n; cin >> n; cin >> s; int last, cnt = 0; for (int i = 0; i < n; i++) { int t = s[i] - '0'; ...
C++
5278cb48aca6fc84e2df393cd8723ecb
54784d5d9bde2c6a0ac0241e55b13886
900
PASSED
#include <bits/stdc++.h> using namespace std; int a[25]; bool via[25]; int ans; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } bool check(const int n, const int pre) { int res=a[1]; for (int i = 1; i <= n; i++) { res=gcd(res,a[i]); } if(res==1...
C++
ff3216bcb009cb963d7e734ceb0e9722
3a8b534cb896ba24554376025c929b60
1,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N=20+5; ll n; ll da[N]; ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);} int main(){ cin.tie(0);cout.tie(0); ios::sync_with_stdio(false); ll t; cin>>t; while(t--){ cin>>n; for(ll i=1;i<=n;i++) cin>>da[i]; ll g=0; for(int ...
C++
ff3216bcb009cb963d7e734ceb0e9722
4375021e0008ed6009a2e740d8252206
1,000
PASSED
// // Codeforces_839_A_Bestie_Div.cpp // // // Created by Shubham Yadav on 25/10/22. // #include <stdio.h> #include<bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; int a[n]; int gcd=0; // calculate if gcd of whole array is already 1, or some element is 1 which makes whole arra...
C++
ff3216bcb009cb963d7e734ceb0e9722
ad58bb07924fc3726db1583291791f6b
1,000
PASSED
#include<bits/stdc++.h> #define A 1000005 #define ll long long using namespace std; int n,m,t,a[30],b[30]; int gcd(int x,int y) { if(x<y) swap(x,y); int s=x%y; while(s!=0) { x=y; y=s; s=x%y; } return y; } int main() { bool op=0; scanf("%d",&t); for(int g=1;g<=t;g++) { ...
C++
ff3216bcb009cb963d7e734ceb0e9722
ee0ed6bc535e49fcf4cd80b2d4086bc6
1,000
PASSED
#include <algorithm> #include <iostream> using namespace std; typedef long long ll; int gcd(ll a,ll b) { int d=max(a,b); int x=min(a,b); if(d%x==0) { return x; } else { return gcd(x,d%x); } } void solve() { int n; cin>>n; ll a[21]; ...
C++
ff3216bcb009cb963d7e734ceb0e9722
748d3dbf9da62dbd1aa88b33ca3cff78
1,000
PASSED
#pragma GCC optimize(2) #include <iostream> #include <cstring> #include <algorithm> #include <cmath> using namespace std; long long t,i,n,a[25]={0},v,j,b[25]={0}; long long gcd(long long x,long long y) { if(y==0)return x; else return gcd(y,x%y); } int main() { std::ios::sync_with_stdio(false);...
C++
ff3216bcb009cb963d7e734ceb0e9722
425190a0941c11004e22938556845070
1,000
PASSED
#include <bits/stdc++.h> #define kareem ios_base::sync_with_stdio(false);cin.tie(0); #define BIG 9223372036854775807 #define mod 1000000007 #define mod2 998244353 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;...
C++
ff3216bcb009cb963d7e734ceb0e9722
03890cedd575aba867f6d8b7f543fc07
1,000
PASSED
#include <bits/stdc++.h> #include <algorithm> typedef long long ll; typedef unsigned long long ull; #define sfi(ix) scanf("%d",&ix); #define sfl(lx) scanf("%lld",&lx); using namespace std; const int N=2e5+5; const int INF=(unsigned int)~0>>1; ll gcd(ll x,ll y){return x%y==0?y:gcd(y,x%y);} int a[N]; int main(...
C++
ff3216bcb009cb963d7e734ceb0e9722
c61b616f9011c4b5cc5494a8ef61d443
1,000
PASSED
#include <bits/stdc++.h> #include <algorithm> typedef long long ll; typedef unsigned long long ull; #define sfi(ix) scanf("%d",&ix); #define sfl(lx) scanf("%lld",&lx); using namespace std; const int N=2e5+5; const int INF=(unsigned int)~0>>1; ll gcd(ll x,ll y){return x%y==0?y:gcd(y,x%y);} int a[N]; int main(...
C++
ff3216bcb009cb963d7e734ceb0e9722
e907457f9f9f7b385521e1396ba2ce13
1,000
PASSED
#include<bits/stdc++.h> #define int long long #define I 1e18 using namespace std; const int Mod1=998244353; const int Mod2=1000000007; int gcd(int a,int b){return __gcd(a,b);} int lcm(int a,int b){return a/gcd(a,b)*b;} const int N=0; int a[25]; void Solve(){ //coding here... int ans=0,sum=I; int n; ci...
C++
ff3216bcb009cb963d7e734ceb0e9722
63320a7dfa92331d479c9f279d001b86
1,000
PASSED
/* DavitMarg In a honky-tonk, Down in Mexico */ #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <ran...
C++
ea07271e3c7cffd7e64cbff1454479bd
164c9ac795e9e62958ad6d3971989495
2,800
PASSED
/* DavitMarg In a honky-tonk, Down in Mexico */ #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <ran...
C++
ea07271e3c7cffd7e64cbff1454479bd
55c4e59c1125cd058e9d506be7e8c7c9
2,800
PASSED
#include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma comment (linker, "/STACK: 268435456") #define f first #define s second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back ...
C++
ea07271e3c7cffd7e64cbff1454479bd
7dcf8ad25e9aeee60b855b4e69ed2b32
2,800
PASSED
#include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma comment (linker, "/STACK: 268435456") #define f first #define s second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back ...
C++
ea07271e3c7cffd7e64cbff1454479bd
0a92798f1d611f91178c174ffa9dc638
2,800
PASSED
#include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma comment (linker, "/STACK: 268435456") #define f first #define s second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back ...
C++
ea07271e3c7cffd7e64cbff1454479bd
6afc39b9edadf2e0d38ece4d9babef06
2,800
PASSED
#include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma comment (linker, "/STACK: 268435456") #define f first #define s second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back ...
C++
ea07271e3c7cffd7e64cbff1454479bd
9f036c815d4f1afffe8b0f255dc860b8
2,800
PASSED
#include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma comment (linker, "/STACK: 268435456") #define f first #define s second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back ...
C++
ea07271e3c7cffd7e64cbff1454479bd
7ba5e89ea12d7cc7a6d01040f999dfd5
2,800
PASSED
#include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma comment (linker, "/STACK: 268435456") #define f first #define s second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back ...
C++
ea07271e3c7cffd7e64cbff1454479bd
0fd34018b686fd6f63d742e59c8e3fb4
2,800
PASSED
#include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma comment (linker, "/STACK: 268435456") #define f first #define s second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back ...
C++
ea07271e3c7cffd7e64cbff1454479bd
dc520eed2f327dab0966fa8efe0afef7
2,800
PASSED
#include <bits/stdc++.h> //#pragma GCC target ("avx2") //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma comment (linker, "/STACK: 268435456") #define f first #define s second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back ...
C++
ea07271e3c7cffd7e64cbff1454479bd
69cd08e30b4d223945421b9413f2527c
2,800
PASSED
/*______________________________________________Bismillahir Rahmanir Rahim____________________________________________ | |.----------------. .----------------. .----------------. .----------------. .----------------.| | | | .--------------. || .--------------. || .--------------. || ....
C++
28277036765f76f20c327ab2fda6c43b
40489a3e1f0861c3c3ba10a4dbfd0e0b
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { long long n; cin>>n; string s; cin>>s; long long cost=0; long long i,j,k; for(long long i=0;i<n;i++) { if(s[i]=='0'||s[i]=='2'...
C++
28277036765f76f20c327ab2fda6c43b
21f99751ae5755bf02f93f27f85d35c4
1,200
PASSED
#include <iostream> //#include <cstdio> #include <numeric> #include <functional> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <map> #include <bit...
C++
28277036765f76f20c327ab2fda6c43b
3617400b07f60932b5da1f5206e439d7
1,200
PASSED
#include <iostream> //#include <cstdio> #include <numeric> #include <functional> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <map> #include <bit...
C++
28277036765f76f20c327ab2fda6c43b
845762d8e3c61548cd544a30322f5b8f
1,200
PASSED
#include <iostream> //#include <cstdio> #include <numeric> #include <functional> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <map> #include <bit...
C++
28277036765f76f20c327ab2fda6c43b
86c673698be5e3823c09518e9c890ca4
1,200
PASSED
#include <iostream> //#include <cstdio> #include <numeric> #include <functional> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <map> #include <bit...
C++
28277036765f76f20c327ab2fda6c43b
267884616fca438406b2f5ae1243df0c
1,200
PASSED
#include <iostream> //#include <cstdio> #include <numeric> #include <functional> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <map> #include <bit...
C++
28277036765f76f20c327ab2fda6c43b
f7544ebedbd79947a1884249a83b3390
1,200
PASSED
#include <iostream> //#include <cstdio> #include <numeric> #include <functional> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <map> #include <bit...
C++
28277036765f76f20c327ab2fda6c43b
240b2d05784c2d24c604a2e7fc6418bc
1,200
PASSED
#include <iostream> //#include <cstdio> #include <numeric> #include <functional> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <map> #include <bit...
C++
28277036765f76f20c327ab2fda6c43b
38b8efe9cc666e04fe9602bdd91e9f1c
1,200
PASSED
#include <iostream> //#include <cstdio> #include <numeric> #include <functional> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <queue> #include <map> #include <bit...
C++
28277036765f76f20c327ab2fda6c43b
624778dc481b31fe5842c457bfa572fe
1,200
PASSED
#include<iostream> using namespace std; typedef long long LL; const int N = 2e5 + 5; LL val[N]; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int t; cin >> t; while(t --) { int n, k; cin >> n >> k; for(int i=1; i<=n; i++) cin >> val[i]; int l = k - 1, r = k + 1; LL ...
C++
4de6411fbc7a8018844bd8e0e13638f2
d31cbfc1430c123faf45ec578d099a93
1,800
PASSED
#include<iostream> using namespace std; const int N = 2e5 + 5; typedef long long LL; LL val[N]; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int t; cin >> t; while(t --) { int n, k; cin >> n >> k; for(int i=1; i<=n; i++) cin >> val[i]; int l = k - 1, r = k + 1; L...
C++
4de6411fbc7a8018844bd8e0e13638f2
591a9c68f1d5d449dc7a0d3021ea9b3a
1,800
PASSED
#include<iostream> using namespace std; typedef long long LL; const int N = 2e5 + 5; LL val[N]; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int t; cin >> t; while(t --) { int n, k; cin >> n >> k; for(int i=1; i<=n; i++) cin >> val[i]; int l = k - 1, r = k + 1; LL ...
C++
4de6411fbc7a8018844bd8e0e13638f2
cd20f1763fbe688b393ca5fdf5581363
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define x first #define y second const int N=2e5+10; typedef long long LL; pair<LL,LL> p1[N],p2[N]; LL a[N]; void solve() { int n,q; int n1=0,n2=0; memset(a,0,sizeof a); scanf("%d%d",&n,&q); for(int i=1;i<=n;i++) scanf("%lld"...
C++
4de6411fbc7a8018844bd8e0e13638f2
d149f255e387c0588ea9abd28ba66d00
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define endl "\n" /*for interactive problems remove this line*/ /* -for ordered set problems policy based data sucture header //PBDS */ typedef long long ll; ll mod = pow(10,9)+7; typedef unsigned long long ull; int gcdExtended(int a, int b, int *x, ...
C++
4de6411fbc7a8018844bd8e0e13638f2
9384c43d06d08a1924cd3c8ee6ce7ae9
1,800
PASSED
#include <bits/stdc++.h> #define SF ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define ms(x, y) memset(x, y, sizeof(x)) #define all(v) v.begin(), v.end() #define bug(x) cerr<<#x<<'='<<x<<' ' #define debug(x) cerr<<#x<<'='<<x<<'\n' #define INF 0x3f3f3f3f #define X first #define Y second usin...
C++
4de6411fbc7a8018844bd8e0e13638f2
6a608438c7b44a3c565eb5a0b721386f
1,800
PASSED
#include <bits/stdc++.h> #define SF ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define ms(x, y) memset(x, y, sizeof(x)) #define all(v) v.begin(), v.end() #define bug(x) cerr<<#x<<'='<<x<<' ' #define debug(x) cerr<<#x<<'='<<x<<'\n' #define INF 0x3f3f3f3f #define X first #define Y second usin...
C++
4de6411fbc7a8018844bd8e0e13638f2
e5facdfd6abfb9073f35395cefb1bd34
1,800
PASSED
#include<iostream> #include<cstring> #include<vector> #include<algorithm> using namespace std; using LL = long long; const int maxn = 2e5 + 5; int a[maxn]; LL s[maxn], mx[maxn]; int main(){ cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int T; cin >> T; while(T--){ ...
C++
4de6411fbc7a8018844bd8e0e13638f2
44b139f7e32e4b22c9de379d7f5aaad6
1,800
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <queue> #include <unordered_map> #include <vector> #include <set> #define x first #define y second using namespace std; const int mod = 1e9 + 7; typedef long long LL; typedef pair<int, int> PII; typedef pair<double, doub...
C++
4de6411fbc7a8018844bd8e0e13638f2
2291f9eb4749269237d0cd06cefef76c
1,800
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <queue> #include <unordered_map> #include <vector> #include <set> #define x first #define y second // using namespace std; // const int mod = 1e9 + 7; // typedef long long LL; // typedef pair<int, int> PII; // typedef pa...
C++
4de6411fbc7a8018844bd8e0e13638f2
815982aa571e2eed909f8275f1ebcc5c
1,800
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; int T,n,m; map<pair<int,int>,int>mp[2]; int solve(int x,int y,int z){ // cerr<<"S "<<x<<' '<<y<<' '<<z<<'\n'; if(y==0)return 0; if(x==0){ return z; } if(mp[z].find({x,y})!=mp[z].end())return mp[z][{x,y}]; if(y<=(1ll<<(x-1))){ retur...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
429482cd463c84afd9575099bc76ae1c
2,500
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; map<int,int> mp; int ask(int x,int L,int R){ while(R>x)x=x*2+1; int t=x+114514*(L%233333333)-1919*(R%33333332); if(mp[t])return mp[t]; if(L==0&&R>=x)return x+1; int mi=x/2,res=0; if(L<=mi){ if(R>mi)res+=R-mi-as...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
299527dcf7ca8fcfdfa6eb74c8eb7cb3
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef unsigned long long LL; LL f[65][2][2],g[65][2][2]; int main(){ int T; LL n,m; cin>>T; while(T--){ cin>>n>>m; --m; int l=1; while((1ull<<l)<=m)++l; memset(f,0,sizeof(f)); memset(g,0,sizeof(g)); int cnt=0; LL h=n>>(l-1); for(LL x...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
fb77ec90bd6e570590c20c456fe29edc
2,500
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int n,m,T,f[65][2][2][2]; int dfs(int x,int a,int b,int c){ if(x==63)return (!a)&&(b^c); int &o=f[x][a][b][c]; if(~o)return o;o=0; for(int i=0;i<2;i++){ int u=i+b+((n>>x)&1); o+=dfs(x+1,(m>>x&1)?(i?a:0):(i?1:a),u/2,c^(u&1)^i); }retur...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
7737f7ec99c9df6d23601571330fc3da
2,500
PASSED
#pragma GCC optimize(3,"Ofast","inline") #include<bits/stdc++.h> using namespace std; #define pi pair<int,int> #define mp make_pair #define fi first #define se second #define pb push_back #define mid ((l+r)>>1) #define lowbit(x) (x&-x) #define int long long const int maxn=2e5+5,M=34005,mod=1e9+1; inline int...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
cfb0858ce44dd53c239f3f05c863cc26
2,500
PASSED
// LUOGU_RID: 93333491 #include<bits/stdc++.h> #define fep(i,l,r) for(int i=l;i<=r;++i) #define feb(i,r,l) for(int i=r;i>=l;--i) #define For(i,u) for(int i=head[u];i;i=e[i].nxt) #define int long long #define LL long long #define mpr make_pair #define pr pair<int,int> #define mpr make_pair using namespace std;...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
c070100c7d4a4e3acf120949093e551c
2,500
PASSED
#include<bits/stdc++.h> #define fep(i,l,r) for(int i=l;i<=r;++i) #define feb(i,r,l) for(int i=r;i>=l;--i) #define For(i,u) for(int i=head[u];i;i=e[i].nxt) #define int long long #define LL long long #define mpr make_pair #define pr pair<int,int> #define mpr make_pair using namespace std; const int N = 1e5+5...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
b4be2cc1a05c06e7428ad7794f29c1d8
2,500
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define sz size #define IOS ios::sync_with_stdio(0), cin.tie(0),cout.tie(0) #define endl "\n" const ll inf=1ll<<60; const int mod=998244353; mt19937 rnd(std::...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
b36493704d1da05cc96fc7fc93fa64ff
2,500
PASSED
#include <stdio.h> #include <iostream> #include <string.h> #define ll long long int tr(ll a){ int cnt = 0; while(a&1){ cnt++; a >>= 1; }; return cnt; }; int ss(ll a, ll b){ int cnt = 0; while(b){ cnt += a&1; cnt += b&1; a >>= 1; b >>= 1; }; return ...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
6f86c3f7b7b0f7a139dd69daa055ccf9
2,500
PASSED
#include <bits/stdc++.h> #define int long long #define pb push_back using namespace std; int n,m,dn[71],dm[71],totn,totm; int dp[71][71][2][2][2]; int dfs(int pos,int ne,int up,int Lim,int zero) { if(!pos) { if(ne==0&&!up&&!zero&&!Lim) return 1; return 0; } if(~dp[pos][ne][up][Lim][zero]) return dp[...
C++
c9d57c590f4fe99e4a41f7fce1a8e513
1088feaa721ad77a23bea9cd238e467b
2,500
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long const int maxn=2010; vector<int>a(maxn); int n; vector<int>b(maxn); vector<int>c[maxn]; bool flag[maxn]; int now=1; void dfs(int&pos,vector<int>v,int fa) { if(v.size()==1) { c[fa].push_back(v[0]); return; } ...
C++
4a473e34f2be18a19c306d80d4693199
158d5d37881a6ada4d78e8dd0de1da37
800
PASSED
#include <bits/stdc++.h> using namespace std; #define st first #define nd second #define cl(x,v) memset((x), (v), sizeof(x)) #define db(x) cerr << #x << " == " << x << endl #define dbs(x) cerr << x << endl #define _ << ", " << typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typ...
C++
4a473e34f2be18a19c306d80d4693199
13e6f6ed8940b3a41da5488d867c52ab
800
PASSED
#include<iostream> using namespace std; int main() { int t, n; cin >> t; while (t--) { cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { if (j== 1) cout << 1; else if (j== i) cout << ' ' << 1; else cout << ' ' << 0; } cout << endl; } } return 0;...
C++
4a473e34f2be18a19c306d80d4693199
214040f87bfd10ae2088160cbb1eb787
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; for(int i=1; i<=n; ++i) { for(int j=1;j<=i;++j){ if(j==i||j==1){ cout<<"1"<<" "; } else cout<<"0"<<" "; } cout<<endl; } } return 0; }
C++
4a473e34f2be18a19c306d80d4693199
50d788fc48eb540edcea61b06bb5c2af
800
PASSED
#include <iostream> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <set> #include <map> #include <queue> #include <stack> using namespace std; #define fi first #define se second #define allV(x) x.begin(), x.end() #define mp make_pair #define pb push_back typedef long long LL; typ...
C++
4a473e34f2be18a19c306d80d4693199
ffb398e405c9cd656095b88bbdcd9b27
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=2e5+7; ll s[N]; void work(){ int n; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ if(j==1||j==i) cout<<1<<" "; else cout<<0<<" "; } cout<<endl; } } int main(){ int _; cin>>_; while(_--){ work(); } return 0; } ...
C++
4a473e34f2be18a19c306d80d4693199
339c1d6b40aead81d9a19a1a8d874c42
800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int inf=1e9; const int N=1e7+10; int a[N]; void solve(){ int n;cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ if(j==1||j==i)cout<<"1 "; else cout<<"0 "; } cout<<"\n"; } } signed main(){ ios::sync_with_stdio(0);cin.tie(0...
C++
4a473e34f2be18a19c306d80d4693199
481059079a4f682d83960fd638056ed8
800
PASSED
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") typedef long long ll; // const ll mod = 1e9 + 7; const ll MAXN = 1e6 + 5; #define vi vector<int> #define vll vector<ll> #define pii pair<int, int> #define pll pair<ll, ll> #define mp make_pair #define pb push_back #define lb lower_bound #define...
C++
4a473e34f2be18a19c306d80d4693199
f0860c874e701c87f45c433a3351fa83
800
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int a[505][505]; signed main(){ int t; cin>>t; for(int i=1;i<=501;i++){ for(int j=1;j<=i;j++){ if(j==1||j==i)a[i][j]=1; else { a[i][j]=0; } } } while(t--){ int n; scanf("%lld",&n); for(int i=1;i<=n;i++){ for(int j=1;j<...
C++
4a473e34f2be18a19c306d80d4693199
296db999456ad2db8c3e9e3ea2015e33
800
PASSED
#include <bits/stdc++.h> using namespace std; int a[55]; char c[55]; int main(){ int T,n; scanf("%d",&T); while(T--){ scanf("%d",&n); for(int i = 1;i <= n;i++){ for(int j = 1;j <= i;j++){ if(j==1 || j==i)cout<<"1 "; else cout<<"0 "; } cout<<endl; } } return 0; }
C++
4a473e34f2be18a19c306d80d4693199
54db9a2e6623a80e11acb2f44e5e9085
800
PASSED
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int n; cin >> n; int a[310]; int x; for (int i = 1; i <= n; i++) { cin >> x; for (int j = 0; j < x; j++) cin >> a[j]; sort(a, a + x); int ans = a[2] - a[0]; for (int j = 1; j < x - 2; j++) { ans = min(ans, a...
C++
53ff11122a277d1eb29fe2034017fd75
a6dc738e496ab4b94e680c0028283ec3
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t ; cin >> t ; while(t--) { int n ; cin >> n ; long long arr[n]; for (int i = 0; i < n; ++i) { cin >> arr[i]; } sort(arr,arr+n); long long mn = 1e9; for (int i = 1; i < n-1; ++i...
C++
53ff11122a277d1eb29fe2034017fd75
76ae13fd50c5a03677e45beaff5d4199
800
PASSED
#include<iostream> #include<algorithm> using namespace std; int main() { int m; int f[300]; cin >> m; for (int i=0; i<m; i++) { int n; cin>>n; for (int j=0; j<n; j++) { cin>>f[j]; } int a[300]; sort(f,f+n); int sum=0; ...
C++
53ff11122a277d1eb29fe2034017fd75
b1b3420f53dbf835b2bc5dcebf476c35
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t,n; long long int oper,min_oper; cin>>t; while(t--){ min_oper=LLONG_MAX; cin>>n; vector<int> v(n); for(int &x:v){ cin>>x; } sort(v.begin(), v.end()); for(int i=0;i<=n-3;...
C++
53ff11122a277d1eb29fe2034017fd75
14409466dc0e31072119d74fbcfc1bd1
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(void) { int t; cin >> t; while(t --) { int n; long long a[310],p; cin >> n; for(int i = 0; i < n; i ++) cin >> a[i]; sort(a,a + n); int min = a[n - 1]; for(int i = 1;i < n - 1; i ++) { p = a[i + 1] - a[i - 1]; if(p < min) min = p; } cou...
C++
53ff11122a277d1eb29fe2034017fd75
7860527998017fae8b0ab9e6932153fb
800
PASSED
#include "bits/stdc++.h" using namespace std; void runfast() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } typedef long long ll; typedef vector<int> vi; #define F first #define S second #define pb push_back #define MP make_pair using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i+...
C++
53ff11122a277d1eb29fe2034017fd75
b6ab53f533c97e1ed54730b7d64770e1
800
PASSED
#include<stdio.h> #include<math.h> #include<string> #include<string.h> int t, n, p, min; int a[310]; int tmp[310]; void sort(int l, int r) { if (l >= r)return; int mid = (l + r) / 2; sort(l, mid); sort(mid + 1, r); int k = 1, i = l, j = mid + 1; while (i < mid + 1 && j <= r) { if (a[i] < a[j]) { tmp[k++] = a...
C++
53ff11122a277d1eb29fe2034017fd75
fad9c6c5da03b7c7210716bad7b23fb5
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(void) { int t; cin >> t; while(t--) { int n; cin >> n; int a[310], b[310]; for(int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for(int i = 0; i < n - 2; i++) { b[i] = a[i + 2]- a[i] ; } sort(b, b + n - 2); cout << b[0] << e...
C++
53ff11122a277d1eb29fe2034017fd75
182588757b1b098ac625bd45bd6ec80e
800
PASSED
#include<iostream> #include<algorithm> #include<vector> using namespace std; void FAST() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); } int main() { FAST(); int t; cin >> t; while (t--) { int size; cin >> size; vector<int>v; int num; for (int i = 0; i < size; i++) { cin >> num; v.p...
C++
53ff11122a277d1eb29fe2034017fd75
b1f18dc4e8f3ff263af3a2906d06b9a4
800
PASSED
#include <stdio.h> #include <algorithm> using namespace std; int main (void) { int t; scanf("%d",&t); for(int a=0;a<t;a++) { int b,e[4000]; scanf("%d",&b); int j=0; for(int c=0;c<b;c++) { scanf("%d",&e[j]); j=j+1; } sort(e,e+b); int h,k[4000],g=0; for(h=0;h<j-2;h=h+1,g++) { k[g]=...
C++
53ff11122a277d1eb29fe2034017fd75
064fe4389e1956aa9ae3a97ffab35824
800
PASSED
#include<bits/stdc++.h> using namespace std; int b[400],a[400][400],n; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&b[i]); if(n==2) { if(b[1]==0&&b[2]==0) printf("0 0\n1 0\n"); else if(b[1]==0&&b[2]==1) printf("0 0\n0 1\n"); else if(b[2]==0) printf("1 0\n0 0\n"); ...
C++
a6e13812cdf771ba480e69c0ff6f4c74
c77de10afbb25ff4d153b03bcd931a40
2,100
PASSED
// LUOGU_RID: 90246957 #include<bits/stdc++.h> #define int long long using namespace std; bool Begin; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inlin...
C++
a6e13812cdf771ba480e69c0ff6f4c74
a339b5234aa085bc6f2d63f081bec334
2,100
PASSED
// LUOGU_RID: 90236073 #include<bits/stdc++.h> #define int long long using namespace std; bool Begin; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inlin...
C++
a6e13812cdf771ba480e69c0ff6f4c74
76a0d5e4017cf79a6d693395982bd319
2,100
PASSED
// LUOGU_RID: 90234444 #include<bits/stdc++.h> #define int long long using namespace std; bool Begin; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inlin...
C++
a6e13812cdf771ba480e69c0ff6f4c74
70cd1f8790fe8524d20624eb2500d658
2,100
PASSED
// LUOGU_RID: 90238664 #include<bits/stdc++.h> #define int long long using namespace std; bool Begin; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inlin...
C++
a6e13812cdf771ba480e69c0ff6f4c74
05fe2c84c2dd5ebbad0981f1738b5e4e
2,100
PASSED
// LUOGU_RID: 90238221 #include<bits/stdc++.h> #define int long long using namespace std; bool Begin; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inlin...
C++
a6e13812cdf771ba480e69c0ff6f4c74
9f652579ace2915a9bb5e3e47fd12b22
2,100
PASSED
// LUOGU_RID: 90232801 #include<bits/stdc++.h> #define int long long using namespace std; bool Begin; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inlin...
C++
a6e13812cdf771ba480e69c0ff6f4c74
1c14ceb52a4e156b061491d0457698ca
2,100
PASSED
// LUOGU_RID: 90232044 #include<bits/stdc++.h> #define int long long using namespace std; bool Begin; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inlin...
C++
a6e13812cdf771ba480e69c0ff6f4c74
38e917045898f6342961b61674e9a27e
2,100
PASSED
// LUOGU_RID: 90233621 #include<bits/stdc++.h> #define int long long using namespace std; bool Begin; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inlin...
C++
a6e13812cdf771ba480e69c0ff6f4c74
a1e391ae04decb19a4c1e4b9cdb14ce9
2,100
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int max_n=352; inline int read(){ int x=0;bool w=0;char c=getchar(); while(c<'0' || c>'9') w|=c=='-',c=getchar(); while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return w?-x:x; } inline void write(int x){ if(x<0) pu...
C++
a6e13812cdf771ba480e69c0ff6f4c74
deeaf742ffc4943da8a1b367595fb08c
2,100
PASSED
#include<iostream> #include<algorithm> using namespace std; int a[200005]; int main() { int t; scanf("%d",&t); while(t--) { int n,l,r; long long sum=0; scanf("%d%d%d",&n,&l,&r); for(int i=1;i<=n;i++) scanf("%d",&a[i]); sort(a+1,a+1+n); for(int i=1;i<=n-1;i++) { int x=lower_bound(a+i+1,a+1+n,l-a[...
C++
2f12b2bb23497119bb70ca0839991d68
7702d20af7f456ba3844a3903373637f
1,300
PASSED