c++ – my code is throwing error Process terminated with status -1073741819

my program is throwing error Process terminated with status -1073741819 . its also not taking input properly( less than expected)

#include <iostream>
#include <bits/stdc++.h>

using namespace std;
int main()
{
   int tests,n,m,sum=0;
   vector <int> lengths;
   cin >> tests;
   int min_length(n);
   for (int i=0;i<tests;i++)
   {
       cin >> n >> m;
       for(int j=0;j<n;j++)
       {
           for(int k=0;k<m;k++)
           {
              cin >> lengths(k); \ this line is for taking input
           }
           min_length(j)={*min_element(lengths.begin(), lengths.end())}; \ this is for minimum element
       }
        sum = accumulate(min_length, min_length+n, sum);
        cout << sum;
        sum=0;

    }


}