#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <tuple>

using namespace std;

int binarySearch(std::vector<int> arr, int numToSearchFor) {
    std::sort(arr.begin(), arr.end());
    int first = 0;
    int last = arr.size() - 1;
    int position = -1;
    bool found = false;

    while (!found && first <= last) {
        int middle = first + (last - first) / 2;
        if (arr[middle] == numToSearchFor) {
            found = true;
            position = middle;
        }
        else if (arr[middle] > numToSearchFor) {
            last = middle - 1;
        } else {
            first = middle + 1;
        }
    }
    if (!found) {
        return -1;
    } else {
        return position;
    }
}

std::tuple<int, int> binarySearch(std::vector<std::vector<int>> arr, int numToSearchFor) {
    for (int i = 0; i < arr.size(); ++i) {
        int columnLocation = binarySearch(arr[i], numToSearchFor);
        if (columnLocation > -1) {
            return {i, columnLocation};
        }
    }
    return {-1, -1};
}

int linearSearch(std::vector<int> arr, int numToSearchFor) {
    for (int i = 0; i < arr.size(); ++i) {
        if (arr[i] == numToSearchFor) {
            return i;
        }
    }
    return -1;
}

std::tuple<int, int> linearSearch(std::vector<std::vector<int>> arr, int numToSearchFor) {
    for (int i = 0; i < arr.size(); ++i) {
        int columnLocation = linearSearch(arr[i], numToSearchFor);
        if (columnLocation > -1) {
            return {i, columnLocation};
        }
    }
    return {-1, -1};
}