akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include <random>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

vi to[MX];
int ans;

int dfs(int v, int p=-1) {
  int a = 0, b = 0;
  rep(i,sz(to[v])) {
    int u = to[v][i];
    if (u == p) continue;
    int r = dfs(u,v);
    b |= a&r;
    a |= r;
  }
  while (pcnt(b) > 1) b += b&-b;
  if (b) a |= b-1;
  ++a;
  return a;
}

int main() {
  int n;
  scanf("%d",&n);
  rep(i,n-1) {
    int a,b;
    scanf("%d%d",&a,&b);
    --a; --b;
    to[a].pb(b);
    to[b].pb(a);
  }
  int x = dfs(0);
  int ans = -1;
  while (x) ++ans, x >>= 1;
  cout<<ans<<endl;
  return 0;
}































Measured memory_bytes: 10240
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {
    
    int a,b;
  cin >> a;
  cin >> b;
  int c,d,e;
  c = a + b;
  d = a - b;
  e = a * b;
  if (c >= d && c >= e)
  {
    cout << c;
  } 
  else if (d >= c && d >= e)
  {
    cout << d;
    
  }
  else if (e >= c && e >= d)
  {
    cout << e;
  }
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;   //author: madmin2619/mintu_agarwal
     
#define nfs() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define pf push_front
#define forin(i, n) for(int i=0;i<n;i++)
#define tr(c, it) for(auto it=c.begin();it!=c.end();it++)
#define sz(c) c.size()
#define all(c) c.begin(),c.end()
#define ff first
#define ss second
#define m_p(x, y) make_pair(x, y)
     
const int M = 1e9 + 7;
     
int32_t main(){
    nfs()
    int t, n, i, j, k;
    cin >> n >> k;
    vector<int> h(n);
    forin(i, n)	cin >> h[i];
    vector<int> dp(n, M);
    dp[0]=0;
    for(i=1;i<n;i++){
    	for(j=1;j<=k;j++){
    		if((i-j)<0)
    			break;
    		else
    			dp[i]=min(dp[i], dp[i-j]+abs(h[i]-h[i-j]));
    	}
    }
    cout << dp[n-1] << "\n";
    return 0;
}

Measured memory_bytes: 1792
// ABC141_C
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, K, Q;
    cin >>N >>K >> Q;

    vector<int> vec(Q),point(N);
    for(int i = 0; i < Q; i++){
        cin >> vec.at(i);
    }
    for(int i = 0; i < N; i++){
        point.at(i) = K;
    }

        for(int i = 0; i < N; i++){

            point.at(i)=point.at(i)-Q;


        }
    for(int i = 0; i < Q; i++){
        point.at(vec.at(i)-1)++;

    }

    for(int i = 0; i<N ; i++){
   
        if(point.at(i) <= 0){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }

}


Measured memory_bytes: 1408
A, B, M = map(int, input().split())
price_A = list(map(int, input().split()))
price_B = list(map(int, input().split()))

ans = min(price_A) + min(price_B)

for _ in range(M):
    x, y, c = map(int, input().split())
    tmp = price_A[x-1] + price_B[y-1] - c
    if ans > tmp:
        ans = tmp
        
print(ans)

Measured memory_bytes: 18612
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

const [h, a] = input[0].split(' ').map((x: string): number => +x);

if(h % a === 0){
	console.log(Math.floor(h/a));
}else{
	console.log(Math.floor(h/a) + 1);
}


Measured memory_bytes: 7372
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <queue>
using namespace std;
#define ll long long
set<pair<ll, ll> > ans[100000 + 1];
map<pair<ll, ll>, ll> stamp;
ll x[100000 + 1];
ll p[100000 + 1];

bool bfs (ll t) {

  // 初期化
  x[t] = 0;    
  p[t] = 1;
  queue<ll> box;
  box.push(t);
  bool fortrue = false;
  while (!box.empty()) {
    ll top = box.front();
    box.pop();
    for (auto i = ans[top].begin(); i != ans[top].end(); ++i) {
      ll R = i->first;
      if (stamp[make_pair(top, R)] == 1) continue;
      stamp[make_pair(top, R)] = 1;
      stamp[make_pair(R, top)] = 1;
      ll D = i->second;
      if (p[R] == 1) {
        if (x[R] == D + x[top]) {
          // ok  
        }  
        else {
          fortrue = true;
          break;    
        }
      }  
      else {
        p[R] = 1;
        x[R] = D + x[top];  
        box.push(R);
      }
    }    
    if (fortrue) {
      break;  
    }
  }
  return fortrue;
}

int main () {
  ll n, m;
  cin >> n >> m;
  ll L[m], R[m], D[m];
  for (ll i = 0; i <= n; i++) {
    p[i] = 0;
  }
  for (ll i = 0; i < m; i++) {
    cin >> L[i] >> R[i] >> D[i];
    ans[L[i]].insert(make_pair(R[i], D[i]));
    ans[R[i]].insert(make_pair(L[i], -1 * D[i]));
  }
  for (ll i = 0; i < m; i++) {
    if (stamp[make_pair(L[i], R[i])] != 1) {
      if (bfs(L[i])) {
        cout << "No" << endl;
        return 0;  
      }  
    }      
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 61184
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define int long long

signed main(){
    int N,A,B,H=-1; 
    cin>>N>>A>>B;
    vector<int > h(N);
    rep(i,N){
        cin>>h[i];
        H = max(H,h[i]);
    }

    int left = 0,right = H/B + 1;
    int ans = right;

    while(left <= right){
        int T = (left + right) / 2;
        int cnt = 0;
        rep(i,N){
            if(h[i] > B*T){
                cnt += (h[i] - B*T + (A-B-1)) / (A-B);
            }
        }
        if(cnt <= T){
            ans = T;
            right = T - 1; 
        }
        else left = T + 1;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


def solve(n, s):
    c0 = sum(1 for si in s if si == 'AC')
    c1 = sum(1 for si in s if si == 'WA')
    c2 = sum(1 for si in s if si == 'TLE')
    c3 = sum(1 for si in s if si == 'RE')
    ws("AC x {0}".format(c0))
    ws("WA x {0}".format(c1))
    ws("TLE x {0}".format(c2))
    ws("RE x {0}".format(c3))


def main():
    n = ri()
    s = []
    for i in range(n):
        s.append(rs())
    solve(n, s)


if __name__ == '__main__':
    main()


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  const int sqrtN = 512;

  int n, m;
  cin >> n >> m;

  struct edge {
    int to, cost;
    edge(){}
    edge(int to, int cost):to(to), cost(cost){}
  };
  vector<vector<edge> > graph(n);
  rep(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    graph[a].emplace_back(b, c);
    graph[b].emplace_back(a, c);
  }

  auto dijkstra = [&](int s){
    vint res(n, inf);
    res[s] = 0;
    priority_queue<Pi, vector<Pi>, greater<Pi> > que;
    que.emplace(res[s], s);
    while(!que.empty()) {
      Pi p = que.top(); que.pop();
      int v = p.second;
      if(res[v] < p.first) continue;
      for(edge& e : graph[v]) {
	if(e.cost+res[v] < res[e.to]) {
	  res[e.to] = e.cost+res[v];
	  que.emplace(res[e.to], e.to);
	}
      }
    }
    return res;
  };

  auto ds = dijkstra(0);
  auto dg = dijkstra(n-1);

  vint press_ds;
  rep(i, n) press_ds.push_back(ds[i]);

  int q;
  cin >> q;
  vector<Pi> qs;
  rep(i, q) {
    int f, g;
    cin >> f >> g;
    qs.emplace_back(f, g);
    press_ds.push_back(f);
  }

  sort(all(press_ds));
  press_ds.erase(unique(all(press_ds)), press_ds.end());

  int bucket_sz = ((int)press_ds.size()+sqrtN-1)/sqrtN;
  vector<vector<int> > bucket_dat(bucket_sz);
  vector<vector<int> > dat(press_ds.size());
  rep(i, n) {
    int p = lower_bound(all(press_ds), ds[i])-press_ds.begin();
    bucket_dat[p/sqrtN].push_back(dg[i]);
    dat[p].push_back(dg[i]);
  }

  rep(i, bucket_sz) sort(all(bucket_dat[i]));
  rep(i, dat.size()) sort(all(dat[i]));

  auto ask = [&](int a, int b, int x) {
    int res = 0;
    rep(i, bucket_sz) {
      int l = i*sqrtN, r = (i+1)*sqrtN;
      if(r <= a || b <= l) continue;
      if(a <= l && r <= b) {
	res += bucket_dat[i].end() - lower_bound(all(bucket_dat[i]), x);
      } else {
	reps(j, max(a, l), min(b, r)) {
	  res += dat[j].end() - lower_bound(all(dat[j]), x);
	}
      }
    }
    return res;
  };

  for(Pi p : qs) {
    int l = 0, r = upper_bound(all(press_ds), p.first)-press_ds.begin();
    cout << ask(l, r, p.second) << endl;
  }

  return 0;
}



Measured memory_bytes: 22552
def judge(a, b, c):
	if a*a + b*b == c*c: return 'YES'
	else: return 'NO'
N = int(raw_input())
for i in range(0, N):
	side = map(int, raw_input().split())
	side.sort()
	print judge(side[0], side[1], side[2])


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

int main(){
    int a,b,c; cin >> a >> b >> c;
    int ans;
    if ( a == b ) ans = c;
    else if ( a == c ) ans = b;
    else ans = a;

    cout << ans << endl;
}

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

int main() { 
    int N, Q; cin >> N >> Q;
    string S; cin >> S;
    auto cter = vector<int>(N, 0);
    int ct = 0;
    for (int i=1; i<N; i++) {
        if (S[i-1] == 'A' && S[i]=='C') ct++;
        cter[i] = ct;
    }

    for (int i=0; i<Q; i++) {
        int l, r; cin >> l >> r;
        l--; r--;
        cout << cter[r] - cter[l] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1408
import bisect

n=int(input())
L=sorted(list(map(int,input().split())))

ans=0
for i in range(n-1):
      for j in range(i+1,n):
            idx=bisect.bisect_left(L,L[j]+L[i])
            ans+=max(0,idx-j-1)

print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);
ll mod_pow(ll x,ll n,ll mod){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    vector<ll> A(N);
    ll sum=0;
    rep(i,N){
        cin>>A[i];
        sum+=A[i]%MOD;
        sum%=MOD;
    }
    
    vector<ll> one(61,0);
    rep(i,N){
        rep(j,61){
            if((A[i]&pw2[j])==pw2[j]) one[j]++;
        }
    }
    
    ll tmp=0;
    rep(i,61){
        ll x=one[i];
        tmp+=(((x*(x-1)/2)%MOD)*mod_pow(2,i,MOD))%MOD;
        tmp%=MOD;
    }
    
    ll ans=(sum*(N-1))%MOD;
    ans-=tmp*2;
    if(ans<0) ans+=MOD;
    if(ans<0) ans+=MOD;
    
    cout<<ans<<endl;
}



Measured memory_bytes: 5644
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int H = int.Parse(str[0]);
        int W = int.Parse(str[1]);
        bool[,] b = new bool[H,W];
        for(int i=0;i<H;i++){
            str = Console.ReadLine().Split(' ');
            for(int j=0;j<W;j++){
                b[i,j] = str[j] == "1";
            }
        }
        int[,] U = new int[H,W];
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(b[i,j]){
                    U[i,j] = 0;
                }
                else{
                    U[i,j] = i == 0 ? 1 : U[i-1,j] + 1;
                }
            }
        }
        int max = 0;
        for(int i=0;i<H;i++){
            int[] stack = new int[W+1];
            int[] point = new int[W+1];
            int p = 1;
            for(int j=0;j<W;j++){
                int h = U[i,j];
                while(p > 1 && stack[p-1] >= h){
                    max = Math.Max(max,(j-point[p-2])*(stack[p-1]));
                    p--;
                }
                stack[p] = h;
                point[p] = j+1;
                p++;
            }
            {
                for(int j=1;j<p;j++){
                    max = Math.Max(max,(point[p-1]-point[j-1])*(stack[j]));
                }
            }
        }
        sb.Append(max+"\n");
    }
}

Measured memory_bytes: 25196
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t K;
  cin >> K;
  vector<int64_t> vec(K);
  for(int i=0; i<K; i++){
    cin >> vec.at(i);
  }
  int64_t dp[K+1][2]; 
  for(int i=0; i<K; i++){
    for(int j=0; j<2; j++){
      dp[i][j] = 0;
    }
  }
  dp[K][0] = 2;
  dp[K][1] = 2;
  bool flag = true;
  
  for(int i=K-1; i>=0; i--){
    int64_t down = ((dp[i+1][0]-1) / vec.at(i)) * vec.at(i) + vec.at(i);
    int64_t up = (dp[i+1][1] / vec.at(i)) * vec.at(i);
    if(down > dp[i+1][1]){
      flag = false;
    }
    dp[i][0] = down;
    dp[i][1] = up + vec.at(i)-1;
  }

  if(flag){
    cout << dp[0][0] << " " << dp[0][1] << endl;
  }
  else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main()
{
    char a[200][200];
    bool x[200];
    bool y[200];
    int h, w;
    cin >> h >> w;
    char ch = fgetc(stdin);
    int p = 0;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            a[i][j] = fgetc(stdin);
            if (a[i][j] == '#')
                p = 1;
        }
        if (p == 0) {
            x[i] = 0;
        }
        else
            x[i] = 1;
        p = 0;
        ch = fgetc(stdin);
    }
    p = 0;
    for  (int j = 1; j <= w; j++) {
        for (int i = 1; i <= h; i++) {
            if (a[i][j] == '#')
                p = 1;
        }
        if (p == 0)
            y[j] = 0;
        else
            y[j] = 1;
        p = 0;
    }
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            if (x[i] == 1 && y[j] == 1)
                fputc(a[i][j], stdout);
        }
        if (x[i] == 1)
            cout << "\n";
    }
    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

string solve(int a, int b) {
	int res = a;
	while (--b) {
		res = res * 10 + a;
	}
	return to_string(res);
}

int main() {
	int a, b;
	cin >> a >> b;

	string res1 = solve(a, b);
	string res2 = solve(b, a);

	if (res1 > res2) {
		cout << res2 << endl;
	}
	else {
		cout << res1 << endl;
	}
}

Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

H,W = I()
S = []
for i in range(H):
    s1 = list(s())
    if '#' in s1:
        S.append(s1)
L = [1]*W
for i in range(len(S)):
    if 1 not in L:
        break
    for j in range(W):
        if S[i][j] == '#':
            L[j] = 0
for i in range(W-1,-1,-1):
    if L[i] == 1:
        for j in range(len(S)):
            S[j].pop(i)
for i in range(len(S)):
    print(''.join(S[i]))

Measured memory_bytes: 9828
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

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

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

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

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	_ = readInt()
	A := readInt()
	B := readInt()
	if (B-A)%2 == 0 {
		println("Alice")
	} else {
		println("Borys")
	}

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<double, double> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<P> x(n);
    vector<int> a(n);
    double all = 1.0;
    for (int i = 1; i <= n; ++i) all *= i;
    rep(i,n) a[i] = i;
    rep(i,n) cin>>x[i].first>>x[i].second;

    sort(x.begin(), x.end());
    double sum = 0.0;
    do {
        double te = 0.0;
        rep(i,n-1) {
            double X = (x[i].first-x[i+1].first);
            double Y = (x[i].second-x[i+1].second);
            X*=X; Y*=Y;
            te += sqrt(X+Y);
        }
        sum += te;
    } while (next_permutation(x.begin(), x.end()));
    
    cout<<fixed<<setprecision(10);
    cout<<sum/all<<endl;
    return 0;
}

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

int main(){
  
  int N;
  int d[100] = {0};
  set<int> values;

  cin >> N;
  for(int i = 0; i<N; i++)
    cin >> d[i];
  
  for(int i = 0; i < N; i++)
    values.insert(d[i]);


  cout << values.size() << endl;

  return 0;
}


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

int n,ans;
vector<int> e(101);

int num(int m){
    int cnt = 0;
    for(int i = 2;i < n+1;i ++){
        if(e[i]>=m-1) cnt++;
    }
    return cnt;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 2;i < n+1;i ++){
        int cur = i;
        for(int j = 2;j < i+1;j ++){
            while(cur%j==0){
                e[j] ++;
                cur /= j;
            }
        }
    }
    ans = num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) / 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
using namespace std;
const long long int mod=1000000009;
const long long int INF=1000000000;
const long long int MAX=1000000000;
int main()
{
	long long int n,a,b;
	vector<long long int> h;
	cin>>n>>a>>b;
	a-=b;
	h.resize(n);
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
 
	long long int up=MAX,low=0;
	long long int mid=0;
 
	while(up-low>1)
	{
		mid=(up+low)/2;
		long long int t=0;
		for(int i=0;i<n;i++)
		{
			t+=max(0,(int)(ceil((float)(h[i]-mid*b)/(float)a)));
		}
        if(t<=mid)
		{
			up=mid;
		}else
		{
			low=mid;
		}
	}
	cout<<up<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#define N 100000

typedef struct{
  int time;
  char name[10];
}Process;

int q;

int main(){
  Process P[N], p;
  int num, i, total = 0;
  int head = 0, tail;
  
  scanf("%d%d", &num, &q);
  
  for(i = 0; i < num; i++){
    scanf("%s %d", P[i].name, &P[i].time);
  }
  tail = i;
  
  while(head != tail){
    
    p = P[head];
    head++;
    if(head == num+1){
      head = 0;
    }
    
    if(p.time - q <= 0){
      total += p.time;
      printf("%s %d\n", p.name, total);
    }
    else{
      total += q;
      p.time -= q;

      P[tail] = p;
      tail++;
      if(tail == num+1){
	tail = 0;
      }
    }
  }
  
  return 0;
}




Measured memory_bytes: 2504
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         1000000000000000000
#define M           1000000000000000007
using namespace std;
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}

int dp[1005][1005] = {0};

signed main()
{
    tezz

    int h,w;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++) cin>>s[i];

    for(int i=0;i<h;i++) if(s[i][0] == '#') break; else dp[i][0] = 1;
    for(int i=0;i<w;i++) if(s[0][i] == '#') break; else dp[0][i] = 1;

    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(s[i][j] == '.') dp[i][j] = (dp[i-1][j] + dp[i][j-1])%1000000007;
        }
    }

    cout<<dp[h-1][w-1]%1000000007;
}

Measured memory_bytes: 9216
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define REP(i,n) for(i=0;i<n;i++)
#define REVREP(i,n) for(i=n-1;i>=0;i--)

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

void check(char *S, int *C) {
    int i, j;
    REVREP(i,strlen(S)) {
        j = i + 1;
        if (j > strlen(S)) continue;
//        cout(S[i]);
        if (S[i] != 'A') {
            C[i] += C[j];
        } else {
            if (S[j] != 'C') {
                C[i] += C[j];
            } else {
                C[i] += (C[j] + 1);
            }
        }
    }
}

int main() {
    int N = iin(), Q = iin();
    char S[N];
    int C[N];
    int i;
    stin(S);
    memset(C, 0, sizeof C);
//    stout(S);
    check(S, C);
//    REP(i,N) { iout(C[i]); }
    REP(i,Q) {
        int l = iin(), r = iin();
        iout(C[l - 1] - C[r - 1]);
    }
    return 0;
}


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

int main() {
	int N;
	string S;
	cin >> N >> S;
	vector<int> LeftBlack(N + 1,0);
	int white = 0;
	for (int i = 1; i <= N; i++) {
		if (S[i-1]=='#') LeftBlack[i] = LeftBlack[i - 1] + 1;
		else {
			LeftBlack[i] = LeftBlack[i - 1];
			white++;
		}
	}
	int MIN = N;
	for (int i = 0; i <= N; i++) MIN = min(MIN, LeftBlack[i] + white - (i - LeftBlack[i]));
	cout << MIN << endl;
}

Measured memory_bytes: 1412
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <functional>
#include <stack>
#include <set>

using namespace std;

#define ll long long

int v[25] = {};
int c[25] = {};

int main() {
	int n;
	int ans = 0;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}

	for (int i = 0; i < n; i++)
	{
		cin >> c[i];
	}

	for (int i = 0; i < n; i++)
	{
		if (v[i] - c[i] > 0) {
			ans += v[i] - c[i];
		}
	}

	cout << ans << endl;
	

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, ll> P;
#define mp(x, y) make_pair(x, y)

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define repm(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

int main() {
	int L, R, d; cin >> L >> R >> d;
	int ans = 0;

	for (int i = L; i <= R; i++) {
		if (i % d == 0) ans++;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    ll a[n];
    ll flag=0;
    for(int i=0;i<n;i++) cin>>a[i];
    ll sum=0;
    for(int i=0;i<n;i++) sum+=a[i];
    for(int i=0;i<n;i++)
    {
        if(a[i]>=sum/(4.0*m))
            flag++;

    }
    if(flag>=m)
        cout<<"Yes"<<"\n";
    else cout<<"No"<<"\n";



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
ll n;
set<ll> factors;
bool check(ll n, ll k) {
  if (n < 1 || n < k)
    return false;
  else if (n == 1)
    return true;
  else {
    while (n % k == 0) {
      n /= k;
    }
    return (n % k == 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n;
  ll ans = 0;
  for (ll i = 1; i * i <= n; i++)
    if (n % i == 0)
      factors.insert(i), factors.insert(n / i);
  for (ll i = 1; i * i <= n - 1; i++)
    if ((n - 1) % i == 0)
      factors.insert(i), factors.insert((n - 1) / i);
  for (ll i : factors) {
    if (i != 1 && check(n, i)) {
      ans++;
      // cout << i << endl;
    }
  }
  cout << ans << endl;
}

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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

int main(){
  int n, m;
  cin >> n;
  string reg[n];
  REP(i, n) cin >> reg[i];
  cin >> m;
  string user;
  bool locked = true;
  REP(i, m) {
    cin >> user;
    bool find = false;
    REP(j, n) if(user == reg[j]) { find = true; locked = !locked; break; }
    if(find)
      cout << (locked ? "Closed" : "Opened") << " by " << user << endl;
    else cout << "Unknown " << user << endl;
  }
  return 0;
}

Measured memory_bytes: 3228
#include<stdio.h>

int main(){
  int col[9][9],row[9][9],sq[9][9],n,i,pz[9][9],j,k;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<9;j++){
      col[j][0]=row[j][0]=sq[j][0]=0;
      scanf("%d",&(pz[j][0]));
      for(k=1;k<9;k++){
	col[j][k]=row[j][k]=sq[j][k]=0;
	scanf(" %d",&(pz[j][k]));
      }
    }
    for(j=0;j<9;j++){
      for(k=0;k<9;k++){
	col[j][pz[j][k]-1]++;
	row[j][pz[k][j]-1]++;
	sq[j][pz[(j/3)*3+k/3][(j%3)*3+k%3]-1]++;
      }
    }
    for(j=0;j<9;j++){
      for(k=0;k<9;k++)
	printf("%c%d",(col[j][pz[j][k]-1]!=1
	       ||row[k][pz[j][k]-1]!=1
	       ||sq[(j/3)*3+k/3][pz[j][k]-1]!=1)
	  ?'*':' ',pz[j][k]);
      printf("\n");
    }
    if(i+1!=n) printf("\n");
  }
  return 0;
}

Measured memory_bytes: 0
n, m, c = map(int, input().split())
Bs = list(map(int, input().split()))
As = [map(int, input().split()) for i in range(n)]

ans = 0
for i in range(n):
    Am = list(As[i])
    s = c
    for j in range(m):
        s += Am[j]*Bs[j]
    if s > 0:
        ans += 1
        
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;



int main(){
    string s;
    cin >> s;
    int w;
    cin >> w;
    int n=0;
    string t="";
    while(n<s.length()){
        t.pb(s[n]);
        n+=w;
    }
    cout << t << endl;
    return 0;
}


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

using namespace std;

int main(){
    string s, t;
    cin>>s;
    cin>>t;
    int arr[s.length()+1][t.length()+1];
    int dir[s.length()+1][t.length()+1];
    memset(arr, 0 ,sizeof(arr));
    memset(dir, 0 ,sizeof(dir));
    for(int i =0;i<= s.length();i++){
        for(int j= 0;j<= t.length();j++){
            if(i == 0 || j == 0)continue;
            if(s[i-1] == t[j-1]){
                arr[i][j] =  arr[i-1][j-1] +1;
                dir[i][j] = 1;
                continue;
            }
            if(arr[i-1][j] > arr[i][j-1]){
                arr[i][j] = arr[i-1][j];
                dir[i][j]= -1;
                continue;
            }
            else{
                arr[i][j] = arr[i][j-1];
                dir[i][j] = 0;
                continue;
            }
        }
    }
    int i = s.length(), j = t.length();
    string a = "";
    while(i>0 && j>0){
        // cout<<"HERE"<<endl;
        if(dir[i][j] == 1){
            a = a+s[i-1];
            i--;
            j--;
            continue;
        }
        if(dir[i][j] == 0){
            j--;
            continue;
        }
        if(dir[i][j] == -1){
            i--;
            continue;
        }
    }
    i = a.length()-1;
    while(i>=0){
        cout<<a[i];
        i--;
    }
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
using Graph = vector<vector<int>>;
Graph G;

ll dp[50][2];
int main(){
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll count;
    rep(i, 50)rep(j, 2) dp[i][j] = -1;
    dp[45][0] = 0;

    for(int i = 44; i >= 0; i--){
        count = 0;
        rep(j, n){
            if((a[j] >> i) % 2) count++;
        }

        if(dp[i + 1][1] >= 0){
            dp[i][1] = max(dp[i][1], dp[i + 1][1] + (1LL << i) * max(count, n - count));
        }
        if(dp[i + 1][0] >= 0){
            if(k & (1LL << i)){
                dp[i][1] = max(dp[i][1], dp[i + 1][0] + (1LL << i) * count);
                dp[i][0] = max(dp[i][0], dp[i + 1][0] + (1LL << i) * (n - count));
            }else{
                dp[i][0] = max(dp[i][0], dp[i + 1][0] + (1LL << i) * count);
            }
        }    
    }
    cout << max(dp[0][0], dp[0][1]) << endl;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  ll n, d;
  cin>>n>>d;
  ll ans = 0;
  while(n--)
  {
    ll x, y;
    cin>>x>>y;
    if (x*x + y*y <= d*d)
      ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3628
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A_1 = sc.nextInt();
      int A_2 = sc.nextInt();
      int A_3 = sc.nextInt();
      int[] S = new int[]{A_1,A_2,A_3};
      Arrays.sort(S);
      
      System.out.println(S[2]-S[0]);
    }
}

Measured memory_bytes: 35752
#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;

typedef pair <int,int> pii;
typedef vector <pii> vpii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef long long int lli;
typedef vector <lli> vlli;
typedef vector <vlli> vvlli;
typedef vector <string> vs;
typedef vector <bool> vb;

#define rep(i, n) for( i = 0; i < (n); ++i)
#define repA(i, a, n) for( i = a; i <= (n); ++i)
#define repD(i, a, n) for( i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sortr(x) sort(x.begin(),x.end(),greater <int> ())
#define mod 1000000007
#define ff first
#define ss second
#define fill(a,c)  memset(a, c, sizeof (a))
#define formap(i,v) for(auto &i: v)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; formap(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it<<endl;} cerr<<endl
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; formap(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it.first<<" , "<<it.second<<endl;} cerr<<endl
#define PI  3.14159265358979323846
#define pb push_back



int main() {
    cin.sync_with_stdio(0);cin.tie(0);
    cin.exceptions(cin.failbit);
    
    
    int i,j,k,n,cnt=0;
    cin>>n;
    vi a(n);
    rep(i,n){
        cin>>a[i];
        if (a[i]%2 && i%2==0)cnt++;
    }
    cout<<cnt<<endl;
    
    
    
    
    
    
    
    
    
    
     
   
   
	return 0;
}


Measured memory_bytes: 3648
#include "stdio.h"
#include "math.h"
int main(int argc, char const *argv[])
{
	double x1,x2,y1,y2,ans;
	scanf("%lf",&x1); scanf("%lf",&x2); scanf("%lf",&y1); scanf("%lf",&y2);
	ans =   sqrt(pow(x1-y1,2) + pow(x2-y2,2) ) ;
	printf("%lf\n",ans);
	return 0;
}


Measured memory_bytes: 652
#include <bits/stdc++.h>
#define ll long long
#define ii pair <int, int>
#define dl pair <ll, ll>
#define vi vector <int>
#define vl vector <ll>
#define vii vector <ii>
#define graph vector <vi>
#define REP(a, b) for (int i = a; i < b; i++)
#define REP2(a, b) for (int j = a; j < b; j++)
#define REPS(a, b, c) for (int i = a; i < b; i += c)
#define tam 1000001

using namespace std;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a * c, max(a * d, max(b * c, b * d))) << "\n";
    return 0;
}


Measured memory_bytes: 3688
from sys import exit, setrecursionlimit, stderr, stdin
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect
import functools

def input():
  return stdin.readline().strip()

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

S = input()
k = len(S)
maxwin = sum(c == 'o' for c in S) + (15 - k)
print("YES" if maxwin >= 8 else "NO")

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

int main() {
    int N,K;
    cin >> N >> K;
    double p = 0;
    for(int i = 1; i <= N; i++){
        int sum = i;
        int tmp = 0;
        while(sum < K){
            sum *= 2;
            tmp++;
        }
        p += pow(0.5f,tmp) / N;
    }
    cout << fixed;
    cout << setprecision(10)<< p << endl;
}

Measured memory_bytes: 384
def myAnswer(a:int,b:int) -> str:
   if(a <= 0 and b >= 0): return "Zero"
   if(a < 0):
      if(b < 0):
         return "Negative" if((abs(a-b) + 1)%2==1) else "Positive"
      else:
         return "Negative" if(abs(a)%2==1) else "Positive"
   else:
      return "Positive"


def modelAnswer():
   tmp=1
def main():
   a,b = map(int,input().split())
   print(myAnswer(a,b))

if __name__ == '__main__':
   main()

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

using namespace std;

int main()
{
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    int best = -1;
    for (int i = 0; i <= 2 * max(X, Y); i += 2) {
        int a = X, b = Y;
        a -= i / 2;
        b -= i / 2;

        a = max(a, 0);
        b = max(b, 0);

        int now  = i * C + a * A + b * B;

        if (best == -1 || now < best) {
            best = now;
        }
    }

    assert (best != -1);
    cout << best << "\n";
    return 0;
}


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

int main() {
    int a,b;
    cin >> a >> b;
    int ans = -a;
    rep2(i,1,b-a) ans += i;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
 
using namespace std;
 
int h,w,sx,sy,gx,gy,tx,ty;
char house[505][505];   
bool isvisited[505][505]={false};
 
void search(int x,int y){
    if(isvisited[x][y]){
        return;
    }
    isvisited[x][y]=true;
 
    if(x<=0 || x>h || y<=0 || y>w){
        return;
    }
 
    if(house[x][y]=='#'){
        return;
    }
 
    search(x-1,y-1);
    search(x-1,y);
    search(x-1,y+1);
    search(x,y-1);
    search(x,y);
    search(x,y+1);
    search(x+1,y-1);
    search(x+1,y);
    search(x+1,y+1);
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  string s,t,u;
  int a,b;
  cin>>s>>t>>a>>b>>u;
  if(s==u){
    a--;
  }
  else{
    b--;
  }
  cout<<a<<" "<<b<<'\n';
  return 0;
}


Measured memory_bytes: 256
N = int(input())
D = list(map(int,input().split()))
import collections as col
E = col.Counter(D)
def tree(L):
    t = 1
    if L[0] != 1:
        return 0
    else:
        for i in range(1,len(L)):
            t = t * (L[i-1]**L[i])
            t = t % 998244353
        return t
def number(D,E):
    if D[0] == 0:
        return tree(E)
    else:
        return 0
print(number(D,E))

Measured memory_bytes: 18932
#include <iostream>
#include <algorithm>

using namespace std;

void solve() {
    int n;
    cin >> n;
    int si, min_drop=105, ans=0;
    for (int i=0; i < n; ++i) {
        cin >> si;
        ans += si;
        if ((si % 10 != 0) && (si < min_drop))
            min_drop = si;
    }
    if (ans % 10 == 0) {
        if (min_drop < 100)
            ans -= min_drop;
        else
            ans = 0;
    }
    cout << ans;
}

int main() {

	solve();
    return 0;
}


Measured memory_bytes: 3144
'''a = [1, 6, 9, 6**2, ....]

dp[i+1][n]: i番目までのaから総和をｎにする組み合わせのうち、
　　　　　　選ぶ整数の数の最小値 (個数制限なし)
0 <= i <= len(a)
0 <= n <= N
'''

maxN = int(1e5)
N = int(input())
a = [1]
for i in range(1,100):
    if 6**i <= N: a.append(6**i)
    if 9**i <= N: a.append(9**i)
    if 6**i>N and 9**i>N: break
        
 
dp = [[0] + [maxN*10]*N] # initial state :dp[0][n]

for i in range(len(a)):
    dp.append([0]*(N+1)) # create dp[i+1]
    for n in range(N+1):
        if a[i] <= n:
            dp[i+1][n] = min(dp[i][n], dp[i+1][n-a[i]] +1)
        else:
            dp[i+1][n] = dp[i][n]
            
print(dp[len(a)][N])

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;
    int n = s.length();

    cout << ((n + (s[0] == s[n-1])) % 2 ? "First" : "Second") << "\n";

    return 0;
}


Measured memory_bytes: 3780