# Daily Coding Challenge #52

Daily Coding Challenge (81 Part Series)

This is a series of Daily Coding Challenge. Each day I show a few solutions written in C++. The questions are from coding practice/contest sites such as HackerRank, LeetCode, Codeforces, Atcoder and etc.

/*
Codeforces Round #654 (Div. 2) - A. Magical Sticks
https://codeforces.com/contest/1371/problem/A
*/

#include <bits/stdc++.h>
using namespace std;
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)

int main()
{
FAST_INP;
int n,t;
cin >> t;
while(t--){
cin >> n;
if(n%2==0) cout << n/2 << endl;
else cout << (n/2)+1 << endl;
// or cout << (n+1)/2 << endl;
}
return 0;
}

/*
Codeforces Round #654 (Div. 2) - B. Magical Calendar
https://codeforces.com/contest/1371/problem/B
*/

#include <bits/stdc++.h>
using namespace std;
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)

int main()
{
FAST_INP;
long long t,n,r,ans;
cin >> t;
while(t--){
cin >> n >> r;
if(n>r) ans=(r*(r+1))/2;
else ans=((n*(n-1))/2)+1;
cout<<ans<<endl;
}
return 0;
}

/*
Codeforces Round #654 (Div. 2) - C. A Cookie for You
https://codeforces.com/contest/1371/problem/C
*/

#include <bits/stdc++.h>
using namespace std;
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)

int main()
{
FAST_INP;
long long t,a,b,n,m;
cin >> t;
while(t--){
cin >> a >> b >> n >> m;
if(min(a,b)<m) cout << "No" << endl;
else if(a+b<n+m) cout << "No" << endl;
else cout << "Yes" << endl;
}
return 0;
}

The source code is available in corresponding repo below. Star and watch for timely updates!

## wingkwong / atcoder

### 🏆 A Collection of my AtCoder Solutions with Explanations 🏆

Daily Coding Challenge (81 Part Series)

Posted on by:

### Wing-Kam

Consultant by day. Developer by night. AWS certified. Exploring #CloudNative currently.