akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)); //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl; }
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

LL N, A, B, C;
vector<LL> L;

LL recursion(LL i, LL a, LL b, LL c) {
	if (i == N) {
		if (a == 0 || b == 0 || c == 0) return INF;
		else return abs(a - A) + abs(b - B) + abs(c - C);
	}


	//パターン1：今見ている竹は使わない場合
	LL res = recursion(i + 1, a, b, c);

	//パターン2:今見ている竹をAの竹に使う場合
	chmin(res, recursion(i + 1, a + L[i], b, c) + (a ? 10 : 0));

	//パターン3:今見ている竹をBの竹に使う場合
	chmin(res, recursion(i + 1, a, b + L[i], c) + (b ? 10 : 0));

	//パターン4:今見ている竹をCの竹に使う場合
	chmin(res, recursion(i + 1, a, b, c + L[i]) + (c ? 10 : 0));

	return res;
}

int main(void) {
	cin >> N >> A >> B >> C;
	L.resize(N);
	rep(i, N) cin >> L[i];

	//先に合体させて3本を作り出す 合体回数*10
	//作り出した3本のA,B,Cとの差が残りのコストになる
	
	cout << recursion(0, 0, 0, 0) << endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8

def main():
    N = int(input())
    H = list(map(int, input().split()))
    ans = 0
    tmp = 0
    tmp_h = H[0]

    for i in range(1, N):
        if H[i] <= tmp_h:
            tmp += 1
        else :
            ans = max(ans, tmp)
            tmp = 0
        tmp_h = H[i]

    ans = max(ans, tmp)

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 20392
#include<stdio.h>
long long int fact[2000006];
long long int modpow(long long int a, long long int n, long long int p)
{
	long long int res = 1;
	while (n > 0)
	{
		if (n % 2 > 0)
			res = res * a % p;
		a = a * a % p;
		n /= 2;
	}
	return res;
}
long long int comb(long long int n, long long int r, long long int p)
{
	long long int res = fact[n];
	res = res * modpow(fact[r], p - 2, p) % p;
	res = res * modpow(fact[n - r], p - 2, p) % p;
	return res;
}
int main()
{
	long long int k;
	scanf("%lld", &k);
	char s[1000006];
	scanf("%s", s);
	long long int i, n = 0;
	while (s[n] != '\0')
		n++;
	long long int p = 1000000007;
	fact[0] = 1;
	for (i = 1; i < 2000006; i++)
		fact[i] = fact[i - 1] * i % p;
	long long int ans = 0;
	for (i = n; i <= n + k; i++)
		ans = (ans + comb(i - 1, n - 1, p) * modpow(25, i - n, p) % p * modpow(26, n + k - i, p) % p) % p;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 18304
<?php
  
fscanf(STDIN, "%d", $n);
for ($i = 1; $i <= $n; $i++) {
  //$iが3を含むばあい、$include3 === True
  $include3 = False;
  $cha = str_split($i);
  for ($k = 0; $k < count($cha); $k++) {
    if ($cha[$k] === "3") {
      $include3 = True;
    }
  }
  if ($i % 3 === 0 or $include3) {
    echo " ".$i;
  }
}
echo "\n";


Measured memory_bytes: 9220
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    string in; cin >> in;
    int n = in.size();

    int r = n - 1;
    int res = 0;
    rep(l, n){
        if(l >= r) break;
        if(in[l] == 'x'){
            if(in[r] == 'x'){
                r--;
            }
            else {
                res++;
            }
        }
        else {
            if(in[r] == 'x'){
                l--;
                r--;
                res++;
            }
            else {
                if(in[l] != in[r]){
                    cout << -1 << endl;
                    return 0;
                }
                r--;
            }
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 512
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from time import time
from random import randrange
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    start = time()

    B.reverse()
    for i in range(n):
        if A[i] != B[i]:
            continue
        while time() - start < 1.8:
            j = randrange(n)
            if A[i] != B[j] and A[j] != B[i]:
                B[i], B[j] = B[j], B[i]
                break
        else:
            print("No")
            return

    print("Yes")
    print(*B)
resolve()

Measured memory_bytes: 125400
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int n, a;

  std::cin >> n;

  std::deque<int> deque;

  for (int i = 0; i < n; i ++) {
    std::cin >> a;

    if (i % 2 == 0) {
      deque.push_back(a);
    }
    else {
      deque.push_front(a);
    }
  }

  if (n % 2 == 0)  {
    for (int i = 0; i < n; i ++)
      std::cout << deque[i] << ' ';
  }
  else {
    for (int i = n - 1; i >= 0; i --)
      std::cout << deque[i] << ' ';
  }
  std::cout << std::endl;
  
  return 0;
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;



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

    vector<char> C;
    rep (i, 2) for (char c = 'a'; c <= 'z'; c++) C.pb(c);

    for (int i = 0; i < s.size(); i++) {
        if (i != s.size() - 1) {
            if (s[i] == 'a') continue;
            if (26 - (s[i] - '0' - 48) + 1 <= k) {
                k -= 26 - (s[i] - '0' - 48) + 1;
                s[i] = 'a';
            }
        }
        else {
            s[i] = C[(s[i] - '0' - 48 - 1 + k % 26)];
        }
        //cout << i << " " << k << endl;
    }


    //cout << 'z' - '0' - 48 << endl; 26

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000
int N,M,L,D;
int K[MAX_N];
int ans;
vector<char> C;
bool bool_ans;
int X[100][100];
double dis;


int solve(void) {
  int buf_ans;

  buf_ans = N / (2*D+1);

  if (N%(2*D+1) != 0) {
    buf_ans++;
  }


  return buf_ans;
}

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

  ans = solve();
  put(ans);

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int count = 0;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      if(n%2 == 1){
        count++;
      }
    }
    System.out.println(count%2==1 ? "NO" : "YES");
  }
}

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

class Dice {
public:

  int a1, a2, a3, a4, a5, a6;

  Dice(int x) {

    a1 = a2 = a3 = a4 = a5 = a6 = x;

  }

  void rotateFront() {
    int newa1 = a5;
    a5 = a6;
    a6 = a2;
    a2 = a1;
    a1 = newa1;

  }

  void rotateRight() {
    int newa1 = a4;
    a4 = a6;
    a6 = a3;
    a3 = a1;
    a1 = newa1;

  }

  void rotateLeft() {
    int newa1 = a3;
    a3 = a6;
    a6 = a4;
    a4 = a1;
    a1 = newa1;

  }

  void Spin() {

    int newa2 = a4;
    a4 = a5;
    a5 = a3;
    a3 = a2;
    a2 = newa2;

  }

};

int check(Dice,Dice);

int main(void) {

  Dice d1(0) , d2(0);
  int i, j;

  cin >> d1.a1 >> d1.a2 >> d1.a3 >> d1.a4 >> d1.a5 >> d1.a6;
  cin >> d2.a1 >> d2.a2 >> d2.a3 >> d2.a4 >> d2.a5 >> d2.a6;

  for(i = 0; i < 4; i++) {

    d1.rotateFront();

    for(j = 0; j < 4; j++) {

      d1.Spin();
      if(check(d1,d2) == 1) {

	cout << "Yes" << endl;
	return 0;

      }

    }

  }

  d1.rotateRight();
  for(j = 0; j < 4; j++) {

    d1.Spin();
    if(check(d1,d2) == 1){
    cout << "Yes" << endl;
    return 0;

    }
  }

  d1.rotateLeft();
  d1.rotateLeft();
  for(j = 0; j < 4; j++) {

    d1.Spin();
    if(check(d1,d2) == 1) {
      cout << "Yes" << endl;
      return 0;

    }
  }

  cout << "No"<< endl;

  return 0;

}

int check(Dice d1, Dice d2) {

  if(d1.a1 == d2.a1 &&
     d1.a2 == d2.a2 &&
     d1.a3 == d2.a3 &&
     d1.a4 == d2.a4 &&
     d1.a5 == d2.a5 &&
     d1.a6 == d2.a6 ) {

    return 1;

  } else {

    return 0;

  }

}

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


void trace(int a[],int n){
    int i;
    for(i = 0;i<n;i++){
        if(i>0)printf(" ");
        printf("%d",a[i]);
    }
    printf("\n");
}

void InsertionSort(int a[],int n){
    int i,j;
    int v;
    for(i = 1;i<n;i++){
        v = a[i];
        j = i - 1;
        while(j >= 0 && a[j] > v){
            a[j + 1] = a[j];
            j--;
        }
        a[j+1] = v;
        trace(a,n);
    }
}

int main(void){
    int a[100];
    int i;
    int n;
    scanf("%d",&n);
    for(i = 0;i < n;i++){
        scanf("%d",&a[i]);
    }
    trace(a,n);
    InsertionSort(a,n);
    return 0;
}


Measured memory_bytes: 2052
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    ll a[n], b[n];
    rep(i, n) {
        cin >> a[i];
    }
    sort(a, a+n);

    b[0] = a[0];
    for(int i = 1; i < n; i++) {
        b[i] = b[i-1] + a[i];
    }

    int j = 0;
    rep(i, n-1) {
        if(3*b[i] < b[i+1]) {
            j = i+1;
        }
    }

    cout << n-j;
        
    cout << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000009
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
#define top(i,j) val[i*m+j]
#define s(a,b) strcmp(a,b)
typedef long long lli;
typedef unsigned short int usi;

int main()
{
    int n, i;
    int ans=0;
    scanf("%d",&n);
    char a[n], b[n], c[n];
    scanf("%s %s %s",a,b,c);
    for(i=0; i<n; i++) {
        //printf("%c %c %c\n",a[i],b[i],c[i]);
        if(a[i]==b[i] && b[i]==c[i]) {
            ans+=0;
            //puts("0");
        } else if(a[i]==b[i] || b[i]==c[i] || c[i]==a[i]) {
            ans+=1;
            //puts("1");
        } else {
            ans+=2;
            //puts("2");
        }
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
    char s[3];
    
   scanf("%s", s);
  
   if(s[0] == 'a' || s[0] == 'b' || s[0] == 'c' ){
     if(s[1] != s[0]){
        if(s[1] == 'a' || s[1] == 'b' || s[1] == 'c' ){
           if(s[2] != s[0] && s[2] != s[1]){        
               if(s[2] == 'a' || s[2] == 'b' || s[2] == 'c' ){
                         puts("Yes");
               }
               else puts("No");
           }
           else puts("No");
        }
        else puts("No");
     }
     else puts("No");
   }
   else puts("No");
  return 0;
}

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


int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> H(N);
  rep(i, N) cin >> H[i];

  ll ans = 0;
  if (N > K) {
    sort(H.begin(), H.end());
    rep(i, N - K) ans += H[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
import sys
import collections

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	al = lin()
	al.sort()
	
	unique_al = list(set(al))
	unique_al.sort()
	
	al_counter = collections.Counter(al)
	ok=[v for v in al_counter.keys() if al_counter[v] == 1]
	d = {v:i for i,v in enumerate(ok)}
	max_v = 10**6+1
	for check in unique_al:
		for v in range(2*check, max_v, check):
			if v in d:
				ok[d[v]]=0
				
	return sum([v > 0 for v in ok ])
		
	
	
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 165396
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int N = 1000;

bool solve(int cnt[N]){
  if(cnt[1] % 2 == 0) return false;
  if(cnt[2] % 2 == 0) return false;
  FOR(i, 3, N) if(cnt[i] % 2) return false;
  return true;
}
int main() {
  int a, b;
  int cnt[N];
  memset(cnt, 0, sizeof(cnt));
  while(scanf("%d %d", &a, &b) != EOF){
    cnt[a]++;
    cnt[b]++;
    if(a == 0 && b == 0){
      cout <<(solve(cnt) ? "OK" : "NG") <<endl;
      memset(cnt, 0, sizeof(cnt));
    }
  }

  return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<vector<int>> val(2, vector<int>(N));
	for (int i = 0; i < N; ++i) {
		cin >> val[0][i];
	}
	for (int i = 0; i < N; ++i) {
		cin >> val[1][i];
	}

	int answer = 0;
	for (int i = 0; i < N; ++i) {
		if (val[0][i] - val[1][i] > 0) {
			answer += val[0][i] - val[1][i];
		}
	}

	cout << answer << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
int main() {

  string s;
  cin >> s;

  int cnt =0;

  rep(i, 4) {
    if(s[i]=='+') ++cnt;
    else --cnt;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
// Vicfred
// https://atcoder.jp/contests/dp/tasks/dp_a
// dynamic programming
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.stdio;
import std.string;

void main() {
    long n, k;
    readf("%d %d\n", &n, &k);
    const long[] h = 0~readln.split.map!(to!long).array;

    long[] dp = new long[n+1];
    dp.fill(int.max);

    dp[1] = 0;
    for(int i = 2; i <= n; ++i) {
        for(int j = 1; j <= k; ++j) {
            if(i - j >= 0) {
                dp[i] = min(dp[i],
                            dp[i-j] + abs(h[i] - h[i - j]));
            }
        }
    }
    dp[n].writeln;
}



Measured memory_bytes: 7992
#include <stdio.h>

#define N (10)
#define TOP (3)

int main()
{
	int i, j, height[TOP + 1] = {0}, temp;
	
	for (i = 0; i < N; ++i) {
		scanf("%d", &temp);
		for (j = TOP - 1; j >= 0; --j) {
			if (temp > height[j]) {
				height[j + 1] = height[j];
				height[j] = temp;
			} else {
				break;
			}
		}
	}
	
	for (i = 0; i < TOP; ++i) {
		printf("%d\n", height[i]);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std; typedef long long  ll;
#define all(a) a.begin() , a.end()
#define print(x)   cout<<x<<"\n";
const ll M = ll(1e9 + 7);
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; if (i != v.size() - 1) os << ", "; } os << "]\n"; return os;}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v)
{os << "["; for (auto it : v) {os << it; if (it != *v.rbegin())os << ", ";} os << "]\n"; return os;}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v)
{for (auto it : v)os << it.first << " : " << it.second << "\n"; return os;}
template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v)
{os << "("; os << v.first << ", " << v.second << ")"; return os;}
/***********************************************************************/
int dp[1005][1005];
const int mod = 1e9 + 7;
int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, m;
    cin >> n >> m;
    string s[n];
    for (int i = 0; i < n; i++)
        cin >> s[i];
    for (int i = 1; i <= n; i++)
    {
        if (s[0][i - 1] != '#')
            dp[1][i] = 1;
        else
            break;
    }
    for (int i = 1; i <= m; i++)
    {
        if (s[i - 1][0] != '#')
            dp[i][1] = 1;
        else
            break;
    }
    for (int i = 2; i <= n; i++)
    {
        for (int j = 2; j <= m; j++)
        {
            if (s[i - 1][j - 1] == '#')
                continue;
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
        }
    }
    cout << dp[n][m] << '\n';
}

Measured memory_bytes: 5376
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

const int MAX_N = 100005;
int N, K, X[MAX_N], zero;

void solve() {
    cin >> N >> K;
    rep(i, N) {
        cin >> X[i];
        if (X[i] == 0)zero = 1;
    }

    if (!zero)X[N++] = 0;
    sort(X, X + N);

    int p = -1;
    rep(i, N)if (X[i] == 0) {
        p = i;
        break;
    }
    assert(p != -1);

    int rig = p;
    int re = INT_MAX;
    rep(i, p + 1) {
        while (rig < N - 1 && (rig - p) + zero + (p - i) < K) {
            rig++;
        }
        if ((rig - p) + zero + (p - i) >= K) {
            int ma = max(X[rig], -X[i]), mi = min(X[rig], -X[i]);
            smin(re, ma + mi * 2);
        }
    }
    cout << re << endl;
}

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


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
    int N;
    cin>>N;
    int sort[100]={};
    int count=0;
    
    for(int i=0;i<N;i++){
        cin>>sort[i];
    }

    int x=0,y=0;

    for(int i=0;i<N;i++){
        x=i;
        for(int j=i;j<N;j++){
            if(sort[j]<sort[x]){
                x=j;
            }
        }
        if(i!=x){
                y=sort[i];
                sort[i]=sort[x];
                sort[x]=y;
                count++;
        }
        
            
        
        
    }
    
  
    for(int k=0;k<N-1;k++){
            cout<<sort[k]<<" ";
        }
    cout<<sort[N-1]<<endl;
    cout<<count<<endl;
        
    
    
    return 0;
}

    




Measured memory_bytes: 3104
X = int(input())
for b in range(0, 10000):
    a5p = X + b**5
    a5m = X - b**5
    for a in range(abs(b)+1, 10000):
        a5 = a**5
        if a5 == a5p:
            b = b
            break
        elif a5 == a5m:
            b = -b
            break
    else:
        continue
    break

print(a, b)

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

int main() {
	char c;
	cin >> c;

	if (c == 'a'|| c == 'e'|| c == 'i'|| c == 'o'|| c == 'u') {
		cout << "vowel" << endl;
	}
	else if (c != 'a' || c != 'e' || c != 'i' || c != 'o' || c != 'u') {
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main (){
	
	int n;
	int a[100];

	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[n-1-i];
	}
 	for(int i=0;i<n;i++){
 		if(i==n-1)cout << a[i];
 		else cout << a[i] << " ";
 	}
 	cout << endl;
 	return 0;

 }

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N);
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    int ans = INF, sumt = 0;
    for (int i = 0; i < N; ++i) {
        sumt += a[i];
        sum -= a[i];
        ans = min(ans, abs(sum - sumt));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		string s=to_string(i);
		if ((s.size()-1) % 2 == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include <set>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<fstream>
#include<stdio.h>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

#define PI  3.141592
//----------------------------------------
int main(void)
{
	int n;
	cin >> n;
	int m = 0;
	
	vector<pair<string, int>> p;
	map<string, int> mp;

	rep(i, n)
	{
		string str;
		cin >> str;
		mp[str]++;
		m = max(m, mp[str]);
	}


	bool finish = false;
	

		for (auto i = mp.begin(); i != mp.end(); ++i)
		{
			if (i->second == m)
			{
				cout << i->first << endl;
				finish = true;
			}


			
		}



}

Measured memory_bytes: 25216
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//const int mod = 1e9 + 7;
const int N = 310000;
set < int > g[N];
int a[N], b[N], c[N], ans, q;
int dfs1(int v, int p = -1){
    int f = a[v];
    vector < int > del;
    for (auto u: g[v]){
        if (u == p) continue;
        int x = dfs1(u, v);
        if (x == 0) del.pb(u);
        f |= x;
    }
    for (auto u: del) g[v].erase(u);
    if (f == 1){
        if (a[v] && g[v].size() % 2 == 0){
            b[v] = 1;
        } else
        if (a[v] == 0 && g[v].size() % 2 == 1){
            b[v] = 1;
        }
        ans += b[v] + g[v].size();
    }
    return f;
}
int dfs2(int v, int p = -1){
    if (b[v] == 1) c[v] = 1; else c[v] = -1;
    int res;
    if (g[v].size() != 1) res = c[v] + 1; else res = 0;
    int t = res;
    for (auto u: g[v]){
        if (u == p) continue;
        auto x = dfs2(u, v);
        res = max(res, x + 1 + c[v]);
        q = max(q, x + t);
        t = max(t, x + 1 + c[v]);
    }
    return res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 1; i < n; i++){
        int u, v;
        cin >> u >> v;
        g[u].insert(v);
        g[v].insert(u);
    }
    string s;
    cin >> s;
    int iv = -1;
    for (int i = 0; i < n; i++){
        if (s[i] == 'W'){
            a[i + 1] = 1;
            iv = i + 1;
        }else a[i + 1] = 0;
    }
    if (iv == -1){
        cout << 0;
        return 0;
    }
    dfs1(iv);
    for (int i = 1; i <= n; i++){
        if (g[i].size() > 1){
            dfs2(i);
            cout << ans - q;
            return 0;
        }
    }
    dfs2(iv);
    cout << ans - q;
}


Measured memory_bytes: 45132
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    string S;
    cin >> S;
    int N = sz(S);
    bool fin = true;
    rep(i, N){
        if(S[i] != S[0]) fin = false;
    }
    if(fin) {cout << 0 << endl; return 0;}
    int ans = inf;
    rep(i, 26){
        vector<char> s[N+1];
        rep(j, N) s[N].pb(S[j]);
        char x = 'a'+i;
        rep3(j, N-1, 0){
            rep(k, j){
                if(s[j+1][k+1] == x) s[j].pb(x);
                else s[j].pb(s[j+1][k]);
            }
            fin = true;
            for(auto &e: s[j]) if(e != x) fin = false;
            if(fin) chmin(ans, N-j);
        }
    }
    cout << ans << endl;
}

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

int sevenFiftyThree(string s) {
    int minimum = 1e5;
    for (int i = 0; i <= s.length() - 3; i++) {
        int Ss = stoi(s.substr(i, 3));
        minimum = min(minimum, abs(Ss - 753));
    }
    return minimum;
}

int main() {
    string S; cin >> S;
    cout << sevenFiftyThree(S) << endl;
}

Measured memory_bytes: 3524
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
    public static void main(String arg[]) throws IOException
    {
        String str = null;
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        str = br.readLine();

        int i = Integer.parseInt(str);

        System.out.println(i*i*i);
    }

}



Measured memory_bytes: 24164
n,k,q = list(map(int, input().split()))
a = [0]*n
for i in range(q):
    tmp = int(input())
    a[tmp-1] += 1

b = ["No"]*n
    

for i in range(n):
    if k - q + a[i] > 0 :
        b[i] = "Yes"

for i in range(n):
    print(b[i])

Measured memory_bytes: 50852
#include <bits/stdc++.h>
#define INF 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class segtree{
public:
	static const int N=1<<18;
	int dp[1<<19];
	segtree(){
		memset(dp,0,sizeof(dp));
		
	}
	void init(int v){
		for(int i=0;i<N*2;i++){
			dp[i]=v;
		}
	}
	void update(int k,int v){
		k+=N-1;
		dp[k]=min(v,dp[k]);
		while(k>0){
			k=(k-1)/2;
			dp[k]=min(dp[k*2+1],dp[k*2+2]);
		}
	}

	int query(int a,int b,int k=0,int l=0,int r=N){
		if(b<=l || r<=a)return INF;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		int vl=query(a,b,k*2+1,l,mid);
		int vr=query(a,b,k*2+2,mid,r);
		return min(vl,vr);
	}
};

segtree seg;

int n;
ll v;
ll x[200005];
ll to[2][20][200005];
ll dp[2][1<<20];
bool ans[200005];

int main(void){
	scanf("%d%lld",&n,&v);
	seg.init(n+1);
	for(int i=0;i<n;i++){
		scanf("%lld",&x[i]);
	}
	int jp=0;
	ll tmp=v;
	while(v>0){
		jp++;
		v/=2LL;
	}
	jp++;
	v=tmp;
	for(int ty=0;ty<2;ty++){
		tmp=v;
		for(int i=0;i<jp;i++){
			int f=0;
			for(int j=1;j<n;j++){
				if(x[j-1]+v<x[j]){
					for(int k=f;k<j;k++){
						to[ty][i][k]=j;
					}
					f=j;
				}
			}
			for(int j=f;j<n;j++){
				to[ty][i][j]=n;
			}
			to[ty][i][n]=n;
			v/=2;
		}
		for(int i=0;i<(1<<jp);i++){
			//printf("%d %d %lld\n",ty,i,dp[ty][i]);
			for(int j=0;j<jp;j++){
				if(!(i>>j & 1)){
					dp[ty][i|(1<<j)]=max(dp[ty][i|(1<<j)],to[ty][j][dp[ty][i]]);
				}
			}
		}
		v=tmp;
		reverse(x,x+n);
		for(int i=0;i<n;i++){
			x[i]=-x[i];
		}
	}
	for(int i=0;i<jp;i++){
		reverse(to[1][i],to[1][i]+n);
		for(int j=0;j<n;j++){
			to[1][i][j]=n-to[1][i][j];
		}
	}

	for(int i=0;i<(1<<jp);i++){
		dp[1][i]=n-dp[1][i];
	}
	for(int i=0;i<(1<<jp);i++){
		if(i>>0 & 1)continue;
		//printf("ad %d %lld %lld\n",i,dp[0][i],dp[1][(1<<jp)-i-2]);
		seg.update(dp[0][i],dp[1][(1<<jp)-i-2]);
	}
	for(int i=0;i<n;i++){
		//printf("%lld %lld\n",to[0][0][i],to[1][0][i]);
		if(to[0][0][i]==n){
			if(to[1][0][i]==0){
				ans[i]=true;
			}else{
				ans[i]=(seg.query(to[1][0][i],seg.N)<=n);
			}
		}else{
			if(to[1][0][i]==0){
				ans[i]=(seg.query(0,seg.N)<=to[0][0][i]);
			}else{
				ans[i]=(seg.query(to[1][0][i],seg.N)<=to[0][0][i]);
			}
		}
	}
	for(int i=0;i<n;i++){
		printf("%s\n",ans[i]?"Possible":"Impossible");
	}
	return 0;
}

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

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, Q = MAP()
A = LIST()

sm = sum([A[i] for i in range(N-1, -1, -2)])
borders = [(INF, sm)]
j = N-3
for i in range(N-2, N//2-1, -1):
    border =  (A[j] + A[i]) // 2
    val = A[i] - A[j]
    sm += val
    borders.append((border, sm))
    j -= 2
borders.sort()

for _ in range(Q):
    x = INT()
    idx = bisect_left(borders, (x, 0))
    print(borders[idx][1])


Measured memory_bytes: 18340
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
    
    unsigned long long n,a,b;
    cin >> n >> a >> b;
    if((b-a)%2 == 0){
        cout << (b-a)/2 << endl;
    }else{
        unsigned long long m = max(a,b);
        unsigned long long l = min(a,b);
        unsigned long long x,y;
        x = (l-1) + 1 + (m-l)/2;
        y = (n-m) + 1 + (m-l)/2;
        cout << min(x,y) << endl;
    }

}

Measured memory_bytes: 256
while True:
    n,x=map(int,input().split())
    if n==0 and x==0: break
    ans=0
    for a in range(1,n+1):
        for b in range(a+1,n+1):
            for c in range(b+1,n+1):
                if a+b+c==x: ans+=1
    print(ans)


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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<ld> Point;
typedef vector<vector<int>> Graph;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    ll cnt = 0;
    int min = INF;
    rep(i, n) {
        if (min >= a[i])
            cnt++;
        if (a[i] < min)
            min = a[i];
    }
    out(cnt);
    return 0;
}


Measured memory_bytes: 1024
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n, d = MAP()
    print(ceil(n/(2*d+1)))

if  __name__=='__main__':
    main()

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

int gcd(int x,int y){
    if(x < y) swap(x, y);
    //余りが出なくなったときのxが最大公約数
    while(y > 0){
        int r = x % y;
        x = y;
        y = r;
    }
    return x;
}
int main(){
    int x, y;
    cin >> x >> y;
    cout << gcd(x, y) << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<climits>
#include<algorithm>
#include<vector>
#include<valarray>
#include<string>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iostream>
#include<iomanip>
using namespace std;
   
   
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define DREP(i,n) for(int i=n;i>0;i--)
#define Rep(i,m,n) for(int i=m;i<n;i++)
#define ReP(i,m,n) for(int i=m;i<=n;i++)
#define scani(a) scanf("%d",&a)
#define scand(a) scanf("%lf",&a)
#define scans(s) scanf("%s",s)
#define readi(a) int a;scanf("%d",&a)
#define printi(a) printf("%d",a)
#define prints(s) printf("%s",s)
#define even(n) (((n)+1)%2)
#define odd(n) ((n)%2)
#define sg(x) ((x)?1:0)
#define LF printf("\n")
#define SPACE printf(" ")
#define pb push_back
#define mp make_pair
#define bs binary_search
#define all(a) (a).begin(),(a).end()
#define forall(itr,a) for(auto itr=(a).begin();itr!=(a).end();++itr)
   
typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<double,double> pdd;
typedef pair<int,int> pii;
   
const double pi = acos(-1.0);
double rad(double t){return t*pi/180.0;}
double deg(double d){return d*180.0/pi;}
template<typename T>T GCD(T x,T y){return y?GCD(y,x%y):x;}
template<typename T>T LCM(T x,T y){return x/GCD(x,y)*y;}
template<class T>ostream& operator<<(ostream& os,const set<T>& s){os<<"{";for(auto itr=s.begin();s.end() != itr;++itr){if(itr!=s.begin())os<<',';os<<*itr;}os<<"}";return os;}
template<class S,class T>ostream& operator<<(ostream& os,const pair<S,T>& p){os<<'('<<p.first<<','<<p.second<<')';return os;}
const int MOD = (int)pow(10,9) +7;


//begin global variable
//end   global variable

int main(){
  ios::sync_with_stdio(false);
  //begin main()

  string s;
  cin >> s;
  cout << s.substr(0,4) + " " + s.substr(4,8) << endl;

  //end   main()
  return 0;
}


Measured memory_bytes: 256
def parent(i):
    if heap[i // 2] != None:
        print(", parent key = " + str(heap[i // 2]), end = "")
    else:
        print("", end = "")

def left(i):
    if 2 * i <= n:
        print(", left key = " + str(heap[2 * i]), end = "")
    else:
        print("", end = "")

def right(i):
    if 2 * i + 1 <= n:
        print(", right key = " + str(heap[2 * i + 1]), end = "")
    else:
        print("", end = "")


n=int(input())
heap = list(map(int,input().split()))
heap.insert(0, None)

for i in range(1, n + 1):
    print("node", str(i) + ": key = " + str(heap[i]), end = "")
    parent(i)
    left(i)
    right(i)
    print(", ")
   # print("node %d: parent = %d, depth = %d, "%(i,nodes[i].parent_id,nodes[i].depth),end = "")
    
    
    


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

int main(){
    int h, w, n; cin >> h >> w >> n;
    vector<int> a(n); for(auto i = 0; i < n; i++) cin >> a[i];
    vector<vector<int>> ans(h, vector<int>(w)); int cnt = 0;
    for (auto i = 0; i < h; i++) {
        for (auto j = 0; j < w; j++) {
            auto j_tmp = j;
            if(i % 2 == 1) j_tmp = w - 1 - j;
            ans[i][j_tmp] = cnt + 1; a[cnt]--;
            if(a[cnt] == 0) cnt++;
        }
    }

    for(auto i = 0; i < h; i++) {
        for (auto j = 0; j < w; j++) {
            cout << ans[i][j];
            if(j != w - 1) cout << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,coin;
  vector<int> dp(50001,50001);
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>coin;
    dp[coin]=1;
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n-i;j++){
      if(dp[i+j] > dp[i]+dp[j])dp[i+j]=dp[i]+dp[j];
    }
  }
  cout<<dp[n]<<endl;
  return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    int N;
    cin >> N;
    VEC(int) A(N), B(N);
    FOR(i, 0, N) {
        cin >> A[i] >> B[i];
    }

    sort(ALL(A));
    sort(ALL(B));

    if (N % 2 == 1) {
        int K = (N + 1) / 2;
        cout << B[K - 1] - A[K - 1] + 1 << endl;
        return;
    } else {
        int K1 = N / 2, K2 = N / 2 + 1;
        int sumA = A[K1 - 1] + A[K2 - 1];
        int sumB = B[K1 - 1] + B[K2 - 1];

        if (sumA % 2 == 0 && sumB % 2 == 0) {
            cout << sumB - sumA + 1 << endl;
            return;
        } else if (sumA % 2 == 1 && sumB % 2 == 1) {
            cout << sumB - sumA + 1 << endl;
            return;
        } else if (sumA % 2 == 0) {
            cout << sumB - sumA + 1 << endl;
            return;
        } else {
            cout << sumB - sumA + 1 << endl;
            return;
        }
    }
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


Measured memory_bytes: 4788
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;

ll ans=0;
int flag[20][20]={};
int p[20]={};
void getans(ll pt[20],ll index){
    if(index==N){
        bool fg=true;
        rep(mi,M){
            ll count=0;
            rep(ni,N){
                count += flag[mi][ni] * pt[ni];
            }
            if(count%2!=p[mi]){
                fg = false;
                break;
            } 
        }
        if(fg) ans++;
    }else{
        pt[index]=1;
        getans(pt,index+1);
        pt[index]=0;
        getans(pt,index+1);
    }

}

int main(){

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

    cin >> N;
    cin >> M;
    ll pt[20] = {};
    rep(mi,M){
        cin >> K;
        rep(ki,K){
            int sw;
            cin >> sw;
            sw--;
            flag[mi][sw]=1;
        }
    }
    rep(mi,M){
        int pp;
        cin >> pp;
        p[mi]=pp;
    }


    getans(pt,0);
    cout << ans << endl;
}

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

int main(void){
  string a;
  cin >> a;

  if(a == "A"){
    cout << "T" << endl;
  }else if(a == "T"){
    cout << "A" << endl;
  }else if(a == "G"){
      cout << "C" << endl;
  }else{
    cout << "G" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
typedef long long int ll;
using namespace std;
int main(){
	int N;
	int x;
	ll ans;
	int sub;
	cin>>N;
	cin>>x;
	ans=0;
	sub=x;
	for(int j=1;j<N;j++){
		cin>>x;
		if(x>sub){
			ans+=sub;
			sub=x;
		}else{
			ans+=x;
		}
	}
	ans+=sub/2;
	cout<<ans<<endl;
}

Measured memory_bytes: 256