akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //-----------------------------------------
    int N;
    cin >> N;

    bool isApproved = true;
    rep(i, N)
    {
        int A;
        cin >> A;
        if(A%2==0)
        {
            if(A%3!=0&&A%5!=0)
            {
                isApproved = false;
            }
        }
    }

    if(isApproved)
    {
        cout << "APPROVED" << endl;
    }
    else
    {
        cout << "DENIED" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
N=int(input())
S=input()
leftid=-1
rightid=-1
blcnt=0
whcnt=0
cnt=0
ans=float("inf")
#.*#*になれば良い
#左と右から黒石・白石の数を数えていき、
#"a1,a2,a3,...,aN"列から構成しうるN+1この".#"境界
#について境界右で白い部分と左で黒い部分を変更する必要があるため、その和の最小が答え
leftblack=[0]*N
rightwhite=[0]*N
if S[0]=="#":
    leftblack[0]=1
if S[N-1]==".":
    rightwhite[N-1]=1
for i in range(1,N):
    if S[i]=="#":
        leftblack[i]=leftblack[i-1]+1
    else:
        leftblack[i] =leftblack[i - 1]
#print(leftblack)
for i in range(N-1,0,-1):
    if S[i-1]==".":
        rightwhite[i-1]=rightwhite[i]+1
    else:
        rightwhite[i-1] = rightwhite[i]
#print(rightwhite)
leftblack.insert(0,0)
rightwhite.insert(N,0)
#print(leftblack)
#print(rightwhite)
for i in range(N+1):# ####→.###→→....を考える
    ans=min(ans,leftblack[i]+rightwhite[i])
print(ans)

Measured memory_bytes: 47328
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int l; cin >> l;
  VV<> res;
  for (int i = 1; i < 20; i++) res.push_back(V<>{i, i + 1, 0});
  int t = 1;
  while (l > 1) {
    if (l & 1) {
      l -= 1;
      res.push_back(V<>{t, 20, l});
    } else {
      l >>= 1;
      res.push_back(V<>{t, ++t, l});
    }
  }
  cout << 20 << ' ' << res.size() << '\n';
  for (auto&& v : res) cout << v[0] << ' ' << v[1] << ' ' << v[2] << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fo(i,start,end) for(int i=start;start<end?i<end:i>end;start<end?i+=1:i-=1)
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vop vector<pll>
#define vov vector<vector<ll>>
using namespace std;

const long long mod1=1e9+7;
const long long mod2=1e18;
const ll mod3=9e18;

long long power(ll  x, ll n){if(n==0)return 1;ll temp=power(x,n/2);if(n%2==0)return temp*temp;else return x*temp*temp;}
ll MAX(ll a,ll b){return a>b?a:b;}
ll MAX(ll a,ll b,ll c){return max(max(a,b),c);}
ll MIN(ll x,ll  y){return x+y-max(x,y);}
ll MIN(ll x,ll y,ll z){return min(min(x,y),z);}
void swap(int* a, int* b){int t = *a;*a = *b;*b = t;}
bool f(ll x,ll y){return x>y;}
const ld pi=3.14159265358;





int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    ll arr[n+1];
    fo(i,0,n+1)arr[i]=0;
    fo(i,0,n-1){
        ll t;
        cin>>t;
        arr[t]++;


    }
fo(i,1,n+1)cout<<arr[i]<<"\n";
    return 0;
}

Measured memory_bytes: 5224
n=int(input())
s=[[0]*9for i in range(9)]
for i in range(1,n+1):
    if i%10!=0:
        t=str(i)
        s[int(t[0])-1][int(t[-1])-1]+=1
an=0
for i in range(1,10):
    for j in range(1,10):
        an+=s[i-1][j-1]*s[j-1][i-1]
print(an)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000007
//S.size()

using namespace std;


typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;



int main(void){
  int A,B;
  string S;
  cin>>A>>B>>S;
  bool jud = true;
  for(int i = 0;i < A;i++){
    if(S[i] != '0' && S[i] != '1' && S[i] != '2' && S[i] != '3' && S[i]
      != '4' && S[i] != '5' && S[i] != '6' && S[i] != '7' && S[i] != '8'
      && S[i] != '9')jud = false;

  }
  if(S[A] != '-')jud =false;
  for(int t = A + 1;t < A + B + 1;t++){
    if(S[t] != '0' && S[t] != '1' && S[t] != '2' && S[t] != '3' && S[t]
      != '4' && S[t] != '5' && S[t] != '6' && S[t] != '7' && S[t] != '8'
      && S[t] != '9')jud = false;
  }
  cout<<(jud?"Yes":"No");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
  int n,m;
  vector<string> u;
  string t;

  cin >> n;

  for(int i=0;i<n;i++){
    string var;
    cin >> var;
    u.push_back(var);
  }

  cin >> m;
  int state=0; // close

  for(int i=0;i<m;i++){
    cin >> t;
    for(int j=0;j<n;j++){
      if(t==u[j]){
        if(state==0){
          cout << "Opened by " << t << endl;
          state=1;
        }else{
          cout << "Closed by " << t << endl;
          state=0;
        }
        break;
      }else if(t!=u[j]&&j==n-1){
        cout << "Unknown " << t << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1224
#include<iostream>

using namespace std;

int main(){
    int A[21][21];
    int B[21];
    int N, M, C;
    int x, s;
    cin >> N >> M >> C;
    for(int i=1; i<=M; i++){
        cin >> B[i];
    }

    x = 0; s = 0;
    for(int i=1; i<=N; i++){
        for(int j=1; j<=M; j++){
            cin >> A[i][j];
            x += A[i][j] * B[j];
        }
        x += C;
        if(x > 0) s++;
        x = 0;
    }

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

Measured memory_bytes: 256
#include<stdio.h>
int sac(int,int);//sum and check 1=OK,0=NOT
int H[20];
int n;

int main(){
  int i,q,x;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&H[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&x);
    if(sac(0,x)==1)printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int sac(int i,int x){
  if(x==0)return 1;
  if(i>=n)return 0;
  //printf("%d %d\n",i,x);
  if(sac(i+1,x)==1||sac(i+1,x-H[i])==1)return 1;
}



Measured memory_bytes: 2612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll div_ceil(ll, ll);

int main() {
  int N;
  std::cin >> N;
  std::vector<int> H(N);
  REP(i, N) { std::cin >> H.at(i); }
  int count = 1;
  REP(i, N) {
    bool ok = true;
    REP(j, i) {
      if (H.at(i) < H.at(j)) {
        ok = false;
      }
    }
    if (i != 0 && ok) {
      count++;
    }
  }
  std::cout << count << '\n';
}

ll div_ceil(ll a, ll b) {
  ll quotient = a / b;
  ll remainder = a % b;
  if (remainder == 0) {
    return quotient;
  } else {
    return quotient + 1;
  }
}


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

const int MAX_N = 100000;

int N, M;
int A[MAX_N];

struct UF {
    static const int N = 100000;//書き換え!
    int par[N];
    int rank[N];
    vector<int> group[N];
    int num;

    UF() {
        rep(i, N) {
            par[i] = i;
            rank[i] = 0;
            group[i].push_back(A[i]);
        }
    }

    void init() {
        rep(i, N) {
            par[i] = i;
            rank[i] = 0;
            group[i].clear();
            group[i].push_back(A[i]);
        }
    }

    int root(int x) {
        if (par[x] == x)return x;
        return par[x] = root(par[x]);
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y)return;
        num--;
        if (rank[x] < rank[y]) {
            par[x] = y;
            rep(i, group[x].size()) {
                group[y].push_back(group[x][i]);
            }
            group[x].clear();
        } else {
            par[y] = x;
            rep(i, group[y].size()) {
                group[x].push_back(group[y][i]);
            }
            group[y].clear();
            if (rank[x] == rank[y])++rank[x];
        }
    }
};

UF uf;

signed main() {
    cin >> N >> M;
    uf.num = N;
    rep(i, N)cin >> A[i];
    uf.init();
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        uf.unite(x, y);
    }
    int ans = 0;
    int num = uf.num;
    if (num == 1) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> kouho;
    rep(i, N) {
        if (i == uf.root(i)) {
            sort(uf.group[i].begin(), uf.group[i].end());
            ans += uf.group[i][0];
            for (int r = 1; r < uf.group[i].size() && r <= num - 1; ++r) {
                kouho.push_back(uf.group[i][r]);
            }
        }
    }
    sort(kouho.begin(), kouho.end());
    if (kouho.size() < num - 2) {
        cout << "Impossible" << endl;
        return 0;
    }
    rep(i, num - 2) {
        ans += kouho[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10748
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
int main() 
{
    int A,B;
    cin >> A >> B;

    if(A < 2*B){
        cout << 0 << endl;
    }
    else
    {
        cout << A-2*B << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define ll long long
    #define mod 1000000007
    #define maxn 200005
    #define vi vector<int>
    #define vl vector<ll>
    #define mii map<int,int>
    #define mli map<ll,int>
    #define forit(it,v) for(auto it=v.begin();it!=v.end();++it)
    #define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
    using namespace std;
    void solve()
    {
        ll n,v=7,k=0;
        cin>>n;
        v=v%n;
        mli mp;
        while(mp[v]==0 && v!=0)
        {
            mp[v]=1;
            v=(v*10+7)%n;
            k++;
        }
        if (v!=0)
        {
            k=-2;
        }
        cout<<k+1;
    }
    int main()
    {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
        fastIO;
        // sieve();
        int t=1;
        // int t;
        // cin>>t;
        while(t--)
        {
            solve();
        }
        return 0;
    }

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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
constexpr ll INF = 1999999999999999997; 
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    int main() {
        fastio;

        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        ll ans=0;
        ll lc = (c*d)/(__gcd(c,d));
            ans= b/d + b/c - (a-1)/c - (a-1)/d - (b/lc - (a-1)/lc);
            cout<<(b-a+1)-ans<<endl;  
        
    }

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){
    unsigned long long int N;
    cin >> N;
    if(N%2==1){
        cout << "0" << endl;
    }
    else{
        int cnt = 1;
        unsigned long long int count5 = 0;
        unsigned long long int tmp = N;
        while(tmp/5>0){
            count5 += tmp/10;
            cnt +=1;
            tmp /=5;
        }
        cout << count5 << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

int c[100005];
int d[100005];
int n,a,b;
long long sum;

bool meet(long long cnt)
{
    long long t = sum;

    for (int i = 0;i < n;i++)
    {
        d[i] = c[i];
        d[i] -= cnt * b;
    }



    for (int i = 0;i < n;i++)
    {
        if (d[i] <= 0) continue;

        if (d[i] % (a - b) == 0)
        {
            cnt -= d[i] / (a - b);
        }
        else
        {
            cnt -= (d[i] / (a - b) + 1);
        }
    }

    if (cnt >= 0) return true;
    else return false;
}

int main()
{
    scanf("%d%d%d",&n,&a,&b);

    for (int i = 0;i < n;i++)
    {
        scanf("%d",&c[i]);
        sum += c[i];
    }

    sort(c,c+n);

    long long l = 1,h = c[n-1] / b + 1;
    long long mid;

    while (l <= h)
    {
        //printf("ss*\n");
        mid = (l + h) / 2;

        if (meet(mid)) h = mid - 1;
        else l = mid + 1;
    }

    while (meet(mid - 1)) mid--;
    while (!meet(mid)) mid++;

    printf("%I64d\n",mid);

    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a, b, c;
  cin >> a >> b >> c;
  if(c-a-b > 0 && 4*a*b-(c-a-b)*(c-a-b) < 0){
    cout <<"Yes" <<endl;
  }else{
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n;
  cin >> n;

  ll c=0;

  for(int i=1;i<n+1;i++){
    ll a;
    cin >> a;
    if(i%2==1 && a%2==1)c++;
  }
  cout << c << endl;


}

Measured memory_bytes: 3616
import sys
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))

sum_S = sum(S)
if sum_S % 10 != 0:
    print(sum_S)
    sys.exit()

S.sort()

for s in S:
    if s % 10 != 0:
        break
else:
    print(0)
    sys.exit()

print(sum_S - s)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
template <class X> void print(X x) { cout << x << endl; }
#define in(A, n)                                                                                                       \
    rep(i, n) {                                                                                                        \
        cin >> f;                                                                                                      \
        A.push_back(f);                                                                                                \
    }

void print(vl x) {
    for(ll i : x) {
        cout << i << " ";
    }
    cout << endl;
}
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v, m;
ll codeforces = 1;
string S, T;
vector<vl> g(MAX_N);
vl A, B, C;
ll NEXT[MAX_N][20], NEXT2[MAX_N][20];
void input() {
    cin >> n >> k;
    rep(i, n) {
        cin >> x;
        A.pb(x);
    }
    cin >> q;
}
void solve() {
    rep(i, n) {
        a = lower_bound(all(A), A[i] + k) - A.begin();
        B.pb(a);
    }
    rep(i, n) {
        a = upper_bound(all(A), A[i] - k) - A.begin() - 1;
        C.pb(a);
    }

    rep(i, 20) {
        if(i == 0) {
            rep(j, n) { NEXT[j][i] = B[j]; }
        } else {
            rep(j, n) {
                if(NEXT[j][i - 1] == n)
                    NEXT[j][i] = n;
                else
                    NEXT[j][i] = NEXT[NEXT[j][i - 1]][i - 1];
            }
        }
    }

    rep(i, 20) {
        if(i == 0) {
            rep(j, n) { NEXT2[j][i] = C[j]; }
        } else {
            rep(j, n) {
                if(NEXT2[j][i - 1] == -1)
                    NEXT2[j][i] = -1;
                else
                    NEXT2[j][i] = NEXT2[NEXT2[j][i - 1]][i - 1];
            }
        }
    }

    vl cost1(n + 1, 0), cost2(n + 1, 0);

    for(ll i = n; i > -1; i--) {
        if(i == n)
            cost1[i] = 0;
        else {
            cost1[i] = cost1[NEXT[i][0]] + i;
        }
    }

    for(ll i = -1; i < n; i++) {
        if(i == -1)
            cost2[i + 1] = 0;
        else {
            cost2[i + 1] = cost2[C[i] + 1] + i;
        }
    }

    rep(i, q) {
        cin >> l >> r;
        l--;
        r--;
        a = 0;
        t = l;
        p = r;
        rrep(i, 20) {
            if(NEXT[t][i] <= r) {
                a += 1 << i;
                t = NEXT[t][i];
                p = NEXT2[p][i];
            }
        }
        t = B[t];
        p = C[p];

        print(a - (cost1[l] - cost1[t]) + (cost2[r + 1] - cost2[p + 1]) + 1);
    }
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    while(codeforces--) {
        solve();
    }
}

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

#ifdef TESTING
  #include "dump.hpp"
#else
  #define DUMP(...)
  #define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))
#define CS(s,l) char s[l + 1];assert(0<scanf("%s",s))

int main(){
  INT(n); INT(q);
  CS(s, n); string ts = "", ds = ""; 
  REP(q){CS(t, 1); CS(d, 1); ts += t[0]; ds += d[0];}
  auto check = [&](int i){
    REP(j, q){
      if (i < 0){
        return -1;
      } else if (n <= i){
        return 1;
      }
      if (ts[j] == s[i]){
        if (ds[j] == 'L'){
          i--; 
        } else {
          i++;
        }
      }
    }
    if (i < 0){
      return -1;
    } else if (n <= i){
      return 1;
    }
    return 0;
  };
  int l = -1, r = n, m, ll, rr, ans;
  while (l + 1 < r){
    m = (l + r) / 2;
    if (check(m) == -1){
      l = m;
    } else {
      r = m;
    }
  } ll = l;
  l = -1, r = n;
  while (l + 1 < r){
    m = (l + r) / 2;
    if (check(m) == 1){
      r = m;
    } else {
      l = m;
    }
  } rr = r;
  ans = rr - ll - 1;
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 936
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

from collections import defaultdict

N = int(input())

counter = defaultdict(int)

for i in map(str, range(1, N+1)):
  # 桁数の先頭、末尾を代入
  head = i[0]
  tail = i[-1]
  counter[(head, tail)] += 1

ans = 0  
for (head, tail), cnt in list(counter.items()):  
  ans += cnt * counter[(tail, head)]

print(ans)  

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
 
int main() {
	int N,K;
	cin >> N >> K;
	int A[Nmax]={};
	int mina=MOD;
	REP(i,N){
		cin >> A[i];
		mina=min(mina, A[i]);
	}
	int ans=0;
	if((N-1)%(K-1)==0) ans = (N-1)/(K-1);
	else ans = (N-1)/(K-1)+1;
	cout << ans << endl;
	return 0;
}

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

#define pb push_back
#define ppp pop_back
#define pii pair<int,int>
#define fi first
#define se second

const int N = 3005;

double dp[N][N];
double a[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int n;
    cin >> n;
    for (int i=1; i<=n; i++) cin >> a[i];
    dp[0][0] = 1;
    for (int i=1; i<=n; i++) {
        dp[i][0] = dp[i-1][0] * (1 - a[i]);
        for (int j=1; j<=i; j++) {
            dp[i][j] = dp[i-1][j-1] * a[i] + dp[i-1][j] * (1 - a[i]);
        }
    }
    double ans = 0;
    for (int i=(n+1)/2; i<=n; i++) ans += dp[n][i];
    cout << fixed << setprecision(12);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 69120
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private final static String NEGATIVE = "NO\n";
	private final static String AFFIRMATIVE = "YES\n";

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in),1024);
		int number = Integer.parseInt(br.readLine());
		int sides[] = new int[3];
		StringTokenizer tknz;
		StringBuilder builder = new StringBuilder();

		for (; 0 < number; number--) {
			tknz = new StringTokenizer(br.readLine());
			for (int i = 0; i < 3; i++) {
				sides[i] = Integer.parseInt(tknz.nextToken());
			}
			Arrays.sort(sides);
			if (sides[0] * sides[1] * sides[2] % 60 != 0) {
				builder.append(NEGATIVE);
			} else if (Math.pow(sides[0], 2) + Math.pow(sides[1], 2) != Math.pow(sides[2], 2)) {
				builder.append(NEGATIVE);
			} else {
				builder.append(AFFIRMATIVE);
			}
		}
		System.out.print(builder);
	}
}

Measured memory_bytes: 18360
from collections import defaultdict
h, w = map(int, input().split())
A = defaultdict(int)
for _ in range(h):
  for x in str(input()):
    A[x] += 1
#print(A)
for k in A.keys():
  A[k] %= 4
#print(A)
if h%2 == 0 and w%2 == 0:
  if sum(A.values()) == 0:
    ans = 'Yes'
  else:
    ans = 'No'
else:
  cnt2 = 0
  for k in A.keys():
    if A[k] >= 2:
      cnt2 += 2
      A[k] %= 2
  rest = sum(A.values())
  if h%2 == 1 and w%2 == 1:
    if cnt2 <= h + w - 2 and rest == 1:
      ans = 'Yes'
    else:
      ans = 'No'
  else:
    if h%2 == 0 and cnt2 <= h and rest == 0:
      ans = 'Yes'
    elif w%2 == 0 and cnt2 <= w and rest == 0:
      ans = 'Yes'
    else:
      ans = 'No'
print(ans)

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    ll n;
    cin >> n;
    vi h(n);
    rep(i, n) { cin >> h[i]; }

    int ans = 0;
    while (true) {
        if (count(all(h), 0) == n) break;
        int i = 0;
        while (n > i) {
            if (h[i] == 0) {
                i++;
            } else {
                ans++;
                while (n > i && h[i] > 0) {
                    h[i]--;
                    i++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

string s;
int r=0;
int b=0;

int main(){
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='0')
			r++;
		else
			b++;
	}
	cout<<2*min(r,b)<<endl;
	return 0;

}

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

int main()
{
	int n;
	cin >> n;
	for (int i = 3; i <= n; i++)
	{
		string a = to_string(i);
		for (int j = 0; j <= a.length() - 1; j++)
		{
			if (a[j] == '3')
			{
				while (a[j] == '3')
				{
					cout << " " << i;
					i++;
					if (i > n)
					{   
						cout << endl;
						return 0;
					}
					a = to_string(i);
				}
				break;
			}
		}
		if (i % 3 == 0) cout << " " << i;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define loop(i,n) for(int i = 0;i < (n);i++)
#define range(i,a,b) for(int i = (a);i <= (b);i++)
#define all(A) A.begin(),A.end()
#define pb push_back
#define mp make_pair
#define sz(A) ((int)A.size())
#define vi vector<int>
#define vl vector<long long>
#define vd vector<double>
#define vp vector<pair<int,int> >
#define ll long long
#define pi pair<int,int>
#define popcnt(x) __builtin_popcount(x)
#define LSOne(x) ((x) & (-(x)))
#define xx first
#define yy second
#define PQ priority_queue
#define print(A,t) cerr << #A << ": "; copy(all(A),ostream_iterator<t>(cerr," " )); cerr << endl
#define prp(p) cerr << "(" << (p).first << " ," << (p).second << ")";
#define prArr(A,n,t)  cerr << #A << ": "; copy(A,A + n,ostream_iterator<t>(cerr," " )); cerr << endl
#define PRESTDIO() cin.tie(0),cerr.tie(0),ios_base::sync_with_stdio(0)
#define what_is(x) cerr << #x << " is " << x << endl
#define bit_lg(x) (assert(x > 0),__builtin_ffsll(x) - 1)
const double PI = acos(-1);
using namespace std;
 
int cnt[4];
int A[1 << 20];
 
int main(){

	int n,x; scanf("%d",&n);
	loop(i,n) {
		scanf("%d",&x);
		cnt[x%4]++;
	}
	if(cnt[1] + cnt[2] + cnt[3] <= cnt[0] + 1) puts("Yes");
	else if(cnt[1] + cnt[3] <= cnt[0]) puts("Yes");
	else puts("No");
	return 0;
}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define R(i,n) for(int i = 0; i < (n); i++)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}

template<class T> ostream &operator<<(ostream& os, set<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}

template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if(k % 2){
    cout << b - a << "\n";
  }else{
    cout << a - b << "\n";
  }
}




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

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int main() {
    vi A(5);
    int mn = INF, mx = 0;
    int a;
    for (int i = 0; i < 5; i++) {
        cin >> a;
        mn = min(mn, a);
        mx = max(mx, a);
    }

    int k;
    cin >> k;

    if (mx - mn <= k) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

const int mod = 1e9+7;

int n;
int a[N];
int dp[N];

int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        dp[i] = 0;
    }
    int mx = 0;
    for(int i = 2; i <= n; i++){
        if(a[i - 1] >= a[i]){
            dp[i] = dp[i - 1] + 1;
        }
        mx = max(mx , dp[i]);
    }
    cout << mx << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int main() {
    int n, q;
    cin >> n >> q;
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            d.merge(u, v);
        }
        else {
            cout << d.same(u, v) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4004
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<queue>
#include<math.h>
#include<ctime>
#include<deque>
#include<set>
#include<string.h>
#include<algorithm>
#include<map>
#include<stack>
#define ll long long
#define ld long double
#define ull unsigned long long
#define ls rt<<1
#define rs rt<<1|1
#define mmm(a,b) memset(a,b,sizeof(a))
#define sc(x) scanf("%d",&x)
using namespace std;
const ll mod = 1e9+7;
const ll inf = 1e17;
const double pi = acos(-1.0);
const int maxn = 1e6+5;
ll kase;
int n,m,p;
int f[maxn][2],vis[maxn];
string s;
void run(){
    cin>>n;
    int ok=0,tmp=0;
    for(int i=0;i<n;i++){
        cin>>m>>p;
        if(m==p)tmp++;
        else tmp=0;
        if(tmp==3)ok=1;
    }
    cout<<(ok?"Yes":"No");
}
int main(){
#ifdef haosao
freopen("main.h", "r", stdin);
//freopen("out.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
//    cin>>kase;
//    while(kase--)
        run();
    return 0;
}


Measured memory_bytes: 3168
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

int ncr(int n, int k)  
{  
    int res = 1;  
  
    // Since C(n, k) = C(n, n-k)  
    if ( k > n - k )  
        k = n - k;  
  
    // Calculate value of  
    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]  
    for (int i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
}  

signed main() {
   tezz
   
    int n;
    cin >> n;
    string s;
    vector<string> a(n);
    for(int i=0; i<n; i++){
        cin >> s;
        sort(all(s));
        a[i]=s;
    }
    int c=0;
    sort(all(a));
    int ans=0;
    for(int i=1; i<n; i++){
        if(a[i]==a[i-1])c++;
        else {
            if(c>=1){
                // c++;
                ans+=ncr(c+1,2);
            }
            c=0;
        }
    }
    if(c>=1){
        // c++;
        ans+=ncr(c+1,2);
    }
    cout << ans;
    
   return 0;
}



Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <iomanip>
#include <deque>
using namespace std;
typedef long long int lo;
#define pb push_back
#define pf push_front
#define ft front
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e9;
#define FOR for(lo i = 0 ; i < n ; i++)
#define FORV for(lo i = 0 ; i < (lo)v.size() ; i++)
#define ii pair<lo,lo>
#define iii pair<lo, pair<lo,lo> >
bool is_p(string s){
    lo n = s.size();
    string s1 = "";
    for(lo i = n - 1 ; i >= 0 ; i--){
        s1 += s[i];
    }
    if(s == s1){
        return 1;
    }
    return 0;
}
lo a,b,c,d,e,n,m,k,t,h,x,y,a1[100005],a2[100005];
char c1[505][505],c2,c3,c4;
string s1,s2,s3,s4;
double d1,d2,d3;
vector <lo> v;
map <lo,lo> mp1;
map <string,lo> mp2;
set <lo> stt;
queue <lo> q;
priority_queue <lo> pq;
lo vis [10000];
deque <lo> dq;
int main() {
    // freopen("gir.gir", "r", stdin);
    // freopen("cik.cik", "w", stdout);
    cin >> n;
    d1 = (n / 3.0) * (n / 3.0) * (n / 3.0);
    printf("%f \n", d1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define all(c) (c).begin(), (c).end()
#define endl '\n'

ll pow(ll a,ll p,ll m=mod)
{ll res=1;while(p>0){if(p&1)res=(res*a)%m;a=(a*a)%m;p>>=1;}
return res;}




int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//      int t;
//      cin >> t;
//      while(t--){



// }

int x,n;
cin >> x >> n;
int arr[n];
fo(i,0,n)cin >> arr[i];

int mi = mod;
int mians = 0;
fo(i,-500,500){
	int j;
	for(j=0;j < n;j++){
		if(i == arr[j])break;
	}
	if(j == n){
		if(mi > abs(x-i)){
			mians = i;
			mi = abs(x-i);
		}
	}
}
cout << mians << endl;




return 0;
}



Measured memory_bytes: 3624
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string s = Console.ReadLine();
    string alphabets = "abcdefghijklmnopqrstuvwxyz";//26文字
    int n = s.Length;
		long answer = 1000;
    long answerMemo = 0;
    long answerMemoMax = 0;
    
    for(int i = 0; i < 26; i++)
    {
      for(int j = 0; j < n; j++)
      {
        if(s[j] == alphabets[i])
        {
          answerMemoMax = Math.Max(answerMemoMax, answerMemo);
          answerMemo = 0;
        }else
        {
          answerMemo++;
        }
        answerMemoMax = Math.Max(answerMemoMax, answerMemo);
      }
      //Console.WriteLine(i + " " +answerMemoMax);
      answer = Math.Min(answer, answerMemoMax);
      answerMemo = 0;
      answerMemoMax = 0;
    }

    
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 13140
#include <stdio.h>

#define N 128

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;

  for ( ; ; ) {
    int res = 0;
    int d[ N ];
    int n;

    scanf ( "%d", &n );
    if ( !( n ) ) break ;

    for ( i = 0; i < n; ++i )
    {
      scanf ( "%d", d + i );
    }

    for ( j = n; j; --j )
    for ( i = 1; i < j; ++i )
    {
      if ( d[ i - 1 ] > d[ i ] )
      {
        int t = d[ i - 1 ];
        d[ i - 1 ] = d[ i ];
        d[ i ] = t;
        ++res;
      }
    }

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

  return ( 0 );
}

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

int main() {
  int N; cin >> N;
  int dp[45];
  dp[0] = dp[1] = 1;
  rep(i, 1, N) dp[i + 1] = dp[i] + dp[i - 1];
  cout << dp[N] << endl;
  return 0;
}



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

int main(){
    int r,D;
    vector<int> x(11);
    cin >> r >> D >> x.at(0);
    for(int i = 1;i < 11; i++){
        x.at(i) = r * x.at(i-1) - D;
    }
    for(int i = 1;i < 11; i++){
        cout << x.at(i) << endl;
    }
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string>
#include <queue>
#include <vector>
using namespace std;

int cnt = 0;
int A[500000];
int L[250001];
int R[250001];

void merge(int A[], int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	for (int i = 0; i < n1; i++) L[i] = A[left + i];
	for (int i = 0; i < n2; i++) R[i] = A[mid + i];
	L[n1] = 1000000000;
	R[n2] = 1000000000;

	int i = 0, j = 0;
	for (int k = left; k < right; k++) {
		if (L[i] <= R[j]) {
			A[k] = L[i];
			i++;
		}
		else {
			A[k] = R[j];
			j++;
		}
		
		cnt++;
	}
}

void mergeSort(int A[], int left, int right) {
	if (left + 1 < right) {
		int mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];
	mergeSort(A, 0, n);
	for (int i = 0; i < n; i++) {
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl << cnt << endl;
}



Measured memory_bytes: 6996
#include<stdio.h>

int main(){
    int a, b;
    
    scanf("%d", &a);
    scanf("%d", &b);
    
    int l;
    l = a*2+b*2;
    
    int s;
    s = a*b;
    
    printf("%d %d\n", s ,l);
    
    return 0;
}


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

namespace ABC099
{
    class C
    {
        static int[] memo;
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            memo = new int[N + 1000].Select(x => -1).ToArray();

            Console.WriteLine(rec(N));
        }

        static int rec(int n)
        {
            if (n == 0) return 0;
            if (memo[n] != -1) return memo[n];

            int res = n;
            for (int i = 1; i <= n; i *= 6) res = Math.Min(res, rec(n - i) + 1);
            for (int i = 1; i <= n; i *= 9) res = Math.Min(res, rec(n - i) + 1);

            memo[n] = res;
            return memo[n];
        }
    }
}


Measured memory_bytes: 17504
#include<cstdio>
#include<algorithm>
#include<functional>
#include<map>
using namespace std;

int a, l;
char s[10];

int getN(char* a) {
  int ans = 0;
  for (int i = 0; i < l; i++) {
    ans *= 10;
    ans += (int)a[i] - '0';
  }
  return ans;
}

void getC(int a, char* c) {
  c[l] = 0;
  for (int i = l - 1, temp = 1; i >= 0; i--, temp *= 10) c[i] = (char)((int)(a % (temp * 10)) / temp) + '0';
}

void copy(char* t) {
  char x[10];
  for (int i = 0; i < l + 1; i++) x[i] = t[i];
}

int main() {
  while (1) {
    scanf("%d%d", &a, &l);
    if (l == 0) break;
    getC(a, s);
    int counter = 1, a = getN(s);
    char x[10];
    for (int i = 0; i < l + 1; i++) x[i] = s[i];
    sort(x, x + l, greater<int>());
    char y[10];
    for (int i = 0; i < l + 1; i++) y[i] = s[i];
    sort(y, y + l);
    int b = getN(x) - getN(y);
    map<int, int> m;
    m[a] = -1;
    m[b] = 1;
    if (a == b) {
      printf("0 %d 1\n", a);
      continue;
    }
    while (b != a) {
      getC(b, x);
      getC(b, y);
      sort(x, x + l, greater<int>());
      sort(y, y + l);
      b = getN(x) - getN(y);
      counter++;
      if (m[b] != 0) {
        if (m[b] == -1) m[b] = 0;
        printf("%d %d %d\n", m[b], b, counter - m[b]);
        break;
      }
      m[b] = counter;
    }
  }
}



Measured memory_bytes: 2740
#include<stdio.h>
#define inf 5000000000000000

long long maxs(long long a,long long b,long long c){
	if(a<=b && b<=c){return c-a;}
	if(a<=c && c<=b){return b-a;}
	if(b<=a && a<=c){return c-b;}
	if(b<=c && c<=a){return a-b;}
	if(c<=a && a<=b){return b-c;}
	if(c<=b && b<=a){return a-c;}
}

long long hk(long long a,long long b){
	if(a<b){return a;}return b;
}

int main(void){
	long long h,w,i,d,min;
	scanf("%lld%lld",&h,&w);
	if((h*w)%3 == 0){printf("0\n");return 0;}
	min = hk(h,w);
	for(i = 1;i <= h-1;i++){
		if(w%2 == 0){d = maxs(w*i,(w/2)*(h-i),(w/2)*(h-i));}
		else{d = maxs(w*i,((w/2)+1)*(h-i),(w/2)*(h-i));}
		min = hk(min,d);
	}
	for(i = 1;i <= w-1;i++){
		if(h%2 == 0){d = maxs(h*i,(h/2)*(w-i),(h/2)*(w-i));}
		else{d = maxs(h*i,((h/2)+1)*(w-i),(h/2)*(w-i));}
		min = hk(min,d);
	}
	printf("%lld\n",min);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <random>
using namespace std; typedef long long ll; const int INF=1e9;
typedef pair<int,int> P;

int keta(ll a) {int res=0; while(a>0) res+=a%10, a/=10; return res;}
int main() {
  int n; cin>>n;
  int an=1e9;
  for(int i=1;i<n;i++) {
    int j=n-i;
    an = min(an, keta(i) + keta(j));
  }
  cout<<an<<endl;
}

Measured memory_bytes: 256
a,b = map(int,input().split())

c = []

if a == b:
    print(a + b)
    
elif a > b:
    c.append(a)
    a = a - 1
    if a > b:
        c.append(a)
    else:
        c.append(b)
    print(sum(c))
    
elif a < b:
    c.append(b)
    b = b - 1
    if a > b:
        c.append(a)
    else:
        c.append(b)
    print(sum(c))  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define MOD 1000000007

using namespace std;
using ll = long long;

int main() {
	ll a, b, c, k, ans = 0;
	cin >> a >> b >> c >> k;
	ll ad = k - a, bd = k - a - b;
	if (ad <= 0) ans = k;
	else if (bd <= 0) ans = a;
	else ans = a - bd;

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


Measured memory_bytes: 3636
//https://atcoder.jp/contests/code-festival-2017-quala/tasks/code_festival_2017_quala_a
//A - Snuke's favorite YAKINIKU
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    string S; cin>>S;
    string tmp="YAKI";
    bool ans=true;
    REP(i,tmp.size()){
        if(i>=S.size() || tmp[i]!=S[i]){
            ans=false;
        }
    }
    cout<<(ans?"Yes":"No")<<endl;
    return 0;
}

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

using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;

int32_t main() {
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall


        
    ini(n);
    vl V[12];
    FOR(i,1,10)V[1].push_back(i);
    if(n<=9){
        out(n);
        return 0;
    }
    n-=9;
    FOR(i,1,10){
        for(auto x:V[i]){
            int tmp = x%10;
            if(tmp)V[i+1].push_back(x*10+tmp-1);
            V[i+1].push_back(x*10+tmp);
            if(tmp!=9) V[i+1].push_back(x*10+tmp+1);
        }
        if(n<=V[i+1].size()){
            out(V[i+1][n-1]);
            return 0;
        }
        n-=V[i+1].size();
    }
    


    return 0;
}


Measured memory_bytes: 1976
#include <stdio.h>
#include <stdlib.h>
#include<iostream>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <string.h>
#include <string>
#include <limits.h>
#include <algorithm>
#include <set>
#include <ctime>
#include <cmath>
#include <assert.h>
#include <stack>
using namespace std;
#define SZ(x) ((int)(x).size())
#define rep(i,a,n) for (int i=a; i<(int)n; i++)
#define per(i,n,a) for (int i=n; i>=a; i--)
#define hk push_back
#define pk pop_back
#define mp make_pair
#define PI 3.141592653589793
#define clr(a) memset(a, 0, sizeof(a))
#define clr1(a) memset(a, -1, sizeof(a))
#define c_false ios_base::sync_with_stdio(false); cin.tie(0)
typedef vector<int> VI;
typedef vector< pair<int, int> > VIP;
typedef vector< pair<int, pair<int, int> > > VIPP;
typedef vector<string> VS;
typedef vector <double> VD;
typedef vector <bool> VB;
typedef long long ll;
#define MAX_V 1000
const ll mod = 1000000007;
ll powmod(ll a, ll b) {
	ll res = 1; a %= mod; for (; b; b >>= 1){ if (b & 1)res = res*a%mod; a = a*a%mod; }return res;
}

string s;
int n;

int main()
{
	c_false;
	cin >> s;
	rep(i, 0, 4) cout << s[i];
	cout << " ";
	rep(i, 4, 12) cout << s[i];
	cout << endl;

	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,T;

signed main(){
    cin>>N>>T;
    int a=0,b=0;
    rep(i,N){
        int x;cin>>x;
        b+=min(a,x);
        chmax(a,x);

        int lb=0,ub=1001001001;
        while(ub-lb>1){
            int mid=(ub+lb)/2;
            if(a*mid+b>T)ub=mid;
            else lb=mid;
        }
        cout<<ub<<endl;
    }

    return 0;
}

Measured memory_bytes: 3088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s1 = scanner.next(),s2 = scanner.next(),s3 = scanner.next();
		String str = String.valueOf(s1.charAt(0)) + String.valueOf(s2.charAt(0)) + String.valueOf(s3.charAt(0));
		System.out.println(str.toUpperCase());
	}

}


Measured memory_bytes: 20820
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007

int N;
int A[200005];
vector<int> buka[200005];
signed main(){
    scanf("%lld",&N);
    rep(i,N){
        scanf("%lld",&A[i]);A[i]--;
        buka[A[i]].pb(i+1);
    }
    rep(i,N){
        printf("%lld\n",buka[i].size());
    }
    return 0;
}


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

int main() {
  char c;
  cin >> c;
  if(c=='a' ||c=='i'||c=='u'||c=='e'||c=='o'){
    cout << "vowel"<< endl;
  }
  else{
    cout << "consonant"<< endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;
int a,b;

int main()
{
    cin>>a>>b;
    cout<<(a+(b-a)*2)<<endl;
    return 0;
}



Measured memory_bytes: 256