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 ll long long using namespace std; int main(){ int n,x; cin >> n >> x; vector<ll> C(n); for(ll &c : C){ cin >> c; } sort(C.begin(), C.end()); ll sum = 0; for(ll i : C){ sum += i*x; if(x != 1)x--; } cout << sum; }
C++
ce27e56433175ebf9d3bbcb97e71091e
296d8f726945071f4f981fcd21299d43
1,200
PASSED
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int n, x; long long sum = 0; vector<int> c; //Input data cin >> n >> x; c.resize(n+1); for (int i = 1; i <= n; i++){ cin >> c[i]; } // Sort sort(c.begin(), c.end()); // Get ...
C++
ce27e56433175ebf9d3bbcb97e71091e
abcef30c7afcc8368fba91723315069f
1,200
PASSED
#include<iostream> #include<vector> #include<algorithm> using namespace std; unsigned long long DumbGuy(int n, int x, vector<unsigned long long>chapter) { unsigned long long count = 0; sort(chapter.begin(), chapter.end()); for (int i = 0; i < n; i++) { if (x - i <= 1) { count += chapter[i]; } else { co...
C++
ce27e56433175ebf9d3bbcb97e71091e
94c26f4be5abb6cb0e71ea2991b3b563
1,200
PASSED
#include <iostream> #include <algorithm> using namespace std; long long c[100001]; int main(){ long long cnt=0; int n,x; cin>>n>>x; for(int i=1;i<=n;i++){ cin>>c[i]; } sort(c+1,c+1+n); for(int i=1;i<=n;i++){ cnt+=c[i]*x; if(x>1){ x--; } } cout<<cnt; return 0; }
C++
ce27e56433175ebf9d3bbcb97e71091e
084f8a0a1fcf2c65a13cd6ad2dec9c9a
1,200
PASSED
#include <iostream> #include <algorithm> using namespace std; int main() { long long int n,x; cin>>n>>x; long long int c[n+20]; long long int counter=0,LL; for(long long int i=0;i<n;i++) cin>>c[i]; sort(c+0,c+n); for(long long int i=0;i<n;i++){ counter=counter+(c[i]*x); if(x>1) x--; } cout<<counter; ...
C++
ce27e56433175ebf9d3bbcb97e71091e
65966d27398be232d03862f6d2478da8
1,200
PASSED
// https://www.youtube.com/watch?v=tNdBLBleO90 // judge.cpp // codeforces // // Created by Laith on 8/21/18. // Copyright © 2018 Laith. All rights reserved. // #include<iostream> #include<vector> #include<string> #include<stdio.h> #include<sstream> #include<memory> #include<memory.h> #include<map> #include<stack>...
C++
ce27e56433175ebf9d3bbcb97e71091e
689484963ce4a999ce4202e8fda5dd25
1,200
PASSED
#include <bits/stdc++.h> #define pb push_back #define sz size using namespace std; typedef long long ll; typedef pair <ll, ll> pll; const ll N = 2e5; const ll INF = 1e9; ll a[N + 10], n, i, l, r, Q; pll d[N + 10]; vector <ll> p[N + 10]; void check(){ for(i = 1; i <= Q; ++ i)p[i].clear(); for(i = 1; i <= n;...
C++
e0450f2644494c92ec0d9ea3ab9d0056
6e9093fc382e2dbaa00fa658f6223387
1,700
PASSED
///In the name of ALLAH #include<bits/stdc++.h> using namespace std; typedef long long ll; 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 vector<pll> ...
C++
e0450f2644494c92ec0d9ea3ab9d0056
a26857d33281e09a5ef2df3644eda81e
1,700
PASSED
///In the name of ALLAH #include<bits/stdc++.h> using namespace std; typedef long long ll; 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 vector<pll> ...
C++
e0450f2644494c92ec0d9ea3ab9d0056
32238071f229fcc6a1abd0ad8864fd1a
1,700
PASSED
#include<bits/stdc++.h> using namespace std; const int MAXN = 2*100000+5; int n, q; int ans[MAXN], mrk1[MAXN], mrk2[MAXN], add[MAXN], mx; set < int > st; bool ok = 1; set < int > :: iterator it, itp; int main() { ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); cin >> n >> q; for( int i = 0; i < n; i+...
C++
e0450f2644494c92ec0d9ea3ab9d0056
9a321ae18470b00d125a054ceb6bc71e
1,700
PASSED
// // Created by watemus on 04.08.2020. // #ifdef LOCAL #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; #define ALL(a) a.begin(), a.end() #define RALL(a) a.rbegin(), a.rend() #define FF first #define SS second using ll = long long; using ld = long double; #define int ll template<type...
C++
e0450f2644494c92ec0d9ea3ab9d0056
8d840e3cffb4e3590ac5bd9916d428c5
1,700
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <cmath> #include <cstdlib> #include <algorithm> #include <stack> using namespace std; const int MAX=1000000; int que[MAX]; bool vis[MAX]; stack<int> s; int main(){ int n,q,num=-1,ans=0; memset(vis,false,sizeof(vis)); bool mar...
C++
e0450f2644494c92ec0d9ea3ab9d0056
e961239ea4b982c1fc1fceb75d1900d1
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define in first #define fin second #define mp make_pair #define all(x) x.begin(), x.end() typedef long long ll; const ll MaxN = 301002; ll n, q; ll save; ll a[MaxN]; bool vis[MaxN]; pair<ll, ll> rangos[MaxN]; int main () { ios_base::sync_with_stdio(0); cin.tie(0)...
C++
e0450f2644494c92ec0d9ea3ab9d0056
d6d685031458154d7998d20dd0ac4b39
1,700
PASSED
/* @author: sharrad99 */ #include<bits/stdc++.h> using namespace std; const int oo = 1e9; int main(){ #ifndef ONLINE_JUDGE freopen("C:\\Users\\sharr\\Documents\\Input.txt", "r", stdin); freopen("C:\\Users\\sharr\\Documents\\Output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout...
C++
e0450f2644494c92ec0d9ea3ab9d0056
59d1b55ce3de8377cf35f8552b147f63
1,700
PASSED
/* @author: sharrad99 */ #include<bits/stdc++.h> using namespace std; const int oo = 2e9; int main(){ #ifndef ONLINE_JUDGE freopen("C:\\Users\\sharr\\Documents\\Input.txt", "r", stdin); freopen("C:\\Users\\sharr\\Documents\\Output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout...
C++
e0450f2644494c92ec0d9ea3ab9d0056
031fb88208f6ea13fd8c794ec90a9eda
1,700
PASSED
/* @author: sharrad99 */ #include<bits/stdc++.h> using namespace std; const int oo = 1e9; int main(){ #ifndef ONLINE_JUDGE freopen("C:\\Users\\sharr\\Documents\\Input.txt", "r", stdin); freopen("C:\\Users\\sharr\\Documents\\Output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout...
C++
e0450f2644494c92ec0d9ea3ab9d0056
7e9f0e0107e2b86f1f20bf7ede3e4d12
1,700
PASSED
#include <bits/stdc++.h>/*{{{*/ using namespace std;typedef long long ll;typedef long double ld;void run();int main(){ios::sync_with_stdio(0);run();}/*}}}*/ int v[300000]; int s[1000004]; void run(){ int n,k; cin>>n>>k; for (int i=0; i<n; i++) cin>>v[i]; sort(v,v+n); for (int i=0; i<n; i++) ++s[v[i]+1]; fo...
C++
b963c125f333eef3ffc885b59e6162c2
6b2eadbd168fd1e587e30419f0531895
2,100
PASSED
#include <bits/stdc++.h> #define clr(x) memset((x), 0, sizeof(x)) #define all(x) (x).begin(), (x).end() #define pb push_back #define mp make_pair #define For(i, st, en) for(int i=(st); i<=(int)(en); i++) #define Ford(i, st, en) for(int i=(st); i>=(int)(en); i--) #define forn(i, n) for(int i=0; i<(int)(n); i++) #define ...
C++
b963c125f333eef3ffc885b59e6162c2
11c67a2be3132c7a7e13c96481ebe9e5
2,100
PASSED
#include <iostream> #include <algorithm> #include <vector> using namespace std; const int MAX_N = 3e5 + 10, MAX_A = 1e6 + 10; int N, K, A[MAX_N]; pair<int, int> c[MAX_A]; int main() { cin >> N >> K; for (int i = 0; i < N; ++i) { cin >> A[i]; } sort(A, A + N); for (int i = 1, l = 0, r ...
C++
b963c125f333eef3ffc885b59e6162c2
353eb7c55b2fded94b9f7b1350076c58
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define TR(i,v) for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i) #define DEBUG(x) cout << #x << " = " << x << endl; #define SIZE(p) (int)(p).size() #define MP(a, b) make_pair((a), (b)) #define ALL(p) (p).begin(), (p).end() #def...
C++
b963c125f333eef3ffc885b59e6162c2
03fc61e0f74b6fdcd083dc4bc545d89a
2,100
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <queue> #include <map> #include <vector> #include <utility> #include <set> #include <cstdlib> using namespace std; typedef pair<int, int> PII; typedef long long LL; const int maxn = 1000005; const int mask = (1 << 17...
C++
b963c125f333eef3ffc885b59e6162c2
02ace18ebc2a5bbac5fc2486dba7fff2
2,100
PASSED
#include <iostream> #include <algorithm> #include <set> #define nmax 300005 using namespace std; int n, k, sol = 1000000; int v[nmax]; bool stop; int main() { cin>>n>>k; for(int i=1; i<=n; i++) cin>>v[i], sol = min(sol, v[i]); while(!stop) { stop = true; for(int i=1; i<=n...
C++
b963c125f333eef3ffc885b59e6162c2
213d164e9650d939ce17b828474b4ea4
2,100
PASSED
#include <iostream> using namespace std; const int N=2020202; int st[N*2]; int sum(int a, int b){ a+=N; b+=N; int s=0; while (a<=b){ if (a%2) s+=st[a++]; if (!(b%2)) s+=st[b--]; a/=2; b/=2; } return s; } int main(){ int n,k; cin>>n>>k; int mia=9999...
C++
b963c125f333eef3ffc885b59e6162c2
0b3621cb433fc973c34f774490837dea
2,100
PASSED
/* Author: Zhouxing Shi Created on Aug 20, 2014 */ #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <set> #include <cstdlib> #include <ctime> #include <map> #include <cmath> #include <string> #include <stack> #include <complex> #include <bitset> #include <ios...
C++
b963c125f333eef3ffc885b59e6162c2
5c26791e8964ff2879fc946b1e0a7719
2,100
PASSED
// Enjoy your stay. #include <bits/stdc++.h> #define EPS 1e-9 #define INF 1070000000LL #define MOD 1000000007LL #define fir first #define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++) #define ite iterator #define mp make_pair #define mt make_tuple #define rep(i,n) rep2(i,0,n) #define rep2(i,m,n) for(int i...
C++
b963c125f333eef3ffc885b59e6162c2
a7f8119d98f7a28fb1737d2f600ed449
2,100
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <string> #include <algorithm> #include <cstring> #include <queue> #include <set> #include <cstdlib> #include <cassert> #include <cmath> #include <map> #include <cctype> #define DEBUG 0 #if (DEBUG == 1) #define debug(fmt, ...) fprintf(stderr, fmt, ##...
C++
b963c125f333eef3ffc885b59e6162c2
d95a7ac357f9068526d7260fffae2606
2,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll b,q,l,m,x; cin>>b>>q>>l>>m; map<ll,int> a; for(int i=0;i<m;i++){ cin>>x; a[x]++; } if(abs(b)>l){ cout<<"0\n"; return 0;} if(b==0){ if(a[0]) cout<<"0\n"; else cout<<"inf\n"; ...
C++
749c290c48272a53e2e79730dab0538e
d6e91b45973be6c00247381d4ffe6abf
1,700
PASSED
#include <sstream> #include <string> #include <vector> #include <map> #include <algorithm> #include <iostream> #include <utility> #include <set> #include <cctype> #include <queue> #include <stack> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> using namespace std; bool contains(vector <long ...
C++
749c290c48272a53e2e79730dab0538e
50c3841059947de7d3df0f3bb4079762
1,700
PASSED
#include <iostream> #include <algorithm> using namespace std; int main() { long long a; int b, c, d, e; cin >> a >> b >> c >> d; int n[d]; for(int i = 0; i < d; i++) { cin >> e; n[i] = e; } sort(n, n + d); if(a == 0) { if(binary_search(n, n+d, 0)) cout << 0; else cout << "inf" << endl; } else...
C++
749c290c48272a53e2e79730dab0538e
6b16ce4ed6ac6b33664cab931fc73a78
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; map<ll,int>mp; int main(){ //ll xx=1000000000; //xx*=xx; //cout<<xx<<' '<<xx+11<<endl; ll b1,q,l,m; cin>>b1>>q>>l>>m; while(m--){ ll x; cin>>x; mp[x]=1; } ll sum=b1; ll sk=b1; ll cnt=0;...
C++
749c290c48272a53e2e79730dab0538e
97342d63cbf47b706ed405dbe9991acb
1,700
PASSED
#include<bits/stdc++.h> #define sd(x) scanf("%d",&x) #define sl(x) scanf("%ld",&x) #define sld(x) scanf("%lld",&x) #define sf(x) scanf("%f",&x) #define slf(x) scanf("%lf",&x) #define sc(x) scanf("%c",&x) #define ss(x) scanf("%s",&x) #define pf printf #define rn return #define cn continue #define pb push_back #define ...
C++
749c290c48272a53e2e79730dab0538e
f4e442b50823a19ab4fa4659d93db237
1,700
PASSED
#include<stdio.h> #include<bits/stdc++.h> #define ll long long typedef struct node node; using namespace std; ll a[100001]; map<ll,int>p; int chk(ll a,ll b,ll x) { while(a%b==0) { if(abs(a)<=abs(x)) break; a/=b; } if(a==x) return 1; return 0; }; int main() { ll b,q,l,m,i; cin>>b>>q>>l>>m;...
C++
749c290c48272a53e2e79730dab0538e
18f4c766a03f528a824361f8eba5959d
1,700
PASSED
#include <bits/stdc++.h> using namespace std; int main() { map<long long, int> v; long long b,q,l,m,x; cin>>b>>q>>l>>m; for(int i=0;i<m;i++) { cin>>x; v[x] = true; } long long cnt = 0, kk=0; for(long long i = b; abs(i) <= l && kk <= 100; i*=q, kk++) { if(!v...
C++
749c290c48272a53e2e79730dab0538e
16396fda4bc8c9ce084913af60b275d6
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int ,int > pii; typedef pair<ll ,ll > pll; const ll maxn =2e6; const ll mod = 1e9+7; const ld PI = 4 * atan((ld) 1); #define pb(x) push_back(x); #define endl '\n' #define dokme(x) cout << x ; return(0); #defi...
C++
32f245fa1a2d99bfabd30b558687ca5f
5cfac040381b97dc6facfa1de4e9796d
1,700
PASSED
#include <iostream> using namespace std; int arr[5005], dp[5005]; int main() { int n,m; cin>>n>>m; for(int i =0; i<n; ++i) { cin>>arr[i]; double y; cin>>y; } int ans = 1; for(int i =0; i<n; ++i) { dp[i] = 1; for(int j = i-1; j>=0; --j ){ if(arr[j] <= arr[i]) { dp[i] = ma...
C++
32f245fa1a2d99bfabd30b558687ca5f
c3340f7879afb97f4e2d8906cc16fb59
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define pb push_back #define inf 1e18 #define mod 1000000007 #define mp make_pair typedef long long int lli; typedef vector<lli> vi; typedef tuple<int,int,int>tup; typedef unsigned long long ull; typedef long double ld; typedef pair<lli,lli> pii; #define PI 3.14159265358...
C++
32f245fa1a2d99bfabd30b558687ca5f
5448e4f3f36df75d27e426d36daf3bd5
1,700
PASSED
// #pragma GCC optimize("Ofast,unroll-loops") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define dd double #define ld long double #define sl(n) scanf("%lld", &n) #define si(n) scanf("%d", &n) #define sd(n) scanf("%lf", &n) #d...
C++
32f245fa1a2d99bfabd30b558687ca5f
5601d2b9895aedafae0738c6d82e3a38
1,700
PASSED
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; typedef long long int lld; const lld N = 200043; const lld MOD = 1000000007; lld add(lld x, lld y) { x =((x%MOD)+(y%MOD))%MOD; while(x >= MOD) x -= MOD; while(x < 0) x += MOD; return x; } ll...
C++
32f245fa1a2d99bfabd30b558687ca5f
36a1efef58876420722891c31fbffe42
1,700
PASSED
/* " اللهم صلي و سلم علي سيدنا محمد و علي اله وصحبه اجمعين " */ #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #define f for #define ll long long #define ull unsigned long long #define endl "\n" #define intial(s1, s2, x, dp) f(int i = 0; i < s1; i++) f(int j = 0; j < s2; j++) dp[i][j] = x; us...
C++
32f245fa1a2d99bfabd30b558687ca5f
3808c8b127201d27a60e5c4dda786907
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define all(v) ((v).begin()),((v).end()) #define ll long long #define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) double const EPS = 1e-9, PI = acos(-1); const int N = 1e5 + 9, M = 5e3 + 9, OO = 1e9 + 7, MOD = 1e...
C++
32f245fa1a2d99bfabd30b558687ca5f
b5bd5be4c3046475856d599defe61556
1,700
PASSED
//http://codeforces.com/contest/270/problem/D /* * Author : Max Nguyen */ /******** All Required Header Files ********/ #include<bits/stdc++.h> using namespace std; /******* All Required define Pre-Processors and typedef Constants *******/ #define SCD(t) scanf("%d",&t) #define SCLD(t) scanf("%ld",&t) #define SCLLD(...
C++
32f245fa1a2d99bfabd30b558687ca5f
8b4011b429287a5fb7a6a15d5b9f4750
1,700
PASSED
/* ############################## ## Author: AAYUESH BARUI ##### ## College: LNMIIT ########### ############################## */ #include <bits/stdc++.h> //========================================================================================================// //===================================...
C++
32f245fa1a2d99bfabd30b558687ca5f
ecabb54eb243499541bed28594afe319
1,700
PASSED
#include <bits/stdc++.h> /** return NO_PAIN ? NO_GAIN : GAIN; */ using namespace std; #define all(v) v.begin(), v.end() #define sz(x) (int) x.size() #define Unique(x) x.erase(unique(all(x)), x.end()) #define endl "\n" #define pb push_back #define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0...
C++
32f245fa1a2d99bfabd30b558687ca5f
2dcf708e77d7f09fc7d239dcbcbcc8d2
1,700
PASSED
#include <bits/stdc++.h> #define ll long long #define F first #define pb push_back #define SF second.first #define SS second.second using namespace std; const ll N=1000006, MOD=1e9+7, INF=1e16; ll a[N], b[N], ans, n, m, mx, mn, l, r, x, y, z, o, k, q=1; vector <int> v[N]; string s; main(){ios_base::sync_with_stdio(fal...
C++
be9138aca8e1b8a5d722f99fcd70b685
9f85be89f273a17f5988421aaa0ba35d
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int l1; int main() { l1 t; cin>>t; while(t--){ l1 g,b,n; cin>>n>>g>>b; //l1 d=ceil(n/2); l1 ans=0; if(n<g){ cout<<n<<endl; continue; } l1 k=n/2,l; if(k*2==n)...
C++
be9138aca8e1b8a5d722f99fcd70b685
fd8d28469d54ec8654eb47363b3f6c63
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int inf = 0x3f3f3f3f; const int MAXN=220; ll T; void solve() { ll n,g,b,mod,ans,n1,n2,t; scanf("%lld%lld%lld",&n,&g,&b); if(g>=b) printf("%lld\n",n); else { n1=(n+1)/2; n2=n-n1; mod=n1%g; t=n1/g; if(mod==0) { t--; mod=g; ...
C++
be9138aca8e1b8a5d722f99fcd70b685
82f2e652a4f8ae7dac086d8e9b532db4
1,400
PASSED
#include <iostream> using namespace std; typedef long long ll; int main() { int t; cin>>t; for(int i=1;i<=t;i++){ ll n,a,b,res,x,y; cin>>n>>a>>b; /*if(i==1787){ res=n*10000+a*100+b; cout<<res<<"\n"; continue; }*/ res = (n+1)/2; ...
C++
be9138aca8e1b8a5d722f99fcd70b685
f3232142d5bde0078765780382bc8a34
1,400
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <set> #include <map> #include <algorithm> #include <string> #include <cmath> /* Author Information * Author: JokerNoCry * Time: 2020-07-16 10:53:20 * QQ:1160860141 **/ #define max(a,b) ((a>b)?(a):(b)) #define min(a,b) ((a<b)?(a):(b...
C++
be9138aca8e1b8a5d722f99fcd70b685
b009c6e4e07ec1e4b828b59e7ef7a72f
1,400
PASSED
#include<bits/stdc++.h> #define ll long long #define F first #define S second #define pb push_back #define pp pop_back #define in insert #define pii pair<int, int> #define pll pair<ll, ll> #define N int(1e5) + 5 #define T int(1e4) + 55 #define H int(1e3) + 55 #define mp make_pair using namespace std; ll t, n, a, g,...
C++
be9138aca8e1b8a5d722f99fcd70b685
d4956054f655ef75e3eb9b06da1065e4
1,400
PASSED
#include<iostream> #include<string> #include<algorithm> #include<cmath> #include<iomanip> #include<vector> #define ll long long using namespace std; ll tt; int main() { cin>>tt; while(tt--) { ll n,g,b,t,ans=0; cin>>n>>g>>b; t=(n+1)/2; if(g>=b||t<=g) { cout<<n<<end...
C++
be9138aca8e1b8a5d722f99fcd70b685
da2583bef8b641c7550192b139e87d2e
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; long long n,a,b,m,h; cin>>t; while(t--) { cin>>n>>a>>b; m=(n+1)/2; h=(m-1)/a*b+m; cout<<max(n,h)<<endl; } }
C++
be9138aca8e1b8a5d722f99fcd70b685
64de65bee08ceff5ed3dc4802548e310
1,400
PASSED
#include<iostream> #include<math.h> #include<algorithm> #define ll long long #define pb push_back #define ff first #define ss second using namespace std ; ll n,t ,m, x , y , ans , a , b ,mid ; ll pw(ll x ,ll os){ if(os==0)return 1; ll z=pw(x,os/2); if(os%2)return z*z*x; else return z*z; } int main() { cin>> t ; w...
C++
be9138aca8e1b8a5d722f99fcd70b685
32df39dd6a96930b882ff25ac5a0c6e5
1,400
PASSED
#include<iostream> #include<math.h> #include<algorithm> #define ll long long #define pb push_back #define ff first #define ss second using namespace std ; ll n,t ,m, x , y , ans , a , b ,mid ; ll pw(ll x ,ll os){ if(os==0)return 1; ll z=pw(x,os/2); if(os%2)return z*z*x; else return z*z; } int main() { cin>> t ; w...
C++
be9138aca8e1b8a5d722f99fcd70b685
407ff5ffb6b5cd37836d2701e95afda4
1,400
PASSED
#include <iostream> #include <map> using namespace std; int n; map<int, int> num; int main() { cin >> n; int minNum = 1000 * 1000 * 1000 + 1; for(int i = 0; i < n; i++) { int tmp; cin >> tmp; num[tmp]++; minNum = min(minNum, tmp); } for(int i = minNum; n > 0; i++) { if(num[i] == 0 || num[i] > num[i +...
C++
de41c260a37ec9db2371efb9d246a470
547ca3364ff19b0ac0554b5c6690b106
2,000
PASSED
#include <cstdio> #include <algorithm> #include <vector> using namespace std; /*bool isGood(vector<int> v, bool orig = false) { int n = (int)v.size(); if (n == 1) return false; bool beg = true; for (int i = 0; i < n; i++) { if (beg) { v[i] -= 1; beg = false; ...
C++
de41c260a37ec9db2371efb9d246a470
95e6111611a77b894c93dd8137cf4091
2,000
PASSED
#include <cstdio> #include <cstdlib> #include <iostream> #include <algorithm> #include <cstring> using namespace std; const int maxn=100100; int a[maxn]; int col[maxn]; int main() { int n,ta; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",a+i); if(n%2){ cout<<"NO"<<endl; return 0; ...
C++
de41c260a37ec9db2371efb9d246a470
aa9a80ac3cacbbf331d0746b49ef461a
2,000
PASSED
#include <cstdio> #include <cstdlib> #include <iostream> #include <algorithm> #include <cstring> using namespace std; const int maxn=100100; int a[maxn]; int col[maxn]; int main() { int n,ta; cin>>n; for(int i=0;i<n;i++) cin>>a[i]; if(n%2){ cout<<"NO"<<endl; return 0; } sort(...
C++
de41c260a37ec9db2371efb9d246a470
fc3bfe3cf60b89de4a3346e4bd6c8319
2,000
PASSED
#include<iostream> #include<algorithm> int const w=100000; using namespace std; string circle(int a[],int min,int max){ if (a[min] == 0) return "NO"; if(min+1==max) if(a[min]==a[max]){ return "YES"; return "NO"; } if(a[min+1] < a[min]+1) { return "NO"; } a...
C++
de41c260a37ec9db2371efb9d246a470
08e832661c9fdee3b43a9675a626928b
2,000
PASSED
#include <iostream> #include <algorithm> using namespace std; const int MAXN = 1000 * 100; int n, arr[MAXN + 10], t[MAXN + 10]; int main() { ios::sync_with_stdio(false); cin >> n; for(int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); for(int i = 1; i < n; i++) if(arr[i] - arr[i - 1] > 1) { cout <<...
C++
de41c260a37ec9db2371efb9d246a470
99befd67429a46f8b86ddc089fa9167f
2,000
PASSED
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <algorithm> using namespace std; #define pb push_back typedef long long ll; const int INF = 1000000000; const int prime = 9241; int main() { int n; scanf("%d",&n); if (n & 1) { cout << "NO"; return 0; } vector<int> p(...
C++
de41c260a37ec9db2371efb9d246a470
10f7efc4783814d137b6bdd09eddced4
2,000
PASSED
#include<cstdio> #include<cstring> #include<map> #include<algorithm> #include<iostream> #include<vector> #include<queue> #include<stdlib.h> #include<time.h> #include<math.h> using namespace std; int vis[100010]; int mi,ma; int dfs(int n) { if(n==ma) return vis[n]==0; if(vis[n]==0||vis[n]>vis[n+1]) return 0...
C++
de41c260a37ec9db2371efb9d246a470
2407078d60cd3dd7a089a12da78d4b7a
2,000
PASSED
#include <iostream> #include <cmath> #include <algorithm> #include <cmath> #include <cstdio> #include <vector> #include <string> #include <cstring> #include <map> #include <set> using namespace std ; #define ll long long #define pb push_back const int maxn = 1000 * 100 ; int n ; int a[maxn] ; int num[maxn+100] ; int...
C++
de41c260a37ec9db2371efb9d246a470
485c0b32854838784ca59f54af2438a6
2,000
PASSED
#include <iostream> #include <cmath> #include <algorithm> #include <cmath> #include <cstdio> #include <vector> #include <string> #include <cstring> #include <map> #include <set> using namespace std ; #define ll long long #define pb push_back const int maxn = 1000 * 100 ; int n ; int a[maxn] ; int num[maxn+100] ; int...
C++
de41c260a37ec9db2371efb9d246a470
5588a15f4a79318b4f8d48b8cb1c3fad
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define RI(a) scanf("%d",&a) #define RII(a,b) scanf("%d%d",&a,&b) #define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c) #define IOS ios_base::sync_with_stdio(0); cin.tie(0) #define ALL(a) a.begin(),a.end() #define F first #define S se...
C++
a559171e858d9a63c49fc9e0fecb44c7
c0cef227c02096063864cc1478f21570
1,900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,x; cin>>n>>x; if(n==1) { cout<<"YES"<<endl; cout<<x<<endl; } else if(n==2&&x==0) { cout<<"NO"<<endl; return 0; } else if(n==2) { // cout<<"YES"<<endl<<" "<<0<<" "<<x<<...
C++
a559171e858d9a63c49fc9e0fecb44c7
2d5e8ea216c8eaee6426320944c68ba1
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define ieps (int) 1e6 #define eps (int) 1e9 #define pii pair<int,int> int32_t main(){ // -- > < -- int n , x; scanf("%d%d" , &n , &x); if(n == 1){ printf("YES\n"); printf("%d" , x); re...
C++
a559171e858d9a63c49fc9e0fecb44c7
c9154fe13e24eb9383c0fcfafa575398
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define mp make_pair #define pb push_back #define ieps (int) 1e6 #define eps (int) 1e9 #define pii pair<int,int> int32_t main(){ int n , x; scanf("%d%d" , &n , &x); if(n == 1){ printf("YES\n"); printf("%d" , x); return 0; } i...
C++
a559171e858d9a63c49fc9e0fecb44c7
1832e4de5a7b4a1a3186c915b226efd7
1,900
PASSED
#include <bits/stdc++.h> #define MaxN 1000005 #define INF 2140000000 #define INV 262143 using namespace std; int N,X,alfa; int main() { cin>>N>>X; if(N==1) { cout<<"YES\n"<<X; } else if(N==2) { if(X==0) cout<<"NO"; else cout<<"YES\n"<<INV<<' '...
C++
a559171e858d9a63c49fc9e0fecb44c7
06f11e472697714a3c7d2e109171660b
1,900
PASSED
#include <iostream> #include <math.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> #include <algorithm> #include <sstream> #include <stack> #include <vector> #include <set> #include <map> #include <list> #include <string.h> #include <bitset> #include <queue> #define MOD 1e9 + 7 #define maxI 2147483647 #de...
C++
a559171e858d9a63c49fc9e0fecb44c7
be20d221ae7fe0ec35371d0778c55bde
1,900
PASSED
#include<bits/stdc++.h> //#include<ext/pb_ds/assoc_container.hpp> //#include<ext/pb_ds/tree_policy.hpp> #define reduce200ms ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define dofloat cout<<fixed<<setprecision(6) #define pb push_back #define mp make_pair #define x first #define y second #define bitcount _builti...
C++
a559171e858d9a63c49fc9e0fecb44c7
3b6ada586087df6422339a944c581f51
1,900
PASSED
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define MAXN 1000010 #define MAXE 400 #define INF 100000000 #define MOD 10001 #define LL long long #define p...
C++
a559171e858d9a63c49fc9e0fecb44c7
604fb359086054e5b77a692f20a6276b
1,900
PASSED
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i=a; i<=b; i++) #define ll long long #define pb push_back using namespace std; int A[100005], B[25], N, X; bool bad(bool already) { vector<int> vec; FOR(i,1,200000) vec.pb(i); FOR(i,1,N) { int idx = rand() % (N-i+1); int n = vec[idx]; ...
C++
a559171e858d9a63c49fc9e0fecb44c7
ad4176dc92d5636aca41e71398255f59
1,900
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; int a,b,c; bool compare(const pair<int,int>&i , const pair<int,int>&j) { return i.first*pow(2,b) - max(i.first - i.second,i.second) < j.first*pow(2,b) -max( j.first - j.second,j.second) ; } bool comp(const pair<int,int>&i , const pair<int,int>&j...
C++
87f4b8523d0047935931906ccc2ea911
a434b07173ad3356d0cd69b555d0712a
2,100
PASSED
#include <bits/stdc++.h> #define fi first #define se second #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define lowbit(x) x&-x #define pb push_back #define MP make_pair #define debug(x) cout<<"["<<x<<"]"<<endl #define FIN freopen("in.txt","r",stdin) using namespace std; typedef long long LL; typedef unsigned long...
C++
87f4b8523d0047935931906ccc2ea911
1853dfcff2813e4bf327639196f2e2c5
2,100
PASSED
#include <stdio.h> #include <fstream> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <stack> #include <set> #include <stdlib.h> #inclu...
C++
87f4b8523d0047935931906ccc2ea911
cfe0d9f9e3dd295b76f005d2c3f8d94d
2,100
PASSED
#include <stdio.h> #include <fstream> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <stack> #include <set> #include <stdlib.h> #inclu...
C++
87f4b8523d0047935931906ccc2ea911
f964a2fa87ae1930e46ccb5552fdbaac
2,100
PASSED
#include<bits/stdc++.h> using namespace std; long long int maxi(long long int a,long long int b) { if(a>b) return a; else return b; } long long int mini(long long int a,long long int b) { if(a>b) return b; else return a; } #define pb push_back #define mp make_pair int main() { long...
C++
87f4b8523d0047935931906ccc2ea911
d61de3d1910382f25cf8cbc9514d4f26
2,100
PASSED
#include<iostream> #include<algorithm> #define ll long long using namespace std; struct creature{ ll hp, dmg; }c[200005]; bool cmp(creature a, creature b){ return a.hp - a.dmg > b.hp - b.dmg; } int main(){ ll n, a, b, sum = 0, res; cin >> n >> a >>b; for(int i = 0; i < n; i++){ cin >> c[i].hp >> c[i].dmg; } ...
C++
87f4b8523d0047935931906ccc2ea911
5ecd9f1b23369aadcd2003852dd66cf6
2,100
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 2e6+1; long long hp[N], dm[N], cl[N], m2[21]; long long n, a, b, temp; void first() { m2[0] = 1; for (int i = 1; i <= 20; ++i) m2[i] = m2[i-1]*2; m2[0] = 0; } void enter() { //freopen("976E.inp","r",stdin); //freopen("976E.out",...
C++
87f4b8523d0047935931906ccc2ea911
a5bd1ce57dd780db3c2cb7ce178ea8f8
2,100
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <string> #include <cstring> #define pb push_back #define mp make_pair using namespace std; const int N = 2e5 + 5; int n; int a, b; long long tpow; struct creature{ long long hp, dmg; int id; bool topb = false; }c[N]; bool d...
C++
87f4b8523d0047935931906ccc2ea911
b3e27d0e80e48ea374e9a2a5963a942f
2,100
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 2e5+7; int book[N]; ll f[N], hp[N], dmg[N], anc[N], vis[N]; struct node { int id; ll val; bool operator < (const node & t)const { if(val!=t.val) { return val > t.val; } return id <...
C++
87f4b8523d0047935931906ccc2ea911
d7d0c0183d7b3fc93d0eac5d31b4a20b
2,100
PASSED
#include <algorithm> #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <cmath> #include <list> #include <map> #include <fstream> #include <queue> #include <set> #include <sstream> #include <stack> #include <bitset> #include <cctype> #include <vector> #include <comple...
C++
960e4c234666d2444b80d5966f1d285d
7fb3b24513c98ef23cf57ccd3a3f0678
1,300
PASSED
#include<stdio.h> #include<string.h> #include<string> #include<iostream> using namespace std; int main() { string str,str1; long int l,i,j=0,k=0; long long int count=0; cin>>str; l=str.size(); for(i=0;i<l;i++) { str1=str.substr(i,5); if(str1.compare("heavy")==0) { ...
C++
960e4c234666d2444b80d5966f1d285d
76acd8d02627405ccb1ac0d33ebb32d1
1,300
PASSED
#include<vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #inclu...
C++
960e4c234666d2444b80d5966f1d285d
a8164103f877b42d83ed2ec4d7065e51
1,300
PASSED
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; main() { __int64 i,j,l,count; string s; cin>>s; count=0; l=s.length(); j=0; for(i=0;i<l;i++) { //if(i<=l-5) if (s[i]=='h'&&s[i+1]=='e'&&s[i+2]=='a'&&s[i+3]=='v'&&s[i+4]=='y') { j++; i+=4; } if (s[i]=='m'&&s[i+1]=='e'&&s[...
C++
960e4c234666d2444b80d5966f1d285d
bb86245d4de9a299de8577fb11c98cce
1,300
PASSED
#include <cstdlib> #include <iostream> #include <stdio.h> #include <vector> #include <string> #include <ctime> #include <map> #include <cmath> #include <fstream> #include <iterator> #include <cstring> #include <algorithm> #include <set> #include <cassert> #include <list> #include <sstream> #include <stack> #include <qu...
C++
960e4c234666d2444b80d5966f1d285d
a604e08ca3457ba525cab5a3eac168b7
1,300
PASSED
#include<iostream> #include<string.h> #include<stdio.h> using namespace std; int kiemtra(int k, char s[]) { if(s[k]=='h' && s[k+1]=='e' && s[k+2]=='a' && s[k+3]=='v' && s[k+4]=='y') return 1; if(s[k]=='m' && s[k+1]=='e' && s[k+2]=='t' && s[k+3]=='a' && s[k+4]=='l') return 2; return 0; } int main() { cha...
C++
960e4c234666d2444b80d5966f1d285d
0e26131af7fc1bb36101ed84aef10eaa
1,300
PASSED
#include <iostream> #include <string> #include <cmath> using namespace std; int main() { string str; cin >> str; int count = 0; long long count2 =0; for(int i = 0; i < str.size();i++) { if(str.substr(i,5) == "heavy" ) count ++; if(str.substr(i,5) == "metal") count...
C++
960e4c234666d2444b80d5966f1d285d
c0af0a4224bba81bab668c19b8307931
1,300
PASSED
#include <string> #include <iostream> using namespace std; int main() { long long count = 0; string str; long long count2 = 0; cin >> str; for(int i = 0 ; i+ 4 < str.size();i++) { if(str.substr(i,5) == "heavy" ) count ++; if(str.substr(i,5) == "metal") count2 += count; ...
C++
960e4c234666d2444b80d5966f1d285d
22ead10f6b3385d5e6443eba09b97f87
1,300
PASSED
#include <iostream> #include <map> #include <math.h> #include <stdlib.h> #include <stdio.h> #include <string> #include <string.h> #include <vector> #include <algorithm> #include <sstream> #include <bitset> #include <cmath> #include <cstdio> using namespace std; typedef long long ll; int main(int argc, const char * a...
C++
960e4c234666d2444b80d5966f1d285d
3074aaa28f8dc0c1cc2d652e49f9b97b
1,300
PASSED
#include <iostream> #include <map> #include <math.h> #include <stdlib.h> #include <stdio.h> #include <string> #include <string.h> #include <vector> #include <algorithm> #include <sstream> #include <bitset> #include <cmath> #include <cstdio> using namespace std; typedef pair<int,int> ii; typedef long long ll; typedef ...
C++
960e4c234666d2444b80d5966f1d285d
beb6b143ec695b3765b08049d3c52569
1,300
PASSED
#include <bits/stdc++.h> #define endl '\n' typedef long long ll; typedef long double ld; using namespace std; vector<int> parent; int find(int a) { if (parent[a] == a) return a; else { parent[a] = find(parent[a]); return parent[a]; } } void merge(int a, int b) { parent[find(b)] = find(a); } int main() { i...
C++
c4b7265ff4332225c0d5617c3233a910
4513795a3442bcba6bb5048c94d7c810
1,600
PASSED
#include<algorithm> #include<iostream> #include<cstring> #include<string> #include<vector> #include<cstdio> #include<cmath> #include<map> #include<set> using namespace std; int n,a[105],d[105],c[105]; bool v[105]; int cnt=0; void dfs(int x) { int t=cnt; c[x]=cnt; v[x]=1; for(int i=1;i<=n;i++) if(!v[i]) ...
C++
c4b7265ff4332225c0d5617c3233a910
e1e8e887a220e0ebb481ad017388be90
1,600
PASSED
#include<algorithm> #include<iostream> #include<cstring> #include<string> #include<vector> #include<cstdio> #include<cmath> #include<map> #include<set> using namespace std; int n,g[105],a[105],d[105]; int FD(int x) { if(x==g[x]) return g[x]; return g[x]=FD(g[x]); } void U(int x,int y) { //cout<<x<<' '<<y<<endl;...
C++
c4b7265ff4332225c0d5617c3233a910
c8a8aebf9d752c3d5160d5c8ff7c9c1c
1,600
PASSED
#include <cstdio> using namespace std; int n,a[105],f[105],d[105]; int find(int x){ if(f[x]==x) return x; else return f[x]=find(f[x]); } void combine(int x,int y){ x=find(x); y=find(y); f[x]=y; } int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ f[i]=i; scanf("%d",&a[i]); } for(int i=1;i<=n;i++) scanf("...
C++
c4b7265ff4332225c0d5617c3233a910
fac3e8c7f55743085e415aa9815b0354
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int f[102],n,b[102],a[102]; int find(int x){ if(f[x]==x){ return x; }else{ return f[x]=find(f[x]); } } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; f[i]=i; } for(int i=1;i<=n;i++){ cin>>b[i]; if(i+b[i]<=n){ f[find(i)]=find(i+b[i]); } if(i-b...
C++
c4b7265ff4332225c0d5617c3233a910
e03b5808c5c41a771d12ea9181616fdb
1,600
PASSED
#include<iostream> using namespace std; int n,goal[105],change[105],father[105]; int find(int x) { if(father[x]!=x) { father[x]=find(father[x]); } return father[x]; } void unionn(int a,int b) { if(b<=0||b>n) { return; } father[find(a)]=find(b); } int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>goal[i...
C++
c4b7265ff4332225c0d5617c3233a910
6d0f8e0bf1d64921d16b86fac6d2c0f8
1,600
PASSED
#include<iostream> using namespace std; int a[105],b[105],n,c[105]; int find(int k) { if(k==b[k]) return k; else return b[k]=find(b[k]); } void un(int x,int y) { int xx=find(x); int yy=find(y); if(xx!=yy) b[xx]=yy; } int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; b[i]=i; } for(int i=1;i<=n;i++) ...
C++
c4b7265ff4332225c0d5617c3233a910
91e990080fb3ff97c448facd38c99589
1,600
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n,a[105],fa[105]; inline int Get_fa(int x){ if(x==fa[x])return x; return fa[x]=Get_fa(fa[x]); } int main(){ cin>>n; for(int i=1;i<=n;i++) scanf("%d",&a[fa[i]=i]); for(int i=1,x;i<=n;i++){ scanf("%d",&x); int f1...
C++
c4b7265ff4332225c0d5617c3233a910
cba6aeebbd970e879f05eefc3429ce58
1,600
PASSED
#include<cstdio> #include<algorithm> using namespace std; const int N=1e3+5; int fa[N],a[N],d[N],n; void build(int n) { for(int i=1;i<=n;i++) fa[i]=i; } int findfa(int x) { if(fa[x]!=x)fa[x]=findfa(fa[x]); return fa[x]; } void add(int x,int y) { int fx=findfa(x),fy=findfa(y); if(fx!=fy)fa[fx...
C++
c4b7265ff4332225c0d5617c3233a910
4c06d232ded29dc6cfde7da09b9f683c
1,600
PASSED