akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)

    val h, w = sc.nextInt()
    val map = Vector.fill(h)(sc.next().toCharArray.toVector)

    def f[T](a: Vector[Vector[T]]): Vector[Vector[T]] = {
      if (a.head.length == 1) Vector(a.map(_.head))
      else a.map(_.head) +: f(a.map(_.tail))
    }

    val ans =
      f(
        f(map.filter(vec => vec.contains('#')))
          .filter(vec => vec.contains('#'))
      )

    ans.foreach(i => println(i.mkString("")))
  }

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }

  def printExecTime(process: => Unit): Unit = {
    val start = System.currentTimeMillis
    process
    debug("処理時間： " + (System.currentTimeMillis - start) + " ミリ秒")
  }

  def bitSearch[T](n: Int, choice: Vector[T]): Vector[Vector[T]] = {
    @tailrec
    def bitSearchLogic(n: Int,
                       choice: Vector[T],
                       acc: Vector[Vector[T]]): Vector[Vector[T]] = {
      if (n == 0) acc
      else {
        val newAcc =
          acc.flatMap(vec => {
            choice.map(c => vec :+ c)
          })
        bitSearchLogic(n - 1, choice, newAcc)
      }
    }

    val firstAcc = choice.map(i => Vector(i))
    bitSearchLogic(n - 1, choice, firstAcc)
  }
}


Measured memory_bytes: 39612
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    uint64_t sum=0;
    vector<uint64_t> A(N);
    rep(n,0,N){cin>>A.at(n); sum+=A.at(n);}

    vector<vector<int64_t>> sumH(2,vector<int64_t>(N+1,0));
    sumH.at(1).at(0)=sum;

    rep(n,1,N+1){
        sumH.at(0).at(n)=sumH.at(0).at(n-1)+A.at(n-1);
        sumH.at(1).at(n)=sumH.at(1).at(n-1)-A.at(n-1);
    }

    int64_t minD=INT64_MAX;
    rep(n,1,N+1){
        minD=min(minD,abs(sumH.at(0).at(n)-sumH.at(1).at(n)));
    }

    cout<<minD<<endl;
}

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

#define ll long long

ll dp[200001],n,h[200001];

int main()
{
//    freopen("a.in","r",stdin);
    cin>>n;
    dp[0]=1e15;
    dp[1]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>h[i];
    }
    for(int i=2;i<=n;i++)
    {
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n];
}




Measured memory_bytes: 1792
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

class mod_int{
    private:
        ull num;
    public:
        static const ull mod=1000000007;
        mod_int()=default;
        mod_int(ull num):num(num%mod){}
        explicit operator ull()             const{return num;}
        bool    operator==(const mod_int&mi)const{return num==mi.num;}
        bool    operator!=(const mod_int&mi)const{return !operator==(mi);}
        mod_int operator~ ()                const{return pow(*this,mod-2);}
        mod_int operator+ (const mod_int&mi)const{return num+mi.num;}
        mod_int operator- (const mod_int&mi)const{return num-mi.num+mod;}
        mod_int operator* (const mod_int&mi)const{return num*mi.num;}
        mod_int operator/ (const mod_int&mi)const{return num*(~mi).num;}
        mod_int&operator+=(const mod_int&mi)     {return*this=operator+(mi);}
        mod_int&operator-=(const mod_int&mi)     {return*this=operator-(mi);}
        mod_int&operator*=(const mod_int&mi)     {return*this=operator*(mi);}
        mod_int&operator/=(const mod_int&mi)     {return*this=operator/(mi);}
        static mod_int pow(mod_int x,ull y){return y==0?1:y%2==0?pow(x*x,y/2):x*pow(x,y-1);}
};
int main()
{
    ll n=in();
    vector<ll>cnt(n,0);
    mod_int ans=1;
    for(ll i=0;i<n;++i){
        ll a=in();++cnt[a];
        if((a==0||cnt[a-1]>=cnt[a])&&cnt[a]<=3){
            ans*=(a==0?3:cnt[a-1])-cnt[a]+1;
        }else{
            cout<<0<<endl;
            return 0;
        }
    }
    cout<<(ull)ans<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define PPF pop_front
#define PPB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//
struct poi{
  int X;int Y;int Z;
  bool operator<(const poi&R)const{
    return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
  }
};
//
//
int A[200000];
int P[200000];
int B[200000];
int a[200000];
int b[200000];
int main(){
  int N;
  cin>>N;
  FOR(i,0,N){
    A[i]=1e9+i;
  }
  FOR(i,0,N){
    cin>>P[i];
    P[i]--;
    B[P[i]]=A[i];
  }
  FOR(i,0,N){
    a[i]=(i+1)*30000;
    b[i]=B[i]-a[i];
  }
  FOR(i,0,N){
    cout<<a[i]<<" \n"[i==N-1];
  }
  FOR(i,0,N){
    cout<<b[i]<<" \n"[i==N-1];
  }
	return 0;
}


Measured memory_bytes: 1024
using System;
using System.Reflection;
using System.Linq.Expressions;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder {
    public class Program {
        static int[] getKeys(char delimiter) {
            var Keys = Console.ReadLine().Split(' ');
            int N = Keys.Length;
            int[] Ns = new int[N];
            for (int i = 0; i < N; i++) {
                Ns[i] = int.Parse(Keys[i]);
            }
            return Ns;
        }
        static void Show<T>(T[,] map) {
            int H = map.GetLength(0);
            int W = map.GetLength(1);
            Console.WriteLine("-------------------------");
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    Console.Write(map[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine("-------------------------");
        }
        static void Show<T>(T[,] map, string delimiter) {
            int H = map.GetLength(0);
            int W = map.GetLength(1);
            Console.WriteLine("-------------------------");
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    Console.Write(map[i, j] + delimiter);
                }
                Console.WriteLine();
            }
            Console.WriteLine("-------------------------");
        }
        static void Show<T>(IEnumerable<T> ts) {
            foreach (var item in ts) {
                Console.Write(item + " ");
            }
            Console.WriteLine();
        }
        static void Show<T>(IEnumerable<T> ts, string delimiter) {
            foreach (var item in ts) {
                Console.Write(item + delimiter);
            }
            Console.WriteLine();
        }
        static void Main() {
            if (Console.ReadLine().Contains('9')) {
                Console.WriteLine("Yes");
            } else {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

int main() {

    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h){
        cin >> s[i];
    }

    vector<vector<int>> height(h, vector<int>(w));
    rep(j, w){
        int h_cnt = 0;
        rep(i, h){
            if(s[i][j] == '#'){
                if(h_cnt != 0){
                    rep(k, h_cnt){
                        height[i-1-k][j] = h_cnt;
                    }
                    h_cnt = 0;
                }
                continue;
            }
            h_cnt++;
            if(i == h-1){
                rep(k, h_cnt){
                    height[i-k][j] = h_cnt;
                }
            }
        }
    }
    vector<vector<int>> weight(h, vector<int>(w));    
    rep(i, h){
        int w_cnt = 0;
        rep(j, w){
            if(s[i][j] == '#'){
                if(w_cnt != 0){
                    rep(k, w_cnt){
                        weight[i][j-1-k] = w_cnt;
                    }
                    weight[i][j-1] = w_cnt;
                    w_cnt = 0;
                }
                continue;
            }
            w_cnt++;
            if(j == w-1){
                rep(k, w_cnt){
                    weight[i][j-k] = w_cnt;
                }
            }
        }
    }
    
    int ans = 0;
    rep(i, h){
        rep(j, w){
            if(s[i][j] == '#'){
                continue;
            }
            ans = max(ans, height[i][j]+weight[i][j]-1);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(int argc, char const *argv[])
{
    COMinit();
    int x, y;
    cin >> x >> y;
    int ans = 0;
    rep(a, x + 1)
    {
        int b = y - 2 * a;
        if (b < 0 || 2 * b + a != x)
        {
            continue;
        }
        ans += COM(a + b, a);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


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


int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(auto& a : A){
    cin >> a;
  }
  
  sort(A.begin(), A.end());
  int s=0;
  while(s<N-1){
    if(A[s]==1){
      break;
    }
    for(int ii=s+1; ii<N; ii++){
      A[ii] %= A[s];
    }
    sort(A.begin(), A.end());
    while(A[s]==0){
      s++;
    }
  }
  cout << A[s] << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    s[k - 1] = tolower(s[k - 1]);
    cout << s << endl;
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> C(N, 1);
  vector<bool> R(N, false);
  R[0] = true;
  int x, y;
  for (int i = 0; i < M; i++) {
    cin >> x >> y;
    x--; y--;
    if (R[x]) R[y] = true;
    if (R[x] && C[x] == 1) R[x] = false;
    C[x]--; C[y]++;
  }
  int ans = 0;
  for (bool r : R) if(r) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef unsigned long long ull;
typedef long long int ll;
#define EPS 1e-9
#define PI acos(-1.0)
#define el        '\n'
#define ft       first
#define sd       second
#define sp(x)       fixed<<setprecision(x)
#define mp(x,y)    make_pair((x),(y))
#define pb(x)      push_back((x))
#define pf(x)      push_front((x))
#define all(v)    ((v).begin()),((v).end())
#define sz(x)      ((int) (x).size())
#define mem(a,b)  memset(a,b,sizeof(a))
#define fr(i, n)  for (ll i = 1; i < n-1; i+=2)
#define frn(i, n)  for (int i = 0; i <= n; ++i)
#define rf(i, n)  for (int i = n; i >= 0; --i)
#define fro(i, n)  for (ll i = 1; i <= n; ++i)
#define fora(a) for(auto &i : a)
#define Sum(a,n,i_s)       accumulate(a,a+n,i_s)
#define frt(v)     for (std::vector<int>::iterator i = v.begin(); i != v.end(); ++i)
const ll mod = 1e9 + 7;
const int  OO = INT_MAX, P = 3 * (1e5 + 5);
int xd[] = { 1,0,-1,0,-1,1,1,-1 };
int yd[] = { 0,-1,0,1,1,1,-1,-1 };
vector<ll>adj[P];
ll dp[P],vis[P],ans;
ll dfs(ll i)
{
	vis[i] = 1;
	if (adj[i].empty())
	{
		return 0;
	}
	
	ll &ret = dp[i];
	if (~ret)
		return ret;
	for (ll j = 0; j < sz(adj[i]); j++)
	{
		ll nxt = adj[i][j];
		ret = max(ret, 1+dfs(nxt));
	}
	return ret;
}

int main() {
	//freopen("Text.txt", "r", stdin);
	ll n, m,x,y;
	cin >> n >> m;
	mem(dp, -1);
	for (ll i = 0; i < m; i++)
	{
		cin >> x >> y;
		adj[x].pb(y);
	}
	ans = 0;
	for (ll i = 1; i <= n; i++)
	{
		if (!vis[i])
		{
			ans = max(ans, dfs(i));
		}
	}
	cout << ans << el;
	return 0;
}


Measured memory_bytes: 18712
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    int N;
    int64_t K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i=0;i<N; i++) {
        cin >> A[i];
    }

    int ok = 0, ng = 1'000'000'001;
    while(ok + 1 < ng) {
        int mid = (ok + ng) / 2;
        int64_t cnt = 0;
        for(int i=0; i<N; i++) {
            cnt += (A[i]+mid-1) / mid - 1;
        }
        if(cnt <= K) {
            ng = mid;
        } else {
            ok = mid;
        }
    }

    cout << ng << endl;
    return 0;
}


Measured memory_bytes: 4044
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N,K=pin()
    A=[*pin()]

    
    for i in range(N-K):
        print(["No","Yes"][A[i]<A[i+K]])
            
#%%submit!
resolve()


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

using namespace std;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

const int maxn = 5005;

const int MOD = 1000000007;

inline int sub(int a, int b)
{
	a -= b;
	if (a < 0) a += MOD;
	return a;
}

const int OK = 0;

inline int RUN(int last, int tlen)
{
	return 1 + (last * maxn + tlen);
}

int dp[maxn][2 * maxn + 100];
int n, A, B;

inline void upd(int &a, int b)
{
	a += b;
	if (a >= MOD) a -= MOD;
}

int main()
{
	scanf("%d%d%d", &n, &A, &B);
	A = min(A, n);
	if (A > B) swap(A, B);
	dp[0][RUN(1, 0)] = 1;
	for (int i = 0; i <= n; i++)
	{
		for (int last = 0; last < 2; last++)
		{
			for (int tlen = 0; tlen <= n; tlen++)
			{
				int curans = dp[i][RUN(last, tlen)];
				//cout << i << ' ' << last << ' ' << tlen << ' ' << curans << endl;
				if (tlen >= B)
				{
					upd(dp[i][OK], curans);
				} else
				{
					if (last == 0 && tlen == 0)
					{
						upd(dp[i + 1][RUN(0, 0)], curans);
						upd(dp[i + 1][RUN(1, 1)], curans);
					} else
					{
						upd(dp[i + 1][RUN(last, tlen + 1)], curans);
						if (last == 0) upd(dp[i + 1][RUN(1, tlen + 1)], curans);
						else
						{
							if (i + A <= n)
							{
								upd(dp[i + A][RUN(0, tlen + A)], curans);
								upd(dp[i + 1][RUN(0, 0)], curans);
								upd(dp[i + A][RUN(0, 0)], sub(MOD, curans));
							} else // does not fit anyway
							{
								upd(dp[i + 1][RUN(1, 0)], curans);
							}
						}
					}
				}
				//cout << dp[3][RUN(0, 2)] << endl;
			}
		}

		//cout << i << " OK " << dp[i][OK] << endl;

		upd(dp[i + 1][OK], dp[i][OK]);
		upd(dp[i + 1][OK], dp[i][OK]);
	}
	
	printf("%d\n", dp[n][OK]);
    return 0;
}


Measured memory_bytes: 201240
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n int
	var s string
	fmt.Fscan(read, &n, &s)

	t := ""
	pre := ":"
	for i := 0; i < n; i++ {
		if string(s[i]) == pre {
			continue
		}
		t += string(s[i])
		pre = string(s[i])
	}
	fmt.Fprintln(write, len(t))
}


Measured memory_bytes: 10752
n,m = map(int,input().split())
D = list(map(int,input().split()))

INF = 10**5
dp = [INF for i in range(n+1)]
dp[0] = 0

for i in range(n+1):
    for d in D:
        if i+d <= n:
            dp[i+d] = min(dp[i+d],dp[i]+1)
print(dp[n])



Measured memory_bytes: 7384
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))


import itertools

n,m,x = map(int, input().split())
c = []
a = []
for i in range(n):
    cc, *aa = map(int, input().split())
    a.append(aa)
    c.append(cc)

best = None
for use in itertools.product(*[[True, False] for _ in range(n)]):
    vals = [0] * m
    nedan = sum([v for i,v in enumerate(c) if use[i]])
    for i,u in enumerate(use):
        if u:
            for j,v in enumerate(a[i]):
                vals[j] += v
    if all([item>=x for item in vals]):
        best = min(best, nedan) if best is not None else nedan
if best is not None:
    print(best)
else:
    print(-1)

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

int main() {
  int a, b, c;

  cin >> a>>b>>c;

  if(a+b+c >=22){
  cout << "bust" << endl;
}
  if(a+b+c<=21){
      cout << "win" << endl;
}
}
    
    


Measured memory_bytes: 256
def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    l, r = 0, max(A)
    while r - l > 1:
        c = (l + r) // 2
        if sum((a - 1) // c if a > c else 0 for a in A) <= k:
            r = c
        else:
            l = c
    print(r)

if __name__ == '__main__':
    main()


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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read()          freopen("in.txt","r",stdin)
#define write()         freopen("out.txt","w",stdout)
#define sf(n)           scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n)          scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%ull",&n)
#define ull             unsigned long long int
#define endll           pf("\n")
#define pf              printf
#define PI              acos(-1.0)
#define eps             1e-12
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MX 100005
#define MOD 1000000007
#define var    int i,j,k,z=0,c=0,t,x,y,l,r,mid
//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};
//int dx[4]={1,-1,0,0};  //4 direction
//int dy[4]={0,0,1,-1};

ll n,m,a[200005];

int main()
{
    ll var;
    sfl(a[0]);sfl(a[1]);sfl(a[2]);
    sort(a,a+3);
    if((a[0]==a[1] && a[1]!=a[2]) || (a[2]==a[1] && a[0]!=a[2]))
    {
        pf("Yes\n");
    }
    else pf("No\n");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define st string
#define dl double
#define ve(i) vector<i>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define each(i, n) for(auto&& i: n)
#define pr(n) cout << fixed << setprecision(n)
#define ci(n, o) cin >> n >> o
#define co(n) cout << n << endl

int main() {
  int X, K;
  ci(K, X);
  rep(i, K * 2 -1) {
    cout << X - K + i + 1<< " ";
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec[i];
  }
  bool check = true;
  for(int i = 0; i < N; i++){
    if(vec[i]%2==0){
      if(vec[i] % 3 != 0 && vec[i] % 5 != 0){
        check = false;
      }
    }
  }
  if(check){
    cout << "APPROVED";
  }
  else{
    cout << "DENIED";
  }
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
kaijo=[0]*(1+N)
kaijo[0]=1
mod=10**9+7
for i in range(1,1+N):
    kaijo[i]=kaijo[i-1]*i%mod
ruiseki=[0]*(N+1)
ruiseki[1]=1
for i in range(2,N+1):
    ruiseki[i]=(ruiseki[i-1]+pow(i,mod-2,mod))%mod
ans=0
for i,a in enumerate(A):
    ans=(ans+kaijo[N]*a*(ruiseki[i+1]+ruiseki[N-i]-1)%mod)%mod
print(ans)

Measured memory_bytes: 15204
#include<iostream>
#include<algorithm>
using namespace std;
int n,ans=100000000;
main()
{
	cin>>n;
	for(int i=0;i<=n;i++)
	{
		int a=i,b=n-i,c=0;
		while(a>0)c+=a%6,a/=6;
		while(b>0)c+=b%9,b/=9;
		ans=min(ans,c);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
/**
 * 
 * @param {string} input 
 */
function main(input) {
  const inputList = input.split(" ");
  const t = Number(inputList[0]);
  const x = Number(inputList[1]);
  console.log(t/x);
}


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


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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }

///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int check(vvi &v,int i) {
	int res = 10000;
	int c = 0,a=i;
	REP(j, 5) {
		c = v[c][a / res];
		a %= res;
		res /= 10;
	}
	return c;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vvi v(10, vi(10));
	REP(i, 10)REP(j, 10)cin >> v[i][j];
	int cnt = 0;
	vi digit(10000);
	REP(i, 10000) {
		int a = i, res = 1000, c = 0;
		REP(j, 4) {
			c = v[c][a / res];
			a %= res;
			res /= 10;
		}
		digit[i] = c;
	}

	REP(i, 10000) {
		int a = i;
		string s;
		REP(j, 4) {
			s = char(a % 10 + '0') + s;
			a /= 10;
		}
		s += char(digit[i] + '0');
		string tmp = s;

		REP(j, 5) {
			REP(k, 10) {
				tmp = s;
				tmp[j] = k + '0';
				if (s == tmp)continue;
				if (check(v,stoi(tmp))==0) {
					cnt++;
					goto next;
				}
			}
		}
		REP(j, 4) {
			tmp = s;
			swap(tmp[j], tmp[j + 1]);
			if (s == tmp)continue;
			if (check(v, stoi(tmp))==0) {
				cnt++;
				//cout << i << endl;
				goto next;
			}
			
		}
	next:;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3276
h, w = map(int, input().split())
l1 =[]

for i in range(h):
    l2 = list(input())
    l1.append(l2)

is_no = 0
for i in range(h):
    if is_no:
        break
    for j in range(w):
        if is_no:
            break
        if l1[i][j] == '#':
            if i == 0:
                if j == 0:
                    if l1[i][j + 1] == '.' and l1[i + 1][j] == '.':
                        is_no = 1
                        
                elif j == w - 1:
                    if l1[i][j - 1] == '.' and l1[i + 1][j] == '.':
                     is_no = 1

                else:
                    if l1[i][j - 1] == '.'  and l1[i][j + 1] == '.' and l1[i + 1][j] == '.':
                        is_no = 1


            elif i == h - 1:
                if j == 0:
                    if l1[i][j + 1] == '.' and l1[i - 1][j] == '.':
                        is_no = 1

                elif j == w - 1:
                    if l1[i][j - 1] == '.' and l1[i - 1][j] == '.':
                        is_no = 1

                else:
                    if l1[i][j - 1] == '.'  and l1[i][j + 1] == '.' and l1[i - 1][j] == '.':
                        is_no = 1


            else:
                if j == 0:
                    if l1[i][j + 1] == '.' and l1[i - 1][j] == '.' and l1[i + 1][j] == '.':
                        is_no = 1

                elif j == w - 1:
                    if l1[i][j - 1] == '.' and l1[i - 1][j] == '.' and l1[i + 1][j] == '.':
                        is_no = 1

                else:
                    if l1[i][j - 1] == '.'  and l1[i][j + 1] == '.' and l1[i - 1][j] == '.' and l1[i + 1][j] == '.':
                        is_no = 1


if is_no:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3188
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <numeric>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>
#include <cctype>
int main() {
	int n, k; std::cin >> n >> k;
	std::string str; std::cin >> str;
	str[k - 1] = std::tolower(str[k - 1]);
	std::cout << str << '\n';
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define gcd __gcd
#define lcm(a, b) ((a) * (b) / gcd((a), b))
#define all(x) x.begin(), x.end()
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define fastio() ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
#define endl '\n'

typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;

template <class T> inline T RD(T &a) {T x; cin >> x; return a = x;}

signed main()
{
//	freopen("TEXT.inp", "r", stdin); freopen("TEXT.out", "w", stdout);
	fastio();

	string s; cin >> s;
	int q; cin >> q;

	int op, pos;
	char c;

	string l = "", r = "";

	short curState = 0; //1 = reverse

	for (int i = 0; i < q; i++) {
        cin >> op;
        if (op == 1) {
            curState ^= 1;
        } else {
            cin >> pos >> c;
            if (pos == 1) {
                if (!curState) {
                    l = c + l;
                } else {
                    r += c;
                }
            } else {
                if (!curState) {
                    r += c;
                } else {
                    l = c + l;
                }
            }
        }
	}

	if (!curState) cout << l + s + r;
	else {
        s = l + s + r; reverse(all(s));
        cout << s;
	}
}


Measured memory_bytes: 1416
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
mo = 10**9+7

def main():
	n,m = MI()
	a = LI()
	tot = sum(a)
	if tot > n:
		print(-1)
	else:
		print(n-tot)

if __name__ == '__main__':
	main()

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

int main(){
    string s;
    cin >> s;
    string output = "";
    for (int i = 0; i < s.length(); i++)
    {
        if(s[i] == '0'){
            output += "0";
        }else if(s[i] == '1'){
            output += "1";
        }else{
            if(output.size() != 0) output.erase(output.size()-1, 1);
        }
    }
    cout << output << endl;
}

Measured memory_bytes: 256
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a<b:
  if w<v:
    if (v-w)*t>=(b-a):
      print("YES")
    else:
      print("NO")
  else:
    print("NO")
else:
  if w<v:
    if (v-w)*t>=(a-b):
      print("YES")
    else:
      print("NO")
  else:
    print("NO")

Measured memory_bytes: 9052
module Main where

import qualified Data.ByteString.Char8 as BS
import           Data.List                      ( unfoldr )
import           Data.Char                      ( isSpace )

main :: IO ()
main = do
  [h, a] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ (h + a - 1) `div` a

Measured memory_bytes: 380
n,k = map(int, input().split())
s = input()
ans = 0
for i in range(n):
    if s[i] == "L":
        if i != 0:
            if s[i - 1] == "L":
                ans += 1
    else:
        if i != n - 1:
            if s[i + 1] == "R":
                ans += 1
ans += 2 * k
print(min(ans, n - 1))

Measured memory_bytes: 39920
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;



int main(int argc, char* argv[])
{
    long n, k;
    scanf("%ld%ld", &n, &k);

    long a[55];
    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &a[i]);
    }

    vector<long> zz;
    long count=0;
    long imin_prev=-1;
    while( 1 ) {
        long min=INF;
        long imin=0;
        for(i=0; i<n; i++) {
            if(i!=imin_prev && min>a[i]) {
                min=a[i];
                imin=i;
            }
        }
        for(i=0; i<n; i++) {
            if(i==imin_prev) continue;
            if(i==imin) continue;
            if(a[i]==0) goto FIN;
            zz.push_back(i);
            a[i]--;
        }
        if(a[imin]==0) goto FIN;
        zz.push_back(imin);
        a[imin]--;

        imin_prev = imin;
        count++;
    }

FIN:
    if(k>=count) {
        printf("-1\n");
    }
    else {
        printf("%ld\n", (long)zz.size());
        for(i=0; i<(long)zz.size(); i++) {
            printf("%ld ", zz[i]+1);
        }   
        printf("\n");
    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  int main() {
  int a;
  int b;
  
  cin >> a;
  cin >> b;
  
  if (a*500 >= b) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  
  
  return 0;
}

Measured memory_bytes: 3548
using System;
class Program
{
    static void Main(string[] args)
    {
        char[] s = Console.ReadLine().ToCharArray();
        char[] p = Console.ReadLine().ToCharArray();
        int pcount = p.Length;
        for (int i = 0,scount = s.Length; i < scount; i++)
        {
            if (s[i] == p[0])
            {
                if (pcount == 1)
                {
                    Console.WriteLine("Yes");
                    return;
                }
                for (int j = 1; j < pcount; j++)
                {
                    if (i + j == scount)
                    {
                        for (int k = 0, kcount = pcount - j + 1; k < kcount; k++)
                        {
                            if (j + k == pcount)
                            {
                                Console.WriteLine("Yes");
                                return;
                            }
                            if (s[k] != p[j + k])
                            {
                                Console.WriteLine("No");
                                return;
                            }
                        }
                    }

                    if (s[i + j] != p[j])
                    {
                        break;
                    }

                    if (j == pcount - 1)
                    {
                        Console.WriteLine("Yes");
                        return;
                    }
                }
            }
        }
        Console.WriteLine("No");
    }
}

Measured memory_bytes: 19592
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            if (i % 3 == 0) {
                System.out.print(" " + i);
            } else {
                int x = i;
                do {
                    if (x % 10 == 3) {
                        System.out.print(" " + i);
                        break;
                    } else {
                        x /= 10;
                    }
                } while (x != 0);
            }
        }
        System.out.println();
    }
}

Measured memory_bytes: 28560
from sys import stdin
n, k = [int(x) for x in stdin.readline().rstrip().split()]

#print(n, k)

def convert_to_n(num, n):
    if (int(num/n)):
        return convert_to_n(int(num/n), n)+str(num%n)
    return str(num%n)

ans = convert_to_n(n, k)  
  
print(len(ans))

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

bool so[10000001] = {0};

int main() {

  for(int i=2;i*i<=10000000;i++) {
    if(so[i] == 0) {
      int k = i;
      for(int j=2;j<=10000000;j++) {
	if(k+i > 10000000)break;
	so[k+i] = 1;
	k += i;
	//	cout << i*j << endl;
      }
    }
  }


  while(1) {

    int n;
    cin >> n;

    if(n ==0) break;

    for(int i=n;i>=13;i--) {
      if(so[i]+so[i-2]+so[i-6]+so[i-8] == 0) {
	cout <<i<<endl;
	break;
      }
      }

  }



  return 0;

}

Measured memory_bytes: 10924
n,M=map(int,input().split())
from math import factorial
i=2
c_list=[]
m=M
while i**2<=M:
    count=0
    while m%i==0:
        m=m//i
        count=count+1
    if not count==0:
        c_list.append(count)
    i=i+1
if not m==1:
    c_list.append(1)
if M==1:
    print(1)
else:
    INF=10**9+7
    Sum=1
    for i in c_list:
        Sum=Sum*(factorial(n-1+i)//(factorial(n-1)*factorial(i)))
        Sum=Sum%INF
    print(Sum)


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

int main()
{
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int sum=0;
    if(k>=a)
    {
        sum=a;
        k-=a;
    }
    else{
        sum=k;
        k=0;
    }
    if(k>=b)
    {
        k-=b;
    }
    if(k>0)
        sum-=k;

    cout<<sum;

    return 0;
}


Measured memory_bytes: 3612
program main
implicit None
integer(8)::a,b,c,k
read *,a,b,c,k

c=a-b
if(abs(c)>10e18)then 
	print 102,"Unfair"
	else
		print 101,c*((-1)**(2-mod(k,2)))
endif

101 format(i0)
102 format(a)
end program main

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        double[] x = new double[N];
        double[] y = new double[N];
        for (int i = 0; i < N; i++) {
            x[i] = scan.nextDouble();
            y[i] = scan.nextDouble();
        }
        if (N == 2) {
            System.out.printf("%.9f\n", distance(x[0],y[0],x[1],y[1])/2);
            return;
        }
        double answer = Double.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                for (int k = j + 1; k < N; k++) {
                    double[] center = null;
                    if (is_line(x[i],y[i],x[j],y[j],x[k],y[k])) {
                        continue;
                    }
                    center = center_distance_tri(x[i],y[i], x[j],y[j], x[k], y[k]);
                    double max_distance = 0;
                    for (int p = 0; p < N; p++) {
                        max_distance = Math.max(max_distance, distance(center[0],center[1], x[p], y[p]));
                    }
                    answer = Math.min(answer, max_distance);
                }
            }
        }
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                double[] center = new double[2];
                center[0] = (x[i]+x[j])/2;
                center[1] = (y[i]+y[j])/2;
                double max_distance = 0;
                for (int p = 0; p < N; p++) {
                    max_distance = Math.max(max_distance, distance(center[0],center[1], x[p], y[p]));
                }
                answer = Math.min(answer, max_distance);
            }
        }
        System.out.printf("%.9f\n", answer);
    }
    private boolean is_line(double x1, double y1, double x2, double y2, double x3, double y3) {
        double dx1 = x2 - x1;
        double dy1 = y2 - y1;
        double dx2 = x3 - x1;
        double dy2 = y3 - y1;
        return dx1 * dy2 == dx2 * dy1;
    }
    private double[] center_distance_tri(double a, double b, double c, double d, double e, double f) {
        double py = ((e-a) * (a*a + b*b - c*c - d*d) - (c-a)*(a*a + b*b - e*e - f*f))/(2*(e-a)*(b-d)-2*(c-a)*(b-f));
        double px = 0;
        if (c-a == 0) {
            px = (2*(b-f)*py - a*a - b*b + e*e + f*f) / (2*(e-a));
        } else {
            px = (2*(b-d)*py - a*a - b*b + c*c + d*d) / (2*(c-a));
        }
        double[] p = new double[2];
        p[0] = px;
        p[1] = py;
        return p;
    }
    private double distance(double x1, double y1, double x2, double y2) {
        double z = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
        return Math.sqrt(z);
    }
}


Measured memory_bytes: 25488
#include <map>
    #include <set>
    #include <list>
    #include <cmath>
    #include <deque>
    #include <queue>
    #include <stack>
    #include <cstdio>
    #include <string>
    #include <vector>
    #include <complex>
    #include <cstdlib>
    #include <cstring>
    #include <iomanip>
    #include <numeric>
    #include <utility>
    #include <iostream>
    #include <algorithm>
    #include <functional>
     
    using namespace std;
     
    #define INF (1 << 30)
    #define INFL (1LL << 62)
    #define MOD7 1000000007
    #define MOD9 1000000009
    #define EPS 1e-10
     
    #define ll long long
    #define ull unsigned long long
    #define pii pair<int, int>
    #define pll pair<ll, ll>
    #define pul pair<ull, ull>
    #define all(a) (a).begin(), (a).end()
    #define mp make_pair
    #define pb push_back
    #define FOR(i,a,b) for (int i=(a);i<(b);++i)
    #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
    #define REP(i,n) for (int i=0;i<(n);++i)
    #define RREP(i,n) for (int i=(n)-1;i>=0;--i)
     
    void YES() { cout << "YES" << endl; }
    void NO() { cout << "NO" << endl; }
    void Yes() { cout << "Yes" << endl; }
    void No() { cout << "No" << endl; }
    void yes() { cout << "yes" << endl; }
    void no() { cout << "no" << endl; }
    void Taka() { cout << "Takahashi" << endl; }
    void Aoki() { cout << "Aoki" << endl; }
    void digit(int d) { cout << fixed << setprecision(d); }
    void IOup() { cin.tie(0); ios::sync_with_stdio(false); }
     
    int main() {
    	int n, a, ans = INF;
    	cin >> n;
    	while (n--) {
    		cin >> a;
    		int c = 0;
    		while (a % 2 == 0) {
    			a /= 2;
    			c++;
    		}
    		ans = min(ans, c);
    	}
     
    	cout << ans << endl;
     
    	return 0;
    }

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		while(in.hasNext())
		{
			int n=in.nextInt();
			int door=0;//初期状態は施錠
			HashMap<String, String> hm=new HashMap<String, String>();
			for(int i=0;i<n;i++)
			{
				String st=in.next();
				hm.put(st,st);
			}
			int m=in.nextInt();
			for(int i=0;i<m;i++)
			{
				String id=in.next();
				if(id.equals(hm.get(id)))
				{
					if(door==0)
					{
						System.out.println("Opened by"+" "+id);
						door=1;
					}
					else
					{
						System.out.println("Closed by"+" "+id);
						door=0;
					}
				}
				else
					System.out.println("Unknown "+id);
			}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[3009],dp[3009][3009],o;
long long bt(int st,int sz)
{
    if(sz==-1)return 0;
    if(dp[st][sz]!=0)return dp[st][sz];
    /*if(sz==0)
    {
        if(!o)
        dp[st][sz]=a[st];
        else dp[st][sz]=a[st]*(-1);
        return dp[st][sz];
    }*/
    long long &ret=dp[st][sz];
    if(sz%2==o)
    {
        ret=max(a[st]+bt(st+1,sz-1),a[st+sz]+bt(st,sz-1));
    }
    else
    {
        ret=min(bt(st+1,sz-1)+(-1)*a[st],bt(st,sz-1)+a[st+sz]*(-1));
    }
    return ret;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    if(n%2)o=0;
    else o=1;
    cout<<bt(0,n-1)<<"\n";
}



Measured memory_bytes: 70272
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007;
#define pi 3.14159265358979323846264
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define vi vector <int>
#define vl vector <long long>
#define vpii vector <pair <int, int> >
#define ll long long
#define fi first
#define se second
ll n, a, b, ar[100005];
ll ans;
int main() {
    scanf("%lld %lld %lld", &n, &a, &b);
    for (int i=1;i<=n;i++) scanf("%lld", &ar[i]);
    for (int i=2;i<=n;i++) ans+=min((ar[i]-ar[i-1])*a, b);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
int main()
{
    string s;
    cin >> s;
    int len = s.size(), ans = 0;
    for(int i=0;i<len/2;i++) {
        if(s[i] != s[len-i-1]) ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <math.h>
#include <assert.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <array>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL); clock_t beg = clock()
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
//const int N = 1e5+7 ;
const int INF = 1e18 ;
//const int MOD = 1e9 + 7 ;
/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
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 ;
}
//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif



int n ;
vi a , dp , ans ;
vector<vector<int>> adj ;

void dfs(int x , int par = -1){
	int idx = lower_bound(all(dp),a[x])-begin(dp) ;
	int t = dp[idx] ; // used to roll-back
	dp[idx] = a[x] ;
	//trace(x,dp) ;
	ans[x] = lower_bound(all(dp),INF)-begin(dp) ;
	for(int y : adj[x]){
		if(y == par) continue ;
		dfs(y,x) ;
	}
	dp[idx] = t ;
}
void solve(){
	cin >> n ;
	a.resize(n) ;
	dp.resize(n,INF) ;
	adj.resize(n) ;
	ans.resize(n) ;
	for(int i = 0 ; i < n ; i++){
		cin >> a[i] ;
	}
	for(int i = 1 ,x , y ; i < n ; i++){
		cin >> x >> y ;
		--x ; --y ;
		adj[x].pb(y) ;
		adj[y].pb(x) ;
	}
	dfs(0,-1) ;
	for(auto x : ans) cout << x << endl ; 
	
}

int32_t main(){
	FAST_IO ;
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
}


Measured memory_bytes: 30356
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[31]={},p=1,n;

  for(int i=1;i<31;i++){

    if(i>1&&i%2)p*=3;

    a[i]=a[i-1]+p;

  }

  while(cin>>n)
    cout<<a[n]<<endl;
}

Measured memory_bytes: 3020