import sys
def solve():
data = list(map(int, sys.stdin.read().split()))
n = data[0]
W = data[1]
items = data[2:]
g0 = []
g1 = []
g2 = []
idx = 0
for _ in range(n):
w = items[idx]
v = items[idx + 1]
g = items[idx + 2]
idx += 3
if g == 0:
g0.append((w, v))
elif g == 1:
g1.append((w, v))
else:
g2.append((w, v))
dp = [0] * (W + 1)
for w, v in g0:
for cap in range(W, w - 1, -1):
dp[cap] = max(dp[cap], dp[cap - w] + v)
best1 = [(0, 0)]
for w, v in g1:
best1.append((w, v))
best2 = [(0, 0)]
for w, v in g2:
best2.append((w, v))
ans = 0
for w1, v1 in best1:
for w2, v2 in best2:
total_w = w1 - w2
if total_w <= W:
ans = max(ans, v1 + v2 + dp[W - total_w])
print(ans)
if name == "main":
solve()
def solve():
data = list(map(int, sys.stdin.read().split()))
n = data[0]
W = data[1]
items = data[2:]
g0 = []
g1 = []
g2 = []
idx = 0
for _ in range(n):
w = items[idx]
v = items[idx + 1]
g = items[idx + 2]
idx += 3
if g == 0:
g0.append((w, v))
elif g == 1:
g1.append((w, v))
else:
g2.append((w, v))
dp = [0] * (W + 1)
for w, v in g0:
for cap in range(W, w - 1, -1):
dp[cap] = max(dp[cap], dp[cap - w] + v)
best1 = [(0, 0)]
for w, v in g1:
best1.append((w, v))
best2 = [(0, 0)]
for w, v in g2:
best2.append((w, v))
ans = 0
for w1, v1 in best1:
for w2, v2 in best2:
total_w = w1 - w2
if total_w <= W:
ans = max(ans, v1 + v2 + dp[W - total_w])
print(ans)
if name == "main":
solve()
import sys
input = sys.stdin.readline
def solve(N: int, V: list) -> int:
if N == 1:
return V[0]
A = [[0] * N for _ in range(N)]
B = [[0] * N for _ in range(N)]
for gap in range(1, N):
for l in range(N - gap):
r = l + gap
best = -10**30
for step in (1, 2):
nl = l + step
if nl >= r:
best = max(best, 0)
else:
best = max(best, V[nl] + B[nl][r])
A[l][r] = best
worst = 10**30
for step in (1, 2):
nr = r - step
if nr <= l:
worst = min(worst, 0)
else:
worst = min(worst, A[l][nr])
B[l][r] = worst
return V[0] + A[0][N - 1]
if name == "main":
data = list(map(int, sys.stdin.read().split()))
N = data[0]
V = data[1:1 - N]
print(solve(N, V))
input = sys.stdin.readline
def solve(N: int, V: list) -> int:
if N == 1:
return V[0]
A = [[0] * N for _ in range(N)]
B = [[0] * N for _ in range(N)]
for gap in range(1, N):
for l in range(N - gap):
r = l + gap
best = -10**30
for step in (1, 2):
nl = l + step
if nl >= r:
best = max(best, 0)
else:
best = max(best, V[nl] + B[nl][r])
A[l][r] = best
worst = 10**30
for step in (1, 2):
nr = r - step
if nr <= l:
worst = min(worst, 0)
else:
worst = min(worst, A[l][nr])
B[l][r] = worst
return V[0] + A[0][N - 1]
if name == "main":
data = list(map(int, sys.stdin.read().split()))
N = data[0]
V = data[1:1 - N]
print(solve(N, V))
def solve(S: str) -> int:
def cost(ch):
pos=[i for c in enumerate(S) if c==ch]
k=len(pos)
if k<=1:
return 0
q=[pos[i]-i for i in range(k)]
m=q[k//2]
return sum(abs(x-m) for x in q)
return min(cost('0'),cost('1'))
def cost(ch):
pos=[i for c in enumerate(S) if c==ch]
k=len(pos)
if k<=1:
return 0
q=[pos[i]-i for i in range(k)]
m=q[k//2]
return sum(abs(x-m) for x in q)
return min(cost('0'),cost('1'))
❤2
IBM | Associates | Year of Pass out 2024 and 2025 only
Register here : https://careers.ibm.com/en_US/careers/JobDetail?jobId=103807
Register here : https://careers.ibm.com/en_US/careers/JobDetail?jobId=103807
Zensar is hiring
Direct test opportunity
Apply Link:https://forms.office.com/pages/responsepage.aspx?id=Mj58IBVx006KVSL37bd9ybeqpIAtYiJKvHTQhHsYIn5UQUlMQjdGWjRCOE9KMFY1WVc3Uk5INlFRMS4u&route=shorturl&utm_source=sp_auto_dm&utm_referrer=sp_auto_dm&fbclid=PAb21jcARUZ8pleHRuA2FlbQIxMABzcnRjBmFwcF9pZA81NjcwNjczNDMzNTI0MjcAAadnMi-RmkOBHbXBSwpc3EBdXP4cv-o_WnM6PgJLuUZhicuso6pc9QCGiY1Cdg_aem_O4VAXWORhnFpy2SjF404Ug
Direct test opportunity
Apply Link:https://forms.office.com/pages/responsepage.aspx?id=Mj58IBVx006KVSL37bd9ybeqpIAtYiJKvHTQhHsYIn5UQUlMQjdGWjRCOE9KMFY1WVc3Uk5INlFRMS4u&route=shorturl&utm_source=sp_auto_dm&utm_referrer=sp_auto_dm&fbclid=PAb21jcARUZ8pleHRuA2FlbQIxMABzcnRjBmFwcF9pZA81NjcwNjczNDMzNTI0MjcAAadnMi-RmkOBHbXBSwpc3EBdXP4cv-o_WnM6PgJLuUZhicuso6pc9QCGiY1Cdg_aem_O4VAXWORhnFpy2SjF404Ug
Company: Accentur
Job Description
Skill required: Membership - Life Sciences Regulatory Operations
Designation: Health Operations New Associate
Qualifications:Any Graduation
Years of Experience:0 to 1 years
Apply Now: https://www.accenture.com/in-en/careers/jobdetails?id=AIOC-S01645412_en
Job Description
Skill required: Membership - Life Sciences Regulatory Operations
Designation: Health Operations New Associate
Qualifications:Any Graduation
Years of Experience:0 to 1 years
Apply Now: https://www.accenture.com/in-en/careers/jobdetails?id=AIOC-S01645412_en
1️⃣Walmart is hiring Intern
For 2026, 2027 grads
Location: Bangalore
https://walmart.wd5.myworkdayjobs.com/en-US/WalmartExternal/job/XMLNAME--IND--Grad-Intern---No-Work-Experience_R-2465961
3️⃣Capgemini is hiring for SAP
https://www.capgemini.com/in-en/jobs/468468-en_GB+sap_btp
4️⃣EY is hiring freshers and experienced
https://careers.ey.com/ey/job/Bengaluru-Associate-SaT-National-SaT-TCF-Valuation-Bangalore-KA-560001/1383554633/
5️⃣Deliotte is hiring for Freshers and Experienced
https://southasiacareers.deloitte.com/job/Bengaluru-Enabling-Areas-DEC-Executive-Web-Development/55814844/
https://southasiacareers.deloitte.com/job/Bengaluru-Enabling-Areas-Talent-Onboarding-Executive-TSG-Bengaluru/55491344/
https://southasiacareers.deloitte.com/job/Bengaluru-Executive-Internal-Audit-Bangalore-Controls-Assurance/54211744/
6️⃣Hiring for Associate Software Engineer - Freshers and Exp.
https://www.naukri.com/job-listings-associate-software-engineer-ibrowsejobs-technologies-bengaluru-0-to-4-years-140526015149?src=sortby&sid=17787400486065093_1&xp=1&px=1&nignbevent_src=jobsearchDeskGNB
8️⃣IBM
https://careers.ibm.com/en_US/careers/JobDetail/Associate-System-Engineer/103807
9️⃣Carelon
https://elevancehealth.wd1.myworkdayjobs.com/en-US/carelonglobal_in/job/IND-KA-Bengaluru-Bagmane-Solarium-City/Associate-Software-Engineer_JR180452
🔟Amazon
https://amazon.jobs/en/jobs/10402495/transportation-specialist-india-transportation-execution
For 2026, 2027 grads
Location: Bangalore
https://walmart.wd5.myworkdayjobs.com/en-US/WalmartExternal/job/XMLNAME--IND--Grad-Intern---No-Work-Experience_R-2465961
3️⃣Capgemini is hiring for SAP
https://www.capgemini.com/in-en/jobs/468468-en_GB+sap_btp
4️⃣EY is hiring freshers and experienced
https://careers.ey.com/ey/job/Bengaluru-Associate-SaT-National-SaT-TCF-Valuation-Bangalore-KA-560001/1383554633/
5️⃣Deliotte is hiring for Freshers and Experienced
https://southasiacareers.deloitte.com/job/Bengaluru-Enabling-Areas-DEC-Executive-Web-Development/55814844/
https://southasiacareers.deloitte.com/job/Bengaluru-Enabling-Areas-Talent-Onboarding-Executive-TSG-Bengaluru/55491344/
https://southasiacareers.deloitte.com/job/Bengaluru-Executive-Internal-Audit-Bangalore-Controls-Assurance/54211744/
6️⃣Hiring for Associate Software Engineer - Freshers and Exp.
https://www.naukri.com/job-listings-associate-software-engineer-ibrowsejobs-technologies-bengaluru-0-to-4-years-140526015149?src=sortby&sid=17787400486065093_1&xp=1&px=1&nignbevent_src=jobsearchDeskGNB
8️⃣IBM
https://careers.ibm.com/en_US/careers/JobDetail/Associate-System-Engineer/103807
9️⃣Carelon
https://elevancehealth.wd1.myworkdayjobs.com/en-US/carelonglobal_in/job/IND-KA-Bengaluru-Bagmane-Solarium-City/Associate-Software-Engineer_JR180452
🔟Amazon
https://amazon.jobs/en/jobs/10402495/transportation-specialist-india-transportation-execution
IBM Hiring for associate
Eligibility
- Degrees: BE/BTech, M.Tech, ME, M.Sc, MCA
- Branches: CSE, AIML, DS, Cloud, Big Data, CSBS, IoT, Robotics, AI, CyberSecurity, Blockchain, IT
- Cutoff: 60% or 6 CGPA
Apply now:- https://jobseekers19.blogspot.com/2026/05/ibm-hiring-for-associate.html
Eligibility
- Degrees: BE/BTech, M.Tech, ME, M.Sc, MCA
- Branches: CSE, AIML, DS, Cloud, Big Data, CSBS, IoT, Robotics, AI, CyberSecurity, Blockchain, IT
- Cutoff: 60% or 6 CGPA
Apply now:- https://jobseekers19.blogspot.com/2026/05/ibm-hiring-for-associate.html
Dell Technologies Hiring
Job Category:- Undergraduate Intern
Posting Date:- 19/05/2026, 02:26 pm
Apply Before:- 31/05/2026, 05:30 am
Job Schedule:- Full time
Job Shift:-Day
Locations:- Crystal Downs, Embassy GolfLinks Business Park, Inner Ring R, Bengaluru, Karnataka, 560071
Apply now:- https://jobseekers19.blogspot.com/2026/05/dell-technologies-hiring.html
Share with your friends ↗️
Job Category:- Undergraduate Intern
Posting Date:- 19/05/2026, 02:26 pm
Apply Before:- 31/05/2026, 05:30 am
Job Schedule:- Full time
Job Shift:-Day
Locations:- Crystal Downs, Embassy GolfLinks Business Park, Inner Ring R, Bengaluru, Karnataka, 560071
Apply now:- https://jobseekers19.blogspot.com/2026/05/dell-technologies-hiring.html
Share with your friends ↗️