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> #define pb push_back #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define mod 1000000007 using namespace std ; typedef long long ll ; typedef vector<int>vi ; //typedef vector<l>vl ; typedef vector<ll>vll ; typedef vector<vector<ll> >vvl ; typedef pair<int,int> p...
C++
f2f9f63a952794f27862eb24ccbdbf36
d0987c384e519ba9e3180367aa8617d2
1,600
PASSED
#include<bits/stdc++.h> #define ll long long int #define mp make_pair #define ff first #define ss second #define pb push_back using namespace std ; ll a[2000001], pre[2000001], suf[2000001]; ll n,i,j,x,y, m, k, z, t; int main() { cin >> t; while(t--) { cin >> n >> m >> k; for (i = 1 ; i <= n; ++i) { cin ...
C++
f2f9f63a952794f27862eb24ccbdbf36
9c87804964c3dc09c292345c9a2717be
1,600
PASSED
#include<bits/stdc++.h> #define ll long long int #define mp make_pair #define ff first #define ss second #define pb push_back using namespace std ; ll a[2000001], pre[2000001], suf[2000001]; ll n,i,j,x,y, m, k, z, t; int main() { cin >> t; while(t--) { cin >> n >> m >> k; for (i = 1 ; i <= n; ++i) { cin ...
C++
f2f9f63a952794f27862eb24ccbdbf36
9a7ac2dbecb92a92b5fc3124ccb094d5
1,600
PASSED
//include <GOD> // To Saram Koli Fekre Khobo Khafan! #include <bits/stdc++.h> #define Time printf("\nTime : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC) #define For(J,R,K) for(int J=R;J<K;++J) #define Rep(I,N) For(I,0,N) #define MP make_pair #define ALL(X) (X).begin(),(X)....
C++
f2f9f63a952794f27862eb24ccbdbf36
c3522fbae679daa12cbceeaba3c299d8
1,600
PASSED
/* ____________ ______________ __ / _________ /\ /_____ _____/\ / /\ / /\ / / \\ / /\ \ \ / / \ / / \_____/ / / \__/ / \____\/ / / / / / / / / / / / / / / / / / / / / / ...
C++
f2f9f63a952794f27862eb24ccbdbf36
d37de4d33c3b32f9035b498eb7883380
1,600
PASSED
/* ____________ ______________ __ / _________ /\ /_____ _____/\ / /\ / /\ / / \\ / /\ \ \ / / \ / / \_____/ / / \__/ / \____\/ / / / / / / / / / / / / / / / / / / / / / ...
C++
f2f9f63a952794f27862eb24ccbdbf36
397d855c8e9833dfb7d76724fd47ab1a
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' const int T = 1005; bool v[T][T]; int vis[T][T]; int mapa[T*T]; int t = 0; int n,m; int mov[4][2] = { {1,0}, {0,1}, {-1,0}, {0,-1} }; bool isIn(int i, int j) { return (i >= 0 and i < n and j >= 0 and j < m); } int dfs(int i, int j) { vis[i][j] = t; ...
C++
c91dd34bfa784f55ad3b661e06f84cfb
7895bd292fd5b48abf27a47c10789274
1,600
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define fast ios_base::sync_with_stdio(false); cin.tie(NULL) int n,m; char str[1010][1010]; static vector<pair<int,int> >v; vector<pair<int,int> >:: iterator it; int viv[1001][1001]; static bool vis[1001][1001]; int finaly[1000010]={0}; int arr[1000010]...
C++
c91dd34bfa784f55ad3b661e06f84cfb
438d1574b340e7af4b35034ec9d29cf2
1,600
PASSED
// hard times :/ #include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false); cin.tie(NULL) int n,m; char str[1010][1010]; int viv[1001][1001]; static bool vis[1001][1001]; int finaly[1000010]={0}; int arr[1000010]={0}; inline int get_id(int x,int y,int cnt,int id) { if(x<0 || y<0) ...
C++
c91dd34bfa784f55ad3b661e06f84cfb
69a255a76d65bcf3e51a483a9f35faee
1,600
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef string str; #define forn(i, n) for (int i = 0; i < n; i++) #define form(i, n, m) for (int i = n; i <= m; i++) // #define read(x) scanf("%d", &x) #define write(x) printf("%d", &x) #define read2(x, y) scanf("%d %d", &x, &y) // #define sqr(x) x*x ...
C++
c91dd34bfa784f55ad3b661e06f84cfb
a53e31f2c3e52cfe1a065b50a18460c1
1,600
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef string str; #define forn(i, n) for (int i = 0; i < n; i++) #define form(i, n, m) for (int i = n; i <= m; i++) // #define read(x) scanf("%d", &x) #define write(x) printf("%d", &x) #define read2(x, y) scanf("%d %d", &x, &y) // #define sqr(x) x*x ...
C++
c91dd34bfa784f55ad3b661e06f84cfb
d7a013996def21748f98c8e7474c3166
1,600
PASSED
#include <iostream> #include <algorithm> #include <stdio.h> #include <algorithm> using namespace std; const int N = 1001; int n, m, x[4] = {1,-1,0,0}, y[4] = {0,0,1,-1}, us[N][N]; char c[N][N]; int p[N][N], v, cr, b[1000100]; bool g[1000100]; void calc(int i, int j, int z) { int w=0; us[i][j] = 1; p[i][j]=...
C++
c91dd34bfa784f55ad3b661e06f84cfb
2313e0208f64230f6fc32eb7a342e55a
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define pii pair <int, int> #define vi vector<int> #define read1(a) int a; scanf("%d", &a) #define read2(a, b) int a, b; scanf("%d %d", &a, &b) #define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)...
C++
c91dd34bfa784f55ad3b661e06f84cfb
ffaea30b3f622d738d0c66b28b2d2351
1,600
PASSED
#include<bits/stdc++.h> //#define yamin using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pii; typedef vector<pii> vii; #define PB push_back #define F first #define S second #define MP make_pair #define PI acos(-1) #define EPS 1e9 #define inf 100000000 #...
C++
c91dd34bfa784f55ad3b661e06f84cfb
b4eef6ad59c9ac1a5b2b1bcb2612c936
1,600
PASSED
#include<bits/stdc++.h> using namespace std; string s[1005]; int vis[1005][1005],c[1000005],n,m; int dfs(int i,int j,int z) { if(i<0||j<0||i>=n||j>=m) return -1; if(s[i][j]=='*') return -1; if(vis[i][j]) return vis[i][j]; vis[i][j]=z; c[z]++; dfs(i+1,j,z); dfs(i-1,j,z); dfs(i,j+1,z); ...
C++
c91dd34bfa784f55ad3b661e06f84cfb
a00ecc05663111bf2afb9d2131ff74f6
1,600
PASSED
#include<bits/stdc++.h> using namespace std; string s[1005]; int cc[1005][1005],ccl[1010101],n,m; int dfs(int i,int j,int c) { if(i<0||j<0||i>=n||j>=m) return -1; if(s[i][j]=='*') return -1; if(cc[i][j]) return cc[i][j]; cc[i][j]=c; ccl[c]++; dfs(i+1,j,c); dfs(i-1,j,c); dfs(i,j+1,c); ...
C++
c91dd34bfa784f55ad3b661e06f84cfb
8f2275406766640bcf5d2f4667386c83
1,600
PASSED
//besmellah #include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 65; int V[maxn], U[maxn], n; vector <int> adj[maxn / 2], ans, E; bitset <maxn> vmark, mark; void dfs(int v, int ee) { vmark[v] = 1; while (adj[v].size()) { int e = adj[v].back(); adj[v].pop_back(); int u = V[e] ^ U[e] ^ v; if (...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
a93eab75f5f822f77c49e97d66331330
2,400
PASSED
#include<bits/stdc++.h> using namespace std; const int M=1000000007; int n,m,d[1000005],i,j,k,p,ansu[1000005],ansv[1000005]; int head[1000005],Next[2000005],adj[2000005],u[1000005],v[1000005]; map<int,int> ans[1000005]; void Push(int u,int v) { Next[++k]=head[u]; head[u]=k; adj[k]=v; } struct str{ int s,x; }a[10000...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
fcb11a722d42ca99be5d43a5307c8023
2,400
PASSED
#include<cstdio> #include<vector> #include<algorithm> using namespace std; const int Maxn=1e6; int N,M,totm; int d[Maxn+5]; struct Node { int to; int id; }; vector<Node> G[Maxn+5]; struct Edge { int u,v; int typ; }e[Maxn*2+5]; void addedge(int u,int v,int typ) { G[u].push_back(Node{v,++totm}); G[v].push_back(N...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
07348a3e88d779893e3b7c3fdc509202
2,400
PASSED
// Copyright: lzt #include<stdio.h> #include<cstring> #include<cstdlib> #include<algorithm> #include<vector> #include<map> #include<set> #include<cmath> #include<iostream> #include<queue> #include<string> #include<ctime> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef long double ld; typed...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
1b8f3d7f0fe9e2df7ed945ca55aeb443
2,400
PASSED
// Copyright: lzt #include<stdio.h> #include<cstring> #include<cstdlib> #include<algorithm> #include<vector> #include<map> #include<set> #include<cmath> #include<iostream> #include<queue> #include<string> #include<ctime> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef long double ld; typed...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
751f159fe49a35fc016e5b2eefbd2a1d
2,400
PASSED
#include<cstdio> #include<cctype> #include<cstring> #define fo(i,a,b) for(int i=a;i<=b;i++) #define rep #define gc (p1==p2&&(p2=(p1=fr)+fread(fr,1,1<<21,stdin))==p1?EOF:*p1++) #define fl fwrite(fw,1,q-fw,stdout),q=fw using namespace std; const int L=(1<<21)+9; char ch,fr[L],*p1=fr,*p2=fr,fw[L],*q=fw; void rd(int&x) { ...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
315ecd7669d8cbd056f8afde086226de
2,400
PASSED
#include <cstdio> #include <ctime> #include <algorithm> #include <set> #include <vector> #include <map> using namespace std; struct point { int i,d; inline bool operator < (const point t) const { if (d!=t.d) return d<t.d; else return i<t.i; } }; set < point > S; set < pair <int,int> > T[1200000]; set...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
0d2a5a1d44f03a5c88b511dcc41f08d2
2,400
PASSED
#include <cstdio> #include <ctime> #include <algorithm> #include <set> #include <vector> #include <map> using namespace std; struct point { int i,d,r; inline bool operator < (const point t) const { if (d!=t.d) return d<t.d; else return i<t.i; } }; set < point > S; set < pair <int,int> > T[1200000]; s...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
930764442d0bbce0002e2fff3cc4f616
2,400
PASSED
#include <bits/stdc++.h> using namespace std; const int sz=1e6+10; multiset <int> sv[sz]; set <int> sv2[sz]; vector <int> sp; int st[sz]; void dfs(int v) { while(sv[v].size()) { int ne=*sv[v].begin(); sv[v].erase(sv[v].begin()); sv[ne].erase(sv[ne].find(v)); dfs(ne); } sp...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
b4a4aff3d59a19f699c7fa9ba7e01e07
2,400
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 1000010; struct edge { int u, v, flag; }; int st[maxn * 2], ans[maxn * 2], re[maxn * 2]; edge a[maxn * 2]; int head[maxn], id[maxn * 4], Next[maxn * 4], ver[maxn * 4], tot, totm, tot_ans; bool v[maxn * 4], vis[maxn * 4]; int deg[maxn]; int Top; void a...
C++
5a0f578ef7e9e9f28ee0b5b19be2ca76
485709e1bff2c9844e36b0e7c21d438c
2,400
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <queue> int a[200010]; int sums[200010], roots[200010]; int ans[200010] = { 0 }; struct edge { int where, index; bool direction; }; std::vector< std::vector<edge> > g(200010); void initialize(int n) { for (int i = 0; i < n; ++i) { ...
C++
666b710742bb710dda112e4a6bbbe96b
7fcbd2252784808c76a63c1fe410aaa3
2,400
PASSED
#include <bits/stdc++.h> using namespace std; int N, M; vector<int> graph[200005]; int val[200005]; bool vis[200005]; pair<int, int> edge[200005]; int ans[200005]; void dfs(int n, int p){ vis[n] = 1; for(int e : graph[n]){ if(e == p){ continue; } if(edge[e].first == n){ ...
C++
666b710742bb710dda112e4a6bbbe96b
c26a838fcc6860919c2c8f89cebe50f4
2,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef pair <int, int> P; const int N = 2e5 + 10; vector <P> G[N]; int val[N], used[N], ans[N]; void dfs(int x, int fa, int id){ used[x] = 1; for (int i = 0; i < G[x].size(); i++){ if (!used[G[x][i].first]) dfs(G[x][i].first, x, G[x][i].second); } if (val[x] !...
C++
666b710742bb710dda112e4a6bbbe96b
b8973586b84ef498aa42be495bfc8780
2,400
PASSED
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #define Rep(i,a,b) for(register int i=(a),i##end=(b);i<=i##end;++i) #define Repe(i,a,b) for(register int i=(a),i##end=(b);i>=i##end;--i) #define For(i,a,b) for(i=(a),i<=(b);++i) #define Forward(i,a,b) for(i=(a),i>=(b);--i) template<typename T>inline void r...
C++
666b710742bb710dda112e4a6bbbe96b
d223c5163168f9520907a24d2dc37306
2,400
PASSED
#include<bits/stdc++.h> #define N 200005 using namespace std; int i,j,k,l,s,n,m,x,y,a[N],ans[N],last[N],to[2*N],Next[2*N],vis[N],tot; inline void add(int x,int y) { Next[++tot]=last[x]; last[x]=tot; to[tot]=y; } inline void dfs(int x) { vis[x]=1; for (int i=last[x];i;i=Next[i]) { if (!vis[to[i]]) { dfs(to[i]); ...
C++
666b710742bb710dda112e4a6bbbe96b
c4120a50a479d2bc3704c836a340370c
2,400
PASSED
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <queue> #include <array> #include <string> #include <stack> #include <bitset> #include <cmath> #include <set> #include <memory> #include <iomanip> using namespace std; int dfs(const vector<vector<array<int, 3>>>& edges, vector<int>& an...
C++
666b710742bb710dda112e4a6bbbe96b
7512b3bc18794a4309a9c2aa42e98cb0
2,400
PASSED
/* Trading life for life It all must fall It must end with us It must end with me Insinuations of what might be Fight through depriviation There will be no sleep Heed my cry Because of greed and hatred To dust we return They will see the strength in our numbers Only then will the self-righteous learn Insinuations o...
C++
666b710742bb710dda112e4a6bbbe96b
aea65768d77eaafedc66e13df137c9f5
2,400
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; struct E {int v, nt;} e[N<<1]; int n, m, tot=1, h[N], s[N], sum[N], vis[N], val[N<<1]; inline void add(int u, int v) { e[++tot] = (E){v, h[u]}, h[u] = tot; e[++tot] = (E){u, h[v]}, h[v] = tot; } template <class T> inline void in(T &x) { x = 0; ...
C++
666b710742bb710dda112e4a6bbbe96b
6c88262c37e1b0b8b90d9511b8c1141d
2,400
PASSED
#include <bits/stdc++.h> typedef long long ll; typedef double ld; using namespace std; const int Max = 5e5+ 5, Mod = 1e9 + 7; ll n, m, f[Max]; int s[Max]; vector<pair<int, int>> G[Max], T[Max]; bool vis[Max]; void build(int u) { vis[u] = true; for(auto v : G[u]) if (!vis[v.first]) { ...
C++
666b710742bb710dda112e4a6bbbe96b
68af4ada5a783cc4b7d68892e4c0495d
2,400
PASSED
#define _CRT_SECURE_NO_DEPRECATE #include <iostream> #include <string> #include <vector> #include <sstream> #include <queue> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <math.h> #include <stack> #include <deque> #include <numeric> #include <cstring> #include <cstdio> #include <cstdlib...
C++
666b710742bb710dda112e4a6bbbe96b
e538f99175a136c6be1dcb5dccb275e8
2,400
PASSED
#include<bits/stdc++.h> using namespace std; long long power(long long x,long long p){ if(p==0)return 1; if(p==1)return x; if(p%2) return x*power(x,p-1); long long y=power(x,p/2); return y*y; } int main() { int t; cin >> t; while(t--) { long long n; cin >> ...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
3b46b51d35b31fbf082af9748ec16c44
1,400
PASSED
#include<bits/stdc++.h> using namespace std; long long power(long long x,long long p){ if(p==0)return 1; if(p==1)return x; if(p%2) return x*power(x,p-1); long long y=power(x,p/2); return y*y; } int main() { long long t; cin >> t; while(t--) { long long n; c...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
2623e5eacbfcebec2c773098dd26a73e
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL); //ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ff first #define ss second #define pb push_back #define pf push_front #define mp make_pair #define in insert typedef long double ld; typedef lo...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
51407802250c5787c5dd5886bc4a51f9
1,400
PASSED
// C++ program for the above approach #include <bits/stdc++.h> using namespace std; #define int long long int // Function to implement fast // exponentiation int binpow(int a, int b) { int res = 1; while (b) { if (b & 1) res = res * a; a = a * a; b /= 2; } return res; } // Function to return the value //...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
4d0423585b1d5bff7a913b8199615ab7
1,400
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<long long, long long>; using piii = pair<pair<int, int>, int>; using vi = vector<int>; using vl = vector<long long>; using vvi = vector<vector<int>>; using vvl = vector<vector<long long>>; using ul...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
3ef4afcc65cd9f85a6a1a841eaf26e70
1,400
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<long long, long long>; using piii = pair<pair<int, int>, int>; using vi = vector<int>; using vl = vector<long long>; using vvi = vector<vector<int>>; using vvl = vector<vector<long long>>; using ul...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
ac61661ae44f5fc46be159be28b2f33f
1,400
PASSED
#include <bits/stdc++.h> #define MOD 1000000007 using namespace std; typedef long long ll; typedef long int lint; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while(t--) { ll n; cin >> n; n *= 2; ll k = 2, ans = 0; while(n >= k) { ans += n/k; k *= 2; } c...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
00ffd62602d4b4dd52a0d0784c1028d5
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define f(i,n) for(i=0;i<n;i++) #define f1(i,n) for(i=1;i<n;i++) #define em emplace_back #define mp make_pair #define in insert #define fi first #define sc second #define b begin #define e end #define er erase #define ...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
8133865c4cfe070808c9f3ae1460b68c
1,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define mp make_pair #define pb push_back ll arr[64],arr1[64],n; void solve(ll p,ll *sum) { } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll p; arr[1] = 1; for(p=2;p<64;p++) arr[p] = p + 2*arr[p-1]...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
9193353f06a1233e4743c672f7f4095e
1,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; //const double pi=acos(-1.0); #define mod 1000000007 #define forn(i,k,n) for(ll i=k;i<n;i++) #define fornr(i,k,k1) for(ll i=k;i>=k1;i--) #define v(ll) vector<ll> #define vl(a,n,ll,k) vector<ll> a(n,k) #define vli(a,n) vector<ll> a(n) #define init(a,...
C++
2a4f4c91522d83bc8f1ca2f086d24c3c
748cfc02652437b67814b1200f0c49a8
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here int n; long long sum{},b{},i{},j{-1},t; cin>>n>>t; vector<long long> a(n); for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) { sum+=a[i]; if(sum>t) { while(sum>t) ...
C++
ef32a8f37968629673547db574261a9d
e1d5eb041b1c9f544d5183f60bf82090
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define max 9999999 #define ll long long ll consi[max]; ll arr[max]; void generate(ll length){ ll sum = 0; for(ll i = 1;i<=length;++i){ sum+=arr[i]; consi[i] = sum; } } ll max_val(ll a,ll b){ if(a>b)return a; return b; } ll solve(ll lengt...
C++
ef32a8f37968629673547db574261a9d
ac463839e91085c8d1d27aa452899e89
1,400
PASSED
#include<bits/stdc++.h> #define int ll using namespace std; typedef long long ll; typedef pair<int,int> pii; #define Rep(i,a,b) for(register int i=(a);i<=int(b);++i) #define Dep(i,a,b) for(register int i=(a);i>=int(b);--i) #define rep(i,a,b) for(register int i=(a);i<int(b);++i) #define mem(x,v) memset(x,v,sizeof(x)) #d...
C++
45e715b158cf0dba7798fc68f04b075a
30eb81236bb080635e151a006f5bb919
2,900
PASSED
#define DEBUG 0 #include <bits/stdc++.h> using namespace std; #if DEBUG // basic debugging macros int __i__,__j__; #define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl #define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl #define printVar(n) cout<<#n<<": "<<n<<endl #define printA...
C++
45e715b158cf0dba7798fc68f04b075a
bd2893cfd37b1c0af9630398960664bd
2,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MX=4005,MXK=81; const int md=998244353; int n1,n2,k; int f[3][MXK]; vector<int>G[MX]; int fa[MX],g[MX][MXK],gs[MX][MXK],gf[MX][MXK]; #define A(x,y) ((x)=((x)+(ll)(y))%md) void dfs(int i,int f){ fa[i]=f; for(auto j:G[i])if(j!=f)dfs(j,i);...
C++
45e715b158cf0dba7798fc68f04b075a
a7d4b880111a6369480fdde30b800f5d
2,900
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<set> #include<map> #include<queue> using namespace std; typedef long long ll; #define sqr(x) ((x)*(x)) #define mp make_pair inline char gc(){ static char buf[100000],*p1=buf,*p2=buf; return p1==p2&&(p2=(p1=buf)+fr...
C++
45e715b158cf0dba7798fc68f04b075a
6201c06b6ea36fde3d63dad74d272e58
2,900
PASSED
#include<iostream> #include<algorithm> #include<cstdio> #include<cstring> using namespace std; const int Mod=998244353; int k; struct Edge{ int v,nxt; }e[8010];int tot; int first[4010]; void build(int u,int v) { e[++tot]=(Edge){v,first[u]}; first[u]=tot;return ; } bool book[4010]; int siz[4010]; void getsiz(int u,in...
C++
45e715b158cf0dba7798fc68f04b075a
c1a2500ea6faa4bc9e4d0d5cf2936ea0
2,900
PASSED
#include<bits/stdc++.h> using namespace std; #define mp make_pair const int maxn=4000,mod=998244353; int k; int ans; int C[80][80]; void inc(int &a,int b) { a=(a+b)%mod; } struct wjmzbmr { int n; vector<int> g[maxn+5]; vector<int> dp[80][maxn+5]; int sum[80][maxn+5]; int ans[maxn+5],sz[maxn+5]; ...
C++
45e715b158cf0dba7798fc68f04b075a
b4c77bb875f5da49e5f7f017134ab00d
2,900
PASSED
#include<bits/stdc++.h> #define nn 4002 #define mod 998244353 #define ll long long using namespace std; #define pii pair<int,int> int nk; void add(int &x,int y) { x+=y; if(x>=mod) x-=mod; } struct tree{ int n;vector<int> v[nn],rev[nn]; int tot[78]; vector<int> dp[78][nn]; vector<int> vis[78][nn]; vector<int> ...
C++
45e715b158cf0dba7798fc68f04b075a
6d4682063e38570442f6c5273dc1d834
2,900
PASSED
#include<bits/stdc++.h> #define int ll using namespace std; typedef long long ll; typedef pair<int,int> pii; #define Rep(i,a,b) for(register int i=(a);i<=int(b);++i) #define Dep(i,a,b) for(register int i=(a);i>=int(b);--i) #define rep(i,a,b) for(register int i=(a);i<int(b);++i) #define mem(x,v) memset(x,v,sizeof(x)) #d...
C++
45e715b158cf0dba7798fc68f04b075a
b0ef26351275f51c00de688762e10709
2,900
PASSED
#include <iostream> #include <vector> using namespace std; int N, M, K; vector <int> G[2][4005]; vector <int> V; const int MOD = 998244353; int Res[2][80]; int Sz[4005]; bool Blocked[4005]; int DP[4005][80], DP2[4005][80], C[4005][80]; int Comb[205][205]; void Read() { cin >> N >> M >> K; for(int i = 1; i < N; ...
C++
45e715b158cf0dba7798fc68f04b075a
1f3dd15d4b336a0fce1217b419e3d53b
2,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 998244353; const int K = 80; const int N = 4010; int n, m, k, C[K][K], vtx[2 * N], v_cyc[K][N], e_cyc[K][2 * N], trip[2][K], ans; vector<int> g[N]; int main() { cin >> n >> m >> k; if (k & 1) { cout << "0\n"; return 0; ...
C++
45e715b158cf0dba7798fc68f04b075a
edfc86b54e717132b0852bcbcfa1eebe
2,900
PASSED
#include<iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main() { ll n; cin>>n; ll a[n+5]={0}; for (int i=0; i<n; i++) { cin>>a[i]; } sort(a,a+n); vector<ll> A; A.push_back(a[0]); for (int i=1; i<n; i++) if(a[i]!=a[i-1]) A.push_back(a[i]); if(A.size()==1 ...
C++
27f837609b2777cefccb13aa4596d91c
c1fc99eaf05c69cfbfa90bcc551d610a
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int64_t n,i,j,count=0; cin>>n; int64_t a[n+5],b[5]; for(i=0,j=0; i<n; i++)cin>>a[i]; sort(a,a+n); for(i=0; i<n; i++){ if(a[i]!=a[i+1]){ b[++j]=a[i]; } if(j>3){ cout<<"NO"<<endl; ...
C++
27f837609b2777cefccb13aa4596d91c
95ab2f993d8085d7965d374eccff07e1
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int64_t n,i,j,count=0; cin>>n; int64_t a[n+5],b[5]; for(i=0,j=0; i<n; i++)cin>>a[i]; sort(a,a+n); for(i=0; i<n; i++){ if(a[i]!=a[i+1]){ b[++j]=a[i]; } if(j>3){ cout<<"NO"<<endl; ...
C++
27f837609b2777cefccb13aa4596d91c
9667b148fc59abd47ecd7b326405fd8d
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int64_t n,i,j,count=0; cin>>n; int64_t a[n+5],b[5]; for(i=0,j=0; i<n; i++)cin>>a[i]; sort(a,a+n); for(i=0; i<n; i++){ if(a[i]!=a[i+1]){ b[++j]=a[i]; } if(j>3){ cout<<"NO"<<endl; ...
C++
27f837609b2777cefccb13aa4596d91c
778f6d5d3b0b88006bc2d0cb0768f0ce
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int64_t n,i,j,count=0; cin>>n; int64_t a[n+5],b[5]; for(i=0,j=0; i<n; i++)cin>>a[i]; sort(a,a+n); for(i=0; i<n; i++){ if(a[i]!=a[i+1]){ b[++j]=a[i]; } if(j>3){ cout<<"NO"<<endl; ...
C++
27f837609b2777cefccb13aa4596d91c
67e33b6c9b5a44cb7c30f86bb897f846
1,200
PASSED
#include<bits/stdc++.h> #include<iostream> #include<stack> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef pair<int, string > is; typedef pair<string, string > ss; typedef vector<ii> vii; typedef set<int> si; typedef map<string, int> msi; #define pb push_back #d...
C++
27f837609b2777cefccb13aa4596d91c
48df496ff13fc202c47b543f39245c51
1,200
PASSED
/* Name : Mohit Khare B.Tech 2nd Year Computer Science and Engineering MNNIT Allahabad */ #include <bits/stdc++.h> using namespace std; #define F(i,a,b) for(int i = (int)(a); i < (int)(b); i++) #define RF(i,a,b) for(int i = (int)(a); i > (int)(b); i--) #define ll long long int #define ull unsigned long long int #...
C++
27f837609b2777cefccb13aa4596d91c
b0f67e231d5d89c1a487c6dab87bb17b
1,200
PASSED
#include <bits/stdc++.h> #define _for(i,a,b) for (int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_) #define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i) #define _all(v) v.begin(), v.end() using namespace std; typedef long long LL; typedef unsigned long long ULL; template<typename T> vector<T>...
C++
27f837609b2777cefccb13aa4596d91c
a5e5cecfe64446e928ca2f4572215172
1,200
PASSED
#include<iostream> #include<vector> #include<algorithm> using namespace std; long a,b,i,j,n; vector<long>v; vector<long>vec; int main() { cin>>n; for(i=0;i<n;i++) { cin>>j; v.push_back(j); } j=1; sort(v.begin(),v.end()); for(i=1;i<n;i++) { if(v[i]!=v[i-1]) j++; } if(j<3) cout<<"YES"<<endl; else if(j>3) cout<<"NO"<<...
C++
27f837609b2777cefccb13aa4596d91c
f68c40cf6072eba1a1486dc493b44d7b
1,200
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef long double ldb; #define fi first #define se second #define pb push_back #define mkp make_pair #define all(v) (v).begin(),(v).end() #define dbg(a) cout << #a << " = " << a << endl int main() { ios_base::sync_with...
C++
27f837609b2777cefccb13aa4596d91c
fc3655ddf02d9eb01853ceb691cdb80f
1,200
PASSED
#include <vector> #include <stdio.h> #include <string.h> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include ...
C++
20cbd67b7bfd8bb201f4113a09aae000
2e22fedf79ccdcc049c87fb6bf6bc364
1,900
PASSED
#include <iostream> #include <vector> #include <map> #include <cstdlib> #include <fstream> #include <queue> #include <cstdio> #include <algorithm> #define x first #define y second #define now q.front() using namespace std; string s; int i,j,m,n,o,p,a,b,pas[100][100],ok,t,k,maxi=0,mini=1000000000,c[30001]; int v[30001],...
C++
20cbd67b7bfd8bb201f4113a09aae000
1f37552521cf2094f978cbda2230fa51
1,900
PASSED
#include<bits/stdc++.h> #define N 30005 using namespace std; int n, d, ans = 0, a[N], f[N+300][500]; inline int read() { int red = 0, f_f = 1; char ch = getchar(); while(ch>'9'||ch<'0') {if(ch == '-') f_f = -1; ch = getchar();} while(ch>='0'&&ch<='9') red = red * 10+ch-'0', ch = getchar(); return red * f_f; } int...
C++
20cbd67b7bfd8bb201f4113a09aae000
a201b0f6b000d8a1adb7576491dd31e6
1,900
PASSED
// _ooOoo_ // o8888888o // 88" . "88 // (| -_- |) // O\ = /O // ____/`---'\____ // . ' \\| |// `. // / \\||| : |||// \ /...
C++
608b152c0c15bf0a41465bfa7fa41866
9a55a90c51c94dd1314fe1762c898e05
2,900
PASSED
/// In The Name Of Allah // Mohammad Hosseini #include <bits/stdc++.h> #define ss second #define ff first #define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define se(n) cout << setprecision(n) << fix...
C++
608b152c0c15bf0a41465bfa7fa41866
48322764c5b91fa15e668c9ae1b4c1a3
2,900
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <queue> #define N 101000 #define MP make_pair #define PLL pair<ll, ll> typedef long long ll; template<typename T> inline void read(T &x) { x = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdi...
C++
608b152c0c15bf0a41465bfa7fa41866
1775fabcdcfda8b3a1000c2e32ca6382
2,900
PASSED
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") //#pragma GCC optimize("Os") using namespace std; #define sync() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define F first #define S second #define mp make_pair #define ers erase #define ins insert #define...
C++
608b152c0c15bf0a41465bfa7fa41866
b8ec3fbd7fd3a226674b97d737a39108
2,900
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <string> #include <cstring> #include <cmath> #include <set> #include <map> #include <cstdio> #include <stdlib.h> #include <stack> #include <numeric> #include <bitset> #include <cctype> #include <list> #include <assert.h> #include <rand...
C++
608b152c0c15bf0a41465bfa7fa41866
529a18fcb3a25d3b4eb18b728dd7437c
2,900
PASSED
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define Mp make_pair #define pb push_back using ll = long long; using db = double; using pii = pair<int, int>; using vi = vector<int>; const int N = 101000; int n, m, k; ll p, h[N], a[N]; bool chk(ll x) { priority_queue<pii, vector<p...
C++
608b152c0c15bf0a41465bfa7fa41866
f2886f9cf8a1b9369ba358e410813b64
2,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int n,m,K,p,h[100010],a[100010]; class bam { public: ll day; int id; bool operator <(const bam &x)const { return day>x.day; } }; priority_queue<bam> q; int f[100010]; bool check(ll x) { while(!...
C++
608b152c0c15bf0a41465bfa7fa41866
6e9c4fa2f213941b9d4607812fe93ebe
2,900
PASSED
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; typedef long long ll; typedef long double ld; typedef complex...
C++
608b152c0c15bf0a41465bfa7fa41866
678e8bb818ac251d1e0dbc2f0e360ae0
2,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=100100; int n,k,m,p; ll b[N]; pair<int,int>a[N]; set<pair<ll,int> >S; bool chk(ll x){ ll sum=0; for(int i=1;i<=n;++i){ b[i]=x; ll ret=(a[i].first-(b[i]-(ll)m*a[i].second));ret=max(ret,0ll); sum+=(ret+p-1)/p; } if(sum>m*k)return 0; ...
C++
608b152c0c15bf0a41465bfa7fa41866
eb2e190bfe9362e13655096fde49e3b2
2,900
PASSED
#include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #include<cmath> #include<queue> #include<vector> #include<ctime> #include<map> #include<bitset> #define LL long long #define mp(x,y) make_pair(x,y) using namespace std; inline int read() { int f=1,x=0;char ch=getchar(); while(ch<'0'||ch>'9'){if(...
C++
608b152c0c15bf0a41465bfa7fa41866
45b08556ac00ac28acd2132641000ff4
2,900
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> using namespace std; typedef long long ll; struct Node{ int l,r,id; }node[200100]; int a[201000],M; ll ans[201000]; ll cnt[1001000]; ll tc[2000100]; ll sum; bool cmp(Node a,Node b){ int x = a.l/M; int y = b.l/M; if...
C++
82e3538887746bc83d1098b4380db64b
29afb46f54913b8f7c97a95b33239d61
2,200
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> using namespace std; typedef long long ll; struct Node{ int l,r,id; }node[200100]; int a[201000],M; ll ans[201000]; ll cnt[1001000]; ll tc[2000100]; ll sum; bool cmp(Node a,Node b){ int x = a.l/M; int y = b.l/M; if...
C++
82e3538887746bc83d1098b4380db64b
05ca73d56546471a1b07d5aff9e3c004
2,200
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> using namespace std; typedef long long ll; struct Node{ int l,r,id; }node[200100]; int a[201000],M; ll ans[201000]; ll cnt[1001000]; ll tc[1000100]; ll sum; bool cmp(Node a,Node b){ int x = a.l/M; int y = b.l/M; if...
C++
82e3538887746bc83d1098b4380db64b
690a2506a6557cdb33c39d35f740a9fa
2,200
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> using namespace std; typedef long long ll; struct Node{ int l,r,id,x; }node[200100]; int M; ll a[201000]; ll ans[201000]; int cnt[1001000]; ll sum; bool cmp(Node a,Node b){ if(a.x != b.x) return a.x < b.x; else return ...
C++
82e3538887746bc83d1098b4380db64b
4858cba2ee42fb5ced1d0016a4e58794
2,200
PASSED
#include <iostream> #include <string> #include <string.h> #include <cstdlib> #include <cmath> #include <cstdio> #include <stdio.h> #include <algorithm> #define mx 200001 using namespace std; typedef long long lli; int n, t, m; lli a[mx], k[1000001]; lli rslt[mx]; struct query{ int l, r, p; }q[mx]; bool cmp(query x, ...
C++
82e3538887746bc83d1098b4380db64b
53b35a1810dfdf97f8fab39da63554d2
2,200
PASSED
#include <iostream> #include <string> #include <string.h> #include <cstdlib> #include <cmath> #include <cstdio> #include <stdio.h> #include <algorithm> #define mx 200001 using namespace std; typedef long long lli; int n, t, m, a[mx], k[1000001]; lli rslt[mx]; struct query{ int l, r, p; }q[mx]; bool cmp(query x, quer...
C++
82e3538887746bc83d1098b4380db64b
e0475e563e52bebc06103c7e1c2eb4a1
2,200
PASSED
#include <iostream> #include <string> #include <string.h> #include <cstdlib> #include <cmath> #include <cstdio> #include <stdio.h> #include <algorithm> #define mx 200001 using namespace std; typedef long long lli; int n, t, m; lli a[mx], k[1000001]; lli rslt[mx]; struct query{ int l, r, p; }q[mx]; bool cmp(query x, ...
C++
82e3538887746bc83d1098b4380db64b
a246817bbb99ef4fdf8c11aea03a3e74
2,200
PASSED
//Abinash Ghosh(Om) #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <cstring> #include <climits> #include <iostream> #include <iomanip> #include <vector> #include <list> #include <stack> #include <queue> #include <map> #include <set> #include <string> #include <utility> #include <sstrea...
C++
82e3538887746bc83d1098b4380db64b
6f5328f847bbfa2c92cb99673b3aca3c
2,200
PASSED
//Abinash Ghosh(Om) #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <cstring> #include <climits> #include <iostream> #include <iomanip> #include <vector> #include <list> #include <stack> #include <queue> #include <map> #include <set> #include <string> #include <utility> #include <sstrea...
C++
82e3538887746bc83d1098b4380db64b
b3d8e5dd0afafedf8f647fd5003d9298
2,200
PASSED
//Abinash Ghosh(Om) #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <cstring> #include <climits> #include <iostream> #include <iomanip> #include <vector> #include <list> #include <stack> #include <queue> #include <map> #include <set> #include <string> #include <utility> #include <sstrea...
C++
82e3538887746bc83d1098b4380db64b
ce70b9333c29e02045f70f7b2f8c90f7
2,200
PASSED
def main(): a=[0]*10 n=int(input()) s=input() for i in range(n): if s[i]=="L": a[a.index(0)]=1 elif s[i]=="R": a[9-a[::-1].index(0)]=1 else: a[int(s[i])]=0 print(''.join(map(str,a))) main()
Python
a6cbf01d72d607ca95fe16df4fb16693
603a855b805e773e8850825f9928c3ef
800
PASSED
def main(): n = int(input()) s = input() ans = 0 for i in s: if(i == 'L'): j = 9 while(j >= 0): if((ans & (1 << j)) == 0): ans |= (1 << j) break j -= 1 elif(i == 'R'): j = 0 ...
Python
a6cbf01d72d607ca95fe16df4fb16693
dfba23efbf67c9ba764b1d288dd3717d
800
PASSED
def hotel(string): values=['0']*10 for i in range(len(string)): if string[i]=='L': for i in range(len(values)): if values[i]=='0': values[i]='1' break elif string[i]=='R': for j in range(len(values)-1,-1,-1): ...
Python
a6cbf01d72d607ca95fe16df4fb16693
bda697de6f8959561e13b3bb045e67d5
800
PASSED
''' Auther: ghoshashis545 Ashis Ghosh College: jalpaiguri Govt Enggineering College ''' from os import path import sys from heapq import heappush,heappop from functools import cmp_to_key as ctk from collections import deque,defaultdict as dd from bisect import bisect,bisect_left,bisect_right,insort,insort_lef...
Python
a6cbf01d72d607ca95fe16df4fb16693
6ffbe79d9a661a3bc84542b057f1a723
800
PASSED
n = int(input()) log = input() left = 0 right = 9 hotel = [0] * 10 for l in log: if l == 'L': for i in range(10): if hotel[i] == 0: left = i break hotel[left] = 1 elif l == 'R': for i in range(9, -1, -1): if hotel[i] == 0: ...
Python
a6cbf01d72d607ca95fe16df4fb16693
6037907c1fb06b6189f7a20cf369858e
800
PASSED
n = int(input()) s = input() ans = list("0"*10) for i in s: if(i == 'L'): for j in range(10): if(ans[j] == '0'): ans[j] = '1' break elif i == 'R': for j in range(9, -1, -1): if(ans[j] == '0'): ans[j] = '1' br...
Python
a6cbf01d72d607ca95fe16df4fb16693
56ee7c9f18b0e98f1038e1ce65a3e50c
800
PASSED
def convert(list): # Converting integer list to string list # and joining the list using join() res = ''.join([str(i) for i in list]) return res n=int(input()) events=input() rooms=[0]*10 for e in events: if(e=='L'): index=rooms.index(0) rooms[index]=1 elif(e=='R'): ...
Python
a6cbf01d72d607ca95fe16df4fb16693
98f5816a66334cae5ab31161d327e35c
800
PASSED
n=int(input()) ch=input() b=[0]*10 for e in ch: if e=='L': i=b.index(0) b[i]=1 elif e=='R': b.reverse() i=b.index(0) b[i]=1 b.reverse() else: b[int(e)]=0 ch='' for e in range(10): ch+=str(b[e]) print(ch)
Python
a6cbf01d72d607ca95fe16df4fb16693
ca9743d2749659c64eb4bc60e088e5e4
800
PASSED
n = int(input()) s = input() k = [0,0,0,0,0,0,0,0,0,0] for i in range(n): if s[i] == 'L': for j in range(10): if k[j] != 1: k[j] = 1 break elif s[i] == 'R': for j in range(9, -1, -1): if k[j] != 1: k[j] = 1 break else: k[int(s[i])] = 0 for i in k: print(i...
Python
a6cbf01d72d607ca95fe16df4fb16693
1b14d36533c4501cfc831313895e6c0e
800
PASSED