Language: C++

#include<bits/stdc++.h>
#include<set>
using namespace std;
int main()
{
	float N,W,i;
	cin >> N >> W;
	float w[N],v[N];
	typedef pair <float ,float > pairs;
	set <pairs> s;
	for(i=0;i<N;i++)
	{
		cin >> w[i] >> v[i];
		s.insert({w[i]/v[i],w[i]});
	}
	auto it = s.begin();
	float W1,V1;
	W1 = 0;
	V1 = 0;
	for(it = s.begin();it != s.end() ;it++)
	{
		W1 = W1 + it->second;
		V1 = V1 + (it->second)/(it->first);
		if(W1 > W)
		{
			W1 = W1 - it->second;
			V1 = V1 - (it->second)/(it->first);
		}
	}
	cout << V1;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: conversion from 'float' to 'long unsigned int' in a converted constant expression
    8 |         float w[N],v[N];
      |                 ^
a.cc:8:17: error: could not convert 'N' from 'float' to 'long unsigned int'
    8 |         float w[N],v[N];
      |                 ^
      |                 |
      |                 float
a.cc:8:17: error: size of array 'w' has non-integral type 'float'
a.cc:8:22: error: conversion from 'float' to 'long unsigned int' in a converted constant expression
    8 |         float w[N],v[N];
      |                      ^
a.cc:8:22: error: could not convert 'N' from 'float' to 'long unsigned int'
    8 |         float w[N],v[N];
      |                      ^
      |                      |
      |                      float
a.cc:8:22: error: size of array 'v' has non-integral type 'float'
a.cc:13:25: error: invalid types 'float [1][float]' for array subscript
   13 |                 cin >> w[i] >> v[i];
      |                         ^
a.cc:13:33: error: invalid types 'float [1][float]' for array subscript
   13 |                 cin >> w[i] >> v[i];
      |                                 ^
a.cc:14:28: error: invalid types 'float [1][float]' for array subscript
   14 |                 s.insert({w[i]/v[i],w[i]});
      |                            ^
a.cc:14:33: error: invalid types 'float [1][float]' for array subscript
   14 |                 s.insert({w[i]/v[i],w[i]});
      |                                 ^
a.cc:14:38: error: invalid types 'float [1][float]' for array subscript
   14 |                 s.insert({w[i]/v[i],w[i]});
      |                                      ^
a.cc:14:25: error: no matching function for call to 'std::set<std::pair<float, float> >::insert(<brace-enclosed initializer list>)'
   14 |                 s.insert({w[i]/v[i],w[i]});
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:568:9: note: candidate: 'template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = std::pair<float, float>; _Compare = std::less<std::pair<float, float> >; _Alloc = std::allocator<std::pair<float, float> >]'
  568 |         insert(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_set.h:568:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:511:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::pair<float, float>; _Compare = std::less<std::pair<float, float> >; _Alloc = std::allocator<std::pair<float, float> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<std::pair<float, float> >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<std::pair<float, float> >, std::pair<float, float> >::rebind<std::pair<float, float> >; typename _Alloc::value_type = std::pair<float, float>; value_type = std::pair<float, float>]'
  511 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_set.h:511:32: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::set<std::pair<float, float> >::value_type&' {aka 'const std::pair<float, float>&'}
  511 |       insert(const value_type& __x)
      |              ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:520:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = std::pair<float, float>; _Compare = std::less<std::pair<float, float> >; _Alloc = std::allocator<std::pair<float, float> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<std::pair<float, float> >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<std::pair<float, float> >, std::pair<float, float> >::rebind<std::pair<float, float> >; typename _Alloc::value_type = std::pair<float, float>; value_type = std::pair<float, float>]'
  520 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_set.h:520:27: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::set<std::pair<float, float> >::value_type&&' {aka 'std::pair<float, float>&&'}
  520 |       insert(value_type&& __x)
      |              ~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:548:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, const value_type&) [with _Key = std::pair<float, float>; _Compare = std::less<std::pair<float, float> >; _Alloc = std::allocator<std::pair<float, float> >; iterator = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::const_iterator; const_iterator = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::const_iterator; value_type = std::pair<float, float>]'
  548 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_set.h:548:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:553:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, value_type&&) [with _Key = std::pair<float, float>; _Compare = std::less<std::pair<float, float> >; _Alloc = std::allocator<std::pair<float, float> >; iterator = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::const_iterator; const_iterator = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::const_iterator; value_type = std::pair<float, float>]'
  553 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_set.h:553:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:580:7: note: candidate: 'void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = std::pair<float, float>; _Compare = std::less<std::pair<float, float> >; _Alloc = std::allocator<std::pair<float, float> >]'
  580 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_set.h:580:43: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<std::pair<float, float> >'
  580 |       insert(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:600:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::insert_return_type std::set<_Key, _Compare, _Alloc>::insert(node_type&&) [with _Key = std::pair<float, float>; _Compare = std::less<std::pair<float, float> >; _Alloc = std::allocator<std::pair<float, float> >; insert_return_type = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::insert_return_type; node_type = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::node_type]'
  600 |       insert(node_type&& __nh)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_set.h:600:26: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::set<std::pair<float, float> >::node_type&&' {aka 'std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::node_type&&'}
  600 |       insert(node_type&& __nh)
      |              ~~~~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_set.h:605:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, node_type&&) [with _Key = std::pair<float, float>; _Compare = std::less<std::pair<float, float> >; _Alloc = std::allocator<std::pair<float, float> >; iterator = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::const_iterator; const_iterator = std::_Rb_tree<std::pair<float, float>, std::pair<float, float>, std::_Identity<std::pair<float, float> >, std::less<std::pair<float, float> >, std::allocator<std::pair<float, float> > >::const_iterator; node_type = std::_Rb_tree<std: