Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions Codeforces Solutions/1030A - In Search of an Easy Problem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//Author: Akash Gautam (@geekblower)
//Date: 11-07-2022
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define GEEKBLOWER ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define TEST_CASES create(t);while(t--)
#define SOLUTION solve(); return 0;
#define display(n) cout<<n<<endl;
#define VI vector<int>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define loop(i,a,b,c) for(int i=a;i<b;i+=c)
#define revloop(i,a,b,c) for(int i=a;i>=b;i-=c)
#define start_loop loop(i,0,n,1)
#define start_revloop revloop(i,n,0,1)
#define create(n) int n;cin>>n;
#define def(a,n) int a[n];start_loop cin>>a[i];
#define print(a) for(auto i : a){cout<<i<<" ";}cout<<endl;
#define vector(a,n) VI a;loop(i,0,m,1){int x;cin>>x;a.PB(x);}
inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}
const int MOD = 1000000007;

void solve() {
create(n)
def(arr,n)

start_loop {
if(arr[i]) {
display("HARD");
return;
}
}

display("EASY")
}

int32_t main() {
GEEKBLOWER
SOLUTION
}
46 changes: 46 additions & 0 deletions Codeforces Solutions/1077A - Frog Jumping.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//Author: Akash Gautam (@geekblower)
//Date: 13-08-2022
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define GEEKBLOWER ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define TEST_CASES create(t);while(t--)
#define SOLUTION solve(); return 0;
#define display(n) cout<<n<<endl;
#define VI vector<int>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define loop(i,a,b,c) for(int i=a;i<b;i+=c)
#define revloop(i,a,b,c) for(int i=a;i>=b;i-=c)
#define start_loop loop(i,0,n,1)
#define start_revloop revloop(i,n,0,1)
#define create(n) int n;cin>>n;
#define def(a,n) int a[n];start_loop cin>>a[i];
#define print(a) for(auto i:a){cout<<i<<" ";}cout<<endl;
#define vector(a,n) VI a;loop(i,0,n,1){int x;cin>>x;a.PB(x);}
inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}
const int MOD = 1000000007;

void solve() {
create(a)
create(b)
create(k)

int ans = 0;

ans += (k/2)*a;
ans -= (k/2)*b;

ans += (k&1) ? a : 0;

display(ans)
}

int32_t main() {
GEEKBLOWER
TEST_CASES
SOLUTION
}
46 changes: 46 additions & 0 deletions Codeforces Solutions/110A - Nearly Lucky Number.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//Author: Akash Gautam (@geekblower)
//Date: 01-08-2022
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define GEEKBLOWER ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define TEST_CASES create(t);while(t--)
#define SOLUTION solve(); return 0;
#define display(n) cout<<n<<endl;
#define VI vector<int>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define loop(i,a,b,c) for(int i=a;i<b;i+=c)
#define revloop(i,a,b,c) for(int i=a;i>=b;i-=c)
#define start_loop loop(i,0,n,1)
#define start_revloop revloop(i,n,0,1)
#define create(n) int n;cin>>n;
#define def(a,n) int a[n];start_loop cin>>a[i];
#define print(a) for(auto i : a){cout<<i<<" ";}cout<<endl;
#define vector(a,n) VI a;loop(i,0,n,1){int x;cin>>x;a.PB(x);}
inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}
const int MOD = 1000000007;

void solve() {
create(n)
int count = 0;

while(n) {
if(n%10==4 || n%10==7)
count++;
n /= 10;
}

if(count==4 || count==7)
display("YES")
else
display("NO")
}

int32_t main() {
GEEKBLOWER
SOLUTION
}
45 changes: 45 additions & 0 deletions Codeforces Solutions/112A - Petya and Strings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//Author: Akash Gautam (@geekblower)
//Date: 25-06-2022
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

#define endl '\n'
#define GEEKBLOWER ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define TEST_CASES create(t);while(t--)
#define SOLVE solve(); return 0;
#define VI vector<int>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(a.begin(),a.end())
#define loop(i,a,b,c) for(int i=a;i<b;i+=c)
#define revloop(i,a,b,c) for(int i=a;i<b;i-=c)
#define start_loop loop(i,0,n,1)
#define start_revloop revloop(i,0,n,1)
#define create(n) int n;cin>>n;
#define def(a,n) int a[n];start_loop cin>>a[i];
#define print(a) for(auto i : a){cout<<i<<" ";}cout<<endl;
const int MOD = 1e9+7;

int solve() {
string str1, str2;
cin>>str1>>str2;
int n = str1.length();
start_loop {
char ch1 = toupper(str1[i]);
char ch2 = toupper(str2[i]);
if(ch1 > ch2)
return 1;
if(ch1 < ch2)
return -1;
}
return 0;
}

int32_t main() {
GEEKBLOWER
int n = solve();
cout<<n;
}
45 changes: 45 additions & 0 deletions Codeforces Solutions/1154A - Restoring Three Numbers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//Author: Akash Gautam (@geekblower)
//Date: 08-07-2022
#include <iostream>
#include <algorithm>
using namespace std;

#define endl '\n'
#define GEEKBLOWER ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define TEST_CASES create(t);while(t--)
#define SOLUTION solve(); return 0;
#define display(n) cout<<n<<endl;
#define VI vector<int>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define loop(i,a,b,c) for(int i=a;i<b;i+=c)
#define revloop(i,a,b,c) for(int i=a;i>=b;i-=c)
#define start_loop loop(i,0,n,1)
#define start_revloop revloop(i,n,0,1)
#define create(n) int n;cin>>n;
#define def(a,n) int a[n];start_loop cin>>a[i];
#define print(a) for(auto i : a){cout<<i<<" ";}cout<<endl;
#define vector(a,n) VI a;loop(i,0,m,1){int x;cin>>x;a.PB(x);}
inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}
const int MOD = 1000000007;

void solve() {
int n = 4;
int arr[4];
start_loop
cin>>arr[i];

sort(arr, arr+n);

for(int i=0; i<3; i++)
cout<<arr[3]-arr[i]<<" ";

cout<<endl;
}

int32_t main() {
GEEKBLOWER
SOLUTION
}
48 changes: 48 additions & 0 deletions Codeforces Solutions/116A - Tram.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//Author: Akash Gautam (@geekblower)
//Date: 17-07-2022
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define GEEKBLOWER ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define TEST_CASES create(t);while(t--)
#define SOLUTION solve(); return 0;
#define display(n) cout<<n<<endl;
#define VI vector<int>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define loop(i,a,b,c) for(int i=a;i<b;i+=c)
#define revloop(i,a,b,c) for(int i=a;i>=b;i-=c)
#define start_loop loop(i,0,n,1)
#define start_revloop revloop(i,n,0,1)
#define create(n) int n;cin>>n;
#define def(a,n) int a[n];start_loop cin>>a[i];
#define print(a) for(auto i : a){cout<<i<<" ";}cout<<endl;
#define vector(a,n) VI a;loop(i,0,n,1){int x;cin>>x;a.PB(x);}
inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}
const int MOD = 1000000007;

void solve() {
create(n)
int total=0, ans=0;

start_loop {
create(a)
create(b)
int temp = total;

total -= a;
total += b;

ans = max(total, ans);
}

display(ans)
}

int32_t main() {
GEEKBLOWER
SOLUTION
}
41 changes: 41 additions & 0 deletions Codeforces Solutions/1186A - Vus the Cossack and a Contest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//Author: Akash Gautam (@geekblower)
//Date: 18-08-2022
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define GEEKBLOWER ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define TEST_CASES create(t);while(t--)
#define SOLUTION solve(); return 0;
#define display(n) cout<<n<<endl;
#define VI vector<int>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define loop(i,a,b,c) for(int i=a;i<b;i+=c)
#define revloop(i,a,b,c) for(int i=a;i>=b;i-=c)
#define start_loop loop(i,0,n,1)
#define start_revloop revloop(i,n,0,1)
#define create(n) int n;cin>>n;
#define def(a,n) int a[n];start_loop cin>>a[i];
#define print(a) for(auto i : a){cout<<i<<" ";}cout<<endl;
#define vector(a,n) VI a;loop(i,0,n,1){int x;cin>>x;a.PB(x);}
inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}
const int MOD = 1000000007;

void solve() {
create(n)
create(m)
create(k)

if(m>=n && k>=n)
display("YES")
else
display("NO")
}

int32_t main() {
GEEKBLOWER
SOLUTION
}
46 changes: 46 additions & 0 deletions Codeforces Solutions/1234A - Equalize Prices Again.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//Author: Akash Gautam (@geekblower)
//Date: 15-08-2022
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define GEEKBLOWER ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define TEST_CASES create(t);while(t--)
#define SOLUTION solve(); return 0;
#define display(n) cout<<n<<endl;
#define VI vector<int>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define loop(i,a,b,c) for(int i=a;i<b;i+=c)
#define revloop(i,a,b,c) for(int i=a;i>=b;i-=c)
#define start_loop loop(i,0,n,1)
#define start_revloop revloop(i,n,0,1)
#define create(n) int n;cin>>n;
#define def(a,n) int a[n];start_loop cin>>a[i];
#define print(a) for(auto i : a){cout<<i<<" ";}cout<<endl;
#define vector(a,n) VI a;loop(i,0,n,1){int x;cin>>x;a.PB(x);}
inline int GCD(int a,int b){return !b?a:GCD(b,a%b);}
const int MOD = 1000000007;

void solve() {
create(n)
def(arr,n)

int sum = 0;
start_loop {
sum += arr[i];
}

if(sum%n)
display(sum/n+1)
else
display(sum/n)
}

int32_t main() {
GEEKBLOWER
TEST_CASES
SOLUTION
}
Loading