CodeMortem is the new way
to compete and learn.

Real-time 1v1 algorithmic battles and interactive learning paths built with
speed, precision, and developer-first design.

Start Competing
swayam_v320
18:42
tourist180
Problems
Q1+100
Q2+200
Q3+300
Q4+400
Q5+500
Q6+600
Q7+700
solution.cpp
1#include <bits/stdc++.h>
2using namespace std;
3 
4int main() {
5 ios::sync_with_stdio(0);
6 cin.tie(0);
7 
8 int n, k;
9 cin >> n >> k;
10 vector<int> a(n);
11 for (auto& x : a) cin >> x;
12 
13 sort(a.begin(), a.end());
14 long long ans = 0;
15 for (int i = 0; i < k; i++)
16 ans += a[i];
17 cout << ans << '\n';
18 return 0;
19}
20
OPPONENT
tourist
2847
Q1 solved
YOU
swayam_v
1847
Q1 solved
VERDICT
✓ Accepted
0ms · 4KB

TRUSTED BY COMPETITIVE PROGRAMMERS TRAINING FOR

Pricing

Simple pricing for everyone.

Choose an affordable plan that's packed with the best features for mastering DSA, competing in real-time, and tracking your progression.

Quarterly2 MONTHS FREE ✨

Free

Everything you need to get started competing

₹0 / forever

  • All module lessons
  • Module coding challenges
  • Completion badges
  • Ranked 1v1 matches
  • Solo practice mode
  • Global leaderboard access

Premium

For serious competitive programmers who want more

₹1,200 / 3 months

  • Everything in Free
  • Practice Bank (8+ bonus problems/module)
  • Full editorials + C++ & Python solutions
  • Post-module timed practice contests
  • Premium badge on leaderboard
  • Priority judge execution
A
Aditya Raj
@aditya_raj
1847

Went from 1300 to 1700 in 3 weeks. The 1v1 pressure is unlike any other practice method.

S
Saumya K.
@saumya_k
1623

HLD finally clicked after 2 sessions. The interactive visualizers are genuinely helpful.

P
Priya D.
@priyanka_d
1941

My CF rating jumped from Expert to CM after 1 month on CodeMortem. The 1v1 format works.

H
Harsh V.
@harsh_v
1582

1v1s made my actual Codeforces rounds feel manageable. Q3 solves improved massively.

R
Rohan M.
@rohan_m
2103

Judge0 execution is blazing fast. No more TLE surprises from a slow online judge.

I
Ishaan P.
@ishaan_p
1389

Perfect for a student training for ICPC. The structured learning modules are gold.

N
Nisha R.
@nisha_r
1765

Competing against real people at my level is so much better than isolated LeetCode grind.

D
Dev S.
@dev_s
1503

The rating system actually maps to Codeforces. First platform that feels honest.

A
Aditya Raj
@aditya_raj
1847

Went from 1300 to 1700 in 3 weeks. The 1v1 pressure is unlike any other practice method.

S
Saumya K.
@saumya_k
1623

HLD finally clicked after 2 sessions. The interactive visualizers are genuinely helpful.

P
Priya D.
@priyanka_d
1941

My CF rating jumped from Expert to CM after 1 month on CodeMortem. The 1v1 format works.

H
Harsh V.
@harsh_v
1582

1v1s made my actual Codeforces rounds feel manageable. Q3 solves improved massively.

R
Rohan M.
@rohan_m
2103

Judge0 execution is blazing fast. No more TLE surprises from a slow online judge.

I
Ishaan P.
@ishaan_p
1389

Perfect for a student training for ICPC. The structured learning modules are gold.

N
Nisha R.
@nisha_r
1765

Competing against real people at my level is so much better than isolated LeetCode grind.

D
Dev S.
@dev_s
1503

The rating system actually maps to Codeforces. First platform that feels honest.

P
Priya D.
@priyanka_d
1941

My CF rating jumped from Expert to CM after 1 month on CodeMortem. The 1v1 format works.

H
Harsh V.
@harsh_v
1582

1v1s made my actual Codeforces rounds feel manageable. Q3 solves improved massively.

R
Rohan M.
@rohan_m
2103

Judge0 execution is blazing fast. No more TLE surprises from a slow online judge.

I
Ishaan P.
@ishaan_p
1389

Perfect for a student training for ICPC. The structured learning modules are gold.

N
Nisha R.
@nisha_r
1765

Competing against real people at my level is so much better than isolated LeetCode grind.

D
Dev S.
@dev_s
1503

The rating system actually maps to Codeforces. First platform that feels honest.

A
Arjun B.
@arjun_b
2248

Segment tree module is the best resource I've seen anywhere. Finished it in 2 days.

S
Sneha T.
@sneha_t
1677

Post-match editorials are what set CodeMortem apart. I learn more from losses.

P
Priya D.
@priyanka_d
1941

My CF rating jumped from Expert to CM after 1 month on CodeMortem. The 1v1 format works.

H
Harsh V.
@harsh_v
1582

1v1s made my actual Codeforces rounds feel manageable. Q3 solves improved massively.

R
Rohan M.
@rohan_m
2103

Judge0 execution is blazing fast. No more TLE surprises from a slow online judge.

I
Ishaan P.
@ishaan_p
1389

Perfect for a student training for ICPC. The structured learning modules are gold.

N
Nisha R.
@nisha_r
1765

Competing against real people at my level is so much better than isolated LeetCode grind.

D
Dev S.
@dev_s
1503

The rating system actually maps to Codeforces. First platform that feels honest.

A
Arjun B.
@arjun_b
2248

Segment tree module is the best resource I've seen anywhere. Finished it in 2 days.

S
Sneha T.
@sneha_t
1677

Post-match editorials are what set CodeMortem apart. I learn more from losses.

R
Rohan M.
@rohan_m
2103

Judge0 execution is blazing fast. No more TLE surprises from a slow online judge.

I
Ishaan P.
@ishaan_p
1389

Perfect for a student training for ICPC. The structured learning modules are gold.

N
Nisha R.
@nisha_r
1765

Competing against real people at my level is so much better than isolated LeetCode grind.

D
Dev S.
@dev_s
1503

The rating system actually maps to Codeforces. First platform that feels honest.

A
Arjun B.
@arjun_b
2248

Segment tree module is the best resource I've seen anywhere. Finished it in 2 days.

S
Sneha T.
@sneha_t
1677

Post-match editorials are what set CodeMortem apart. I learn more from losses.

K
Karan G.
@karan_g
1432

Finally a platform that treats competitive programming like a sport, not homework.

M
Meera J.
@meera_j
1910

Codeforces integration is seamless. My ratings on both platforms now correlate.

R
Rohan M.
@rohan_m
2103

Judge0 execution is blazing fast. No more TLE surprises from a slow online judge.

I
Ishaan P.
@ishaan_p
1389

Perfect for a student training for ICPC. The structured learning modules are gold.

N
Nisha R.
@nisha_r
1765

Competing against real people at my level is so much better than isolated LeetCode grind.

D
Dev S.
@dev_s
1503

The rating system actually maps to Codeforces. First platform that feels honest.

A
Arjun B.
@arjun_b
2248

Segment tree module is the best resource I've seen anywhere. Finished it in 2 days.

S
Sneha T.
@sneha_t
1677

Post-match editorials are what set CodeMortem apart. I learn more from losses.

K
Karan G.
@karan_g
1432

Finally a platform that treats competitive programming like a sport, not homework.

M
Meera J.
@meera_j
1910

Codeforces integration is seamless. My ratings on both platforms now correlate.

N
Nisha R.
@nisha_r
1765

Competing against real people at my level is so much better than isolated LeetCode grind.

D
Dev S.
@dev_s
1503

The rating system actually maps to Codeforces. First platform that feels honest.

A
Arjun B.
@arjun_b
2248

Segment tree module is the best resource I've seen anywhere. Finished it in 2 days.

S
Sneha T.
@sneha_t
1677

Post-match editorials are what set CodeMortem apart. I learn more from losses.

K
Karan G.
@karan_g
1432

Finally a platform that treats competitive programming like a sport, not homework.

M
Meera J.
@meera_j
1910

Codeforces integration is seamless. My ratings on both platforms now correlate.

A
Aditya Raj
@aditya_raj
1847

Went from 1300 to 1700 in 3 weeks. The 1v1 pressure is unlike any other practice method.

S
Saumya K.
@saumya_k
1623

HLD finally clicked after 2 sessions. The interactive visualizers are genuinely helpful.

N
Nisha R.
@nisha_r
1765

Competing against real people at my level is so much better than isolated LeetCode grind.

D
Dev S.
@dev_s
1503

The rating system actually maps to Codeforces. First platform that feels honest.

A
Arjun B.
@arjun_b
2248

Segment tree module is the best resource I've seen anywhere. Finished it in 2 days.

S
Sneha T.
@sneha_t
1677

Post-match editorials are what set CodeMortem apart. I learn more from losses.

K
Karan G.
@karan_g
1432

Finally a platform that treats competitive programming like a sport, not homework.

M
Meera J.
@meera_j
1910

Codeforces integration is seamless. My ratings on both platforms now correlate.

A
Aditya Raj
@aditya_raj
1847

Went from 1300 to 1700 in 3 weeks. The 1v1 pressure is unlike any other practice method.

S
Saumya K.
@saumya_k
1623

HLD finally clicked after 2 sessions. The interactive visualizers are genuinely helpful.

A
Arjun B.
@arjun_b
2248

Segment tree module is the best resource I've seen anywhere. Finished it in 2 days.

S
Sneha T.
@sneha_t
1677

Post-match editorials are what set CodeMortem apart. I learn more from losses.

K
Karan G.
@karan_g
1432

Finally a platform that treats competitive programming like a sport, not homework.

M
Meera J.
@meera_j
1910

Codeforces integration is seamless. My ratings on both platforms now correlate.

A
Aditya Raj
@aditya_raj
1847

Went from 1300 to 1700 in 3 weeks. The 1v1 pressure is unlike any other practice method.

S
Saumya K.
@saumya_k
1623

HLD finally clicked after 2 sessions. The interactive visualizers are genuinely helpful.

P
Priya D.
@priyanka_d
1941

My CF rating jumped from Expert to CM after 1 month on CodeMortem. The 1v1 format works.

H
Harsh V.
@harsh_v
1582

1v1s made my actual Codeforces rounds feel manageable. Q3 solves improved massively.

A
Arjun B.
@arjun_b
2248

Segment tree module is the best resource I've seen anywhere. Finished it in 2 days.

S
Sneha T.
@sneha_t
1677

Post-match editorials are what set CodeMortem apart. I learn more from losses.

K
Karan G.
@karan_g
1432

Finally a platform that treats competitive programming like a sport, not homework.

M
Meera J.
@meera_j
1910

Codeforces integration is seamless. My ratings on both platforms now correlate.

A
Aditya Raj
@aditya_raj
1847

Went from 1300 to 1700 in 3 weeks. The 1v1 pressure is unlike any other practice method.

S
Saumya K.
@saumya_k
1623

HLD finally clicked after 2 sessions. The interactive visualizers are genuinely helpful.

P
Priya D.
@priyanka_d
1941

My CF rating jumped from Expert to CM after 1 month on CodeMortem. The 1v1 format works.

H
Harsh V.
@harsh_v
1582

1v1s made my actual Codeforces rounds feel manageable. Q3 solves improved massively.

Stop solving problems alone.

Find your first match in under 60 seconds. No credit card required.