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 F first #define S second using namespace std; typedef long long ll; typedef pair<ll, ll>pll; ll MOD = 1e9 + 7; ll K = 2; struct Matrix { vector<vector<ll>> mat; int n_rows, n_cols; Matrix(vector<vector<ll>> values): mat(values), n_rows(values.size()), n_cols(value...
C++
ad8da6ceb781d89fa5a98869fac0c84c
f7fbf3c0cf24198e1d4b4b4defded1a0
2,200
PASSED
#include <bits/stdc++.h> #define all(x) begin(x), end(x) #define rall(x) (x).rbegin(), (x).rend() #define sz(x) ((int)(x).size()) #define pb push_back #define eb emplace_back #define fi first #define se second #define mp make_pair #define input freopen("input.txt","r",stdin); #define output freopen("output.txt","w",st...
C++
ad8da6ceb781d89fa5a98869fac0c84c
b8c8d564f3b1543a80c9e123e58f7afd
2,200
PASSED
#include <bits/stdc++.h> using namespace std; const int OO = 1e9; const double EPS = 1e-9; #define ndl cout << '\n' #define sz(v) int(v.size()) #define pb push_back #define mp make_pair #define fs first #define sc second #define present(a, x) (a.find(x) != a.end()) #ifdef LOCAL #define db(...) ({cout << "> Line " <<...
C++
ad8da6ceb781d89fa5a98869fac0c84c
40bf5b86f9eea48e772ea48eb49a81b9
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define llong long long #define xx first #define yy second #define len(x) ((int)x.size()) #define rep(i,n) for (int i = -1; ++ i < n; ) #define rep1(i,n) for (int i = 0; i ++ < n; ) #define all(x) x.begin(), x.end() #define rem ((llong)1e9+7) struct matrix { vector<ve...
C++
ad8da6ceb781d89fa5a98869fac0c84c
e32d1714983a41d1ad7c511164932f4d
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define llong long long #define xx first #define yy second #define len(x) ((int)x.size()) #define rep(i,n) for (int i = -1; ++ i < n; ) #define rep1(i,n) for (int i = 0; i ++ < n; ) #define all(x) x.begin(), x.end() #define rem ((llong)1e9+7) struct matrix : public vect...
C++
ad8da6ceb781d89fa5a98869fac0c84c
21b4d364384938810acc7b17f3e9f367
2,200
PASSED
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define dbg(x) cerr<<#x": "<<(x)<<endl #define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl #define dbg_v(x, n) {cerr<<#x"[]: ";...
C++
ad8da6ceb781d89fa5a98869fac0c84c
f39257b012ff8b7fc7a1f5bc52d10dca
2,200
PASSED
#include <bits/stdc++.h> #define dbg(x) cerr<<#x<<" = "<<x<<endl; #define dbg_v(v,n) {cerr<<#v<<" = [";for(int III=0;III<=n;III++)cerr<<v[III]<<(III!=n?",":"]\n");} #define ll long long #define ld long double #define pii pair<int,int> #define MOD 1000000007 #define zeros(x) x&(x-1)^x #define Nmax 1003 using namespace s...
C++
ad8da6ceb781d89fa5a98869fac0c84c
fb3edb55962b676cabbb0b4c62cc9a4d
2,200
PASSED
#include <iostream> using namespace std; long long int n,x,i,j,k,temp[101][101],arr[101][101]={{1}},mod=1000000007; void multiply(long long int A[101][101],long long int B[101][101]){ for(i=0;i<=100;++i) for(j=0;j<=100;++j) for(temp[i][j]=0,k=0;k<=100;++k) temp[i][j]=(temp[i][j]+(A[i][k]*B[k][j]))%mod; for(i=0;...
C++
ad8da6ceb781d89fa5a98869fac0c84c
3e442b70159c768ad17ed38284f8bd77
2,200
PASSED
//#pragma GCC optimize(3) #define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> #include<unordered_map> typedef long long LL; using namespace std; #define MAXN 200005 #define eps (1e-11) #define lyh 998244353 #define pp 1000000007 const int INF = 1e9; const double pi = acos(-1.0); #define P pair<int,int> #define se s...
C++
ad8da6ceb781d89fa5a98869fac0c84c
09682e6940e6bb24b9e70540ce6e0c66
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; const ll mod = 1e9 + 7; const int N = 105; ll dp[N], f[N]; void product(ll a[N][N], ll b[N][N], ll c[N][N]){ for(int i = 0; i <= 100; i++){ for(int j = 0; j <= 100; j++){ c[i][j] = 0; ...
C++
ad8da6ceb781d89fa5a98869fac0c84c
0d5e646ae2ab3672769aabfebcb941d3
2,200
PASSED
#include <bits/stdc++.h> using namespace std; //#define int long long #define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define pb push_back #define all(x) begin(x),end(x) int mod = 1e9+7; //int inf = 4e18; const int N = 3e5+5; string s; int deg[N]; vector<int> adj[N]; int dp[N][26]; int n,m;...
C++
db5a99701dabe3516f97fd172118807e
5d80493a66ab059bb2b80c21f574e935
1,700
PASSED
#include <bits/stdc++.h> using namespace std; //#define int long long #define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define pb push_back #define all(x) begin(x),end(x) int mod = 1e9+7; //int inf = 4e18; const int N = 3e5+5; string s; int deg[N]; vector<int> adj[N]; int dp[N][26]; int n,m;...
C++
db5a99701dabe3516f97fd172118807e
901aa6966759952a7049a67809b388e6
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define watch(x) cout << (#x) << " = " << (x) << endl #define PI double(2 * acos(0.0)) #define LL long long #define MOD 1000000007 #define all(x) (x).begin(), (x).end() #define INF 1e15 vector<int> edges[300005]; int in[300005]; int dp[300005][26]; int main() { ios_bas...
C++
db5a99701dabe3516f97fd172118807e
6ff7604dfe2f66d9dbb9dbe671e4edf0
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define sf(x) scanf("%d",&x) #define sfl(x) scanf("%lld",&x) #define pf(x) printf("%d\n",x) #define pfl(x) printf("%lld\n",x) #define endl '\n' #define...
C++
db5a99701dabe3516f97fd172118807e
26df949b1e07c86aed66dc8a8624be9b
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define sf(x) scanf("%d",&x) #define sfl(x) scanf("%lld",&x) #define pf(x) printf("%d\n",x) #define pfl(x) printf("%lld\n",x) #define endl '\n' #define...
C++
db5a99701dabe3516f97fd172118807e
ac1140e0ba7f382ce55811004aa1a4e6
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod 1000000007 ll maxN=1; string s; vector<set<ll>>v; vector<vector<ll>>map1; //map<char, int>map1; vector<bool>visited, calculated; bool dfs(ll pos){ if(calculated[pos]){ return true; } calculated[pos]=true; if(v[pos].size()==0){ ...
C++
db5a99701dabe3516f97fd172118807e
20ccdbebf1a852872702f0d9de6f4866
1,700
PASSED
/* _____________ _____________ _____________ _____________ _____________ ( ___________) | _________ ) (___________ ) (___________ ) ( ___________) ( ( | | | ) | ) ) ) ( ( ( (___________ | |_________| ) ___________| ) ...
C++
db5a99701dabe3516f97fd172118807e
d0629354f9d9224f15d5f9e70d994d08
1,700
PASSED
/* _____________ _____________ _____________ _____________ _____________ ( ___________) | _________ ) (___________ ) (___________ ) ( ___________) ( ( | | | ) | ) ) ) ( ( ( (___________ | |_________| ) ___________| ) ...
C++
db5a99701dabe3516f97fd172118807e
dc9d69f7384159982c3a1d77b853b2fd
1,700
PASSED
#include <bits/stdc++.h> using namespace std; inline void fk() { cout << -1; exit(0); } const int mxN=3e5; vector<int> graph[mxN]; bool vis[mxN], act[mxN]; int dp[mxN][26], ans; string s; void dfs1(int u) { vis[u]=act[u]=1; for(int v : graph[u]) { if(act[v]) fk(); if(!vis[v]) dfs1(v); for(int i=0;...
C++
db5a99701dabe3516f97fd172118807e
0a2152c4741160647880b4acbba6e5fd
1,700
PASSED
#include<bits/stdc++.h> using namespace std; void dfs(int i, vector<bool> &cycle, string &s, vector<bool> &visited, vector<vector<int>> &v, vector<vector<int>> &dp, int &ans); int main() { //freopen("input.txt", "r", stdin); ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n, m, ans = INT32_MIN; string...
C++
db5a99701dabe3516f97fd172118807e
c560e284befaaff7fb16c8176758210a
1,700
PASSED
#include<bits/stdc++.h> using namespace std; int n; string s; int main(){ int tc; cin >> tc; for(int t = 0; t < tc; ++t){ cin >> n >> s; int pos = n; for(int i = 0; i < n; ++i) if(s[i] == '8'){ pos = i; break; } ...
C++
bcdd7862b718d6bcc25c9aba8716d487
587fe9da9b1cfd94e0f00b6fe04d42f0
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long t,n,a=0,c=0,i,j; string s; cin>>t; for(i=1; i<=t; i++) { cin>>n; cin>>s; int len=s.size(); for(j=0; j<len; j++) { if(s[j]=='8') { c=1; b...
C++
bcdd7862b718d6bcc25c9aba8716d487
301ecb1c84168cf4cd0ed38f7c470989
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long t,n,a=0,c=0,i,j; string s; cin>>t; for(i=1; i<=t; i++) { cin>>n; cin>>s; int len=s.size(); for(j=0; j<len; j++) { if(s[j]=='8') { c=1; b...
C++
bcdd7862b718d6bcc25c9aba8716d487
0277f118a6a487949dcabae507505472
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n,k,i; cin>>n; char a[110]; cin>>a; for(i=0;i<n;i++) { if(a[i]=='8') { k=i; break; } } ...
C++
bcdd7862b718d6bcc25c9aba8716d487
e07d54ae7780486e3867b0d68da1ce2f
800
PASSED
#include<iostream> using namespace std; string a(int n,char s[100]) { int i=0,j=0,k=0; while(i<n){ if(s[i]=='8'||k!=0){ if(s[i]=='8'||s[i]!='8'){j++;} if(s[i]=='8'){k++;} } i++; } if(j>10){return "YES";} else{return "NO";} } int main() { int t,n,i;...
C++
bcdd7862b718d6bcc25c9aba8716d487
4cefc020cedfb80a1d6485326ea450ea
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int i,j,k,a[1000],d,t,count=0,n; string s; cin >> k; bool b; b=false; while(k--) {b=false; count =0; cin >> n; cin >> s; for(i=0;i<n-10;i++) { if (s[i]=='8') { b=true; } ...
C++
bcdd7862b718d6bcc25c9aba8716d487
d5beddbed6a93e11448a6a32b4cba20f
800
PASSED
#include <iostream> using namespace std; int main() { int t; cin>>t; while(t!=0) { int n; cin>>n; string s; cin>>s; int index=-1; for(int i=0 ; i<n ; i++) { if(s[i]=='8') { index=i; break; ...
C++
bcdd7862b718d6bcc25c9aba8716d487
38660bd1d10036f3942b7454a3767678
800
PASSED
#include <iostream> using namespace std; /* 15 11 88888888888 100 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 100 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 100 111111111111111111111111111181111111111111...
C++
bcdd7862b718d6bcc25c9aba8716d487
ba96fff30f1a599242e95afb2d1305d2
800
PASSED
#include <iostream> using namespace std; int t,n; string s; string a[100]; int main() { cin>>t; for (int i=0;i<t;i++){ cin>>n>>s; if ((n==11) && (s[0]=='8')) {a[i]="YES"; continue; } else if ((n==11) && (s[0]!='8')) {a[i]="NO"; continue;} if (n<11) {a[i]="NO"; continue;} ...
C++
bcdd7862b718d6bcc25c9aba8716d487
48bb8908779c1a9c6f12dcc4b2340104
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int, int> ii; typedef pair<ll, int> li; typedef pair<int, ll> il; typedef vector<ii> vii; typedef vector<il> vil; typedef vector<li> vli; #define ff first #define ss second #define p...
C++
bcdd7862b718d6bcc25c9aba8716d487
cd8e9c612e642f4387ab0e1f80b7323f
800
PASSED
#include<iostream> #include<string> #include<vector> #include<cmath> #include<algorithm> #include<sstream> #include<iomanip> #include <utility> #include<map> #include<set> #include<iterator> #include<stack> #include<bitset> #include<queue> #include<deque> #define all(v) ((v).begin()) , ((v).end()) #define sz(v) ((int)(...
C++
5d11fa8528f1dc873d50b3417bef8c79
99542f8e0eaeb2d4655a82b7298d6ebf
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define lim 1000000 #define mod 1000003ll #define pii pair<ll,ll> #define ull usigned long long const float pi = 3.141592653589793238; ll toint(const string &s) {stringstream ss; ss << s; ll x;...
C++
5d11fa8528f1dc873d50b3417bef8c79
8ba63bcd6aa372b79fef9e9495c0d5ab
1,100
PASSED
#include <iostream> using namespace std; int arr[1005]; int solve(int n,int index){ int right=0; int left=0; int rigthreference=arr[index]; int leftreference=arr[index]; for(int i=index;i<n;i++){ if(arr[i]>rigthreference){ break; } else{ ++right; if(arr[i]<rigthreference){ rigthreference=arr[i];...
C++
5d11fa8528f1dc873d50b3417bef8c79
a34e196ac8eb8d4eeaf86f5cb4dc5692
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long n,k,a[1000],b[1000],c=1,d,x[1000],m[1000],z=0,y=0,t=0,s=0,i,o=1; bool t1=true,t2=true; cin>>n; for (int i=0;i<n;i++) cin>>a[i]; for (int i=0;i<n;i++){ for(int j=i;j<n-1;j++){ if ( a[j+1] <=a[j]) c++; else ...
C++
5d11fa8528f1dc873d50b3417bef8c79
712a9f5921a8b084f1bdc7fa2f8ed176
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long n,k,a[1000],b[1000],c=1,d,x[1000],m[1000],z=0,y=0,t=0,s=0,i,o=1,q; bool t1=true,t2=true; cin>>n; for (int i=0;i<n;i++) cin>>a[i]; for (int i=0;i<n;i++){ for(int j=i;j<n-1;j++){ if ( a[j+1] <=a[j]) c++; else ...
C++
5d11fa8528f1dc873d50b3417bef8c79
c64766a1007e6f54c4277b8c2938bf10
1,100
PASSED
#include <bits/stdc++.h> #include <cstring> #define ll long long int #define vi vector<int> #define vll vector<ll> #define pb push_back() #define pll pair<long long, long long> #define mod 1000000007 #define inf 1000000000000000001; #define all(c) c.begin(),c.end() #define mp(x,y) make_pair(x,y) #define mem(a,val) mems...
C++
5d11fa8528f1dc873d50b3417bef8c79
ac487bea438fa150a5cab143214158a5
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int count(int a[],int n) { int dp[n]={0},bp[n]={0}; int i,j; dp[0]=1; bp[n-1]=1; for(i=1;i<n;i++) {if(a[i]>=a[i-1]) dp[i]=dp[i-1]+1; else dp[i]=1;} for(i=n-2;i>=0;i--) {if(a[i]>=a[i+1]) bp[i]=bp[i+1]+1; else bp[i]=1;} ...
C++
5d11fa8528f1dc873d50b3417bef8c79
4a1b9fa49c3e450345cd53ad5292f810
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n, k = 0; cin >> n; vector <int> a(n); for(int i = 0; i < n; i++) cin >> a[i]; if (n == 1) {cout <<"1"; return(0);} int flag = 1, count = 1, mx = 0; while (k < n - 1) { // cout << endl // << "Comparing "...
C++
5d11fa8528f1dc873d50b3417bef8c79
21047c05a1a247ab025c2293567799b3
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a[n]; int count = 0 ; int t = n; while(t>0){ cin>>a[count++]; t--; } int maxl = 1; for(int i = 0 ; i < n ; i++){ int count = 1; int prev = a[i]; for(int r = i+1; r < n ; r++){ if(a[r] <= prev)count++; else break; ...
C++
5d11fa8528f1dc873d50b3417bef8c79
2e036b6af5c4170bf3ac50efe65f99c7
1,100
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; const int sz=1002; int a[sz]={0}; int main() { int n,i,j,c=0,m=0; cin>>n; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++){ for(j=i;j<n-1;j++){ if(a[j+1]<=a[j])c++; else break;} fo...
C++
5d11fa8528f1dc873d50b3417bef8c79
2e3ebaadfda8c221bc8d7a065244726a
1,100
PASSED
#include<bits/stdc++.h> #define fr first #define sc second #define memset(X,Y) memset(X,Y,sizeof X) #define all(X) X.begin(),X.end() #define sz size() #define pp pair < pair <int,int> , pair<int,int> > #define mp make_pair #define pb push_back typedef long long ll; using namespace std; int const N=100010,K=30,OO=1e18...
C++
7ff7f47cee182d2542754e412f6aab1a
2d77f6d61fdec089666dda663d57cedb
1,600
PASSED
#include<iostream> #include<algorithm> #include<map> using namespace std; long long d1[100010]; long long d2[100010]; long long v[100010]; int main() { long long N; cin >> N; for ( long long i = 1; i <= N; ++i) { cin >> v[i]; } for ( long long i = 1; i <= N - 1; ++i) { if (i % 2 == 0) { d1[i] =...
C++
7ff7f47cee182d2542754e412f6aab1a
16be40beb359fcb82eaaea3d90a40a9a
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long ll ara [100005], he[100005], she[100005], cumhe[100005], cumshe[100005], minhe[100005], minshe[100005]; int main() { ll n, i, j, k, p, q, x, y; scanf("%I64d", &n); for(i = 1; i <= n; i++) scanf("%I64d", &ara[i]); p = 1; for(i ...
C++
7ff7f47cee182d2542754e412f6aab1a
327dfb172000387e4f5c5c1246a957b2
1,600
PASSED
/*--------------------------------------------- Author:TanYz ---------------------------------------------*/ #include <iostream> #include <sstream> #include <stdio.h> #include <string.h> #include <algorithm> #include <queue> #include <string> #include <cmath> #include <map> #include <stack> #include <ctime> #includ...
C++
7ff7f47cee182d2542754e412f6aab1a
3fc996793f94c7883d0d407e7cbf5303
1,600
PASSED
#include <algorithm> #include <iostream> #include <sstream> #include <string> #include <cstring> #include <vector> #include <queue> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <list> #include <cassert> #include <ctime> #include...
C++
7ff7f47cee182d2542754e412f6aab1a
998f277d10b39d3a8862812919aca97e
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int64_t n,i,s,b,c=-2e18,d=-2e18,a[100179]; int main(){ for(cin>>n>>a[0];i+1<n;++i) cin>>a[i+1], s+=abs(a[i+1]-a[i])*(i&1?-1:1), d=max(d,s-b),d=max(d,c-s), i&1?b=min(b,s):c=max(c,s); cout<<d; }
C++
7ff7f47cee182d2542754e412f6aab1a
4924bdc9eb36f15de19146a0b523c71e
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int64_t n,i,a,b,c=-2e18,d=-2e18,x,y; int main(){ for(cin>>n>>x;i+1<n;x=y,++i) cin>>y,a+=abs(y-x)*(i&1?-1:1), d=max(d,max(c-a,a-b)), i&1?b=min(b,a):c=max(c,a); cout<<d; }
C++
7ff7f47cee182d2542754e412f6aab1a
2ca8024ea32c168b8777e01835373934
1,600
PASSED
#include<iostream> #include<string.h> #include<math.h> #define MAX 100005 using namespace std; int n; long long T[MAX]; int main() { cin>>n; int i; for(i=0;i<n;i++) cin>>T[i]; for(i=0;i<n-1;i++) { T[i]=abs(T[i+1]-T[i]); } if(n==2) { cout<<T[0]; return 0; } long long ans0=T[0]; long long k=T[0]; for(i=...
C++
7ff7f47cee182d2542754e412f6aab1a
5c29647afd1ce1f81a5593d1e9a4adb9
1,600
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<queue> #include<map> #include<cmath> #include<vector> #include<set> using namespace std; #define LL long long int n; LL a[100005]; LL dp[100005][2]; int main() { while(~scanf("%d",&n)) { for(int i=1;i<=n;++i) ...
C++
7ff7f47cee182d2542754e412f6aab1a
182b2b12b5cad9301a36df1c77c75cd9
1,600
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<queue> #include<map> #include<cmath> #include<vector> #include<set> using namespace std; #define LL long long int n; LL a[100005]; LL dp[100005][2]; int main() { while(~scanf("%d",&n)) { for(int i=1;i<=n;++i) ...
C++
7ff7f47cee182d2542754e412f6aab1a
77eadbabc981286bf4f6edc7ae312015
1,600
PASSED
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:25600000000000000000000000000000000") #define qq cout << "!!" << endl; #define ww cout << "??" << endl; #define rr return 0; #define nl cout << endl; #define pb push_back #define mk make_pair #define sqr(a) ((a) * (a)) #define imp(a) fixed << setprecision(a) #de...
C++
56535017d012fdfcc13695dfd5b33084
015258a98419f75d88e1c7ebcdda42d2
1,300
PASSED
#include <iostream> using namespace std; int main() { int v1, v2, v3, m; cin >> v1 >> v2 >> v3 >> m; for (int a = 1; a < 201; a++) { for (int b = a + 1; b < 201; b++) { for (int c = b + 1; c < 201; c++) { if ((v1 <= c) && (2 * v1 >= c) && (v2 <= ...
C++
56535017d012fdfcc13695dfd5b33084
188da45d1209cb6220ed83418ed34187
1,300
PASSED
#include <iostream> #include <cmath> #include <stdlib.h> #include <algorithm> #include <fstream> #include <vector> #include <queue> #include <set> #include <string> #include <map> #include <time.h> #define fr first #define sc second #define mp make_pair #define pb push_back #define ll long long const int N = 5*1e5+1;...
C++
56535017d012fdfcc13695dfd5b33084
50c5260f38bb1d7f4246ab2a64d8cf28
1,300
PASSED
// // Created by kirill on 23.12.17. // #include <iostream> int main() { int v1 = 0, v2 = 0, v3 = 0, vm = 0; std::cin >> v1 >> v2 >> v3 >> vm; if (vm >= v2 || 2 * vm < v3 || 2 * v3 < vm) { std::cout << "-1"; return 0; } else { v3 = std::max(v3, vm); std::cout << 2 * v1 <...
C++
56535017d012fdfcc13695dfd5b33084
3b1b125b58075482edb8800abfee9e5e
1,300
PASSED
// Made By Haireden Aibyn #include <algorithm> #include <iostream> #include <iomanip> #include <cstring> #include <cstdlib> #include <fstream> #include <string> #include <cstdio> #include <vector> #include <cmath> #include <ctime> #include <queue> #include <deque> #include <stack> #include <map> #include <set> using n...
C++
56535017d012fdfcc13695dfd5b33084
a247af69af42d0ad126d6b985faf8bd4
1,300
PASSED
#include<stdio.h> #include<math.h> int cmp(const void*a,const void*b) { return *(int*)b-*(int*)a; } int main() { int i,j,k1=0,k2=0,k3=0,n,n1=0,n2=0,n3=0,judge=0; int c[5001],a[5001],b[5001],d[5001]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&c[i]); if(c[i]==1) { a[n1]=i+1; n1++; } else if(c[i]...
C
c014861f27edf35990cc065399697b10
4ed0d6fd1effbd3c5b64fd6a5c4fc066
800
PASSED
#include<stdio.h> #include<math.h> int cmp(const void*a,const void*b) { return *(int*)b-*(int*)a; } int main() { int i,j,k,a,num,n,n1=0,n2=0,n3=0,judge=0; int c[5001],b[4][5001]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&c[i]); if(c[i]==1) { b[1][n1]=i+1; n1++; } else if(c[i]==2) { b[2][...
C
c014861f27edf35990cc065399697b10
506b46418a71b032acada012c3a6dd72
800
PASSED
#include<stdio.h> #include<math.h> int cmp(const void*a,const void*b) { return *(int*)b-*(int*)a; } int main() { int i,j,k,a,n,n1=0,n2=0,n3=0,judge=0; int c[5001],b[3][2],d[5001]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&c[i]); if(c[i]==1) { n1++; } else if(c[i]==2) { n2++; } else { ...
C
c014861f27edf35990cc065399697b10
b8eeb1bf65a68a336c6f5170184ce20b
800
PASSED
#include<stdio.h> int main() { int n,i,t,one[5002],two[5005],three[5005],on=0,tw=0,thr=0; scanf("%d",&n); for(i=1; i<=n; i++) { scanf("%d",&t); if(t==1) { on++; one[on]=i; } if(t==2) { tw++; two[tw]=i; ...
C
c014861f27edf35990cc065399697b10
7083d4553353124078d639a35790ca2a
800
PASSED
#include<stdio.h> int main(){ int ones=0,twoes=0,threes=0; int n,checker,j=1,n1=0,n2=1,n3=2,w; scanf("%d",&n); int a[n*3]; for(int i=1;i<=n;i++){ scanf("%d",&checker); if(checker==1){ a[n1]=j; n1+=3; j++; ones++; } else if(checker==2){ a[n2]=j; n2+=3; j++; twoes++; } else{ a[n3]=j; ...
C
c014861f27edf35990cc065399697b10
45237a8acfaae043554c384fe6b3b175
800
PASSED
#include<stdio.h> #include<stdlib.h> int main(void) { unsigned n,i,j,k,l,num,num1,num2,num3,*a,*b,*c,*t; scanf("%u",&n); t=(unsigned*)malloc(n*sizeof(unsigned)); a=(unsigned*)malloc((n)*sizeof(unsigned)); b=(unsigned*)malloc((n)*sizeof(unsigned)); c=(unsigned*)malloc((n)*sizeof(unsigned)); f...
C
c014861f27edf35990cc065399697b10
ad47f8056a6a7e98b4dfe67b64f36a0e
800
PASSED
// Codeforces A. Team Olympiad // Created by Abdulrahman Elsayed on 04/07/2020 #include <stdio.h> int min(int *a, int *b, int *c); int main() { int n, c1 = 0, c2 = 0, c3 = 0, teams = 0; scanf("%d", &n); int array[n]; int count1[n], count2[n], count3[n]; for (int i = 0; i < n; i++) ...
C
c014861f27edf35990cc065399697b10
e77a1d5f0a5a379fc9dd0f0ae97547ad
800
PASSED
#include<stdio.h> main(){ int n, i, j, input; scanf("%d", &n); int prog[n], math[n], sports[n], p=0, m=0, s=0, teams; for(i=0; i<n; i++){ scanf("%d", &input); // store the index if(input==1){ prog[p] = i+1; p++; }else if(input==2){ math[m] = i+1; m++; }else if(input==3){ sports[s] =...
C
c014861f27edf35990cc065399697b10
7f892cdfea0f0bb71ab92a61c88c5946
800
PASSED
#include<stdio.h> main(){ int n, i, input; scanf("%d", &n); int skills[3][n], p=0, m=0, s=0; for(i=0; i<n; i++){ scanf("%d", &input); // store the index if(input==1){ skills[0][p] = i+1; p++; }else if(input==2){ skills[1][m] = i+1; m++; }else if(input==3){ skills[2][s] = i+1; s++...
C
c014861f27edf35990cc065399697b10
87db91479654336c44cdc297d1d2f91a
800
PASSED
#include<stdio.h> main(){ int n, i, input; scanf("%d", &n); int skills[3][n], p=0, m=0, s=0, teams; for(i=0; i<n; i++){ scanf("%d", &input); // store the index if(input==1){ skills[0][p] = i+1; p++; }else if(input==2){ skills[1][m] = i+1; m++; }else if(input==3){ skills[2][s] = i+1;...
C
c014861f27edf35990cc065399697b10
e2ee8d99e2f0db9d6762c89d729fe026
800
PASSED
#include<stdio.h> #define MAX(a,b) a>b?a:b int tc[200000],x[200000]; int main() { int n; scanf("%d",&n); int current[n],i; for(i=0; i<n; i++) scanf("%d",&current[i]); int q; scanf("%d",&q); int serial,max=0,t,tx; for(i=0; i<q; i++) { scanf("%d",&serial); if(se...
C
7b788c660fb8ca703af0030f4c84ce96
852ee8d505f20c21fe2e2d8041546906
1,600
PASSED
#include<stdio.h> #define MAX(a,b) a>b?a:b int tc[200000],x[200000]; int main() { int n; scanf("%d",&n); int current[n],i; for(i=0; i<n; i++) scanf("%d",&current[i]); int q; scanf("%d",&q); int serial,max=0,t,tx; for(i=0; i<q; i++) { scanf("%d",&serial); if(se...
C
7b788c660fb8ca703af0030f4c84ce96
1fe8af35dbbc4c82f2a871becd0f835b
1,600
PASSED
using System; using System.Collections.Generic; class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); string[] str = Console.ReadLine().Split(); int[]A = new int[N]; for(var i=0;i<N;i++){ A[i] = int.Parse(str[i]); } int Q = int.Parse(Console.ReadLine()); int[,]P = n...
C#
7b788c660fb8ca703af0030f4c84ce96
e4541327ca1fce14d7cb8b7ece0fc5c6
1,600
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.IO; using System.Text; using System.Diagnostics; using static util; using P = pair<int, int>; using Binary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Ex...
C#
7b788c660fb8ca703af0030f4c84ce96
37ebcb99721ca5d0d4bd2ab0179a8d6c
1,600
PASSED
using System; using System.Linq; namespace Solution { internal static class Program { private static void Main(string[] args) { Reader(out var n, out var a, out var last, out var max); FindSolution(n, ref a, last, max); Writer(a); } private s...
C#
7b788c660fb8ca703af0030f4c84ce96
7005a8018e13db564a461e3db8c407e7
1,600
PASSED
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PIAA1912188 { class Program { static void Main(string[] args) { int citizensNumber = int.Parse(Console.ReadLine()); int[] citizensBalance = Arra...
C#
7b788c660fb8ca703af0030f4c84ce96
94ecfba1c81c8c9a58770eee4bb521fa
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define mp make_pair #define st(arr,a) memset(arr,a,sizeof arr) #define nl cout<<endl #define real signed #define endl '\n...
C++
ec1a4656256b09cf1c6050977fbc6cb9
3455d59fec5fc290f7cf2aa9a7a69805
2,500
PASSED
/// Bismillahir-Rahmanir-Rahim #include <bits/stdc++.h> #define ll long long int #define FOR(x,y,z) for(int x=y;x<z;x++) #define pii pair<int,int> #define pll pair<ll,ll> #define ...
C++
ec1a4656256b09cf1c6050977fbc6cb9
84aaa8b66951b6cc9bf3b6108ed9733c
2,500
PASSED
/// Bismillahir-Rahmanir-Rahim #include <bits/stdc++.h> #define ll long long int #define FOR(x,y,z) for(int x=y;x<z;x++) #define pii pair<int,int> #define pll pair<ll,ll> #define ...
C++
ec1a4656256b09cf1c6050977fbc6cb9
277dddfd040e3966af8afdd3366631a6
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e2 + 10; int n, m; int adj[MAXN][MAXN]; int adj_[MAXN][MAXN]; int ans[MAXN][MAXN]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; memset(adj, 63, sizeof(adj)); memset(adj_, 63, sizeof(adj_)); for (int i = 0; i < m; i...
C++
ec1a4656256b09cf1c6050977fbc6cb9
61347048281568f3f0cfd77d929f4d61
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e2 + 10; int n, m; int adj[MAXN][MAXN]; int adj_[MAXN][MAXN]; int ans[MAXN][MAXN]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; memset(adj, 63, sizeof(adj)); memset(adj_, 63, sizeof(adj_)); for (int i = 0; i < m; i...
C++
ec1a4656256b09cf1c6050977fbc6cb9
afc393a79fcd65d235fec7c32347fb9d
2,500
PASSED
#pragma GCC optimize("O3") #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define F first #define S second #define ll long long #define ull unsigned long long #define pb push_back using namespace std; using namespace __gnu_pbds; typedef tree< int , null_type, less<int>, rb_tree_tag, tree_order_sta...
C++
ec1a4656256b09cf1c6050977fbc6cb9
fd7a227a8e437dde6cff73eca250670f
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e2 + 10; int n, m; int adj[MAXN][MAXN]; int adj_[MAXN][MAXN]; int ans[MAXN][MAXN]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; memset(adj, 63, sizeof(adj)); memset(adj_, 63, sizeof(adj_)); for (int i = 0; i < m; i...
C++
ec1a4656256b09cf1c6050977fbc6cb9
5ab30e4e461f753783ffad4e416e28a7
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e2 + 10; int n, m; long long adj[MAXN][MAXN]; long long adj_[MAXN][MAXN]; int ans[MAXN][MAXN]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; memset(adj, 63, sizeof(adj)); memset(adj_, 63, sizeof(adj_)); for (int i =...
C++
ec1a4656256b09cf1c6050977fbc6cb9
f3231d52f1431006166707d16a2a7601
2,500
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; const int MAXN = 5e2 + 10; int n, m; int adj[MAXN][MAXN]; int adj_[MAXN][MAXN]; int ans[MAXN][MAXN]; int main() { ios::sync...
C++
ec1a4656256b09cf1c6050977fbc6cb9
a609d0bbcb70be3d1088d0f646ee5b25
2,500
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; const int MAXN = 5e2 + 10; int n, m; long long adj[MAXN][MAXN]; long long adj_[MAXN][MAXN]; int ans[MAXN][MAXN]; int main() ...
C++
ec1a4656256b09cf1c6050977fbc6cb9
1d09299e0a91c9fc8219ac215b667041
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<to;x++) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //-----...
C++
dcb55324681dd1916449570d6bc64e47
ce6961a4cd51900a90db1da0f463dd34
2,700
PASSED
#include<cmath> #include<cstdio> #include<vector> #include<utility> #include<iostream> #include<algorithm> using namespace std; const int MAXN=10010; void open() { freopen("goal.in","r",stdin); freopen("goal.out","w",stdout); } class Gauss { public: int a[MAXN],b[MAXN],n; vector<pair<int,int> > ops[2]; void ...
C++
dcb55324681dd1916449570d6bc64e47
1bda56f63df4e6467adea56c7fdc3a1b
2,700
PASSED
#include <cmath> #include <cstdio> #include <cctype> #include <cstdlib> #include <climits> #include <cstring> #include <vector> #include <string> #include <iostream> #include <cassert> #include <algorithm> using namespace std; #define foreach(e,x) for(__typeof((x).begin()) e=(x).begin(); e!=(x).end(); ++e) const int...
C++
dcb55324681dd1916449570d6bc64e47
96e0db67b853a257f08ccdc97a74cb23
2,700
PASSED
#include <iostream> #include <algorithm> #include <vector> using namespace std; #define sz(x) ((int)(x).size()) #define mP make_pair #define pB push_back #define X first #define Y second int getHighestBit(int a) { for (int i = 31; i >= 0; i--) { if (a >> i & 1) { return 1 << i; } } return 0; } vector <int>...
C++
dcb55324681dd1916449570d6bc64e47
96222910321ab0ca33a7effccca836d6
2,700
PASSED
#include <iostream> #include <algorithm> #include <vector> using namespace std; #define sz(x) ((int)(x).size()) #define mP make_pair #define pB push_back #define X first #define Y second int getHighestBit(int a) { for (int i = 31; i >= 0; i--) { if (a >> i & 1) { return 1 << i; } } return 0; } vector <int>...
C++
dcb55324681dd1916449570d6bc64e47
27a194e310c91a9887915e15453b78d6
2,700
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> using namespace std; #define sz(x) ((int)(x).size()) #define X first #define Y second #define mP make_pair #define pB push_back #define pii pair <int, int> int getHighestOne(int a) { for (int i = 31; i >= 0; i--) { if (((1 << i) & a) != 0...
C++
dcb55324681dd1916449570d6bc64e47
1deafd90ffa7da968cdc81c809d038d5
2,700
PASSED
/* Call it liberation or frustration As it hits like a bomb Tearing you apart as you're first in line Entering the zone Watch how it runs A nerve wrecking resistance Watch how it burns A venomous script's getting formed You've traveled a long way to get here And now its waking you up Waking you up Walk straight for ...
C++
dcb55324681dd1916449570d6bc64e47
f9936664934152359703761fcaff13ab
2,700
PASSED
#include <cstdio> #include <vector> using namespace std; #define n 1000005 #define MK make_pair #define PA pair<int,int> int N,A[n],B[n]; vector<PA> Qa,Qb; void Add(int *A,int i,int j,vector<PA> &Q){ A[i]^=A[j]; Q.push_back(MK(i,j)); } void Work(int *A,vector<PA> &Q){ for (int i=30,j=1,k;i+1;i--){ for (k=j;k...
C++
dcb55324681dd1916449570d6bc64e47
cc944230ec89d94319dfdc5536bbd095
2,700
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <cstring> #include <string> #include <cmath> #include <queue> #include <deque> #include <bitset> #include <algorithm> #include <stack> #include <set> #include <map> #include <list> #include <sstream> using namespace std; #define DB(x) cerr<<#x<<"="<<x<<"...
C++
dcb55324681dd1916449570d6bc64e47
0a9357f2a3c0fef64e416d5035e7cd34
2,700
PASSED
#include <cassert> #include <vector> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; int n; const int N = 10005; int getBit(int x) { int ret = 0; while (x) { x >>= 1; ++ret; } return ret - 1; } vector<int> clear(vector<int> &x, v...
C++
dcb55324681dd1916449570d6bc64e47
3f2e2ab887aa1d97bb69dddc50d27606
2,700
PASSED
#include <iostream> using namespace std; int main() { string s; getline(cin, s); s += " "; int x = -1; char bef = 'a'; string ans = ""; for (int i = 0; i < s.size() - 1; i++) { if (s[i] == '.') { ans += "."; bef = '.'; } if (s[i] == ',') { ans += ","; bef = ','; } if (s[i] >= '0' && ...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
3c1942d01a5c108ab0396789e9e10083
1,700
PASSED
#include<iostream> #include<algorithm> #include<cstdio> #include<vector> #include<string> #include<cstring> #include<cmath> #define fr(a,b,c) for(a=b;a<=c;a++) #define frr(a,b,c) for(a=b;a>=c;a--) #define pb push_back #define mp make_pair #define pii pair<int,int> using namespace std; typedef long long ll; const int dx...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
fec4d86b5bd5ab0d141c2c8b2f526465
1,700
PASSED
#include<iostream> #include<string> using namespace std; string s,ans; int m; int main() { getline(cin,s); bool f=false; for(int i=0;i<s.size();i++) { if(s[i]==' '){f=true;continue;} if(s[i]=='.' && s[i+1]=='.' && s[i+2]=='.') { int len=ans.size(); if(i!=0 && ans[len-1]!=' '){ans+=" ...";m++;f=true;} ...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
7faf2a425096464e9ca55bed5390b791
1,700
PASSED
#include<iostream> #include<string> using namespace std; int main() { string a,s="",p=""; int m=0; bool f=false; getline(cin,a); for(int i=0;i<a.size();i++) { if(a[i]==' '){f=true;continue;} if(a[i]=='.' && a[i+1]=='.' && a[i+2]=='.') { int len=s.size(); if(i!=0 && s[len-1]!=' '){s+=" ...";m++;f=tru...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
c49b534685311b82b035d1db1fc5a8c8
1,700
PASSED
#include <cstring> #include <cctype> #include <cstdio> #include <vector> using namespace std; int main () { char input[300]; gets(input); for (int i = 0, lastnum = 0, lastspace = 0; i < strlen(input); ++i) { if (input[i] == ' ') continue; if (input[i] == '.') { if (i =...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
b8e54f968f895549d51c597bd34caf59
1,700
PASSED
#include <iostream> #include <algorithm> using namespace std; int main() { string s; getline(cin , s); char bef; string ans = ""; for(int i = 0; i < s.size() ; i++) { if(i <= s.size() - 3 && i != 0 && s.substr(i , 3) == "...") { //cout << bef << endl; if(bef == ',') { ans += "..."; i += 2; ...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
c02235c1d2bac2df5e0f6f0f41a62354
1,700
PASSED
#include<map> #include<set> #include<list> #include<cmath> #include<ctime> #include<deque> #include<queue> #include<stack> #include<bitset> #include<cctype> #include<cstdio> #include<string> #include<vector> #include<cstdlib> #include<cstring> #include<iomanip> #include<numeric> #include<utility> #include<sstream> #inc...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
3e49dd7149ebdbc5d48361d140d9c39c
1,700
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ string s,ans=""; getline(cin,s); if(s.size()<2) { cout<<s; return 0; } for(int i=0;i<s.size()-2;i++) if(isdigit(s[i])) { while(isdigit(s[i])) i++; while(s[i]==' ') i++; if(isdigit(s[i])) s=s.substr(0,i)+'Z'+s.substr(i,s.size()-i...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
449fb0eaf9cc2e10903e12cff505d419
1,700
PASSED
#include <iostream> #include <cstdlib> #include <cstdio> #include <cstring> #define for1(i,a,b) for(i=a;i<=b;i++) #define for2(i,a,b) for(i=a;i>=b;i--) using namespace std; const int maxn=10003; int n; char s[maxn]; inline int find(char ch){ int i; for1(i,1,n) if (s[i]==ch)return i; return 0; } inline void e...
C++
c7d8c71a1f7e6c7364cce5bddd488a2f
01e27c0f0a87bc99e53e1c57aeb3b077
1,700
PASSED