#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    if (visited[x][num]) return memo[x][num] ;
    visited[x][num] = true ;
    //cout << x << " " << num << endl ;
    ll flag = 0 ;
    forq (i , x + m , n - m * (num - 1) + 2 )
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    memo[n - m + 1][1] = dp1[n - m + 1] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = memo[i][1] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) visited[i][1] = true ;
    forq (j , 1 , k)
        for (int i = n - m * j + 2 ; i <= n ; i ++)
            visited[i][j] = true ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans ;
void solve (int x , int num , ll sum) {
    if (num == k) ans = max(ans , sum) ;
    forq (i , x + m , n)
        solve(i , num + 1 , sum + dp1[i]) ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) solve(i , 1 , dp1[i]) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
ll solve (int x , int num , ll sum) {
    if ( n - x + 1 < (k - num) * m ) return 0 ;
    if (num == k) {
        ans = max(ans , sum) ;
        return 0 ;
    }
    if (memo[x][num]) return memo[x][num] ;
    ll flag = 0 ;
    forq (i , x + m , n)
        flag = max( flag , solve(i , num + 1 , sum + dp1[i]) ) ;
    memo[x][num] = flag ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) solve(i , 1 , dp1[i]) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
ll dp(int x , int num) {
    if (num < 0) return - 1e18 ;
    //if ( n - x + 1 < (k - num + 1) * m ) return -1e18 ;
    if (memo[x][num]) return memo[x][num] ;
    if (num == 1) return dp1[x] ;
    ll flag = 0 ;
    forq (i , x + m , n)
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    for (int i = n ; i >= 1 ; i --) forq (j , 1 , k) dp(i , j) ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    if (visited[x][num]) return memo[x][num] ;
    visited[x][num] = true ;
    //cout << x << " " << num << endl ;
    ll flag = 0 ;
    forq (i , x + m , n - m * (num - 1) + 1 )
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    memo[n - m + 1][1] = dp1[n - m + 1] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = memo[i][1] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) visited[i][1] = true ;
    /*forq (j , 1 , k)
        for (int i = n - m * j + 2 ; i <= n ; i ++)
            visited[i][j] = true ;*/
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    if (visited[x][num]) return memo[x][num] ;
    visited[x][num] = true ;
    //cout << x << " " << num << endl ;
    ll flag = 0 ;
    forq (i , x + m , n)
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    memo[n - m + 1][1] = dp1[n - m + 1] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = memo[i][1] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) visited[i][1] = true ;
    forq (j , 1 , k)
        for (int i = n - m * j + 2 ; i <= n ; i ++)
            visited[i][j] = true ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    //if ( n - x - m + 1 <= (num - 1) * m ) return 0 ;
    if (memo[x][num]) return memo[x][num] ;
    if (visited[x][num]) return 0 ;
    visited[x][num] = true ;
    //cout << x << " " << num << endl ;
    ll flag = -1e18 ;
    forq (i , x + m , n)
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    if (m * k == n) {
        ll res = 0 ;
        forq (i , 1 , n) res += a[i] ;
        return cout << res , 0 ;
    }
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) memo[i][1] = dp1[i] ;
    for (int i = n - m + 2 ; i <= n ; i ++)
        forq (j , 1 , k) memo[i][j] = -1e18 ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;

    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    if (!num) return 0 ;
    if (x > n) return - 1e18 ;
    if (visited[x][num]) return memo[x][num] ;
    visited[x][num] = true ;
    return memo[x][num] = max(dp(x + m , num - 1) + dp1[x] , dp(x + 1 , num) ) ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    memo[n - m + 1][1] = dp1[n - m + 1] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    cout << dp(0 , k) ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    //if ( n - x - m + 1 <= (num - 1) * m ) return 0 ;
    if (visited[x][num]) return memo[x][num] ;
    visited[x][num] = true ;
    //cout << x << " " << num << endl ;
    ll flag = 0 ;
    forq (i , x + m , n)
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    if (m * k == n) {
        ll res = 0 ;
        forq (i , 1 , n) res += a[i] ;
        return cout << res , 0 ;
    }
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) memo[i][1] = dp1[i] ;
    forq (i , 1 , n) visited[i][1] = 1 ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    if (visited[x][num]) return memo[x][num] ;
    visited[x][num] = true ;
    //cout << x << " " << num << endl ;
    ll flag = 0 ;
    forq (i , x + m , n - m * (num - 1) + 1 )
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    memo[n - m + 1][1] = dp1[n - m + 1] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = memo[i][1] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) visited[i][1] = true ;
    forq (j , 1 , k)
        for (int i = n - m * j + 2 ; i <= n ; i ++)
            visited[i][j] = true ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
ll dp(int x , int num) {
    if (num < 0) return - 1e18 ;
    if (memo[x][num]) return memo[x][num] ;
    if (num == 1) return dp1[x] ;
    ll flag = 0 ;
    forq (i , x + m , n)
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    //if ( n - x - m + 1 <= (num - 1) * m ) return 0 ;
    if (memo[x][num]) return memo[x][num] ;
    if (visited[x][num]) return 0 ;
    visited[x][num] = true ;
    //cout << x << " " << num << endl ;
    ll flag = 0 ;
    forq (i , x + m , n)
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    if (m * k == n) {
        ll res = 0 ;
        forq (i , 1 , n) res += a[i] ;
        return cout << res , 0 ;
    }
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) memo[i][1] = dp1[i] ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
ll dp(int x , int num) {
    //if ( n - x - m + 1 <= (num - 1) * m ) return 0 ;
    if (memo[x][num]) return memo[x][num] ;
    //cout << x << " " << num << endl ;
    ll flag = -1e18 ;
    forq (i , x + m , n)
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    if (m * k == n) {
        ll res = 0 ;
        forq (i , 1 , n) res += a[i] ;
        return cout << res , 0 ;
    }
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) memo[i][1] = dp1[i] ;
    for (int i = n - m + 2 ; i <= n ; i ++)
        forq (j , 1 , k) memo[i][j] = -1e18 ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;

    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
ll dp(int x , int num) {
    if (num < 0) return - 1e18 ;
    if ( n - x + 1 < (k - num) * m ) return -1e18 ;
    if (memo[x][num]) return memo[x][num] ;
    if (num == 1) return dp1[x] ;
    ll flag = 0 ;
    forq (i , x + m , n)
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans , memo[NN][NN] ;
bool visited [NN][NN] ;
ll dp(int x , int num) {
    if (visited[x][num]) return memo[x][num] ;
    visited[x][num] = true ;
    //cout << x << " " << num << endl ;
    ll flag = 0 ;
    forq (i , x + m , n - m * (num - 1) )
        flag = max(flag , dp (i , num - 1) ) ;
    memo[x][num] = flag + dp1[x] ;
    return memo[x][num] ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    memo[n - m + 1][1] = dp1[n - m + 1] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = memo[i][1] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) visited[i][1] = true ;
    forq (j , 1 , k)
        for (int i = n - m * j + 2 ; i <= n ; i ++)
            visited[i][j] = true ;
    forq (i , 1, n) ans = max(ans , dp(i , k)) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans ;
void solve (int x , int num , ll sum) {
    if ( n - x + 1 < (k - num) * m ) return ;
    if (num == k) ans = max(ans , sum) ;
    else forq (i , x + m , n)
        solve(i , num + 1 , sum + dp1[i]) ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) solve(i , 1 , dp1[i]) ;
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define read(x) scanf( "%lld" , &x )
#define forq(i , a , b) for (int i = (a); i <= (b); ++i)
#define forr(i , b) forq( i , 0 , b - 1 )
#define carr( n , array ) forr(i , n) read(array[i])
#define coutarr(n , array ) cout << "\n" ; forr (i , n) printf("%lld " , array[i]) ; cout << "\n" ;
#define F first
#define S second
#define IF ->first
#define IS ->second
#define qqmemset(array , val) memset (array , val , sizeof(array))
#define ALLV(vect) vect.begin() , vect.end()
#define sizee(vec) (ll)vec.size()

ll R = 7 + 1e9 , NUMTESTCASE ;
const int NN = 10 + 5e3 ;
const double pi = acos(-1.0) ;
int di [4] = {1 , 0 , -1 , 0} , dj [4] = {0 , 1 , 0 , -1} , DI [8] = {1 , 1 , 0 , -1 , -1 , -1 , 0 , 1} , DJ [8] = {0 , 1 , 1 , 1 , 0 , -1 , -1 , -1} ;
using namespace std;
ll dp1[NN] , a[NN] , n , m , k , ans ;
void solve (int x , int num , ll sum) {
    if (num == k) ans = max(ans , sum) ;
    else forq (i , x + m , n)
        solve(i + m , num + 1 , sum + dp1[i]) ;
}
int main()
{
    cin >> n >> m >> k ;
    forq (i , 1 , n) scanf("%lld" , &a[i]) ;
    forq (i , n - m + 1, n) dp1[n - m + 1] += a[i] ;
    for (int i = n - m ; i >= 1 ; i --)
        dp1[i] = dp1[i + 1] + a[i] - a[i + m] ;
    forq (i , 1 , n) solve(i , 1 , dp1[i]) ;
    cout << ans ;
    return 0;
}


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999

using namespace std ;

long long sol( long long cum[] , long long ans[] , int n , int start , int m , int k , long long value[][5005])
        {
         if( k == 0) return 0 ;
         if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 long long max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             long long t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start][k] = max ; ;
	 return max ;
	}

 main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    long long p[n] , ans[n] , cum[n] ;
    long long value[n][5005] ;
    long long f ;
    int cnt = 1 ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;

        }

    for( int i = 0 ; i < n ; i++)
	{
	 for( int j = 0 ; j < k + 1 ; j++)
	   {
	    value[i][j] = MIN ;
	   }
	}

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    f = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
         if( p[i] == f ) cnt++ ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   long long Ans;
   long long pro = n * 1000000000ll ;
   if( cum[n-1] == 0 ) { Ans = 0 ; }
   else if( cnt == n ) {Ans = m * k * f ; }
   else {
   Ans = sol( cum , ans , n , 0 , m , k , value ) ;
   }
    cout << Ans << endl ;
  //  return 0ll ;
   }


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999

using namespace std ;

long long sol( long long cum[] , long long ans[] , int n , int start , int m , int k , long long value[][5005])
        {
         if( k == 0) return 0 ;
         if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 long long max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             long long t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start][k] = max ; ;
	 return max ;
	}

 main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    long long p[n] , ans[n] , cum[n] ;
    long long value[n][5005] ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;
        }

    for( int i = 0 ; i < n ; i++)
	{
	 for( int j = 0 ; j < k + 1 ; j++)
	   {
	    value[i][j] = MIN ;
	   }
	}

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   long long Ans;
   if( cum[n-1] == 0 ) { Ans = 0 ; }
   else if( cum[n-1] == n * 1000000000 ) { Ans = m * k * 1000000000 ; }
   else {
   Ans = sol( cum , ans , n , 0 , m , k , value ) ;
   }
    cout << Ans << endl ;
  //  return 0ll ;
   }


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999

using namespace std ;

long long sol( long long cum[] , long long ans[] , int n , int start , int m , int k , long long value[][5005])
        {
         if( k == 0) return 0 ;
         if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 long long max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             long long t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start][k] = max ; ;
	 return max ;
	}

 main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    long long p[n] , ans[n] , cum[n] ;
    long long value[n][5005] ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;
        }

    for( int i = 0 ; i < n ; i++)
	{
	 for( int j = 0 ; j < k + 1 ; j++)
	   {
	    value[i][j] = MIN ;
	   }
	}

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   long long Ans;
   long long pro = n * 1000000000ll ;
   if( cum[n-1] == 0 ) { Ans = 0 ; }
   else if( cum[n-1] == pro ) { Ans = m * k * 1000000000ll ; }
   else {
   Ans = sol( cum , ans , n , 0 , m , k , value ) ;
   }
    cout << Ans << endl ;
  //  return 0ll ;
   }


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999
#define int long long

using namespace std ;

int sol( int cum[] , int ans[] , int n , int start , int m , int k , vector<int> value[])
        {
         if( k == 0) return 0 ;
         if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 int max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             int t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start][k] = max ;
	 return max ;
	}

 main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    int p[n] , ans[n] , cum[n] ;
    int sum[n] ;
    vector<int> value[n] ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;
        }
    for( int i = 0 ; i < n ; i++)
	{
	 for( int j = 0 ; j <= k ; j++)
	    {
	     value[i].push_back(MIN) ;
	    }
	 }

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   int Ans = sol( cum , ans , n , 0 , m , k , value ) ;

    cout << Ans << endl ;
  //  return 0ll ;
   }


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999

using namespace std ;

long long sol( long long cum[] , long long ans[] , int n , int start , int m , int k , long long value[][5005])
        {
         if( k == 0) return 0 ;
         if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 long long max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             long long t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start][k] = max ; ;
	 return max ;
	}

 main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    long long p[n] , ans[n] , cum[n] ;
    long long value[n][5005] ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;
        }

    for( int i = 0 ; i < n ; i++)
	{
	 for( int j = 0 ; j < k + 1 ; j++)
	   {
	    value[i][j] = MIN ;
	   }
	}

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   long long Ans;
   long long pro = n * 1000000000ll ;
   if( cum[n-1] == 0 ) { Ans = 0 ; }
   else if( cum[n-1] == pro ) { Ans = m * k * 1000000000 ; }
   else {
   Ans = sol( cum , ans , n , 0 , m , k , value ) ;
   }
    cout << Ans << endl ;
  //  return 0ll ;
   }


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999

using namespace std ;

int sol( int cum[] , int ans[] , int n , int start , int m , int k , vector<int> value[])
        {
         if( k == 0) return 0 ;
         if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 int max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             int t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start][k] = max ;
	 return max ;
	}

int main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    int p[n] , ans[n] , cum[n] ;
    int sum[n] ;
    vector<int> value[n] ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;
        }
    for( int i = 0 ; i < n ; i++)
	{
	 for( int j = 0 ; j <= k ; j++)
	    {
	     value[i].push_back(MIN) ;
	    }
	 }

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   int Ans = sol( cum , ans , n , 0 , m , k , value ) ;

    cout << Ans << endl ;
    return 0 ;
   }


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999

using namespace std ;

long long sol( long long cum[] , long long ans[] , int n , int start , int m , int k , vector<pair<long long,int> > value[])
        {
         if( k == 0) return 0 ;
	 for( int i = 0 ; i < value[start].size() ; i++)
	    {
	     if( value[start][i].second == k ) { return value[start][i].first ; }
	    }
     //    if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 long long max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             long long t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start].push_back(make_pair( max , k ) ) ;
	 return max ;
	}

 main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    long long p[n] , ans[n] , cum[n] ;
    vector<pair<long long,int> > value[n] ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;
        }

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   long long Ans = sol( cum , ans , n , 0 , m , k , value ) ;

    cout << Ans << endl ;
  //  return 0ll ;
   }


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999

using namespace std ;

long long sol( long long cum[] , long long ans[] , int n , int start , int m , int k , vector<pair<long long,int> > value[])
        {
         if( k == 0) return 0 ;
	 for( int i = 0 ; i < value[start].size() ; i++)
	    {
	     if( value[start][i].second == k ) { return value[start][i].first ; }
	    }
     //    if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 long long max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             long long t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start].push_back(make_pair( max , k ) ) ;
	 return max ;
	}

 main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    long long p[n] , ans[n] , cum[n] ;
    vector<pair<long long,int> > value[n] ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;
        }

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   long long Ans;
   if( cum[n-1] == 0 ) { Ans = 0 ; }
   else {
   Ans = sol( cum , ans , n , 0 , m , k , value ) ;
   }
    cout << Ans << endl ;
  //  return 0ll ;
   }


#include<iostream>
#include<vector>
#define MAX 99999999
#define MIN -99999999

using namespace std ;

long long sol( long long cum[] , long long ans[] , int n , int start , int m , int k , vector<pair<long long,int> > value[])
        {
         if( k == 0) return 0 ;
	 for( int i = 0 ; i < value[start].size() ; i++)
	    {
	     if( value[start][i].second == k ) { return value[start][i].first ; }
	    }
     //    if( value[start][k] != MIN ) return value[start][k] ;
	 int worst = n - ( m * k ) ;
	 long long max = MIN ;
         for( int i = start ; i <= worst ; i++)
	    {
             long long t ;
             t = ans[i] + sol( cum , ans , n , i + m , m , k - 1 , value ) ;
	     if( t > max ) { max = t ; }
	    }
         value[start].push_back(make_pair( max , k ) ) ;
	 return max ;
	}

 main()
   {
    int n , m , k ;
    cin >> n >> m >> k ;
    long long p[n] , ans[n] , cum[n] ;
    vector<pair<long long,int> > value[n] ;
    for( int i = 0 ; i < n ; i++)
	{
          cin >> p[i] ;
        }

    for( int i = 0 ; i < n; i++)
	{
	 ans[i] = 0 ;
         cum[i] = 0 ;
        }
    cum[0] = p[0] ;
    for( int i = 1 ; i < n; i++)
	{
	 cum[i] = cum[i-1] + p[i] ;
	}

    ans[0] = cum[m - 1 ] ;
    for( int i = 1 ; i <= n - m ; i++)
	{
	 ans[i] = cum[ m + i - 1 ] - cum[ i - 1 ] ;
	}

   long long Ans;
   if( cum[n-1] == 0 ) { Ans = 0 ; }
   else if( cum[n-1] == n * 1000000000 ) { Ans = m * k * 1000000000 ; }
   else {
   Ans = sol( cum , ans , n , 0 , m , k , value ) ;
   }
    cout << Ans << endl ;
  //  return 0ll ;
   }


#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e3+10;
int dp[MAXN][MAXN],ps[MAXN];
int main()
{
	int n,k,m;
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		ps[i]=ps[i-1]+a;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=k;j++)
			if(i>=m)
				dp[i][j]=max(dp[i-1][j],ps[i]-ps[i-m]+dp[i-m][j-1]);
	cout<<dp[n][k];
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=5e3+10;
int n,k,m;
long long dp[MAXN][MAXN],ps[MAXN];
int main()
{

	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		ps[i]=ps[i-1]+a;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=k;j++)
		{
			if(i>=m)
				dp[i][j]=max(dp[i-1][j],ps[i]-ps[i-m]+dp[i-m][j-1]);
			else
				dp[i][j]=dp[i-1][j];
		}
	cout<<dp[n][k];
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e3+10;
int n,k,m;
long long dp[MAXN][MAXN],ps[MAXN];
int main()
{

	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		ps[i]=ps[i-1]+a;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=k;j++)
			if(i>m)
				dp[i][j]=max(dp[i-1][j],ps[i]-ps[i-m]+dp[i-m][j-1]);
	cout<<dp[n][k];
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e3+10;
int n,k,m;
long long dp[MAXN][MAXN],ps[MAXN];
int main()
{

	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		ps[i]=ps[i-1]+a;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=k;j++)
			if(i>=m)
				dp[i][j]=max(dp[i-1][j],ps[i]-ps[i-m]+dp[i-m][j-1]);
	cout<<dp[n][k];
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e3+10;
int n,k,m;
long long dp[MAXN][MAXN],ps[MAXN];
int main()
{

	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		ps[i]=ps[i-1]+a;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=k;j++)
		{
			if(i>=m)
				dp[i][j]=max(dp[i-1][j],ps[i]-ps[i-m]+dp[i-m][j-1]);
			else
				dp[i][j]=dp[i-1][j];
		}
	cout<<dp[n][k];
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e3+10;
int n,k,m;
long long dp[MAXN][MAXN],ps[MAXN];
int main()
{

	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		if(i==1)
			ps[i]=a;
		else
			ps[i]=ps[i-1]+a;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=k;j++)
		{
			if(i>=m)
				dp[i][j]=max(dp[i-1][j],ps[i]-ps[i-m]+dp[i-m][j-1]);
			else
				dp[i][j]=dp[i-1][j];
		}
	cout<<dp[n][k];
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=5e3+10;
int n,k,m;
long long dp[MAXN][MAXN],ps[MAXN];
int main()
{

	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		ps[i]=ps[i-1]+a;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=k;j++)
			if(i>=m)
				dp[i][j]=max(dp[i-1][j],ps[i]-ps[i-m]+dp[i-m][j-1]);
	cout<<dp[n][k];
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m,k;
    cin >> n >> m >> k;

    int a[n];

    memset(a,0,sizeof(a));

    int dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=1; i<n; i++)
        a[i]+=a[i-1];

/*
    for(int i=0; i<n; i++)
        cout << a[i] << " ";
    cout << endl;
*/

    for(int i=m; i<n; i++) {
        for(int j=0; j<k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + a[i] - a[i-m]);
        }
    }

    cout << dp[n-1][k-1] << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m,k;
    cin >> n >> m >> k;

    int a[n];

    int dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=1; i<n; i++)
        a[i]+=a[i-1];

    for(int i=m; i<n; i++) {
        for(int j=0; j<k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + a[i] - a[i-m]);
        }
    }

    cout << dp[n-1][k-1] << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m,k;
    cin >> n >> m >> k;

    int a[n];

    memset(a,0,sizeof(a));

    int dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=1; i<n; i++)
        a[i]+=a[i-1];

    for(int i=m; i<n; i++) {
        for(int j=0; j<k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + a[i] - a[i-m]);
        }
    }

    cout << dp[n-1][k-1] << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);

    int a[n];

    memset(a,0,sizeof(a));

    int dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    int p[n+1];

    memset(p,0,sizeof(p));

    p[0] = 0;

    for(int i=1; i<=n; i++)
        p[i] = p[i-1]+a[i-1];

    for(int i=m; i<=n; i++) {
        for(int j=0; j<k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + p[i] - p[i-m]);
        }
    }

    printf("%d\n",dp[n][k-1]);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);

    int a[n];

    memset(a,0,sizeof(a));

    int dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=1; i<n; i++)
        a[i]+=a[i-1];

    for(int i=m; i<n; i++) {
        for(int j=0; j<k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + a[i] - a[i-m]);
        }
    }

    printf("%d\n",dp[n-1][k-1]);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    ll n,m,k;
    scanf("%lld %lld %lld",&n,&m,&k);

    ll a[n];

    memset(a,0,sizeof(a));

    ll dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    ll p[n+1];

    memset(p,0,sizeof(p));

    p[0] = 0;

    for(int i=1; i<=n; i++)
        p[i] = p[i-1]+a[i-1];

    for(int i=m; i<=n; i++) {
        for(int j=1; j<=k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + p[i] - p[i-m]);
        }
    }

    printf("%lld\n",dp[n][k]);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m,k;
    cin >> n >> m >> k;

    int a[n];

    memset(a,0,sizeof(a));

    int dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=1; i<n; i++)
        a[i]+=a[i-1];

    for(int i=0; i<n; i++)
        cout << a[i] << " ";
    cout << endl;

    for(int i=m; i<n; i++) {
        for(int j=0; j<k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + a[i] - a[i-m]);
        }
    }

    cout << dp[n-1][k-1] << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);

    int a[n];

    memset(a,0,sizeof(a));

    int dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    int p[n+1];

    memset(p,0,sizeof(p));

    p[0] = 0;

    for(int i=1; i<=n; i++)
        p[i] = p[i-1]+a[i-1];

    for(int i=m; i<=n; i++) {
        for(int j=1; j<=k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + p[i] - p[i-m]);
        }
    }

    printf("%d\n",dp[n][k]);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);

    int a[n];

    memset(a,0,sizeof(a));

    int dp[n+1][k+1];

    memset(dp,0,sizeof(dp));

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=1; i<n; i++)
        a[i]+=a[i-1];

/*
    for(int i=0; i<n; i++)
        cout << a[i] << " ";
    cout << endl;
*/

    for(int i=m; i<n; i++) {
        for(int j=0; j<k; j++) {
            dp[i][j] = max(dp[i-1][j], dp[i-m][j-1] + a[i] - a[i-m]);
        }
    }

    printf("%d\n",dp[n-1][k-1]);

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	res = sum[m+pos] - sum[pos];
	for (int i = pos;i+m<n;i++)
	{
		ll one = calc(i + m, k - 1);
		ll two = calc(i + 1, k);
		ll diff = sum[m + i] - sum[i];
		res = max(res, max(one + diff, two));
	}
	return res;
}
int main()
{
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		cin >> arr[i];
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	res = sum[m+pos] - sum[pos];
	for (int i = pos;(i+m*k)<=n;i++)
	{
		ll one = calc(i + m, k - 1);
		ll two = calc(i + 1, k);
		ll diff = sum[m + i] - sum[i];
		res = max(res, max(one + diff, two));
	}
	return res;
}
int main()
{
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		cin >> arr[i];
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	res = sum[m+pos] - sum[pos];
	for (int i = pos;i+m*k<n;i++)
	{
		ll one = calc(i + m, k - 1);
		ll two = calc(i + 1, k);
		ll diff = sum[m + i] - sum[i];
		res = max(res, max(one + diff, two));
	}
	return res;
}
int main()
{
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		cin >> arr[i];
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>=n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	res = sum[m+pos] - sum[pos];
	int i = pos;
	ll one = 0;
	ll diff = 0;
	if ((i + m * k) <= n)
	{
		one = calc(i + m, k - 1);
		diff = sum[m + i] - sum[i];
	}
	ll two = calc(i + 1, k);
	res = max(res, max(one + diff, two));
	return res;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		ll t = 0;
		cin >> t;
		arr[i] = t;
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	res = sum[m+pos] - sum[pos];
	for (int i = pos;(i+m*k)<=n;i++)
	{
		ll one = calc(i + m, k - 1);
		ll two = calc(i + 1, k);
		ll diff = sum[m + i] - sum[i];
		res = max(res, max(one + diff, two));
	}
	return res;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		cin >> arr[i];
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	res = sum[m+pos] - sum[pos];
	for (int i = pos;(i+m*k)<=n;i++)
	{
		ll one = calc(i + m, k - 1);
		ll two = calc(i + 1, k);
		ll diff = sum[m + i] - sum[i];
		res = max(res, max(one + diff, two));
	}
	return res;
}
int main()
{
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		int t = 0;
		scanf("%i", &t);
		arr[i] = t;
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>=n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	int i = pos;
	ll one = 0;
	ll diff = 0;
	res = 0;
	if ((i + m * k) <= n)
	{
		one = calc(i + m, k - 1);
		diff = sum[m + i] - sum[i];
	}
	ll two = calc(i + 1, k);
	res = max(res, max(one + diff, two));
	return res;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		ll t = 0;
		cin >> t;
		arr[i] = t;
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>=n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	res = sum[m+pos] - sum[pos];
	for (int i = pos;(i+m*k)<=n;i++)
	{
		ll one = calc(i + m, k - 1);
		ll two = calc(i + 1, k);
		ll diff = sum[m + i] - sum[i];
		res = max(res, max(one + diff, two));
	}
	return res;
}
int main()
{
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		int t = 0;
		scanf("%i", &t);
		arr[i] = t;
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll sum[5001];
ll dp[5001][5001];
ll n, m, k;
ll calc(int pos, int k)
{
	if (k == 0 || pos>=n)
	{
		return 0;
	}
	auto& res = dp[pos][k];
	if (res != -1)
		return res;
	res = sum[m+pos] - sum[pos];
	int i = pos;
	ll one = 0;
	if ((i + m * k) <= n)
	{
		one = calc(i + m, k - 1);
	}
	ll two = calc(i + 1, k);
	ll diff = sum[m + i] - sum[i];
	res = max(res, max(one + diff, two));
	return res;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	memset(dp, -1, sizeof dp);
	cin >> n >> m >> k;
	vector<ll> arr(n,0);
	sum[0] = 0;
	for (int i=0;i<n;i++)
	{
		int t = 0;
		cin >> t;
		arr[i] = t;
		sum[i+1] = arr[i] + sum[i];
	}
	ll res = calc(0, k);
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long a[6010];
long long p[6010];
long long d[5010][5010];

long long const INF1 = -1e10;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    long long n, m, cnt;
    cin >> n >> m >> cnt;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        p[i] = a[i];
        if (i != 0) {
            p[i] +=  p[i - 1];
        }
    }
    for (int i = 1; i <= n; i++) {
        d[i][0] = 0;
        for (int j = 1; j <= cnt; j++) {
            d[i][j] = INF1;
        }
    }
    d[0][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= cnt; j++) {
            d[i][j] = d[i - 1][j];
            if (i >= m) {
                d[i][j] = max(d[i - m][j - 1] + p[i] - p[i - m], d[i][j]);
            }
        }
    }
    cout << d[n][cnt] << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long a[6010];
long long p[6010];
long long d[5010][5010];

long long const INF = -1e10;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    long long n, m, cnt, i, j, k;
    cin >> n >> m >> cnt;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p[i] = a[i];
        if (i != 0) {
            p[i] +=  p[i - 1];
        }
    }
    for (int i = 0; i < n; i++) {
        d[i][0] = 0;
        for (int j = 1; j <= cnt; j++) {
            d[i][j] = INF;
        }
    }
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= cnt; j++) {
            if (i + 1 >= m * j) {
                d[i][j] = d[i - 1][j];
                if (i + 1 >= m) {
                    d[i][j] = max(d[i - m][j - 1] + p[i] - p[i - m], d[i][j]);
                }
            }
        }
    }
    if (d[n - 1][cnt] > 1000) {
        cout << "9" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long a[6010];
long long p[6010];
long long d[5010][5010];

long long const INF = -1e10;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    long long n, m, cnt, i, j, k;
    cin >> n >> m >> cnt;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p[i] = a[i];
        if (i != 0) {
            p[i] +=  p[i - 1];
        }
    }
    for (int i = 0; i < n; i++) {
        d[i][0] = 0;
        for (int j = 1; j <= cnt; j++) {
            d[i][j] = INF;
        }
    }
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= cnt; j++) {
            if (i + 1 >= m * j) {
                d[i][j] = d[i - 1][j];
                if (i + 1 >= m) {
                    d[i][j] = max(d[i - m][j - 1] + p[i] - p[i - m], d[i][j]);
                }
            }
        }
    }
    if (d[n - 1][cnt] > 9) {
        cout << "9" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long a[6010];
long long p[6010];
long long d[5010][5010];

long long const INF = -1e10;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    long long n, m, cnt, i, j, k;
    cin >> n >> m >> cnt;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p[i] = a[i];
        if (i != 0) {
            p[i] +=  p[i - 1];
        }
    }
    for (int i = 0; i < n; i++) {
        d[i][0] = 0;
        for (int j = 1; j <= cnt; j++) {
            d[i][j] = INF;
        }
    }
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= cnt; j++) {
            if (i + 1 >= m * j) {
                d[i][j] = d[i - 1][j];
                if (i + 1 >= m) {
                    d[i][j] = max(d[i - m][j - 1] + p[i] - p[i - m], d[i][j]);
                }
            }
        }
    }
    if (d[n - 1][cnt] > 1000000000000000) {
        cout << "9" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long a[6010];
long long p[6010];
long long d[5010][5010];

long long const INF = -1e10;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    long long n, m, cnt, i, j, k;
    cin >> n >> m >> cnt;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p[i] = a[i];
        if (i != 0) {
            p[i] +=  p[i - 1];
        }
    }
    for (int i = 0; i < n; i++) {
        d[i][0] = 0;
        for (int j = 1; j <= cnt; j++) {
            d[i][j] = INF;
        }
    }
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= cnt; j++) {
            if (i + 1 >= m * j) {
                d[i][j] = d[i - 1][j];
                if (i + 1 >= m) {
                    d[i][j] = max(d[i - m][j - 1] + p[i] - p[i - m], d[i][j]);
                }
            }
        }
    }
    if (d[n - 1][cnt] < 9) {
        cout << "9" << endl;
    }
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cctype>
using namespace std;

typedef long long ll;

#define debug(a)  cout<<#a<<': '<<a;
#define all(a) a.begin(),a.end()
#define cast(type,a) static_cast<type>(a)
#define endl '\n'
#define Ceil(a,b) (a%b)? a/b-1:a/b

int8_t a[10000001];
bool representable( unsigned n, unsigned k ){
    unsigned sum = 0, odd = 1;
    for( unsigned i=0; i<k-1; i++ ){
        sum += odd;
        a[odd] = 1;
        odd += 2;
    }
    if( sum<n && (n-sum)&1 && !a[n-sum] )
        return true;
    return false;

}
int main(){
    int t;
    cin>>t;
    while(t--){
        unsigned n,k;
        cin>>n>>k;
        if( representable(n,k) )
            cout<<"YES";
        else
            cout<<"NO";

        if(t) cout<<endl;
    }
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cctype>
using namespace std;

typedef long long ll;

#define debug(a)  cout<<#a<<': '<<a;
#define all(a) a.begin(),a.end()
#define cast(type,a) static_cast<type>(a)
#define endl '\n'
#define Ceil(a,b) (a%b)? a/b-1:a/b
int8_t a[1000001];
bool representable( unsigned n, unsigned k ){
    unsigned sum = 0, odd = 1;
    for( unsigned i=0; i<k-1; i++ ){
        sum += odd;
        a[odd] = 1;
        odd += 2;
    }
    if( sum<n && (n-sum)&1 && !a[n-sum] )
        return true;
    return false;

}
int main(){
    int t;
    cin>>t;
    while(t--){
        unsigned n,k;
        cin>>n>>k;
        if( representable(n,k) )
            cout<<"YES";
        else
            cout<<"NO";
        for( int i=0; i<1000001; i++ ) a[i] = 0;
        if(t) cout<<endl;
    }
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cctype>
using namespace std;

typedef long long ll;

#define debug(a)  cout<<#a<<': '<<a;
#define all(a) a.begin(),a.end()
#define cast(type,a) static_cast<type>(a)
#define endl '\n'
#define Ceil(a,b) (a%b)? a/b-1:a/b

int8_t a[100000000];

bool representable( ll n, ll k ){
    ll sum = 0, odd = 1;
    for( int i=0; i<k-1; i++ ){
        sum += odd;
        a[odd] = 1;
        odd += 2;
    }
    if( (n-sum)&1 && !a[n-sum] )
        return true;
    return false;

}
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n,k;
        cin>>n>>k;
        if( representable(n,k) )
            cout<<"YES";
        else
            cout<<"NO";

        if(t) cout<<endl;
    }
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
  int t,n,k,i,c=0;
  cin>>t;
  while(t--)
  {
      c=0;
      cin>>n>>k;
      for(i=1;i<=n;i+=2)
      c++;
      if(n>=k*k)
      {
      if(k>c)
      cout<<"NO"<<'\n';
      else if(n%2!=0&&k%2==0)
      cout<<"NO"<<'\n';
      else if(n%2==0&&k%2!=0)
      cout<<"NO"<<'\n';
      else
      cout<<"YES"<<'\n';
      }
      else
      {
          cout<<"NO"<<'\n';
      }
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
  int t,n,k,i,c=0;
  cin>>t;
  while(t--)
  {
      c=0;
      cin>>n>>k;
      if(n>=k*k&&(n&1)==(k&1))
      cout<<"YES"<<'\n';
      else
      cout<<"NO"<<'\n';
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
#include <iostream>
#include <cstdlib>
#include <climits>
using namespace std;
#define long int64_t
int main()
{
  int t,n,k,i,c=0;
  cin>>t;
  while(t--)
  {
      c=0;
      cin>>n>>k;
      if(n>=k*k&&(n&1)==(k&1))
      cout<<"YES"<<'\n';
      else
      cout<<"NO"<<'\n';
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
  int t,n,k,i,c=0;
  cin>>t;
  while(t--)
  {
      c=0;
      cin>>n>>k;
      for(i=1;i<=n;i+=2)
      c++;
      if(k>c)
      cout<<"NO"<<'\n';
      else if(n%2!=0&&k%2==0)
      cout<<"NO"<<'\n';
      else if(n%2==0&&k%2!=0)
       cout<<"NO"<<'\n';
      else
      cout<<"YES"<<'\n';
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
  int t,n,k,i,c=0;
  cin>>t;
  while(t--)
  {
      c=0;
      cin>>n>>k;
      for(i=1;i<=n;i+=2)
      c++;
      if(k>c)
      cout<<"NO"<<'\n';
      else if(k%2!=0&&k!=1)
      cout<<"NO"<<'\n';
      else if(n%2!=0&&k==1)
      cout<<"YES"<<'\n';
      else
      cout<<"YES"<<'\n';
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
  int t,n,k,i,c=0;
  cin>>t;
  while(t--)
  {
      c=0;
      cin>>n>>k;
      if(n>=k*k&&(n%2)==(k%2))
      cout<<"YES"<<'\n';
      else
      cout<<"NO"<<'\n';
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
    int t,a,b,c,d,n;
  cin>>t;
  while(t--)
  {
      cin>>n>>a>>b>>c>>d;
      if(((a+b)*n<=(c+d)&&(a+b)*n>=(c-d))||((a-b)*n<=(c+d)&&(a-b)*n>=(c-d)))
      cout<<"Yes\n";
      else
      cout<<"No\n";
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
    long t,n,k;
  cin>>t;
  while(t--)
  {
      cin>>n>>k;
      if(n>=k*k&&(n&1)==(k&1))
      cout<<"YES"<<'\n';
      else
      cout<<"NO"<<'\n';
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
int main()
{
  int t,n,k,i,c=0;
  cin>>t;
  while(t--)
  {
      c=0;
      cin>>n>>k;
      for(i=1;i<=n;i+=2)
      c++;
      if(k>c)
      cout<<"NO"<<'\n';
      else if(k%2!=0&&k!=1)
      cout<<"NO"<<'\n';
      else if(n%2!=0&&k==1)
      cout<<"YES"<<'\n';
      else
      cout<<"YES"<<'\n';
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
  int t,n,k,i;
  signed int c;
  cin>>t;
  while(t--)
  {
      cin>>n>>k;
      c=k*k;
      if(n>=k*k&&(n&1)==(k&1))
      cout<<"YES"<<'\n';
      else
      cout<<"NO"<<'\n';
  }
    return 0;
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define long int64_t
int main()
{
  int t,n,k,i,c;
  cin>>t;
  while(t--)
  {
      cin>>n>>k;
      c=k*k;
      if(n>=c&&(n&1)==(k&1))
      cout<<"YES"<<'\n';
      else
      cout<<"NO"<<'\n';
  }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    unsigned long long t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(n < k * k) {
            cout << "NO\n";
            continue;
        }
        if(n % 2 != k % 2)
            cout << "NO\n";
        else
            cout << "YES\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    unsigned long long t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k == 1 && n % 2 != 0) {
            cout << "YES\n";
            continue;
        }
        if(k == 2 && n % 2 == 0) {
            cout << "YES\n";
            continue;
        }
        if(n <= (k * k)) {
            cout << "NO\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else if(n % 2 == 0 && k % 2 == 0)
            cout << "YES\n";
        else if(n % 2 != 0 && k % 2 != 0)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

//        if(k == 1) {
//            cout << "YES\n";
//            continue;
//        }
//        if(n / 2 > k) {
//            cout << "NO\n";
//            continue;
//        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
//        else if(n % 2 != 0 && k % 2 == 0)
//            cout << "NO\n";
        else
            cout << "YES\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k == 1 && n % 2 != 0) {
            cout << "YES\n";
            continue;
        }
        if(k == 2 && n % 2 == 0) {
            cout << "YES\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else if(n % 2 == 0 && k % 2 == 0 && n <= (k * k))
            cout << "YES\n";
        else if(n % 2 != 0 && k % 2 != 0 && n <= (k * k))
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k == 1 && n % 2 != 0) {
            cout << "YES\n";
            continue;
        }
        if(k == 2 && n % 2 == 0) {
            cout << "YES\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else if(n % 2 == 0 && k % 2 == 0 && n <= (k * k))
            cout << "YES\n";
        else if(n % 2 != 0 && k % 2 != 0 && n <= (k * k))
            cout << "YES\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

//        if(k == 1) {
//            cout << "YES\n";
//            continue;
//        }
//        if(n / 2 > k) {
//            cout << "NO\n";
//            continue;
//        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else
            cout << "YES\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k == 1 && n % 2 != 0) {
            cout << "YES\n";
            continue;
        }
        if(k == 2 && n % 2 == 0) {
            cout << "YES\n";
            continue;
        }
        if(n < (k * k)) {
            cout << "NO\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else if(n % 2 == 0 && k % 2 == 0)
            cout << "YES\n";
        else if(n % 2 != 0 && k % 2 != 0)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k == 1) {
            cout << "YES\n";
            continue;
        }
//        if(n / 2 > k) {
//            cout << "NO\n";
//            continue;
//        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
//        else if(n % 2 != 0 && k % 2 == 0)
//            cout << "NO\n";
        else
            cout << "YES\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    long long t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k * k > n) {
            cout << "NO\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else
            cout << "YES\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    unsigned long long t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k == 1 && n % 2 != 0) {
            cout << "YES\n";
            continue;
        }
        if(k == 2 && n % 2 == 0) {
            cout << "YES\n";
            continue;
        }
        if(n < (k * k)) {
            cout << "NO\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else if(n % 2 == 0 && k % 2 == 0)
            cout << "YES\n";
        else if(n % 2 != 0 && k % 2 != 0)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

//        if(k == 1) {
//            cout << "YES\n";
//            continue;
//        }
        if(n > (k * k)) {
            cout << "NO\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else
            cout << "YES\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    unsigned long long t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k == 1 && n % 2 != 0) {
            cout << "YES\n";
            continue;
        }
        if(k == 2 && n % 2 == 0) {
            cout << "YES\n";
            continue;
        }
        if(sqrt(n) < k) {
            cout << "NO\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else if(n % 2 == 0 && k % 2 == 0)
            cout << "YES\n";
        else if(n % 2 != 0 && k % 2 != 0)
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;

        if(k == 1) {
            cout << "YES\n";
            continue;
        }
        if(n % 2 == 0 && k % 2 != 0)
            cout << "NO\n";
        else if(n % 2 != 0 && k % 2 == 0)
            cout << "NO\n";
        else
            cout << "YES\n";
    }

    return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    int n,k;
    cin>>n>>k;
    if(n%k==0)
    {
      cout<<"YES"<<endl;
    }
    else
    {
      cout<<"NO"<<endl;
    }
  }
  return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    int n,k;
    cin>>n>>k;
    if((n+k)%2==0)
    cout << "YES"<<endl;
    else cout << "NO"<<endl;
  }

  return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    int n,k;
    cin>>n>>k;
    if(k*k<=n && (n+k)%2==0)
    cout << "YES"<<endl;
    else cout << "NO"<<endl;
  }

  return 0;
}


#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;

if((n%2==0)&&(k%2==0))
{
cout<<"YES"<<endl;
}
else if((n%2==1)&&(k%2==1))
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
}
return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    long long int n,k;
    cin>>n>>k;

    if(k*k<=n&&(n+k)%2==0)
    cout << "YES"<<endl;
    else cout << "NO"<<endl;
  }

  return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    int n,k;
    cin>>n>>k;

     if(n%2==k%2)cout <<"YES"<<endl;
     else cout<<"NO"<<endl;
  }
  return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    int n,k;
    cin>>n>>k;

    if(n<k)
    cout<<"NO"<<endl;
    else if(n==k)cout<<"YES"<<endl;
    else{
      n = n - k;
      if(n%2==0)cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    }

  }
  return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n<k)
		{
			cout<<"NO"<<endl;
		}
		 else if(n%2==k%2)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		 if((n>=k)&&(n%2==k%2))
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    int n,k;
    cin>>n>>k;

     if(n==k)cout<<"YES"<<endl;
     else{
      n = n - k;
      if(n%2==0)cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    }

  }
  return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    int n,k,vf;
    cin>>n>>k;
    vf = n / k;
    int vs = n % k;

    if((vf%2)+(vs%2) == 1 && n >= k)
    cout << "YES"<<endl;
    else cout << "NO"<<endl;
  }

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		if(n%2==k%2 && n*n > k)
		{
			cout<<"yes"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		if(n%2==k%2 && k*k <= n)
		{
			cout<<"yes"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%2==k%2 && n*n > k)
		{
			cout<<"yes"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%2!=k%2 && n*n > k)
		{
			cout<<"yes"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%2==0&&k%2==0)
		{
			cout<<"yes"<<endl;
		}
		else if(n%2!=0 && k%2!=0)
		{
			cout<<"yes"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%2==0 && k%2==0)
		{
			cout<<"yes"<<endl;
		}
		else if(n%2!=0 && k%2!=0)
		{
			cout<<"yes"<<endl;
		}
		else if(n==2)
		{
			cout<<"no"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%k==0)
		cout<<"yes"<<endl;
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%2==0 && k%2==0)
		{
			cout<<"yes"<<endl;
		}
		else if(n%2!=0 && k%2!=0)
		{
			cout<<"yes"<<endl;
		}
		else if(n%k!=0)
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		if(n%2==k%2 && k*k>n)
		{
			cout<<"yes"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%k==0 && n > k)
		cout<<"yes"<<endl;
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		if(n%2==k%2 && k*k < n)
		{
			cout<<"yes"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%2==0 && k%2==0)
		{
			cout<<"yes"<<endl;
		}
		else if(n%2!=0 && k%2!=0)
		{
			cout<<"yes"<<endl;
		}
		else if(n%k!=0)
		{
			cout<<"no"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100000];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k;
		cin>>n>>k;
		if(n%2==0 && k%2==0)
		{
			cout<<"yes"<<endl;
		}
		else if(n%2!=0 && k%2!=0)
		{
			cout<<"yes"<<endl;
		}
		else
		{
			cout<<"no"<<endl;
		}

	}

}


#include<bits/stdc++.h>
using namespace std;

int main(){

	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		if(n%2==1 && k%2==0) cout<<"NO"<<endl;
		else if(n%2==0 && k%2==1) cout<<"NO"<<endl;
		 else{
		 	unsigned long long int k_=k*k;

		 	if(k_>n) cout<<"NO"<<endl;
		 	else cout<<"YES"<<endl;

		 }

	}

return 0;

}


    #include<bits/stdc++.h>
    using namespace std;

    int main(){

    	int t;
    	cin>>t;
    	while(t--){
    		int n,k;
    		cin>>n>>k;

    		if(n%2==1 && k%2==0) cout<<"NO"<<endl;
    		else if(n%2==0 && k%2==1) cout<<"NO"<<endl;
    		 else{

    		 	int diff=n-k*k;

    		 	if(k*k>n) cout<<"NO"<<endl;

    		 	else if(diff%2==0) cout<<"YES"<<endl;
    		 	else cout<<"NO"<<endl;

    		 }

    	}

    return 0;

    }


#include<bits/stdc++.h>
using namespace std;

int main(){

	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		if(n%2==1 && k%2==0) cout<<"NO"<<endl;
		else if(n%2==0 && k%2==1) cout<<"NO"<<endl;
		 else{
		 	if(k*k>n) cout<<"NO"<<endl;
		 	else cout<<"YES"<<endl;

		 }

	}

return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main(){

	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		if(n%2==0 && k%2==0 && k<=n) cout<<"YES"<<endl;
		else if(n%2==1 && k%2==1 && k<=n) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;

	}

return 0;

}


    #include<bits/stdc++.h>
    using namespace std;

    int main(){

    	int t;
    	cin>>t;
    	while(t--){
    		int n,k;
    		cin>>n>>k;

    		if(n%2==1 && k%2==0) cout<<"NO"<<endl;
    		else if(n%2==0 && k%2==1) cout<<"NO"<<endl;
    		 else{

                    int n_=sqrt(n);
                    if(n_<k){
                        cout<<"NO"<<endl;
                        continue;
                    }
    		 	int diff=n-k*k;

    		 //	if(k*k>n) cout<<"NO"<<endl;

    		 	 if(diff%2==0) cout<<"YES"<<endl;
    		 	else cout<<"NO"<<endl;

    		 }

    	}

    return 0;

    }


#include<bits/stdc++.h>
using namespace std;

int main(){

	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		 	int diff=n-k*k;

		 	if(k*k>n) cout<<"NO"<<endl;

		 	else if(diff%2==0) cout<<"YES"<<endl;
		 	else cout<<"NO"<<endl;

	}

return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main(){

	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		if(n%2==1 && k%2==0) cout<<"NO"<<endl;
		else if(n%2==0 && k%2==1) cout<<"NO"<<endl;
		 else{
		 	 int n_= sqrt(n);

		 	if(k>n_) cout<<"NO"<<endl;
		 	else cout<<"YES"<<endl;

		 }

	}

return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main(){

	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		if(n%2==1 && k%2==0) cout<<"NO"<<endl;
		else if(n%2==0 && k%2==1) cout<<"NO"<<endl;
		 else{
		 	long long int k_=k*k;

		 	if(k_>n) cout<<"NO"<<endl;
		 	else cout<<"YES"<<endl;

		 }

	}

return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main(){

	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		if(n%2==1 && k%2==0) cout<<"NO"<<endl;
		else if(n%2==0 && k%2==1) cout<<"NO"<<endl;
		 else{

		 	int diff=n-k*k;

		 	if(k*k>n) cout<<"NO"<<endl;

		 	else if(diff%2==0) cout<<"YES"<<endl;
		 	else cout<<"NO"<<endl;

		 }

	}

return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main(){

	int t;
	cin>>t;
	while(t--){
		int n,k;
		cin>>n>>k;

		if(n%k==0) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;

	}

return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main(){
    ll t ; cin >> t ;

    while(t--)
    {
        ll n , k ;
        cin >> n >> k ;

        ll f= 1 ;
        ll l = 2*(k-1) + f ;

        ll sum =  (long long) k * (f + l) / 2;

        if ( l <=n and n%2== k%2 )
            cout << "YES\n";
        else
            cout <<"NO\n";

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n%k !=0 or k>n )
            cout <<"NO\n";
        else
            cout << "YES\n" ;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n%2 == k%2 and k*k <=n )
            cout<< "YES\n";
        else
            cout <<"NO\n";

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main(){
    ll t ; cin >> t ;

    while(t--)
    {
        ll n , k ;
        cin >> n >> k ;

            ll f= 1 ;
            ll l = 2*(k-1) + f ;

            ll sum =  (long long) k * (f + l) / 2;

            if (sum <=n and n%2== k%2 )
                cout << "YES\n";
            else
                cout <<"NO\n";

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n== k and n==1 )
            cout<<"YES\n" ;
        else if( n <= k )
            cout <<"NO\n";
        if( n%2 !=0 and k%2 == 0 )
            cout<< "NO\n";
        else if( n%2 == 0 and k%2 !=0 )
            cout<<"NO\n";
        else
            cout << "YES\n" ;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n== k and n==1 )
            cout<<"YES\n" ;

        else if( n%2 !=0 and k%2 != 0 and n >= k )
            cout<< "YES\n";
        else if( n%2 == 0 and k%2 ==0 and n >= k )
            cout<<"YES\n";
        else
            cout << "NO\n" ;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n== k and n==1 )
            cout<<"YES\n" ;

        else if( n%2 !=0 and k%2 != 0 and k*k <=n )
            cout<< "YES\n";
        else if( n%2 == 0 and k%2 ==0 and k*k <= n )
            cout<<"YES\n";
        else
        {
            int f= 1 ;
            int l = 2*(k-1) + f ;

            int sum = (f+l)*k ;
            sum /= 2 ;

            if (sum==n)
                cout << "YES\n";
            else
                cout <<"NO\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n%2 !=0 and k%2 == 0 )
            cout<< "NO\n";
        else if( n%2 == 0 and k%2 !=0 )
            cout<<"NO\n";
        else
            cout << "YES\n" ;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n%2==0 and k%2 == 0 )
            cout<< "YES\n";
        else if( n%2 != 0 and k%2 !=0 )
            cout<<"YES\n";
        else
            cout << "NO\n" ;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n%2 !=0 and k%2 != 0 and k*k <=n )
            cout<< "YES\n";
        else if( n%2 == 0 and k%2 ==0 and k*k <= n )
            cout<<"YES\n";
        else
        {
            cout <<"NO\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n== k and n==1 )
            cout<<"YES\n" ;

        else if( n%2 !=0 and k%2 != 0 and n >= k )
            cout<< "YES\n";
        else if( n%2 == 0 and k%2 ==0 and n >= k )
            cout<<"YES\n";
        else
        {
            int f= 1 ;
            int l = 2*(k-1) + f ;

            int sum = (f+l)*10 ;
            sum /= 2 ;

            if (sum==n)
                cout << "YES\n";
            else
                cout <<"NO\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;

        if( n== k and n==1 )
            cout<<"YES\n" ;

        else if( n%2 !=0 and k%2 != 0 and n > k )
            cout<< "YES\n";
        else if( n%2 == 0 and k%2 ==0 and n > k )
            cout<<"YES\n";
        else
            cout << "NO\n" ;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main(){
    ll t ; cin >> t ;

    while(t--)
    {
        ll n , k ;
        cin >> n >> k ;

        if( n== k and n==1 )
            cout<<"YES\n" ;

        else if( n%2 !=0 and k%2 != 0 )
            cout<< "YES\n";
        else if( n%2 == 0 and k%2 ==0 )
            cout<<"YES\n";
        else
        {
            ll f= 1 ;
            ll l = 2*(k-1) + f ;

            ll sum = (f+l)*k ;
            sum /= 2 ;

            if (sum==n)
                cout << "YES\n";
            else
                cout <<"NO\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long int

int main(){
    ll t ; cin >> t ;

    while(t--)
    {
        ll n , k ;
        cin >> n >> k ;

        ll fucking_programming = k*k ;

        if( n%2 == k%2 and fucking_programming <= n )
            cout<< "YES\n";
        else
            cout <<"NO\n";

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int t ; cin >> t ;

    while(t--)
    {
        int n , k ;
        cin >> n >> k ;
        if( k > n )
            cout << "NO\n";
        else if( k<= n )
        {
            if( n%2==0 and k%2 == 0 )
                cout<< "YES\n";
            else if( n%2 != 0 and k%2 !=0 )
                cout<<"YES\n";
            else
                cout << "NO\n" ;
        }
    }
    return 0;
}


#include<iostream>
#include<string>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll test, temp, int1, int2, i = 0, diff;
	cin >> test;
	temp = test;
	string output[100005];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		diff = int1 - int2;
		if(diff <= 0)
		output[i] = "NO";
		if(int1 == 1 && int2 == 1)
		output[i] = "YES";
		else
		output[i] = (diff%2 == 0)?"YES":"NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#include<math.h>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll test, temp, int1, int2, i = 0, diff;
	cin >> test;
	temp = test;
	string output[100005];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		diff = int1 - int2;
		if(diff%2 == 0 && int2 <= sqrt(int1))
		output[i] = "YES";
		else output[i] = "NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll test, temp, int1, int2, i = 0, diff;
	cin >> test;
	temp = test;
	string output[100005];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		diff = int1 - int2;
		if(diff%2 == 0 && int1 >= int2 && int1 >= (int2*int2) && diff != 0)
		output[i] = "YES";
		else output[i] = "NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll test, temp, int1, int2, i = 0;
	cin >> test;
	temp = test;
	string output[100005];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		if(int1 <= int2)
		output[i] = "NO";
		else
		output[i] = ((int1 - int2)%2 == 0)?"YES":"NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll test, temp, int1, int2, i = 0, diff;
	cin >> test;
	temp = test;
	string output[100005];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		diff = int1 - int2;
		if(diff <= 0)
		output[i] = "NO";
		else
		output[i] = (diff%2 == 0)?"YES":"NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#define ll long long
using namespace std;
int main()
{
	ll test, temp, int1, int2, i = 0;
	cin >> test;
	temp = test;
	string output[test];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		if(int1 == 1 && int2 == 1)
		output[i] = "NO";
		else if(int1 < int2)
		output[i] = "NO";
		else
		output[i] = ((int1 - int2)%2 == 0)?"YES":"NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#include<math.h>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll test, temp, int1, int2, i = 0, diff;
	cin >> test;
	temp = test;
	string output[100005];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		diff = int1 - int2;
		if(diff%2 == 0 && int1 >= int2 && int2 <= sqrt(int1) && diff != 0)
		output[i] = "YES";
		else output[i] = "NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#define ll long long
using namespace std;
int main()
{
	ll test, temp, int1, int2, i = 0;
	cin >> test;
	temp = test;
	string output[test];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		output[i] = (abs(int1 - int2)%2 == 0)?"YES":"NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#include<math.h>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll test, temp, int1, int2, i = 0, diff;
	cin >> test;
	temp = test;
	string output[100005];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		diff = int1 - int2;
		if(int1 == 1 && int2 == 1)
		output[i] == "YES";
		else if(diff%2 == 0 && int1 >= int2 && int2 <= sqrt(int1) && diff != 0)
		output[i] = "YES";
		else output[i] = "NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#include<math.h>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll test, temp, int1, int2, i = 0, diff;
	cin >> test;
	temp = test;
	string output[100005];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		diff = int1 - int2;
		if(int1 == 1 && int2 == 1)
		output[i] == "YES";
		else if(diff%2 == 0 && int2 <= sqrt(int1))
		output[i] = "YES";
		else output[i] = "NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include<iostream>
#include<string>
#define ll long long
using namespace std;
int main()
{
	ll test, temp, int1, int2, i = 0;
	cin >> test;
	temp = test;
	string output[test];
	while(temp--)
	{
		cin >> int1;
		cin >> int2;
		if(int1 < int2)
		output[i] = "NO";
		else if(int1 == int2)
		output[i] = "NO";
		else
		output[i] = ((int1 - int2)%2 == 0)?"YES":"NO";
		i++;
	}
	for(i = 0;i<test; i++)
	cout << output[i] << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long t,a,b,l,sum;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		if(a==1&&b==1){cout<<"YES"<<endl;continue;}
		if(a%2==b%2&&a-1>=(b-1)*(b+1))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}
/*#include <bits/stdc++.h>
using namespace std;

long long t,a,b,l,sum;
int main(){
	cin>>t;
	while(t--){l=3;sum=0;
		cin>>a>>b;
		if(a==1&&b==1){cout<<"YES"<<endl;continue;}
		if(a/2<b){cout<<"NO"<<endl;continue;}
		if(a%2==1&&b==1){cout<<"YES"<<endl;continue;}
		if(a%2!=b%2){cout<<"NO"<<endl;continue;}
		if(a==2){cout<<"NO"<<endl;continue;}
		if(a%2==0){a--;b--;}
		if(a%2==1&&b==1){cout<<"YES"<<endl;continue;}
		if(b%2==0){cout<<"NO"<<endl;continue;}
		if(a<=13){cout<<"NO"<<endl;continue;}
		while(b--&&a>sum){
			sum+=l;l+=2;
		}
		if(b==0&&sum==a){cout<<"YES"<<endl;continue;}
		if(b>=0){cout<<"NO"<<endl;continue;}
		if(b==-1&&sum==a){cout<<"YES"<<endl;continue;}
		if(b!=-1&&sum==a){cout<<"NO"<<endl;continue;}
		if(a<sum){cout<<"NO"<<endl;continue;}
		if(a>sum&&b==-1){cout<<"YES"<<endl;continue;}
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

long long t,a,b,l,sum;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		if(a%2==b%2&&a>=b*(b+2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

a=25
b=-1
l=13
sum=35

99 99

16 4

15 3
b=0
a=35
sum=35
l=13

10+20+20+30+19
15 15,3+5+7
17 17,3+5+9
19 19,3+7+9,3+5+11,
21 7+3+11
23
25
27
29
31
33
35 3+5+7+9+11
37
39
41
43
45
47
49
51
53
*/


#include <bits/stdc++.h>
using namespace std;
long long t,a,b,l,ans,o,oo;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		if(a%2==0){a--;b--;}
		if(b%2==0){cout<<"NO"<<endl;continue;}
		if(a/b%2==1)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long t,a,b,l,sum;
int main(){
	cin>>t;
	while(t--){l=3;sum=0;
		cin>>a>>b;
		while(b--){
			sum+=l;l+=2;
		}
		if(a<sum)cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long t,a,b,l,ans,o,oo;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		if(a%2==0){a--;b--;}
		if(b%2==0){cout<<"NO"<<endl;continue;}
		if(a%3==0&&a%3%4==0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long t,a,b,l,ans,o,oo;
int main(){
	cin>>t;
	while(t--){l=3;
		cin>>a>>b;
		if(a%2==0){a--;b--;}
		if(a/2<b){cout<<"NO"<<endl;continue;}
		if(b%2==0){cout<<"NO"<<endl;continue;}
		if(b==1){cout<<"YES"<<endl;continue;}
		if(a%b==0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

long long t,a,b,l,sum;
int main(){
	cin>>t;
	while(t--){l=3;sum=0;
		cin>>a>>b;
		if(a%2==0){a--;b--;}
		if(b==1){cout<<"YES"<<endl;continue;}
		if(b%2==0){cout<<"NO"<<endl;continue;}
		if(a<=13){cout<<"NO"<<endl;}
		while(b--){
			sum+=l;l+=2;
		}
		if(a<sum)cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
	}
	return 0;
}