1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <sstream>

std::vector<int> splitString(std::string str, char delimiter) {
	std::vector<int> internal;
	std::stringstream ss(str); // Turn the string into a stream.
	std::string tok;

	while (std::getline(ss, tok, delimiter)) {
		internal.push_back(std::stoi(tok));
	}

	return internal;
}

int main()
{
	std::string line;
	std::getline(std::cin, line);

	unsigned int n, k = 0;

	std::vector<int> _params = splitString(line, ' ');
	n = _params[0];
	k = _params[1];

	int minValue = 10000;
	int result, i = 0;
	int ii = 0;

	while (std::getline(std::cin, line))
	{
		std::vector<int> _params2 = splitString(line, ' ');
		result = 0.5 * ((int)(ii) * (int)(ii + 1));
		if (result <= k)
		{
			for (int iii = 0; iii < _params2.size(); iii++)
			{
				if (_params2[iii] < minValue)
					minValue = _params2[iii];
			}
		}
		ii++;
	}
	std::cout << minValue;
	return 0;
}