akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long int
#define endl "\n"
#define arrinp(v) for(auto &i:v) cin>>i;
#define arrout(v) for(auto &i:v) cout<<i<<" ";
#define newline cout<<endl;
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin >> t;
    while (t--) {
        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        int count=0;
        for(int i=1;i<n;i++){
            if(a[i]<a[i-1]){
                count+=a[i-1]-a[i];
                a[i]=a[i-1];
            }
        }
        cout<<count<<endl;
    }
    return 0;
}

Measured memory_bytes: 5212
package main

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

func main() {
	scn := newScanner()
	H := scn.nextInt()
	W := scn.nextInt()
	A := make([]string, H)
	for i := 0; i < H; i++ {
		A[i] = scn.nextLine()
	}
	var cnt1, cnt2 int
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if A[i][j] == '#' {
				cnt1++
			}
		}
	}
	cnt2++
	var i, j int
	for i < H && j < W {
		if (i < H && j+1 < W) && A[i][j+1] == '#' {
			j++
			cnt2++
		} else if (i+1 < H && j < W) && A[i+1][j] == '#' {
			i++
			cnt2++
		} else if i == H-1 && j == W-1 {
			log.Println(i, j, cnt1, cnt2)
			if cnt1 == cnt2 {
				fmt.Println("Possible")
				return
			} else {
				break
			}
		} else {
			break
		}
	}
	fmt.Println("Impossible")
	return
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) nextInt64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int main()
{
    //freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
    ll n;
    cin>>n;
    set<string>S;
    string temp;
    while(n--)
    {
        cin>>temp;
        S.insert(temp);
    }
    cout<<S.size()<<endl;
    return 0;
}

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

const int DIM = 1005;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1}; 

char mat[DIM][DIM]; 
int dst[DIM][DIM];

deque<pair<int, int>> que;

int main(void) {
	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		cin >> (mat[i] + 1);
		for (int j = 1; j <= m; ++j) {
			if (mat[i][j] == '#') {
				dst[i][j] = 0; que.push_back(make_pair(i, j)); }
			else {
				dst[i][j] = 10000; } } }
	int ans = 0;
	for (; que.size(); que.pop_front()) {
		pair<int, int> pc = que.front();
		for (int d = 0; d < 4; ++d) {
			pair<int, int> pv = make_pair(pc.first + dx[d], pc.second + dy[d]);
			if (pv.first < 1 or pv.first > n or pv.second < 1 or pv.second > m) {
				continue; }
			if (dst[pv.first][pv.second] > dst[pc.first][pc.second] + 1) {
				dst[pv.first][pv.second] = dst[pc.first][pc.second] + 1;
				que.push_back(pv); ans = dst[pv.first][pv.second]; } } }
	cout << ans;
	return 0; }


Measured memory_bytes: 13328
#include <iostream>
#include <fstream>
#include <cstring>
#include <climits>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long

ll dpa[100000];
ll dpb[100000];
ll dpc[100000];

int solve(int i, int* a, int* b, int* c, int n, bool aa, bool bb, bool cc) {
	
	if (i == n-1) {
		dpa[i] = a[i];
		dpb[i] = b[i];
		dpc[i] = c[i];
		if (!aa)
			return max(dpb[i], dpc[i]);
		if (!bb)
			return max(dpa[i], dpc[i]);
		if (!cc)
			return max(dpa[i], dpb[i]);
	}
	
	if (dpa[i] == -1)
		dpa[i] = a[i] + solve(i+1, a, b, c, n, false, true, true);

	if (dpb[i] == -1) 
		dpb[i] = b[i] + solve(i+1, a, b, c, n, true, false, true);
	
	if (dpc[i] == -1)
		dpc[i] = c[i] + solve(i+1, a, b, c, n, true, true, false);
	
	if (!aa) return max(dpb[i], dpc[i]);
	if (!bb) return max(dpa[i], dpc[i]);
	if (!cc) return max(dpa[i], dpb[i]);
	return max(max(dpa[i], dpb[i]), dpc[i]);
}

int main() {
  
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		cin >> b[i];
		cin >> c[i];
	}
	for (int i = 0; i < 100000; ++i) {
		dpa[i] = -1;
		dpb[i] = -1;
		dpc[i] = -1;
	}
	cout << solve(0, a, b, c, n, true, true, true);

	return 0;
}

Measured memory_bytes: 14720
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned long long int uint64;
typedef long long int          int64;
 
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

//set many funcs template
//Ver.20181228
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>

void get_N (int64 *n)
{
  int cnt;
  
  cnt = scanf("%lld", n);

  return;
}

void get_NK (int64 *n, int64 *k)
{
  int cnt;
  
  cnt = scanf("%lld %lld", n, k);

  return;
}

void get_N1234 (int64 *n1, int64 *n2, int64 *n3, int64 *n4)
{
  int cnt;

  if (n2 == NULL) {
    cnt = scanf("%lld", n1);
    return;
  }
  if (n3 == NULL) {
    cnt = scanf("%lld %lld", n1, n2);
    return;
  }
  if (n4 == NULL) {
    cnt = scanf("%lld %lld %lld", n1, n2, n3);
    return;
  }
  cnt = scanf("%lld %lld %lld %lld", n1, n2, n3, n4);
  return;
}

void omit_LF (void)
{
  char c;
  int  cnt;
  
  cnt = scanf("%c", &c);
  return;
}

char *get_S (int64 n)
{
  char *buf;
  int  i;
  int  cnt;

  buf = malloc((size_t)(n * sizeof(char)));
  if (buf == NULL) {
    return NULL;
  }

  cnt = scanf("%s", buf);

  return buf;
}

char *get_SN (int64 max, int64 *size)
{
  char *buf;
  int  i;
  int  n;
  int  cnt;

  buf = malloc((size_t)(max * sizeof(char)));
  if (buf == NULL) {
    return NULL;
  }

  cnt = scanf("%s", buf);

  n = strlen(buf);

  *size = n;
  
  return buf;
}

int64 *get_NSeq (int64 n)
{
  int64 *buf;
  int64 i;

  buf = malloc((size_t)(n * sizeof(int64)));
  for (i=0; i<n; i++) {
    get_N(&buf[i]);
  }

  return buf;
}

typedef struct _tmp_t {
  int64    a;
  int64    b;
} tmp_t;


int compare_a(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->a > y->a) return 1;
  if (x->a < y->a) return -1;

  return 0;
}

int compare_b(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->b > y->b) return 1;
  if (x->b < y->b) return -1;

  return 0;
}

void qsort_a (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_a);
}

void qsort_b (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_b);
}

int main()
{
  int64 L;
  double x,y,z;

  get_N(&L);

  x = L/3.0;
  y = L/3.0;
  z = L-x-y;

//  printf("%lf,%lf,%lf\n", x,y,z);

  printf("%lf", (x*y*z));
  return 0;
}



Measured memory_bytes: 128
package main

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

const B uint64 = 100000007

func main() {
	var t, p string
	fmt.Scan(&t)
	fmt.Scan(&p)

	ts, ps := []rune(t), []rune(p)
	n, m := len(ts), len(ps)
	if n < m {
		return
	}

	var th, ph, bm uint64 = 0, 0, 1
	for i := 0; i < m; i++ {
		th = uint64(ts[i]) + th*B
		ph = uint64(ps[i]) + ph*B
		bm = bm*B
	}
	wr := bufio.NewWriter(os.Stdout)
	if th == ph {
		wr.WriteString("0\n")
	}
	for i := 1; i <= n-m; i++ {
		th = th*B + uint64(ts[i+m-1]) - uint64(ts[i-1])*bm
		if th == ph {
			wr.WriteString(strconv.Itoa(i) + "\n")
		}
	}
	wr.Flush()
}



Measured memory_bytes: 11280
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n;
  cin >> n;
  deque<ll> b(n);
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    b[i]--;
  }

  ll cnt = 0;
  stack<ll> ans;

  while (!b.empty()) {
    ll erase_target = -1;
    for (int i = 0; i < b.size(); i++) {
      if (b[i] == i) {
        erase_target = i;
      }
    }

    if (erase_target == -1) {
      cout << -1 << ln;
      return 0;
    } else {
      ans.push(b[erase_target]);
      b.erase(b.begin() + erase_target);
    }

    cnt++;
  }

  while (!ans.empty()) {
    cout << ans.top() + 1 << ln;
    ans.pop();
  }

  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdio>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
//    cout << fixed << setprecision(10);
    long long N, M, X;
    cin >> N >> M >> X;
    
    vector< vector<long long> > input;
    
    for (int i = 0; i < N; i++) {
        input.push_back(vector<long long>(M + 1));
        cin >> input[i][0];
        for (int j = 0; j < M; j++) {
            cin >> input[i][j + 1];
        }
    }
    
    long long minimum = -1;
    for (int k = 0; k < (2 << N); k++) {
        vector<long long> result(M + 1);
        for (int i = 0; i < N; i++) {
            if ((k >> i) & 1) {
                result[0] += input[i][0];
                for (int j = 0; j < M; j++) {
                    result[j + 1] += input[i][j + 1];
                }
            }
        }

        bool isOk = true;
        for (int l = 1; l <= M; l++) {
            isOk = isOk & (result[l] >= X);
        }
        if (isOk && (minimum > result[0] || minimum == -1)) {
            minimum = result[0];
        }
    }
    
    cout << minimum;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;

int main()
{

	int n, x, l[110], i, k;

    int cnt = 1;

    cin >> n >> x;

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

    for(i = 0; i < n; i++)
    {
        k += l[i];
        if(k <= x) cnt++;
    }

    cout << cnt << endl;

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    map<long,long> m;
    vector<pair<long,long>> a;
    long num;
    for(int i=0;i<n;i++){
        cin>>num;
        m[num]++;
    }
    for(auto i=m.begin();i != m.end();i++){
        a.push_back({i->first,i->second});
    }
    int cnt=0;
    int sz = m.size();
    m.clear();
    for(int i=0;i<(sz-2);i++){
        for(int j=(i+1);j<(sz-1);j++){
            for(int k=(j+1);k<sz;k++){
                if(a[i].first + a[j].first > a[k].first){
                    cnt += a[i].second*(a[j].second*a[k].second);
                }
                else{
                    break;
                }
            }
        }
    }
    cout<<cnt;
    return 0;
}

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

int main()
{
    int h, w, n;
    cin >> h >> w >> n;

    map<pair<int, int>, int> mp;
    int dx[] = {1, 1, 1, 0, -1, -1, -1, 0, 0};
    int dy[] = {1, 0, -1, -1, -1, 0, 1, 1, 0};
    for (int i = 0; i < n; i++) {
        int y, x;
        scanf("%d %d", &y, &x);
        // cin >> y >> x;
        for (int j = 0; j < 9; j++) {
            int xx = x + dx[j];
            int yy = y + dy[j];
            if (xx - 1 <= 0 || xx + 1 > w || yy - 1 <= 0 || yy + 1 > h) continue;
            mp[pair<int, int> (yy, xx)]++;
        }
    }

    int ans[10] = {};
    for (auto x : mp) {
        ans[x.second]++;
    }

    cout << 1LL * (h - 2) * (w - 2) - mp.size() << endl;
    for (int i = 1; i < 10; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 56448
X,N = gets.split.map(&:to_i)  # スペースで区切られた複数の整数
X.freeze
N.freeze
if N == 0 then
  puts X
  exit
end
p = gets.split.map(&:to_i)  # スペースで区切られた複数の整数

p.sort!

#初期化
wkp = 0
wkm = 0
ans = X
#X自身が答えの判定
if p.include?(X) == false then
  puts X
  exit
end

loop do
  #マイナス側判定
  wkm = wkm - 1
  if p.include?(X-(wkm.abs)) == false then
  puts X-(wkm.abs)
  exit
  end
  #プラス側判定
  wkp = wkp + 1
  if p.include?(X+(wkp.abs)) == false then
  puts X+(wkp.abs)
  exit
  end
end

Measured memory_bytes: 14292
#include"bits/stdc++.h"
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
int64_t i,j,k;//preparation for
int main(){
    string s,t;
    int64_t p;
    p=0;
    cin>>s>>t;
    for(i=0;i<s.length();i++){
        if(s[i]!=t[i]){
            p+=1;
        }
    }

    cout<<p;
    
    return 0;
}

Measured memory_bytes: 3860
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i) 
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}

int main() {

    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    string ans = "";

    for (int y = sy; y < ty; ++y) {
        ans += 'U';
    }
    for (int x = sx; x < tx; ++x) {
        ans += "R";
    }
    for (int y = sy; y < ty; ++y) {
        ans += 'D';
    }
    for (int x = sx; x < tx; ++x) {
        ans += "L";
    }

    ans += 'L';
    for (int y = sy; y <= ty; ++y) {
        ans += 'U';
    }
    for (int x = sx; x <= tx; ++x) {
        ans += "R";
    }
    ans += 'D';

    ans += 'R';
    for (int y = sy; y <= ty; ++y) {
        ans += 'D';
    }
    for (int x = sx; x <= tx; ++x) {
        ans += "L";
    }
    ans += 'U';

    Cout(ans);

    return 0;
}


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

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

  int ans = 0;

  for (int i = 1; i <= N; i++)
  {
    if (to_string(i).size() % 2 == 1)
    {
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3764
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int s = scanner.nextInt();
        if(s==25) {
        	System.out.println("Christmas");
        }else if(s==24){
        	System.out.println("Christmas Eve");
        }else if(s==23){
        	System.out.println("Christmas Eve Eve");
        }else {
        	System.out.println("Christmas Eve Eve Eve");
        }

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

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

const int N = 2010;
string A, B;
int n;
int ans = 1e9;
int ml[N], mr[N], mx[N];

void solve() {
	for (int i = 0; i < n; ++i) {
		ml[i] = mr[i] = 0;
		while(B[(i + mr[i]) % n] != '1') ++mr[i];
		while(B[(i - ml[i] + n) % n] != '1') ++ml[i];
	}
	for (int s = 0; s < n; ++s) {
		for (int i = 0; i < n; ++i) mx[i] = 0;
		int dif = 0;
		for (int i = 0; i < n; ++i) if (A[i] != B[(i + s) % n]) {
			++dif;
			mx[ml[i]] = max(mx[ml[i]], mr[i] - s);
		}

		int add = 1e9, cur = 0;
		for (int i = n - 1; i >= 0; --i) {
			cur = max(cur, mx[i + 1]);
			add = min(add, i + cur);
		}

		ans = min(ans, 2 * add + s + dif);
	}
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> A >> B; n = (int)A.size();

	bool full0 = 1;
	for (int i = 0; i < (int)B.size(); ++i) {
		full0 &= (B[i] == '0');
	}
	if (full0) {
		for (int i = 0; i < (int)A.size(); ++i) full0 &= (A[i] == '0');
		if (!full0) return printf("-1\n"), 0;
		else return printf("0\n"), 0;
	}

	solve();

	reverse(A.begin(), A.end());
	reverse(B.begin(), B.end());
	solve();

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

Measured memory_bytes: 380
#include<stdio.h>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
#define ll long long
int main()
{
	int n, m, sum=0;
	cin >> n >> m;
	vector<int>val(n);
	for (auto &i : val) {
		cin >> i;
		sum += i;
	}
	m -= sum;
	int mm = *min_element(val.begin(), val.end());
	int cnt = n + m / mm;
	cout << cnt;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

void func(){
    int n=in();
    ll ans=0;
    vector<priority_queue<pii>> que(2);
    rep(i,n){
        int k=in()-1,l=in(),r=in();
        if(l > r){
            ans += r;
            l -= r;
            que[0].push(mp(-k,l));
        }else{
            ans += l;
            r -= l;
            que[1].push(mp(-(n-k-2),r));
        }
    }
    rep(x,2){
        rep(i,n){
            while(!que[x].empty() && -que[x].top().first < i){
              //  cout<<"##"<<i<<" "<<-que[x].top().first<<" "<<que[x].top().second<<endl;
                que[x].pop();
            }
            if(!que[x].empty()){
                ans += que[x].top().second;
               // cout<<i<<" "<<-que[x].top().first<<" "<<que[x].top().second<<endl;
                que[x].pop();
            }
        }
    }
    cout<<ans<<endl;
}

/*int main(){
    int N=in();
    for(int n=1;n<=N;n++){
        int ans=0;
        for(int a=2;a*a<n*2;a++){
            for(int b=a;b*b<n*2;b++){
                int x = sqrt(n*2 - a*a - b*b);
                if(x >= b && a + b > x && x*x + a*a + b*b == 2*n && (a+b+x)%2==0){
                    if(a==b){
                        if(b==x)ans++;
                        else ans+=3;
                    }
                    else if(b==x)ans += 3;
                    else ans += 6;
                }
            }
        }
        cout<<ans<<endl;
    }
}*/
int main(){
    int n=in();
    int ans=0;
    rep(i,n){
        int x=in();
        if(i%2==0 && x%2==1)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3688
n,a,b,c,d = gets.chomp.split.map(&:to_i)
sa = (b-a).abs
n -= 1
f = false
  (n+1).times do|i|
    h = d*(n-i) - c*i
    l = c*(n-i) - d*i
    if(l <= sa and sa <= h)
      f = true
      break
    end
  end
puts (f)? "YES" : "NO"

Measured memory_bytes: 1788
n,m=map(int,input().split())
lst=[list(input().split()) for i in range(m)]
x,y=0,0
cnt=['?']+[0]*n
cnt2=[0]+[0]*n
for i in lst:
  if i[1]=='WA':
    pin=int(i[0])
    if cnt[pin]!='AC':
      cnt2[pin]+=1
  elif i[1]=='AC':
    cnt[int(i[0])]='AC'

x=cnt.count('AC')

for i in range(len(cnt)):
  if cnt[i]=='AC':
    y+=cnt2[i]
print(x,y)

Measured memory_bytes: 98976
program sample
implicit none
character(len=100) :: x
integer(8) :: i,j,n,count
integer(8) :: a(26),b(26)

read(*,*) x

a(:)=0

n=len_trim(x)

do i=1,n
do j=ichar('a'),ichar('z') !aは97,zは122
if (ichar(x(i:i))==j) then
a(j-96) =a(j-96) +1
end if
end do
end do
count=0

do i=1,26
	if (mod(a(i),2)==1) then
	count=count+1
	end if
end do
if (count==0) then
	write(*,*) 'Yes'
else
	write(*,*) 'No'
end if

!write(*,*) ichar('a'),ichar('z'),count
!write(*,*) a

end program sample

Measured memory_bytes: 2844
import sys
input = sys.stdin.readline


n, m, l = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]
graph = [[] for i in range(n)]
for i in range(m):
    a, b, cost = info[i]
    if cost > l:
        continue
    a -= 1
    b -= 1
    graph[a].append((b, cost))
    graph[b].append((a, cost))


def warshall_floid(graph):
    """warshall-floid法: 各頂点から各頂点への最短距離を求める
    重み付きグラフgraphは隣接リストで与えられる
    計算量: O(|N|^3)
    """
    n = len(graph)
    INF = 10**18
    dp = [[INF]*n for i in range(n)]
    for i in range(n):
        dp[i][i] = 0

    for i in range(n):
        for j, cost in graph[i]:
            dp[i][j] = cost
            dp[j][i] = cost

    for k in range(n):
        for i in range(n):
            for j in range(n):
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

    return dp

def warshall_floid_matrix(matrix):
    """warshall-floid法: 各頂点から各頂点への最短距離を求める
    matrix[i][j] := 頂点iから頂点jへの距離（頂点iから頂点jへ到達できないときはINFを代入しておく）
    計算量: O(|N|^3)
    """
    n = len(matrix)
    dp = matrix
    for k in range(n):
        for i in range(n):
            for j in range(n):
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
    return dp

dp1 = warshall_floid(graph)
INF = 10**18
dp2 = [[INF]*n for i in range(n)]
for i in range(n):
    for j in range(n):
        if dp1[i][j] <= l:
            dp2[i][j] = 1
ans = warshall_floid_matrix(dp2)         

q = int(input())
query = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
    a, b = query[i]
    a -= 1
    b -= 1
    if ans[a][b] == 10**18:
        print(-1)
    else:
        print(ans[a][b] - 1)

Measured memory_bytes: 74332
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 1000000007
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

int n, a, b;
int arr[105];

int main(){
    ios::sync_with_stdio(0);
    cin >> n;
    forn(i,n) cin >> arr[i];
    sort(arr,arr+n,greater<int>());
    a = b = 0;
    forn(i,n){
        if(i%2 == 0) a+=arr[i];
        else b+=arr[i];
    }

    cout << a-b << "\n";
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}

template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	int n;
	ll k;
	cin >> n >> k;
	vector<int> nxt(n);
	deque<int> dq;
	vector<bool> vi(n);
	for(auto& el: nxt) {
		cin >> el;
		el--;
	}

	k++;
	for(int cr = 0; k && !vi[cr]; cr = nxt[cr], k--) {
		debug(cr + 1);
		dq.push_back(cr);
		vi[cr] = 1;
	}
	
	if(!k) {
		cout << dq.back() + 1 << '\n';
	} else {
		k--;
		while(dq.front() != nxt[dq.back()]) dq.pop_front();
		int sob = k % dq.size();
		debug(sob, k, dq.front() + 1);
		while(sob--) dq.pop_front();
		assert(sob == -1 && dq.size() > 0);
		cout << dq.front() + 1 << '\n';
	}
}



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

int main(){
  int n;
  cin >> n;
  int sum = 0;
  vector<int> t(n);
  for(int i = 0; i < n; i++) {
    cin >> t.at(i);
    sum += t.at(i);
  }
  int m;
  cin >> m;
  vector<int> p(m),x(m);
  for(int i = 0; i < m; i++) cin >> p.at(i) >> x.at(i);
  for(int i = 0; i < m; i++){
    cout<<sum-t.at(p.at(i)-1)+x.at(i)<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
<?php
	fscanf(STDIN,"%d%d%d%d",$n,$m,$x,$y);
	$x_li = explode(" ",trim(fgets(STDIN)));
	$y_li = explode(" ",trim(fgets(STDIN)));

	sort($x_li);
	sort($y_li);
	$z = $x_li[count($x_li)-1];
	while($z< $y_li[0]){
      if($x<=$z && $z<$y){
        echo "No War";
        exit;
      }
      $z++;
    }

	echo "War";

	
	


Measured memory_bytes: 16304
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin>>N;
  ll ans=0;
  for(int i=1;i<N;i++){
    ll u,v;
    cin>>u>>v;
    if(u>v){swap(u,v);}
    ans-=u*(N-v+1);
  }
  for(int i=1;i<=N;i++){
    ans+=(N-i+1)*(N-i+2)/2;
  }
  cout<<ans<<endl;
  


  return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int [] T = new int[N];
		for (int i=0; i<N; i++) {
			T[i] = sc.nextInt();
		}
		int M = sc.nextInt();
		int [] P = new int[M];
		int [] X = new int[M];
		for (int i=0; i<M; i++) {
			P[i] = sc.nextInt();
			X[i] = sc.nextInt();
		}
		for (int i=0; i<M; i++) {
			int res = 0;
			for (int j=1; j<=N; j++) {
				if (P[i] == j) {
					res += X[i];
				}else {
					res += T[j-1];
				}
			}			
			System.out.println(res);
		}
	}
}


Measured memory_bytes: 21204
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;
int N,D,P;
long long int M,S,SD;
pair<int,int> DP[ 10010 ];
int main(){
	while (cin >> N >> M && N > 0) {
		S=0;
		SD = 0;
		for (int i=0; i < N ; i++) {
			cin >> D >> P;
			DP[i] = make_pair(P,D);
			S = S + D*P;
			SD = SD + D;
		}
		if (SD < M) {
			cout << "0" << endl;
		}
		else {
			sort(DP,DP+N);
			for (int j = 0; j < N; j++) {
				if ( M > 0) {
					if ( M > DP[N-1-j].second) {
						S = S - DP[N-1-j].first*DP[N-1-j].second;
						M = M - DP[N-1-j].second;
					}
					else {
						S = S - M*DP[N-1-j].first;
						M = 0;	
					}
				}
			}
			cout << S << endl;
		}
	}
}

Measured memory_bytes: 1244
// C - HonestOrUnkind2
#include <bits/stdc++.h>
using namespace std;

using p = pair<int, int>;
int n;
vector<vector<p>> v;

bool judge(int bit){
    for(int i=0; i<n; i++){
        if(!(bit & (1<<i))) continue;
    
        for(p xy : v[i]){
            int x = xy.first;
            int y = xy.second;
            
            if(y==1 && !(bit & (1<<x))) return false;
            if(y==0 && (bit & (1<<x))) return false;
        }
    }
    return true;
}

int main(){
    cin >> n;
    v.resize(n);
    for(int i=0; i<n; i++){
        int a; cin >> a;
        v[i].resize(a);
        for(int j=0; j<a; j++){
            cin >> v[i][j].first >> v[i][j].second;
            v[i][j].first--;
        }
    }
    int res = 0;
    for(int bit=0; bit<(1<<n); bit++){
        // 矛盾チェック
        if(judge(bit)){
            int cnt = 0;
            for(int i=0; i<n; i++){
                if(bit & (1<<i)) cnt++;
            }
            res = max(res, cnt);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
  input! {
    n: usize,
    ai: [usize;n]
  }
  
  let len = ai.len();
  let mut count = 0;
  let mut val = 1;
  for v in ai {
    if val == v {
      val += 1;
    } else {
      count += 1;
    }
  }
  
  if len == count {
    println!("-1");
  } else {
    println!("{}", count);
  }
}

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

unordered_set<long long> divisors(long long n) {
  unordered_set<long long> res;
  for (int i = 1; i < floor(sqrt(n)) + 1; i++) {
    if (n % i == 0) {res.insert(i); res.insert(n / i);}
  }
  res.erase(1);
  return res;
}

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

  long long n;
  cin >> n;
  long long cnt = divisors(n - 1).size();
  for (long long const &i : divisors(n)) {
    long long m = n;
    while (m % i == 0) m /= i;
    cnt += (m - 1) % i == 0;
  }
  cout << cnt << '\n';
  return 0;
}

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

int X1, Y1, X2, Y2, DX, DY;

int main() {
  cin >> X1 >> Y1 >> X2 >> Y2;
  DX = X2 - X1; DY = Y2 - Y1;
  cout << X2 - DY << ' ' << Y2 + DX << ' '
    << X1 - DY << ' ' << Y1 + DX << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int N, x[100], y[100], h[100];

bool check(int cx, int cy, int ch) {
    bool ok = true;
    REP(i, N) {
        ok &= h[i] == max(ch - abs(cx - x[i]) - abs(cy - y[i]), 0);
    }
    return ok;
}

int main() {
    cin >> N;
    REP(i, N) cin >> x[i] >> y[i] >> h[i];
    REP(i, 101) REP(j, 101) {
        int ch = -1;
        REP(k, N) {
            if (h[k] == 0) continue;
            ch = h[k] + abs(i - x[k]) + abs(j - y[k]);
        }
        if (check(i, j, ch)) {
            cout << i << " " << j << " " << ch << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] h = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        int ans = 0;
        int count = 0;
        for (int i = 1; i < n; i++)
        {
            if (h[i - 1] >= h[i])
                count++;
            else
            {
                ans = Math.Max(ans, count);
                count = 0;
            }
        }
        ans = Math.Max(ans, count);
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 24796
#include<stdio.h>

int main(){
	int n_nodes, n_edges;
	scanf("%d", &n_nodes);
	scanf("%d", &n_edges);
	long long int height[n_nodes+1];
	//塔が良い->1;でない->0
	int is_tallest[n_nodes+1];
	for(int node_i = 1; node_i <= n_nodes; node_i++){
		scanf("%lld", &height[node_i]);
		is_tallest[node_i] = 1;
	}
	//ペア(edge_iで繋がるnode1, 2_i)で比較、tallestになり得るか判定
	for(int edge_i = 1; edge_i <= n_edges; edge_i++){
		int node1_i, node2_i;
		scanf("%d", &node1_i);
		scanf("%d", &node2_i);
		if(height[node1_i] > height[node2_i])
			is_tallest[node2_i] = 0;
		else if(height[node2_i] > height[node1_i])
			is_tallest[node1_i] = 0;
		else
			is_tallest[node1_i] = is_tallest[node2_i] = 0;
	}
	int ans = 0;
	for(int node_i = 1; node_i <= n_nodes; node_i++)
		ans += is_tallest[node_i];
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 2904
#include <iostream>
using namespace std;
int main(void){
    long long N,i,j,k;
    cin>>N;
    long long a[N],b[N];
    for(i=0;i<N;i++){
        a[i]=i+1;
        b[i]=0;
    }
    k=0;
    for(i=2;i<N+1;i++){
        for(j=0;j<N;j++){
            while(a[j]%i==0){
                a[j]/=i;
                b[k]++;
            }
        }
        if(b[k]>0){
            k++;
        }
    }
    long long n75=0,n25=0,n15=0,n5=0,n3=0;
    for(i=0;i<N;i++){
        if(b[i]>73){
            n75++;
        }
        if(b[i]>23){
            n25++;
        }
        if(b[i]>13){
            n15++;
        }
        if(b[i]>3){
            n5++;
        }
        if(b[i]>1){
            n3++;
        }
    }
    long long sum=n75+n25*(n3-1)+n15*(n5-1)+n5*(n5-1)/2*(n3-2);
    cout<<sum<<endl;
}


Measured memory_bytes: 256
N,X = map(int,input().split())
li = [int(input()) for i in range(N)]
count = 0
flag = True
mi = 1000
for i in li:
  X -= i
  count += 1
  mi = min(mi,i)
while(flag):
  X -= mi
  if X < 0:
    flag = False
    break
  count += 1
print(count)

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

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b>c+d) {
        cout << "Left" << endl;
    }else if(a+b<c+d) {
        cout << "Right" << endl;
    } else {
        cout << "Balanced" << endl;
    }
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    vi A(N), B(N); F0R(i, N) cin >> A[i] >> B[i];
    sort(all(A));
    sort(all(B));
    ll X, Y; 
    if (N % 2 == 1) {
        X = A[N/2];
        Y = B[N/2];
    } else {
        X = A[N/2 - 1] + A[N/2];
        Y = B[N/2 - 1] + B[N/2];
    }

    cout << Y-X+1 << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 4812
let () = Scanf.scanf "%d\n" @@ fun n ->
  let a = Array.make 4 0 in
  for i = 0 to n - 1 do
    let i = Scanf.scanf "%s\n" @@ function
      | "AC" -> 0
      | "WA" -> 1
      | "TLE" -> 2
      | "RE" -> 3 in
    a.(i) <- 1 + a.(i)
  done;
  Printf.printf "AC x %d\nWA x %d\nTLE x %d\nRE x %d\n" a.(0) a.(1) a.(2) a.(3)

Measured memory_bytes: 5880
import java.util.Scanner;
 
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int[][] dp = new int[n+100][3];
		int[][] a = new int[n+100][3];
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 3; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 3; j++) {
				for(int k = 0; k < 3; k++) {
					if(j == k) continue;
					dp[i+1][k] = Math.max(dp[i+1][k], dp[i][j] + a[i][k]);
				}
			}
		}
		
		int res = 0;
		for(int j = 0; j < 3; j++) res = Math.max(res, dp[n][j]);
		System.out.println(res);
		
	}
}

Measured memory_bytes: 100656
#include <stdlib.h>
#include <iostream>
using namespace std;
 
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
int main(){
	int n, m;
	cin >> n >> m;
	char a[50][50];
	char b[50][50];
	REP(i, n){
		REP(j, n){
			cin >> a[i][j];
		}
	}
 
	REP(i, m){
		REP(j, m){
			cin >> b[i][j];
		}
	}
 
	bool ans = false;
	for(int i = 0; i < n-m+1 && !ans; ++i){
		for(int j = 0; j < n-m+1 && !ans; ++j){
			bool is_exist = true;
			for(int k = 0; k < m && is_exist; ++k){
				for(int l = 0; l < m && is_exist; ++l){
					if(a[i+k][j+l] != b[k][l]){
						is_exist = false;
					}
				}
			}
			if(is_exist){
				ans = true;
			}
		}
	}
 
	if(ans){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
 
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <map>
#include <string>

using namespace std;

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

int main() {
    int N; // 青いカード, 100
    scanf("%d", &N);

    map<string, int> s;
    REP(i, N) {
        char str[11];
        scanf("%s", str);

        map<string, int>::iterator it = s.find(str);
        if (it != s.end()) {
            s[str]++;
        } else {
            s.insert(make_pair(str, 1));
        }
    }

    int M; // 赤いカード, 100
    scanf("%d", &M);
    map<string, int> t;
    REP(i, M) {
        char str[11];
        scanf("%s", str);

        map<string, int>::iterator it = t.find(str);
        if (it != t.end()) {
            t[str]++;
        } else {
            t.insert(make_pair(str, 1));
        }
    }

    int ans = 0;
    for (map<string, int>::iterator it = s.begin(); it != s.end(); ++it) {
        map<string, int>::iterator it2 = t.find(it->first);
        if (it2 != t.end()) {
            ans = max(ans, it->second - it2->second);
        } else {
            ans = max(ans, it->second);
        }
    }

    printf("%d\n", ans);

    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, h, cnt = 0;
  long long maxa = 0;
  cin >> n >> h;
  vector<int> strong;
  vector<pair<long long, long long> > vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i].first >> vec[i].second;
    maxa = max(maxa, vec[i].first);
  }

  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    if (maxa < vec[i].second) strong.push_back(vec[i].second);
  }
  sort(strong.begin(), strong.end());
  reverse(strong.begin(), strong.end());
  for (int i = 0; i < strong.size(); i++) {
    h -= strong[i];
    cnt++;
    if (h <= 0) {
      cout << cnt << '\n';
      return 0;
    }
  }
  cout << cnt + (h-1) / vec[0].first + 1 << '\n';
}


Measured memory_bytes: 2428
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int a=n%10;
        if(a==2 || a==4 || a==5 || a==7 || a==9){
            System.out.println("hon");
        }
        if(a==0 || a==1 || a==6 || a==8){
            System.out.println("pon");
        }
        if(a==3){
            System.out.println("bon");
        }
    }

}


Measured memory_bytes: 27084
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  if(abs(A - B) % 2 == 0) {
    ll ans = abs(A - B) / 2;
    cout << ans << endl;
  } else {
    ll ans2 = N - B;
    ll ans3 = A - 1;
    ll sub = min(ans2, ans3);
    dump(sub);
    ll ans = sub + (B - A - 1) / 2 + 1;
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)


int main(){
    int n;
    cin >> n;
    vector<ll> u(n+1);
    ll ans=1LL << 60;
    u[0]=0;
    for (int i=1;i <= n;i++){
       ll tmp;
       cin >> tmp;
       u[i] = u[i-1]+tmp;
    }
    //rep(i,n+1) cout << u[i] << " ";
    for (int i = 1;i < n;i++){
       ans=min(abs((u[i]-u[0])-(u[n]-u[i])),ans);
    }
    cout << ans << endl;

    
}



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

using namespace std;

int main() {
	string s;
	cin>>s;
	if (s == "SUN")
		cout<<7;
	if (s == "SAT")
		cout<<1;
	if (s == "FRI")
		cout<<2;
	if (s == "THU")
		cout<<3;
	if (s == "WED")
		cout<<4;
	if (s == "TUE")
		cout<<5;
	if (s == "MON")
		cout<<6;
}

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

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	vector< vector<string> > S(h, vector<string>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> S[i][j];
			if (S[i][j] == "snuke") {
				cout << (char)('A' + j) << i + 1 << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define INF 2147483647
vector<int> a(300000,INF);
int n,si;
void update(int,int);
int find(int,int,int,int,int);

int main(){
  int q,f;
  si=1;
  cin >> n >> q;
  for(int i=0;;i++){
    si*=2;
    if(si>=n)break;
  }

  for(int i=0;i<q;i++){
    cin >> f;
    if(f==0){
      int po,d;
      cin >> po >> d;
      update(po,d);
    }
    else{
      int st,go,mi;
      cin >> st >> go;
      mi=find(st,go+1,0,0,si);
      cout << mi << endl;
    }
  }
  return 0;
}
void update(int p,int d){
  int ko;
  ko=si-1+p;
  a[ko]=d;
  while(ko>0){
    ko=(ko-1)/2;
    a[ko]=min(a[ko*2+1],a[ko*2+2]);
  }
}
int find(int s,int t,int k,int l,int r){
  int m=(l+r)/2;
  if(s<=l&&r<=t){
    return a[k];
  }
  else if(r<=s||t<=l)return INF;
  
  return min(find(s,t,k*2+1,l,m),find(s,t,k*2+2,m,r));
}

Measured memory_bytes: 3716
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

one = 0
two = 0
four = 0
for i in range(N):
    a = As[i]
    if a%4==0:
        four += 1
    elif a%2==0:
        two += 1
    else:
        one += 1
if one==0:
    print('Yes')
elif one==1:
    if four>=1:
        print('Yes')
    else:
        print('No')
else:
    if one+four==N and four>=one-1:
        print('Yes')
    else:
        if four>=one:
            print('Yes')
        else:
            print('No')
    

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

int main() {
  int x;
  cin >> x;
  int a;
  a = x % 500;
  int happy = 0;
  happy += (x / 500) * 1000;
  happy += (a / 5) * 5;
  cout << happy << endl;
}

Measured memory_bytes: 3580
import sys
sys.setrecursionlimit(10**9)
n, m = map(int, input().split())

root = [-1]*n

def r(x):
    if root[x] < 0:
        return x
    else:
        root[x] = r(root[x])
        return root[x]

def unite(x, y):
    x = r(x)
    y = r(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x

def size(x):
    x = r(x)
    return -root[x]

for i in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    unite(x, y)

ans = 0
for i in range(n):
    ans = max(ans, size(i))

print(ans)

Measured memory_bytes: 96772