akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0516 : Maximum Sum **/
int main()
{
	int N, K;
	while (cin>>N>>K, N||K) {
		vector<int> a(N);
		rep(i, N) cin>>a[i];
	
		int k=0;
		rep(i, K) k+=a[i];
		
		int ans=k;
		REP(i, K, N) {
			k+=a[i] - a[i-K];
			ans = max(ans, k);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1532
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;
int main() {
	int d,t,s;
	cin>>d>>t>>s;
	if(d<=(s*t))
	{
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3132
n = int(input())
S = [int(x) for x in input().split()]

S0 = {}
S1 = {}
for i in range(len(S)):
  if i%2 == 0:
    if S[i] not in S0:
      S0[S[i]] =1
    else:
      S0[S[i]] += 1
  else:
    if S[i] not in S1:
      S1[S[i]] =1
    else:
      S1[S[i]] += 1

if max(S0, key = S0.get) != max(S1, key = S1.get):
  Answer = len(S) - max(S0.values()) -max(S1.values())
  print(Answer)
  exit()
      
S0list = sorted(list(S0.values()),reverse = True)
S1list = sorted(list(S1.values()),reverse = True)

S00 = S0list[0]

if len(S0list) == 1:
  S01 = 0
else:
  S01 = S0list[1]
S10 = S1list[0]
if len(S1list) == 1:
  S11 = 0
else:
  S11 = S1list[1]
Answer = min(len(S) - S00 - S11,len(S) - S01 - S10)

print(Answer)

Measured memory_bytes: 17632
#include <iostream>
#define rep(i,o,u) for(int i = o;i < u; i++)
using namespace std;
int L[500000/2+2],R[500000/2+2];
int ans = 0;
void merge(int a[],int left,int mid,int right){
	int n1 = mid - left;
	int n2 = right - mid;
	rep(i,0,n1) L[i] = a[left + i];
	rep(i,0,n2) R[i] = a[mid + i];
	L[n1] = R[n2] = 2000000000;
	int i = 0,j = 0;
	rep(k,left,right){
		ans++;
		if(L[i] <= R[j]){
			a[k] = L[i++];
		}else{
			a[k] = R[j++];
		}
	}
}
void mergeSort(int a[],int left,int right){
	if(left + 1 < right){
		int mid = (left + right) / 2;
		mergeSort(a,left,mid);
		mergeSort(a,mid,right);
		merge(a,left,mid,right);
	}
}
int main(){
	int n;
	cin >> n;
	int a[500001];
	rep(i,0,n) cin >> a[i];
	mergeSort(a,0,n);
	rep(i,0,n-1){cout << a[i] << " ";}
	cout << a[n-1] << endl;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6888
#include <bits/stdc++.h>
  
using namespace std;
 
#define endl "\n"
#define JAM(x) cout<< #x <<" = "<<x<<"\n"

 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
typedef vector<PII> VPI;
 
const int INF=2e9;
const int MX=100005;
const int MOD=1000000007;
const double PI=acos(-1.0);



long long int power(long long int a,long long int b)
{
    a %= MOD;
    long long int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}
bool isprime(int n)
{
    if(n==1)
    return 0;
    int i;
    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return false;
    }
    return true;
}




/*_______________________________________________*/





int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<vector<int>> v(n,vector<int>(2));
    int i,flag=0;
    for(i=0;i<n;i++)
    cin>>v[i][0]>>v[i][1];
    for(i=0;i<n-2;i++)
    {
        if(v[i][0]==v[i][1] && v[i+1][0]==v[i+1][1] && v[i+2][0]==v[i+2][1])
        {
            flag=1;
            break;
        }
    }
    if(flag)
    cout<<"Yes";
    else
    cout<<"No";
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <fstream>
#include <vector>
using namespace std;

int main() {
   
               long long int n,x,i,a;  
               cin>>n;
                if(n>=30)
                        cout<<"Yes"<<endl;
                else
                        cout<<"No"<<endl;
      
    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    for(int i=0;i<4000;i++){
      if(n==6174){cout<<i<<endl;break;}
      vector<int>v;
      for(int j=0;j<4;j++){
        v.push_back(n%10);
        n/=10;
      }
      sort(v.begin(),v.end());
      if(v[0]==v[3]){cout<<"NA"<<endl;break;}
      int p1,p2;
      p1=v[0]+v[1]*10+v[2]*100+v[3]*1000;
      p2=v[3]+v[2]*10+v[1]*100+v[0]*1000;
      n=p1-p2;
    }
  }
}



Measured memory_bytes: 3112
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>

using namespace std;

#if defined(_MSC_VER)
#pragma warning(disable: 4996)  // VSでscanfを使う．
#endif

int main() {
  int n;
  string s[3];
  cin >> n >> s[0] >> s[1] >> s[2];

  int ans = 0;
  for (int i = 0; i < n; i++) {
    int t = 2;
    if (s[0][i] == s[1][i] && s[1][i] == s[2][i]) {
      t = 0;
    } else if (s[0][i] == s[1][i]) {
      t = 1;
    } else if (s[0][i] == s[2][i]) {
      t = 1;
    } else if (s[1][i] == s[2][i]) {
      t = 1;
    }

    ans += t;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[55];
int n,ans;
int main()
{
	cin>>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++)
		    ans+=a[i]*a[j];
	cout<<ans<<endl;
	return 0;	    
} 

Measured memory_bytes: 256
N, X = map(int, input().split())
L = list(map(int, input().split()))

d = 0
jumps = [0]
for i in range(len(L)):
    d = d + L[i]
    jumps.append(d)
    
cnt = 0
for x in jumps:
    if x <= X:
        cnt += 1
    else:
        pass
    
print(cnt)

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

int n, m, k, vis[100001], res[100001], group[100001];
vector<int> adj[100001];
pair<int, int> edg[200000];

void dfs(int vtx, int id){
	vis[vtx] = id;
	for(auto i : adj[vtx])
		if(!vis[i]) dfs(i, id);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m >> k;
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
		edg[i] = make_pair(a, b);
	}
	for(int i = 0; i < k; i++) cin >> edg[i + m].first >> edg[i + m].second;
	for(int i = 1; i <= n; i++){
		if(!vis[i]) dfs(i, i);
		group[vis[i]]++;
	}
	for(int i = 1; i <= n; i++) res[i] = group[vis[i]];
	for(int i = 0; i < m + k; i++)
		if(vis[edg[i].first] == vis[edg[i].second]) res[edg[i].first]--, res[edg[i].second]--;
	for(int i = 1; i <= n; i++) cout << res[i] - 1 << ((i == n) ? "\n" : " ");
	return 0;
}

Measured memory_bytes: 9472
#include<algorithm>
#include<functional>
#include<iostream>

int N;
std::pair<int, int> point[100];
int rank[100];

int main()
{
	std::cin >> N;
	for( int i = 0; i != N * ( N - 1 ) / 2; ++i )
	{
		int A, B, C, D;
		std::cin >> A >> B >> C >> D;
		
		if( C == D )
			++point[A-1].first, ++point[B-1].first;
		else if( C > D )
			point[A-1].first += 3;
		else
			point[B-1].first += 3;
	}

	for( int i = 0; i != N; ++i )
		point[i].second = i;

	std::sort( point, point + N, std::greater<std::pair<int, int> >() );

	int r = 0;
	for( int i = 0; i != N; ++i )
	{
		if( i - 1 >= 0 && point[i-1].first == point[i].first )
			++r;
		else 
			r = 0;

		rank[point[i].second] = i + 1 - r;
	}

	for( int i = 0; i != N; ++i )
		std::cout << rank[i] << std::endl;

	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = getchar();c < '0' || c > '9';c = getchar()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = getchar()) res = res * 10 + (c - '0');
  return res * sig;
}
char s[55];
int n,k;
int main(){
  n = getint(), k = getint();
  scanf("%s",s + 1);
  for(int i = 1;i <= strlen(s + 1);i++){
    if(i == k) printf("%c",s[i] + 'a' - 'A');
    else printf("%c",s[i]);
  }
  puts("");
  return 0;
}


Measured memory_bytes: 256
using System;

namespace ITP1_11_B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str1 = Console.ReadLine().Split(' ');
            Dice dice = new Dice(int.Parse(str1[0]), int.Parse(str1[1]), int.Parse(str1[2]), int.Parse(str1[3]), int.Parse(str1[4]), int.Parse(str1[5]));
            string str2 = Console.ReadLine();
            int n = int.Parse(str2);

            for(int i = 0;i < n; ++i)
            {
                string[] str3 = Console.ReadLine().Split(' ');
                dice.SetTop(int.Parse(str3[0]), int.Parse(str3[1]));
                Console.WriteLine("{0}", dice.EastPip);
            }
        }
    }

    class Dice
    {
        public int TopPip { get; private set; }
        public int SouthPip { get; private set; }
        public int EastPip { get; private set; }
        public int WestPip { get; private set; }
        public int NorthPip { get; private set; }
        public int BottomPip { get; private set; }

        public Dice(int topPip,int southPip, int eastPip, int westPip, int northPip, int bottomPip)
        {
            this.TopPip = topPip;
            this.SouthPip = southPip;
            this.EastPip = eastPip;
            this.WestPip = westPip;
            this.NorthPip = northPip;
            this.BottomPip = bottomPip;
        }

        public void MoveNorth()
        {
            int temp = this.NorthPip;
            this.NorthPip = this.TopPip;
            this.TopPip = this.SouthPip;
            this.SouthPip = this.BottomPip;
            this.BottomPip = temp;
        }

        public void MoveSouth()
        {
            int temp = this.SouthPip;
            this.SouthPip = this.TopPip;
            this.TopPip = this.NorthPip;
            this.NorthPip = this.BottomPip;
            this.BottomPip = temp;
        }

        public void MoveWest()
        {
            int temp = this.WestPip;
            this.WestPip = this.TopPip;
            this.TopPip = this.EastPip;
            this.EastPip = this.BottomPip;
            this.BottomPip = temp;
        }

        public void MoveEast()
        {
            int temp = this.EastPip;
            this.EastPip = this.TopPip;
            this.TopPip = this.WestPip;
            this.WestPip = this.BottomPip;
            this.BottomPip = temp;
        }

        public void RevolveLeft()
        {
            int temp = this.SouthPip;
            this.SouthPip = this.EastPip;
            this.EastPip = this.NorthPip;
            this.NorthPip = this.WestPip;
            this.WestPip = temp;
        }

        public void SetTop(int topPip)
        {
            while(true)
            {
                if (this.TopPip == topPip) { break; }
                MoveNorth();
                if (this.TopPip == topPip) { break; }
                MoveWest();
            }
        }

        public void SetTop(int topPip,int southPip)
        {
            SetTop(topPip);
            while(true)
            {
                if (this.SouthPip == southPip) { break; }
                RevolveLeft();
            }
        }


    }
}

Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;

ll N = 2 * 1e5 + 5;
ll K;
ll mod = 1000000007;

vector<ll> fac(N), finv(N), inv(N);

void Cinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < N; 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(ll n, ll 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(){
    Cinit();
    cin >> N >> K;
    ll ans = 0;
    for (int i = 0; i < min(K + 1, N);i++){
        ll a = com(N, i);
        a = (a * com(N - 1, N - i - 1) % mod);
        ans = (a + ans) % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        int ridge = 4;  //棟
        int floor = 3;  //階
        int roomNumber = 10;    //部屋番号
        int[][][] liveHumans = new int[ridge][floor][roomNumber];
        
        //初期値設定
        for(int rid = 0; rid < ridge; rid++){
            for(int flo = 0; flo < floor; flo++){
                for(int roo = 0; roo < roomNumber; roo++){
                    liveHumans[rid][flo][roo] = 0;
                }
            }
        }
        
        //入力
        Scanner sc = new Scanner(System.in);
        int inputNum = sc.nextInt();
        for(int i = 0; i < inputNum; i++){
            int inputRidge          = sc.nextInt();
            int inputFloor          = sc.nextInt();
            int inputRoomNumber     = sc.nextInt();
            int inputHuman          = sc.nextInt();
            if(liveHumans[inputRidge-1][inputFloor-1][inputRoomNumber-1] != 0){
                liveHumans[inputRidge-1][inputFloor-1][inputRoomNumber-1] += inputHuman;
                continue;
            }
            liveHumans[inputRidge-1][inputFloor-1][inputRoomNumber-1] = inputHuman;
        }
        
        /**
         * ネストしすぎて見にくいから改行
         */ 
        //出力
        for(int rid = 0; rid < ridge; rid++){
            
            for(int flo = 0; flo < floor; flo++){
                
                for(int roo = 0; roo < roomNumber; roo++){
                    System.out.print(" " + liveHumans[rid][flo][roo]);
                    if(roo == roomNumber-1){
                        System.out.println();
                    }
                }
                
                if(flo == floor-1 && (rid == 0 || rid == 1 || rid == 2)){
                    for(int floorCount = 0; floorCount < 20; floorCount++){
                        if(floorCount == 19){
                            System.out.println("#");
                            break;
                        }
                        System.out.print("#");
                    }
                }
            }
        
        }
    }
}



Measured memory_bytes: 29648
#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, = getIntList()
#print(N)

zd = {}

for i in range(2, N+1):
    for j in range(2,N+1):
        while i%j==0:
            if j not in zd:
                zd[j] = 0
            zd[j]+=1
            i = i//j
z1 = []
for x in zd:
    if zd[x]>=2:
        z1.append(zd[x])
dprint(z1)
re = 0
def search(ki, zt, ti):
    if ti>=len(zt):
        global re
        re+=1
        return
    global z1
    if ki >= len(z1):
        return
    search(ki+1, zt,ti)
    if z1[ki] +1 >= zt[ti]:
        search(ki+1, zt,ti+1)

search(0, [75,], 0)
search(0, [3,25], 0)
search(0, [25,3], 0)
search(0, [15,5], 0)
search(0, [5,15], 0)
search(0, [3,5, 5], 0)
search(0, [5,3, 5], 0)
search(0, [5,5, 3], 0)


print(re)




Measured memory_bytes: 41328
#定数
#2≦x≦10^5
x = int(input())

f = False   #flag    
x = x - 1
#素数がになるまでインクリメントを続ける
while f == False:
    x += 1
    #素数判定
    def judge_prime_num(a:int)->bool:   #O(√N)
        m = int(a**(1/2)+1)
        for i in range(2, m):
            if a % i == 0:
                return False
            else:
                pass
        return True
    f = judge_prime_num(x)

#答えの出力
print(x)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,s=1;
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    {  
      if(i<0)s*=-1;
      if(i==0){cout<<"Zero"<<endl;return 0;} 
      
    }
    if(s>0)cout<<"Positive"<<endl;
    if(s<0)cout<<"Negative"<<endl;
    if(s==0)cout<<"Zero"<<endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import os
from collections import defaultdict

d = defaultdict(list)

for s in sys.stdin:
    lst = s.split()
    word = lst[0]
    page = int(lst[1])
    d[word].append(page)

keys = list(d.keys())
keys.sort()
for key in keys:
    print(key)
    pages = d[key]
    pages.sort()
    print(*pages)

Measured memory_bytes: 7960
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int k; cin >> k;
    string s; cin >> s;
    if (sz(s)<=k) cout << s << endl;
    else {
        rep(i, k) cout << s[i];
        rep(i, 3) cout << '.';
        cout << endl;
    }
}

Measured memory_bytes: 3644
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> P;
struct pos {
  int row;
  int column;
};
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1 << 30;
const ll MOD = 1000000007;
int main(void) {
  int N, W;
  int v[1002];
  int w[1002];
  int dp[102][10002];
  cin >> N >> W;
  rep(i, N) { cin >> v[i] >> w[i]; }

  rep(i, N + 1) {
    for (int u = 0; u <= W; u++) {
      if (w[i] > u) {
        dp[i + 1][u] = dp[i][u];
      } else {
        dp[i + 1][u] = max(dp[i][u], dp[i + 1][u - w[i]] + v[i]);
      }
    }
  }

  cout << dp[N][W] << endl;
  return 0;
}


Measured memory_bytes: 7024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, k; cin >> n >> k;
	ll ans = 0;
	vi a(n);
	map<ll, int> cnt;
	vi sum(n + 1);
	cnt[0] = 1;
	rep(i, n){
		cin >> a[i];
		a[i] = (a[i] + k - 1) % k;
		sum[i + 1] = (sum[i] + a[i]) % k;
		if(i >= k - 1) cnt[sum[i - k + 1]]--;
		ans += cnt[sum[i + 1]]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 14336
import java.util.*;
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();
    for(int i=0; i<10; i++){
    c = a*c - b;
    System.out.println(c);
    }
    sc.close();
  }
}
    

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

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 4e3 + 10;

int N, M, Q, Nr[MAX_N][MAX_N], Sum[MAX_N][MAX_N];
int main() {
	cin >> N >> M >> Q;
	for(int i=1; i<=N; i++) for(int j=1; j<=M; j++) scanf("%1d", &Nr[i*2][j*2]);
	for(int i=1; i<=N; i++) for(int j=1; j<=M; j++) {
		if(Nr[i*2][j*2] == 0) continue;
		for(int k=0; k<2; k++) {
			int x = i + ("12"[k] - '1');
			int y = j + ("21"[k] - '1');
			if(Nr[x*2][y*2] == 1)
				Nr[i+x][j+y] = -1;
		}
	}
	for(int i=1; i<=N*2; i++) for(int j=1; j<=M*2; j++)
		Sum[i][j] = Nr[i][j] + Sum[i-1][j] + Sum[i][j-1] - Sum[i-1][j-1];

	while(Q--) {
		int x0, x1, y0, y1; scanf("%d%d%d%d", &x0, &y0, &x1, &y1);
		printf("%d\n", Sum[x1*2][y1*2] - Sum[x0*2-1][y1*2] - Sum[x1*2][y0*2-1] + Sum[x0*2-1][y0*2-1]);
	}
	return 0;
}

Measured memory_bytes: 127104
#include "bits/stdc++.h"
#define long int64_t
using namespace std;

struct Solver {
	void solve() {
		int N;
		cin >> N;

		int ans = 0;
		for( int i = 1; i < N; ++i ) {
			for( int j = 1; i*j < N; ++j ) {
				ans += 1;
			}
		}

		cout << ans << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;

int main()
{
	int n=0;
	char S[4];

	for (int i = 0; i < 4; i++) 
		cin >> S[i];


	for (int i = 0; i < 4; i++) {
		if (S[i] == '+')
			n++;
		if (S[i] == '-')
			n--;
	}

	cout << n << endl;
	
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  
  if(s[2] == s[3] && s[4] == s[5]){
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << 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;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  vector<char> res;
  rep(i, n) {
    if (s[i] == "AB") {
      if (a > b) {
        --a, ++b;
        res.push_back('B');
      } else if (a < b) {
        ++a, --b;
        res.push_back('A');
      } else {
        if (i == n-1 || s[i+1] != "BC") {
          ++a, --b;
          res.push_back('A');
        } else {
          --a, ++b;
          res.push_back('B');
        }
      }
    } else if (s[i] == "AC") {
      if (a > c) {
        --a, ++c;
        res.push_back('C');
      } else if (a < c) {
        ++a, --c;
        res.push_back('A');
      } else {
        if (i == n-1 || s[i+1] != "BC") {
          ++a, --c;
          res.push_back('A');
        } else {
          --a, ++c;
          res.push_back('C');
        }
      }
    } else {
      if (b > c) {
        --b, ++c;
        res.push_back('C');
      } else if (b < c) {
        ++b, --c;
        res.push_back('B');
      } else {
        if (i == n-1 || s[i+1] != "AC") {
          ++b, --c;
          res.push_back('B');
        } else {
          --b, ++c;
          res.push_back('C');
        }
      }
    }
    if (a < 0 || b < 0 || c < 0) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  rep(i, n)
    cout << res[i] << '\n';
  return 0;
}

Measured memory_bytes: 6620
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,min=0,max=0;
  cin >>n;
  int a[n];
  int b[9];
  for(int i=0;i<9;i++)b[i]=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]<=399)b[0]=1;
    else if(a[i]<=799)b[1]=1;
    else if(a[i]<=1199)b[2]=1;
    else if(a[i]<=1599)b[3]=1;
    else if(a[i]<=1999)b[4]=1;
    else if(a[i]<=2399)b[5]=1;
    else if(a[i]<=2799)b[6]=1;
    else if(a[i]<=3199)b[7]=1;
    else b[8]+=1;
  }
  int count=0; 
  for(int i=0;i<8;i++){
    if(b[i]==1)count++;
  }
  int c;
  if (count==0 && b[8]>0)c=1;
  else c=count;
  
  cout << c <<" "<< count+b[8] << endl;
}

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

#define watch(x) cout << (#x) << " is " << (x) << endl
#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
#define repn(i, st, en) for(int i=st; i>=en; i--)
#define sq(a) (a*a)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int mod = 1e9+7;

void add_self(int &a, int b){
    a += b;
    if(a >= mod) a -= mod;
}

void sub_self(int &a, int b){
    a -= b;
    if(a < 0) a += mod;
}

void solve(){
    int n, k;
    cin>>n>>k;
    int a[n+1];

    vector<int> dp(k+1);
    dp[0] = 1;

    for(int child = 0; child < n; ++child){
        int ub;
        cin>>ub;
        vector<int> fake(k+1);
        for(int used = k; used >=0; --used){
            int temp = dp[used];
            int L = used + 1;
            int R = used + min(k - used, ub);
            if(L <= R){
                add_self(fake[L], temp);
                if(R+1 <= k)
                    sub_self(fake[R+1], temp);
            }
            /*
                for(int i=L; i<=R; i++){
                    add_self(dp[i], temp);  /// range update from L to R with temp, we can use BIT to do that, instead use pref sum concept
                }
            */
        }
        int prefix_sum = 0;
        for(int i=0; i<=k; i++){
            add_self(prefix_sum, fake[i]);
            add_self(dp[i], prefix_sum);
        }
    }

    cout<<dp[k];

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll t = 1;
    //  cin>>t;
    while(t--){
        solve();
    }

    return 0;
}



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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; i++)
        cin >> a[i];
    ll dp[n+1];
    dp[0] = 0;
    for(int i=0; i<n; i++)
        dp[i+1] = (dp[i] + a[i] -1) % k;
    map<int, int> mp;
    ll ans = 0;
    mp[0] = 1;
    for(int i=1; i<=n; i++){
        if(i>=k) mp[dp[i-k]]--;
        ans += mp[dp[i]]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12032
#include <stdio.h>
#include <stdlib.h>

void Array_Print(int N, int A[]){
	for(int i=0; i<N; i++){
		if(i==N-1) printf("%d", A[i]);
		else 	   printf("%d ", A[i]);
	}
	printf("\n");
}

int Bubble_Sort(int N, int A[]){
	int counter = 0;
	for(int i=0; i<N-1; i++){
		for(int j=N-1; j>=i+1; j--){
			int k = A[j];
			if(A[j-1] > A[j]){
				counter++ ;
				A[j] = A[j-1];
				A[j-1] = k;
			}
		}
	}
	Array_Print(N,A);
	return counter;
}

int main(int argc, char const *argv[])
{
	// Input the total number of elements
	int N;
	scanf("%d", &N);
	// Input elements in the list
	int A[N];
	for(int i=0; i<N; i++){
		scanf("%d", &A[i]);
	}
	// Bubble Sort
	int counter = Bubble_Sort(N,A);
	printf("%d\n", counter);
	return 0;
}


Measured memory_bytes: 2064
#include<bits/stdc++.h>
#define LL long long
#define MOD (1000000007)
using namespace std;

LL n,x,y,z,ans=1,f[49][1<<17];

int main()
{
	cin>>n>>x>>y>>z;
	for (int i=1; i<=n; ++i) ans=ans*10%MOD;
	f[0][0]=1;
	int lim=(1<<z-1)|(1<<y+z-1)|(1<<x+y+z-1);
	int state=(1<<x+y+z)-1;
	for (int i=0; i<=n; ++i)
		for (int S=0; S<=state; ++S)
		{
			if (!f[i][S]) continue;
			for (int k=1; k<=10; ++k)
			{
				int now=((S<<k)|(1<<k-1))&state;
				if ((now&lim)!=lim) (f[i+1][now]+=f[i][S])%=MOD;
			}
		}
	for (int i=0; i<=state; ++i)
		(ans-=f[n][i])%=MOD;
	cout<<(ans+MOD)%MOD<<endl;
}

Measured memory_bytes: 43264
#include<iostream>
#include<string>
#include<cmath>
using namespace std;

void select_cal(char c, int *tmp, int val){

	if(c == '+') *tmp += val;
	else if(c == '-') *tmp -= val;
	else if(c == '*') *tmp = floor(*tmp * val);
	else if(c == '/' && val != 0) *tmp = floor(*tmp / val);

}

int calculation(string str, int len, int begin){

	int ans, tmp, cnt, val;
	char c;
	
	ans = 0;
	tmp = 0;
	c = '+';

	for(int i=begin; i<len; i++){
		if(str[i] == '+' || str[i] == '-'){
			ans += tmp;
			tmp = 0;
			c = str[i];
		}
		else if(str[i] == '*' || str[i] == '/'){
			c = str[i];
		}
		else if(str[i] == '('){
			select_cal(c, &tmp, calculation(str, len, i+1));
			cnt = 1;
			do{
				i++;
				if(str[i] == '(') cnt++;
				else if(str[i] == ')') cnt--;
			}while(cnt != 0);
		}
		else if(str[i] == ')' || str[i] == '='){
			break;
		}
		else {
			cnt = 1;
			while(str[i+cnt] >= '0' && str[i+cnt] <= '9'){
				cnt++;
			}
			val = 0;
			for(int j=0; j<cnt; j++){
				val += (str[i+cnt-j-1] - '0') * pow(10, j);
			}
			select_cal(c, &tmp, val);
			i += cnt - 1;
		}
	}
	ans += tmp;

	return ans;

}

int main(){

	int n;
	string str;
	
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> str;
		cout << calculation(str, str.length(), 0) << endl;
	}

	return 0;

}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<int, ii>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define mp make_pair
#define fi first
#define se second
// #define multicase
const int MOD = 1e9 + 7;
const int INF = 2e9;
const int N = 1e4 + 5;

void solve() {
    int T = 1;
  #ifdef multicase
    cin >> T;
  #endif
    for(int tc = 1, n; tc <= T; tc++) {
        cin >> n;
        n -= n / 1000 * 1000;
        cout << (!n ? 0 : 1000 - n) << "\n";
    }
}

int main() {
 
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    solve();
    
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
#define Mod 1000000007;

int main(){
    ll i,n;
    cin>>n;
    vector<P> v;
    ll x;

    for(i=0;i<n;i++){
        cin>>x;
        v.push_back(P(x,0));
    }
    for(i=0;i<n;i++){
        cin>>x;
        v.push_back(P(x,1));
    }
    sort(v.begin(),v.end());

    ll ans=1;
    int b=1;
    int cnt=1;
    int f=v[0].second;
    while(b<2*n){
        if(f==-1){
            f=v[b].second;
            cnt=1;
        }
        else if(f==v[b].second) {
            cnt++;
        }
        else  {
            ans*=cnt;
            ans%=Mod;
            cnt--;
            if(cnt==0) f=-1;
        }
        b++;
    
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 6256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;
using ll = long long;

/**
 * main
 */
int main () {
  ll A, B, C;
  cin >> A >> B >> C;
  if (A == B && B == C && C == A) {
    cout << "No\n";
  } else if (A == B || B == C || C == A) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


Measured memory_bytes: 256
import sys
s=[list(map(int,e.split(',')))for e in sys.stdin]
for i in range(1,len(s)):
 k=len(s[i]);b=k>len(s[i-1])
 for j in range(k):t=j-b;s[i][j]+=max(s[i-1][t*(j>0):t+2])
print(*s[-1])


Measured memory_bytes: 5612
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N[12];

int main() {

	rep(i, 3)cin >> N[i];



	cout << N[2] << " " << N[0] << " " << N[1] << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
const int maxn=50+5;
int main()
{
	int n,k;
	while(scanf("%d%d",&n,&k)!=EOF)
	{
		long long num,i,j,even=0,odd=0;
		for(i=1;i<=n;i++)
		cin>>num,even+=(!(num&1)),odd+=(num&1);
		if(k)
		{
			if(odd)
			cout<<(1ll<<(odd-1+even))<<endl;
			else
			cout<<0<<endl;
		}
		else 
		{
			if(odd==0)
			cout<<(1ll<<n)<<endl;
			else
			cout<<(1ll<<(odd-1))*(1ll<<even)<<endl;
		}
		
	}
	return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()

ans = 0
l, r = 1, max(h)//B+1
while l < r:
    m = (l+r)//2
    c = m
    for i in range(N):
        t = h[i]-m*B
        if t > 0:
            c -= (t+A-B-1)//(A-B)
            if c < 0:
                break

    if c >= 0:
        r = m
    else:
        l = m+1

print(l)


Measured memory_bytes: 50904
/*input
19 99
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b; cin >> a >> b;
    for(int i = 1; i <= 1000; i++) if(i * 8/100 == a && i * 10/100 == b)
    {
		cout << i;
		return 0;
    }
    cout << -1;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
long long int com(long int n,long int r){
  long long int re=1;
  long long int pre=1;
  for(long long int i=0; i<r; i++){
    re*=n-i;
    if(re%(r-i)==0){
      re/=r-i;
    }else{
      pre*=r-i;
    }
    if(re%pre==0){
      re/=pre;
      pre=1;
    }
  }
  re/=pre;
  return re;
}
int main(void){
  int n,p;
  cin>>n>>p;
  int gu=0;
  int ki=0;
  for(int i=0; i<n; i++){
    int pre;
    cin>>pre;
    if(pre%2==0){
      gu++;
    }else{
      ki++;
    }
  }

  long long int ans=pow(2,n-1);
  if(ki==0){
    if(p==1){
      ans=0;
    }else{
      ans=pow(2,n);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define lld long long int 

//-4%3=-1
        int n,k;
        lld arr[100001][3],dp[100001][3],cnt[3]={0};
        
int fun(int i,int m)
{
    if(i==n+1)
    return 0;
    if(dp[i][m]==-1){
    if(m==0)
    return( dp[i][0]=max(arr[i][0]+fun(i+1,1),arr[i][0]+fun(i+1,2)));
    else if(m==1)
    return( dp[i][1]=max(arr[i][1]+fun(i+1,0),arr[i][1]+fun(i+1,2)));
    else
    return( dp[i][2]=max(arr[i][2]+fun(i+1,1),arr[i][2]+fun(i+1,0)));}
    else
    return dp[i][m];
    
}
    


int main() {
	// your code goes here
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t;
    //cin>>t;
    t=1;
    while(t--)
    {

        cin>>n;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
            dp[i][0]=dp[i][1]=dp[i][2]=-1;
        }
        cout<<max(fun(1,0),max(fun(1,1),fun(1,2)));
    }
}



Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			int c = scanner.nextInt();
			System.out.println(((c >= a) && (c <= b)) ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 23764
#include<stdio.h>
int gcd(int,int);
int main(){
    int a,b,k,g;
    scanf("%d %d %d",&a,&b,&k);

    g = gcd(a,b);
    int ans[30];
    int j=0;

    for(int i=g;i>0;i--){
        if(g%i==0){
            ans[j] = i;
            j++;
        }
    }        

    printf("%d",ans[k-1]);

    return 0;
}
int gcd(int a,int b){
    if(a>b){
        int tmp=0;
        tmp=a;
        a=b;
        b=tmp;
    }
    int c=b%a;
    while(1){
        c=b%a;
        if(c==0)
            break;
        b=a;
        a=c;
    }

    return a;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define OP_UNDEFINED	(-1000)
#define OP_NULL			(-2000)
#define OP_MALLOC		(-3000)
#define OP_CLONE		(-4000)
#define OP_FREE			(-5000)

int heap_size;
int heap_rest;

int memory_map_size;
int memory_map[10000];

char statement[400];
int operation_num;
int operations[1000];

int values[26];

int main(void) {
	int i;
	int current_value=0;
	int error=0;
	int leak_size;
	for(i=0;i<26;i++)values[i]=OP_UNDEFINED;
	scanf("%d",&heap_size);
	heap_rest=heap_size;
	while(scanf("%s",statement)==1) {
		operation_num=0;
		for(i=0;statement[i]!=0 && statement[i]!=')';) {
			if(statement[i]=='m') {
				operations[operation_num++]=OP_MALLOC;
				i+=7;
			} else if(statement[i]=='c') {
				operations[operation_num++]=OP_CLONE;
				i+=6;
			} else if(statement[i]=='f') {
				operations[operation_num++]=OP_FREE;
				i+=5;
			} else if(statement[i]=='N' && statement[i+1]=='U') {
				current_value=OP_NULL;
				break;
			} else if(isupper(statement[i])) {
				if(statement[i+1]=='=') {
					operations[operation_num++]=-(statement[i]-'A')-1;
					i+=2;
				} else {
					current_value=values[statement[i]-'A'];
					break;
				}
			} else if(statement[i]=='(') {
				i++;
			} else if(isdigit(statement[i])) {
				current_value=atoi(&statement[i]);
				break;
			} else return 1;
		}
		for(i=operation_num-1;i>=0;i--) {
			if(operations[i]==OP_MALLOC) {
				if(heap_rest<current_value) {
					current_value=OP_NULL;
				} else {
					memory_map[memory_map_size]=current_value;
					heap_rest-=current_value;
					current_value=memory_map_size;
					memory_map_size++;
				}
			} else if(operations[i]==OP_CLONE) {
				if(current_value!=OP_NULL) {
					if(current_value<0 ||
							current_value>=memory_map_size ||
							memory_map[current_value]<0) {
						error=1;
						current_value=OP_NULL;
					} else {
						if(heap_rest<memory_map[current_value]) {
							current_value=OP_NULL;
						} else {
							memory_map[memory_map_size]=memory_map[current_value];
							heap_rest-=memory_map[current_value];
							current_value=memory_map_size;
							memory_map_size++;
						}
					}
				}
			} else if(operations[i]==OP_FREE) {
				if(current_value!=OP_NULL) {
					if(current_value<0 ||
							current_value>=memory_map_size ||
							memory_map[current_value]<0) {
						error=1;
						current_value=OP_NULL;
					} else {
						heap_rest+=memory_map[current_value];
						memory_map[current_value]=OP_UNDEFINED;
					}
				}
			} else if(-26<=operations[i] && operations[i]<0) {
				values[-operations[i]-1]=current_value;
			} else return 1;
		}
	}
	if(error) {
		puts("Error");
	} else {
		for(i=0;i<26;i++) {
			if(0<=values[i] && values[i]<memory_map_size) {
				memory_map[values[i]]=OP_UNDEFINED;
			}
		}
		leak_size=0;
		for(i=0;i<memory_map_size;i++) {
			if(memory_map[i]!=OP_UNDEFINED)leak_size+=memory_map[i];
		}
		printf("%d\n",leak_size);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

void solve0(ll n) {
    V<ll> a(n);
    V<ll> sum0(n), sum1(n + 2);
    rep(i, n) {
        cin >> a[i];
        (i & 1 ? sum1 : sum0)[i] = a[i];
    }
    rep(i, n - 1) sum0[i + 1] += sum0[i];
    FORR(i, n - 1) sum1[i] += sum1[i + 1];

    ll ans = sum1[0];
    for(int i = 0; i < n; i += 2) {
        chmax(ans, sum0[i] + sum1[i + 2]);
    }
    cout << ans << endl;
    exit(0);
}

void solve1(ll n) {
    ll sum = 0;
    V<ll> a(n + 1);
    FOR(i, 1, n + 1) cin >> a[i], sum += a[i];
    V<V<ll>> dp(n + 1, V<ll>(2, inf));
    dp[0][0] = 0;
    FOR(i, 1, n + 1) {
        if(i & 1) {
            chmin(dp[i][1], dp[i - 1][0] + a[i]);
            if(i > 1) chmin(dp[i][1], dp[i - 2][1] + a[i]);
        } else {
            chmin(dp[i][0], min(dp[i - 1][0], dp[i - 2][0]) + a[i]);
            chmin(dp[i][1], min(dp[i - 1][1], dp[i - 2][1]) + a[i]);
        }
    }
    cout << sum - min(dp[n - 1][1], dp[n][1]) << endl;

    exit(0);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    ll n;
    cin >> n;
    if(n % 2 == 0) solve0(n);
    solve1(n);

    return 0;
}

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

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

    const int MAX = 100005;
    int even[MAX] = {0}, odd[MAX] = {0};

    rep(i, n) {
        int x;
        cin >> x;
        if (i % 2 == 0) {
            even[x]++;
        } else {
            odd[x]++;
        }
    }

    int evenMax = 0, oddMax = 0, ei, oi;
    for (int i = 0; i < MAX; i++) {
        if (evenMax < even[i]) evenMax = even[i], ei = i;
        if (oddMax < odd[i]) oddMax = odd[i], oi = i;
    }

    sort(even, even + MAX, greater<int>());
    sort(odd, odd + MAX, greater<int>());

    if (ei == oi)
        cout << min(n - even[0] - odd[1], n - even[1] - odd[0]) << endl;
    else
        cout << n - even[0] - odd[0] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  string a, b, c;
  cin >> a >> b >> c;

  if (a.back() == b.front() && b.back() == c.front()) cout << "YES\n";
  else cout << "NO\n";

  return (0);
}


Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var sc = new Scanner();
            int[] a = new int[5];
            for (int i = 0; i < a.Length; i++) a[i] = sc.NextInt();

            int time = 0;
            a = a.OrderBy(p => p % 10).ToArray();

            int k = 0;
            while (k < a.Length && a[k] % 10 == 0) time += a[k++];
            if (k < a.Length) time += a[k++];
            while (k < a.Length)
                time += (int)Math.Ceiling(a[k++] / 10.0) * 10;


            Console.WriteLine(time);
        }
    }

    class Scanner
    {
        int index = -1;
        string[] buf;

        public Scanner()
        {
        }

        public int NextInt()
        {
            CheckNext();
            return int.Parse(buf[index++]);
        }

        public string NextString()
        {
            CheckNext();
            return buf[index++];
        }

        private void CheckNext()
        {
            if (index >= 0 && index < buf.Length) return;

            buf = Console.ReadLine().Split(' ');
            index = 0;
        }
    }
}


Measured memory_bytes: 13268
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

struct Node {
	int value;
	vector<int>edges;
	Node() :value(0), edges() {

	}
};
struct aa {
	int value;
	int amin;
	int amax;
};
map<int, int>mp;

aa memo[100][202][202];
aa getans(const int now,const vector<Node>&ns,const int alp,const int bet) {
	if (memo[now][mp[alp]][mp[bet]].amax != -1)return memo[now][mp[alp]][mp[bet]];
	else {
		Node no(ns[now]);
		if (no.edges.empty())return memo[now][mp[alp]][mp[bet]]=aa{ ns[now].value,1,1 };
		else {
			int realvalue = -1e9;
			{
				int nalp = alp;
				int nbet = bet;
				for (int i = 0; i < no.edges.size(); ++i) {
					aa ans = getans(no.edges[i], ns, -nbet, -nalp);
					realvalue = max(realvalue, -ans.value);
				}
			}
			aa ret{ realvalue,int(1e9),int(-1e9) };
			vector<int>perms(no.edges.size());
			iota(perms.begin(), perms.end(), 0);
			do {
				int amintime = 0;
				int nalp = alp;
				int nbet = bet;
				int amaxtime = 0;
				for (int i = 0; i < no.edges.size(); ++i) {
					aa ans = getans(no.edges[perms[i]], ns, -nbet, -nalp);
					amintime += ans.amin;
					amaxtime += ans.amax;
					if (-ans.value >= nbet) {
						break;
					}
					else if (-ans.value > nalp) {
						nalp = -ans.value;
					}
				}
				ret.amin = min(ret.amin, amintime);
				ret.amax = max(ret.amax, amaxtime);
			} while (next_permutation(perms.begin(), perms.end()));
			return memo[now][mp[alp]][mp[bet]]=ret;
		}
	}
}

int main() {
	int N; cin >> N;
	for (int i = 0; i < 100; ++i) {
		for (int j = 0; j < 202; ++j) {
			for (int k = 0; k < 202; ++k) {
				memo[i][j][k] = aa{ -1,-1,-1 };
			}
		}
	}
	vector<Node>nodes(N);
	vector<int>nums;
	for (int i = 0; i < N; ++i) {
		int a; cin >> a;
		nodes[i].value = a;
		nums.emplace_back(a);
		nums.emplace_back(-a);
	}
	nums.emplace_back(int(1e9));
	nums.emplace_back(int(-1e9));
	sort(nums.begin(), nums.end());
	nums.erase(unique(nums.begin(), nums.end()), nums.end());
	for (int i = 0; i < nums.size(); ++i) {
		mp[nums[i]] = i;
	}
	for (int i = 0; i < N; ++i) {
		int k; cin >> k;
		for (int j = 0; j < k; ++j) {
			int a; cin >> a; a--;
			nodes[i].edges.push_back(a);
		}
	}
	aa ans=getans(0, nodes, int(-1e9), int(1e9));
	cout << ans.amin <<" "<< ans.amax<< endl; 
	return 0;
}

Measured memory_bytes: 50964