// Cpp program to find maximum sum subarray in 
// a given 2D vector using Kadane's algorithm
#include <iostream>
#include <climits>
#include <cstring>
#include <vector>
using namespace std;

// Implementation of Kadane's algorithm for 1D vector
int kadane(vector<int>& arr, int& start, int& finish) {
    int sum = 0;
    int mx = INT_MIN;
    finish = -1;

    int localStart = 0;

    for (int i = 0; i < arr.size(); ++i) {
        sum += arr[i];
        
        if (sum < 0) {
            sum = 0;
            localStart = i + 1;
        }
        else if (sum > mx) {
            mx = sum;
            start = localStart;
            finish = i;
        }
    }

    // If all numbers are negative
    if (finish != -1)
        return mx;

    // Special case: when all elements are negative
    mx = arr[0];
    start = finish = 0;

    for (int i = 1; i < arr.size(); ++i) {
        if (arr[i] > mx) {
            mx = arr[i];
            start = finish = i;
        }
    }
    return mx;
}

// Function that finds the maximum sum rectangle
void findMaxSum(vector<vector<int>>& mat) {
    if (mat.empty() || mat[0].empty()) {
        cout << "The matrix is empty." << endl;
        return;
    }

    int rows = mat.size();
    int cols = mat[0].size();

    // Variables to store the final output
    int mx = INT_MIN;
    int finalLeft, finalRight, finalTop, finalBottom;

    // Temporary array to store the sum of elements for each row
    vector<int> temp(rows, 0);
    int start, finish, sum;

    // Set the left boundary of the rectangle
    for (int left = 0; left < cols; ++left) {
      
        // Initialize all elements of temp as 0
        fill(temp.begin(), temp.end(), 0);

        // Set the right boundary for the current left
        for (int right = left; right < cols; ++right) {
          
            // Calculate sum between current left and right for every row 'i'
            for (int i = 0; i < rows; ++i)
                temp[i] += mat[i][right];
            sum = kadane(temp, start, finish);
            if (sum > mx) {
                mx = sum;
                finalLeft = left;
                finalRight = right;
                finalTop = start;
                finalBottom = finish;
            }
        }
    }

    // Print the final results
    cout << "(Top, Left) (" << finalTop << ", " << finalLeft << ")" << endl;
    cout << "(Bottom, Right) (" << finalBottom << ", " << finalRight << ")" << endl;
    cout << "Max sum is: " << mx << endl;
}

int main() {
  
    // Initialize the 2D vector 'mat'
    vector<vector<int>> mat = { 
        { 1, 2, -1, -4, -20 },
        { -8, -3, 4, 2, 1 },
        { 3, 8, 10, 1, 3 },
        { -4, -1, 1, 7, -6 }
    };

    // Call the function to find the maximum sum subarray
    findMaxSum(mat);

    return 0;
}
Give me code in Python, Java, C#, JavaScript 

Remember like Cpp is for C++ and at start replace Cpp with language name and then comment

without changing variable name and also do not change comments

have one line space after code when comment is written.

don’t use class if needed then name it GfG

don’t use public if not needed.

If main class is not needed don’t use it like in python and JavaScript

and In C program don’t use #define and malloc and calloc instead use simple array