akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string.h>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <sstream>
#include <stack>
#include <iomanip>
#include <climits>
#include <complex>
#include <cmath>
#define fi first
#define se second
#define th second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, int> di;
typedef vector<int> vi;
typedef multiset<ll, greater<ll>>::iterator iit;
typedef pair<iit, iit> pvi;
typedef complex<double> cd;

const int maxN = 1e3 + 3, MOD = 1e9 + 9, LG = 21;
//NOTE: maxN>2^LG must be held, remember maxN is twice ur biggest polynom
/*
 HAB
 G C
 FED*/

ll a, b, c, x, y;

ll opt(ll A, ll B){
    if(B > A) return B * c;
    return min(B * c + (A - B) * a, A * c);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    
    cin >> a >> b >> c >> x >> y;
    c <<= 1;
    ll ans = LLONG_MAX;
    for(ll i = 0; i <= y; i++){
        ans = min(ans, i * b + opt(x, y - i));
    }
    cout << ans << '\n';
    
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=998244353;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<llint>kati[4];
	llint n,W,ans=0,z,x,c,v,i,j,ki,w,VV;
	cin>>n>>W;
	for(i=0;i<n;i++){
		cin>>w>>VV;
		if(i==0){ki=w;}
		kati[w-ki].pub(VV);
	}
	for(i=0;i<4;i++){
		SO(kati[i]);REV(kati[i]);
		for(j=1;j<kati[i].size();j++){kati[i][j]+=kati[i][j-1];}
		kati[i].ins(kati[i].begin(),0);
	}
	for(z=0;z<kati[0].size();z++){
		for(x=0;x<kati[1].size();x++){
			for(c=0;c<kati[2].size();c++){
				for(v=0;v<kati[3].size();v++){
					llint omo=ki*(z+x+c+v)+x+c+c+v+v+v;
					if(W<omo){continue;}
					maxeq(ans,kati[0][z]+kati[1][x]+kati[2][c]+kati[3][v]);
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(m);
    int sum=0;
    for(int i=0; i<m; i++){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum<=n) cout<<n-sum<<endl;
    else cout<<-1<<endl;

}

Measured memory_bytes: 3672
#include <iostream>
#include <cmath>
 
using namespace std;
int main(){
	int n, tt, tx, ty; 
	int t = 0, x = 0, y = 0, flag = 0;
	cin >> n;
	for (int i = 0; i<n; i++){
		cin >> tt >> tx >> ty;
		if (abs(tx - x) + abs(ty - y)>(tt - t) || (abs(tx - x) + abs(ty - y)) % 2 != (tt - t) % 2)
			flag = 1;
		t = tt;
		x = tx;
		y = ty;
	}
	if (!flag)	cout << "Yes" << endl;
	else	cout << "No" << endl;
 
	return 0;
}


Measured memory_bytes: 504
import sys
input = sys.stdin.readline
N,M,L = map(int,input().split())
ABC = [tuple(map(int,input().split())) for i in range(M)]
Q = int(input())
ST = [tuple(map(int,input().split())) for i in range(Q)]

INF = float('inf')
dist1 = [[INF]*N for i in range(N)]
dist2 = [[INF]*N for i in range(N)]
for a,b,c in ABC:
    if c > L: continue
    a,b = a-1,b-1
    dist1[a][b] = dist1[b][a] = c
for i in range(N):
    dist1[i][i] = 0
    dist2[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            d = dist1[i][k] + dist1[k][j]
            if dist1[i][j] <= d: continue
            dist1[i][j] = d
for i in range(N):
    for j in range(N):
        if i==j: continue
        if dist1[i][j] <= L:
            dist2[i][j] = 1
for k in range(N):
    for i in range(N):
        for j in range(N):
            d = dist2[i][k] + dist2[k][j]
            if dist2[i][j] <= d: continue
            dist2[i][j] = d
ans = []
for s,t in ST:
    d = dist2[s-1][t-1]
    if d == INF:
        ans.append(-1)
    else:
        ans.append(d-1)
print(*ans, sep='\n')

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

ll keta(ll n) {
    ll res = 0;
    ll p = 1;
    while(n >= p) {
        p *= 10;
        res++;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];

    map<string, int> m;
    rep(i, n) {
        string e = s[i];
        m[e]++;
    }
    cout << m.size() << endl;
}


Measured memory_bytes: 25172
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  s = s + '?';
  string t = "AGCT";
  int len = 0, ans = 0;
  for (char c : s) {
    int f = 0;
    for (char cc : t) {
      f |= cc == c;
    }
    if (!f) {
      ans = max(len, ans);
      len = 0;
    } else {
      len++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val cnt = IntArray(4)
    readLine()!!.split(' ').forEach { cnt[it.toInt() - 1]++ }
    readLine()!!.split(' ').forEach { cnt[it.toInt() - 1]++ }
    readLine()!!.split(' ').forEach { cnt[it.toInt() - 1]++ }
    var even = 0
    var odd = 0
    for (c in cnt) {
        if (c % 2 == 0) {
            even++
        } else {
            odd++
        }
    }
    println(if (odd == 0 || odd == 2) "YES" else "NO")
}


Measured memory_bytes: 37920
#include <bits/stdc++.h>
    #define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define ZERO(a) memset(a,0,sizeof(a))
    #define MINUS(a) memset(a,0xff,sizeof(a))
    #define MEMSET(v, h) memset((v), h, sizeof(v))
    #define pb push_back
    #define mp make_pair
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    typedef long long ll;
    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; }
    using namespace std;
     
    int main(){
      ll n,m;
      string S,T;
      cin >> n >> m >> S >> T;
     
      ll lcm = n*m/__gcd(n,m);
      if (n>m){
        swap(n,m);
        swap(S,T);
      }
      rep(i,n){
        ll div = i*m / n;
        if((i*m)%n==0 && div<=(m-1)){
          if(S[i] != T[div]){
            cout << -1 << endl;
            return 0;
          }
        }
     
      }
      
      cout << lcm << endl;
     
     
     
      return 0;
    }

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int N, M;
int L[100000], R[100000];
int lef=0;
int righ=100001;

signed main(void) {

    cin >> N >> M;

    rep(i, M) {
        cin >> L[i] >> R[i];

        if (lef < L[i]) {
            lef = L[i];
        }
        if (righ > R[i]) {
            righ = R[i];
        }

    }
    if (righ < lef) {
        cout << 0 << endl;
    } else {
    cout << righ - lef + 1 << endl;
}
    return 0;
}


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

#define N 3
 
int p[N][N];
int temp[N][N];
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
int dfs(int, int, int, int, int);
int calc();
void swap(int *,int *);
 
int main()
{
  int i, j;
  int x, y;
  int n, count = 0;

  for(i = 0; i < N; i++)
    {
      for(j = 0; j < N; j++)
	{
	  scanf("%d",&p[i][j]);
	  if(p[i][j] == 0)
	    {
	      x = j;
	      y = i;
	    }
	}
    }
  
  while(1)
    {
      for(i = 0; i < N; i++)
	{
	for(j = 0; j < N; j++)
	  {
	  temp[i][j] = p[i][j];
	  }
	}
      
      n = dfs(x, y, -1, 0, count);
      
      if(n != -1)
	{
	  printf("%d\n", n);
	  break;
	}
      
      for(i = 0; i < N; i++)
	{
	  for(j = 0; j < N; j++)
	    {
	      p[i][j] = temp[i][j];
	    }
	}
      
      n = -1;
      
      if(count++ == 99)
	{
	  printf("%d\n", n);
	  break;
	}
    }
  
    return 0;
}


int dfs(int x, int y, int key, int dep, int lim)
{
  int i;
  int nx, ny;
  int h, ans;
  
  h = calc();
  
  if(h == 0)return dep;
  if(dep + h > lim)return -1;
  
  for(i = 0; i < 4; i++)
    {
      nx = x + dx[i];
      ny = y + dy[i];

      if(0 > nx || nx >= N || 0 > ny || ny >= N)continue;
      if(key > 0 && i == (key+2) % 4)continue;
   
      swap(&p[y][x], &p[ny][nx]);
      
      ans = dfs(nx, ny, i, dep+1, lim);
      
      if(ans != 0 && ans != -1)return ans;
      
      swap(&p[y][x], &p[ny][nx]);
    }
  
  return -1;
}

int calc()
{
  int i;
  int n, sum = 0;
  
  for(i = 0; i < 9; i++)
      {
        n = p[i/N][i%N];
	
        if(n != 0)
	  {
            n--;
            sum += abs(i/N - n/N) + abs(i%N - n%N);
	  }
    }
  
  return sum;
}

void swap(int *a, int *b)
{
  int cpy;
  
  cpy = *a;
  *a = *b;
  *b = cpy;

  return;
}



Measured memory_bytes: 2084
#include<bits/stdc++.h>
#define INF 1e9+5
using namespace std;
int main(){
	int N;
	int K;
	cin >> N >> K;
	vector<int > hei(N);
	vector<int > dp(N,INF);
	for(int i = 0; i<N; ++i){
		cin >> hei[i];
	}
	dp[0] = 0;
	for(int i = 0; i<N; ++i){
		for(int j = i+1; j<=i+K; ++j){
			if(j < N)
				dp[j] = min(dp[j],dp[i]+abs(hei[j] - hei[i]));
		}
	}
	cout << dp[N-1];
}

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

int arr[102][102];

int main ()
{
    ios_base::sync_with_stdio(false);
    int r, c, n;
    cin >> r >> c >> n;
    bool up = true;
    int row = 0, col = 0, dir = 1;
    for(int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        for(int j = 0; j < a; j++) {
            arr[row][col] = i;
            col += dir;
            //cout << row << " " << col << endl;
            if(col == c) row++, col--, dir = -1;
            if(col == -1) row++, col++, dir = 1;
        }
    }
    for(int i = 0; i < r; i++) {
        for(int j = 0; j < c; j++) {
            cout << arr[i][j] << " ";
        }
        cout << '\n';
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int seg(int l,int r,int n,int nl,int nr,vector<int>&t){
    if(r<=nl || nr<=l)return 0;
    else if(l<=nl && nr<=r)return t[n];
    else{
        int mid=(nl+nr)/2;
        return seg(l,r,n*2,nl,mid,t)+seg(l,r,n*2+1,mid,nr,t);
    }
}
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int N=1;
    for(int i=2;i<n;i*=2)N=i;
    N*=2;
    vector<vector<int>>t(26,vector<int>(N*2,0));
    for(int i=0;i<n;i++)t[s[i]-'a'][i+N]++;
    for(int i=0;i<26;i++){
        for(int j=N-1;j>0;j--)t[i][j]=t[i][j*2]+t[i][j*2+1];
    }
    int q;
    cin>>q;
    vector<int>x;
    for(int i=0;i<q;i++){
        int type,a;
        cin>>type>>a;
        if(type==1){
            char b;
            cin>>b;
            for(int j=N+a-1;j>0;j/=2){
                t[b-'a'][j]++;
                t[s[a-1]-'a'][j]--;
            }
            s[a-1]=b;
        }
        if(type==2){
            int b;
            cin>>b;
            int kind=0;
            for(int j=0;j<26;j++){
                if(seg(a-1,b,1,0,N,t[j]))kind++;
            }
            x.push_back(kind);
        }
    }
    for(int i=0;i<x.size();i++)cout<<x[i]<<endl;
    return 0;
}

Measured memory_bytes: 111620
#include<iostream>
#include "stdlib.h"
using namespace std;
#define max 100005

typedef struct pp{
	char name[100];
	int time;
}P;

P Q[max];
int head,tail,n;
void enquene(P x){
	Q[tail]=x;
	tail=(tail+1)%max;
}
P dequene(){
	P x=Q[head];
	head=(head+1)%max;
	return x;
}
int min(int x,int y){
	return x<y?x:y;
}

int main(){
	int elaps=0,c;
	int i,q;
	P u;
	cin>>n>>q;
	for(int i=0;i<n;i++){
		cin>>Q[i].name>>Q[i].time;
	}
	head=0;tail=n;
	while(head!=tail){
		u=dequene();
		c=min(q,u.time);
		u.time-=c;
		elaps+=c;
		if(u.time>0)enquene(u);
		else{
			cout<<u.name<<" "<<elaps<<endl;
		}
			
	}
	return 0;
} 


Measured memory_bytes: 13236
import java.util.Scanner;
public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int max = 0, min = 0, in;
        long sum = 0;
        int a = sc.nextInt();
        for (int i = 0; i < a; i++) {
            in = sc.nextInt();
            if (i == 0) {
                max = in;
                min = in;

            }
            if (in > max)
                max = in;
            if (in < min)
                min = in;
            sum += in;

        }
        System.out.println(min + " " + max + " " + sum);
    }
}



Measured memory_bytes: 41960
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<cmath>
#include<algorithm>
#include<map>
#define debug1 cout<<"?"<<endl;
#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
#define PIB pair<int,bool>
typedef long long ll;
using namespace std;
const int maxn=2e5+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=1e9;
const double ep=1e-10;
int main()
{
	ll k,n,i,a[maxn]={0},ans=2e9;
	scanf("%lld%lld",&k,&n);
	for(i=1;i<=n;i++)scanf("%lld",&a[i]);
	sort(a+1,a+1+n);
	for(i=2;i<=n;i++)ans=min(ans,k-(a[i]-a[i-1]));
	ans=min(ans,k-(a[1]+k-a[n]));
	printf("%lld\n",ans);
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

def main():
    N = int(input())
    A = list(map(int, input().split()))

    s = {}
    for i in range(N):
        s[A[i]-1] = i
    
    out = ""
    for j in range(N):
        out += str(s[j]+1)
        out += " "
    print(out[:-1])

if __name__ == '__main__':
    main()

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

#define ARRAY_SIZE 4
int main()
{
    char inputS[ARRAY_SIZE];

    scanf("%s", inputS);
    
    // Checks if there are routes operated by only one company
    if (strcmp(inputS, "AAA") == 0 || strcmp(inputS, "BBB") == 0)
    {
        printf("No\n");
    }
    else
    {
        printf("Yes\n");
    }
    
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>
#include <complex>

using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const ll MOD = 1000000007;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> ll mod_pow(ll a, ll n, T mod) { mod=(ll)mod; ll res=1, p=a%mod; while(n){ if(n&1) res=res*p%mod; p=p*p%mod; n>>=1; } return res; }
template<int mod>
struct ModInt {
    using ll = long long; ll x;
    ModInt() : x(0) {}
    ModInt(int y) : x(y >= 0 ? ll(y % mod) : (ll)((mod - (-y) % mod))) {}
    ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod)) {}
    ModInt &operator+=(const ModInt &rhs) { if((x += rhs.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &rhs) { if((x += mod - rhs.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &rhs) { x = x * rhs.x % mod; return *this; }
    ModInt &operator/=(const ModInt &rhs) { *this *= rhs.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(const ModInt &rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(const ModInt &rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(const ModInt &rhs) const { return ModInt(*this) /= rhs; }
    ModInt operator==(const ModInt &rhs) const { return x == rhs.x; }
    ModInt operator!=(const ModInt &rhs) const { return x != rhs.x; }
    friend ostream &operator<<(ostream &os, const ModInt &rhs) { return os << rhs.x; }
    friend istream &operator>>(istream &is, ModInt &rhs) { ll t; is >> t; rhs = ModInt<mod> (t); return (is); }
private:
    ModInt inverse() const { ll a = x, u = 1LL, v = 0LL, t, b = (ll)mod; while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); } return  ModInt(u); }
};
using mint = ModInt<MOD>;

int main() {
    vector<int> ok(30, true);
    rep(i, 28){
        int n;
        cin >> n;
        --n;
        ok[n] = false;
    }
    rep(i, 30) if(ok[i]) cout << i+1 << endl;
    return 0;
}


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

using namespace std;

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r) {
	if (l >= r) return;
	int root = pre[pos++];
	int m = distance(in.begin(), find(in.begin(), in.end(), root));
	rec(l, m);
	rec(m + 1, r);
	post.push_back(root);
}

void solve() {
	pos = 0;
	rec(0, n);
	for (int i = 0; i < n; ++i) {
		if (i) cout << " ";
		cout << post[i];
	}
	cout << endl;
}

int main() {
	cin >> n;
	int k;
	for (int i = 0; i < n; ++i) {
		cin >> k;
		pre.push_back(k);
	}
	for (int i = 0; i < n; ++i) {
		cin >> k;
		in.push_back(k);
	}
	solve();

	return 0;
}


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

int main() {
  vector<int> cook(5);
  vector<int> amari(5);
	int amari_sum=0;
  int sum=0;
  
  for(int i=0;i<5;i++){
  	cin >> cook.at(i);
  }

for(int i=0;i<5;i++){
	if(cook.at(i)%10==0){
	amari.at(i)=cook.at(i)%10;
	}
	else{
		amari.at(i)=10-cook.at(i)%10;
	}
	
}

sort(amari.begin(), amari.end());

for(int i=0;i<4;i++){
	amari_sum=amari_sum+amari.at(i);
}


 for(int i=0;i<5;i++){
 	sum=sum+cook.at(i);
 }
 sum=sum+amari_sum;
 cout << sum <<endl;


}


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

using namespace std;

void solve()
{
	int s;
	cin >> s;
	map<int, int> mp;
	int ans = 0;
	while(1)
	{
		ans++;
		if (mp[s])
		{
			cout << ans << endl;
			return;
		}
		mp[s]++;
		if (s&1) s = 3*s+1;
		else s /= 2;
	}
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

  int data[31];

  for(int i = 0; i <= 30; i++) data[i] = 0;

  for(int i = 0; i < 28; i++){
    int in;
    cin >> in;
    data[in] = 1;
  }

  for(int i = 1; i <= 30; i++){
    if(data[i] == 0) cout << i <<endl;
  }
  return 0;

}

Measured memory_bytes: 0
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int N;
int maximum;

void recursive(int index,int array[10],int tmp_sum,int manjyu_num){

	int check = tmp_sum;
	for(int i = 1; i <= 9; i++)check += i*array[i];

	if(manjyu_num+check/10 <= maximum)return;

	maximum = max(maximum,manjyu_num);

	if(tmp_sum == 10){
		recursive(1,array,0,manjyu_num+1);
		return;
	}
	if(index == 10 && tmp_sum != 10)return;

	for(int num = 0; num <= array[index]; num++){
		if(tmp_sum+index*num > 10)return;

		int next_array[10];
		for(int i = 1; i <= 9; i++)next_array[i] = array[i];
		next_array[index] -= num;
		recursive(index+1,next_array,tmp_sum+index*num,manjyu_num);
	}
}

void func(){

	maximum = 0;

	int input[10];
	for(int i = 1; i <= 9; i++)input[i] = 0;

	int tmp;
	for(int loop = 0; loop < N; loop++){
		scanf("%d",&tmp);
		input[tmp]++;
	}

	int ans = 0;

	for(int i = 1; i <= 4; i++){
		tmp = min(input[i],input[10-i]);
		ans += tmp;
		input[i] -= tmp;
		input[10-i] -= tmp;
	}

	ans += input[5]/2;
	input[5] %= 2;

	recursive(1,input,0,0);

	printf("%d\n",ans+maximum);
}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 3196
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
#include<queue>
using namespace std;
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; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    deque<char> deq;
    string s;
    cin>>s;
    rep(i,s.size()) deq.push_back(s.at(i));
    int q;
    cin>>q;
    int t1sum=0;
    rep(i,q){
        int t;
        cin>>t;
        if(t==1){
            t1sum++;
        }
        else{
            int f;
            cin>>f;
            char c;
            cin>>c;
            if(f==1){
                if(t1sum%2==0){
                    deq.push_front(c);
                }
                else{
                    deq.push_back(c);
                }
            }
            else{
                if(t1sum%2==0){
                    deq.push_back(c);
                }
                else{
                    deq.push_front(c);
                }
            }
        }
    }
    if(t1sum%2==0){
        while(!deq.empty()){
            cout<<deq.front();
            deq.pop_front();
        }
        cout<<endl;
    }
    else{
        while(!deq.empty()){
            cout<<deq.back();
            deq.pop_back();
        }
        cout<<endl;
    }
}


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1'000'000'000'000'000'000ll + 7;

const double eps = 1e-8;

const i64 MAXN = 2 * 100'000 + 6;
i64 n, m;

i64 c[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;
    for (i64 i = 2; i <= n; i++) {
        i64 t;
        cin >> t;
        c[t] += 1;
    }

    stringstream ss;
    for (i64 i = 1; i <= n; i++) {
        ss << c[i] << endl;
    }

    cout << ss.str();

    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;


long long C(int n, int r) {
    if(r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}

int main(void){
    int n, p;
    ll ans=0, cnt_o=0, cnt_e=0, ans_r=0, ans_l=0;
    cin >> n >> p;
    vector<int> o, e;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        if(tmp % 2 == 0){
            e.push_back(tmp);
        }else{
            o.push_back(tmp);
        }
    }
    cnt_o = o.size()/2;
    cnt_e = e.size();
    if(p == 0){
        for(int i=0;i<=cnt_o*2;i += 2){
            ans_r += C(o.size(), i);
        }
        for(int i=0; i<=cnt_e; i++){
            ans_l += C(cnt_e, i);
        }
        ans = ans_r * ans_l;
    }else{
        for(int i=0; i<=cnt_e; i++){
            ans_l += C(cnt_e, i);
        }
        for(int i=1; i<=o.size(); i += 2){
            ans_r += C(o.size(), i);
        }
        ans = ans_r*ans_l;
    }
    cout << ans << endl;
    
    return 0;
}

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

int main()
{
    int n, q, a[50];
    string s[50];

    cin >> n >> q;

    a[0] = 1;
    s[0] = "kogakubu10gokan";

    for( int i = 1; i <= n; i++ )
        cin >> a[i] >> s[i];
    
    for( int i = 0; i <= n; i++ )
        for( int j = n; j > i; j-- )
            if( a[j] < a[j-1] )
            {
                int t = a[j];
                a[j] = a[j-1];
                a[j-1] = t;

                string c = s[j];
                s[j] = s[j-1];
                s[j-1] = c;
            }

    bool judge = true;
    for( int i = 0; i <= n; i++ )
    {
        if( a[i] == q )
        {
            cout << s[i] << endl;
            judge = false;
            break;
        }
        if( a[i] > q )
        {
            cout << s[i-1] << endl;
            judge = false;
            break;
        }
    }

    if( judge )
        cout << s[n] << endl;

    return 0;
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
using ll = long long;
int main(){ 
    ll a;
    string s;
    cin>>a>>s;
    if(a>=3200){
        cout<<s;
    }else{
        cout<<"red";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define MOD 1000000007

using namespace std;

int main(){
   
    long long nums, k, menor[200005] , maior[200005];
    long long ans = 0;
    cin >> nums >> k;     

    menor[0] = 0;
    for(int i = 1; i <= nums; i++){
        menor[i] = menor[i - 1] + i;       
    }

    maior[nums] = nums;
    for(int i = nums - 1; i >= 0; i--){
        maior[i] = maior[i + 1] + i;
    }

    for(int i = k; i <= nums + 1; i++){        
        ans += maior[nums - i + 1] - menor[i - 1] + 1;
        ans = ans % MOD;
    }    

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6708
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);


        var n = Read();
        
        for(int i = 1; i <= 9; i++)
        {
            if (111 * i >= n)
            {
                Console.WriteLine(111 * i);
                break;
            }
        }
        
        
        Console.Out.Flush();
    }
}


Measured memory_bytes: 11092
from collections import deque
import sys
sys.setrecursionlimit(10**7)
def search(l,dic1,dic2):
    if not l:
        return(dic2)
    else:
        x=l.pop()
        for y in dic1[x]:
            if dic2[y]==0:
                l.appendleft(y)
                dic2[y]=x
        return search(l,dic1,dic2)

n,m=map(int,input().split())
l=[i+1 for i in range(n)]
dic1={i:[] for i in l}
dic2={i:0 for i in l}
for _ in range(m):
    a, b = map(int, input().split())
    dic1[a].append(b)
    dic1[b].append(a)
l=deque(dic1[1])
for z in l:
    dic2[z]=1

d=search(l,dic1,dic2)
print('Yes')
for k in range(2,n+1):
    print(dic2[k])


Measured memory_bytes: 134412
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    while (cin >> n) {
        long long ans = 0;
        for (long long i = 1; i <= n; i++)
            if (i % 3 && i % 5)
                ans += i;
        cout << ans << '\n';
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    vector<ll> t(n);

    ll ans = 1;
    rep(i, n){
        cin >> t[i];
        ans = ans / __gcd(ans,t[i]) * t[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define ull unsigned long long
#define ll long long
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}

int N;ll x;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	cin >> N;
	unordered_set<ll> a; vector<ll> b;
	for(int i=0;i<N;++i) {
		cin >> x;
		if(a.count(x)) {
			a.erase(x);
			b.push_back(x);
		} else {
			a.insert(x);
		}
	}

	sort(b.begin(),b.end(),greater<ll>());
	if(b.size() >= 2) {
		cout << b[0]*b[1] << endl;
	} else {
		cout << 0 << endl;
	}
}

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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

class Combination{
	constexpr static int atcoder_mod = 998244353;
	vector<ll> fac,finv,inv;
public:
	Combination(ll N){
		fac.resize(N+1);
		finv.resize(N+1);
		inv.resize(N+1);
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for(int i=2;i<=N;i++){
			fac[i] = fac[i-1] * i % atcoder_mod;
			inv[i] = atcoder_mod - inv[atcoder_mod%i] * (atcoder_mod/i) % atcoder_mod;
			finv[i] = finv[i-1] * inv[i] % atcoder_mod;
		}
	}
	ll Caluclation(ll n,ll r){
		if(n < r) return 0;
		if (n < 0 || r < 0) return 0;
		return fac[n] * (finv[r] * finv[n-r] % atcoder_mod) % atcoder_mod;
	}
	ll GetFInv(ll i){
		return finv[i];
	}
};

ll powermod(ll a,ll b,ll m){
	if(b==0){
		return 1LL;
	}
	if(b%2){
		return (a*powermod(a,b-1LL,m))%m;
	}
	return powermod((a*a)%m,b/2LL,m);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	ll N=in(),M=in(),K=in();
	Combination comb(N);
	ll S=0;
	REP(i,K+1){
		ll X=N-i;
		//ll C = DP[N-X][X];
		ll C = comb.Caluclation(N-1,X-1);
		ll P = (M*powermod(M-1LL,X-1,998244353)%998244353);
		ll Y = (C*P)%998244353;
		S += Y;
		S %= 998244353;
	}
	out(S);
	return 0;
}


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

int main() {
  int K, S, n=0; cin >> K >> S;
  for (int X=0; X<=K; X++) {
    for (int Y=0; Y<=K; Y++) {
      int Z=S-X-Y;
      if (Z>=0&&Z<=K) n++;
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 384
n = int(input())
a = []
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        a.append(i - 1)
        if i != n // i:
            a.append(n // i - 1)
ans = 0
for i in a:
    if i and n // i == n % i:
        ans += i
print(ans)

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int A[] = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = 0;
        }
        for (int i = 1; i < N; i++) {
            int num = s.nextInt();
            A[num - 1] += 1;
        }
        for (int i = 0; i < N; i++) {
            System.out.println(A[i]);
        }
        s.close();
    }
}

Measured memory_bytes: 60160
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int A, B, C;
    cin >> A >> B >> C ;
    if(A==B&&A==C){
        cout << "No" ;
    }
    else if(A!=B&&B!=C&&C!=A){
        cout << "No" ;
    }
    else cout << "Yes" ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
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; }
using namespace std;

//ABC131
signed main(void){
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);

    string s; cin>>s;
    rep(i,s.size()-1)if(s[i]==s[i+1]){
        cout<<"Bad"<<endl;
        return 0;
    }
    cout<<"Good"<<endl;

}

Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main  implements Runnable {

    public static void main(String[] args) {

        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();

    }

    public void run() {
    	FastScanner sc = new FastScanner(System.in);
		//long n = Long.parseLong(sc.next());
    	//int[] ar = new int[3];
    	//ar[0]=Integer.parseInt(sc.next());
    	//ar[1]=Integer.parseInt(sc.next());
    	//ar[2]=Integer.parseInt(sc.next());
    	//Arrays.parallelSort(ar);
		int x = Integer.parseInt(sc.next());
		int a = Integer.parseInt(sc.next());
		//int k = Integer.parseInt(sc.next());
		//String s = sc.next();
		//int k = Integer.parseInt(sc.next());
		//int m = Integer.parseInt(sc.next());
		//int x2000 = Integer.parseInt(sc.next());
		//int t = Integer.parseInt(sc.next());
		//int k = 0;
		//int k = Integer.parseInt(sc.next());
		///String str = sc.next();
		//char c[] = str.toCharArray();
		//char a[][] = new char[n];
		//int atmp[] = new int[h];
		//int max= 0;
		//int blackar[][] = new int[h*w][2];
		//int p=0;
		//ArrayList<Integer> lists = new ArrayList<Integer>();
		//lists = new ArrayList;

		PrintWriter out = new PrintWriter(System.out);
		if(x<a)
		{
			out.println(0);
		}
		else
		{
			out.println(10);
		}

		out.flush();
	}

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long nextInt() {
            return Integer.parseInt(next());
        }

    }

}

Measured memory_bytes: 21844
A, B, H, M = map(int, input().split())

import math

C = 360
degS = H*360/12 + M*30/60
degL = M*360/60
rad = (degS-degL)*math.pi / 180
ans = math.sqrt(A*A+B*B-2*A*B*math.cos(rad))
print(ans)

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

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()

ll n,k,a[100010];
ll ans=INF;

void input(){
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	return;
}

void solve(){
	sort(a,a+n);
	for(int i=0;i<=n-k;i++){
		ans=min(ans,a[i+k-1]-a[i]);
	}
	cout<<ans<<endl;
	return;
}

int main(){
	input();
	solve();
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;

int n,k;
vector<int> d;
vector<vector<int>> a;

void input(){
    cin >> n >> k;
    d.resize(k);
    a.resize(k, vector<int>());
    for(int i=0;i<k;i++){
        cin >> d[i];
        a[i].resize(d[i]);
        for(int j=0;j<d[i];j++){
            cin >> a[i][j];
        }
    }
}

void solve(){
    int ans=0;
    for(int i=1;i<=n;i++){
        bool have = false;
        for(auto v : a){
            for(auto p : v){
                if(p == i){
                    have = true;
                }
            }
        }
        if(!have)ans++;
    }
    cout << ans << endl;
}

int main() {
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3608
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		for(int i=0;i<n;i++)d[i]=sc.nextInt();
		Arrays.sort(d);
		int count=0;
		for(int i=0;i<n;i++) {
			if(i==0) {
				count++;
			}else {
				if(d[i] != d[i-1]) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 36012
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=10000;
const ll INF=1000000010;
const int MAX=100001;
int dx[8]={0,1,0,-1,1,-1,1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
int main(){
	int n,m,t;cin>>n>>m>>t;
	int a[110];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int ans=a[0]-m;
	for(int i=1;i<n;i++){
		ans+=max(0,a[i]-a[i-1]-2*m);
	}
	ans+=max(0,t-a[n-1]-m);
	cout<<ans<<endl;
	return 0;
}



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

int counter(string str, char c) {
    int count;
    for (int i = 0; i < str.size(); i++) {
        if (str.at(i) == c) count++;
    }
    return count;
}

int main () {
    string w;
    cin >> w;
    string ans = "Yes";
    
    for (int i = 0; i < 26; i++) {
        if (counter(w, 'a' + i) % 2 != 0) {
            ans = "No";
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>//小数点以下表示
#include<map>
using namespace std;
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; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int64_t d(int64_t x){
    if(x==1){
        return 1;
    }

    int64_t a;
    a=2*d(floor(x/2))+1;
    return a;
}

int main(){
    int64_t h;
    cin>>h;
    cout<<d(h)<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>


int main() {

    int A[20];
    int B[200];
    int i,j,k;
    int n,q;
    int dp[20+1][2000] = {0};

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

    scanf("%d", &q);
    for (i = 0; i < q; ++i){
        scanf("%d", &B[i]);
    }

    dp[0][0] = 1;

    for (k = 0; k < q; ++k) {
        for (i = 0; i < n; ++i) {
            for (j = 0; j <= B[k]; ++j) {
                dp[i + 1][j] |= dp[i][j];
                if (j >= A[i]) {
                    dp[i + 1][j] |= dp[i][j - A[i]];
                }

            }
        }

    }
    for (k = 0; k < q-1; ++k){
        if (dp[n][B[k]]){
            printf("yes\n");
        }
        else{
            printf("no\n");
        }
    }
    if (dp[n][B[q-1]]){
        printf("yes\n");
    }
    else{
        printf("no\n");
    }

}


Measured memory_bytes: 2080
import math


N, D = list(map(int, input().split(" ")))
X = [list(map(int, input().split(" ")))
     for _ in range(N)]

res = 0
for i in range(N):
    for j in range(i + 1, N):
        d2 = sum((X[i][k] - X[j][k]) ** 2 for k in range(D))
        d = math.floor(math.sqrt(d2))
        if d * d == d2:
            res += 1
print(res)

Measured memory_bytes: 38256
#include <iostream>

int main()
{
    int x;
    std::cin >> x;
    int h, m, s;
    h = x / 3600;
    m = (x % 3600) / 60;
    s = (x % 3600) % 60;
    std::cout << h << ":" << m << ":" << s << std::endl;
    return 0;
}



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

using namespace std;

#define sp << " " <<

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long k,a,b;
    cin >> k >> a >> b;
    if(b<a+3)
        cout << k+1;
    else
    {
        k-=(a-1);
        long long dp=a;
        dp+=(b-a)*(k/2);
        if(k%2==1)
            dp++;
        cout << dp;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>

using namespace std;

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

ll N,m,len,len_max;
v_ll X,Y;

int main(){
  cin >> N;
  X.assign(N+10,0);
  Y.assign(N+10,0);
  bool odd=true,even=true;
  for (ll i=1;i<=N;i++){
    cin >> X[i] >> Y[i];
    if ((X[i]+Y[i])%2==0)odd=false;
    else even=false;
  }
  if (!odd && !even){
    cout << -1 << endl;
    return 0;
  }
  len_max=(ll)1<<30;
  if (odd) m=31;
  else m=32;
  cout << m << endl;
  len=len_max;
  for (ll i=1;i<=m;i++){
    cout << len;
    if (i<m) cout << " ";
    len/=2;
    if (len<1)len=1;
  }
  cout << endl;
  for (ll i=1;i<=N;i++){
    len=len_max;
    ll x_t=X[i],y_t=Y[i];
    ll x_n=0,y_n=0;
    for (ll j=1;j<=m;j++){
      if (abs(x_t-x_n)>abs(y_t-y_n)){
        if (x_t-x_n<0) {cout<< "L";x_n-=len;}
        else {cout << "R";x_n+=len;}
      }else{
        if (y_t-y_n>0) {cout<< "U";y_n+=len;}
        else {cout << "D";y_n-=len;}
      }
      len/=2;
      if (len<1)len=1;
    }
    cout << endl;
  }

}


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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	string s; cin >> s;

	int mini = n;
	int cntB = 0;
	int cntW = 0;
	REP(i, n) {
		if (s[i] == '.')
			cntW++;
	}
	mini = min(mini, cntB + cntW);
	REP(i, n) {
		if (s[i] == '#')
			cntB++;
		else
			cntW--;
		mini = min(mini, cntB + cntW);
	}
	cout << mini << '\n';
	return 0;
}

Measured memory_bytes: 3728
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int intH;
		int intW;
		while(true){
			intH = scan.nextInt();
			intW = scan.nextInt();
			if(intH == 0 && intW ==0){
				break;
			}
			for(int i = 0; i < intH; i++){
				for(int j = 0; j < intW; j++){
					if((i + j) % 2 == 0){
						System.out.print("#");
					}else{
						System.out.print(".");
					}

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

		scan.close();
	}
}

Measured memory_bytes: 26700
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); }
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
#define forxr(i,n) for(int i = (n)-1; i >= 0; --i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll,ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second
#define all(c) c.begin(),c.end()

using pt = complex<ld>;
const int N = 60;
int n, k;
ld x[N], y[N], c[N];

vector<pt> cxc(pt c1, ld r1, pt c2, ld r2) {
  ld dq = norm(c1-c2), rq=r1*r1-r2*r2;
  pt c = (c1+c2)+(c2-c1)*rq/dq; c*=.5;
  ld dt=2*dq*(r1*r1+r2*r2)-dq*dq-rq*rq;
  if (dt < -EPS) return {};
  if (dt < EPS) return {c};
  dt=sqrt(dt)/2/dq;
  pt d = (c2-c1)*pt(0,1)*dt;
  return {c+d, c-d};
}

bool poss(ld t) {
  for (int i = 0; i < n; ++i) {
    for (int j = i+1; j < n; ++j) {
      auto pts = cxc({x[i], y[i]}, t/c[i], {x[j], y[j]}, t/c[j]);
      for (pt p : pts) {
        int cnt = 0;
        for (int l = 0; l < n; ++l) {
          pt o = {x[l], y[l]};
          ld d = abs(o-p);
          if (d - EPS < t/c[l]) {
            cnt++;
            if (cnt >= k) return true;
          }
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    pt p(x[i], y[i]);
    int cnt = 0;
    for (int l = 0; l < n; ++l) {
      pt o = {x[l], y[l]};
      ld d = abs(o-p);
      if (d - EPS < t/c[l]) {
        cnt++;
        if (cnt >= k) return true;
      }
    }
  }
  return false;
}

int main() { // Emily <3
  atexit([](){ cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << fixed << setprecision(12);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i] >> c[i];
  }
  ld lo = 0, hi = 1e10;
  while (abs(hi - lo) > EPS) {
    ld mid = (lo+hi)/2;
    if (poss(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  cout << hi << nl;

  return 0;
}



Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if(A1 >= A2 && A2 >= A3)
        cout << A1 - A3 << endl;
    else if(A1 >= A3 && A3 >= A2)
        cout << A1 - A2 << endl;
    else if(A2 >= A1 && A1 >= A3)
        cout << A2 - A3 << endl;
    else if(A2 >= A3 && A3 >= A1)
        cout << A2 - A1 << endl;
    else if(A3 >= A1 && A1 >= A2)
        cout << A3 - A2 << endl;
    else if(A3 >= A2 && A2 >= A1)
        cout << A3 - A1 << endl;
    return 0;
}


Measured memory_bytes: 256