akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int D, M=26;
  cin >> D;
  vector<long long> c(M);
  for(int i=0; i<M; i++){
    cin >> c[i];
  }
  vector<vector<long long>> s(D,vector<long long>(M));
  for(int i=0; i<D; i++){
    for(int j=0; j<M; j++){
      cin >> s[i][j];
    }
  }
  long long la,onelos=0;
  for(int j=0; j<M; j++){
    onelos += c[j];
  }
  long long num = 2000;
  vector<long long> sat(num,0), los(num,0), nlos(num,0);
  vector<pair<long long, long long>> tmpsat(num*M);
  vector<vector<long long>> last(num,vector<long long>(M,-1)), nlast(num,vector<long long>(M,-1));
  vector<vector<long long>> t(num,vector<long long>(D)), nt(num,vector<long long>(D));
  for(int i=0; i<D; i++){
    for(int j=0; j<num; j++){
      for(int k=0; k<M; k++){
        la = (long long)i - last[j][k];
    	tmpsat[j*M+k].first = sat[j] + s[i][k] - los[j] - onelos + la*c[k];
        tmpsat[j*M+k].second = j*M+k;
      }
    }
    sort(tmpsat.begin(), tmpsat.end(), greater());
    for(int j=0; j<num; j++){
      sat[j] = tmpsat[j].first;
      long long ty = tmpsat[j].second%M;
      long long prenum = tmpsat[j].second/M;
      nlast[j] = last[prenum];
      nlast[j][ty] = (long long)i;
      nlos[j] = los[prenum] + onelos - ((long long)i - last[prenum][ty])*c[ty];
      nt[j] = t[prenum];
      nt[j][i] = ty;
    }
    for(int j=0; j<num; j++){
      last[j] = nlast[j]; los[j] = nlos[j]; t[j] = nt[j];
    }
  }
  //cout << sat[0] << endl;
  for(int i=0; i<D; i++){
    cout << t[0][i]+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 16632
#include <bits/stdc++.h>
#include <math.h>


    using namespace std;
    typedef long long ll;
    # define M_PI  3.14159265358979323846
    const int MOD=1e9+7;

    void solve(){
        int n,k;
        cin>>n>>k;
        vector<int>a(n+1);
        for(int i=1;i<=n;i++)
            cin>>a[i];
        int dp[n+1][k+1];
        dp[0][0]=1;
        for(int i=1;i<=k;i++)
            dp[0][i]=0;
        for(int i=1;i<=n;i++){
            vector<int>sum(k+1);
            sum[0]=dp[i-1][0];
            for(int j=1;j<=k;j++)
                sum[j]=(sum[j-1]+dp[i-1][j])%MOD;
            for(int j=0;j<=k;j++){
                if(j<=a[i])
                    dp[i][j]=sum[j];
                else{
                    int non_existing=j-a[i]-1;
                    dp[i][j]=(sum[j]-sum[non_existing]+MOD)%MOD;
                }
            }
            sum.clear();
        }
//        for(int i=0;i<=n;i++){
//            for(int j=0;j<=k;j++)
//                cout<<dp[i][j]<<" ";
//            cout<<"\n";
//        }
        cout<<dp[n][k];
    }

    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


Measured memory_bytes: 40056
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
    for(int h, w = 5, res; cin >> h, h; cout << res << endl){
        res = 0;

        vvi m(h, vi(w));
        rep(y, h) rep(x, w) cin >> m[y][x + 1];

        int diff;
        do{
            diff = 0;
            
            rep(y, h) rep(x, w + 2){
                if(m[y][x] == 0)
                    continue;

                int cnt = 0, color = m[y][x];
                rep(i, w){
                    if(m[y][x + i] != color) break;
                    cnt++;
                }

                if(cnt < 3) continue;

                diff += cnt * color;
                rep(i, cnt){
                    m[y][x + i] = 0;
                }
            }

            for(int y = h - 1; 0 <= y; y--){
                rep(x, w + 2){
                    if(m[y][x] != 0) continue;

                    rep(i, h){
                        if(y - i < 0) break;
                        if(m[y - i][x] != 0){
                            m[y][x] = m[y - i][x];
                            m[y - i][x] = 0;
                            break;
                        }
                    }
                }
            }

            res += diff;
        } while(diff != 0);
    }

	return 0;
}

Measured memory_bytes: 1220
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

struct edge {
    int dst;
    int cost[2];
};

int n;
vector<vector<edge>> g;

vector<long> d1, d2;

void dijkstra(int s, int c, vector<long> &d) {
    d.assign(n, MAX_LONG);
    d[s] = 0;
    set<pair<long, int>> pq;
    pq.insert({0, s});
    while (pq.size() > 0) {
        auto p = *(pq.begin());
        pq.erase(p);
        int v = p.second;
        for (auto &e : g[v]) {
            long dd = d[v] + e.cost[c];
            int u = e.dst;
            if (d[u] > dd) {
                pq.erase({d[u], u});
                d[u] = dd;
                pq.insert({d[u], u});
            }
        }
    }
}

int main() {
    std::ios::sync_with_stdio(false);

    int m, s, t;
    cin >> n >> m >> s >> t;
    s--;
    t--;
    g.resize(n);
    for (int i = 0; i < m; i++) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--;
        v--;
        edge e;
        e.dst = v;
        e.cost[0] = a;
        e.cost[1] = b;
        g[u].push_back(e);
        e.dst = u;
        g[v].push_back(e);
    }

    dijkstra(s, 0, d1);
    dijkstra(t, 1, d2);

    vector<long> d(n);
    for (int i = 0; i < n; i++) {
        d[i] = d1[i] + d2[i];
    }
    for (int i = n - 2; i >= 0; i--) {
        d[i] = std::min(d[i], d[i + 1]);
    }
    for (int i = 0; i < n; i++) {
        cout << 1000000000000000ll - d[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll; 


int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	
	ll A,B;
	cin>>A>>B;
	
	cout<<max(A+B,max(A-B,A*B));
	
	
	
	
}


Measured memory_bytes: 256
while true
  n = gets.to_i
  break if n==0

  x = 2  
  ptn = 0
  while x<n
    if (2*n)%x == 0
      y = (2*n)/x
      k2 = y-x+1
      ptn += 1 if k2>0 && k2%2==0
    end
    x += 1
  end

  puts ptn
end

Measured memory_bytes: 8572
#include<cmath>
#include<cstdio>

using namespace std;

int main(){
	int a[31],b[31];
	a[0]=0,a[1]=1;
	for(int i=2;i<=30;i++){
		if(i%2==0)	b[i]=2*(int)pow(3.0,i/2-1);
		else		b[i]=4*(int)pow(3.0,i/2-1);
		a[i]=a[i-2]+b[i];
	}

	for(int n;~scanf("%d",&n);)	printf("%d\n",a[n]);

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <functional>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(var,init,end) for(int var=init;var<end;var++)
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
int pow(int a, int b) {
	int ret = 1;
	int cnt = 0;
	while (cnt < b) {
		cnt++;
		ret = ret * a;
	}
	return ret;
}

int main() {
	int D, N;
	cin >> D >> N;

	if (N == 100) {
		N+=1;
	}
	cout << pow(100, D)*N;

	return 0;
} 

Measured memory_bytes: 768
from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [list(input()) for _ in range(H)]

visited = [[-1] * W for _ in range(H)]

que = deque([(Ch-1, Cw-1, 0)])
move = ((1, 0), (-1, 0), (0, 1), (0, -1))
while que:
    ci, cj, d = que.popleft()

    if visited[ci][cj] != -1:
        continue
    visited[ci][cj] = d

    for di, dj in move:
        ni, nj = ci + di, cj + dj
        if not (0 <= ni < H and 0 <= nj < W) or visited[ni][nj] != -1:
            continue
        if S[ni][nj] == '.':
            que.appendleft((ni, nj, d))

    for di in range(-2, 3):
        for dj in range(-2, 3):
            ni, nj = ci+di, cj+dj
            if not (0 <= ni < H and 0 <= nj < W)  \
                    or visited[ni][nj] != -1:
                continue
            if S[ni][nj] == '.':
                que.append((ni, nj, d+1))
    # print(visited)
    # exit()

if visited[Dh-1][Dw-1] == -1:
    print(-1)
else:
    print(visited[Dh-1][Dw-1])


Measured memory_bytes: 246524
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<n;++i)
#define FOR(i,j,k) for(int i=j;i>=k;--i)

using ll = long long;
using namespace std;

const ll INF = 1010101010;
const ll MOD = 1000000007;

int main() {
	static ll n, m, A[1010101], B[1010101];
	rep(i, 3) cin >> A[i];
	sort(A, A + 3);
	n = abs(A[2] - A[1]) + abs(A[1] - A[0]);
	m = abs(A[0] - A[1]) + abs(A[1] - A[2]);
	cout << min(n, m) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  string s;
  cin >> s;
  
  int sl = s.size();
  string st = "";
  rep(i, sl) {
    if(s[i] == '0') st.push_back('0');
    if(s[i] == '1') st.push_back('1');
    if(s[i] == 'B') {
      if(st.size() == 0) continue;
      else {
        st.pop_back();
      }
    }
  }
  
  cout << st << endl;
  return 0;
}

Measured memory_bytes: 3608
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double[] f = new double[N];
		for (int i = 0; i < f.length; i++)
			f[i] = sc.nextDouble();
		Arrays.sort(f);
		double[] nf = new double[N - 1];
		nf[0] = (f[0] + f[1]) / 2;
		for (int i = 2; i < f.length; i++) {
			nf[i - 1] = (nf[i - 2] + f[i]) / 2;
		}
		System.out.println(String.format("%.5f", nf[nf.length - 1]));
		sc.close();
	}
}

Measured memory_bytes: 24404
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int k,x,y,z;
ll a[1004],b[1004],c[1004];
vector <ll> v,ans;
int main(){
	cin>>x>>y>>z>>k;
	for (int i=0;i<x;i++) cin>>a[i];
	for (int i=0;i<y;i++) cin>>b[i];
	for (int i=0;i<z;i++) cin>>c[i];
	for (int i=0;i<x;i++)
		for (int j=0;j<y;j++)
			v.push_back(a[i]+b[j]);
	sort (v.begin(),v.end());
	for (int i=v.size()-1,j=0;j<3000&&i>=0;j++,i--)
		for (int j=0;j<z;j++)
			ans.push_back(v[i]+c[j]); 
	sort (ans.begin(),ans.end());
	for (int i=ans.size()-1,j=0;j<k;j++,i--)
		printf("%lld\n",ans[i]);
}

Measured memory_bytes: 43364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P, P> PP;
constexpr ll MOD = ll(1e9 + 7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll V, E, G[105][105];
    cin >> V >> E;
    for(int i=0;i<V;i++){
        fill(G[i], G[i]+V, LLINF/3);
    }
    for(int i=0;i<V;i++){
        G[i][i] = 0;
    }
    for(int i=0;i<E;i++){
        ll u, v, d;
        cin >> u >> v >> d;
        G[u][v] = d;
    }
    bool neg = false;
    for(int t=0;t<10;t++){
        for(int k=0;k<V;k++){
            for(int i=0;i<V;i++){
                for(int j=0;j<V;j++){
                    if(G[i][k] == LLINF/3 || G[k][j] == LLINF/3) continue;
                    if(t>0 && G[i][j] > G[i][k]+G[k][j]){
                        neg = true;
                    }
                    G[i][j] = min(G[i][j], G[i][k]+G[k][j]);
                }
            }
        }
    }
    for(int i=0;i<V;i++){
        if(G[i][i] < 0) neg = true;
    }
    if(neg){
        cout << "NEGATIVE CYCLE" << endl;
    }
    else{
        for(int i=0;i<V;i++){
            for(int j=0;j<V;j++){
                if(G[i][j] < LLINF/3){
                    cout << G[i][j];
                }
                else{
                    cout << "INF";
                }
                cout << " \n"[j==V-1];
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3164
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int h,w,n;
	cin >> n >> h >> w;
	cout << ((n-h+1)*(n-w+1)) << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long sum = 0;
		for(int i=0;i<n;i++) {
			sum += in.nextLong();
		}
		System.out.println(sum-n);

	}
}

Measured memory_bytes: 25572
#include<iostream>
using namespace std;
int main()
{
	int n,c=0;
	cin>>n;
	int a[n];
	for(int i=1;i<=n;i++)
	cin>>a[i];
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			for(int k=j+1;k<=n;k++)
			{
				if(a[i]!=a[j] && a[j]!=a[k] && a[k]!=a[i])
				{
					if(a[i]+a[j]>a[k] && a[j]+a[k]>a[i] && a[k]+a[i]>a[j])
					c++; 
				}
			}
		}
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 3616
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int n=0;
for(int x=a;x<=b;x++){
 if(c%x==0)n++;}System.out.println(n);
}}

Measured memory_bytes: 26356
long s,f,c[101][101],n;i;main(j){for(scanf(f="%ld\n",&n);i++<n;)for(j=0;j++<n;j<i?s+=fmin(c[i][j],c[j][i]):s)scanf(f,c[i]+j);n=!printf(f,s);}

Measured memory_bytes: 688
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

const mod = 998244353

func mpow(a, b int) int {
	if b == 0 {
		return 1
	} else if b%2 == 0 {
		tmp := mpow(a, b/2)
		return tmp * tmp % mod
	}
	return mpow(a, b-1) * a % mod
}

var fracMemo = []int{1, 1}

func mfrac(n int) int {
	if len(fracMemo) > n {
		return fracMemo[n]
	}
	if len(fracMemo) == 0 {
		fracMemo = append(fracMemo, 1)
	}
	for len(fracMemo) <= n {
		size := len(fracMemo)
		fracMemo = append(fracMemo, fracMemo[size-1]*size%mod)
	}
	return fracMemo[n]
}

var ifracMemo = []int{1, 1}

func mifrac(n int) int {
	if len(ifracMemo) > n {
		return ifracMemo[n]
	}
	if len(ifracMemo) == 0 {
		fracMemo = append(ifracMemo, 1)
	}
	for len(ifracMemo) <= n {
		size := len(ifracMemo)
		ifracMemo = append(ifracMemo, ifracMemo[size-1]*mpow(size, mod-2)%mod)
	}
	return ifracMemo[n]
}

func nCr(n, r int) int {
	if n == r {
		return 1
	}
	if n < r || r < 0 {
		return 0
	}
	ret := 1
	ret *= mfrac(n)
	ret %= mod
	ret *= mifrac(r)
	ret %= mod
	ret *= mifrac(n - r)
	ret %= mod
	return (ret)
}

func nHr(n, r int) int {
	return nCr(n+r-1, r)
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	d := make(map[int]int)
	for i := 0; i < N; i++ {
		x := getInt()
		if i == 0 && x != 0 {
			out(0)
			return
		}
		d[x]++
	}

	if d[0] != 1 {
		out(0)
		return
	}
	cnt := 0
	for i := 0; i < N; i++ {
		if d[i] == 0 {
			break
		}
		cnt += d[i]
	}
	if cnt != N {
		out(0)
		return
	}

	ans := 1
	for i := 1; i < N; i++ {
		y := d[i-1]
		x := d[i]
		if x == 0 {
			break
		}
		// out(y, x, mpow(y, x))
		ans *= mpow(y, x)
		ans %= mod
	}
	out(ans)
}


Measured memory_bytes: 6784
#include <iostream>
#include <string>
#include <vector>

#include <cstdio>
#include <cmath>


using namespace std;

int main(){
  long long L, R;
  cin >> L >> R;

  long long n = R / 2019;
  long long modulo = 2019;
  if(L <= 2019 *n){
    modulo = 0;
  }else{
    for(long long i = L; i < R; i++){
      long long I = i % 2019;
      for(long long j = i+1; j <= R; j++){
        long long J = j % 2019;
        long long K = (I*J) % 2019;
        if(modulo > K){
          modulo = K;
        }

      }
    }
  }
    cout << modulo << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;

int main(void){
	int n,h;
	int pt=0,t=0;

	cin>>n;

	for(int i=0;i<n;i++){
		cin>>h;
		if(t<h)pt+=h-t;
		t=h;
	}

	cout<<pt<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,K,ans=0;
  string S;
  cin>>N>>K>>S;
  
  S+="!";
  vector<ll> L;
  if(S[0]=='0') L.PB(0);
  
  ll cnt=1;
  REP(i,(ll)S.size()-1){
    if(S[i+1]==S[i]) cnt++;
    else{
      L.PB(cnt);
      cnt=1;
    }
  }
  
  REP(i,201010) L.PB(0);
  ll count=0;
  for(int i=0; i<=2*K; ++i) count+=L[i];
  chmax(ans,count);
  for(int i=2*K+1; i<=N+4; i+=2){
    chmax(ans,count);
    count-=L[i-2*K-1]+L[i-2*K];
    count+=L[i]+L[i+1];
  }
  
  co(ans);
  return 0;
}

Measured memory_bytes: 7596
/*************************************************************************
	> File Name: 1.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/7/15 15:35:33
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
const LL maxx=1e9;
LL a,b,c,d;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	LL n;
	scanf("%lld",&n);
	if(n<=maxx) printf("0 0 %lld 0 0 1\n",n);
	else{
		a=d=sqrt(n);
		if(a*d<n) a++;
		if(a*d<n) d++;
		LL x=a*d-n;
		if(x<=maxx) b=1,c=x;
		else{
			for(LL i=x/maxx;i<=sqrt(x);++i)
				if(x%i==0 && x/i<=maxx){
					b=i;  c=x/i;
					break;
				}
		}		
		printf("0 0 %lld %lld %lld %lld",a,b,c,d);
	}	
	return 0;
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>

//macro
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, n, m) for(int i = m; i < n; ++i)
#define LL long long

using namespace std;

typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;

int main(){
    LL x;
    LL ans;

    cin >> x;

    ans = (x / 11) * 2;
    if(x % 11 <= 6 && x % 11 != 0){
        ans += 1;
    }else if(x % 11 >= 7 && x % 11 != 0){
        ans += 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << -1; return;}
#define yes {cout << "Yes"; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

void solve() {
    int n; cin >> n;
    cout << (n + 999) / 1000 * 1000 - n;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3644
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

int N,Q;
vector<vi> V;

signed main(){

    in(N,Q);
    V.resize(N);
    int a,t,x;
    while(Q--){
        in(a);
        if(a==0){
            in(t,x);
            V[t].pb(x);
        }else if(a==1){
            in(t);
            for(auto itr=V[t].begin();itr!=V[t].end();itr++){
                cout<<*itr;
                if(itr+1!=V[t].end()){
                    cout<<" ";
                }
            }
            cout<<endl;
        }else{
            in(t);
            V[t].clear();
        }
    }

    return 0;
}



Measured memory_bytes: 8976
n,x = map(int,input().split())
lst = [int(i) for i in input().split()]

cnt = 0

if lst[0] > x:
    cnt += lst[0]-x
    lst[0] = x

for i in range(n-1):
    dis = 0
    if lst[i]+lst[i+1] > x:
        dis = lst[i] + lst[i+1] - x
        lst[i+1] -= dis
        cnt += dis

print(cnt)

Measured memory_bytes: 14152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
ll n,a[N],b[N],flg,sum,m=(1e17);
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>a[i]>>b[i];
        if(a[i]!=b[i])flg=1;
        sum+=a[i];
        if(a[i]>b[i])m=min(m,b[i]);
    }
    if(!flg)return cout<<"0" , 0;
    cout<<sum-m;
}


Measured memory_bytes: 640
from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, Q = map(int, readline().split())
STX = [[int(x) for x in readline().split()] for _ in range(N)]
EVENT = []
for s, t, x in STX:
    EVENT.append((s-x, 1, x))
    EVENT.append((t-x, 0, x))

for i in range(Q):
    d = int(readline())
    EVENT.append((d, 2, i))

ans = [-1] * Q

EVENT.sort()


STOP = set()
h = []
for t, op, x in EVENT:
    if op == 2 and STOP:
        while h and h[0] not in STOP:
            heappop(h)
        ans[x] = h[0]
    elif op == 1:
        STOP.add(x)
        heappush(h, x)
    elif op == 0:
        STOP.remove(x)

print("\n".join(map(str, ans)))


Measured memory_bytes: 143636
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define sz(x) int(x.size())

using namespace std;

typedef long long ll;

static const int MAX = 100001;

int n, m;

class UnionFind{
    public:
    vector<ll> par;
    vector<ll> rank;
    ll numComponent;
    void init(ll n){
        par.resize(n);
        rank.assign(n, 1LL);
        for(ll i=0; i<n; i++)par[i] = i;
        numComponent=n;
    }
    
    ll findRoot(ll x){
        if(par[x] == x)return x;
        else return par[x] = findRoot(par[x]);
    }
    
    void unite(ll x, ll y){
        x = findRoot(x);
        y = findRoot(y);
        if(x == y)return;
        if(rank[x] < rank[y])swap(x, y);
        rank[x] += rank[y];
        par[y] = x;
        numComponent--;
        return;
    }
    
    bool same(ll x, ll y){
        return findRoot(x) == findRoot(y);
    }
    
    ll size(ll x){
        return rank[findRoot(x)];
    }
};

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    cin >> n >> m;
    UnionFind unionfind;
    unionfind.init(n);
    
    rep(i, m){
        int x, y, z;
        cin >> x >> y >> z;
        unionfind.unite(x, y);
    }
    
    cout << unionfind.numComponent << endl;
    
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  int n;
  cin >> n;
  vector<ll> v(n);
  rep(i,n)cin >> v[i];
  sort(ALL(v));
  int res = 0;
  rep(i,n)for(int j = i+1;j < n;j++){
    for(int k = j+1;k < n;k++){
      if(v[i] == v[j] || v[j] == v[k])continue;
      if(abs(v[i]-v[j]) < v[k] && v[k] < abs(v[i]+v[j]))res++;
    }
  }
  cout << res << "\n";


  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t % 13;
    } else {
        return modpow(m, n - 1) * m % 13;
    }
}
long long power(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = pow(m, n / 2);
        return t * t;
    } else {
        return pow(m, n - 1) * m;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k) {
    ll denomi = 1;
    for (int i = n; i > n - k; i--) {
        denomi *= i;
        denomi %= mod;
    }
    ll numera = 1;
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}
int main() {
    ll h, w;
    cin >> h >> w;
    vector<string> grid(h);
    REP(i, h) { cin >> grid[i]; }
    REP(i, h) { grid[i] = '#' + grid[i]; }
    grid.insert(grid.begin(), string(w + 1, '#'));
    ll rmemo[h + 1][w + 1] = {0};
    ll cmemo[h + 1][w + 1] = {0};
    ll ans = 0;
    rep(i, 1, h + 1) {
        rep(j, 1, w + 1) {
            ll cur = 0;
            if (grid[i][j] == '.') {
                if (grid[i - 1][j] == '.') {
                    cur += rmemo[i - 1][j];
                    rmemo[i][j] = rmemo[i - 1][j];
                } else {
                    rep(k, i, h + 1) {
                        if (grid[k][j] == '#') {
                            break;
                        }
                        rmemo[i][j]++;
                        cur++;
                    }
                }
                if (grid[i][j - 1] == '.') {
                    cur += cmemo[i][j - 1];
                    cmemo[i][j] = cmemo[i][j - 1];
                } else {
                    rep(k, j, w + 1) {
                        if (grid[i][k] == '#') {
                            break;
                        }
                        cmemo[i][j]++;
                        cur++;
                    }
                }
                ans = max(cur - 1, ans);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 70220
#include <bits/stdc++.h>

using namespace std;

int main() {
    int n; cin >> n;
    int a[n], b[n], c[n];
    for(int i= 0; i < n; ++i) {
        cin >> a[i] >> b[i] >> c[i];
    }

    int dp[n][3];
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];

    for(int i = 1; i < n; ++i) {
        dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][1], dp[i-1][0]);
    }
    cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));

}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}
 
 
 
 
 
 
 







int dp[2005][2005];
int f[2005];
int main()
{
     int n;
     cin>>n;
     ll x[n],y[n],h[n];
     for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>h[i];
     ll cx,cy,H;
     for(cx=0;cx<=100;cx++){
          for(cy=0;cy<=100;cy++){
               int res=-1,mn=INT_MAX;
               int f=1;
               for(int i=0;i<n;i++){
                    int t1=abs(cx-x[i]),t2=abs(cy-y[i]);
                    if(res==-1){
                         if(h[i]==0)
                         mn=min(mn,t1+t2);
                         else res=h[i]+t1+t2; 
                    }
                    else{
                         if(max(res-t1-t2,0)!=h[i]){f=0;break;}
                    }
               }
               if(f&&mn!=INT_MAX&&res>mn){}
               else if(!f){}
               else{
                    cout<<cx<<" "<<cy<<" "<<res;return 0;
               }
          }
     }
}


























Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
using namespace std;
 
#define int long long

const int MAX_V=1000;
int memo[1000001]={0};
int dist[MAX_V][MAX_V];


void warshall_floyd(int V){
    for(int k=0;k<V;k++){
        for(int i=0;i<V;i++){
            for(int j=0;j<V;j++){
                dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }
}

int getdegit(int num){
    int digit=0;
    while(num!=0){
        num/=10;
        digit++;
    }

    return digit;
}

 

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cin高速化
    


    int a;
    cin>>a;
    int hoge=a;

    int ans=0;
    int tmp;


    // cout<<getdegit(a)<<endl;

    for(int i=getdegit(a)-1;i>=0;i--){
        // cout<<"i:"<<i<<endl;
        // cout<<pow(10,i)<<endl;

        tmp=a/pow(10,i);
        a-=pow(10,i)*tmp;
        // cout<<"tmp:"<<tmp<<endl;

        // cout<<"a:"<<a<<endl;

        ans+=tmp;

    }

    // cout<<ans<<endl;



    if(hoge%ans==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
    
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdbool.h>

#define N 123456

int main(){
	int i,j,k,count;
	bool p[N*2+1];
	
	for(i=0;i<N*2+1;i++){
		p[i]=1;
	}
	
	p[0]=0;
	p[1]=0;
	for(i=0;i<N;i++){
		if(p[i]==1){
			for(j=2;i*j<2*N+1;j++){
				p[i*j]=0;
			}
		}
	}
	
	do{
		scanf("%d",&k);
		count=0;
		if(k==0||k>123456){
			break;
		}
		for(i=k+1;i<=2*k;i++){
			if(p[i]){
				count++;
			}
		}
		
		printf("%d\n",count);
		
		
	}while(1);
	return 0;
}

Measured memory_bytes: 840
#include <cstdio>
#include <algorithm>
#define INF 2000000000
using namespace std;

int main(){
    long int n,R[200002];
    long int maxv = -INF,minv = INF;
    scanf("%ld",&n);
    for(int i = 0;i < n;i++)
        scanf("%ld",&R[i]);
    for(int i = 0;i < n;i++){
        maxv = max(maxv,R[i] - minv);
        minv = min(minv,R[i]);
    }
    printf("%ld\n",maxv);

    return 0;
}


Measured memory_bytes: 4272
#include <bits/stdc++.h>
using namespace std;

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, m, k;

int main() {
	cin >> n >> m >> k;
	
	bool ans = false;
	inc(i, n + 1) {
	inc(j, m + 1) {
		LL v = i * j + (n - i) * (m - j);
		if(v == k) { ans = true; }
	}
	}
	
	cout << (ans ? "Yes" : "No") << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

const int bound = 500100;
ll fact[bound], fact_inv[bound];

ll power( ll a, ll b ){
	ll res = 1;
	while( b > 0 ){
		if( b & 1 ) res = res*a % mod;
		a = a*a % mod;
		b >>= 1;
	}
	return res;
}

ll inv( ll x ){
	return power(x, mod-2);
}

void init(){
	fact[0] = 1;
	int b = bound-10;
	for( int i = 0; i < b; ++i ){
		fact[i+1] = fact[i]*(i+1) % mod;
	}
	fact_inv[b] = inv(fact[b]);
	for( int i = b-1; i >= 0; --i ){
		fact_inv[i] = fact_inv[i+1]*(i+1) % mod;
	}
}

ll comb( ll n, ll r ){
	if( n < r ) return 0;
	return ( fact[n]*fact_inv[r] ) % mod * fact_inv[n-r] % mod;
}

int main(){
	init();
	ll n, m; cin >> n >> m;
	ll ans = 0;
	for( ll s = 0; s <= n; ++s ){
		// Σ( 0 ≤ |S| ≤ N ){ (-1)^|S| * C(N, |S|) * P(M, |S|) * (P(M-|S|, N-|S|))^2 }
		ll diff = comb(n, s) * comb(m, s) % mod * fact[s] % mod * comb(m-s, n-s) % mod * fact[n-s] % mod * comb(m-s, n-s) % mod * fact[n-s] % mod;
		if( s % 2 == 1 ) diff = (mod-diff)%mod;
		ans += diff;
		ans %= mod;
	}
	cout << ans << endl;
}

/*
n(U) - Σ( 1 ≤ |S| ≤ N ){ (-1)^(|S|+1) * f(|S|) }
= n(U) + Σ( 1 ≤ |S| ≤ N ){ (-1)^|S| * f|S| }
= Σ( 0 ≤ |S| ≤ N ){ (-1)^|S| * f|S| }
*/

Measured memory_bytes: 11364
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	map<int, int> MA, MB; 
	int A[200010], B[200010] = {}; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
	}
	for(int i = 0; i < N; i++){
		cin >> B[i]; 
	}
	int P[400010], Q[200010] = {}; 
	for(int i = 0; i < N-1; i++){
		P[i] = (A[i] ^ A[i+1]);  MA[P[i]] ++; 
		Q[i] = (B[i] ^ B[i+1]);  MB[Q[i]] ++; 
	}
	P[N-1] = (A[N-1] ^ A[0]); Q[N-1] = (B[N-1] ^ B[0]); 
	for(int i = 0; i < N; i++) P[N+i] = P[i];
	MA[P[N-1]] ++; MB[Q[N-1]] ++; 
	int mn = 1145141919; 
	for(int i = 0; i < N; i++){
		if(MA[P[i]] != MB[P[i]]){
			return 0; 
		}
		mn = min(mn, MA[P[i]]); 
	}
	if(mn == N){
		for(int i = 0; i < N; i++){
			cout << i << " " << (A[i] ^ B[0]) << endl; 
		}
		return 0; 
	}
	for(int i = 0; i < N; i++){
		bool ok = true; 
		for(int j = 0; j < N; j++){
			if(Q[j] != P[i+j]){
				ok = false; break; 
			}
		}
		if(ok) cout << i << " " << (A[i] ^ B[0]) << endl; 
	}
}

Measured memory_bytes: 21760
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

main() {
    int N,M; cin >> N >> M;
    map<int,int>m;
    rep(i,N){
        int k; cin >> k;
        rep(i,k){
            int a; cin >> a;
            m[a]++;
        }
    }
    int ans=0;
    for(auto p:m){
        if(p.second==N) ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
  set<int> s;
  int val;
  vector<bool> hantei(100001,0);
  vector<int> ruiseki(100001,0);

  for(int i=2;i<=100000;i++){
    s.insert(i);
  }  
  while(s.size()){
    val = *begin(s);
    hantei.at(val) = 1;    
    s.erase(val);
    int val2 = val;
    while(val<=100000){
      val += val2;
      if(s.count(val)) s.erase(val);
    }
  }

  ruiseki.at(0) = ruiseki.at(1) = ruiseki.at(2) = 0;
  for(int i=3;i<=100000;i++){
    if(hantei.at(i) && hantei.at((i+1)/2)){
      ruiseki.at(i) = ruiseki.at(i-1) + 1;
    }else{
      ruiseki.at(i) = ruiseki.at(i-1);
    }
  }
  int q,l,r;
  cin >> q;
  int count;

  for(int i=0;i<q;i++){
    cin >> l >> r;
    cout << ruiseki.at(r) - ruiseki.at(l) + (hantei.at(l) && hantei.at((l+1)/2))<< endl;
  }
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 1e3 + 17;
ll a[N], b[N], cnt, ans, lnt, n, m, r1, r0, l1, l0, sum, mx, h, c[N], t[N], mn = N, x, y, k;
pair<ll,ll>pr[N];
vector<ll>v,v2;
map<ll,ll>mp;
bool used[N];
char ch[1005][1005];
ll prime[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> x >> y >> k;
    cout << min(x * y, k);
}


Measured memory_bytes: 256
//ARC060-D(高橋君とカード)
#include<iostream>
using namespace std;

int N,A;
int x[60];

long long dp[60][60][3600]={};

int main(){
    
    cin>>N>>A;
    for(int i=0; i<N; i++)cin>>x[i];
    
    for(int i=0; i<=N; i++)dp[i][0][0]=1;
    
    for(int i=0; i<N; i++){
        for(int j=1; j<=N; j++){
            for(int k=0; k<=N*A; k++){
                if(k-x[i]>=0){
                    dp[i+1][j][k]+=dp[i][j-1][k-x[i]];
                }
                dp[i+1][j][k]+=dp[i][j][k];
            }
        }
    }
    
    long long ans=0;
    for(int j=1; j<=N; j++){
        ans+=dp[N][j][j*A];
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 84480
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,x;
  	cin>>n>>x;
  	int use;
  	cin>>use;
  	x-=use;
  	int minimum_use=use;
  	for(int i=1 ; i<n ; ++i)
    {
    	cin>>use;
      	x-=use;
      	minimum_use=min(minimum_use,use);
    }
  	cout<<n+(x/minimum_use)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a; i < n; i++)
#define per(i,n,a) for (int i = n - 1; i >= a; i--)
using namespace std;

int main() {
    string s;
    cin >> s;
    rep(i, 0, s.size() - 8) {
        cout << s[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();
    
    ll s;cin>>s;
    ll ans = 0;
    ll t = s/3;
    for(ll i=1;i<=t;++i){
        ll tmp = s - 3*i;
        ans += COM(i-1 + tmp,i-1);
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 15580
#include <stdio.h>

int main(void)
{
	int n;
	long int sum;
	long int i;

	scanf("%d", &n);

	sum = 0;

	for (i = 1; i <= n; i++)
	{
		if (i % 3 == 0 || i % 5 == 0)
			continue;
		sum += i;
	}

	printf("%ld", sum);

	return 0;
}

Measured memory_bytes: 1732