akhauriyash/Code-Regression huggingface dataset:
/**********************************************

1.
2.炭田高輝
3.sumita.takaki@gmail.com

last updated: 2013-07-10@12:55

 **********************************************/
#include<iostream>
#include<algorithm>
#include<sstream>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
using namespace std;


int main(void){

        string cipher;
        while(cin >> cipher){

                int i=0;
                while( cipher[i] != 0){

                        if(cipher[i] == 'A'){
                                cipher[i] = 'X';
                        }else if(cipher[i] == 'B'){
                                cipher[i] = 'Y';
                        }else if(cipher[i] == 'C'){
                                cipher[i] = 'Z';
                        }else{
                        cipher[i] = cipher[i] - 3;                        
                        }

                        i++;
                }

                cout << cipher << endl;

        }

        return 0;


}

Measured memory_bytes: 1180
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define pb push_back
#define fst first
#define snd second

typedef long long ll;
typedef pair<int,int> pii;
template<typename T> using min_queue=priority_queue<T,vector<T>,greater<T>>;

const ll MOD=1e9+7;

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

    int N;cin>>N;
    map<string,int> mp;
    while (N --> 0) {
      string s;cin>>s;
      mp[s]++;
    }
    vector<string> v = {"AC", "WA", "TLE", "RE"};
    for (string& s : v) {
      cout << s << " x " << mp[s] << '\n';
    }
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;



void count_zero(int* z){
	int cnt=0;
	for(int i=1 ; i<=20000 ; ++i){
		if(i%5==0) cnt++;
		if (i%15625==0) cnt+=5;
	    else if (i%3125==0) cnt+=4;
		else if (i%625==0) cnt+=3;
		else if (i%125==0) cnt+=2;
		else if (fmod(i,12.5)==0) cnt+=1;
		z[i]=cnt;
	}
}

int main(){
	int zero[20001]={0};
	int n;
	count_zero(zero);
	while(cin>>n , n){
		cout << zero[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
#define asn ans
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	int n, x; CI n >> x;
	vector<int> m(n); CI m;
	sort(all(m));

	int cont = 0;

	REP(i, n) {
		x -= m[i];
		cont++;
	}

	cont += x / m[0];

	CO cont EN;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 3010
using namespace std;
long long dp[maxn][maxn][4], Val[maxn][maxn];
int main() {
	int R, C, K;
	scanf("%d%d%d", &R, &C, &K);
	for(int i = 1; i <= K; ++i) {
		int r, c, v;
		scanf("%d%d%d", &r, &c, &v);
		Val[r][c] = v;
	}
	dp[1][1][1] = Val[1][1];
	for(int i = 1; i <= R; ++i) {
		for(int j = 1; j <= C; ++j) {
			if(j > 1) dp[i][j][0] = dp[i][j - 1][0];
			if(i > 1) for(int k = 0; k < 4; ++k) dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][k]);
			if(j > 1) dp[i][j][1] = max(dp[i][j - 1][1], dp[i][j - 1][0] + Val[i][j]);
			if(i > 1) for(int k = 0; k < 4; ++k) dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][k] + Val[i][j]);
			if(j > 1) dp[i][j][2] = max(dp[i][j - 1][2], dp[i][j - 1][1] + Val[i][j]);
			if(j > 1) dp[i][j][3] = max(dp[i][j - 1][3], dp[i][j - 1][2] + Val[i][j]);
//			for(int k = 1; k < 4; ++k) dp[i][j][k] = dp[i][j - 1][k] + Val[i][j];
//			int RM = 0;
//			for(int k = 0; k < 4; ++k) RM = max(RM, dp[i - 1][j][k]);
//			for(int k = 0; k < 4; ++k) if(RM > dp[i][j][k]) dp[i][j][k] = RM;
//			for(int k = 1; k < 4; ++k) dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k] + );
		}
	}
	long long A = 0;
	for(int k = 0; k < 4; ++k) A = max(A, dp[R][C][k]);
	printf("%lld", A);
	return 0;
}

Measured memory_bytes: 356288
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
public class Hello
{
    public static void Main()
    {
        long N = NextLong();
        //Nの約数列挙
        List<long> A = new List<long>();
        long ans = 0;
        long M = (long)Math.Ceiling(Math.Sqrt(N));
        for (long i = 1; i < M; i++)
            if (N % i == 0)
            {
                long L = (N / i) - 1;
                if (N / L == N % L) ans += L;
            }
        Console.WriteLine(ans);
    }

}

public class Input
{
    private static Queue<string> queue = new Queue<string>();
    private static void Confirm() { if (queue.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) queue.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(queue.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(queue.Dequeue()); }
    public static string NextString() { Confirm(); return queue.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(queue.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int x;
  cin >> x;
  if (x == 3 || x == 5 || x == 7) {
    YES;
  } else {
    NO;
  }
  return 0;
}



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

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var x = new int[5];
            for (var i = 0; i < x.Length; i++)
            {
                x[i] = int.Parse(Console.ReadLine());
            }
            var k = int.Parse(Console.ReadLine());
            var isOk = true;

            for (var i = 0; i < x.Length - 1; i++)
            {
                for (var j = i + 1; j < x.Length; j++)
                {
                    if (Math.Abs(x[i] - x[j]) > k)
                    {
                        isOk = false;
                        break;
                    }
                }
            }
            Console.WriteLine(isOk ? "Yay!" : ":(");
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(void){
  int r;
  int d;
  int x;
  int nx;
  cin >> r;
  cin >> d;
  cin >> x;
  
  for(int i = 0; i < 10; i++) {
  	nx = (r * x) - d;
	cout << nx << endl;
    x = nx;
  }
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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 ll  LINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  int a,b,c;
  cin >> a >> b >> c;
  if((a == 5 && b == 5 && c == 7)||
    (a == 5 && b == 7 && c == 5)||
    (a == 7 && b == 5 && c == 5)) cout << "YES" << endl;
  else cout <<"NO" << endl;
  return 0;
}

Measured memory_bytes: 3544
import sys

L, R = map(int, input().split())
t = 2019

if L == 0:
    print(0)
    sys.exit()

temp = R // t
temp2 = L // t
kouho = []
if temp != temp2:
    print(0)
    sys.exit()
else:
    for i in range(L, R+1):
        for j in range(L, R+1):
            if i != j:
                kouho.append((i * j)%t)
    kouho.sort()
    print(kouho[0])

Measured memory_bytes: 130660
ABCD = input()
n = len(ABCD)
for i in range(1<<(n-1)):
  s = int(ABCD[0])
  for j in range(n-1):
    if i>>j & 1:  # T: +, F: -
      s += int(ABCD[j+1])
    else:
      s -= int(ABCD[j+1])
  if s == 7:
    break
r = [ABCD[0]]
for k in range(n-1):
  if i>>k & 1:
    r.append('+')
  else:
    r.append('-')
  r.append(ABCD[k+1])
print('{}=7'.format(''.join(r)))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define ll long long
#define max_sum 100000

using namespace std;

vector <ll> V;
ll dp[110][max_sum + 1];

int main() {
    for(int j = 1; j <= max_sum; j++)
        dp[0][j] = INT_MAX;

    ll n, W;
    cin >> n >> W;
    for(int i = 1; i <= n; i++){
        ll weights, value;
        cin >> weights >> value;
        for(int j = 1; j <= max_sum; j++){
            dp[i][j] = dp[i - 1][j];
            if(j - value >= 0)
                dp[i][j] = min(dp[i][j], dp[i - 1][j - value] + weights);
        }
    }

    for(int i = max_sum; i >= 0; i--){
        if(dp[n][i] <= W) {
            cout << i;
            return 0;
        }
    }
}


Measured memory_bytes: 82472
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans;llfor;///////////////////////////////////////////////////////////
int main(){
 char s;
 sc(s);
 if(s=='A')puts("T");
 if(s=='T')puts("A");
 if(s=='G')puts("C");
 if(s=='C')puts("G");
   
return 0;}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define ff first
#define ss second
#define int long long
#define all(x) (x).begin(), (x).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define eb emplace_back
#define pii pair<int, int>
#define inf 1e9

using namespace std;

int nxt()
{
    int x;
    cin >> x;
    return x;
}

int n, m;
vector<vector<int>> G;
vector<int> comp, vis;

void dfs(int src, int c)
{
    if (vis[src])
        return;
    vis[src] = 1;
    comp[src] = c;
    for (auto &i : G[src])
        dfs(i, c);
}

void solve()
{
    n = nxt(), m = nxt();
    G.resize(n + 1);
    comp.resize(n + 1);
    vis.resize(n + 1, 0);
    while (m--)
    {
        int s = nxt(), e = nxt();
        G[s].eb(e);
        G[e].eb(s);
    }
    int c = 1;
    for (int i = 1; i <= n; i++)
    {
        if (!vis[i])
            dfs(i, c++);
    }
    vector<int> cnt(c + 1, 0);
    int mx = 0;
    for (auto &i : comp)
        cnt[i]++, mx = max(mx, cnt[i]);
    cout << mx;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // int t;
    // cin >> t;
    // while (t--)
    solve();
    return 0;
}

Measured memory_bytes: 23508
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    int N, M, Q;
    cin >> N >> M;

    int a[M];
    int b[M];
    for (int i = 0; i < M; i++) {
        int ta, tb;
        cin >> ta >> tb;
        ta--; tb--;
        a[i] = ta;
        b[i] = tb;
    }

    cin >> Q;
    int dp[N][11];
    int color[Q];
    fill(dp[0], dp[N-1]+11, 0);
    for (int i = 0; i < Q; i++) {
        int v, d, c;
        cin >> v >> d >> c;
        v--;
        dp[v][d] = i + 1;
        color[i] = c;
    }

    for (int i = 10; i > 0; i--) {
        for (int m = 0; m < M; m++) {
            dp[a[m]][i-1] = max(dp[a[m]][i-1], dp[b[m]][i]);
            dp[b[m]][i-1] = max(dp[b[m]][i-1], dp[a[m]][i]);
        }

        for (int n = 0; n < N; n++) {
            dp[n][i-1] = max(dp[n][i], dp[n][i-1]);
        }
    }

    for (int i = 0; i < N; i++) {
        if (dp[i][0] > 0) {
            cout << color[dp[i][0] - 1] << "\n";
        } else {
            cout << 0 << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 6144
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int max = 0;
    int c = 0;
    string acgt = "ACGT";
    for (int i = 0; i < s.length(); i++) {
        if (acgt.find(s[i]) != -1) {
            c++;
        } else {
            c = 0;
        }
        if (c > max) {
            max = c;
        }
    }
    cout << max << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define f first
#define sec second
#define pb push_back
#define pf push_front
#define po pop_back
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false)
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pi pair<ll,ll>
#define map map<ll,ll>
#define set set<ll>
#define tostr to_string
#define toint stoi
#define gcd __gcd
#define maximum INT_MAX
#define minimum INT_MIN

int n;
int x[10],y[10];

double dist(int i,int j)
{
  double dx=x[j]-x[i];
  double dy=y[j]-y[i];

  return pow(dx*dx + dy*dy, 0.5);
}

int main() {
    int i; double sum=0.0;
cin>>n;  vector<int> v(n);
for(i=1;i<=n;i++)
    cin>>x[i]>>y[i];

    for(i=0;i<n;i++) v[i]=i+1;

    do{
        for(i=0;i<n-1;i++) sum+=dist(v[i],v[i+1]);
    }while(next_permutation(v.begin(),v.end()));


    int factorial=1;
    for(i=1;i<=n;i++) factorial*=i;

    cout<<fixed<<setprecision(10)<<sum/factorial<<endl;

}


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

int main()
{
	int N;
	cin >> N;
	vector<ll> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	ll add = 0;
	for (int i = N - 1; i >= 1; i--) {
		if (a[i] > a[0] + N) {
			ll v = (a[i] - a[0]) / (N + 1);
			add += v;
			a[i] -= v * (N + 1);
		}
	}
	sort(a.rbegin(), a.rend());
	ll id = 0;
	ll mi = INF;
	for (int i = 0; i < N; i++) {
		a[i] += add + i;
		if (a[i] <= N - 1) {
			cout << add + i << endl;
			return 0;
		}
		if (a[i] < mi) {
			mi = a[i];
			id = i;
		}
	}
	cout << ((mi - (N - 1)) * N + id + add) << endl;
	return 0;
}


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

#define F first
#define FF first.first
#define FS first.second
#define S second
#define SF second.first
#define SS second.second
#define ii pair<int,int>
#define iii pair<ii, int>
#define iiii pair<ii, ii>
#define viiii vector< iiii >
#define viii vector< iii >
#define vii vector< ii >
#define vi vector< int >
#define vvi vector<vector< int > >
#define int long long

#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define pb push_back
#define FOR(v, i, l) for(int v = i; v < (int)l; ++v)
#define REP(v, l) FOR(v, 0, l)

#define EPS 1e-6
#define oo (1LL<<60)
#define MAX 1000000000000000000LL
#define MOD 1000000007LL
#define debug(x) cout << #x << " is " << x << "\n";

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

int PAsum(int in, int fi, int s){
   if(fi<in)return 0;
   return ((in+fi)*(1+(fi-in)/s))/2LL;
}

int modPow(int x, int y, int mod = MOD){
   int ans = 1;
   while( y ){
      if(y%2){
         ans = (ans*x)%mod;
      }
      x = (x*x)%mod;
      y /= 2;
   }
   return ans;
}

int countBit(int x){
   int ans  = 0;
   while(x){
      ans += (x%1);
      x /= 2;
   }
   return ans;
}

int N, M, K, L, R, J, P, CASES;
int A,B,C,D;

main(){
   scanf("%lld", &N);
   vi v(N);
   vi have(1000006);
   for(int &x: v){
      scanf("%lld", &x);
   }
   sort( all(v) );

   int ans = 0;

   for(int i = 0; i < N; i++){
     // printf("Testando %lld: ", v[i]);
      if(i+1<N and v[i]==v[i+1]){
         while( i+1<N and v[i]==v[i+1] )i++;
         have[ v[i] ]=1;
         continue;
      }
      int ok = 1;
      for(int j = 1; j*j <= v[i] and ok ;j++){
         if( v[i]%j==0 ){
            if( have[ j ] or have[ v[i]/j ] )
               ok = 0;
         }
      }
      ans += ok;
      //printf("%lld\n", ans);
      have[ v[i] ]=1;
   }
   printf("%lld\n", ans);
}

/*
10
33 18 45 28 8 19 89 86 2 4
*/


Measured memory_bytes: 12784
n,m,X,Y = map(int,input().split())
x = max(list(map(int,input().split())))
y = min(list(map(int,input().split())))
ok = False
for z in range(X+1,Y+1):
        if x < z and y >= z:
            ok = True
            break
if ok :print("No War")
else:print("War")
    


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

int main() {
	ll X;
	cin >> X;
	ll ok = 1, ng = LLINF;
	while (llabs(ok - ng) > 1) {
		ll m = (ok + ng) / 2;
		ll val = m;
		ll cnt = 0;
		while (val > 2) {
			val = (val - 1) / 2;
			cnt++;
		}
		if (cnt > X) ng = m;
		else ok = m;
	}
	cout << ok << endl;
	return (0);
}

Measured memory_bytes: 256
import os
import sys
from collections import defaultdict

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18

MOD = 10 ** 9 + 7
N, K = list(map(int, sys.stdin.readline().split()))

# ある程度数をまとめられるのでまとめておく
nexts = []
n = N
while True:
    p = int(N // (int(N // n) + 1))
    nexts.append(n)
    if p <= 0:
        break
    n = p

# dp[k][i]: i に続く k 文字のパターン数
dp = defaultdict(lambda: defaultdict(int))
prev = 0
for n, m in zip(nexts, reversed(nexts)):
    dp[0][m] = m
for k in range(1, K):
    dp[k][0] = 0
    prev = 0
    for n, m in zip(nexts, reversed(nexts)):
        dp[k][m] = (dp[k][prev] + dp[k-1][n] * (m-prev)) % MOD
        prev = m
print(dp[K - 1][N])


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

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

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

  int ans = 1e9;
  for(int i = 0; i <= n - k; i++) {
    ans = min(ans, h[i+k-1] - h[i]);
  }

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


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int a, b, t;
  cin >> a >> b >> t;

  cout << t / a * b << endl;
  return 0;
}



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

int main() {
  int64_t W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << W * H / 2.0 << endl;
  if(W % 2 == 0 && H % 2 == 0 && W / 2 == x && H / 2 == y) {
    cout << 1 << endl;
  }
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
using namespace std;
#define i64  long long
#define lint long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807

void solve()
{
  int N;
  lint K;
  cin>>N>>K;
  vector<lint> A(N,0);
  vector<lint> F(N,0);

  lint sum=0;

  for (int i = 0; i < N; i++)
  {
    cin>>A[i];
    sum +=A[i];
  }
  for (int i = 0; i < N; i++)
  {
    cin>>F[i];
  }

  if(sum <= K)
  {
    cout<<"0"<<endl;
    return;
  }

  sort(A.begin(),A.end());
  sort(F.rbegin(),F.rend());

  lint l = -1;
  lint r = 100000000000000;

  while(r - l > 1)
  {
    lint mid = (l + r)>>1;
    lint ans = 0;

    for (int i = 0; i < N; i++)
    {
      ans += max((lint)(0),(lint)(A[i]) - mid/F[i]);
    }

    if(ans <= K)
    {
      r = mid ;
    }
    else
    {
      l = mid ;
    }
    
  }

  cout<<r<<endl;//更新してしまった分を戻す
  
  
  return;
}

int main(int argc, const char *argv[])
{

  solve();

  return 0;
}


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

using namespace std;

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;
}

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

    vector<int> h(N);
    vector<int> dp(N);
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }

    dp[0] = 0;
    dp[1] = dp[0] + abs(h[0] - h[1]);
    for (int i = 0; i < N; i++)
    {
        if (i + 2 < N)
        {
            dp[i + 2] = dp[i] + abs(h[i] - h[i + 2]);
        }

        if (i + 1 < N)
        {
            chmin(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        }
    }
    cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1024
N = int(input())
S = input()
WEST = [0]*N
EAST = [0]*N

for i in range(0,N):
    if S[i] == 'W':
        if i == 0:
            WEST[i] = 1
        else:
            WEST[i]=WEST[i-1]+1
    else:
        if i == 0:
            WEST[i] = 0
        else:
            WEST[i]=WEST[i-1]
for i in range(N-1,-1,-1):
    if S[i] == 'E':
        if i == N-1:
            EAST[i] = 1
        else:
            EAST[i] = EAST[i+1]+1
    else:
        if i == N-1:
            EAST[i] = 0
        else:
            EAST[i] = EAST[i+1]

ans = 100000000
for i in range(N):
    if i == 0:
        n = EAST[1]
    elif i == N-1:
        n = WEST[N-2]
    else:
        n = WEST[i-1]+EAST[i+1]
    if ans > n:
        ans = n

print(ans)


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

#define fastIO ios_base::sync_with_stdio(false)
#define for0N(data_type, var, initial, upper) for(data_type var = initial; var < upper; var++)
#define MOD0 1000000007

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int N;
vector<vector<int>> adj_mat;
vector<ull> white, black;

void paint(int vertex, int parent) {
    white[vertex] = black[vertex] = 1;
    for (auto neighbor: adj_mat[vertex]) {
        if (neighbor == parent) continue;
        paint(neighbor, vertex);
        black[vertex] = ((black[vertex] * white[neighbor]) % MOD0);
        white[vertex] = ((white[vertex] * (white[neighbor] + black[neighbor])) % MOD0);
    }
}

int main() {
    fastIO;
    cin >> N;

    adj_mat.resize(N + 1);
    white.resize(N + 1);
    black.resize(N + 1);

    int u, v;
    for0N(int, i, 0, N - 1) {
        cin >> u >> v;
        adj_mat[u].push_back(v);
        adj_mat[v].push_back(u);
    }

    paint(1, -1);

    cout << (white[1] + black[1]) % MOD0;
}

Measured memory_bytes: 14208
#!/usr/bin/env python3


def solve(n, l, xs):
    pair_idx = None
    for i in range(n - 1):
        if xs[i] + xs[i + 1] >= l:
            pair_idx = i
            break
    if pair_idx is None:
        return (False, [])
    ans = [x + 1 for x in range(pair_idx)]
    ans.extend(x + 1 for x in range(pair_idx + 1, n - 1)[::-1])
    ans.append(pair_idx + 1)
    return (True, ans)


def main():
    n, l = map(int, input().split())
    xs = list(map(int, input().split()))
    judge, ans = solve(n, l, xs)
    if not judge:
        print("Impossible")
        return
    print("Possible")
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+1;
const ll p=1e9+7;
int main()
{
	int n,mx=0,mn=INFINITY;
	cin>>n;
	for(int i=0;i<n;i++)
    {
        int x;
        scanf("%d",&x);
        mx=max(mx,x);
        mn=min(mn,x);
    }
    cout<<mx-mn;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;cin >> N;
    long long a,b,c;
    a = 1;b=1;
    if(N%2==0){
        c = (N-2)/2;
    }else{
        c = (N-1)/2;
    }
    for(int i=0;i<c;i++){
        a = a+b;
        b = a+b;
    }
    if(N%2==0){
        c=2*a+1*b;
    }else{
        c=a*1+(b-a)*2;
    }
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 100000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double PI = acos(-1.0);

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


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	ll h, w;
	cin >> h >> w;
	vs c(h);
	string s;
	rep(i, h) {
			cin >> c[i];
	}
	rep(i, h) {
		rep(j, 2) {
			cout << c[i] << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 5001001001001001001ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, k;
    cin>>n>>k;
    vector<LP> xy(n);
    cin>>xy;

    sort(rng(xy));
    ll l = 0, r = n - 1;
    ll ans = LINF;
    rep(l, n - k + 1) {
        for (int r = l + k - 1; r < n; ++r) {
            ll lx = xy[l].fi, rx = xy[r].fi;

            ll m = r - l + 1;
            vl ys;
            rep(i, m) ys.push_back(xy[l + i].se);
            sort(rng(ys));
            rep(b, m - k + 1) {
                for (int u = b + k - 1; u < m; ++u) {
                    ll ly = ys[b], ry = ys[u];
                    chmin(ans, (rx - lx) * (ry - ly));
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts()(a, b int){
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

func lcm(x, y int)int{
	return (x*y)/gcd(x, y)
}


Measured memory_bytes: 1092
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

#[cfg(debug_assertions)]
include!{"./procon/debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let G = read![i64, i64; N];

    let all_a = G.iter().map(|&(a, _)| a).sum::<i64>();
    let all_b = G.iter().map(|&(_, b)| b).sum::<i64>();
    let mut mi = min(all_a, all_b);

    debug!(all_a, all_b);

    let mut ws = vec![];
    for (i, &(a, b)) in G.iter().enumerate() {
        ws.push((a, i));
        ws.push((b, i));
    }
    ws.sort();

    debug!(ws);

    // Whether if both A[v] and B[v] are in ws[..N] for some v.
    let mut ok = false;
    let mut vs = BTreeSet::new();
    for i in ws[0..N].iter().map(|&(_, i)| i) {
        ok = ok || vs.contains(&i);
        vs.insert(i);
    }

    let s = ws[0..N].into_iter().map(|&(w, _)| w).sum::<i64>();
    debug!(ok, s);

    if ok {
        mi = min(mi, s);
    } else {
        for w in 0..N {
            let mut s = s - min(G[w].0, G[w].1);
            let last = if w == ws[N].1 { ws[N + 1].0 } else { ws[N].0 };
            debug!((w, s, last));
            mi = min(mi, s + last);
        }
    }

    println!("{}", mi)
}


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

int main()
{
    int N, M, combination = 0;
    cin >> N >> M;

    if (N > 0) {
        combination += N * (N - 1) / 2;
    }
    if (M > 0) {
        combination += M * (M - 1) / 2;
    }

    cout << combination << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c=1,d;
    cin>>a>>b>>d;
    for(int i=2;i<=min(a,b);i++){
        if(a%i==0&&b%i==0) c=i;
    }
    if(d%c) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}

Measured memory_bytes: 256
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

ll x;
ll k;
ll d;

void input() {
  cin >> x >> k >> d;
}

void solve() {
  ll ans = 0;

  if (x > 0)
    x = -x;

  ll l = 0;
  ll r = 1;

  while (x + r * d < 0)
    r *= 2;

  while (r - l > 1) {
    ll mid = (l + r) / 2;

    if (x + mid * d >= 0)
      r = mid;
    else
      l = mid;
  }

  l = min(l, k);
  r = min(r, k);

  k -= l;

  ans = r;

  if (k % 2 == 0)
    ans = l;

  cout << abs(x + ans * d) << '\n';
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 4;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define F first
#define S second
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define p_b push_back
#define all(c)              c.begin(), c.end()
using namespace std;
typedef long long ll; //printf("%lld ", ll); to out put long
typedef pair <int , int> pii;
typedef pair <ll , ll> pll;
const double eps = 1e-6;
const int MAXN = 1e6 + 5;
const ll MOD = 1e9 + 7;
bool ODD(ll O) {return (O % 2 != 0);}
ll gcd(ll a, ll b) {return __gcd(a , b);}
int dx[] = {1, 0, -1 ,0 , -1 , 0};
int dy[] = {0, 1, 0, -1 , -1 , 0};
ll power (ll x, ll y) {
    if(y == 0) return 1;
    if(ODD(y)) return x * power(x , y / 2) * power(x , y / 2);
    return power(x , y / 2) * power(x , y / 2);
}
/*------ never give up --------*/
int fix(ll n) {
    return (n % 26);
}

int main () {
    int t = 1;
    //cin >> t;
    while(t--) {
       ll a;
       long double b;

       cin >> a >> b;
       
       cout << (unsigned long long) (a * (b * 1000)) / 1000;
    }
    return 0;
}


Measured memory_bytes: 3756
#include <stdio.h>
#include<math.h>

int main(void)
{
    int kazu;
    int i;
    int j = 0;
    int flag = 0;
    int loop;
    int count = 0;
    double Dkazu;
    
    scanf("%d",&loop);
    
    while(j < loop){
        scanf("%d",&kazu);
        Dkazu = sqrt(kazu);
        
        for(i = 2; i <= Dkazu; i = i + 2){
            if(kazu % 2 == 0){
                flag = 1;
                break;
            }
            
            if(kazu % i == 0 && kazu != 0){
                flag = 1;
                break;
            }
            if(i == 2){
                i--;
            }
        }
        
        if(flag == 0){
            count++;
        }
        flag = 0;
        j++;
    }
    
    printf("%d\n",count);
    
	return 0;
}


Measured memory_bytes: 2112
require 'prime'
include Math
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

a,b,c = gs

a = a.split("")
b = b.split ""
c = c.split ""

puts a[-1]==b[0]&&b[-1]==c[0] ? "YES" : "NO"

Measured memory_bytes: 2044
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    val list = Array(n) { 0 }
    for (i in 0 until n-1) {
        list[a[i]-1]++
    }
    for (s in 0 until n) {
        println(list[s])
    }
}

Measured memory_bytes: 69640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000007)
	sc.Split(bufio.ScanWords)
	x, _ := strconv.Atoi(Scanner())
	ans := x / 500 * 1000
	x = x % 500
	ans += x / 5 * 5
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);++i)
#define REP(i,n) for (int i=0;i<=(n);++i)
#define all(x) (x).begin(), (x).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;
typedef long long ll;
const int INF = 10000000;

int main() {
    vector<int> x(5);
    rep(i, 5) {
        cin >> x[i];
        if(x[i] == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }    
}

Measured memory_bytes: 3596
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
    int a,b,c,d,e=0;

    cin>>a>>b>>c;

	for(int i=a; i<=b; i++){
		if( (c%i)==0)e++;
	}
		cout<<e<<endl;
    return 0;
}

Measured memory_bytes: 3108
/* Author : Pranav Deshmukh
            PICT,Pune
   Purpose: Practice B Codeforces Round #653 (Div. 3)
*/

#include<bits/stdc++.h>
using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define int             long long
#define dip(type,var)   type var; cin>>var;
#define dipi(x)			int x; cin>>x;
#define w(x)            int x; cin>>x; while(x--)
#define mka(arr,n,type) type *arr=new type[n];
#define foi(i,n)		for(int i=0;i<n;i++)
#define mod             pow(10,9)+7
#define inf             1e18
#define endl			"\n"
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >

void c_p_c()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {
	c_p_c();
	string s;
	cin >> s;
	if (s[1] == 'B')
		cout << "ARC" << endl;
	else
		cout << "ABC" << endl;
	return 0;
}

Measured memory_bytes: 3640
/*
    Author : zzugzx
    Lang : C++
    Blog : blog.csdn.net/qq_43756519
*/
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define SZ(x) (int)x.size()
#define mem(a, b) memset(a, b, sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int mod = 1e9 + 7;
//const int mod = 998244353;
const double eps = 1e-6;
const double pi = acos(-1.0);
const int maxn = 2e6 + 10;
const int N = 2e4 + 5;
const ll inf = 0x3f3f3f3f;
const int dir[][2]={{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
int a[maxn], k, n;
bool ok(int x) {
    int res = 0;
    for (int i = 1; i <= n; i++) {
        res += max(0, (int)(ceil(1.0 * a[i] / x) - 1));
    }
    return res <= k;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    int l = 1, r = inf, ans = 0;
    while (l <= r) {
        int mid = (l + r) / 2;
        if (ok(mid)) r = mid - 1, ans = mid;
        else l = mid + 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4416
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  int k;
  vector<int> n(3);
  cin >> n[0] >> n[1] >> n[2] >> k;
  sort(all(n));

  cout << (int)(n[0] + n[1] + (n[2] * pow(2, k))) << endl;

  return 0;
}

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

string s;
string t, u, v;
vector<string> w;
bool f;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> s;
	t = "KIH";
	u = "B";
	v = "R";
	w.push_back("A");
	w.push_back("");
	for(int i=0; i<16; ++i){
		string tmp;
		tmp += w[i%2];
		tmp += t;
		tmp += w[(i>>1)%2];
		tmp += u;
		tmp += w[(i>>2)%2];
		tmp += v;
		tmp += w[(i>>3)%2];
		if(s == tmp) f = true;
	}
	cout << (f ? "YES" : "NO") << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char a,b,ans;
    int x,y;
    cin>>a>>b;
    x=a-65;
    y=b-65;
    if (x==y) ans='H';
    else ans='D';
    cout<<ans;
    return 0;
}

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

using namespace std;
using i64 = long long int;
using ui64 = unsigned long long int;

//////

int main(){
	vector<int> a(300000,1);
	a[0] = a[1] = 0;
	for(int i=2;i<300000;i++){
		if(!a[i])continue;
		for(int j=2;i*j<300000;j++){
			a[i*j] = 0;
		}
	}
	for(int i=0;i<299999;i++){
		a[i+1] += a[i];
	}
	int n;
	while(cin >> n,n){
		cout << a[2*n] - a[n] << endl;
	}
}



Measured memory_bytes: 3700
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
using namespace std;
typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

int main(){
    ll a, b, c; cin >> a >> b >> c;
    cout << min(b/a, c) << endstr;
    return 0;
}


Measured memory_bytes: 256