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 <vector> #include <cmath> #include <algorithm> #include <set> #include <map> using namespace std; typedef long long int ll; int main() { int t, n, x; set<int>a; cin >> t; for (int c = 1; c <= t; c++) { cin >> n; int k = 0; for (int i = 1; i <= n; i++) { cin >> x; a.insert(x...
C++
afcd41492158e68095b01ff1e88c3dd4
824c3acfd7c92a98610dc757ec75f0aa
1,200
PASSED
#include <iostream> #include <set> using namespace std; int main() { set <int> a; int t, n, e, m, j; cin >> t; for (int it = 0; it < t; it++) { a.clear(); cin >> n; for (int i = 0; i < n; i++) { cin >> e; a.insert(e); } j = 0; while (!a.empty()) { m = *--a.end(); a.erase(m); if (m % 2 ==...
C++
afcd41492158e68095b01ff1e88c3dd4
d8905701554763998741296f9eb7c25a
1,200
PASSED
#include <vector> #include <algorithm> #include <queue> #include <set> #include <iostream> #include <tuple> #include <string> using namespace std; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); ll t; cin >> t; while (t--) { ll n; cin >> n; set<ll> oddNums; for (ll i = 0; i ...
C++
afcd41492158e68095b01ff1e88c3dd4
57ec9cf75bbe590025455561d98b3d5b
1,200
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <math.h> #include <iomanip> #include <fstream> #include <string> #include <queue> #include <set> #include <unordered_map> #include <unordered_set> #include <tuple> #include <sstream> using namespace std; int main() { int t; cin >> t; for (int k = ...
C++
afcd41492158e68095b01ff1e88c3dd4
cbc21460f842d18575e9af35e4873c16
1,200
PASSED
#include <iostream> #include <iomanip> #include <fstream> #include <string> #include <vector> #include <algorithm> #include <set> #include <cmath> #include <stack> #include <map> #include <queue> #include <deque> #include <bitset> #include <cassert> #define int long long using namespace std; typedef pair<int, int> ii; ...
C++
afcd41492158e68095b01ff1e88c3dd4
4007a4281f676991b8c162fea8828d99
1,200
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> using namespace std; typedef long long int ll; ll n; vector<pair<ll, ll>>fac; vector<int>a; void f(int i) { ll b; b = a[i]; ll k = 0; while (b % 2 == 0) { b = b / 2; k++; } fac[i].first = b; fac[i].second = k; } bool...
C++
afcd41492158e68095b01ff1e88c3dd4
18b19dd7284597b8296d70a2f71827f2
1,200
PASSED
#include <iostream> #include <string> #include <cmath> #include <algorithm> #include <functional> #include <vector> #include <map> #include <set> #include <queue> #include <stack> using namespace std; typedef long long int ll; ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } int main() { int t; cin >> t...
C++
afcd41492158e68095b01ff1e88c3dd4
47ac4b081c37b26d8d354f25ca8ef0a8
1,200
PASSED
#include <iostream> #include <iomanip> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <deque> #include <functional> #include <queue> #include <set> #include <map> using namespace std; int main() { int t; cin >> t; for (int q = 0; q < t; ++q) { int n; cin >> n; vector<long ...
C++
afcd41492158e68095b01ff1e88c3dd4
2d5b814cc8b5aaeb3455e2c2b8751152
1,200
PASSED
#include <iostream> #include <string> #include <cmath> #include <ctime> #include <algorithm> #include <vector> #include <unordered_set> using namespace std; class LongPlus { public: long long num; long long binum; LongPlus(long long a) { num = a; int k = 0; binum = 0; while (a != 0) { if (a & 1 == 1) ...
C++
afcd41492158e68095b01ff1e88c3dd4
8a9b3229490e569be005d58e0b6fc727
1,200
PASSED
#include <iostream> #include <map> #include <algorithm> using namespace std; pair <long long, long long> deltwo(long long x) { long long k = 0; while (x % 2 == 0 && x > 0) { x /= 2; k++; } return (make_pair(x, k)); } int main() { long long t = 0, n = 0, a = 0, mx = 0, ans = 0; map <long long, long long> M;...
C++
afcd41492158e68095b01ff1e88c3dd4
fc693d5024c57d7863fc297e799c8d02
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define endl '\n' #define ll long long #define f first #define s second #define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0) #define debug(x) cout << "DEBUG " << x << endl #define debug2(x, y) cout << "DEBUG " << x << " " ...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
1c6224b695a4a367c10400b50097d14c
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int NMAX = 1e5 + 10; int n,m,r,viz[NMAX],marked[NMAX],dist[NMAX]; vector < int > v[NMAX], discovered; void dfs(int node){ discovered.push_back(node); viz[node] = 1; for(auto it: v[node]){ if(!viz[it]){ dist[it] = dist[node] + 1; ...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
3cedf74b5562509ec671eff2cf1ddbb9
2,500
PASSED
#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> const int N = 2e5 + 5; using namespace std; int n, m, tag[N], pa[N], dep[N], head[N], cnte, cnt; struct edge { int to, nxt; } e[N << 1]; template < typename T > inline T read() { T x = 0, w = 1; char c = getchar(); while(c < '0' || c > ...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
0ed5523ed63c90b09c1c48c3c3cc830d
2,500
PASSED
#include<bits/stdc++.h> using namespace std; #define cs const #define int long long #define low(i) (i&(-i)) #define mid ((l+r)>>1) #define ls (now<<1) #define rs (now<<1|1) #define par pair<int,int> #define mp make_pair #define fr first #define se second #define rep(i, x, y) for(int i=x; i<=y; ++i) #define drep(i, x,...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
6381a2f8f78c8ac96a1029ac33d5bdc2
2,500
PASSED
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; const int N = 3e5 + 5000; int n, m, first[N], nxt[N * 2], to[N * 2], len, d[N], inq...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
59dd6679c7c8a9e51db42e7665cbf731
2,500
PASSED
/* no pain, no gain */ #pragma GCC optimize ("Ofast") #pragma GCC target ("avx,avx2,fma") #include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define szof(s) (int)s.size() #define all(s) s.begin(), s.end() #define pii pair<int, int> #define all(s) s.begin(), s.end() #define prev myrza432...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
81139fe41582d01f93e77795ef7e668f
2,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,int>pii; typedef vector<int> vi; #define rep(i,a,b) for(int i=(a);i<(b);i++) #define fi first #define se second #define de(x) cout<<#x<<"="<<x<<"\n" #define dd(x) cout<<#x<<"="<<x<<" " #define pb(x) push_back(x) #define all(x) x.begin(),...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
f74817e95d9bfc60397d01684a1be369
2,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,int>pii; typedef vector<int> vi; #define rep(i,a,b) for(int i=(a);i<(b);i++) #define fi first #define se second #define de(x) cout<<#x<<"="<<x<<"\n" #define dd(x) cout<<#x<<"="<<x<<" " #define pb(x) push_back(x) #define all(x) x.begin(),...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
8c30876c2431f811c23e18ae67a35e49
2,500
PASSED
//#include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<set> #include<vector> #include<list> #include<queue> #include<cmath> #include<cstring> #include<sstream> #include<cstdio> #include<ctime> #include<map> #include<bitset> #include<stack> #include<string> using namespace std; //#define getchar() (p1...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
f74abcbd136bb3f39e7b5d9004087a75
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define mx 200005 vector<int>g[mx]; int dis[mx],par[mx]; bool vis[mx]; int sq; void call(int u, int v){ cout<<2<<"\n"<<dis[u]-dis[v]+1<<"\n"; while(u!=v){ cout<<u<<" "; u=par[u]; } cout<<u<<endl; } vector<int>visited_order; void dfs(in...
C++
f9ffc3ccb320c7a4ea95cbcca95f1abf
976e2a22161672412db270d435c2d394
2,500
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <vector> using namespace std; struct Edge{ int from, to, v; Edge(int a, int b, int c) : from(a), to(b), v(c) {} bool operator < (const Edge &e) const { return v < e.v; } }; i...
C++
a5363163c1c2dfed91947a582ac28bda
7f91e57f65aa23fdbeb775ddc2a13fba
1,900
PASSED
#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; const ll INF = 1e17; int n,vis[2005],use[2005],fa[2005],change[20005]; ll d[2005][2005],dis[2005]; int work(){ for(int i=2;i<=n;i++) {dis[i] = d[1][i];fa[i] = 1;} int pos ...
C++
a5363163c1c2dfed91947a582ac28bda
4aa26b9c376de3f80ad6f72990a6d7db
1,900
PASSED
///////////////////////////////////////////////// IN THE NAME OF GOD #include <iostream> #include <vector> #include <stack> #include <string> #include <algorithm> #include <cmath> #include <set> #include <queue> #include <map> #include <fstream> #include <utility> #include <sstream> #include <list> #include <iomanip...
C++
a5363163c1c2dfed91947a582ac28bda
3419217d3477ad021fca3b1e9bcc3e9f
1,900
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <cstdio> #include <cstdlib> using namespace std; typedef long long ll; const int MAXN = 2000; int inp_dist[MAXN][MAXN]; int d[MAXN][MAXN]; bool used[MAXN]; int p[MAXN]; int w[MAXN]; vector <vector <pair <int, int> > > g; struct Edge...
C++
a5363163c1c2dfed91947a582ac28bda
58048c83943687c7b67581b0efab2256
1,900
PASSED
#define VERBOSE #define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <fstream> #include <bitset> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #inc...
C++
a5363163c1c2dfed91947a582ac28bda
2d0e35cccab0c90209a0dd4e9ddd3c46
1,900
PASSED
#define VERBOSE #define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <fstream> #include <bitset> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #inc...
C++
a5363163c1c2dfed91947a582ac28bda
6d4e9e83f195dac7760a31d401f1e9cc
1,900
PASSED
#include <vector> #include <queue> #include <map> #include <cmath> #include <utility> #include <queue> #include <algorithm> #include <limits> #include <set> #include <iostream> #include <string> using namespace std; int n; vector<vector<int> > A,A2; vector<vector<int> > Nearest; vector<int> Visited,P,L; vector<vector<...
C++
a5363163c1c2dfed91947a582ac28bda
ff9776de300b37cef5172f86a61da9cc
1,900
PASSED
#include <vector> #include <queue> #include <map> #include <cmath> #include <utility> #include <queue> #include <algorithm> #include <limits> #include <set> #include <iostream> #include <string> using namespace std; int n; vector<vector<int> > A; vector<vector<int> > Nearest; vector<int> Visited,P,L; vector<vector<int...
C++
a5363163c1c2dfed91947a582ac28bda
502ac3cc2dd3cf581b9d756cda93a22e
1,900
PASSED
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using name...
C++
a5363163c1c2dfed91947a582ac28bda
e20770f43a89762576f33e59392b85f5
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <utility> #include <algorithm> #include <string> #include <vector> #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> ii; // globals const int MAX_N = 2050; int n; ll ds[MAX_N][MAX_N]; vector<int> m[MAX_N]; bool visit[M...
C++
a5363163c1c2dfed91947a582ac28bda
5f20397147a3e6eeb3089450f7f36fca
1,900
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { int q; int h, n; int *p; scanf("%d", &q); for(int j = 0; j < q; ++j) { scanf("%d%d", &h, &n);; p = calloc(n + 1, sizeof(*p)); for(...
C
d0c50562764f2008045fe57e5da5de1c
33ddc916be4d64d917b8edebbf32eb5c
1,600
PASSED
#include <stdio.h> int P[200002]; int main() { int i; int Q; int h, n; char F; int R; scanf("%d", &Q); while (Q--) { scanf("%d %d", &h, &n); for (i = 0; i < n; i++) { scanf("%d", &P[i]); } P[n] = 0; P[n + 1] = 0; F = 0; ...
C
d0c50562764f2008045fe57e5da5de1c
813254676e1bd165a0f2109d8db802af
1,600
PASSED
#include <stdio.h> int outPlatforms[200001]; int main() { int q; scanf("%d", &q); while (q--) { int h, n; scanf("%d %d", &h, &n); int count1; for (count1 = 0; count1 < n; count1++) { scanf("%d", &outPlatforms[count1]); } outPlatforms[n] = 0; int counter = 0; for (count1 = 1; count1 < n; coun...
C
d0c50562764f2008045fe57e5da5de1c
8d5f1de9387d0eb719228c6e1203b549
1,600
PASSED
/* practice with Dukkha */ #include <stdio.h> int main() { int q; scanf("%d", &q); while (q--) { int h, n, i, h_, p, cnt; scanf("%d%d%d", &h_, &n, &h_), h_++; cnt = 0, p = 0; for (i = 1; i < n; i++) { scanf("%d", &h); if (h_ - h > 1) { if (p == 1) cnt++; else p = 1; } else p...
C
d0c50562764f2008045fe57e5da5de1c
d4d1cbed80ca38c2139494ca3f9099e6
1,600
PASSED
int q,h,n,c,d,x;main(){for(scanf("%d",&q);q--;){scanf("%d%d",&h,&n);for(c=1,d=0;n--;){scanf("%d",&x);if(h-x>1)d+=c,c=0;c^=1;h=x;}printf("%d ",d+c*(x>1));}}
C
d0c50562764f2008045fe57e5da5de1c
520ca54570ac9658147dba8a6e091622
1,600
PASSED
#include <stdio.h> struct _g_data { int size, bot; } typedef gd; int list[200005]; gd group[200005]; int main(void) { int q = 0; scanf("%d", &q); while (q--) { int h = 0, n = 0, gcnt = 0, result = 0; scanf("%d%d", &h, &n); for (int i = 0, x; i < n; i++) { scanf("%d", &list[i]); } list[n] = 0;...
C
d0c50562764f2008045fe57e5da5de1c
64b3ccaf6fc09079860cdafacc6c705c
1,600
PASSED
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int h,n; scanf("%d%d",&h,&n); int ar[200001]; int i; for(i=0;i<n;i++) scanf("%d",&ar[i]); int count=0; int curr = h; int index = 1; if(n==1) { printf("0\n"); continue; } while(curr>=3) { if(ar[index]!=curr-1) ...
C
d0c50562764f2008045fe57e5da5de1c
6a9064854e457a0e5e7e5f8795d21d89
1,600
PASSED
#include<stdio.h> int arr[200005], h, n; int main(){ int q; scanf("%d", &q); while(q--){ int i; scanf("%d %d", &h, &n); for(i = 0;i < n;i++)scanf("%d", arr + i); int ans = 0; i = 0; while(i < n - 2){ if(arr[i + 1] == arr[i + 2] + 1)i += 2; else{ i++;ans++; } } ...
C
d0c50562764f2008045fe57e5da5de1c
28c3199c8a5e28a3d6f4bb149aa0a4c6
1,600
PASSED
using System; using System.Linq; using System.Collections.Generic; using Debug = System.Diagnostics.Trace; using SB = System.Text.StringBuilder; using static System.Math; using static System.Numerics.BigInteger; using static Program.IO.Scanner; using Number = System.Int64; #region IO namespace Program.IO { using Sys...
C#
d0c50562764f2008045fe57e5da5de1c
8fcba3cd3896f8c177675107bdf5dc0d
1,600
PASSED
using System; using System.Collections.Generic; namespace Problems { class Program { static void Main(string[] args) { int q = Convert.ToInt32(Console.ReadLine()); while (q-- > 0) { long h; int n; string[] in...
C#
d0c50562764f2008045fe57e5da5de1c
689210d9e66791d5bd329704ea05a7ab
1,600
PASSED
#include <iostream> #include <cctype> #include <bits/stdc++.h> using namespace std; typedef long long ll; ll recurse(int i,int count[100001]); ll dp[100005]; ll recurse(ll i,ll count[100001]) { if(dp[i]!=-1) return dp[i]; else if(i==1) return dp[1]=count[1]; else if(i==0) return dp[0]=0...
C++
41b3e726b8146dc733244ee8415383c0
292dfb6ebc4d9927afd5a961d3158436
1,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define mx 100005 ll dp[mx]; ll cnt[mx] = {0}; int main() { ll i,n; cin>>n; // vector<ll> ar(n); // ll cnt[mx]={0}; for(i=0;i<n;i++) { ll x; cin>>x; cnt[x]++; } dp[0] = 0; dp[1] = cnt[1]; ...
C++
41b3e726b8146dc733244ee8415383c0
b57d82ca02f60b432cd44b9cf5b473d2
1,500
PASSED
#include <iostream> #include <string> #include <cmath> #include <cstdio> #include <vector> #include <algorithm> #define For(x,y) for(int i = x;i < y;i++) typedef long long ll; using namespace std; int n, a[100005] = {0}, b[100005] = {0}; long long f[100005] = {0}, ans = 0; int main() { scanf("%d", &n); for (int i =...
C++
41b3e726b8146dc733244ee8415383c0
1e88498654ebcec25547e1aae62a7afe
1,500
PASSED
#include <iostream> #include <string> #include <cmath> #include <cstdio> #include <vector> #include <algorithm> #define For(x,y) for(int i = x;i < y;i++) typedef long long ll; using namespace std; ll dp[100005],ans[100005],a[100005]; int n; int main(){ cin >> n; For(1,n + 1 ){ scanf("%d",&a[i]); ...
C++
41b3e726b8146dc733244ee8415383c0
72771f002c3ba86578bff86bdf10cc75
1,500
PASSED
#include <bits/stdc++.h> using namespace std; int main () { ios_base::sync_with_stdio (false); cin.tie (); long long n; cin >> n; long long a[n], dp[n+1], mxnum = INT_MIN; for (long long i = 0; i < n; i++) { cin >> a[i]; mxnum = max (mxnum, a[i]); ...
C++
41b3e726b8146dc733244ee8415383c0
b0913cfc68674efbde6a5e23260c829f
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define ll unsigned long long #define inf (ll)1e5 ll n, a[inf]; map<pair<ll,ll>, ll> m; ll total(ll freq[], ll i){ //base case if(i == n){ return 0; } //recursive case if(m.count(make_pair(a[i], freq[a[i]]))){return m[make_pair(a[i], freq[a[i]])];} ll op1 = total...
C++
41b3e726b8146dc733244ee8415383c0
7f77604c4796b40ddf61176be5e3f1ee
1,500
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int Maxx = 1e5+5; ll freq[Maxx]; int n; ll mem[Maxx]; ll dp(int i) { if(i>=Maxx) return 0; if(mem[i]!=-1) retur...
C++
41b3e726b8146dc733244ee8415383c0
b72a1b1afc15c4a37ad5135438be7b7f
1,500
PASSED
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define ll long long #define ull unsigned long long #define all(a) (a.begin()),(a.end()) #define ZERO(a) meset(a,0,sizeof(a)) #define FOR(x,val,to) for(int x=(val);x<int((to));x++) #define FORE(x,val,to) for(auto x=(val);x<=(to);x++) #define FORR(x,arr)...
C++
41b3e726b8146dc733244ee8415383c0
132a572316e1f7bec2b9d0d30ad2a34b
1,500
PASSED
// // main.cpp // Boredom // // Created by SRIJAN SONI on 17/08/18. // Copyright © 2018 SRIJAN SONI. All rights reserved. // #include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define Max(x,y,z) max(x,max(y,z)) #define Min(x,y,z) min(x,min(y...
C++
41b3e726b8146dc733244ee8415383c0
559197cd8905e662336c384837918b60
1,500
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; const int N=1e5+5,OO=0x3f3f3f3f; ll n,ans1=0,ans2=0; ll a[N]; map<ll,ll> b,c; vector<pair<ll,ll> > v; bool vis[N]; int main() { cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; b[a[i]]+=a[i]; } for(int i=2;i<=100000;i++){ ...
C++
41b3e726b8146dc733244ee8415383c0
73dea71fc1b28a25cb604a985f43a0c1
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define se second #define fi first #define pb push_back const int N=1e5 + 5,M=1e9 + 7; ll l[10],v[10]; vector<pair<int, string> > qq; ll P(ll n,ll p){ if(p == 0) return 1; if(p == 1) return n; ll m=P(n,p / 2); m=(m * m) % M; if(p & 1) m=(m * n) %...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
3cc95b66b8b615632a0766965e72d4d6
2,100
PASSED
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <set> #include <utility> #include <queue> #include <tuple> #define nfs ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long int #define pb push_back #define mp make_pair #define ff first #define ss second #def...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
8facb6d5dcf16afdfdb13ca67988b487
2,100
PASSED
#include<iostream> #include<cstdio> #define MN 100000 #define mod 1000000007 using namespace std; inline int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } char s[MN+5],t[MN+5],st[MN+5]; int n,len[20],c[...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
fdfd084c98a000fb4b5cb3678c4782ad
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1000000007; string s; char b[100010]; int n, a; pair<int, string> q[100010]; pair<ll, ll> dp[10]; ll fastPow(ll a , ll b) { if (!b)return 1ll; ll res = fastPow(a, b / 2); res = (res * res) % MOD; if (b & 1) return (res * a) ...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
53618e2fb2cc2eab25e3d11123a1ee41
2,100
PASSED
/* Today might be the chance to grasp the chance to let your talent bloom. May be tomorrow, the day after, or next year... May be even when you are 30. I'm not sure if physique has anything to do with it but if you think that it will never come, it probably never will. - Tooru Oikawa. */ #include <bits/stdc++.h>...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
5a2f33aa746875fa02aea63eaf8ae180
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; typedef map<ll,ll> M; #define MEM(a, b) memset(a, (b), sizeof(a)) //fill value #define FI(i, j, k, in) for (int i=j ; i<k ; i+=in) //from j till k increment by in FOR INT #define fl(i, j,...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
c4daf3d30bf51b6ba65712756ad31503
2,100
PASSED
#include <bits/stdc++.h> #define INF INT_MAX #define MAX_N 1005 #define sz 1e7+2 #define MOD 1000000007 #define vi vector<int> #define vlli vector < long long int > #define pb push_back #define tup tuple<string,int,int> #define mt make_tuple #define ulli unsigned long long int #define lli long long int #define ii pair<...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
456249430643b2a33648447401256497
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long typedef long long ll; const int mod = 1e9+7; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); /* set<int> seen; int number = 1; for(int i = 0; i < 1000000; ++i) { if(seen.count(number)) { ...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
6104fef6ecd31d63e75f774f655327fe
2,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef pair<int,int> pii; typedef pair<double, double> pdd; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vecto...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
6cf7384a5a973eb2479bc61965167cf0
2,100
PASSED
//#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("unroll-loops") #include <iostream> #include <stdlib.h> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include...
C++
c315870f5798dfd75ddfc76c7e3f6fa5
49e178e0c6a20b1974bc359b9152f89f
2,100
PASSED
#include <iostream> #include <bits/stdc++.h> #include<cstring> #include<math.h> #define ll long using namespace std; int main() {ios_base::sync_with_stdio(false); cin.tie(NULL); ll t; cin>>t; while(t--) {ll n; cin>>n;ll ans=n; for(ll i=0;i<n;i++){ for(ll j=0;j<n;j++){ if(n%2!=0){ if(i==...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
90bbb5adb6c973013dd3899bb58da893
900
PASSED
#include<bits/stdc++.h> #include<algorithm> #include<iostream> #include<math.h> using namespace std; typedef long long int ll; int isprime(int x) { int i,j,c;c=0; for(i=2;i<=sqrt(x);i++) { if(x%i==0) c++; } if(c==0) return 1; else if(c>0)return 0; } int main(){ ios_b...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
6f0cf8b72643cb61629c9ebfec1e45ec
900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define vt vector #define pb push_back int main() { ll a; cin >> a; for(int x =0; x < a;x ++) { int u; cin >> u; vector<vector<int>> matrix; vector<int> b; b.pb(1); b.pb(1); for(int i =...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
264fe5054874254e14f204979d6a9f35
900
PASSED
#include<iostream> #include<bits/stdc++.h> #include<vector> #include<cctype> #include<string> #include<algorithm> #include<stdint.h> using namespace std; #define max(a,b) (a<b?b:a) #define F(i,L,R) for (int i = L; i < R; i++) #define FE(i,L,R) for (int i = L; i <= R; i++) #define ll long long #define lli long long...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
11dceed71a519657e890c4bec9515cc4
900
PASSED
#include<iostream> using namespace std; int main() { int n = 0, t = 0; cin >> t; while (t) { cin >> n; for (int i = 0; i < n; i++) { if (i > 0)cout << "\n"; for (int j = 0; j < n; j++) { if (i == j)cout << 1 << " "; else if (j == n - i - 1)cout << 1 << " "; else if ( n%2 >0 && i == n / 2 - ...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
06dcd791da1d55c2b7fdecd22bf5214c
900
PASSED
/* Author : S7a2a7d */ #include <bits/stdc++.h> #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops") using namespace std; #define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL) #...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
4b36ac163e6ce33266aedbd025a748e7
900
PASSED
/* Author : S7a2a7d I never lose.I win or I learn */ #include <bits/stdc++.h> using namespace std; #define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL) #define pb push_back #define ll long long #define r(i,n) for(ll i=0;i<n;i++) #define repi(i,n) for(ll i=1;i<=n;i++) #define ...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
4bd22fdd643e3ab679fe49f2c264a63d
900
PASSED
/* Author : S7a2a7d */ #include <bits/stdc++.h> #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops") using namespace std; #define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL) #...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
391fb6a609c3f72dc990761c40f43aa0
900
PASSED
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #pragma GCC optimize("Ofast") //*********************************************DO IT NOW**************************************************************** #include<bits/stdc++.h> #include<random> #define int long long #define pp pair<int,int> #define ss second #...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
cf56ce92525e54b0ba3a196ca26295be
900
PASSED
#include <iostream> #include <iomanip> #include <algorithm> #include <vector> #include <cmath> #include <queue> #include <map> #include <set> #include <utility> #include <math.h> #include <string> #include <cstring> using namespace std; const double PI = acos(-1); const int N=1e3; const int M=10000007; typedef long l...
C++
df6ee0d8bb25dc2040adf1f115f4a83b
8ce95ce59f73237185638ac6623d72e5
900
PASSED
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in...
Java
290d9779a6be44ce6a2e62989aee0dbd
36c8705284060232dbff3d91ba7880da
1,300
PASSED
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; /** * * @author LENOVO Y520 */ public class cosmictables { /** * @param args the command line arguments * @...
Java
290d9779a6be44ce6a2e62989aee0dbd
06708807b63c99c75220b30ae0e47604
1,300
PASSED
import java.util.*; import java.io.*; import java.math.*; /* javac Main.java java Main <input.txt> output.txt */ public class Main { public static void process()throws IOException { int n=ni(); int m=ni(); int k=ni(); long arr[][]=new long[n][m]; int r[]=new int[n]; int c[]=new...
Java
290d9779a6be44ce6a2e62989aee0dbd
8c395f195fec39ae1be6b3a322f5968e
1,300
PASSED
import javax.swing.*; import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static int[] tree; static long m = 1000000007; public static void main(String[] args) throws IOException { //BufferedReader reader=...
Java
290d9779a6be44ce6a2e62989aee0dbd
f038fab895328c56d019026d83deefef
1,300
PASSED
import java.awt.*; import java.io.*; import java.math.BigInteger; import java.util.*; public class TaskC { static Long[][]dp; static int n, m, ans; static StringBuilder[]s1,s2; static int[]arr; public static void main(String[] args) throws Exception { ...
Java
290d9779a6be44ce6a2e62989aee0dbd
f1f17abccbd40c262b06b31128c50314
1,300
PASSED
import java.util.*; import java.io.*; public class A2OJ { public static class FastIO { BufferedReader br; BufferedWriter bw; StringTokenizer st; public FastIO() { br = new BufferedReader(new InputStreamReader(System.in)); bw = new BufferedWriter(new OutputStreamWriter(System.out)); st = new Strin...
Java
290d9779a6be44ce6a2e62989aee0dbd
a12729f0bbe93dc35c16f56ff4fc767b
1,300
PASSED
import java.io.*; import java.util.*; public class main { static StringBuilder out=new StringBuilder(); static FastReader in=new FastReader(); public static void main(String []args){ int n=in.nextInt(), m=in.nextInt(), k=in.nextInt(); int arr[][]=new int[n][m]; ...
Java
290d9779a6be44ce6a2e62989aee0dbd
9a816eb6aba0fd634d7571dab7afbc0a
1,300
PASSED
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class CosmicTable { public static void main(String[] args) throws Exception { BufferedReader read = new BufferedReader(new InputSt...
Java
290d9779a6be44ce6a2e62989aee0dbd
59f3d5afa7f7687f1ba9a909bc4c246d
1,300
PASSED
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair using namespace std; void solve() { ll int i,j,n,m,k; cin>>n>>m>>k; ...
C++
290d9779a6be44ce6a2e62989aee0dbd
214b21686e859d005983fd34a4e8f8d0
1,300
PASSED
//newf.cpp #include <bits/stdc++.h> using namespace std; #define s(n) scanf("%d",&n) #define p(n) printf("%d",n) #define s2(a,b) scanf("%d%d",&a,&b) #define s3(a,b,c) scanf("%d%d%d",&a,&b,&c) #define sc(n) s...
C++
290d9779a6be44ce6a2e62989aee0dbd
11541c36f5bf6f34285acaa11c950ee4
1,300
PASSED
#include<bits/stdc++.h> #define f(i,a,n) for(int i=a;i<n;i++) #define S second #define F first #define Sc(n) scanf("%lld",&n) #define scc(a,b,c) scanf("%lld %lld %lld",&a,&b,&c) #define sp(a) scanf("%lld %lld",&a.first,&a.second) #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #d...
C++
fa2d29150c27014ee7274d029f30b16a
a2bb6518cf839b9a50dc541af700f90e
2,000
PASSED
#include <cstdio> #include <string.h> #include <algorithm> using namespace std; #define N 500050 typedef long long ll; int n,a[N],K,b[N],c[N],d[N]; bool check1(int x) { int i,re=0; for(i=1;i<=n;i++) { if(a[i]>x) re+=a[i]-x; if(re>K) return 0; } return 1; } bool check2(int x) { int i,re=0; for(i=1;i<=n;i++) { ...
C++
fa2d29150c27014ee7274d029f30b16a
4c0b5b3d3760e1541878de8fdddbb297
2,000
PASSED
#include <cstdio> #include <string.h> #include <algorithm> using namespace std; #define N 500050 typedef long long ll; int n,a[N],K,b[N],c[N],d[N]; bool check1(int x) { int i,re=0; for(i=1;i<=n;i++) { if(a[i]>x) re+=a[i]-x; if(re>K) return 0; } return 1; } bool check2(int x) { int i,re=0; for(i=1;i<=n;i++) { ...
C++
fa2d29150c27014ee7274d029f30b16a
45c5a803974130b4001f36005ccb730b
2,000
PASSED
#include <iostream> #include <map> #include <algorithm> #include <vector> using namespace std; template<typename T> int Max(T begin, T end) { int ret = *begin; while (begin != end) { ret = max(ret, *begin); ++begin; } return ret; } template<typename T> int Min(T begin, T end) { in...
C++
fa2d29150c27014ee7274d029f30b16a
a2f57232c8f527b14cb4d9814e9828a7
2,000
PASSED
#include <iostream> #include <map> #include <algorithm> #include <vector> using namespace std; template<typename T> int Max(T begin, T end) { int ret = *begin; while (begin != end) { ret = max(ret, *begin); ++begin; } return ret; } template<typename T> int Min(T begin, T end) { in...
C++
fa2d29150c27014ee7274d029f30b16a
0124e41e2a0d70a5201969ea4e74e72a
2,000
PASSED
#include <iostream> #include <map> #include <algorithm> #include <vector> using namespace std; template<typename T> int Max(T begin, T end) { int ret = *begin; while (begin != end) { ret = max(ret, *begin); ++begin; } return ret; } template<typename T> int Min(T begin, T end) { in...
C++
fa2d29150c27014ee7274d029f30b16a
42c4fdba135e03646d087a099ff331d0
2,000
PASSED
#include <iostream> #include <map> #include <algorithm> #include <vector> using namespace std; template<typename T> int Max(T begin, T end) { int ret = *begin; while (begin != end) { ret = max(ret, *begin); ++begin; } return ret; } template<typename T> int Min(T begin, T end) { in...
C++
fa2d29150c27014ee7274d029f30b16a
68010c8be6e91a91092eac1928dbf3fe
2,000
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; #define F first #define S second typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<ii> vii; typedef vector<int> vi; typedef vector<ull> vull; typedef vector<ll> vll...
C++
fa2d29150c27014ee7274d029f30b16a
a662fa90f314962e2354fe1bb5b1e93b
2,000
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; #define F first #define S second typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<ii> vii; typedef vector<int> vi; typedef vector<ull> vull; typedef vector<ll> vll...
C++
fa2d29150c27014ee7274d029f30b16a
4afdbbc4de413c3ec7cbd8e0736dde6a
2,000
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #define int long long #define MK 500050 using namespace std; int n,k; int a[MK]; bool checkl(int x) { int opt = 0; for(int i=1;i<=n;i++) if(a[i]<x) opt+=(x-a[i]); return opt<=k; } bool checkr(int x) { int opt = 0; for(...
C++
fa2d29150c27014ee7274d029f30b16a
d0ed24b484637c09b94cac8c1a5f574a
2,000
PASSED
#include <bits/stdc++.h> #include <iostream> using namespace std; int main (int argc, char const *argv[]) { freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); int n; cin >> n; int v[n]; for (int i = 0; i < n; i++) cin >> v[...
C++
80cf3ea119fd398e8f003d22a76895a7
ed1249611cc62b43484aa433b7902f6f
1,400
PASSED
#include<bits/stdc++.h> #define ll long long int #define pb push_back using namespace std; int main() { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin>>n; vector<ll>v; for(ll i=0;i<n;i++) ...
C++
80cf3ea119fd398e8f003d22a76895a7
6d7351673ec8c752c28827fb84ec52d4
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); //ios_base::sync_with_stdio(false); cin.tie(); int n , a[100010]={} , j = 0 , ans=0; cin >> n; for(int i = 0 ; i < n ; i++) cin >> a[i]; sort(a , a+n); for(int i = 0 ; i < n ; i++){ fo...
C++
80cf3ea119fd398e8f003d22a76895a7
848aaae0d3817f65e5726cb295fd54c1
1,400
PASSED
#include <bits/stdc++.h> #define ll long long #define scanint1(a) scanf("%d",&a) #define scanint2(a,b) scanf("%d %d",&a,&b) #define scanint3(a,b,c) scanf("%d %d %d",&a,&b,&c) #define scanint4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d) #define scanint5(a,b,c,d,e) scan...
C++
80cf3ea119fd398e8f003d22a76895a7
9e8adceff85eee342c908fabcebeb7e8
1,400
PASSED
#include<algorithm> #include<iostream> #include<limits.h> #include<stdlib.h> #include<string.h> #include<complex> #include<cstring> #include<iomanip> #include<stdio.h> #include<bitset> #include<cctype> #include<math.h> #include<string> #include<time.h> #include<vector> #include<cmath> #include<queue> #include<stack> #i...
C++
80cf3ea119fd398e8f003d22a76895a7
4d939eb9f9d1d6c2594f60101186a8a8
1,400
PASSED
#include<cstdio> #include<cstring> #include<queue> #include<vector> #include<algorithm> #include<iostream> using namespace std; const int maxn = 5000 + 5; int c[maxn],dp[maxn][maxn]; int Dp(int l,int r){ if(dp[l][r] != -1) return dp[l][r]; if(r <= 2*l) return dp[l][r] = 0; r...
C++
80cf3ea119fd398e8f003d22a76895a7
c62ba090f84892168fbf6cbfdfe2e843
1,400
PASSED
#include<algorithm> #include<iostream> #include<cstdio> #define LL long long using namespace std; const int M = 1e5 + 5; int a[M]; int n; int main() { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); scanf("%d", &n); int i; for(i = 1; i <= n; ++i) scanf("%d", &a[i])...
C++
80cf3ea119fd398e8f003d22a76895a7
a8c3e0b097aab41744e7c960907a77f2
1,400
PASSED
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn=100005; int a[maxn],n; int main() { //freopen("//media/学习/ACM/input.txt","r",stdin); freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); scanf("%d",&n); int i,j,ans=0...
C++
80cf3ea119fd398e8f003d22a76895a7
4ee6d333bdc926fbeceb59821b3213cd
1,400
PASSED
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int N = 200000 + 5; int a[N]; int main() { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); int n; scanf("%d",&n); for (int i=1; i<=n; i++) scanf("%d",&a[i]); sort(a+1,a+1+n); int re...
C++
80cf3ea119fd398e8f003d22a76895a7
20a1e77be0761e81748f36692d224e7c
1,400
PASSED
/************************************************************************* * : WMW $ * : $ *************************************************************************/ #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream>...
C++
80cf3ea119fd398e8f003d22a76895a7
8dc7eb77962ed8101cb19bbf80a30d0e
1,400
PASSED