akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//ダイクストラ法
//#include <vector>
//#include <climits>
//#include <queue>
vector<vector<ll>> edge(0);
std::vector<long long> dijkstra(long long n, std::vector<std::vector<std::vector<long long>>> &nx, long long start) {
	std::vector<long long> ret(n, LLONG_MAX);
	std::priority_queue<std::vector<long long>, std::vector<std::vector<long long>>, std::greater<std::vector<long long>>> task;
	task.push({0, start, start});
	while (task.size()) {
		while (task.size() && ret[task.top()[2]] < LLONG_MAX) task.pop();
		if (task.empty()) break;
		std::vector<long long> v = task.top();
		task.pop();
		ret[v[2]] = v[0];
		edge.push_back({v[1], v[2]});
		for (long long i = 0; i < nx[v[2]].size(); i++) {
			std::vector<long long> w = nx[v[2]][i];
			if (ret[w[1]] < LLONG_MAX) continue;
			task.push({ret[v[2]] + w[0], v[2], w[1]});
		}
	}
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n;
	cin >> n;
	vector<vector<vector<ll>>> nx(n, vector<vector<ll>>(0));
	for (ll i = 0; i < n - 1; i++) {
		ll u, v, w;
		cin >> u >> v >> w;
		u--; v--;
		nx[u].push_back({w, v});
		nx[v].push_back({w, u});
	}

	vector<ll> w = dijkstra(n, nx, 0);
	for (ll i = 0; i < n; i++) {
		cout << (w[i] % 2 == w[0] % 2) << endl;
	}
}


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

int main() {
  int N,count= 0;
  string S;
  cin >> N;
  cin >> S;
  for(int i = 0; i< N-2;i++) {
    if(S.at(i)=='A' && S.at(i+1)=='B' && S.at(i+2)=='C') {
      count = count + 1;
    }
  }
  cout<< count <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long A,B,C;cin>>A>>B>>C;
    if(A%2==0||B%2==0||C%2==0){
        cout<<0<<endl;
        return 0;
    }
    else{
        long long MAX=max(A,max(B,C));
        long long MIN=min(A,min(B,C));
        long long MID=A+B+C-MAX-MIN;
        cout<<MIN*MID<<endl;
    }
    return 0;
}


Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

int H, W, D;

char a[505][505];

void print_polygon(int sx, int sy, char c) {
    for (int dy = -D/2+1; dy < D/2; ++dy) {
        for (int dx = abs(dy); dx <= D-1-abs(dy); ++dx) {
            int x = sx + dx, y = sy + dy;
            if (0 <= x && x < H && 0 <= y && y < W) {
                a[x][y] = c;
            }
        }
    }
}

int main() {
    cin >> H >> W >> D;
    for (int j= 0; j < 505; ++j) fill(a[j], a[j]+505, '.');
    if (D % 2 == 1) {
        for (int j = 0; j < H; ++j) {
            for (int k = 0; k < W; ++k) {
                cout << (((j+k)%2==0)?'R':'G');
            }
            cout << endl;
        }
        return 0;
    }

    for (int x = -2*D; x <= H+2*D; x += D*2) {
        for (int y = -2*D; y <= W+2*D; y += D*2) {
            print_polygon(x, y, 'R');
            print_polygon(x+D/2, y+D/2, 'Y');
            print_polygon(x+D/2, y-D/2, 'B');
            print_polygon(x+D, y, 'G');

            print_polygon(x+D, y-D, 'R');
            print_polygon(x+3*D/2, y-D/2, 'Y');
            print_polygon(x+3*D/2, y-3*D/2, 'B');
            print_polygon(x+2*D, y-D, 'G');
        }
    }

    for (int j = 0; j < H; ++j) {
        for (int k = 0; k < W; ++k) {
            cout << a[j][k];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 1144
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll n,m;cin>>n>>m;
	vi a(n),b(n);
	rep(i,0,n) cin>>a[i];

	ll val = (a[0]/2)%2;
	rep(i,1,n) if((a[i]/2)%2!=val) {cout<<"0\n"; return 0;}
	rep(i,0,n) b[i]=a[i]/2;
	ll lcm = b[0];
	rep(i,1,n) lcm = (lcm*b[i])/__gcd(lcm,b[i]);
	rep(i,0,n) if((((lcm/b[i])&1)==0)) {cout<<"0\n"; return 0;}
	ll cnt = m/lcm;
	cout<<(cnt+1)/2<<"\n";

	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll n;
  cin >> n;
  // ll n, m;
  // cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  vi arr(n), ans;
  fi(0, n) {
    cin >> arr[i];
    if(arr[i] > i + 1) {
      cout << "-1\n";
      return 0;
    }
  }

  // from n-1 to 0, take arr[i] when arr[i] is i
  // fail if arr[i + 1] > i + 1
  // ex:
  // [1] 1 1 2 2 1 2 3 2
  // [1] 1 2 2 1 2 3 2
  // 1 [2] 2 1 2 3 2
  // 1 [2] 1 2 3 2
  // [1] 1 2 3 2
  // 1 2 [3] 2
  // 1 [2] 2
  // 1 [2]
  // [1]
  // answer is bottom to up: 1, 2, 2, 3, 1, 2, 2, 1, 1
  //
  // ex:
  // 1 1 1 4 5 [6]
  // 1 1 1 4 [5]
  // 1 1 1 [4]
  // [1] 1 1
  // [1] 1
  // [1]
  // answer is bottom to up: 1, 1, 1, 4, 5, 6
  while(arr.size()) {
    for(int i = arr.size() - 1; i >= 0; i--) {
      if(arr[i] == i + 1) {
        ans.push_back(arr[i]);
        arr.erase(arr.begin() + i);
        break;
      }
    }
  }
  reverse(all(ans));
  for(int x: ans)
    cout << x << endl;
  return 0;
}



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

int *A;
int num;

int partition(int p,int r);

int main(void)
{
  int q;
  int i;

  scanf("%d",&num);

    A=calloc(num,sizeof(int));
  
  for(i=0;i<num;i++)
    {
      scanf("%d",&A[i]);
    }

  q=partition(0,num-1);

  for(i=0;i<num;i++)
    {
      if(i)
	{
	  putchar(' ');
	}
	
      if(i==q)
	{
	  putchar('[');
	}

      printf("%d",A[i]);
	
      if(i==q)
	{
	  putchar(']');
	}
    }

  putchar('\n');

  return 0;
}

int partition(int p,int r)
{
  int tmp,x;
  int i,j;

  x=A[r];
  i=p-1;

  for(j=p;j<r;j++)
    {
      if(A[j]<=x)
	{
	  i++;

	  tmp=A[i];
	  A[i]=A[j];
	  A[j]=tmp;
	}
    }

  tmp=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp;

  return i+1;
}
      
	    



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int cnt = 0;
    int alice[110] = {0};
    int bob[110] = {0};
    for(int i = a; i < b; i++){
        alice[i] = 1;
    }
    for(int i = c; i < d; i++){
        bob[i] = 1;
    }
    for(int i = 0; i < 110; i++){
        if(alice[i] == 1 && bob[i] == 1){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
n = input()    
m = n.split()
p = [int(i) for i in m]
n = input()    
m = n.split()
P = [int(i) for i in m]
nP = sorted(P,reverse=True)
A = p[3] -1
a = nP[p[3]-1]
sum = nP[p[3]-1]
V = a
for i, value in enumerate(nP):
    if i < p[3]:
        pass
    else:
        if V == value:
            sum = sum + value
            A = i
        else:
            if value + p[1] >= a:
                if ((i - p[3]+1)-(p[0] - p[2])) *p[1] <= (value +p[1])*(i - p[3]+1)-sum:
                    A = i
                    sum = sum + value
                    V = value
                else:
                    break
            else:
                break

print(A + 1)

Measured memory_bytes: 16604
# k = int(input())
# init_q = [tuple(map(int, input().split(' '))) for _ in range(k)]
cin = open(0).read().strip().split('\n')
k = int(cin[0])
init_q = [tuple(map(int, a.split(' '))) for a in cin[1:]]

import itertools, copy

# ↓これは[0]のlistオブジェクトの同じIDを持つ要素を使い回すので、init_b[0][1] = 1したときにバグる
# init_b = [[0] * 8] * 8
init_b = [[0 for _ in range(8)] for _ in range(8)]
for q in init_q:
    init_b[q[0]][q[1]] = 1

def culc_diag(list2d, k=0, r2l=False):
    """正方行列のみ"""
    n = len(list2d)

    ret = 0
    if r2l:
        if k > 0:
            ret = sum(list2d[i][n-1-k-i] for i in range(n-k))
        else:
            ret = sum(list2d[i-k][n-1-i] for i in range(n+k))
    else:
        if k > 0:
            ret = sum(list2d[i][i+k] for i in range(n-k))
        else:
            ret = sum(list2d[i-k][i] for i in range(n+k))

    return ret

for cases in itertools.permutations(range(8)):
    b = copy.deepcopy(init_b)
    for idx, c in enumerate(cases):
        if 1 != sum(b[idx]):
            b[idx][c] = 1

    if all([sum(a) for a in b]):
        t_b = [list(x) for x in zip(*b)]
        if all([sum(a) for a in t_b]):
            flg = True
            for i in range(8):
                if (culc_diag(b, k=i, r2l=False) > 1) or (culc_diag(b, k=i, r2l=True) > 1) or (culc_diag(b, k=-1*i, r2l=False) > 1) or (culc_diag(b, k=-1*i, r2l=True) > 1):
                    flg = False
            if flg:
                for row in b:
                    new_b = []
                    for ad in row:
                        new_b.append('.' if ad == 0 else 'Q')
                    print(''.join(new_b))
                break


Measured memory_bytes: 6348
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ARC072
{
    public class C
    {
        private long[] A;

        private long F(int x)
        {
            bool positive = (x & 1) != 0;
            bool force = (x & 2) != 0;

            long result = 0;

            long current;

            if (force)
            {
                if (positive)
                {
                    current = 1;
                    result += Math.Abs(A[0] - 1);
                }
                else
                {
                    current = -1;
                    result += Math.Abs(-A[0] - 1);
                }
            }
            else
            {
                current = A[0];
                if (current == 0)
                {
                    result += 1;
                    current = (positive ? 1 : -1);
                }
            }

            bool nextUp = (current < 0);

            foreach (var a in A.Skip(1))
            {
                current += a;
                if (nextUp)
                {
                    if (current <= 0)
                    {
                        result += (-current + 1);
                        current = 1;
                    }
                }
                else
                {
                    if (current >= 0)
                    {
                        result += (current + 1);
                        current = -1;
                    }
                }
                nextUp ^= true;
            }

            return result;
        }

        private void Run()
        {
            var n = int.Parse(Console.ReadLine().Trim());
            A = Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
            Console.WriteLine(Enumerable.Range(0, 4).Select(F).Min());
        }

        public static void Main()
        {
            var old = Console.Out;
            using (var writer = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Console.SetOut(writer);
                new C().Run();
                Console.Out.Flush();
                Console.SetOut(old);
            }
        }
    }
}


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

main()
{
	int m,n,r,t,min,max;
	while(cin>>m>>n)
	{
		max=m;
		min=n;
		if(n>m)
		{
			t=min;
			min=max;
			max=t;
		}
		while(r=max%min)
		{
			max=min;
			min=r;
		}
		r=m/min*n;
		cout<<min<<" "<<r<<endl;
	}
}

Measured memory_bytes: 3036
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <climits>

const int MAXN = 200001;

long double solve(int& N, std::vector<int>& v)
{
    std::sort(v.begin(), v.end());
    long double sum = v[0];
    
    for (int i = 1; i < v.size(); i++)
    {
        sum += v[i];
        sum /= 2.0;
    }

    return sum;
}

int main()
{
    int N; std::cin >> N;
    std::vector<int> v(N, 0);
    for (int i = 0; i < N; i++)
    {
        std::cin >> v[i];
    }

    long double ans = solve(N, v);

    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 3700
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	int N,R;
    cin >> N >> R;
    if(N >= 10) cout << R << endl;
    else cout << R + 100*(10-N) << endl;
    return  0;
}

Measured memory_bytes: 256
s=input()
for _ in[0]*int(input()):
 a=input().split()
 o=a[0];i=int(a[1]);j=int(a[2])+1
 if'p'==o[0]:print(s[i:j])
 else:
  t=a[3]if'p'==o[2]else s[i:j][::-1]
  s=s[0:i]+t+s[j:]


Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}


int main()
{
    fast();
    ld a,b,t;
    cin>>a>>b>>t;

    ld val= (t+0.5)/a;

    ll mul = val;

    cout<<b*mul;

}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)
	var n, a, b = nextInt(), nextInt(), nextInt()

	var ans = 0

	for i := 1; i <= n; i++ {
		var tmp = i/10000 + i/1000%10 + i/100%10 + i/10%10 + i%10
		if tmp >= a && tmp <= b {
			ans += i
		}

	}

	fmt.Println(ans)

}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int k, x; cin >> k >> x;
	if (500 * k >= x)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

typedef unsigned long long ll;

ll md = 1000000007;

int main(int, char**) 
{
	ll n, ans = 0;
	cin >> n;

	if (n < 10) {
		ans = n;
	} else if (n < 100) {
		ans = 9;
	} else {
		if (n < 1000) 
			ans = n - 100 + 10;
		else if (n < 10000)
			ans = 909;
		else if (n >= 100000)
			ans = 90909;
		else
			ans = n - 10000 + 910;
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>

using namespace std;

int H, W, N;

bool flg = true;

int cnum = 0;

void output(const vector<int> &vi, int j)
{
    if (j == W)
    {
        if (flg)
        {
            for (int k = 0; k < W; k++)
            {
                if (k == 0) printf("%d", vi[k]);
                else printf(" %d", vi[k]);
            }
            printf("\n");
        }
        else
        {
            for (int k = W - 1; 0 <= k; k--)
            {
                if (k == W - 1) printf("%d", vi[k]);
                else printf(" %d", vi[k]);
            }
            printf("\n");
        }
        flg = !flg;
        cnum = 0;
    }
    else
    {
        cnum = j;
    }
}


int main()
{
    if (scanf("%d%d%d", &H, &W, &N) < 3) return 0;

    int a;

    vector<int> vi(W);

    int bk = 0;

    int i = 0;

    while (i < N || bk > 0)
    {
        int j;

        if (bk > 0)
        {
            int tmp = bk;
            int bbk = bk;
            while (tmp > 0)
            {
                for (j = cnum; j <= cnum + bbk; j++)
                {
                    if (W <= j)
                    {
                        bk = bbk - j + cnum;
                        bbk = bk;
                        cnum = 0;
                        output(vi, j);
                        j = 0;
                        break;
                    }
                    else if (j == cnum + bbk)
                    {
                        cnum = j;
                        break;
                    }
                    else
                    {
                        bk = 0;
                    }

                    vi[j] = i;
                    tmp--;
                }
            }

            if (scanf("%d", &a) < 1) return 0;

            if (j == cnum + bk)
            {
                cnum = j;
                for (j = cnum; j <= cnum + a; j++)
                {
                    if (W <= j)
                    {
                        bk = a - j + cnum;
                        cnum = bk;
                        output(vi, j);
                        break;
                    }
                    else if (j == cnum + a)
                    {
                        cnum = j;
                        break;
                    }
                    else
                    {
                        bk = 0;
                    }

                    vi[j] = i + 1;
                }
            }
        }
        else
        {
            if (scanf("%d", &a) < 1) return 0;

            for (j = cnum; j <= cnum + a; j++)
            {
                if (W <= j)
                {
                    bk = a - j + cnum;
                    cnum = bk;
                    output(vi, j);
                    break;
                }
                else if (j == cnum + a)
                {
                    cnum = j;
                    break;
                }
                else
                {
                    bk = 0;
                }
                vi[j] = i + 1;
            }
        }

        i++;
    }

    return 0;
}

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

ifstream fin("darb.in");
ofstream fout("darb.out");
int minCost[100001], v[100001];

int main() {
    int n;

    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> v[i];

    minCost[1] = 0, minCost[2] = abs(v[2] - v[1]);
    for (int i = 3; i <= n; i++)
        minCost[i] = min(minCost[i - 1] + abs(v[i] - v[i - 1]), minCost[i - 2] + abs(v[i] - v[i - 2]));

    cout << minCost[n] << " ";

    return 0;
}

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

int main(){
    int s,s1,s2,p1=0,p2=0;
    cin >> s;
    s1 = s/100;
    s2 = s%100;

    if(s1>=1&&s1<=12) p1 ++;
    if(s2>=1&&s2<=12) p2 ++;

    if(p1&&p2) cout << "AMBIGUOUS" << endl;
    else if(p1) cout << "MMYY" << endl;
    else if(p2) cout << "YYMM" << endl;
    else cout << "NA" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int n, m, l;
    long int tmp;
    scanf("%d%d%d", &n, &m, &l);
    int a[n][m], b[m][l], c[n][l];
    for(int i=0; i<n; i++) for(int j=0; j<m; j++) scanf("%d", &a[i][j]);
    for(int i=0; i<m; i++) for(int j=0; j<l; j++) scanf("%d", &b[i][j]);
    for(int i=0; i<n; i++) for(int j=0; j<l; j++){
        tmp = 0;
        for(int k=0; k<m; k++) tmp += a[i][k] * b[k][j];
        printf("%ld", tmp);
        if(j==l-1) printf("\n");
        else printf(" ");
    }
    return 0;
}



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

int main(){
    using namespace std;
    constexpr unsigned long C = 26;
    unsigned long D;
    cin >> D;
    vector<unsigned long> c(C);
    for(auto&& i : c)cin >> i;
    vector v(D, vector<unsigned long>(C));
    for(auto&& i : v)for(auto&& j : i)cin >> j;

    vector last(C, vector<unsigned long>{0});
    vector<unsigned long> ans(D);

    for(unsigned long i{0}; i < D; ++i){
        unsigned long mx{0}, mxi{0};
        for(unsigned long j{0}; j < C; ++j){
            unsigned long tmp{v[i][j] + c[j] * (i + 1 - last[j].back())};
            if(tmp > mx){
                mx = tmp;
                mxi = j;
            }
        }
        ans[i] = mxi;
        last[mxi].push_back(i + 1);
    }
    for(auto&& i : last)i.push_back(D + 1);

    mt19937_64 mt{random_device{}()};
    uniform_int_distribution<unsigned long> uid(1, D);

    for(unsigned long iter{0}; iter < 8000; ++iter){
        unsigned long d{uid(mt)};
        auto f = ans[d - 1];
        unsigned long tmp{c[f] * (*upper_bound(begin(last[f]), end(last[f]), d) - d) * (d - *prev(lower_bound(begin(last[f]), end(last[f]), d))) + v[d - 1][f]};
        unsigned long mx{tmp}, mxi{0};
        for(unsigned long i{0}; i < C; ++i){
            unsigned long temp{c[i] * (*upper_bound(begin(last[i]), end(last[i]), d) - d) * (d - *prev(lower_bound(begin(last[i]), end(last[i]), d))) + v[d - 1][i]};
            if(temp > mx){
                mx = temp;
                mxi = i;
            }
        }
        if(mx > tmp){
            last[f].erase(lower_bound(begin(last[f]), end(last[f]), d));
            last[mxi].insert(upper_bound(begin(last[mxi]), end(last[mxi]), d), d);
            ans[d - 1] = mxi;
        }
    }

    for(const auto& i : ans)cout << i + 1 << endl;

    return 0;
}

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

const int INF = 1e9;

int main() {
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    int ai;
    cin>>ai;
    a[i]=ai-i-1;
  }
  sort(a,a+n);

  if(n%2==1){
    int b=a[(n-1)/2];
    long long ans=0;
    for(int i=0;i<n;i++){
      ans+=abs(a[i]-b);
    }
    cout<<ans<<endl;
    return 0;
  }
  int b1=a[n/2-1];
  long long ans1=0;
  for(int i=0;i<n;i++){
    ans1+=abs(a[i]-b1);
  }
  int b2=a[n/2];
  long long ans2=0;
  for(int i=0;i<n;i++){
    ans2+=abs(a[i]-b2);
  }
  cout<<min(ans1,ans2)<<endl;

}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K; cin >> N >> K;
	vector<int> x(N), y(N); rep(i, 0, N) {
		cin >> x[i] >> y[i];
	}
	vector<int> X = x, Y = y;
	int ans = INF;
	sort(all(x));
	sort(all(y));
	rep(sx, 0, N)rep(sy, 0, N)
		rep(dx, sx, N)rep(dy, sy, N) {
		dump(x[sx], x[dx], y[sy], y[dy]);
		auto inrange = [&](int i, int j) { return i >= x[sx] && i <= x[dx] && j >= y[sy] && j <= y[dy]; };
		int k = 0;
		rep(i, 0, N) {
			if (inrange(X[i], Y[i]))
				k++;
		}
		dump(k);
		if (k >= K) {
			chmin(ans, (x[dx] - x[sx])*(y[dy] - y[sy]));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>

using namespace std;

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

int main(){
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    char nx;
    int num[3] = {0, 0, 0};
    nx = 'a';
    string ans = "ABC";
    while(true){
        int idx = nx - 'a';
        // cout << idx << " " << num[idx] << " " << s[idx][num[idx]] << endl;
        if(num[idx] == s[idx].size()){
            cout << ans[idx] << endl;
            return 0;
        }
        nx = s[idx][num[idx]];
        num[idx]++;
        

    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,J = 3;
  string S;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> S;
    if(S == "Y"){
      J = 4;
      break;
    }
  }
      
  if(J == 3)
    cout << "Three"<<endl;
  else
    cout <<"Four" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

char c[200];

int cou[50],d[50];


int main(){
    while(1){
        int n;
        scanf("%d",&n);
        if(n == 0)
            break;
        REP(i,n){
            cin >> c[i];
            c[i] -= 'A';
        }

        REP(i,50)
            cou[i] = 0;

        REP(i,n){
            cou[c[i]]++;

            memcpy(d,cou,26 * sizeof(int));


            sort(d,d + 26);

            if(i == n - 1){
                if(d[25] == d[24])
                    printf("TIE\n");
                else{
                    int max = 0,index;
                    REP(j,26){
                        if(max < cou[j]){
                            max = cou[j];
                            index = j;
                        }
                    }
                    printf("%c %d\n",index + 'A',n);
                }
            }else if(d[25] > d[24] + n - i - 1){
                int index;
                REP(j,26){
                    if(d[25] == cou[j]){
                        index = j;
                        break;
                    }
                }
                printf("%c %d\n",index + 'A',i + 1);
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3208
f = True
while f:
    x = map(int, raw_input().split())
    if x == [0, 0]:
        f = False
    else:
        deck = list(range(x[0]))
        deck.reverse()
        deck = map((lambda x: x + 1), deck)
        times = x[1]
        for i in range(times):
            p, c = tuple(map(int,raw_input().split()))
            deck = deck[p-1:p-1+c] + deck[0:p-1] + deck[p-1+c:]
        print deck[0]

Measured memory_bytes: 6248
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;

int main(){
    int N; cin >> N;
    vector<int> d(N);
    for(int i=0;i<N;i++){
        cin >> d[i];
    }
    int sum=0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            sum += d[i]*d[j];
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
# coding:utf-8
a, b, c = map(int, input().split())
k = int(input())
counter = 0

while a >= b:
    counter += 1
    b = b * 2

while b >= c:
    counter += 1
    c = c * 2

if counter <= k:
    print('Yes')
else:
    print('No')


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

# スペース区切りの整数の入力
N = int(input())
an = list(map(int, input().split()))

sum_cnt = 0
for a in an:
    tmp = a
    cnt = 0
    while tmp % 2 == 0:
        cnt += 1
        tmp = tmp / 2

    sum_cnt += cnt

print(sum_cnt)


Measured memory_bytes: 4148
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 12345678901234567

const int maxn = 1e5 + 10;


//initialization here
//
int n, ma, mb;
int a[50], b[50], c[50];
int dp[50];
//
//initialization finish


// your function is here
//

//
// your function finished



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

	// your code is here
	//
	int x; cin >> x;
	if (x < 1200) Print("ABC");
	else Print("ARC");



	//
	// your code finished
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;cin>>s;
    int res=s.length()/2;
    for (int i=0;i<(int)s.length();++i) res-=s[i]=='p';
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 3828
using namespace std;

typedef   long long  int ll;
#include <bits/stdc++.h>


//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
#define fast  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
#define all(a) a.begin(),a.end()
//#define mod 998244353


#define mod   998244353

#define inf 1e18
//#define mod 3
#define flush fflush(stdout)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<ll, ll, hash< ll > > ht;

// find_by_order()  // order_of_key
typedef tree<
    ll,
    null_type,
    less<ll>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;






ll power1(ll a, ll b)//a raised to power b
   {  if(b<=0) return 1; if(b==1) return a;
       ll c=power1(a,b/2);
        c*=c;c%=mod;if(b%2==1) c*=a;c%=mod;
        return c;
   }
   ll mi(ll a,ll m)
   { ll c= power1(a,m-2);

     return c;
   }



 struct less_then_greater {
    template<typename T, typename U>
    bool operator()(T const& lhs, U const& rhs) const {
        if (lhs.first < rhs.first) return true;
        if (rhs.first < lhs.first) return false;
        return lhs.second > rhs.second;
    }
};

 /*std::priority_queue<std::pair<int, int>,
                    std::vector<std::pair<int, int>>,
                    less_then_greater
                    > pq;*/


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

  if(s.back()=='s')s+="es";
  else s+="s";
  cout<<s;   

    return 0;
}



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

using namespace std;

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

  vector<int> m(N);
  for (int i = 0; i < N; ++i) {
    cin >> m[i];
    X -= m[i];
  }

  cout << N + X / *min_element(m.begin(), m.end());
}

Measured memory_bytes: 256
import itertools
N, K = list(map(int, input().split()))
d = []
A = []
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
#print(A)
#s = list(set((list(itertools.chain.from_iterable(A)))))
s = set(itertools.chain.from_iterable(A))
print(N - len(s))

Measured memory_bytes: 9152
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vint a(n);
    rep(i, n) {
        cin >> a[i];
        a[i] -= i+1;
    }
    sort(all(a));
    int b;
    if (n%2 == 1) b = a[n/2];
    else b = (a[n/2-1] + a[n/2]) / 2;
    ll ans = 0;
    rep(i, n) ans += abs(a[i] - b);
    

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pll = pair<long long int,long long int>;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
ll l=1000000007;
string alphabet="abcdefghijklmnopqrstuvwxyz";
using graph = vector<vector<char>>;
double pi=3.14159265358979;

int main() {
  int n; cin>>n;
  if(n%1000==0)cout<<0;
  else{cout<<1000-n%1000<<endl;}
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<math.h>
int main(){
	
	double a,b,C;
	double c,S,L,H;
	
	scanf("%lf%lf%lf",&a,&b,&C);
	C=C * 3.1415926535 / 180;
	c=sqrt(a*a+b*b-2*a*b*cos(C));
	
	
	S=0.5*a*b*sin(C);
	L=a+b+c;
	H=2*S/a;
	
	printf("%.8f\n%.8f\n%.8f\n",S,L,H);
	return 0;
}

Measured memory_bytes: 680
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	string s;
	int n, x;
	while (cin >> s && s != "-") {
		queue <char> q;
		for (int i = 0; i < s.size(); i++) q.push(s[i]);
		for (cin >> n; n--; ) {
			cin >> x;
			for (int i = 0; i < x; i++) {
				char ch = q.front();
				q.pop();
				q.push(ch);
			}
		}
		while (!q.empty()) cout << (char) q.front(), q.pop();
		cout << endl;
	}
}


Measured memory_bytes: 3176
using System;

namespace debug
{
    class Program
    {
        static void Main(string[] args)
        {
            ProgramD a = new ProgramD();
            a.main();

        }
    }

    //ABC115
    class ProgramA
    {
        public void main()
        {
            int D = int.Parse(Console.ReadLine());

            if (D == 25)
                Console.WriteLine("Christmas");
            else if (D == 24)
                Console.WriteLine("Christmas Eve");
            else if (D == 23)
                Console.WriteLine("Christmas Eve Eve");
            else
                Console.WriteLine("Christmas Eve Eve Eve");
        }
    }

    //ABC162
    class ProgramB
    {
        public void main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];

            for (int i = 0; i < n; i++)
                a[i] = int.Parse(Console.ReadLine());

            Array.Sort(a);
            int ans = 0;
            
            for (int i = 0; i < n; i++)
            {
                //偶数の時
                if (i == n - 1)
                {
                    ans += a[i] / 2;
                }
                else
                    ans += a[i];

            }

            Console.WriteLine(ans);
        }
    }

    //ABC161_F問題
    
    class ProgramC
    {
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int k = int.Parse(s[1]);
            long[] a = new long[n];

            for (int i = 0; i < n; i++)
                a[i] = long.Parse(Console.ReadLine());

            Array.Sort(a);

            long ans = 1000000000000;

            for (int i = k - 1; i < n; i++)
            {
                ans = Math.Min(ans, a[i] - a[i - k + 1]);
            }

            Console.WriteLine(ans);
        }
    }

    class ProgramD
    {
        static long[] dp;
        static long[] p;
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            long n = long.Parse(s[0]);
            long x = long.Parse(s[1]);

            dp = new long[n + 1];
            p = new long[n + 1];
            dp[0] = 1;
            p[0] = 1;
            for (int i = 0; i < n; i++)
            {
                dp[i + 1] = 3 + 2 * dp[i];
                p[i + 1] = 1 + 2 * p[i];
            }

            Console.WriteLine(dfs(n, x));
        }

        static long dfs(long n, long x)
        {
            if (n == 0)
            {
                if (x >= 1)
                    return 1;
                else
                    return 0;
            }
            else if (x <= 1 + dp[n - 1])
                return dfs(n - 1, x - 1);
            else
                return p[n - 1] + 1 + dfs(n - 1, x - 2 - dp[n - 1]);

        }
    }


}


Measured memory_bytes: 11092
// Last Change: 08/04/2019 21:21:11.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

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

  ll ipt, tmp = 0;
  bool ans = true;
  for (ll i = 0; i < N; ++i) {
    cin >> ipt;
    if (tmp - ipt > 1) {
      ans = false;
      ;
    }
    tmp = max(tmp, ipt);
  }

  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
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; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
    int k; cin >> k;
    int cnt=1;
    int d = 7;
    rep(i,k){
        d = d % k;
        if(d==0){
            out(cnt);
            return 0;
        }
        else{
            d = d*10 + 7;
            cnt++;
        }
    }
    out(-1);
}

Measured memory_bytes: 3668
dp = 21.times.map{ 11.times.map{ [0] * 156 } }

cnt = 1
(1..20).each do |n|
  cnt.downto(1).each do |j|
    (1..155).each do |k|
      dp[n][j][k] += dp[n - 1][j][k]
      dp[n][j][n + k] += dp[n - 1][j - 1][k] if n + k <= 155
    end
  end
  dp[n][1][n] = 1
  cnt += 1 if cnt < 10
end
 
loop do
  n, k, s = gets.split.map(&:to_i)
  break if n == 0
  p dp[n][k][s]
end

Measured memory_bytes: 8828
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[][]hw = new int[10000][2];

		int h = 1;
		int w = 1;

		//何セット分入力したか
		int count = 0;

		for (int i = 0; h != 0 || w != 0; i++) {

			String line = sc.nextLine();
			String[]HW = line.split(" ");
			h = Integer.parseInt(HW[0]);
			w = Integer.parseInt(HW[1]);

			hw[i][0] = h;
			hw[i][1] = w;

			count++;
		}



		//これで高さと横をint型で出せるようになった
		for (int i = 0; i < count-1 ; i++) {


			StringBuilder x = new StringBuilder();

			for (int j = 0; j < hw[i][1]; j++) {

				if (j == 0 || j%2 == 0 ) {
					x.append("#");
				} else {
					x.append(".");
				}

			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < hw[i][1]; j++) {

				if (j == 0 || j%2 == 0 ) {
					a.append(".");
				} else {
					a.append("#");
				}

			}

			String b = a.toString();

			for (int j = 0; j < hw[i][0]; j++) {
				if (j == 0 || j%2 == 0) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}
			}



			System.out.println("");
		}


	}

}



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

int memo[2][2019];
int N, Z, W;
int Ci[2019];

int calc(int turn, int index, int xPoint, int yPoint) {
    if (index == N) {
        return abs(xPoint - yPoint);
    }
    if (memo[turn][index] >= 0) {
        return memo[turn][index];
    }
    if (turn == 0) {
        int v = -1;
        for (int i = index; i < N; i++) {
            v = max(v, calc(1, i + 1, Ci[i], yPoint));;
        }
        return memo[turn][index] = v;
    }
    int v = pow(2, 30);
    for (int i = index; i < N; i++) {
        v = min(v, calc(0, i + 1, xPoint, Ci[i]));;
    }
    return memo[turn][index] = v;
}

int main()
{
    cin >> N >> Z >> W;
    rep(i, N) {
        cin >> Ci[i];
    }
    rep(i, 2) rep(j, 2019) memo[i][j] = -1;
    int score = calc(0, 0, Z, W);
    cout << score << endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int a, b, c, d, e, f;
int dp[4000][4000];
int main() {
	dp[0][0] = 1;
	for (int i = 0; i < 4000; i++) {
		for (int j = 0; j < 4000; j++) {
			if (i == 0 || j == 0)dp[i][j] = 1;
			else { dp[i][j] = dp[i - 1][j] + dp[i][j - 1]; }
			dp[i][j] %= 100000007;
		}
	}
	int n, m, a, b, c, d, p = 1000000000, q = 0;
	cin >> n >> m >> a >> b >> c >> d;
	for (int i = -2; i <= 2; i++) {
		for (int j = -2; j <= 2; j++) {
			int x = c + i*n;
			int y = d + j*m;
			x -= a; y -= b;
			if (x < 0)x = -x;
			if (y < 0)y = -y;
			if (x + y < p) { p = x + y; q = dp[x][y]; }
			else if (x + y == p) { q += dp[x][y]; q %= 100000007; }
		}
	}
	cout << q << endl;
	return 0;
}

Measured memory_bytes: 63664