coderhelp234 | Unsorted

Telegram-канал coderhelp234 - Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

767

@Codeforces_Codechef_freesolution

Subscribe to a channel

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int t;
cin>>t;

while(t--)
{
int m,p;
cin>>m>>p;

int ans=0;
int tim=m;

while(tim<299 && (tim+1+p+20)<=1000)
{
ans++;
tim++;
p+=20;
}

cout<<ans<<endl;

}


return 0;
}

// Winning World Finals

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Today contest --
Codechef starters 152
Time - 8:00 pm (IST)

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Upcoming contest --
Leetcode weekly

Tomorrow morning 8 A.M.

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 998244353;

int32_t main() {
int n, k;
cin >> n >> k;

vector<int> a(n), pre(n + 1, 0), dp(n + 1, 0), cnt_pre(n + 1, 0);
for (int i = 0; i < n; i++) {
cin >> a[i];
}

for (int i = 1; i <= n; i++) {
pre[i] = pre[i - 1] + a[i - 1];
}

dp[0] = 1;
cnt_pre[0] = 1;

unordered_map<int, int> pre_cnt;
pre_cnt[0] = 1;

for (int i = 1; i <= n; i++)
{
dp[i] = cnt_pre[i - 1] % MOD;

if (pre_cnt.find(pre[i] - k) != pre_cnt.end())
{
int invalid = pre_cnt[pre[i] - k];
dp[i] = (dp[i] - invalid + MOD) % MOD;
}

cnt_pre[i] = (cnt_pre[i - 1] + dp[i]) % MOD;
pre_cnt[pre[i]] = (pre_cnt[pre[i]] + dp[i]) % MOD;
}

cout << dp[n] % MOD << endl;

return 0;
}

// E - Avoid K partitions

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
string s,t;
cin>>s>>t;

if(s==t)
{
cout<<0<<endl;
}
else
{
vector<string>soln;
int cnt=0;

while(s!=t)
{
bool check=false;

int n=s.size();
string ans="";
int store;
int store1;

for(int i=0;i<n;i++)
{
if(s[i]==t[i])
{
ans+=s[i];
}
else if((int)s[i]-'a'>(int)t[i]-'a')
{
check=true;
ans+=t[i];
store=i;
break;
}
else
{
store1=i;
}
}


if(check==true)
{
cnt++;

s[store]=t[store];
ans="";
for(int j=0;j<n;j++)
{
if(j!=store)
{
ans+=s[j];
}
else
{
ans+=t[store];
}
}

soln.push_back(ans);
}
else
{
cnt++;
ans="";
for(int j=0;j<n;j++)
{
if(j!=store1)
{
ans+=s[j];
}
else
{
ans+=t[store1];
}
}

s[store1]=t[store1];
soln.push_back(ans);
}

}

cout<<cnt<<endl;

for(int i=0;i<soln.size();i++)
{
cout<<soln[i]<<endl;
}

}

return 0;

}

// Word ladder

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int L, R;
cin >> L >> R;

if ((L == 1 && R == 1) || (L == 0 && R == 0))
{
cout << "Invalid" << endl;
}
else if (L == 1 && R == 0)
{
cout << "Yes" << endl;
}
else if (L == 0 && R == 1)
{
cout << "No" << endl;
}

return 0;
}

// Raise both hands

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

All codes and answers of MCQ will be available free in this channel 🔥🔥

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Meta Hacker Cup is Back!

Get ready for an epic coding showdown and a chance to score an exclusive Hacker Cup T-shirt and many more! 🏆👕 Don't miss out on this amazing opportunity—register now!

📅 Practice Round: Friday, September 20th, 10 AM Pacific (72 hours)
📅 Round 1: Saturday, October 5th, 10 AM Pacific (3 hours)
📅 Round 2: Saturday, October 19th, 10 AM Pacific (3 hours)

Join the competition and show off your coding skills! 🚀

Register here: https://www.facebook.com/codingcompetitions/hacker-cup

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

All comments are removed

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;

#define int long long

int32_t main()
{
int t;
cin>>t;

while(t--)
{
int n;
cin>>n;
int m=n;
map<int,int>mp;
int maxi=0;
int ans=0;
int counter=0;

while(n--)
{
int x,y;
cin>>x>>y;

mp[y]++;
counter++;

int some=mp[y]-1-1;
ans-=(some)*(some+1)/2;
int full=mp[y]-1;
ans+=(full)*(full+1)/2;

// cout<<ans<<"ds"<<endl;

if(mp[y]>maxi)
{
maxi=mp[y];
}

full=maxi-1;
int soln=ans;
soln-=(full)*(full+1)/2;

// cout<<soln<<"dss"<<endl;


full=maxi+(m-counter)-1;
// cout<<full<<" "<<maxi<<"s"<<endl;
soln+=(full)*(full+1)/2;

cout<<soln<<" ";

}

cout<<endl;

}
return 0;
}

// make equal pairs - hard

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int x,y,z;
cin>>x>>y>>z;

int sum=x+y+z;
float tot=(4-sum)*1;
tot+=x*1;
tot+=(0.5)*y;

float opp=(0.5*y)+(z*1);

if(tot>opp)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}


return 0;
}

// A- Chess Olympiad

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

I am busy this week , I will continue providing solutions from next week

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Only 10 min left
submit till E rank around 1100 will be confirmed, if want F then increase subscribers of this channel 400+

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int h, w, q;
cin >> h >> w >> q;

vector<set<int>> rw(h + 1), cw(w + 1);

for (int i = 1; i <= h; ++i)
{
for (int j = 1; j <= w; ++j)
{
rw[i].insert(j);
cw[j].insert(i);
}
}

for (int x = 0; x < q; x++)
{
int r, c;
cin >> r >> c;

if (rw[r].find(c) != rw[r].end())
{
rw[r].erase(c);
cw[c].erase(r);
}
else
{
auto up = cw[c].lower_bound(r);
if (up != cw[c].begin())
{
--up;
rw[*up].erase(c);
cw[c].erase(up);
}

auto down = cw[c].upper_bound(r);
if (down != cw[c].end())
{
rw[*down].erase(c);
cw[c].erase(down);
}

auto left = rw[r].lower_bound(c);
if (left != rw[r].begin())
{
--left;
cw[*left].erase(r);
rw[r].erase(left);
}

auto right = rw[r].upper_bound(c);
if (right != rw[r].end())
{
cw[*right].erase(r);
rw[r].erase(right);
}
}
}

int remaining = 0;
for (int i = 1; i <= h; i++)
{
remaining += rw[i].size();
}

cout << remaining << endl;

return 0;
}

// Cross Explosion

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int n;
cin>>n;

vector<vector<int>>vec(n,vector<int>(n,0));

for(int i=0;i<n;i++)
{
for(int j=0;j<=i;j++)
{
cin>>vec[i][j];
}
}

int counter=1;
int back=1;
int ans=back;

while(counter<=n)
{
if(back>=counter)
{
ans=vec[back-1][counter-1];
}
else
{
ans=vec[counter-1][back-1];
}

back=ans;

counter++;


}

cout<<ans<<endl;

return 0;
}

// Binary Alchemy

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Happy Ganesh Chaturthi

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Juspay Hiring Challenge 2024
Batches eligible: 2024 & 2025 passouts

Competition Structure:
Round 1: MCQ Assessment:
Round 2: Coding Challenge
Round 3: Final Interviews

• The shortlisted candidates will be hired as interns for 8-12 months (full-time, in-office) and will be converted to full-time completely on the basis of their performance.
• Internship stipend will be INR 40,000 per month. 
• Full-time offered candidates will be compensated with INR 21-27 lakhs per annum.

Apply Link: https://bit.ly/JuspayHiringChallenge2024

Last date of registration: 18th September, 2024

Share our channel with you friends also for all off campus opportunities and solutions

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

Minops fails on last test case from last 30 mins , frustrated now

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
int t;
cin>>t;

while(t--)
{
int n;
cin>>n;
int m=n;
map<int,int>mp;
int maxi=0;
int ans=0;
int counter=0;

while(n--)
{
int x,y;
cin>>x>>y;

mp[y]++;
counter++;

int some=mp[y]-1-1;
ans-=(some)*(some+1)/2;
int full=mp[y]-1;
ans+=(full)*(full+1)/2;


if(mp[y]>maxi)
{
maxi=mp[y];
}

full=maxi-1;
int soln=ans;
soln-=(full)*(full+1)/2;


full=maxi+(m-counter)-1;
soln+=(full)*(full+1)/2;

cout<<soln<<" ";

}

cout<<endl;

}

return 0;
}

Читать полностью…

Juspay exam Solution | Codeforces div 2 free solution| Codechef| Codeforces| Atcoder| free solution

#include<bits/stdc++.h>
using namespace std;

#define int long long

int32_t main()
{
int t;
cin>>t;

while(t--)
{
int n;
cin>>n;

vector<int>vec(n);

for(int i=0;i<n;i++)
{
cin>>vec[i];
}

vector<int>store(101,0);

for(int i=0;i<n;i++)
{
store[vec[i]]++;
}

int some=store[0];
int maxi=0;
int ind=-1;

//cout<<some<<endl;

for(int i=1;i<=100;i++)
{
// maxi=max(maxi,store[i]);

if(store[i]>maxi)
{
maxi=store[i];
ind=i;
}
}

maxi=maxi+some;
//cout<<maxi<<endl;

maxi--;

int ans=maxi*(maxi+1)/2;

for(int i=1;i<=100;i++)
{
if(i!=ind)
{
ans+=(store[i]-1)*(store[i])/2;
}

}

cout<<ans<<endl;


}
return 0;
}

// Equal pairs easy

Читать полностью…
Subscribe to a channel