akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
string s;
cin>>s;
ll k;
cin>>k;
ll n=s.size();
ll a[n]={};
for(ll i=0; i<n; i++){
ll c = s.at(i)-'a';
if(c==0) {a[i]=0; continue;}
else { a[i]=26-c;}}
for(ll i=0; i<n; i++){
if(k>=a[i]){
s.at(i)='a';
k-=a[i];}}
k=k%26;
s.at(n-1)+=k;
cout<<s<<endl;}



Measured memory_bytes: 4436
N=int(input())
A=sorted(map(int,input().split()))
dp=[1]*10**6
for a in A:
    if dp[a-1]==1:
        dp[a-1]=2
        for i in range(a*2,10**6+1,a):
            dp[i-1]=0
    elif dp[a-1]==2:
        dp[a-1]=0
print(sum([1 for a in A if dp[a-1]]))

Measured memory_bytes: 32384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1LL<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1LL<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
 
 
signed main(void)
{
	IOS;
	int a[3];
	for(int i = 0; i < 3; i++)
		cin>>a[i];
	sort(a,a+3);
	if((a[0]==a[1] && a[0]!=a[2]) || (a[1]==a[2] && a[0]!=a[1]))
		cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N; cin >> N;
    vector<int> v;
    for (int i(0); i < N; ++i){
        int h; cin >> h;
        v.push_back(h);
    }
    bool flag = false;
    int ans(0);

    for (int h(1); h <= 100; ++h){
        flag = false;
        for (int j(0); j < N; ++j){
            if (flag){
                if (v[j] < h){
                    flag = false;
                }
            }
            else{
                if (v[j] >= h){
                    ++ans;
                    flag = true;
                }
            }
        }
    }
    cout << ans;
    return 0;
}

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

int main() {
  int N; cin >> N;
  int a = 0;
  for (int i = 1; i <= N; i+=2) {
    int b = 0;
    for (int j = 1; j <= i; j++) {
      b += (i % j == 0);
    }
    a += (b == 8);
  }
  cout << a << endl;
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)

int main() {
    int n;
    cin >> n;
    char suit;
    int rank;
    int cards[4][14] = {};

    REP(i, n) {
        cin >> suit >> rank;
        if (suit == 'S') cards[0][rank] = 1;
        if (suit == 'H') cards[1][rank] = 1;
        if (suit == 'C') cards[2][rank] = 1;
        if (suit == 'D') cards[3][rank] = 1;
    }

    REP(s, 4) {
        FOR(r, 1, 14) {
            if (cards[s][r] == 1) continue;
            if (s == 0) suit = 'S';
            if (s == 1) suit = 'H';
            if (s == 2) suit = 'C';
            if (s == 3) suit = 'D';
            cout << suit << " " << r << endl;
        }
    }
}

Measured memory_bytes: 3048
import array
import bisect

N = int(input())
L = list(map(int, input().split()))

L.sort()

A = array.array('i', L)

#print(L)
#print(A)

count = 0

for ia in range(2,N):
    for ib in range(1, ia):
        ic_max = ib-1
        c_min = A[ia]-A[ib]
        ic_min = bisect.bisect_right(A, c_min)
        #print('---------------------')
        #print(ia, ib, ic_max, ic_min)
        #print(A[ia], A[ib], A[ic_max], A[ic_min])
        c_count = ic_max - ic_min + 1
        if c_count > 0:
            count += c_count

print(count)


Measured memory_bytes: 42844
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    long long h,w;
    cin>>h>>w;
    string a[h];
    f(i,0,h){
        cin>>a[i];
    }
    f(i,0,w+2){
        cout<<"#";
    }
    cout<<endl;
    f(i,0,h){
        cout<<"#"<<a[i]<<"#"<<endl;
    }
    f(i,0,w+2){
        cout<<"#";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main(){
	int ks=0,kj=10,g,n,m;
	while(scanf("%d%d",&n,&m)==2){
		g=n+m;
		while(1){
			g=g/10;
			ks++;
			if(g==0)break;
		}
		printf("%d\n",ks);
		ks=0;
	}
	return 0;
}


Measured memory_bytes: 1964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n, k; scanf("%d%d", &n, &k);
	if(k > 1) printf("%d\n", n-k);
	else printf("0\n");
}


Measured memory_bytes: 256
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val n = readInteger()
    val abArray = Array(n) {
        val (a, b) = readLongList()
        Pair(a, b)
    }.reversed()

    var count = 0L
    for (ab in abArray) {
        val a = ab.first + count
        val b = ab.second
        if (a % b != 0L){
            count += b - a % b
        }
    }
    println(count)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 64908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* modとる */
inline ll modu(ll a){
    return(a % mod + mod) % mod;
}

/* modつき二分累乗法 */
ll modpow(ll a, ll b) {
    ll res = 1;
    for (a = modu(a); b; a = modu(a * a) , b >>= 1){
        if (b & 1) res = modu(res * a);
    }
    return res;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N = in(),L = in();
    cout << modpow(2,L)*(L*1900 + (N-L)*100) << "\n";
}

Measured memory_bytes: 256
N,X,M=map(int,input().split())
t=[]
t.append(X)
temp=X
ans=X
for i in range(10**5+100):
    temp=temp**2%M
    if temp in t:
        firstindex=t.index(temp)
        currentindex=len(t)
        firstsum=0
        for i in range(firstindex):
            firstsum+=t[i]
        repeatsum=0
        for i in range(firstindex,currentindex):
            repeatsum+=t[i]
        repetition=(N-firstindex)//(currentindex-firstindex)
        lastrep=        (N-firstindex)%(currentindex-firstindex)
        lastsum=0
        for i in range(firstindex,firstindex+lastrep):
            lastsum+=t[i]
        print(firstsum+repetition*repeatsum+lastsum)
        exit()

    else:
        t.append(temp)



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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    ll n;cin>>n;
    ll k=1,ans=0;
    while(ans<n){
        ans+=k;
        k++;
    }
    cout<<k-1<<endl;
}

Measured memory_bytes: 256
// #include <stdio.h>
// #include <string.h>
//#include <iostream>
#include <math.h>
#include <iostream>
#include <utility>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include <set>


using namespace std;
typedef pair<int, int> XY;// Pair型変数の宣言
typedef long long ll;
const ll MOD = (ll)1e9 + 7;
    

int main()
{
  	int Nmax = 100;
    char String[Nmax];
    int N;
    int i,j,k;
    int len;   // 文字列の長さ
    int flag=0;
 
    int A[Nmax];
    int B[Nmax];
    int C[Nmax];
    int M,D;
    int count = 0;
    int d1,d10;
    int d,m;



    scanf("%d ", &N);
   for(i=1;i<=N-1;i++){
        scanf("%d ",&B[i]);
    }
  
    for(i=1;i<=N;i++){
        A[i] = 10000000+1;
    }
    
    
   for(i=1 ; i <= N-1 ; i++){
       
       //A[i]の仮計算
       if( A[i] > A[i+1] ) {
           if( B[i] <= A[i] ){
            
              A[i] = B[i];
        
          		
           }
       }
       else{

           if(B[i] <= A[i+1]){
        
            A[i+1] = B[i];
           }
       }
    
    }
  
  
     for(i=1 ; i <= N-1 ; i++){
       
       //A[i]の仮計算
       if( A[i] > A[i+1] ) {
           if( B[i] <= A[i] ){
            
              A[i] = B[i];
        
          		
           }
       }
       else{

           if(B[i] <= A[i+1]){
        
            A[i+1] = B[i];
           }
       }
    
    }
    
    ll sum = 0;
    for(i=1;i<=N;i++){
  //     printf("%d %d\n",A[i],B[i]);
        sum = sum + A[i];
    }
  
  
 
   
 
    
    // 結果出力
 	printf("%lld ",sum);

  return 0;
   
}

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

using namespace std;
typedef long long unsigned int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

struct Info
{
    int number;
    string city;
    int score;

    Info(int n, string c, int s)
    {
        number = n;
        city = c;
        score = s;
    }
    bool operator<(const Info &another) const
    {
        if (city != another.city){
            return city < another.city;
        }
        return score > another.score;
    };
};


int main(void){
    vector <Info> infos;
    int n; cin >> n;
    string c;
    int s;
    REP(i, n){
        cin>>c;
        cin>>s;
        infos.push_back(Info{i+1, c, s});
    }
    sort(infos.begin(), infos.end());
    REP(i, n){
        cout << infos[i].number << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;

    if (a == 1) a = 14;
    if (b == 1) b = 14;

    if (a == b) {
        cout << "Draw" << endl;
    } else if (a > b) {
        cout << "Alice" << endl;
    } else {
        cout << "Bob" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input().split())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input().split()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

sa = S()
sb = S()
sc = S()

def turn(s):
    ans1 = s[0]
    ans2 = s[1:]
    return ans1,ans2

t = "a"
# continue flag
flag = True
while flag:
    if t=="a":
        if len(sa)==0:
            print("A")
            exit()
        else:
            t,sa = turn(sa)
    elif t=="b":
        if len(sb)==0:
            print("B")
            exit()
        else:
            t,sb = turn(sb)
    else:
        if len(sc)==0:
            print("C")
            exit()
        else:
            t,sc = turn(sc)

Measured memory_bytes: 77092
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll N = 2000009;
const ll p = 31;
const ll m = 1e9 + 7;
const ll inf= 1e14;
ll mod = 1e9+7;
ll powm(ll a, ll b) { ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
vector<ll> g[N];
ll score[N];
void dfs(ll v,ll p){
     score[v]+=score[p];
     for(auto u:g[v]){
          if(u==p)continue;
          dfs(u,v);
     }
}
 int main() {   
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
     // #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
     // #endif
     ll t = 1;
     // cin>>t;
     while(t--){
          ll a1,a2,a3;cin>>a1>>a2>>a3;
          if(a1+a2+a3>=22){
               cout<<"bust";
          }
          else{
               cout<<"win";
          }
     }
}            


Measured memory_bytes: 48384
# ABC116 C - Grand Garden
import numpy as np
n = int(input())
h = list(map(int,input().split()))
l = [9]*n
t = 0
x = 0
if n == 1:
    print(h[0])
    exit()

while max(h) > 0:
    if x != 0:
        for i in range(n):
            h[i] -= 1

    for i in range(n):
        if h[i] > 0:
            l[i] = 1
        else:
            l[i] = 0

    for i in range(n-1):
        if i == 0 and l[0] == 1:
            t += 1
        if l[i+1]-l[i] == 1:
            t += 1
    x += 1

print(t)

Measured memory_bytes: 12392
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;
const int INF = 1001001001;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

vector<vector<int>> graph(705, vector<int>(705, 1));
int cnt[2];
vector<int> coloring(705, -1);
int n, m;

// 二部グラフ彩色
bool dfs(int u, int color = 0){
    coloring[u] = color;
    ++cnt[color];
    for(int v = 0; v < n; ++v){
        if(v == u || graph[u][v] == 0)  continue;
        if(coloring[v] != -1){
            if(coloring[v] != color ^ 1)    return false;
            continue;
        }
        if(!dfs(v, color ^ 1))  return false;
    }
    return true;
}

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

    cin >> n >> m;
    for(int i = 0; i < m; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        // 補グラフ形成
        graph[a][b] = 0;
        graph[b][a] = 0;
    }
    
    vector<P> coloring_cnt;
    for(int u = 0; u < n; ++u){
        if(coloring[u] != -1)   continue;
        cnt[0] = 0, cnt[1] = 0;
        if(!dfs(u)){
            cout << -1 << endl;
            return 0;
        }
        coloring_cnt.push_back(P(cnt[0], cnt[1]));
    }

    int sz = coloring_cnt.size();
    bitset<1000> dp = 1;
    for(int i = 0; i < sz; ++i){
        int foo = coloring_cnt[i].first, bar = coloring_cnt[i].second;
        dp = (dp << foo) | (dp << bar);
    }

    int res = INF;
    for(int i = 1; i <= n; ++i){
        if(i * 2 > n)   break;
        if(!dp[i])  continue;
        int hoge = i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2;
        chmin(res, hoge);
    }
    cout << res << endl;
}

Measured memory_bytes: 2304
// Atcoder057 - C
function divisor(n) {var ret=[]; for (var i=1;i*i<=n;i++){if(n%i==0){ret.push(i);if(i*i!=n)ret.push(n/i);}}return ret;}
function f(a , b){return Math.max(`${a}`.length, `${b}`.length);}
function main(input) {
  var inputs = input.split('\n');
  var n = parseInt(inputs[0], 10);

  var divisors = divisor(n).sort((a, b) => a - b);
  var surplus = divisors.length % 2;

  var lastIndex = divisors.length - 1;
  var halfLen = Math.floor(divisors.length / 2);

  var minF = `${n}`.length;
  for (var i = 0; i < halfLen - surplus; i++) {
    minF = Math.min(minF, f(divisors[i], divisors[lastIndex - i]));
  }
  if (surplus == 1) minF = Math.min(minF, `${divisors[halfLen]}`.length);

  console.log(minF);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 8132
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;


#define INF 1001002003004005006ll

long long N, K;
long long H[305];
//idxを使う, いくつ消した？
long long dp[610][610];

int main(){
	cin >> N >> K;
	rep(i, N) cin >> H[i+1];
	H[N+1] = 0;

	rep(i, N + 5) rep(j, N + 5) dp[i][j] = INF;

	dp[0][0] = 0;

	for(long long i = 1; i <= N + 1; i++) {
		for(long long j = 0; j < i; j++) {
			//前回使ったのがj番目, 今回使うのがi番目
			long long jmp = i - j - 1;
			//kはjばんめで消した数
			for(long long k = 0; k <= i; k++) {
				if(dp[j][k] != INF && k + jmp <= K)
					dp[i][k+jmp] = min(dp[i][k+jmp], dp[j][k] + max(H[i] - H[j], 0LL));
			}
		}
	}

	long long ans = INF;
	rep(i, K+1) {
		ans = min(ans, dp[N+1][i]);
	}
	cout << ans << endl;



}



Measured memory_bytes: 5048
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


int a[1000], b[1000], c[1000];
int dist[100][100];
int main() {
	int N, M; cin >> N >> M;
	REP(i, M) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--, b[i]--;
	}

	REP(i, N) {
		REP(j, N) {
			if (i == j)dist[i][j] = 0;
			else dist[i][j] = INF;
		}
	}
	REP(i, M) {
		dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
		dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
	}

	REP(k, N) {
		REP(i, N) {
			REP(j, N) {
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}

	int ans = M;
	bool used = false;
	REP(i, M) {
		used = false;
		REP(j, N) {
			if (dist[j][a[i]] + c[i] == dist[j][b[i]]) used = true;
		}
		if (used)ans--;
	}
	cout << ans << endl;
}




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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	// debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, left, right)  (a).begin()+(left),(a).begin()+(right)	// left to (right-1)


int main() {
	int x, y;
	cin >> x >> y;
	int res = 0;
	if (x == 1) {
		res += 300000;
	}
	if (x == 2) {
		res += 200000;
	}
	if (x == 3) {
		res += 100000;
	}
	if (y == 1) {
		res += 300000;
	}
	if (y == 2) {
		res += 200000;
	}
	if (y == 3) {
		res += 100000;
	}
	if (x == 1 && y == 1) {
		res += 400000;
	}
	pv(res)
	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
map<string,int> Map;
string str,ans="";
signed main(void){
	ios::sync_with_stdio(false);
	while(cin>>str){
		Map[str]++;
		if(str.length()>ans.length())
			ans=str;
	}
	int maxn=0;
	for(map<string,int>::iterator it=Map.begin();it!=Map.end();++it)
		maxn=max(maxn,(int)it->second);
	for(map<string,int>::iterator it=Map.begin();it!=Map.end();++it)
		if(maxn==(int)it->second){
			cout<<it->first<<" ";
			break;
		}
	cout<<ans<<endl;
}

Measured memory_bytes: 1196
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	data := [100][3]int{}
	for i := 0; i < N; i++ {
		var x, y, h int
		fmt.Scanf("%d %d %d\n", &x, &y, &h)
		data[i][0] = x
		data[i][1] = y
		data[i][2] = h
	}
	var rx, ry, rh int
	for cx := 0; cx <= 100; cx++ {
		for cy := 0; cy <= 100; cy++ {
			var H int
			for i := 0; i < N; i++ {
				x, y, h := data[i][0], data[i][1], data[i][2]
				if h == 0 {
					continue
				}
				X := x - cx
				if X < 0 {
					X = -1 * X
				}
				Y := y - cy
				if Y < 0 {
					Y = -1 * Y
				}
				H = h + X + Y
			}
			ok := true
			for i := 0; i < N; i++ {
				x, y, h := data[i][0], data[i][1], data[i][2]
				X := x - cx
				if X < 0 {
					X = -1 * X
				}
				Y := y - cy
				if Y < 0 {
					Y = -1 * Y
				}

				if h == 0 {
					if H-X-Y > 0 {
						ok = false
						break
					}
				} else {
					Hi := h + X + Y
					if H != Hi {
						ok = false
						break
					}
				}

			}
			if ok && H >= 1 && cx >= 0 && cx <= 100 && cy >= 0 && cy <= 100 {
				rx = cx
				ry = cy
				rh = H
			}
		}
	}
	fmt.Printf("%d %d %d\n", rx, ry, rh)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

int dp[3010][3010][4];
int v[3010][3010]={};

signed main() {
    int r,c,K; cin>>r>>c>>K;
    rp(i,K){
        int ri,ci,vi;
        cin>>ri>>ci>>vi;
        v[ri-1][ci-1]=vi;
    }

    //dpの初期値は負にしておく。
    rp(i,3010) rp(j,3010) rp(l,4) dp[i][j][l]=-1;
    dp[0][0][0]=0;

    rp(i,r){
        rp(j,c){
            //各座標で、まずその座標の値を更新し、その後右隣と下の座標に伝播させる。
            //dp[i][j][k]が非負のときは、一つ選んだ場合を考える。
            for(int k=2;k>=0;k--){
                if(dp[i][j][k]>=0){
                    dp[i][j][k+1]=max(dp[i][j][k+1],dp[i][j][k]+v[i][j]);
                }
            }
            //隣の座標に伝播させる。下にいくときは、kを0にする。
            rp(k,4){
                if(dp[i][j][k]>=0){
                    if(i+1<r) chmax(dp[i+1][j][0],dp[i][j][k]);
                    if(j+1<c) chmax(dp[i][j+1][k],dp[i][j][k]);
                }
            }
        }
    }

    int ans=-1;
    rp(k,4) chmax(ans,dp[r-1][c-1][k]);
    cout<<ans<<endl;
}


Measured memory_bytes: 357176
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int k,x;
	cin>>k>>x;
	vector<int> ans;
	for(int i = x-k+1; i <= x+k-1; i++) {
		ans.push_back(i);
	}
	cout << ans[0];
	for(int i = 1; i < ans.size(); i++) {
		cout << " " << ans[i];
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(vec) vec.begin(), vec.end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
ll dp[100010];
ll gcd(ll x, ll y){
  return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
  return x * y / gcd(x, y);
}
map<ll, ll> factor(ll n){
  map<ll, ll> ans;
  ll a = 2;
  while (n >= a * a){
    if (n % a == 0){
      ans[a]++;
      n /= a;
    }
    else a++;
  }
  ans[n]++;
  return ans;
}
template<class T> inline bool chmin(T& a, T b){
  if (a > b){
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b){
  if (a < b){
    a = b;
    return true;
  }
  return false;
}

int main(){
  cout << fixed << setprecision(15);
  int n; cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  
  ll ans = 0;
  sort(all(v));
  for (int i = 0; i < n; i++){
    for (int j = 0; j < i; j++){
      if (i == j) continue;
      for (int k = 0; k < j; k++){
        if (i == k || j == k) continue;
        if (v[k] + v[j] > v[i]) ans++;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    string S;
    string str[] = {"dream","dreamer","erase","eraser"};
    cin >> S;
    while(1){
        bool flag = 0;
        for(auto ss:str){
            int len = ss.length();
            if(S.length() < len)continue;
            if(S.substr(S.length() - len) == ss){
                flag = 1;
                S = S.substr(0,S.length() - len);
            }
        }
        if(!flag)break;
    }
    if(S.length() == 0)cout << "YES" << endl;
    else               cout << "NO" << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <stack>
#define ll long long
#define db double
#define rint register int
#define re register
#define eps 1e-10
#define mk make_pair
#define fs first
#define pint pair<int,int>
#define sd second
#define inf 1ll<<58
#define N 100005
using namespace std;
inline char get(){const int TOP=1<<20;static char T[TOP],*x=T,*y=T;return x==y&&(y=(x=T)+fread(T,1,TOP,stdin),x==y)?EOF:*x++;}
inline int read (){register int num,sign=1;register char c;
while (((c=get())<'0'||c>'9')&&c!='-');c=='-'?num=sign=0:num=c-48;while ((c=get())>='0'&&c<='9')num=(num<<3)+(num<<1)+(c-48);return sign?num:-num;}
int n,l,r,mid,ans=-1;
int s[N],A[N],tr[N*2];
inline void Mo(rint x){while(x<=2*n){tr[x]++;x+=x&-x;}}
inline int Qu(rint x){rint res=0;while(x){res+=tr[x];x-=x&-x;}return res;}
inline bool check(rint k){ll res=0;s[0]=0;
	memset(tr,0,sizeof(tr));
	for(rint i=1;i<=n;++i)s[i]=s[i-1]+(A[i]>=k?1:-1);
	for(rint i=0;i<=n;++i){res+=Qu(n+s[i]+1);Mo(n+s[i]+1);}
	return res>=1ll*n*(n+1)/4;
}
int main(){
	n=read();
	for(rint i=1;i<=n;++i)A[i]=read(),r=max(r,A[i]);
	while(l<=r){
		rint mid=(l+r)>>1;
		if(check(mid))ans=mid,l=mid+1;else r=mid-1;
	}
	printf("%d\n",ans);
}


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

int search_top(char A[],int now,int len){//水たまりの頂点を探索
	int depth=0;
	for(int i=now;i<len;i++){
		if(A[i]=='\\'){
			depth++;
		}else if(A[i]=='/'){
			depth--;
			if(depth==0){
				return (i-now+1);
			}
		}
	}
	return -1;
}


void calc(char A[]){
	int depth=0;
	int len=strlen(A);
	double *area=(double*)malloc(sizeof(double)*(len/2));
	double sum=0;
	int count=0;
	int top;

	for(int i=0;i<(len/2);i++){
		area[i]=0;
	}

	for(int i=0;i<len;i++){
		if(A[i]=='\\'){
			top=search_top(A,i,len);
			if(top>0){
				for(int j=0;j<top;j++){
					if(A[j+i]=='\\'){
						area[count]+=(depth+0.5);
						depth++;
					}else if(A[j+i]=='_'){
						area[count]+=depth;
					}else{
						depth--;
						area[count]+=(depth+0.5);
					}
				}
				count++;
				i+=top-1;
			}			
		}
	}

	for(int i=0;i<count;i++){
		sum+=area[i];
	}
	printf("%d\n",(int)sum);
	printf("%d",count);if(count==0){printf("\n");}else{printf(" ");
		for(int i=0;i<count;i++){
			printf("%d",(int)area[i]);
			if(i==(count-1)){
				printf("\n");
			}else{
				printf(" ");
			}
		}	
	}
}

int main(){

	char A[20000];
	scanf("%s",A);

	calc(A);

   return 0;
}


Measured memory_bytes: 2104
#include <stdio.h>
#include <string.h>

int main()
{
	int i,n,t=0,h=0;
	char st[101],sh[101];
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%s %s",&st,&sh);
		if(strcmp(st,sh) > 0){
			t += 3;
		}else if(strcmp(st,sh) < 0){
			h += 3;
		}else{
			h += 1;
			t += 1;
		}
	}
	printf("%d %d\n",t,h);
	return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    
    long long N, A,B;
    
    cin >> N;
    cin >> A;
    cin >> B;
    
    if ( A > B || ( N == 1 && A != B ) ) {
        cout << 0 << endl;
        return 0;
    }
    else if ( N == 1 && A == B ) {
        cout << 1 << endl;
        return 0;
    }
    
    
    cout << B * (N-2) - A * (N-2) + 1 << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int INF = 1LL << 60;
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; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> &P){
os << P.first;
os << " ";
os << P.second;
os << "\n";
return os;
}
//fixed<<setprecision(10)<<ans<<endl;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i,N) cin >> A[i];
    vector<int> M(N,0);
    REP(i,N){
        if(i&1) M[0]-=A[i];
        else M[0] += A[i];
    }
    REP(i,N-1){
        M[i+1] = 2*(A[i]-M[i]/2);
    }
    cout << M;
}

Measured memory_bytes: 2944
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k;
	cin >> n >> k;
	if (n >= 2 * k - 1)
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;
}


Measured memory_bytes: 256
def main():
    from collections import deque
    n, m, *ab = map(int, open(0).read().split())
    
    l = [[] for _ in range(n+1)]
    for i, j in zip(*[iter(ab)] * 2):
        l[i].append(j)
        l[j].append(i)

    ll = [0 for _ in range(n+1)]
    vis = [0 for _ in range(n+1)]
    que = deque()
    que.append(1)
    vis[1] = 1
    while que:
        now = que.popleft()
        nx = l[now]
        for i in nx:
            if vis[i]:
                continue
            vis[i] = 1
            ll[i] = now
            que.append(i)
    if all(vis[1:]):
        print("Yes")
        s = "\n".join(map(str, ll[2:]))
        print(s)
    else:
        print("No")



if __name__ == '__main__':
    main()


Measured memory_bytes: 56556
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    K=list(input())
    D=I()
    N=len(K)
    
    #dp[i][j]はi桁目まで見て，総和のmodがj，tight&lose
    dpt=[[0]*D for _ in range(N+1)]
    dpl=[[0]*D for _ in range(N+1)]
    
    start=int(K[0])
    
    #初期化
    dpt[0][0]=1
            
    #推移
    now=0#tが0ではない位置
    
    for i in range(N):
        num=(int(K[i]))
        #t
        dpt[i+1][(now+num)%D]=1
        for k in range(num):
            dpl[i+1][(now+k)%D]+=1
        now=(now+num)%D
                    
        
        #l，尺取り
        S=0
        for j in range(10):#初期化，0~9までの和
            S+=dpl[i][j%D]
            
        for j in range(D):#あまりが10~D-1,0~9の順に配る
            dpl[i+1][(j+9)%D]+=S
            dpl[i+1][(j+9)%D]%=mod
            S+=dpl[i][(j+10)%D]-dpl[i][j%D]
        
                
    #0もカウントしているmので1ひく
    print((dpt[-1][0]+dpl[-1][0]-1)%mod)
    
    
            
    
    

main()


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

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

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

/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}

__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    int n;
    cin >> n;
    int tot = n * (n-1) / 2;
    using P = pair<int, int>;
    map<P, int> mp;
    int num = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1 ; j < n; ++j) {
            mp[P(i, j)] = num++;
        }
    }
    auto g = make_vec<int>({tot, 0});
    vector<int> in(tot);
    rep(i, n) {
        vector<int> a(n-1);
        rep(j, n-1) cin >> a[j], a[j]--;
        rep(j, n-2) {
            int x = i, y = a[j], z = a[j+1];
            int id1 = mp[P(min(x, y), max(x, y))];
            int id2 = mp[P(min(x, z), max(x, z))];
            g[id1].push_back(id2);
            in[id2]++;
        }
    }
    queue<int> q;
    vector<int> dist(tot, -1);
    rep(i, tot) if (in[i] == 0) {
        dist[i] = 1;
        q.push(i);
    }

    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int u : g[v]) {
            in[u]--;
            if (in[u] == 0) {
                dist[u] = dist[v] + 1;
                q.push(u);
            }
        }
    }

    int mx = 0;
    rep(i, tot) {
        if (dist[i] == -1) {
            cout << "-1\n";
            return 0;
        }
        chmax(mx, dist[i]);
    }
    cout << mx << '\n';
}


Measured memory_bytes: 65760
#include "bits/stdc++.h"
using namespace std;

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

    int n;
    cin >> n;

    LD ans = 0;
    for (int i = 1; i <= n; i++) {
        LD x;
        string s;
        cin >> x >> s;

        if (s == "JPY") {
            ans += x;
        } else {
            ans += x * 380000;
        }
    }

    cout << fixed << setprecision(10);
    cout << ans << "\n";
    return 0;
}

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

using namespace std;

typedef long long ll;
 

int main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a, next;
	cin >> a;

	int ans = 0;
	for (int i = 0; i < a; ++i)
	{
		/* code */
		cin >> next;
		if ((i%2 == 0) && (next % 2 == 1)){
			ans++;
		}
	}
	cout << ans << "\n";

	return 0;
}



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

int main(){
    int a,b,num;
    cin >> a >> b;
    string s;
    s = to_string(a) + to_string(b);
    num = stoi(s);
    for(int i=1;i<=100000;i++){
        if(i*i == num){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  rep(i, N)
  {
    cin >> A[i] >> B[i];
  }
  REVERSE(A);
  REVERSE(B);
  long long ans = 0;
  rep(i, N)
  {
    A[i] += ans;
    ans += B[i] * ((A[i] + B[i] - 1) / B[i]) - A[i];
  }
  cout << ans << endl;
  return 0;
}

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

int main(void) {
  int N1,N2,N3,N4;
  cin >> N1 >> N2 >> N3 >> N4;
  
  int num[10];
  num[N1] = 1;
  num[N2] = 1;
  num[N3] = 1;
  num[N4] = 1;
  int ok = 0;
  if(num[1]==1 && num[9]==1 && num[7] ==1 && num[4] == 1)
    ok = 1;
  if(ok)
  	cout <<"YES" << endl;
  else
    cout << "NO" << endl;
 return 0; 
}

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

using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
#define pb push_back
#define mk make_pair
typedef long long ll;


template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
int mod = 1e9 + 7;

int add(int a, int b){
	if(a + b >= mod)return a+ b - mod;
	return a + b;
}
int mul(int a, int b){
	return 1LL * a * b  % mod;
}
int power(int a, int b){
	if(b < 0)return 0;
	int re = 1;
	while(b){
		if(b&1){
			re = mul(re, a);
		}
		a = mul(a, a);
		b >>= 1;
	}
	return re;
}
// int const N = 100000 + 5;
// int fact[N], inverse[N];
// void FAC(){
//  	fact[0] = 1;
// 	for(int x = 1; x< N; x++){
// 		fact[x] = mul(fact[x-1], x);
// 	}
// 	inverse[N-1] = power(fact[N-1], mod -2);
// 	for(int x = N-2; x>= 0; x--){
// 		inverse[x] = mul(x + 1, inverse[x+1]);
// 	}

//  }

// int ncr(int a, int b){
// 	if(a < b)return 0;
// 	return mul(fact[a], mul(inverse[a-b], inverse[b]));
// }


/******************************************************/

void solve(){
	long long a , b , c;cin >> a >> b >> c;
	ll d = a * b * 4;
	c = c - a - b;
	if(c <= 0){
		cout << "No";
		return;
	}
	if(c > 2e9){
		cout << "Yes";
		return;
	}
	c = c * c;

	if(c > d){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
}


/******************************************************/
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	int t;
	t = 1;
	// cin >> t;
	while(t--){
		solve();
	}

}


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

int main(){
  int d,m,n,L=150,ans;
  cin>>d;
  while(d--){
    cin>>m>>n;
    ans=0;
    for(int i=-L;i<L;i++)
      for(int j=-L;j<L;j++){
	if(!i&&!j)continue;
	int a=i*i+j*j;
	if(!((i*m+j*n)%a)&&!((i*n-j*m)%a))ans++;
      }
    if(ans==8)cout<<"P"<<endl;
    else cout<<"C"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e15;
const ll MOD=1000000007;

int main(){
    string S;cin>>S;
    int N=S.size();
    int count=0;
    rep(i,N/2)if(S[i]!=S[N-1-i])count++;
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define all(a) (a).begin(), (a).end()
#ifdef LOCAL
	#define dbg(x) cout << #x << " = " << x << endl;
#else 
	#define dbg(x)
#endif 

using namespace std;

void solve(); signed main() {
#ifdef LOCAL
    freopen("file1.txt", "r", stdin);                                       
    freopen("file2.txt", "w", stderr);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();
}                         

void solve() {
    int n; 
    cin >> n;
   	
   	cout << n * n * n << endl;
}	

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	double x0, y0, x1, y1;
	cin >> x0 >> y0 >> x1 >> y1;
	lint q;
	cin >> q;
	rep(_, q) {
		double x2, y2;
		cin >> x2 >> y2;
		double X1 = x1 - x0;
		double Y1 = y1 - y0;
		double X2 = x2 - x0;
		double Y2 = y2 - y0;
		double G = X1 * Y2 - X2 * Y1;
		if (G > 0) {
			cout << "COUNTER_CLOCKWISE" << enld;
		}
		else if (G < 0) {
			cout << "CLOCKWISE" << enld;
		}
		else if (G == 0) {
			if (X2 == 0&&Y2==0) {
				cout << "ON_SEGMENT" << enld;
			}
			else if(Y2==0) {
				double k = X1 / X2;
				if (k >= 1) {
					cout << "ON_SEGMENT" << endl;
				}
				else if (k > 0) {
					cout << "ONLINE_FRONT" << endl;
				}
				else if (k < 0) {
					cout << "ONLINE_BACK" << endl;
				}
			}
			else {
				double k = Y1 / Y2;
				if (k >= 1) {
					cout << "ON_SEGMENT" << endl;
				}
				else if (k > 0) {
					cout << "ONLINE_FRONT" << endl;
				}
				else if (k < 0) {
					cout << "ONLINE_BACK" << endl;
				}
			}
		}
	}
}


Measured memory_bytes: 3228