akhauriyash/Code-Regression huggingface dataset:
/*input

*/
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define debug(x) cerr << (x) << '\n';
#define bits(x,i) ((x >> i) & 1)
#define mid ((l+r)/2)
#define pr pair<int,int>
using namespace std;
const int N = 2005;
pair<int,int> a[N];
long long dp[N][N];
int n;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	up(i,1,n) {
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(a+1,a+1+n);
	reverse(a+1,a+1+n);
	for(int s=1;s<=n;++s){
		for(int i=0;i<=s;++i){
			int j = s - i;
			if (i) dp[i][j] = dp[i-1][j] + 1LL * (a[s].second - i) * a[s].first;
			if (j) dp[i][j] = max(dp[i][j], dp[i][j-1] + 1LL * (n - j + 1  - a[s].second) * a[s].first);
		}
	}
	long long ans = 0;
	for(int i=0;i<=n;++i){
		ans = max(ans, dp[i][n-i]);
	}
	cout << ans;
}

Measured memory_bytes: 26324
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i);
    }
    for(int i=0;i<N;i++){
        int key=A.at(i);
        int j=i-1;
        while(j>=0&&A.at(j)>A.at(j+1)){
            A.at(j+1)=A.at(j);
            j--;
            A.at(j+1)=key;
        }
        int k;
        for(k=0;k<N-1;k++){
            cout<<A.at(k)<<' ';
        }
        cout<<A.at(k)<<endl;
    }
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n;
	cin >> n;
	n %= 1000;
	if (n == 0) co(0);
	else co(1000 - n);

	return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
struct node{
    int l,r;
    long long mx = 0;
};
node tree[200005*4+5];
vector<pair<int,int>>robot;
void build(int cur, int l, int r){
    tree[cur].l = l;
    tree[cur].r = r;
    if(l == r){
        tree[cur].mx = robot[l].first+robot[l].second;
    }
    else{
        int mid = (l+r)/2;
        build(cur*2,l,mid);
        build(cur*2+1,mid+1,r);
        tree[cur].mx = max(tree[cur*2].mx,tree[cur*2+1].mx);
    }
}
void update(int cur,long long goal, long long num){
    if(tree[cur].l == tree[cur].r &&tree[cur].l == goal){
        tree[cur].mx = num;
    }
    else{
        int mid = (tree[cur].l+tree[cur].r)/2;
        if(goal <= mid){
            update(cur*2,goal,num);
        }
        else{
            update(cur*2+1,goal,num);
        }
        tree[cur].mx = max(tree[cur*2].mx,tree[cur*2+1].mx);
    }
}
long long fnd(int cur, int l , int r){
    if(tree[cur].l >=l && tree[cur].r <= r){
        return tree[cur].mx;
    }
    else{
        int mid = (tree[cur].l+tree[cur].r)/2;
        long long best;
        bool st = false;
        if(l<=mid ){
            st = true;
            best = fnd(cur*2,l,r);
        }
        if(mid+1 <=r){
            if(st){
                best = max(fnd(cur*2+1,l,r),best);
            }
            else{
                st =true;
                best = fnd(cur*2+1,l,r);
            }
        }
        if(st)
        return best;
        else
        {
            return -10000000000;
        }
        
    }
}
int main(void){
    ios_base::sync_with_stdio(false);
	int n;
    long long const mod = 998244353;
    while(cin>>n){
        robot.resize(n);
        for(int i = 0; i < n; i++){
            cin>>robot[i].first>>robot[i].second;
        }
        sort(robot.begin(),robot.end());
        build(1,0,n-1);
        vector<long long>total(n+5,1);
        vector<long long>loc(n);
        for(int i =0 ; i < n;i++){
            loc[i]=robot[i].first;
        }
        for(int i  = n-1; i >=0; i--){
            long long check = robot[i].first+robot[i].second;
            auto iter = lower_bound(loc.begin(),loc.end(),check);
            long long temp = iter-loc.begin();
            // cout<<temp<<'\n';
            check = fnd(1,i,temp-1);
            // cout<<check<<'\n';
            update(1,i,check);
            iter = lower_bound(loc.begin(),loc.end(),check);
            temp = iter-loc.begin();
            total[i]=(total[i+1]+total[temp])%mod;
            //cout<<check<<' '<<total[i]<<'\n';
        }
        cout<<total[0]<<'\n';
    }
}

Measured memory_bytes: 17408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin >> a[i];
    }
    vector<ll>col(9,0);
    for(ll i=0;i<n;i++){
        ll x=0;
        while(a[i]>=400){
            a[i]-=400;
            x++;
            if(x>=8){
                break;
            }
        }
        col[x]++;
    }
    ll ans_min=0;
    for(ll i=0;i<8;i++){
        if(col[i]>0){
            ans_min++;
        }
    }
    ll ans_max=ans_min;
    ans_max+=(col[8]);
    if(ans_min==0) ans_min++;
    cout << ans_min << " " << ans_max << endl;
}

Measured memory_bytes: 3628
// abc161_a
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int x,y,z;
  cin>>x>>y>>z;
  cout<<z<<" "<<x<<" "<<y<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    string s,t;cin>>s>>t;
    rep(i,0,n){
        cout<<s[i]<<t[i];
        
    }
    cout<<endl;
}


Measured memory_bytes: 256
import Data.IORef
import Control.Monad

main :: IO ()
main = do
  n <- readLn :: IO Int
  s <- getLine
  mxRef <- newIORef 0
  xRef <- newIORef 0
  forM_ s $ \c -> do
    mx <- readIORef mxRef
    if c == 'I'
      then modifyIORef xRef (+ 1)
      else modifyIORef xRef (subtract 1)
    x <- readIORef xRef
    writeIORef mxRef $ max mx x

  print =<< readIORef mxRef


Measured memory_bytes: 508
#include <iostream>

using namespace std;

int main(void)
{
	int n;
	char data[128];
	for (char c = 'a'; c <= 'z'; c++){
		data[c - 'a'] = c;
	}
	for (char c = 'A'; c <= 'Z'; c++){
		data[c - 'A' + 26] = c;
	}
	for (char c = 'a'; c <= 'z'; c++){
		data[c - 'a' + 26 * 2] = c;
	}
	for (char c = 'A'; c <= 'Z'; c++){
		data[c - 'A' + 26 * 3] = c;
	}

	while (cin >> n, n){
		int key[n];
		for (int i = 0; i < n; i++){
			cin >> key[i];
		}
		string station;
		cin >> station;
		for (int i = 0; i < station.length(); i++){
			char c = station[i];
			int num;
			if ('a' <= c && c <= 'z'){
				num = c - 'a' + 26 * 2;
			}
			else {
				num = c - 'A' + 26 * 3;
			}
			cout << data[num - (key[i % n])];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include<stdio.h>
int main()
{
    char a,b;
    scanf("%c %c",&a,&b);
    if(a>b)
    {
        printf(">\n");
    }
    else if(a<b)
    {
        printf("<\n");
    }
    else
    {
        printf("=\n");
    }
    return 0;
}


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

int n,w;
long long int sol[101][100002];
long long int tez[101],vri[101];
int main () {
	
	cin >>n>>w;
	for(int i=0;i<n;i++)
		cin >>tez[i]>>vri[i];
	for(int i=1;i<=w;i++)
		if (tez[0] <= i)
			sol[0][i] = vri[0];
		else sol[0][i] = 0;
	for(int i=1;i<n;i++) {
		for(int j=0;j<=w;j++) {
			if (j < tez[i])
				sol[i][j] = sol[i - 1][j];
			else
				sol[i][j] = max(sol[i - 1][j], vri[i] + sol[i - 1][j - tez[i]]);
		}
	}
	/*
	for(int i=0;i<n;i++) {
		for (int j=0;j<=w;j++) {
			cout <<sol[i][j]<<" ";
		}
		cout <<endl;
	}*/
	cout <<sol[n - 1][w];
	return 0;
}

Measured memory_bytes: 78336
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<map>
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1000000000 + 7, INF = 1e18;

set<string> strs;
map<string, lint> cnt;
lint N;
string s;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		cin >> s;
		strs.insert(s);
		cnt[s]++;
	}
	lint maxv = 0;
	for (auto itr : cnt) {
		chmax(maxv, itr.second);
	}
	for (auto itr : cnt) {
		if (maxv == itr.second) cout << itr.first << endl;
	}
}


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

int main(){
    std::string s;
    while(std::cin >> s){
      if(s=="0") return 0;
        int sum = 0;
        for(int i=0; i<s.length(); i++){
          sum += s[i] - '0';
        }
        std::cout << sum << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
char s[110][110];
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

ll a[110][110];

int main() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int doll = min(a + b, c * 2);
	int ans = 0;
	if (x >= y) {
		ans = min(doll * x, doll * y + a * (x - y));
	}
	else {
		ans = min(doll * y, doll * x + b * (y - x));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;

void print(const vector<int>& res) {
  for (int i = 0; i < res.size(); i++)
    cout << (i == 0 ? "" : " ") << res[i];
  cout << endl;
}

bool check(const vector<int>& res, const vector<int>& G){
  for (int i = 0; i < res.size()-1; i++)
    if (res[i+1] == G[res[i]]) return false;
  return true;
}

int main(){
  int N; cin >> N;
  vector<int> G(N+1), in(N+1, 0);
  set<int> av;
  for (int i = 1; i <= N; i++) {
    cin >> G[i];
    av.insert(i);
    in[G[i]]++;
  }

  if (N == 2) {
    cout << -1 << endl;
    exit(0);
  }

  int u = -1;
  vector<int> res;
  while (not av.empty()) {
    auto it = av.begin();
    if (u != -1 and *it == G[u]) ++it;
    if (it == av.end()) --it;
    u = *it;

    auto it2 = av.find(G[u]);
    if (it2 != av.end() and in[G[u]] == av.size()-1) u = G[u];

    res.push_back(u);
    av.erase(u);
    in[G[u]]--;
  }

  int& a = res[N-1];
  int& b = res[N-2];
  int& c = res[N-3];
  int sum = a+b+c;
  c = min(a, min(b, c));
  a = max(a, max(b, c));
  b = sum - c - a;

  do {
    if (check(res, G)) {
      print(res);
      exit(0);
    }
  } while (next_permutation(res.begin(), res.end()));
}


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

int adj[100][100];
int a[100][100];
int b[100][100];
int c[100][100];
int val[100][100][100];

int n;
int matching[100], done[100];

int match(int i) {
  for (int j = 0; j < n; j++) {
    if (adj[i][j] && !done[j]++ && (matching[j] == -1 || match(matching[j]))) {
      matching[j] = i;
      return 1;
    }
  }
  return 0;
}

vector<pair<int,int>> maxmatch() {
  fill_n(matching, n, -1);
  for (int i = 0; i < n; i++) {
    fill_n(done, n, 0);
    assert(match(i));
  }
  vector<pair<int,int>> r;
  for (int i = 0; i < n; i++) {
    r.push_back({matching[i], i});
  }
  return r;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int h, w;
  cin >> h >> w;
  n = h;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> a[i][j];
      int y = (a[i][j]-1)/w;
      val[i][y][adj[i][y]++] = a[i][j];
    }
  }
  for (int j = 0; j < w; j++) {
    for (auto p : maxmatch()) {
      int i = p.first, y = p.second;
      b[i][j] = val[i][y][--adj[i][y]];
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << b[i][j] << ' ';
    }
    cout << endl;
  }
  for (int j = 0; j < w; j++) {
    vector<int> col(h);
    for (int i = 0; i < h; i++)
      col[i] = b[i][j];
    sort(col.begin(), col.end());
    for (int i = 0; i < h; i++)
      c[i][j] = col[i];
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << c[i][j] << ' ';
    }
    cout << endl;
  }
}


Measured memory_bytes: 4608
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            var sum = 800 * N;
            sum -= N / 15 * 200;

            Console.WriteLine(sum);
        }
    }
}

Measured memory_bytes: 11092
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string s;
  cin >> s;
  cout << s.at(0) << s.at(1) << s.at(2) << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    string s;
    cin >>s;
    int i;
    for(i=0;i<s.size();i+=2){
      cout << s[i];
    }
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  
  cin>>n;
  
  int a[n];
  
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  
  int max=a[0],count=1;
  
  for(int i=0;i<n;i++)
  {
    if(max>a[i])
    {
      count++;
      max=a[i];
    }
  }
  cout<<count;
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
using namespace std;
int n, s;
pair<int, int> a[100005];
int main() {
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++) scanf("%d", &a[i].first), a[i].second = i;
	sort(a, a+n);
	for(i=0; i<n; i++) s += abs(a[i].second - i) % 2;
	printf("%d", s/2);
	return 0;
}

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

int main(void){
	char s[100];
	int len;
	int i;
	scanf("%s",s);
	
	len = strlen(s);

	for(i=0;i<len;i++){
		if(i==5 || i==13){
			printf(" ");
		}else{
			printf("%c",s[i]);

		}
	}
	printf("\n");

return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
#define bg begin()
#define en end()
#define pb push_back
#define w(x) scanf("%d",&x);while(x--)
#define ws(x) scanf("%d",&x);getchar();while(x--)
#define rep(i,b) for(i=0;i<=b;i++)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 2*acos(0.0)
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

const int N=1e6+2;
long long  mod=1e9+7;
int t,j,cs=0,n,a,b,i,dxx[]={1,0,0,-1},dyy[]={0,-1,1,0},k,m;
vi adj[N];
bool visited[N];

int bfs(int a){
    visited[a]=1;
    queue<int> q;
    int cnt=1;
    q.push(a);
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(auto u:adj[v]){
            if(!visited[u]){
                cnt++;
                visited[u]=1;
                q.push(u);
            }
        }
    }
    return cnt;
}
int main()
{
    int mx=0,cnt=0;
    cin>>n>>m;
    for(i=0;i<m;i++){
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    for(i=1;i<=n;i++){
        if(!visited[i])
            mx=max(mx,bfs(i));
    }
    cout<<mx<<endl;
}



Measured memory_bytes: 33920
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
   FAST/**/
   
   ll x;
   cin>>x;
   if(x<100)
   {
       cout<<0;
       return 0;
   }
   
   ll c1 = x/100;
   ll rem = x%100;
   if(c1*5<rem)
       cout<<0;
   else cout<<1;       
   
   return 0;
}  
   

Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, counter = 0, w, h;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
map<ll, ll> mp;

int main() {
	cin >> n >> k;
	REP(i,n+1)
	REP(j,n+1)
	{
		ll t = k - i - j;
		if (t >= 0 && n >= t) ans++;
	}
	cout << ans << endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    ll a, b, c, k; cin >> a >> b >> c >> k;
    if(k % 2 == 0) cout << a - b << endl;
    else cout << b - a << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3604
def maximumProfit(A, N):
    minR = A[0]
    minP = A[1] - A[0]
    for i in range(1, N):
        R = A[i] - minR
        if R > minP:
            minP = R
        if A[i] < minR:
            minR = A[i]
    return minP

if __name__ == "__main__":
    N = input()
    A = []
    for i in range(N):
        A.append(input())
    print maximumProfit(A, N)

Measured memory_bytes: 18896
#include <stdio.h>
#include <math.h>
#include <string.h>
#define rep(i,a,n) for(int i=a;i<n;i++)

int main(){
	int len;
	char s[1010];
	while(1){
		int ans=0;
		scanf("%s",s);
		len=strlen(s);
		if(len==1 && s[0]=='0') break;
		rep(i,0,len){
			ans+=s[i]-'0';
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 964
#include<stdio.h>

void matrixChainOrder(int *);
int m[101][101];
int n;

int main(){
  
  int i,r,c;
  int p[100];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&r,&c);
    if(i==n-1) p[n]=c;
    p[i]=r;
  }

  matrixChainOrder(p);
  printf("%d\n",m[1][n]);

  return 0;
}

void matrixChainOrder(int *p){
  int l,i,j,q,k;
  
  for(i=1;i<=n;i++){
    m[i][i] = 0;
  }
  for(l=2;l<=n;l++){ 
    for(i=1;i<=n-l+1;i++){ 
      j = i+l-1;
      m[i][j] = 1000000000;
      for(k=i;k<j;k++){
	q = m[i][k] + m[k+1][j]+p[i-1]*p[k]*p[j];
        if(m[i][j]>=q)  m[i][j] = q;
      }
    }
  }
}

Measured memory_bytes: 636
n=int(input())
t=tuple([0]+list(map(int,input().split()))+[0])
a=tuple([0]+list(map(int,input().split()))+[0])
if n==1 and t[1]!=a[1]:
    print(0)
    exit()
c=1
m=10**9+7
for i in range(1,n):
    if t[i]>t[i-1]:
        if a[i]>a[i+1]and a[i]!=t[i]or a[i]==a[i+1]and a[i]<t[i]:
            print(0)
            exit()
    else:
        if a[i]>a[i+1]and a[i]>t[i]:
            print(0)
            exit()
        if a[i]==a[i+1]:
            c=min(t[i],a[i])*c%m
print(c)

Measured memory_bytes: 88932
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
int cnt;
void merge(int *a, int left, int mid, int right){
	int i;
	int j;
	int k;
	int n1=mid-left;
	int n2=right-mid;
	vector<int> L;
	vector<int> R;
	rep(i, n1) L.pback(a[left+i]);
	rep(i, n2) R.pback(a[mid+i]);
	L[n1] = 2e9;
	R[n2] = 2e9;
	for(i=0, j=0, k=left;k<right;k++){
		if(L[i]<=R[j]){
			a[k] = L[i];
			i++;
			cnt++;
		}else{
			a[k] = R[j];
			j++;
			cnt++;
		}
	}
}

void mergesort(int *a, int left, int right){
	if(left+1<right){
		int mid = (left+right)/2;
		mergesort(a, left, mid); //bunkatsu(recursion)
		mergesort(a, mid, right);
		merge(a, left, mid, right);
	}
}

int main(){
	int i;
	int n;
	int a[500001];
	cin >> n;
	rep(i, n) scanf("%d",&a[i]);
	mergesort(a, 0, n);
	rep(i, n){
		if(i !=0)printf(" ");
		printf("%d", a[i]);
	}
	printf("\n");
	cout << cnt << endl;
}





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

using namespace std;


int main(){ 
    long long  n1,n2,n3;
    cin>>n1>>n2>>n3;
     if((n1%n3)!=0){
	 
     long long num1=  (n2/n3)-(n1/n3);
     cout<<num1; 
 }
     else {
	 
	long long num2=  (n2/n3) -(n1/n3)+1;
       cout<<num2;
   }
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int l,x,j,z=1e9+7;
  int64_t y=1;
  cin>>l;
  vector<int> v(l);
  for(j=0;j<l;j++){
    cin>>x;
    v.at(x)++;
  }
  for(j=l-1;j>0;j-=2){
    if(v.at(j)!=2){
      y=0;
      break;
    }
  }
  if(j==0&&v.at(j)!=1) y=0;
  if(y==1) for(j=0;j<l/2;j++) y=y*2%z;
  cout<<y<<endl;
}

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

#define int long long
#define rep(i,a,n) for(int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort((c).begin(), (c).end(), greater<int>());
#define fi first
#define se second
  
typedef pair<int,int> P;
typedef vector<int> vi;

int N;

signed main() {
    cin >> N;
    set<int> d;
    rep(i, 0, N) {
        int D; cin >> D;
        d.insert(D);
    }
    cout << d.size() << endl;
    return 0;
}


Measured memory_bytes: 256
H,W,M = map(int,input().split())
Hlist= {}
Wlist ={}
HWlist = []
for i in range(M):
    h,w = map(int,input().split())
    if h not in Hlist:
        Hlist[h] = 1
    else:
        Hlist[h] += 1
    if w not in Wlist:
        Wlist[w] = 1
    else:
        Wlist[w] += 1
    HWlist.append([h,w])
h2 = max([(v,k) for k,v in Hlist.items()])
h = h2[1]
hmax = h2[0]
Dua2 = []
for k,v in Hlist.items():
    if v == hmax:
        Dua2.append(k)
w2 = max([(v,k) for k,v in Wlist.items()])
w = w2[1]
wmax = w2[0]
Dua = []
for k,v in Wlist.items():
    if v == wmax:
        Dua.append(k)
Answer = Hlist[h] + Wlist[w]
Wld = set()
Hld = set()
sign = 0
for i in range(M):
    if HWlist[i][0] == h:
        Wld.add(HWlist[i][1])
for _ in range(len(Dua)):
    if Dua[_] not in Wld:
        break
    elif _ == len(Dua)-1:
        sign -= 1
for i in range(M):
    if HWlist[i][1] == w:
        Hld.add(HWlist[i][0])
for _ in range(len(Dua2)):
    if Dua2[_] not in Hld:
        break
    elif _ == len(Dua2)-1:
        sign -= 1
if sign == -2:
    Answer -= 1
print(Answer)

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

int main() {
  string s;
  string t;
  cin >> s;
  cin >> t;
  bool ok=true;
  for (int i=0;i<s.size();i++){
    if (s[i]!=t[i]){
      ok=false;
    }
  }
  if (ok==true){
    cout << "Yes";
  }else{
    cout << "No";
  }
	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int h,w,i,j;
	cin>>h>>w;
	bool a[h][w];
	long long int dp[h][w]={0};
	char s;
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			cin>>s;
			if(s == '.') a[i][j] = true;
			if(s == '#') a[i][j] = false;
		}
	}
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			if(i==0&&j==0)
				{dp[i][j]=1;continue;}
			else if(i==0&&a[i][j])
				{
					dp[i][j]=dp[i][j-1];
					continue;
				}
				else if(j==0&&a[i][j])
				{
					dp[i][j]=dp[i-1][j];
					continue;
				}
			if(a[i][j])
				dp[i][j] = (dp[i][j-1] + dp[i-1][j])%1000000007;
			else
				dp[i][j]=0;
		}
	}
	cout<<dp[h-1][w-1]<<endl;
	return 0;

}


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

int n;
int a[100], b[100];
vector<int> et[100];

int maxCount[100];
int maxDepth;

void dfs(int p, int v, int dep) {
	int i;
	
	maxDepth = max(maxDepth, dep);
	
	int child_cnt = 0;
	rep(i, et[v].size()) {
		int nv = et[v][i];
		if (nv == p) continue;
		dfs(v, nv, dep + 1);
		child_cnt++;
	}
	
	maxCount[dep] = max(maxCount[dep], child_cnt);
}

signed main() {
	int i, j;
	
	cin >> n;
	rep(i, n - 1) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		et[a[i]].push_back(b[i]);
		et[b[i]].push_back(a[i]);
	}
	
	int ans1 = 114514;
	int ans2;
	rep(i, n) {
		maxDepth = 0;
		rep(j, n) maxCount[j] = 0;
		dfs(-1, i, 0);
		
		int res1 = maxDepth + 1;
		int res2 = 1;
		rep(j, maxDepth) res2 *= maxCount[j];
		
		if (ans1 > res1 || (ans1 == res1 && ans2 > res2)) {
			ans1 = res1;
			ans2 = res2;
		}
	}
	
	rep(i, n - 1) {
		maxDepth = 0;
		rep(j, n) maxCount[j] = 0;
		dfs(b[i], a[i], 0);
		dfs(a[i], b[i], 0);
		
		int res1 = maxDepth + 1;
		int res2 = 1;
		rep(j, maxDepth) res2 *= maxCount[j];
		res2 *= 2;
		
		if (ans1 > res1 || (ans1 == res1 && ans2 > res2)) {
			ans1 = res1;
			ans2 = res2;
		}
	}
	
	cout << ans1 << " " << ans2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> pa(n);
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        pa[i]={a,b};
    }
    sort(pa.begin(),pa.end());
    int ans=n;
    map<pair<int,int>,int> mp;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int a=pa[j].first-pa[i].first,b=pa[j].second-pa[i].second;
            if(a==0&&b==0) continue;
            else if(mp.count({a,b})) mp[{a,b}]++;
            else mp[{a,b}]=1;
        }
    }
    int m=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        m=max(m,itr->second);
    }
    cout<<ans-m<<endl;
    return 0;
}


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

using namespace std;

/* Template file for Online Algorithmic Competitions */
/* Typedefs */
    /* Basic types */
    typedef long long           ll;
    typedef long double         ld;
    typedef unsigned long long ull;
    /* STL containers */
    typedef vector <int>    vi;
    typedef vector <ll>     vll;
    typedef pair <int, int> pii;
    typedef pair <ll, ll>   pll;
    typedef vector < pii >  vpii;
    typedef vector < pll >  vpll;
    typedef vector <string> vs;
    typedef vector < vi >   vvi;
    typedef vector < vll >  vvll;
    typedef vector < vpii > vvpii;
    typedef set <int>       si;
/* Macros */
    /* Loops */
    #define fl(i, a, b)     for(int i(a); i <= (b); i ++)
    #define rep(i, n)       fl(i, 1, (n))
    #define loop(i, n)      fl(i, 0, (n) - 1)
    #define rfl(i, a, b)    for(int i(a); i >= (b); i --)
    #define rrep(i, n)      rfl(i, (n), 1)
    /* Algorithmic functions */
    #define srt(v)          sort((v).begin(), (v).end())
    /* STL container methods */
    #define pb              push_back
    #define mp              make_pair
    #define eb              emplace_back
    /* String methods */
    #define dig(i)          (s[i] - '0')
    #define slen(s)         s.length()
    /* Shorthand notations */
    #define fr              first
    #define sc              second
    #define re              return 
    #define sz(x)           ((int) (x).size())
    #define all(x)          (x).begin(), (x).end()
    #define sqr(x)          ((x) * (x))
    #define fill(x, y)      memset(x, y, sizeof(x))
    #define clr(a)          fill(a, 0)
    #define endl            '\n'
    /* Mathematical */
    #define IINF            0x3f3f3f3f
    #define LLINF           1000111000111000111LL
    #define PI              3.14159265358979323
    /* Debugging purpose */
    #define trace1(x)                cerr << #x << ": " << x << endl
    #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl
    #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl
    /* Fast Input Output */
    #define high_functioning_sociopath                  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
/* Constants */
    const ll MOD = 1000000007LL;
    const ll MAX = 100010LL;
/* Templates */

template<typename T> T power(T x, T y, ll m = MOD){T ans = 1; x %= m; while(y > 0){ if(y & 1LL) ans = (ans * x)%m; y >>= 1LL; x = (x*x)%m; } return ans%m; }

int main(){

    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif*/

    high_functioning_sociopath;    
    string s;
    cin>>s;
    ll cnt=0;
    for (int i = 0; i < s.length(); ++i)
    {
        if(s[i] == 'o') cnt++;
    }
    ll n = s.length();
    if(cnt >= 8) cout<<"YES\n";
    else{
        if(8-cnt > 15-n) cout<<"NO\n";
        else cout<<"YES\n";
    }

    return 0;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A.sort()
c = Counter(A)

ans = 0
while A:
    a = A.pop()
    if c[a] <= 0:
        continue
    c[a] -= 1
    Num = 1 << (a.bit_length())
    cand = Num - a  # この値は必ずa以下になるはず
    if c[cand] > 0:
        ans += 1
        c[cand] -= 1

print(ans)


Measured memory_bytes: 33296
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main(){
  int a,b,c,d,e,f;
  scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
  int ans1=0,ans2=0;double rate=0.0;
  for(int i=0;i*100*a<=f;++i){
    for(int j=0;j*100*b+i*100*a<=f;++j){
      if(i+j==0)continue;
      int sum=j*100*b+i*100*a;
      int lim=min(sum/100*e,f-sum);
      for(int k=0;k*c<=lim;++k){
    int l=(lim-k*c)/d;
    int sugar=l*d+k*c;
    if(double(sugar)/sum>rate){
      rate=double(sugar)/sum;
      ans1=sum+sugar;ans2=sugar;
    }
      }
    }
  }
  if(rate==0)printf("%d %d\n",100*a,0);
  else printf("%d %d\n",ans1,ans2);
  return 0;
}

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int L;
signed main() {
    cin >> L;
    cout << pow(L / 3.0, 3) << endl;
}


Measured memory_bytes: 384
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); i++)

using namespace std;

int main() {
  string s;
  cin >> s;
  int i = 0, j = s.length() - 1;
  int ans = 0;
  while (i < j) {
    if (s[i] != s[j])
      ans++;
    i++, j--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 760
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
list = {}
for i in s:
  if i in list:
    list[i]+=1
  else:
    list[i] = 1
for i in t:
  if i in list:
    list[i] -= 1
ans = max(list.values())
if ans > 0:
  print(ans)
else:
  print(0)

Measured memory_bytes: 3064
import java.util.*;
public class Main{
	public static void main(String[] args){
		//B-Aは0から数えてB=A個ある
		//もしKの方がb-aより大きい場合全て出力＜ー下書いて思ったけどこれいらないね
		//もしKの方がb-aより小さい場合AND(b-a)/2+1<=kが大きい場合も全て出力
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int afixation = a;
		int bfixation = b;
		int allnumber = b-a+1;//全部の配列の数
		if((b-a)%2 == 1){
		if((b-a)/2+1>=k){//奇数の時
			for(;a < afixation+k;a++){
				System.out.println(a);
			}
			for(;b-k+1 <= bfixation;b++){
				System.out.println(b-k+1);
			}
		}else if((b-a)/2+1<k){//kの数が配列の半分より上にある時
			for(;a <= b;a++){
				System.out.println(a);
			}
		}
		}else if(((b-a)%2 == 0)){
		if((b-a)/2>=k){//偶数の時
			for(;a < afixation+k;a++){
				System.out.println(a);
			}
			for(;b-k+1 <= bfixation;b++){
				System.out.println(b-k+1);
			}
		}else if((b-a)/2<k){//kの数が配列の半分より上にある時
			for(;a <= b;a++){
				System.out.println(a);
			}
		}
	
		}

		
	}
}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  sort(A.begin(),A.end());
  int left=-1; int right=N; int mid;
  while(1<right-left){
    mid=left+(right-left)/2;
    int64_t sum=0;
    for(int i=0;i<=mid;i++)
      sum+=A.at(i);
    bool x=true;
    for(int i=mid+1;i<N;i++){
    if(A.at(i)<=2*sum)
      sum+=A.at(i);
      else{x=false; break;}
    }if(x)right=mid;
    else
      left=mid;
  
  }int ans=N-right;
  cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 1024
#include"iomanip"
#include"iostream"
#include"limits"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"queue"
#include"stack"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"assert.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define mset(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    if(a+b<=2*c)
    {
        cout<<a*x+b*y<<'\n';
        return 0;
    }
    ll ans=0;
    while(x>0&&y>0)
    {
        ans+=2*c;
        x--;
        y--;
    }
    while(x>0)
    {
        ans+=min(a,2*c);
        x--;
    }
    while(y>0)
    {
        ans+=min(b,2*c);
        y--;
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    long long int N,A,B,tmpA,tmpB,tmps = 10000000000,tmp=1,count=0;
    cin >> N;
    for(long long int i = 1; i <= sqrt(N); i++) {
        if(N % i == 0) {
            tmpA = i;
            tmpB = N / i;
            tmps = min(tmps,abs(tmpA-tmpB));
            if(tmps == abs(tmpA-tmpB)) {
                A = tmpA;
                B = tmpB;
            }
        }
    }
    for(long long int i = 0; i < 10; i++) {
        tmp *= 10;
        count++;
        if(tmp > max(A,B)) {
            break;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 384
N = int(input())
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
a = num2alpha(N)
print(a.lower())

Measured memory_bytes: 9176
#include<iostream>
using namespace std;
int main(){
int n,a=0,b=0,c=0,d=0;
cin>>n;
 string z[n];
  for(int i=0;i<n;i++){
    cin>>z[i];
    if(z[i]=="AC"){
      a=a+1;}
    else if(z[i]=="WA"){
    b=b+1;
    }
    else if (z[i]=="TLE"){
    c=c+1;}
    else{
    d=d+1;}}
    cout<<"AC x "<<a<<endl<<"WA x "<<b<<endl<<"TLE x "<<c<<endl<<"RE x "<<d<<endl;
return 0;
}


Measured memory_bytes: 6732
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    string S;
    cin >> S;
    int N = S.size();
    vector<vector<ll>> dp(N+1, vector<ll>(13, 0));
    dp[N][0] = 1;
    int mul = 1;
    RREP(i, N){
        int c;
        if(S[i] == '?') c = -1;
        else c = S[i] - '0';
        REP(j, 10){
            if(c != -1 && c != j) continue;
            REP(k, 13){
                (dp[i][(j * mul + k) % 13] += dp[i+1][k]) %= MOD;
            }
        }
        mul *= 10;
        mul %= 13;
    }
    pr(dp[0][5]);
}

Measured memory_bytes: 13696
import math
s=int(input())
k=10**9+7
ans=0
def h(x,y):
  m=math.factorial(x+y-1)//(math.factorial(y)*math.factorial(x-1))
  return (m%k)
if s<=2:
  print(0)
else:
  n=s//3 #項の数
  t=s%3
  for i in range(n):
    ans=(ans+h(n-i,3*i+t))%k
  print(ans)

Measured memory_bytes: 9204
import sys
x, y = map(int,input().split())

if (x + y)%3:
  print(0)
  sys.exit()

n = y - (x+y)//3
m = x - (x+y)//3

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = m+n
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

print(cmb(m+n,n,mod))

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

using namespace std;

int main(){
    int N, M, X, Y, x, y;
    cin >> N >> M >> X >>Y;
    int a[N]={};
    int b[M]={};
    for(int i=0; i<N; i++){
        cin >> x;
        a[i] +=x;
    }
    for(int i=0; i<M; i++){
        cin >> y;
        b[i] +=y;
    }  
    for(int i=0; i<N; i++){
        if(a[i]>X && a[i]<=Y){
            for(int j=0; j<N; j++){
                if(a[i]>a[j]){
                    if(j==N-1){
                        for(int k=0; k<M; k++){
                            if(a[i]<=b[k]){
                                if(k==M-1){
                                    cout << "No War" << endl;
                                    return 0;
                                }
                                continue;
                            }
                            break;
                        }
                    }
                    continue;
                }
                break;
            }
        }
    }
    for(int i=0; i<N; i++){
        if(b[i]>X && b[i]<=Y){
            for(int j=0; j<N; j++){
                if(b[i]>a[j]){
                    if(j==N-1){
                        for(int k=0; k<M; k++){
                            if(b[i]<=b[k]){
                                if(k==M-1){
                                    cout << "No War" << endl;
                                    return 0;
                                }
                                continue;
                            }
                            break;
                        }
                    }
                    continue;
                }
                break;
            }
        }
    }
    cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = InputNumList();
            var n = nk[0];
            var k = nk[1];
            var s = ReadLine();

            int score = 0;
            for (int i = 0; i < n - 1; i++)
            {
                if (s[i] == s[i + 1]) score++;
            }
            int ans = Math.Min(score + 2 * k, n - 1);
            WriteLine(ans);
        }

        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}

Measured memory_bytes: 11360