akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final Scanner sc    = new Scanner(System.in);
    static final int     MOD   = (int) 1E9 + 7;
    static final long    INF_L = (long) 4E18;

    public static void main(String[] args) {
        int n = nint();
        int[] a = nints(n);
        
        long ans = min(solve(a, false), solve(a, true));
        System.out.println(ans);
    }
    
    static long solve(int[] a, boolean posSum_) {
        boolean posSum = posSum_; // trueなら偶数項目(0-indexed)までの和が正であるべき
        long sum = 0;
        long count = 0;
        
        for (int i = 0; i < a.length; i++) {
            long sumBuff = sum;
            sum += a[i];
            if (posSum && sum > 0 || !posSum && sum < 0) {
                // do nothing
            } else {
                sum = posSum ? 1 : -1;
                count += abs(-a[i] + sum - sumBuff);
            }
            posSum = !posSum;
        }
        return count;
    }

    @Deprecated
    static int nint() {
        return sc.nextInt();
    }

    @Deprecated
    static int[] nints(int N) {
        return nints(N, 0, 0);
    }

    @Deprecated
    private static int[] nints(int N, int padL, int padR) {
        int[] a = new int[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nint();
        return a;
    }

    static long nlong() {
        return sc.nextLong();
    }

    static long[] nlongs(int N) {
        return nlongs(N, 0, 0);
    }

    static long[] nlongs(int N, int padL, int padR) {
        long[] a = new long[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nlong();
        return a;
    }

    static double ndouble() {
        return sc.nextDouble();
    }

    static double[] ndoubles(int N) {
        return ndoubles(N, 0, 0);
    }

    static double[] ndoubles(int N, int padL, int padR) {
        double[] d = new double[N + padL + padR];
        for (int i = 0; i < N; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    static String nstr() {
        return sc.next();
    }

    static char[] nchars() {
        return sc.next().toCharArray();
    }

    static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    static char[][] nchars2(int H, int W) {
        return nchars2(H, W, 0, 0);
    }

    static char[][] nchars2(int H, int W, int padLU, int padRD) {
        char[][] a2 = new char[H + padLU + padRD][W + padLU + padRD];
        for (int i = 0; i < H; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, W);
        return a2;
    }

    static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    static long abs(long a) {
        return Math.abs(a);
    }
}


Measured memory_bytes: 51784
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
#define DEKAI 1000000007
#define INF (1<<28)
/* ┗(^o^)┛ｗｗｗｗｗ┏(^o^)┓ﾄﾞｺﾄﾞｺﾄﾞｺﾄﾞｺｗｗｗｗｗ */
int pr[11000000];
signed main(){
	int n;
	cin>>n;
	int ans=0,before=1;
	lp(i,n+3){
		if(i<2) continue;
		if(pr[i]==0){
			for(int j=i;j<=n+3;j+=i){
				pr[j]=1;
			}
			if(i-before==2) ans++;
			before=i;
		}
	}
	cout<<ans*2<<endl;
  	return 0;
}


Measured memory_bytes: 81212
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
using ll = long long;
using Graph = vector<vector<int>>;
const int INF = 1e8;
int main(){
    int n,k; cin >> n >> k;
    cout << n-k+1 << endl;
}

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

int main() {
    string s;
    int k;
    cin >> s >> k;

    int len = (int)s.size();
    string t = s + s;

    int64_t cnt_s = 0;
    for (int i = 1; i < len; i++) {
        if (s.at(i - 1) == s.at(i)) {
            cnt_s++;
            i++;
        }
    }

    int64_t cnt_t = 0;
    for (int i = 1; i < len * 2; i++) {
        if (t.at(i - 1) == t.at(i)) {
            cnt_t++;
            i++;
        }
    }
    
    string u = s + s + s;
    int64_t cnt_u = 0;
    for (int i = 1; i < len * 3; i++) {
        if (u.at(i - 1) == u.at(i)) {
            cnt_u++;
            i++;
        }
    }
    
    int64_t ans = cnt_s + (cnt_u - cnt_t) * ((k - 1) / 2) + (cnt_t - cnt_s) * ((k - 1) - (k - 1) / 2);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
typedef long long ll;
using namespace std;

int n;
vector<int> a;

void dfs(ll x) {
    if (x > n) return;
    a.push_back(x);
    for (int i = 3; i <= 7; i+=2) {
        dfs(10*x+i);
    }
}

int ctoi(char c) {
    switch (c){
        case '1':
            return 1;
            break;
        case '2':
            return 2;
            break;
        case '3':
            return 3;
            break;
        case '4':
            return 4;
            break;
        case '5':
            return 5;
            break;
        case '6':
            return 6;
            break;
        case '7':
            return 7;
            break;
        case '8':
            return 8;
            break;
        case '9':
            return 9;
            break;
        case '0':
            return 0;
            break;
    }
}

bool judge (int i) {
    string s = to_string(a[i]);
    vector<bool> f(10);
    fill(f.begin(), f.end(), false);
    for (int j = 0; j < s.length(); ++j) f[ctoi(s[j])] = true;
    if (f[3] && f[5] && f[7]) return true;
    else return false;
}

int main(int argc, char const *argv[]) {
    cin >> n;
    if (n > 777777777) n = 777777777;
    dfs(0);
    int c = 0;
    for (int i = 1; i < a.size(); ++i) {
        if (judge(i)) c++;
    }
    cout << c << std::endl;
    return 0;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[List[int]]"):
    if N == 1:
        print(A[0][0] + A[1][0])
        return
    for i in range(1,N):
        A[0][i] += A[0][i-1]

    A[1][0] += A[0][0]
    for i in range(1, N):
        p = A[1][i] + A[0][i]
        q = A[1][i] + A[1][i-1]
        A[1][i] = max(p, q)
    print(A[1][N-1])

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [[int(next(tokens)) for _ in range(N)] for _ in range(2)]  # type: "List[List[int]]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 62168
int main() {
	int a, b, c;
	int max, mid, min;
	scanf("%d %d %d", &a, &b, &c);

	if (a<=b && b<=c) {
		max = c;
		mid = b;
		min = a;
	}
	if (a<=c && c<=b) {
		max = b;
		mid = c;
		min = a;
	}
	if (b<=a && a<=c) {
		max = c;
		mid = a;
		min = b;
	}
	if (c<=a && a<=b) {
		max = b;
		mid = a;
		min = c;
	}
	if (b<=c && c<=a) {
		max = a;
		mid = c;
		min = b;
	}
	if (c<=b && b<=a) {
		max = a;
		mid = b;
		min = c;
	}
	
	printf("%d %d %d\n", min, mid, max);
	return 0;
}

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

#define rep(i,n) for(int i=0; i<n; i++)



int main(){
  int n;

  string s;
  cin >> n;
  cin >> s;

  
  long int sr=0, sg=0, sb=0;
  vector<int> r, g, b;
  for(int i=0; i<n; i++){
    if(s[i]=='R'){
      r.push_back(i);
      sr++;
    }else if(s[i]=='G'){
      g.push_back(i);
      sg++;
    }else{
      b.push_back(i);
      sb++;
    }
  }

  long int sum = 0;
  for(int i=0;i<sr; i++){
    for(int j=0;j<sg; j++){
      int x,y;
      if(r[i]>g[j]){
        x = g[j]; y = r[i];
      }else{
        x = r[i]; y = g[j];
      }
      int aa,bb,cc;
      aa = 2*x-y; 
      bb = (y+x)/2;
      cc = 2*y - x;

      sum += sb;

      decltype(b)::iterator it;
      it = lower_bound(b.begin(), b.end(), aa);
      if(it != b.end() && *it == aa)sum--;

      it = lower_bound(b.begin(), b.end(), bb);
      if((y+x)%2==0 &&  it != b.end() && *it == bb)sum--;

      it = lower_bound(b.begin(), b.end(), cc);
      if(it != b.end() && *it == cc)sum--;    
    }
  }
  cout << sum << endl;
  return 0;
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll maxh;
    cin >> maxh;

    bool flg=true;

    for (ll i = 1; i < n; ++i){
        ll h;
        cin >> h;
        if(maxh>h+1) flg=false;
        
        maxh = max(maxh, h);
    }
    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int N,a[3][3],b[10],i,j,k,f=0,g=0,h=0,flag=0;
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			scanf("%d",&a[i][j]);
		}
	}
	scanf("%d",&N);
	for(k=0;k<N;k++){
		scanf("%d",&b[k]);
	}
	
	
	for(i=0;i<3;i++){
		for(k=0;k<N;k++){
			if(a[i][0]==b[k]){
				f=1;
				break;
			}
		}
		if(f==1){
			for(k=0;k<N;k++){
				if(a[i][1]==b[k]){
					f=2;
					break;
				}
			}
		}
		if(f==2){
			for(k=0;k<N;k++){
				if(a[i][2]==b[k]){
					f=3;
					break;
				}
			}
		}
		if(f==3){
			flag=1;
			break;
		}
		f=0;
	}
	
if(f!=3){
	for(i=0;i<3;i++){
		for(k=0;k<N;k++){
			if(a[0][i]==b[k]){
				g=1;
				break;
			}
		}
		if(g==1){
			for(k=0;k<N;k++){
				if(a[1][i]==b[k]){
					g=2;
					break;
				}
			}
		}
		if(g==2){
			for(k=0;k<N;k++){
				if(a[2][i]==b[k]){
					g=3;
					break;
				}
			}
		}
		if(g==3){
			flag=1;
			break;
		}
		g=0;
	}
}
	
if(g!=3){
		for(k=0;k<N;k++){
			if(a[0][0]==b[k]){
				h=1;
				break;
			}
		}
		if(h==1){
			for(k=0;k<N;k++){
				if(a[1][1]==b[k]){
					h=2;
					break;
				}
			}
		}
		if(h==2){
			for(k=0;k<N;k++){
				if(a[2][2]==b[k]){
					h=3;
					break;
				}
			}
		}
		if(h==3){
			flag=1;
		}
	if(h!=3){
		h=0;
		for(k=0;k<N;k++){
			if(a[0][2]==b[k]){
				h=1;
				break;
			}
		}
		if(h==1){
			for(k=0;k<N;k++){
				if(a[1][1]==b[k]){
					h=2;
					break;
				}
			}
		}
		if(h==2){
			for(k=0;k<N;k++){
				if(a[2][0]==b[k]){
					h=3;
					break;
				}
			}
		}
		if(h==3){
			flag=1;
		}
	}
}
	
	if(flag==1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define size(a) int(a.size())

const ll mod = 1e9 + 7;
const ll inf = ll(1e18);
const double PI = acos(-1);

ll modexp(ll x,ll n,ll md){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%md,n/2,md);
    return (x*modexp((x*x)%md,n/2,md))%md;
}

int main(){
    fastio;
    //clock_t tm = clock();
    vi a(3);
    cin>>a[0]>>a[1]>>a[2];
    sort(all(a));
    if((a[0]==a[1] and a[1]!=a[2]) or (a[1]==a[2] and a[0]!=a[1])){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    A=[int(i) for i in input().split()]

    res = 1000
    for i in A:
        tmp = i
        cnt = 0
        while(tmp%2==0):
            tmp//=2
            cnt+=1
        res = min(res,cnt)
    print(res)
if __name__ == '__main__':
    main()


Measured memory_bytes: 9120
program popular_vote
  implicit none
  integer :: n, m, i
  real(8) :: a(100) = 0.d0, x
  read(*,*) n, m
  read(*,*) a(1:n)
  x = sum(a(1:n))/(4.d0*m)
  do i = 1, n
    if (a(i) >= x) m = m-1
  end do
  if (m > 0) then
    write(*,'(a)') "No"
  else
    write(*,'(a)') "Yes"
  end if
end program popular_vote

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
  	string s,t;
  	cin>>s>>t;
  	ll m=s.length();
  	ll n=t.length();
  	ll dp[m+1][n+1];
  	for(ll e=0;e<=m;e++)
  	{
  		for(ll w=0;w<=n;w++)
  		{
  			if(e==0||w==0)
  			{
  				dp[e][w]=0;
  				continue;
  			}
  			if(s[e-1]==t[w-1])
  			{
  				dp[e][w]=1+dp[e-1][w-1];
  			}
  			else
  			{
  				dp[e][w]=max(dp[e-1][w],dp[e][w-1]);
  			}
  		}
  	}
  	ll i=m;
  	ll j=n;
  	string fg;
  	while(i>0&&j>0)
  	{
  		if(s[i-1]==t[j-1])
  		{
  			fg.push_back(s[i-1]);
  			i--;
  			j--;
  		}
  		else if(dp[i-1][j]>dp[i][j-1])
  		{
  			i--;
  		}
  		else
  		{
  			j--;
  		}
  	}
  	for(ll w=fg.size()-1;w>=0;w--)
  	{
  		cout<<fg[w];
  	}
  	//cout<<endl;
}

Measured memory_bytes: 70656
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define eps 1e-9
#define oo 1e7+5

using namespace std;

typedef unsigned long long ull;
typedef vector<pair<int,pair<int,int>>> dirgraph;
typedef vector<vector<int>> graph;

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	
	string s,t;
	cin>>s>>t;

	int ans=0;
	for(int i=0;i<s.length();i++){
		if(s[i]!=t[i])
			ans++;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3816
#include<iostream>
#include<ctime>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<climits>
#include<cstring>
#include<iomanip>
#include<string>
#include<bitset>
#include<unordered_map>
#include<unordered_set>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<algorithm>
#include<functional>
#include<chrono>
//#include<windows.h>
//#include<direct.h>
#include<random>
#include<sstream>

#define y0 asdahsdlkahsdad
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define taskname "LotusLeaves"
//#define BeztDonkey

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

const int maxV = 202, maxE = 1e4, maxC = maxV;

struct TEdge
{
    int u, v, cf;
} e[maxE << 1];
vector<int> adj[maxV];
int trace[maxV], h, w, s, t, E, flowVal;

inline void AddEdge(int u, int v, int c)
{
    adj[u].push_back(E); e[E++] = {u, v, c};
    adj[v].push_back(E); e[E++] = {v, u, c};
}

void Inp()
{
    cin >> h >> w;
    s = h + w;
    t = s + 1;
    E = 0;
    for (int i = 0; i < h; ++i)
    {
        string tmp;
        cin >> tmp;
        for (int j = 0; j < w; ++j)
            if (tmp[j] == 'o') AddEdge(i, j + h, 1);
            else if (tmp[j] == 'S') AddEdge(s, i, maxC), AddEdge(s, j + h, maxC);
            else if (tmp[j] == 'T') AddEdge(i, t, maxC), AddEdge(j + h, t, maxC);
    }
}

inline bool FindAumentingPath()
{
    memset(trace, -1, sizeof trace);
    queue<int> q({s});
    trace[s] = -2;
    while (!q.empty())
    {
        int u = q.front(), v; q.pop();
        for (int i : adj[u])
        {
            if (e[i].cf == 0 || trace[v = e[i].v] != -1) continue;
            trace[v] = i;
            if (v == t) return 1;
            q.push(v);
        }
    }
    return 0;
}

inline void AugmentFlow()
{
    int del = maxC, i;
    for (int u = t; (i = trace[u]) != -2; u = e[i].u) del = min(del, e[i].cf);
    for (int u = t; (i = trace[u]) != -2; u = e[i].u)
        e[i].cf -= del, e[i ^ 1].cf += del;
    flowVal += del;
}

void Solve()
{
    flowVal = 0;
    while (FindAumentingPath()) AugmentFlow();
    cout << (flowVal >= maxC ? -1 : flowVal);
}

int main()
{
    #ifdef BeztDonkey
    auto start = chrono::steady_clock::now();
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen(taskname".inp", "r", stdin);
    //freopen(taskname".out", "w", stdout);

    Inp();
    Solve();

    #ifdef BeztDonkey
    auto end = chrono::steady_clock::now();
    cerr << "In milliseconds : "
         << chrono::duration_cast<chrono::milliseconds>(end - start).count();
    cerr << '\n' << "In seconds : "
         << chrono::duration_cast<chrono::seconds>(end - start).count() << '\n';
    #endif
    return 0;

}


Measured memory_bytes: 640
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var nums [3]int

	for i, _ := range nums {
		var s int
		fmt.Scanf("%d", &s)
		nums[i] = s
	}

	sort.Ints(nums[:])

	var numStrs []string
	for _, n := range nums {
		numStrs = append(numStrs, fmt.Sprintf("%d", n))
	}

	fmt.Println(strings.Join(numStrs, " "))
}



Measured memory_bytes: 1148
#include <bits/stdc++.h>
#define ll long long
const int mod=1e9+7;
const int maxn=2e5+7;
using namespace std;

int main(){
    ll n,k;
    ll ansa,ansb,ansc,xx,yy;
    ll ans=mod;
    cin>>n>>k;
    if(n%3==0||k%3==0){
        cout<<0<<endl;
    }
    else{
        for(int i=1;i<=n;i++){
            ansa=i*k;
            xx=(n-i)/2;
            yy=n-i-xx;
            ansb=xx*k;
            ansc=yy*k;
            ans=min(ans,max(ansa,max(ansb,ansc))-min(ansa,min(ansb,ansc)));
            xx=k*1.0/2;
            yy=k-xx;
            ansb=xx*(n-i);
            ansc=yy*(n-i);
            ans=min(ans,max(ansa,max(ansb,ansc))-min(ansa,min(ansb,ansc)));
        }
        swap(k,n);
        for(int i=1;i<=n;i++){
            ansa=i*k;
            xx=(n-i)/2;
            yy=n-i-xx;
            ansb=xx*k;
            ansc=yy*k;
            ans=min(ans,max(ansa,max(ansb,ansc))-min(ansa,min(ansb,ansc)));
            xx=k*1.0/2;
            yy=k-xx;
            ansb=xx*(n-i);
            ansc=yy*(n-i);
            ans=min(ans,max(ansa,max(ansb,ansc))-min(ansa,min(ansb,ansc)));
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}

int main()
{
	int n;
	cin>>n;
	vector<int> l(n);
	rep(i,n)cin>>l[i];
	sort(all(l));
	// reverse(all(l));

	// rep(i,n)cout<<l[i]<<" ";
	// cout<<endl;

	ll ans=0;
	for (int i = n-1; i >= 0; i--){
		for (int j = i-1; j >= 0; j--){
			int e = l[i]-l[j];
			int pos=upper_bound(all(l),e)-l.begin();
			// cout<<e<<" "<<l[pos-1] <<" "<<pos<<endl;

			ans += max(j-pos,0);
			
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int x,y,i,j;
   while(1){
      scanf("%d %d",&y,&x);
      if(x+y==0){
          break;
      }
      for(i=0;i<y;i++){
         for(j=0;j<x;j++)
            if((i+j)%2==0){
               printf("#");
            }else{
            printf(".");
            }
         printf("\n");
      }
   printf("\n");
   }
   return 0;
}


Measured memory_bytes: 2080
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x[] = new int[5];
        for (int i = 0; i < 5; i++) {
            x[i] = s.nextInt();
        }
        for (int i = 0; i < 5; i++) {
            if (x[i] == 0) {
                System.out.println(i + 1);
            }
        }
        s.close();
    }
}

Measured memory_bytes: 35692
#include <iostream>
#include <string>
using namespace std;
int main(){
	//freopen("test", "r", stdin);
	ios::sync_with_stdio(false);
	string M1, D1, M2, D2;
	cin >> M1 >> D1 >> M2 >> D2;	
	int flag = 0;
	if(M1 == "1"){
		if(D1 == "31") flag = 1; 	
	}else if(M1 == "2"){
		if(D1 == "28") flag = 1;
	}else if(M1 == "3"){
		if(D1 == "31") flag = 1;
	}else if(M1 == "4"){
		if(D1 == "30") flag = 1;
	}else if(M1 == "5"){
		if(D1 == "31") flag = 1;
	}else if(M1 == "6"){
		if(D1 == "30") flag = 1;
	}else if(M1 == "7"){
		if(D1 == "31") flag = 1;
	}else if(M1 == "8"){
		if(D1 == "31") flag = 1;
	}else if(M1 == "9"){
		if(D1 == "30") flag = 1;
	}else if(M1 == "10"){
		if(D1 == "31") flag = 1;
	}else if(M1 == "11"){
		if(D1 == "30") flag = 1;
	}else if(M1 == "12"){
		if(D1 == "31") flag = 1;
	}
	cout << flag;
	
	
	return 0;
}


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


int main(){
  int N;
  cin>>N;
  vector<ll> a(N);
  ll fu=0;
  ll gokei=0;
  ll saisyo=10e10;
  for(int i=0;i<N;i++){
    cin>>a[i];
    gokei+=abs(a[i]);
    saisyo=min(saisyo,abs(a[i]));
    if(a[i]<0) fu++;
  }
  
  if(fu%2==0){
    cout<<gokei<<endl;
  }else{
    cout<<gokei-2*saisyo<<endl;
  }

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
using namespace std;
 
int main() {
  int a, b;
  int n;
     
  while( cin >> a >> b >> n )  {
    int s = 0;
    for( int i = 0; i < n; i ++ ) {
      a = a % b * 10;
      s += a / b;
    }
 
    cout << s << endl;
  }
   
  return 0;
}


Measured memory_bytes: 3080
/*program by mangoyang*/
#include<bits/stdc++.h>
#define inf (0x7f7f7f7f)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;
using namespace std;
template <class T>
inline void read(T &x){
    int f = 0, ch = 0; x = 0;
    for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = 1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
    if(f) x = -x;
}
#define int ll
main(){
	int n, m, k, ans = inf; read(n), read(k);
	for(int i = 1; i <= n; i++){
		int x; read(x); if(x == 1) m = i;
	}
	for(int i = 1; i <= k; i++){
		int RR = n - (m + k - i), LL = m - i;
		if(LL < 0 || RR < 0) continue;
		int nl = (LL % (k - 1) == 0) ? LL / (k - 1) : LL / (k - 1) + 1;
		int nr = (RR % (k - 1) == 0) ? RR / (k - 1) : RR / (k - 1) + 1; 
		ans = Min(ans, nl + nr + 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
#from collections import deque
#import heapq
#from fractions  import gcd

#input=sys.stdin.readline
mod=1000000007
n=int(input())
s=[input() for _ in range(2)]
d=[]
i=0
while i<n:
    if s[0][i]==s[1][i]:
        d.append(1)
        i+=1
    else:
        d.append(2)
        i+=2
m=len(d)
ans=0
if d[0]==1:
    ans=3
if d[0]==2:
    ans=6
for i in range(1,m):
    if d[i]==1:
        if d[i-1]==2:
            ans*=1
        else:
            ans*=2
    else:
        if d[i-1]==2:
            ans*=3
        else:
            ans*=2
    ans=ans%mod
print(ans%mod)

Measured memory_bytes: 38384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MAX = 2000000;
const ll MOD = 1000000007;
ll n,k;

ll 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;
    }
}

ll 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();
    cin >> n >> k;
    ll a[n];
    priority_queue<ll> apq1;
    priority_queue<ll,vector<ll>,greater<ll>> apq2;
    ll res = 0;
    for(ll i=0;i<n;i++){
        ll a;
        cin >> a;
        apq1.push(a);
        apq2.push(a);
    }
    for(ll ii=0;ii<n;ii++){
        if(ii>=k-1){
            ll a1 = apq1.top();
            ll a2 = apq2.top();
            res = (res + ((com(ii,k-1) * ((a2 - a1) % MOD)) % MOD))%MOD;
        }
        apq1.pop();
        apq2.pop();
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 48884
N=int(input())
table=[[None]*N for _ in range(N)]
for i in range(N):
    a=int(input())
    for j in range(a):
        x,y=map(int, input().split())
        table[i][x-1]=y

def is_consistent(table,hito):
    flag=True
    for i in range(len(hito)):
        if hito[i]==0:
            continue
        elif hito[i]==1:
            for j in range(len(hito)):
                if table[i][j]==None:
                    continue
                elif table[i][j]!=hito[j]:
                    flag=False
                    break
        if flag==False:
            break
    return flag
  
ans=0
for i in range(0,2**N):
    length=len(bin(i)[2:])
    hito=[]
    for j in range(length):
        hito.append(int(bin(i)[2:][-j-1]))
    for j in range(N-length):
        hito.append(0)
    hito.reverse()
    if is_consistent(table,hito):
        ans=max(ans,sum(hito))
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int main(){
	char ss[250];
	int i,c;
	c=0;
	while(0<=scanf("%s",ss)){
		for(i=0;i<=strlen(ss)-1;i++){
			if(ss[i]!=ss[strlen(ss)-i-1])break;
		}
		
		if(i==strlen(ss))++c;
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, a, t = 0, mi, x, c = 0;
    cin >> n >> m;
    mi = 2 * n;
    rep(i, m) {
        cin >> a >> x;
        mi = min(mi, a);
        if(a < n) {
            t += n - a;
            c++;
        }
    }
    if(c > 0) t -= n - mi;
    cout << t << endl;
}


Measured memory_bytes: 3160
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

  public static void main(String[] args) {
    // TODO 自動生成されたメソッド・スタブ
    Scanner scanner = new Scanner(System.in);
    Set<Integer> set = new HashSet<Integer>(Arrays.asList(1, 2, 3));
    int number1 = scanner.nextInt();
    int number2 = scanner.nextInt();
    set.remove(number1);
    set.remove(number2);
    for (Integer integer : set) {
      System.out.println(integer);
    }
  }

}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
#define light ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pb push_back
#define cases() ll t;cin>>t;while(t--)
#define all(c) c.begin(),c.end()
#define PI 3.14159265358979323846
const ll MAX = 1e6+5;
const ll INF = 1e18;
const ll MOD = 1e9+7;

ll a[MAX];

void sieve(ll n) 
{
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime));
    
    for (ll p=2; p*p<=n; p++) 
    {
        if (prime[p] == true) 
        {
            for (ll i=p*p; i<=n; i += p) 
            {
                a[i]=p;
                prime[i]=false;
            }
        }
    }
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          a[p]=p;
}

int main()
{
    ll n,i,j,k,l,p,q;
    sieve(MAX);
    cin >> n;
    l = 1;
    map<ll,ll> mp;
    for(i=2;i<=n-1;i++)
    {
        mp.clear();
        p = i;
        while(p!=1)
        {
            mp[a[p]]++;
            p = p/a[p];
        }
        p = 1;
        for(auto z:mp)
        {
            p=(p*((z.second)+1));
        }
        l+=p;
    }
    cout << l;
}

Measured memory_bytes: 12420
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{ int n;
  cin >> n;
 long long s=0;
 for(int i=0;i<=n;i++)
 { if(i%3==0 || i%5==0)
      {continue;}
   else 
   {s=s+i;}}
  cout << s <<endl;
 return 0;}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map> // pair
#include <set>
#include <string>

#define MAXSIZE 200000
#define PI 3.141592653589
using namespace std;




int main(){
  string s;
  std::cin >> s;


  for(int i=s.size()-1;i>=0;i--){
    std::cout << s[i];
  }

  std::cout  << '\n';
}



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

int main() {
  string N;
  
  cin >> N;
  
  if (N[0] == N[1] && N[1] == N[2]) {
    cout << "Yes" << endl;
  }
  else if (N[1] == N[2] && N[2] == N[3]) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)

a = Array.new(n){Array.new(m, 0)}
b = Array.new(m, 0)

n.times do |i|
  a[i] = gets.split.map(&:to_i)
end

m.times do |i|
  b[i] = gets.to_i
end

n.times do |i|
  c = 0
  m.times do |j|
    c += a[i][j] * b[j]
  end
  puts c
end

Measured memory_bytes: 8948
a, b, c, d = map(int, input().split())

if  a < c < b and c < b < d:
    print(b-c)
elif c < a < d and a < d < b:
    print(d-a)
elif a < c < d < b:
    print(d-c)
elif c < a < b < d:
    print(b-a)
elif a == c:
    print(min(b, d))
elif b == d:
    print(min(b-a,d-c))
else:
    print(0)

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

using ll = long long;

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

    ll h;
    cin>>h;

    int cnt=0;
    while(h!=1)
    {
        h/=2;
        cnt++;
    }

    ll ans=pow(2,cnt+1)-1;

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3964
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <sstream>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define SIZE 300005
#define INF INT_MAX / 3
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<=(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());
#define SQ(x) ((x)*(x))

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;

/////

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int T[8];
  vector<int> a(4);
  vector<int> b(4);
  int i = 0;
  while(cin >> T[i])
  {
    i = (i+1)%8;
    if(i == 0)
    {
      REP(i,4) a[i] = T[i];
      REP(i,4) b[i] = T[i+4];
      int hit = 0, blow = 0;
      REP(i,4) hit += (a[i] == b[i]);
      REP(i,4) blow += (find(ALL(b),a[i])!=b.end());
      cout << hit << " " << blow-hit << endl;
    }
  }

}

Measured memory_bytes: 1196
n,k,q=map(int,input().split())
x=list(int(input()) for _ in range(q))

p=[0]*n

for i in range(q):
	p[x[i]-1]+=1
    
for i in range(n):
	if k-q+p[i]<=0:
		print('No')
	else:
		print('Yes')

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

int main (){
    int A, B, C, D, E;
    string S, P, Q;
    cin >> A >> B >> C >> D >> E;

    cout << 15 - A - B - C - D - E << endl;
    if(0){
        if(1){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    if(0){
        if(1){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 3608
<?php

$box = explode(" ",fgets(STDIN));

$change = $box[0];
$box[0] = $box[1];
$box[1] = $change;

$change = $box[0];
$box[0] = $box[2];
$box[2] = $change;

echo "{$box[0]} {$box[1]} {$box[2]}";
 ?>


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll h,w;
    cin>>h>>w;

    Vs grid(h);
    rep(i,h) cin>>grid[i];

    ll bc = 0;
    ll wc = 0;
    rep(i,h){
        rep(j,w){
            if(grid[i][j]=='.'){
                wc++;
            }else{
                bc++;
            }
        }
    }

    VV dist(h,Vec(w));
    rep(i,h)rep(j,w){
            dist[i][j] = INF;
        }
    queue<P> q;
    ll si,sj;
    si = sj = 0;

    Vec di(4);
    di = {1,0,-1,0};
    Vec dj(4);
    dj = {0,1,0,-1};

    q.push(mp(si,sj));
    dist[si][sj] = 0;
    while (!q.empty()){
        P p = q.front();
        q.pop();
        rep(k,4){
            ll ni = p.fi+di[k];
            ll nj = p.se+dj[k];
            if(ni==-1||ni==h||nj==-1||nj==w)continue;
            if(grid[ni][nj]!='.')continue;
            if(dist[ni][nj]>dist[p.fi][p.se]+1){
                dist[ni][nj] = dist[p.fi][p.se]+1;
                q.push(mp(ni,nj));
            }
        }
    }
    ll ans = h*w-dist[h-1][w-1]-bc-1;
    if(dist[h-1][w-1]==INF){
        ans = -1;
    }
    cout<<ans<<endl;
    return  0;
}


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

typedef uint32_t u32;
typedef uint64_t u64;
typedef std::pair<int, int> pii;

int main() {

  for(;;) {
    int N;
    std::cin >> N;
    if( N == 0 ) break;

    std::vector<std::pair<double, std::string> > vp;
    
    std::string L;
    int P, A, B, C, D, E, F, S, M;
    for(int i = 0; i < N; ++i) {
      std::cin >> L >> P >> A >> B >> C >> D >> E >> F >> S >> M;
      double efficiency = (double)(F * S * M - P) / (A + B + C + (D + E) * M);
      vp.push_back(std::pair<double, std::string>(-efficiency, L));
    }
    std::sort(std::begin(vp), std::end(vp));
    for(auto A : vp) {
      std::cout << A.second << std::endl;
    }
    std::cout << '#' << std::endl;
  }

  return 0;
}

Measured memory_bytes: 3104
#include<iostream>
using namespace std;

char s[30];

int main(){
	int a,b; cin>>a>>b;
	cin>>s;
	if(s[a]!='-') { cout<<"No"<<endl; return 0; }
	else{
		for(int i=0;i<=a+b;i++)
			if(i!=a&&(s[i]<'0'||s[i]>'9')) { cout<<"No"<<endl; return 0; }
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

int main() {
	int a,b,c;
    cin>>a>>b;
  if((b-a)%2==0){
  cout<<((b-a)/2)+a<<endl;
  }
  else
    cout<<"IMPOSSIBLE"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m;
	scanf("%d",&m);
	int a[m+1],b[m];
	for(int i=0;i<m+1;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=0;i<m;i++)
	{
		scanf("%d",&b[i]);
	}
	long long s=0;
	for(int i=0;i<m;i++)
	{
		if(a[i]>=b[i])
		{
			s+=b[i];
			continue;
		}
		if(a[i]+a[i+1]>b[i])
		{
			s+=b[i];
			a[i+1]=a[i]+a[i+1]-b[i];
			continue;
		}
		if(a[i]+a[i+1]<=b[i])
		{
			s+=a[i]+a[i+1];
			a[i+1]=0;
			continue;
		}
	}
	printf("%lld\n",s);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(i) sort((i).begin(),(i).end())
int main() {
	int a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 0) {
		cout << (a + b) / 2 << endl;
	}
	else {
		cout << (a + b) / 2 + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100005;
int n,m,a[N],b[N],f[N],id[N],vis[N];
ll sum[N],cnt[N];
vector<int> e[N]; 
bool cmp(int x,int y){
	return a[x]<a[y];
} 
int find(int x){
	if(x==f[x])return x;
	return f[x]=find(f[x]);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
		a[i]=max(a[i]-b[i],0);
		cnt[i]=a[i],sum[i]=b[i];
		f[i]=id[i]=i;vis[i]=0;
	}
	for(int i=1;i<=m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	sort(id+1,id+n+1,cmp);
	for(int i=1;i<=n;i++){
		int x=id[i];
		vis[x]=1;
		for(int j=0;j<e[x].size();j++){
			int y=e[x][j];
			if(vis[y]){
				int rx=find(x),ry=find(y);
				if(rx!=ry){
					f[ry]=rx;
					sum[rx]+=sum[ry];
					cnt[rx]=min(cnt[rx],cnt[ry]+max(0LL,a[rx]-cnt[ry]-sum[ry]));
				}
			}
		}
	}
	printf("%lld",cnt[id[n]]+sum[id[n]]);
	return 0;
}

Measured memory_bytes: 12852
#include<iostream> 
#include<stdio.h>
#include<string>
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (n); ++i)	
//setprecision(16)

void outi(int x) { cout << x << endl; }
void outl(ll x) { cout << x << endl; }
void outs(string x) { cout << x << endl; }
ll max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
ll min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}
//---------------------------------------------------------------

int main() {
	int k;
	string s;
	cin >> k >> s;

	if (s.size() <= k) {
		outs(s);
	}
	else {
		outs(s.substr(0, k)+"...");
	}
}

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

int ac, wa, tle, re;

int main(void)
{
    int n;
    string s;

    scanf("%d" ,&n);

    while(n--)
    {
        cin >> s;
        if(s=="AC")
            ac++;
        else if(s=="WA")
            wa++;
        else if(s=="TLE")
            tle++;
        else re++;
    }

    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d" ,ac, wa, tle, re);
    return 0;
}


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

int main()
{
	ios::sync_with_stdio(false);
	int odd,even,sum=0,odd_sum=0,even_sum=0;
	cin>>even>>odd;
    even_sum=even*(even-1)/2;
    odd_sum=odd*(odd-1)/2;
    sum=even_sum+odd_sum;
    cout<<sum;
	return 0;
} 

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

int main(){
  long long int n, m;
  cin >> n >> m;
  if(n == 1 && m == 1){
    cout << 1 << endl;
    return 0;
  }else if(n == 1 && m != 1){
    cout << m - 2 << endl;
    return 0;
  }else{
    cout << abs((n - 2) * (m - 2)) << endl;
    return 0;
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int cnt=0;
    string w,s;cin>>w;
    while(cin>>s,s!="END_OF_TEXT"){
		string s1,w1;
		for(int i=0;i<s.size();++i) s1+=tolower(s[i]);
		// cout << s1 << endl;;
		for(int i=0;i<w.size();++i) w1+=tolower(w[i]);
		if(s1==w1)++cnt;
		// cout << tolower(' ') << endl;
    }
  cout<<cnt<<endl;
}


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

int main(){
    int n;
    cin >> n;
    string s[51];
    int t[51];
    rep(i,n) cin >> s[i]>>t[i];
    string x;
    cin>>x;
    int l=0;
    rep(i,n){
        if(s[i]==x){
            l=i;break;
        }
    }
    int ans=0;
    for(int i=l+1;i<n;i++){
        ans+=t[i];
    }
    cout << ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[110];
int main(){
  int n;
  cin >> n;
  for(int i = 0;i < n;i++) cin >> a[i];
  int flag[110] = {0};
  
  for(int i = 0;i < n;i++) flag[a[i]]++;
  int count = 0;
  for(int i = 0;i <= 100;i++){
    if(flag[i] > 0) count++;
  }
  
  cout << count << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

int main()
{
    int n{};
    std::cin >> n;

    if (n <= 10) {
        std::cout << n << std::endl;
        return 0;
    }

    int result = 9;
    for (int a = 11; a <= n; a++) {
        const auto a_tail = a % 10;
        if (a_tail == 0) continue;
        auto a_head = a / 10;
        while (a_head >= 10) a_head /= 10;

        if (a_head == a_tail) result += 2;
        for (int i = 1; i < 6; i++) {
            auto b = a_tail;
            for (int j = 0; j < i; j++) b *= 10;
            b += a_head;
            if (b > n) {
                break;
            }
            if (i > 1) {
                auto count = 1;
                auto x = b;
                for (int j = 1; j < i; j++) {
                    count *= 10;
                    x += count * 9;
                }
                if (x > n) {
                    for (int j = b; j <= x; j += 10) {
                        if (j > n) break;
                        result++;
                    }
                } else {
                    result += count;
                };
            } else {
                result++;
            }
        }
    }
    
    std::cout << result << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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 long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }



int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N, M;   std::cin >> N >> M;
  std::vector<ll> a(M), c(M, 0);
  rep(i,M) {
    int b; std::cin >> a[i] >> b;
    rep(j,b) {
      int t; std::cin >> t; t--;
      c[i] = ( c[i] | (1LL << t) );
    }
  }
  
  const ll INF = 1e12;
  std::vector<std::vector<ll>> dp(M+1, std::vector<ll>(1LL<<13, INF));
  dp[0][0] = 0;
  rep(i, M) rep(b, (1LL<<(N+1))) {
    dp[i+1][b|c[i]] = std::min( { dp[i][b|c[i]], dp[i][b]+a[i], dp[i+1][b|c[i]] } );
    dp[i+1][b] = std::min( { dp[i+1][b], dp[i][b] } );
  }

  if ( dp[M][(1LL<<N)-1] == INF ) std::cout << -1 << std::endl;
  else std::cout << dp[M][(1LL<<N)-1] << std::endl;

  return 0;
}


Measured memory_bytes: 64512
'''987
988
989
998
999
899
elif lunlun[len(lunlun)-1:]=="99":
		num = nextLun(lunlun[:len(lunlun-1])
		return num+
'''
K = int(input())

def nextLun(lunlun):
	notAllowed = [1,2,3,4,5,6,7,8]
	if len(lunlun)==1:
		return str(int(lunlun)+1)
		
	elif int(lunlun[len(lunlun)-2])+1>=int(lunlun[len(lunlun)-1])+1 and len(str(int(lunlun[len(lunlun)-1])+1))==1:
		
		return str(int(lunlun)+1)
	else:
		num = nextLun(lunlun[:len(lunlun)-1])
		if num[len(num)-1]=="0":
			return num+"0"
		else:
			
			return num+str((int(num[len(num)-1])-1))
def getLun(K):
	lunlun = ["1","2","3","4","5","6","7","8","9"]
	while len(lunlun)<K:
		lunlun.append(nextLun(lunlun[len(lunlun)-1]))
	return lunlun[K-1]
print(getLun(K))



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

using namespace std;

using ll = long long;
using vll = vector<ll>;

template <class T>
string to_string(vector<T> v) {
  string str = "";
  for (auto &x : v) {
    str += to_string(x);
    str.push_back(' ');
  }
  if (str.length() > 0) str.pop_back();

  return str;
}

void A() {
  int l, r, d;
  scanf("%d %d %d", &l, &r, &d);

  int lower = l / d + (l % d != 0);
  int upper = r / d + (r % d != 0);
  printf("%d\n", upper - lower + (r % d == 0));
}

void B() {
  int n;
  scanf("%d", &n);

  int satisf = 0;
  int num;
  for (auto i = 0; i < n; ++i) {
    scanf("%d", &num);
    if ((i + 1) % 2 == 1 && num % 2 == 1) {
      satisf++;
    }
  }

  printf("%d\n", satisf);
}

int main() {
  B();
  return 0;
}


Measured memory_bytes: 3812
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn, rr = 0, ww = 0, ans = 0, memo = 0;
	char tmp;
	cin >> nn;
	vector<int64> cc(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> tmp;
		if(tmp == 'R')
		{
			cc[ii] = 1;
			rr++;
		}
		else
		{
			cc[ii] = 0;
			ww++;
		}
	}
	for(int64 ii = 0;ii < rr;ii++)
	{
		if(cc[ii] == 0)
		{
			ans++;
		}
	}
	for(int64 ii = rr;ii < nn;ii++)
	{
		if(cc[ii] == 1)
		{
			memo++;
		}
	}
	ans = min(ans, memo);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4836