#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll N=1e5+10;
class dsu
{
public:
vector<ll> parent,size;
dsu(ll n) {
parent.resize(n + 1);
size.resize(n + 1,1);
for (ll i = 0; i <= n; i++) parent[i] = i;
}
ll par(ll node) {
if (node == parent[node])
return node;
return parent[node]=par(parent[node]);
}
void usize(ll u,ll v) {
ll ulp_u=par(u);
ll ulp_v=par(v);
if (ulp_u == ulp_v) return;
if (size[ulp_u] < size[ulp_v]) {
parent[ulp_u] = ulp_v;
size[ulp_v] += size[ulp_u];
}
else {
parent[ulp_v] = ulp_u;
size[ulp_u] += size[ulp_v];
}
}
};
bool prime[N];
void pre()
{
memset(prime,true,sizeof(prime));
prime[1]=0;
for(ll i=2;i*i<=N;i++)
{
if(prime[i]==1)
{
for(ll j=i*i;j<=N;j+=i)
prime[j]=0;
}
}
}
signed main()
{
pre();
ll n; cin>>n;
dsu obj(n+1);
vector<vector<ll>>g(n+1);
for(ll i=1;i<n;i++)
{
ll a,b; cin>>a>>b;
if(prime[a]==1 && prime[b]==1) continue;
else if(prime[a]==1) g[a].push_back(b);
else if(prime[b]==1) g[b].push_back(a);
else obj.usize(a,b);
}
ll ans=0;
for(ll i=1;i<=n;i++)
{
if(prime[i])
{
ll curr=1;
for(auto rel:g[i]) curr+=obj.size[obj.par(rel)];
for(auto rel:g[i])
{
ll ex=obj.size[obj.par(rel)];
ans+=ex*(curr-ex);
curr-=ex;
}
}
}
cout<<ans<<endl;
}
Prime Tree โ
SELECT order_id, product_id, buyer
FROM quantity
WHERE quantity_ordered = ANY (SELECT 6)
ORDER BY buyer ASC;
Zepto (SQL) โ
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll solve(vector<ll>&a)
{
ll n=a.size();
ll ans=0;
unordered_map<ll,ll>mpp;
for(auto it:a) mpp[it]++;
ll i=3;
vector<ll>t;
while(i<=pow(3,21))
{
t.push_back(i);
i*=3;
}
for(ll i=0;i<n;i++)
{
for(auto it:t)
{
if(it>=a[i] && mpp.find(it-a[i])!=mpp.end()) ans+=mpp[a[i]]*mpp[it-a[i]];
}
mpp.erase(a[i]);
}
return ans;
}
signed main()
{
ll n; cin>>n;
vector<ll>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
cout<<solve(a)<<endl;
}
Valid Pairs โ
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll>solve(vector<ll>&a,ll n,ll k)
{
ll i=0;
while(k)
{
if(a[i]!=0)
{
a[i]--;
k--;
}
i=(i+1)%n;
}
return a;
}
signed main()
{
ll n,k; cin>>n>>k;
vector<ll>a(n);
for(ll i=0;i<=n-1;i++) cin>>a[i];
auto ans=solve(a,n,k);
for(auto it:ans) cout<<it<<" ";
cout<<endl;
}
Olympic preparation โ
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll solve(vector<ll>&a)
{
ll n=a.size();
priority_queue<ll>pq;
ll mini=LONG_MAX;
for(auto it:a)
{
if(it%2) it*=2;
mini=min(mini,it);
pq.push(it);
}
ll ans=LONG_MAX;
while(pq.top()%2==0)
{
auto it=pq.top();
pq.pop();
ans=min(ans,it-mini);
mini=min(mini,it/2);
pq.push(it/2);
}
return min(ans,pq.top()-mini);
}
signed main()
{
ll t; cin>>t;
while(t--)
{
ll n; cin>>n;
vector<ll>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
cout<<solve(a)<<endl;
}
}
Array Difference
Zepto โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
HCL Tech internship
Role : LLM Data Scientist
Batch : 2024,2025
Link : https://forms.office.com/pages/responsepage.aspx?id=N-edGDrJWk-LaG9MqZQZEn_4YzJg3wtMqTZGj64AarhUMFo0TUFTNEY2TDFHTU9XTVlHUjJOWTFaVi4u
Role : LLM Data Scientist
Batch : 2024,2025
Link : https://forms.office.com/pages/responsepage.aspx?id=N-edGDrJWk-LaG9MqZQZEn_4YzJg3wtMqTZGj64AarhUMFo0TUFTNEY2TDFHTU9XTVlHUjJOWTFaVi4u
Office
Please fill out this form
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Crework is hiring for Full Stack Engineer
Remote Opportunity
0 - 2 years experience
Monthly Salary : 50 k ( 6 LPA )
View JD : https://crework.notion.site/Job-Description-Full-Stack-Developer-c8c2ea3cf32340f1b46d4c3c5111293f?pvs=4
Hiring with assignment :
https://crework.notion.site/Assignment-Trello-Style-Task-Management-Application-0bcb3b4db4504d6199b803704e561e87?pvs=4
Submit assignment here :
https://tally.so/r/mBBRee
Assignment Completion Deadline : 31 July 2024
Remote Opportunity
0 - 2 years experience
Monthly Salary : 50 k ( 6 LPA )
View JD : https://crework.notion.site/Job-Description-Full-Stack-Developer-c8c2ea3cf32340f1b46d4c3c5111293f?pvs=4
Hiring with assignment :
https://crework.notion.site/Assignment-Trello-Style-Task-Management-Application-0bcb3b4db4504d6199b803704e561e87?pvs=4
Submit assignment here :
https://tally.so/r/mBBRee
Assignment Completion Deadline : 31 July 2024
Crework on Notion
Job Description - Full Stack Developer | Notion
About Crework Labs
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Aurva is hiring SDE intern
For 2024, 2025, 2026 grads
Location: Remote
https://wellfound.com/jobs/2892047-software-engineering-intern?utm_campaign=linkedin_syndication&utm_source=linkedin
For 2024, 2025, 2026 grads
Location: Remote
https://wellfound.com/jobs/2892047-software-engineering-intern?utm_campaign=linkedin_syndication&utm_source=linkedin
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company: ScoreMe Solutions
Location: N/A
Role: SDE
For Graduates: 2024, 2023, 2022, 2021
https://www.linkedin.com/posts/mukulgargg_dsa-hiring-sde1-activity-7222508945196691458-q9fT
Location: N/A
Role: SDE
For Graduates: 2024, 2023, 2022, 2021
https://www.linkedin.com/posts/mukulgargg_dsa-hiring-sde1-activity-7222508945196691458-q9fT
Linkedin
#dsa #hiring #sde1 #sde2 #sde #software #softwaredeveloper #springbootโฆ | Mukul Garg | 83 comments
Thanks all for overwhelming response.
We are not accepting applications anymore.
I have received lots of resume and while itโs difficult for me to reply on all of them, Iโll reach out to the ones short listed.
Thanks again!
โโโโโโโโโโโโโโโโโโโโโ
Hi Allโฆ
We are not accepting applications anymore.
I have received lots of resume and while itโs difficult for me to reply on all of them, Iโll reach out to the ones short listed.
Thanks again!
โโโโโโโโโโโโโโโโโโโโโ
Hi Allโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Concentrix is hiring for the role of Associate
Expected Salary: 3-5 LPA
Apply here:
https://jobs.concentrix.com/job/phn-phn-14724270/
Expected Salary: 3-5 LPA
Apply here:
https://jobs.concentrix.com/job/phn-phn-14724270/
Global
Search for Jobs - Global
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Zeotap is hiring for Software Engineer - Intern
Expected Stipend: 7-10 LPA
Apply here:
https://jobs.lever.co/zeotap/d9da141a-91f0-4713-9eb1-ee103e7bc1d6
Expected Stipend: 7-10 LPA
Apply here:
https://jobs.lever.co/zeotap/d9da141a-91f0-4713-9eb1-ee103e7bc1d6
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Doctor Droid is hiring for the role SDE Intern
Expected Stipend: 40K - 50K per month
Apply here:
https://ycombinator.com/companies/doctor-droid/jobs/Fwy3NiX-sde-intern
Expected Stipend: 40K - 50K per month
Apply here:
https://ycombinator.com/companies/doctor-droid/jobs/Fwy3NiX-sde-intern
Y Combinator
SDE Intern at Doctor Droid
We are looking for an SDE intern with prior experience of working in Python and/or Javascript.
* Prior experience of writing documentation and blogs will be considered a plus.
* Prior experience of working with a developer tool/startup will be consideredโฆ
* Prior experience of writing documentation and blogs will be considered a plus.
* Prior experience of working with a developer tool/startup will be consideredโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
myBillbook is hiring for Product Intern / APM
Expected Salary: Upto 6 LPA
Apply here:
https://linkedin.com/posts/snehalsamant_hiring-alert-product-intern-apm-for-mybillbook-activity-7222438051866677249-R4fT?utm_source=share&utm_medium=member_desktop
Expected Salary: Upto 6 LPA
Apply here:
https://linkedin.com/posts/snehalsamant_hiring-alert-product-intern-apm-for-mybillbook-activity-7222438051866677249-R4fT?utm_source=share&utm_medium=member_desktop
Linkedin
Snehal Samant on LinkedIn: // not accepting more applications //
Hiring alert - Product Intern / APMโฆ | 31 comments
Hiring alert - Product Intern / APMโฆ | 31 comments
// not accepting more applications //
Hiring alert - Product Intern / APM for myBillbook - up to 6L pa
- 0 to 3 years experience
- CS background (thisโฆ | 31 comments on LinkedIn
Hiring alert - Product Intern / APM for myBillbook - up to 6L pa
- 0 to 3 years experience
- CS background (thisโฆ | 31 comments on LinkedIn
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Totality Corp is hiring for Frontend Developer Intern - Remote
Apply here:
https://totalitycorp-hr.freshteam.com/jobs/NwdoDcjhNZig/frontend-developer-internship-remote?ft_source=5000666420&ft_medium=5000595618
Apply here:
https://totalitycorp-hr.freshteam.com/jobs/NwdoDcjhNZig/frontend-developer-internship-remote?ft_source=5000666420&ft_medium=5000595618
Freshteam
Hiring for Frontend Developer Internship(Remote) - Internship
Posted by : Totality Corp |
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Anthology is hiring for Associate Software Engineer II (0-2 years)
Expected Salary: 5-10 LPA
Apply here:
https://jobs.jobvite.com/anthology/job/oSw7tfwI?jvst=Job%20Board&jvsd=LinkedIn&source=LinkedIn-JS
Expected Salary: 5-10 LPA
Apply here:
https://jobs.jobvite.com/anthology/job/oSw7tfwI?jvst=Job%20Board&jvsd=LinkedIn&source=LinkedIn-JS
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
CBTS is hiring for Associate Software Engineer (0-2 years)
Expected Salary: 6-12 LPA
Apply here:
https://recruiting.adp.com/srccar/public/RTI.home?c=2190231&d=altafiberJobs&rb=INDEED&r=5001058832806#/
Expected Salary: 6-12 LPA
Apply here:
https://recruiting.adp.com/srccar/public/RTI.home?c=2190231&d=altafiberJobs&rb=INDEED&r=5001058832806#/