Language: C++

#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
/* Data Structure */
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <stack>
#include <queue>

using namespace std;

#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3fLL
#define debug cerr << "======= GOT_HERE ======\n"
#define endl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef map<int,int> mii;
typedef map<long long,long long> mll;
typedef set<int> si;
typedef set<long long> sll;

long long n,k;

string to_binary(ll a)
{
	string ans;
	while(a!=0)
	{
		ans+=a%2+'0';
		a/=2;
	}
	reverse(ans.begin(),ans.end());
	//cout << a << " " << ans << endl;
	return ans;

}

int main()
{
	cin>>n>>k;
	vector<ll> v;
	for(int i=0;i<n;++i)
	{
		ll a;
		cin>>a;
		v.emplace_back(a);
	}

	unordered_map<string,int> mp;
	for(int i=0;i<n;++i)
	{
		ll sum = 0;
		for(int j=i;j<n;++j)
		{
			sum+=v[j];
			//cout << "sum is: " << sum << endl;
			mp[to_binary(sum)]++;
		}
	}

	ll length = 0;
	for(auto it: mp)
	{
		length = max(length,(ll)it.first.length());
	}
	unordered_map<string,int> m;
	for(auto& it: mp)
	{
		ll add = length-it.first.length();
		string s;
		for(ll i=0;i<add;++i) s+='0';
		string f = it.first;
		f = s+f;
		m[f] = it.second;
		//cout << it.first << " " << it.second << endl;
	}
	string ans; ans.clear();
	ll cnt = 0;
	for(ll i=0;i<length;++i)
	{
		cnt = 0;
		for(auto& it: m)
		{
			string s = it.first;
			if(s[i]=='1') cnt+=it.second;
		}
		if(cnt>=k) {
			ans+='1';
			for(auto& it: m)
			{
				string s = it.first;
				if(s[i]!='1')
				{
					m.erase(it);
				}
			}
		}
		else {
			ans+='0';
		}
	}
	ll res = 0;
	for(int i=ans.size()-1;i>=0;--i)
	{
		if(ans[i]=='1')
		{
			res+=powl(2,ans.size()-i-1);
		}
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:109:48: error: no matching function for call to 'std::unordered_map<std::__cxx11::basic_string<char>, int>::erase(std::pair<const std::__cxx11::basic_string<char>, int>&)'
  109 |                                         m.erase(it);
      |                                         ~~~~~~~^~~~
In file included from /usr/include/c++/14/unordered_map:41,
                 from /usr/include/c++/14/functional:63,
                 from a.cc:11:
/usr/include/c++/14/bits/unordered_map.h:748:7: note: candidate: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::erase(const_iterator) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; iterator = std::__detail::_Insert_base<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::iterator; const_iterator = std::__detail::_Insert_base<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::const_iterator]'
  748 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/unordered_map.h:748:28: note:   no known conversion for argument 1 from 'std::pair<const std::__cxx11::basic_string<char>, int>' to 'std::unordered_map<std::__cxx11::basic_string<char>, int>::const_iterator' {aka 'std::__detail::_Insert_base<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::const_iterator'}
  748 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/unordered_map.h:753:7: note: candidate: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::erase(iterator) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; iterator = std::__detail::_Insert_base<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::iterator]'
  753 |       erase(iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/unordered_map.h:753:22: note:   no known conversion for argument 1 from 'std::pair<const std::__cxx11::basic_string<char>, int>' to 'std::unordered_map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::__detail::_Insert_base<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::iterator'}
  753 |       erase(iterator __position)
      |             ~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/unordered_map.h:770:7: note: candidate: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::erase(const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; size_type = long unsigned int; key_type = std::__cxx11::basic_string<char>]'
  770 |       erase(const key_type& __x)
      |       ^~~~~
/usr/include/c++/14/bits/unordered_map.h:770:29: note:   no known conversion for argument 1 from 'std::pair<const std::__cxx11::basic_string<char>, int>' to 'const std::unordered_map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  770 |       erase(const key_type& __x)
      |             ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/unordered_map.h:788:7: note: candidate: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::erase(const_iterator, const_iterator) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; iterator = std::__detail::_Insert_base<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::iterator; const_iterator = std::__detail::_Insert_base<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::const_iterator]'
  788 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/unordered_map.h:788:7: note:   candidate expects 2 arguments, 1 provided