akhauriyash/Code-Regression huggingface dataset:
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define int long long

#define VI vector<int> 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数定義や変数宣言



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


int W,H,x,y,r;

cin>>W>>H>>x>>y>>r;

if(x-r>=0 && y+r<=H && x+r<=W && y-r>=0 ){cout<<"Yes"<<endl;}
else{cout<<"No"<<endl;}









}


Measured memory_bytes: 3220
#include <stdio.h>

int main(void){
	int A,B;
	int coin=0;
	scanf("%d %d",&A,&B);

	for(int i=0; i<2; i++){
		if(A>B){ coin += A; A--; }
		else{ coin += B; B--; }
	}

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

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int n; std::cin >> n;
  ll mi = inf, mcnt = 0, ans = 0;
  rep(i, n) {
    ll a; std::cin >> a;
    if (a < 0) a *= -1, mcnt++;
    chmin(mi, a);
    ans += a;
  }
  if (mcnt&1) ans -= mi*2;
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll n;
char s[200010];
ll ans;
int main(){
	scanf("%s",s);
	n=strlen(s);
	ll scnt=0;
	rep(i,0,n){
		if(s[i]=='S')scnt++;
		else{
			if(scnt)scnt--;
			else ans++;
		}
	}
	printf("%lld\n",ans*2);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x,y,dist;
	cin>>n>>x>>y;
  	x--,y--;
	vector<int> ans(n,0);
	for(int i=0;i<n-1;i++){
      	for(int j=i+1;j<n;j++){
          	if(i<=x&&y<=j){
              	dist=x-y-i+j+1;
            }else if(i<=x&&x<=j){
              	dist=min(j-i,x+y-i-j+1);
            }else if(i<=y&&y<=j){
              	dist=min(j-i,i+j-x-y+1);
            }else if(x<=i&&j<=y){
              	dist=min(j-i,y-x+i-j+1);
            }else{
              	dist=j-i;
            }
          	ans[dist]++;
        }
    }for(int i=1;i<n;i++){
      	cout<<ans[i]<<"\n";
    }
}

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

signed main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  vector<int> x(N+1);
  vector<int> y(M+1);
  
  
  for(int i = 0; i < N; i++ ) cin >> x.at(i);
  x.at(N) = X;
  for(int i = 0; i < M; i++ ) cin >> y.at(i);
  y.at(M) = Y;
  
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  if( x.at(N) < y.at(0) ) cout << "No War" << endl;
  else cout << "War" << endl;
  
}


Measured memory_bytes: 256
from collections import Counter
import sys
MOD = 998244353
n, m = map(int, input().split())
decided = Counter()
ans = 1
d_num = 0

def kaijou(a, n):
	x = 1
	while n > 0:
		if n & 1 == 1:
			x = (x * a) % MOD
		a = (a ** 2) % MOD
		n >>= 1
	return x

for _ in range(m):
	a, b, c = map(int, input().split())
	decided[(a-1) * n + b - 1] = c
	if abs(a-b) >= 3:
		if (b-1) * n + a - 1 not in decided:
			d_num += 1
			#ans = (ans * 2) % MOD
			decided[(b-1) * n + a - 1] = c
		elif decided[(b-1) * n + a - 1] != decided[(a-1) * n + b - 1]:
			print(0)
			sys.exit()

ans = (ans * kaijou(2, ((n-2) * (n-3) // 2) - d_num)) % MOD
#print(ans)

is_empty = 0

if n*0+0 not in decided:
	is_empty += 1
if n*0+0+1 not in decided:
	is_empty += 1
if n*0+0+n not in decided:
	is_empty += 1
if n*0+0+n+1 not in decided:
	is_empty += 1

if is_empty == 0 and n*0+0 in decided:
	if (decided[n*0+0] + decided[n*0+0+n+1]) % 2 != (decided[n*0+0+1] + decided[n*0+0+n]) % 2:
		ans *= 0

if is_empty == 1 and n*0+0+n+1 not in decided and n*0+0 in decided:
	decided[n*0+0+n+1] = (decided[n*0+0+1] + decided[n*0+0+n]) % 2 - decided[n*0+0]

ans = (ans * (2 ** max(0, is_empty-1))) % MOD

#print(ans)
for i in range(n-2):

	is_empty = 0
	#if n*i+i+n+1 not in decided:
		#is_empty += 1
	if n*i+i+2 not in decided:
		is_empty += 1
	if n*i+i+2*n not in decided:
		is_empty += 1

	if is_empty == 0 and n*i+i+n+1 in decided:
		if (decided[n*i+i+2] + decided[n*i+i+n+1] + decided[n*i+i+2*n]) % 2 != 0:
			#print("hoge")
			ans *= 0

	if is_empty == 0 and n*i+i+n+1 not in decided:
		decided[n*i+i+n+1] = (decided[n*i+i+2] + decided[n*i+i+n*2]) % 2
		ans = (ans * 499122177) % MOD

	ans = (ans * (2 ** max(0, is_empty-1))) % MOD

	is_empty = 0

	if n*(i+1)+(i+1)+1 not in decided:
		is_empty += 1
	if n*(i+1)+(i+1)+n not in decided:
		is_empty += 1
	if n*(i+1)+(i+1)+n+1 not in decided:
		is_empty += 1

	if is_empty == 0 and n*(i+1)+(i+1) in decided:
		if (decided[n*(i+1)+(i+1)] + decided[n*(i+1)+(i+1)+n+1]) % 2 != (decided[n*(i+1)+(i+1)+1] + decided[n*(i+1)+(i+1)+n]) % 2:
			ans *= 0

	if is_empty == 0 and n*(i+1)+(i+1) not in decided:
		ans = (ans * 499122177) % MOD

	if is_empty == 1 and n*(i+1)+(i+1)+n+1 not in decided and n*(i+1)+(i+1) in decided:
		decided[n*(i+1)+(i+1)+n+1] = (decided[n*(i+1)+(i+1)+1] + decided[n*(i+1)+(i+1)+n]) % 2 - decided[n*(i+1)+(i+1)]

	ans = (ans * (2 ** max(0, is_empty-1))) % MOD


print(int(ans))

Measured memory_bytes: 15520
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  string s;
  unordered_map<string,int> map;
  for(int i=0;i<n;i++){
    cin >> s;
    map[s]++;
  }
  cout << map.size();
  return 0;
}

Measured memory_bytes: 17676
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n, a, b;
  cin>>n>>a>>b;
  if((b - a) % 2 == 0){
    cout<<(b - a) / 2<<endl;
  }
  else{
    long long d = (b - a) / 2;
    long long res = min(a, n - b + 1) + d;
    cout<<res<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

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

	int N,K; cin >> N >> K;

	vector<int> l(N,0);
	for (int i = 0; i < N; i++) {
		cin >> l[i];	
	}
	sort(l.begin(),l.end());
	reverse(l.begin(),l.end());

	int ans = 0;
	for (int i = 0; i < K; i++) {
		ans += l[i];
	}
	cout << ans << endl;

	return 0;
}


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

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;
const long long INF = 1LL << 60;

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

int n, W;
vector<int> w, v;
int dp[110][100100];

signed main()
{
    cin >> n >> W;
    w = v = vector<int>(n);
    rep(i, n)
    {
        cin >> w[i] >> v[i];
    }

    int MAXV = 100100;
    rep(i, 110)
    {
        rep(j, MAXV)
        {
            dp[i][j] = INF;
        }
    }

    dp[0][0] = 0;

    // dp[i][sum] i番目まで調べて価値sum1まで選んだ時の最小の値
    rep(i, n)
    {
        for (int sum_v = 0; sum_v < MAXV; sum_v++)
        {

            if (sum_v - v[i] >= 0)
            {
                chmin(dp[i + 1][sum_v], dp[i][sum_v - v[i]] + w[i]);
            }
            chmin(dp[i + 1][sum_v], dp[i][sum_v]);
        }
    }

    int ans = 0;
    for (int sum_v = 0; sum_v < MAXV; ++sum_v)
    {
        if (dp[n][sum_v] <= W)
        {
            ans = sum_v;
            //cout << ans << endl;
        }
    }

    print(ans);
}


Measured memory_bytes: 86272
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
       long x=sc.nextLong(),k=sc.nextLong(),d=sc.nextLong();
       x=Math.abs(x);
       
       long div=x/d;
       long rem=x%d;
       long ans=x;
       
       if(div<k) {
    	if((k-div)%2==0)  ans=rem;
    	else ans=d-rem;
         		       	   //}
      
       }
       else {
    	   ans=x-k*d;
       }
       System.out.println(ans);
         
       
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

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

}

Measured memory_bytes: 32656
/*
created by sanyam singhal
*/

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

#define pb push_back
#define mp make_pair
#define ll long long int
#define mod 1000000007
#define w(t) int t;	cin>>t while(t--)
#define triplet pair<int,pair<int,int>>
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define fastIO ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
#define loop(i, k, n) for(ll i=k; i<n; i+=1)
#define loop2(i, k, n) for(ll i=k; i>=n; i--)

const ll inf = 1e18;
ll dp[100005][4];
bool vis[100005];

void take_fileIO(){
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  return;
}

ll solve_by_dp(vector<vector<int>> &adj, int node, int parent_color){
  if(dp[node][parent_color]!=-1)
    return dp[node][parent_color];

  vis[node] = true;
  ll ans = 1;
  for(int neigh : adj[node]){
    if(vis[neigh]==false){

      if(parent_color==0){  // 0 here for white
        ll op1 = solve_by_dp(adj, neigh, parent_color)%mod;

        ll op2 = solve_by_dp(adj, neigh,1-parent_color)%mod;
      
        ans = (ans%mod * (op1 + op2)%mod)%mod;

        // cout<<"neigh and node are "<<neigh<<" "<<node<<"color "<<parent_color<<" "<<ans<<endl;
      }
      else{ // 1 for black
        ans = (ans%mod * solve_by_dp(adj, neigh, 1-parent_color)%mod)%mod;
        // cout<<"neigh and node are "<<neigh<<" "<<node<<"color "<<parent_color<<" "<<ans<<endl;
      }
      
    }
  }

  vis[node]=false;
  dp[node][parent_color] = ans;
  return ans;
}

void solve(){
  int n;  
  cin>>n;

  vector<vector<int>>adj(n+1);
  loop(i, 0, n-1){
    int u, v;
    cin>>u>>v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }

  // loop(i, 1, n+1){
  //   cout<<i<<"->";
  //   for(int neigh : adj[i]){
  //     cout<<neigh<<" ";
  //   }
  //   cout<<endl;
  // }

  memset(dp, -1, sizeof(dp));
  memset(vis, false, sizeof(vis));

  ll ans = solve_by_dp(adj, 1, 0)%mod;
  // cout<<ans<<endl;

  
  // memset(vis, false, sizeof(vis));

  // cout<<"---------------\n";

  ll ans2 = solve_by_dp(adj, 1, 1)%mod;

  // cout<<ans2<<endl;

  ll f_ans = (ans%mod + ans2%mod)%mod;

  cout<<f_ans<<endl;

  return;
}

int main(){

  fastIO;
  // take_fileIO();
  solve();
  return 0;
}

Measured memory_bytes: 17280
/*input
3 2
1 2 3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
    out<<'('<<P.F<<','<<P.S<<')';
    return out;
}
#define version 20190713
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        
        b>>=1;
    }
    return res;
}

int a[maxn];
int nxt[maxn];
map<int,int> mp;

vector<int> path;
bool vis[maxn];

vector<int> ans;
set<int> st;

int main(){
    IOS;
    int n;
    ll k;
    cin>>n>>k;
    REP(i,n) cin>>a[i];
    for(int i=n-1;i>=0;i--){
        mp[a[i]]=i;
    }
    for(int i=n-1;i>=0;i--){
        nxt[i]=mp[a[i]]+1;
        nxt[i]%=n;
        mp[a[i]]=i;
    }
    // REP(i,n) cout<<nxt[i]<<' ';
    // cout<<endl;
    int s=0;
    path.pb(s);
    vis[s]=1;
    ll dis=0;
    while(1){
        dis+=(nxt[s]-s+n+n-2)%n+2;
        s=nxt[s];
        if(vis[s]){
            break;
        }
        vis[s]=1;
        path.pb(s);
    }
    dis/=n;
    k%=dis;
    k*=n;
    s=0;
    while(1){
        int tmp=(nxt[s]-s+n+n-2)%n+2;
        if(k>=tmp) k-=tmp;
        else{
            // cout<<s<<'\n';
            for(int i=s;i<s+k;i++){
                if(st.count(a[i])){
                    while(ans.back()!=a[i]){
                        st.erase(ans.back());
                        ans.pop_back();
                    }
                    st.erase(ans.back());
                    ans.pop_back();
                }
                else{
                    ans.pb(a[i]);
                    st.insert(a[i]);
                }
            }
            break;
        }
        s=nxt[s];
    }
    REP(i,SZ(ans)) cout<<ans[i]<<" \n"[i==SZ(ans)-1];
    return 0;
}


Measured memory_bytes: 23668
#include <iostream>

using namespace std;

int n,x;
bool used[200000];

int main()
{
    cin>>n>>x;
    if(x>1 && x<2*n-1)
    {
        if(n==2)
            cout<<"Yes\n1\n2\n3";
        else
        {
            cout<<"Yes\n";
            int i,cnt=0;
            if(x>2)
            {
                used[x-1]=true;
                used[x]=true;
                used[x+1]=true;
                used[x-2]=true;
                for(i = 1;cnt<n-2;i++)
                {
                    if(!used[i])
                    {
                        cout<<i<<'\n';
                        used[i]=true;
                        cnt++;
                    }
                }
                cnt+=4;
                cout<<x-1<<'\n'<<x<<'\n'<<x+1<<'\n'<<x-2<<'\n';
                for(i = 1;cnt<2*n-1;i++)
                {
                    if(!used[i])
                    {
                        cout<<i<<'\n';
                        used[i]=true;
                        cnt++;
                    }
                }
            }
            else
            {
                used[x-1]=true;
                used[x]=true;
                used[x+1]=true;
                used[x+2]=true;
                for(i = 1;cnt<n-2;i++)
                {
                    if(!used[i])
                    {
                        cout<<i<<'\n';
                        used[i]=true;
                        cnt++;
                    }
                }
                cnt+=4;
                cout<<x+1<<'\n'<<x<<'\n'<<x-1<<'\n'<<x+2<<'\n';
                for(i = 1;cnt<2*n-1;i++)
                {
                    if(!used[i])
                    {
                        cout<<i<<'\n';
                        used[i]=true;
                        cnt++;
                    }
                }
            }

        }
    }
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n,m,i,j,a,b,x,y;
  cin >> n >> m;
  vector<int> fl;
  for(i=0;i<m;i++){
    cin >> a >> b;
    if (a==1) fl.push_back(b);
    if (b==n) fl.push_back(a);
  }
  x = fl.size();
  sort(fl.begin(),fl.end());
  fl.erase(unique(fl.begin(),fl.end()),fl.end());
  y = fl.size();
  cout << ((x == y) ? "IMPOSSIBLE":"POSSIBLE") << endl;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a,b;
  cin>>a>>b;
  vector<int> hyoukou(a);
  vector<int> yoi(a);
  for(int i=0;i<a;i++){cin>>hyoukou.at(i);}
  for(int i=0;i<b;i++){int m,n;
                       cin>>m>>n;
                       if(hyoukou.at(m-1)>hyoukou.at(n-1)){yoi.at(n-1)=1;}
                     else if(hyoukou.at(m-1)<hyoukou.at(n-1)){yoi.at(m-1)=1;}
                      else {yoi.at(n-1)=1;yoi.at(m-1)=1;}
                      }
  int k=0; 
  for(int i=0;i<a;i++){if(yoi.at(i)==0){k++;}}
  cout<<k<<endl;
}

Measured memory_bytes: 4048
let hisHappiness money = 
	let hapiness500 = money / 500 * 1000 in
	let hapiness5 = (money mod 500) / 5 * 5 in
	hapiness500 + hapiness5 ;;
let () = read_line() |> int_of_string |> hisHappiness |> string_of_int |> print_string

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int main(){
int R;
  cin>>R;
  if(R<1200){
    cout<<"ABC"<<endl;
    
  }
  else if(R<2800){
  
  cout<<"ARC"<<endl;
  }
  else{
  cout<<"AGC"<<endl;
  
  }

}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = [[int(i) for i in input().split()] for _ in range(N)]
cnt = {}
for i in A:
    for j in i[1:]:
        if j in cnt:
            cnt[j] += 1
        else:
            cnt[j] = 1
ans = len([k for k in cnt if cnt[k] == N])
print(ans)

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

using namespace std;

int main() {
  int N, M;
  map<string, int> cash;

  cin >> N;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;

    cash[s] += 1;
  }

  cin >> M;
  for (int i = 0; i < M; i++) {
    string t;
    cin >> t;

    cash[t] -= 1;
  }

  int maximum = 0;
  for (auto iterator = cash.begin(); iterator != cash.end(); iterator++) {
    maximum = max(maximum, iterator->second);
  }

  int answer = maximum < 0 ? 0 : maximum;

  cout << answer << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int A, B;
  cin >> A >> B;
  cout << max(A-2*B, 0) << endl;
  return 0;
}


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

int main() {
    int N, X; cin >> N >> X;
    int height = 0, ans = 1;
    for (int i = 0; i < N; i++) {
        int L; cin >> L;
        height += L;
        if (height <= X) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
const int INF = 1 << 25;
const LL MOD = 1000000007LL;
using namespace std;
typedef pair<int, int> P;
vector<int> pos[26];
map<P, int> cnt;
int main() {
	int H, W, N;
	cin >> H >> W >> N;
	rep(i, N) {
		int a, b;
		cin >> a >> b; a--; b--;
		for (int dx = -1; dx <= 1; dx++) {
			for (int dy = -1; dy <= 1; dy++) {
				int nx = b + dx, ny = a + dy;
				if (nx <= 0 || nx >= W-1 || ny <= 0 || ny >= H-1) continue;
				cnt[P(nx, ny)]++;
			}
		}
	}
	LL ans[10] = { 0 };
	LL sum = 0;
	for (auto p : cnt) ans[p.second]++;
	for (int i = 1; i <= 9; i++) sum += ans[i];
	ans[0] = (LL)(H-2)*(W-2) - sum;
	rep(i, 10) cout << ans[i] << endl;
}

Measured memory_bytes: 56448
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
T, A = lr()
H = np.array(lr())
temp = np.abs(T - H * 0.006 - A)
answer = np.argsort(temp)
print(answer[0]+1)


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

int main()
{
	vector<int> a(3);

	cin >> a[0] >> a[1] >> a[2];

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

	cout << a[0] + a[1] << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

//============================================================
var sc = bufio.NewScanner(os.Stdin)

func cout(out string) { fmt.Println(out) }
func setScSplit()     { sc.Split(bufio.ScanWords) }
func stoi(str string) int {
  num, _ := strconv.Atoi(str)
  return num
}
func itos(num int) string {
  str := strconv.Itoa(num)
  return str
}
func gsf() string {
  sc.Scan()
  return sc.Text()
}
func gif() int {
  i := stoi(gsf())
  return i
}
func gff() float64 {
  f, _ := strconv.ParseFloat(gsf(), 64)
  return f
}
func uniq(list []int) []int {
  m := make(map[int]struct{}) // 空のstructを使う
  for _, ele := range list {
    m[ele] = struct{}{} // m["a"] = struct{}{} が二度目は同じものとみなされて重複が消える。
  }
  uni := []int{}
  for i := range m {
    uni = append(uni, i)
  }
  return uni
}
func usort(list []int) []int {
  sort.Sort(sort.IntSlice(list))
  return list
}
func dsort(list []int) []int {
  sort.Sort(sort.Reverse(sort.IntSlice(list)))
  return list
}
func push(t *[]int, x int) {
  tmp := *t
  *t = append(tmp, x)
}
func pop(t *[]int) int {
  tmp := *t
  x := tmp[len(tmp)-1]
  *t = tmp[:len(tmp)-1]
  return x
}
func deq(t *[]int) int {
  tmp := *t
  x := tmp[0]
  *t = tmp[1:]
  return x
}

//=============================================================

func main() {
  setScSplit()
  n := gif()
  a := []int{}
  b := []int{}
  for j := 0; j < n; j++ {
    push(&a, gif())
  }

  for j := 0; j < n; j++ {
    push(&b, gif())
  }
  max := -1
  for i := 0; i < n; i++ {
    ai := a[:i+1]
    bi := b[i:]
    sum := 0
    for _, ti := range ai {
      sum += ti
    }
    for _, ti := range bi {
      sum += ti
    }
    if max < sum {
      max = sum
    }
  }
  cout(itos(max))
}


Measured memory_bytes: 640
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     setbits(x)  __builtin_popcountll(x)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=998244353;

int n;
vector<pii>v;
int nxt[N],dp[N];
int rec(int i){
    if(i==n) return 1;
    int &cache=dp[i];
    if(cache!=-1) return cache;
    return cache=(rec(nxt[i])+rec(i+1))%mod;
}
signed main(){
    FastIO;
    cin>>n;
    rep(i,1,n){
        int a,b;
        cin>>a>>b;
        v.pb({a,b});
    }
    sort(all(v));
    stack<pii>s;
    s.push({2e9,n});
    repb(i,n-1,0){
        while(s.top().F<v[i].F+v[i].S) s.pop();
        nxt[i]=s.top().S;
        s.push({v[i].F,i});
    }
    memset(dp,-1,sizeof dp);
    cout<<rec(0);
    return 0;
}


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

ll cnt;

void print(vector<int> &a, int n)
{
	rep(i, n)
		cout << a[i] << endl;
}

void insert_sort(vector<int> &a, int n, int g)
{
	for (int i = g; i < n; i++) {
		int v = a[i];
		int j = i - g;
		while (j >= 0 && a[j] > v) {
			a[j+g] = a[j];
			j -= g;
			cnt++;
		}
		a[j+g] = v;
	}
}

void shell_sort(vector<int> &a, int n)
{
	vector<int> g;
	for (int h = 1; ; ) {
		if (h > n) break;
		g.push_back(h);
		h = 3*h + 1;
	}
	cout << g.size() << endl;
	for (int i = g.size()-1; i >= 0; i--) {
		cout << g[i];
		if (i) cout << " ";
	}
	cout << endl;

	for (int i = g.size()-1; i >= 0; i--)
		insert_sort(a, n, g[i]);
}

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

	shell_sort(a, n);
	cout << cnt << endl;
	print(a, n);
}



Measured memory_bytes: 6716
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <unordered_map>

using namespace std;

const int inf = (int)1e9 + 7;

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

    string s;

    cin >> s;

    vector<int> arr (s.begin (), s.end ());

    for (auto &it : arr)
        it -= 'a';

    vector<int> prst (arr.size () + 1);
    unordered_map<int, vector<int>> stpos;
    stpos[0].push_back (0);

    for (size_t i = 1; i < prst.size (); i++)
        stpos[prst[i] = prst[i - 1] ^ (1 << arr[i - 1])].push_back (i);

    vector<int> dist (prst.size (), -1);
    dist[0] = 0;
    queue<int> bfs;
    bfs.push (0);

    while (!bfs.empty ())
    {
        int i = bfs.front ();
        bfs.pop ();

        if (dist[i] != -1)
        {
            vector<int> jumps (1, prst[i]);

            for (int j = 0; j < 26; j++)
                jumps.push_back (prst[i] ^ (1 << j));

            for (auto neig : jumps)
            {
                auto it = lower_bound (stpos[neig].begin (), stpos[neig].end (), i + 1);

                while (it != stpos[neig].end () && dist[*it] == -1)
                {
                    dist[*it] = dist[i] + 1;
                    bfs.push (*it);
                    it++;
                }
            }
        }
    }

    cout << dist.back () << endl;

    return 0;
}


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

int main() {
    int a, b, c, tmp;
    cin >> a >> b >> c;
    if (a > b) tmp = a, a = b, b = tmp;
    if (b > c) tmp = b, b = c, c = tmp;
    if (a > b) tmp = a, a = b, b = tmp;
    cout << a << ' ' << b << ' ' << c << endl;
    return 0;
}


Measured memory_bytes: 3100
INF = 1000000007

N, M = map(int, input().split())

ab = []

for i in range(N):
    ab.append([int(i) for i in input().split()])

cd = []

for i in range(M):
    cd.append([int(i) for i in input().split()])

for i in range(N):
    ans = 0
    dst = INF
    for j in range(M):
        tmp = abs(cd[j][0] - ab[i][0]) + abs(cd[j][1] - ab[i][1])

        if tmp < dst:
            # 0-indexed
            dst = tmp
            ans = j + 1

    print(ans)


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int N; cin >> N;

    unordered_map<ll,ll> m;
    FOR(w,1,N+1) {
        int X = w;
        FOR(i, 2, X+1) {
            if (i*i > X) break;
            if (X%i == 0) {
                ll exp = 0;
                while(X%i == 0) X /= i, exp++;
                m[i] += exp;
            }
        }
        if (X > 1) m[X]++;
    }

    ll ans = 1;
    trav(w, m) {
        ans = (ans*(w.s+1))%MOD;
    }

    cout << ans << "\n";
}


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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<bool> snukes(n);
  for (int i = 0; i < k; i++)
  {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++)
    {
      int a;
      cin >> a;
      snukes.at(a - 1) = true;
    }
  }
  int ans = 0;
  for (bool snuke : snukes)
  {
    if (!snuke)
    {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[100010];
int N, S, W, Q;

int main(){
    while(cin >> N >> S >> W >> Q && N){
        int g = S;
        for(int i=0; i<N; i++) {
            a[i] = (g/7) % 10;
            if( g%2 == 0 ) { g = (g/2); }
            else           { g = (g/2) ^ W; }
        }
        int ans = 0;
        if(Q != 2 && Q != 5){
            map<int,int> m = {{0,1}};
            ll dig = 1, cur = 0;
            for(int i = N-1; i >= 0; --i) {
                cur = i == N-1 ? a[i] % Q : cur + a[i]*dig;
                cur %= Q;
                if(a[i] != 0) ans += m[cur];
                m[cur]++;
                dig *= 10;
                dig %= Q;
            }
        } else if(Q == 2 || Q == 5){
            int pos = 0;
            for(int i = 0; i < N; ++i){
                if(a[i] != 0) ++pos;
                if(a[i] % Q == 0) ans += pos;
            }
        } 
        cout << ans << endl;
    }
}

Measured memory_bytes: 7612
#include <bits/stdc++.h>
using namespace std;
#define endl "\n";
typedef  long long int lli;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inf (1000*1000*1000+5)
const int NODE =1e4+9;

const int mod=1e9+7;
const lli num=2000000;

void init(){

}


int main()
{
   boost;
   int t=1;
   //cin>>t;
   init();
   while(t--){
      int n;
      cin>>n;
      int a[n][3];
      for(int i=0;i<n;i++){
         for(int j=0;j<3;j++){
            cin>>a[i][j];
         }
      }
      lli dp[n+1][3];
      memset(dp,0,sizeof(dp));
      for(int i=1;i<=n;i++){
         for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
               if(j==k)continue;
               dp[i][k]=max(dp[i][k],dp[i-1][j]+a[i-1][k]);
            }
         }
      }
      lli ans=0;
      for(int i=0;i<3;i++)ans=max(ans,dp[n][i]);
      cout<<ans<<endl;
   }
   return 0;
}


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

  const int MOD = 1000000007;
  const double PI = acos(-1); 

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

  //for
  #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

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



  //二分探索(最小値を出す問題は疑う)
  bool f(ll K){

  }

  ll binary_search(ll ok, ll ng){
    while(abs(ok - ng) > 1){
      ll mid = (ok + ng) / 2;
      if(f(mid)) ok = mid;
      else ng = mid;
    }
    return ok;
  }

int H, W;
vector<vector<char>>s;
vector<vector<int>>cost;

int bfs(){
  int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1};
  queue<pair<int, int>> que;
  que.push(make_pair(0, 0));
  cost[0][0] = 0;
  while(!que.empty()){
    pair<int, int> p = que.front();
    que.pop();
    if(p == make_pair(H - 1, W - 1)){
      return cost[p.first][p.second];
    }
    REP(i, 4){
      int ny = p.first + dy[i], nx = p.second + dx[i];
      if(nx < 0 || ny < 0 || nx >= W || ny >= H) continue;
      if(s[ny][nx] == '#') continue;
      if(cost[ny][nx] != -1) continue;
      cost[ny][nx] = cost[p.first][p.second] + 1;
      que.push(make_pair(ny, nx));
    }
  }
return -1;
}

int main(){
  cin >> H >> W;
  cost = vector<vector<int>>(H, vector<int>(W, -1));
  s = vector<vector<char>>(H, vector<char>(W));
  int white = 0;
  REP(i, H)REP(j, W){
    cin >> s[i][j];
    if(s[i][j] == '.') white++;
  }
  int min_cost = bfs();
  if(min_cost == -1) print(-1);
  else print(white - (min_cost + 1));
}

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

int dp[100001], k;
int fun(int *a, int i,  int n)
{
    if(i==n-1)
    {
        return 0;
    }
    if(i==n-2)
    {
        return abs(a[i]-a[i+1]);
    }
    if(dp[i]!=-1)
    {
        return dp[i];
    }
    int mini=INT_MAX;
    for(int j=1;j<=k;j++)
    {
        if(i+j<n)
    {
        mini=min(abs(a[i]-a[i+j])+fun(a, i+j, n), mini);
    }
    }
    dp[i]=mini;
    return dp[i];
}
int main()
{
    int n;
    cin>>n>>k;
    memset(dp, -1, sizeof(dp));
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    cout<<fun(a, 0, n)<<endl;
return 0;

}



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

int main() {
  int D;
  cin>>D;
  vector<int> sage(26);
  for(int i=0;i<26;i++){
    cin>>sage.at(i);
  }
  vector<vector<int>> man(D,vector<int>(26));
  for(int i=0;i<D;i++){
    for(int j=0;j<26;j++){
      cin>>man.at(i).at(j);
    }
  }
  vector<int> hini(D);
  vector<vector<int>> rkai(D+1,vector<int>(26,1));
  for(int i=0;i<D;i++){
    int A=0,W=man.at(i).at(0)-2*rkai.at(i).at(0)*sage.at(0);
    for(int j=1;j<26;j++){
      int Y=man.at(i).at(j)-2*rkai.at(i).at(j)*sage.at(j);
      if(Y>W){
        W=Y,A=j;
      }
      rkai.at(i+1).at(j)=rkai.at(i).at(j)+1;
    }
    hini.at(i)=A;
    rkai.at(i).at(A)=0;
    rkai.at(i+1).at(A)=1;
  }
  /*for(int i=0;i<D;i++){
    Z+=man.at(i).at(hini.at(i));
    for(int j=0;j<26;j++){
      Z-=rkai.at(i).at(j)*sage.at(j);
    }
    cout<<Z<<endl;
  }*/
  int a=167,b=0;
  for(int i=0;i<1000000;i++){
      int Z=0;
      a+=man.at(a).at(b);
    a%=D;
      b+=man.at(a).at(b);
      b%=26;
    int K=rkai.at(a).at(b),C=0;
    for(int j=a;j<D;j++){
      if(rkai.at(j).at(b)==0){
        break;
      }
      else{
        C++;
      }
    }
    Z+=K*C*sage.at(b);
    Z+=man.at(a).at(b);
    int e=hini.at(a);
    C=0;
      int G;
    if(a==0){
      G=1;
    }
    else{
      G=rkai.at(a-1).at(e)+1;
    }
    for(int j=a;j<D;j++){
      if(rkai.at(j).at(e)==0&&j!=a){
        break;
      }
      else{
        C++;
      }
    }
    Z-=G*C*sage.at(e);
    Z-=man.at(a).at(e);
      if(Z>0){
        for(int j=a;j<D;j++){
      if(rkai.at(j).at(b)==0){
        break;
      }
      else{
        rkai.at(j).at(b)-=K;
      }
    }
        for(int j=a;j<D;j++){
      if(rkai.at(j).at(e)==0&&j!=a){
        break;
      }
      else{
        rkai.at(j).at(e)+=G;
      }
    }
        hini.at(a)=b;
      }
    }
  
    
  for(int i=0;i<D;i++){
    cout<<hini.at(i)+1<<endl;
  }
}

Measured memory_bytes: 3736
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}




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


  ll N; cin >> N; 

  rep(h,3501)rep(n,3501){
    if(h == 0) continue;
    if(n == 0) continue;
    if(4*h*n-n*N-h*N == 0) continue; 
    ll w = (N*h*n) / (4*h*n-n*N-h*N);
    if(w < 0) continue;
    
    if(((N*h*n) % (4*h*n-n*N-h*N) == 0)){
      cout << h << " " << n << " " << (N*h*n) / (4*h*n-n*N-h*N) << endl;
      return 0;
    }
    
  }
  



  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

typedef int value_type; /* ソートするキーの型 */

value_type med3(value_type x, value_type y, value_type z)
/* x, y, z の中間値を返す */
{
    if (x < y)
        if (y < z) return y; else if (z < x) return x; else return z; else
        if (z < y) return y; else if (x < z) return x; else return z;
}

void quicksort(value_type a[], int left, int right,value_type index[])
/* クイックソート
 * a     : ソートする配列 
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 * index: index配列
 */
{
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i],a[j] を交換 */
            tmp = index[i]; index[i] = index[j]; index[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1,index);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right,index); /* 分割した右を再帰的にソート */
    }
}


int dfs(int n,int N){
    if (n>N){
        return 0;
    }
    

    int ret;
    
    return ret;
}
double logfact(int n){
    long long dp[n+1];
    dp[0]=1;
    //dp[1]=1;
    double sum=0;
    for(int i=1;i<=n;i++){
        sum+=log(i);
    }
    return sum;
}
int main(){
    int N,K;
    cin >>N>>K;

    long h[N];

    FOR(i,N){
        cin>>h[i];
    }
    sort(h,h+N);

    long long tmp=pow(19,9);

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

    cout<<tmp<<endl;


    return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){

    long long X, Y;
    cin >> X >> Y;

    int count = 1;

    while(true)
    {
        X = X * 2;
        if(X <= Y){
            count++;
        }else{
            cout << count << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
use std::io;
use std::cmp;


fn main() {
    let n = read_one::<usize>();
    let mut tn = Vec::new();
    let mut an = Vec::new();
    for _ in 0..n {
        let (t, a) = {
            let i = read::<usize>();
            (i[0], i[1])
        };
        tn.push(t);
        an.push(a);
    }

    let mut t = 1usize;
    let mut a = 1usize;

    for i in 0..n {
        let x: usize = cmp::max(
            (t + tn[i] - 1) / tn[i],
            (a + an[i] - 1) / an[i]
        );
        t = tn[i] * x;
        a = an[i] * x;
    }
    println!("{}", t + a);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

long long int lcm(long long int a, long long int b) {
  return (a / gcd(a, b)) * b;
}

int main() {
  long long int N;
  string S;
  vector<long long int> t_v;
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    //cout << i << endl;
    long long int t;
    cin >> t;
    t_v.push_back(t);
  }

  if (N == 1) {
    printf("%lld", t_v[0]);
    return 0;
  }
  long long int mul = lcm(t_v[0], t_v[1]);
  //printf("%lld\n", mul);

  for (int i = 2; i < N; i++) {
    mul = lcm(mul, t_v[i]);
    //printf("%d %lld\n", i, mul);
    // cout << i << " " <<  mul << endl;
  }
  cout << mul << endl;
  return 0;
}


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

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll(x);cin >> (x);
#define stin(x) str(x);cin >> (x);
#define vllin(x,n) vll(x)(n);FOR(i,0,n-1){cin >> (x)[i];}
#define vllin2(a,b,n) vll(a)(n);vll(b)(n);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i];}
#define vllin3(a,b,c,n) vll(a)(n);vll(b)(n);vll(c)(n);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i] >> (c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >> (x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i] >> (c)[i];}
#define vpl4in(x,n) vpl4(x)((n),mp(0,0));FOR(i,0,n-1){cin >> x[i].fi >> x[i].se;}
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define rFOR(i,b,a) for(ll i=a;i>=b;i--)
#define SORT(x) sort(x.be,x.en)
#define rSORT(x) sort(x.rbegin(),x.rend())
#define say(x) cout << (x);
#define sal(x) cout << (x) << endl;
#define says(x) cout << (x) << (' ');
#define sas cout << (' ');
#define sayR(x) cout << fixed << setprecision(10) << (x);
#define salR(x) cout << fixed << setprecision(10) << (x) << endl;
#define yn(a) cout << ((a) ? "yes" : "no") << endl;
#define Yn(a) cout << ((a) ? "Yes" : "No") << endl;
#define YN(a) cout << ((a) ? "YES" : "NO") << endl;
#define Imp(a) cout << ((a) ? "Possible" : "Impossible") << endl;
#define IMP(a) cout << ((a) ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll MOD = 998244353;

signed main()
{
    llin(l);
    vllin(a,l);
    vvll b(l+1,vll(5,0));
    FOR(i,1,l){
        FOR(j,0,4){
            b[i][j]=b[i-1][0];
            FOR(k,1,j) b[i][j]=min(b[i][j],b[i-1][k]);
        }
        b[i][0]+=a[i-1];
        b[i][1]+=a[i-1]%2+(a[i-1]==0?2:0);
        b[i][2]+=(a[i-1]+1)%2;
        b[i][3]+=a[i-1]%2+(a[i-1]==0?2:0);
        b[i][4]+=a[i-1];
    }
    ll s=b[l][0];
    FOR(i,1,4){
        s=min(s,b[l][i]);
    }
    sal(s)
}


Measured memory_bytes: 15872
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   ll n, a[N] = {}, b[N] = {}, ans = 0;
   cin >> n;
   for (int i = 0; i <= n; i++)
      cin >> a[i];
   for (int i = 0; i < n; i++)
      cin >> b[i];
   for (int i = 0; i < n; i++)
   {
      ll kill = min(a[i], b[i]);
      a[i] -= kill;
      b[i] -= kill;
      ans += kill;
      kill = min(a[i + 1], b[i]);
      a[i + 1] -= kill;
      b[i] -= kill;
      ans += kill;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;



public class Main {

	public static void main(String[] args) {
		
	Scanner scanner = new Scanner(System.in);
	
	int a = scanner.nextInt();
	int b = scanner.nextInt();
	int c = scanner.nextInt();
	
	if(a<b&&b<c){
		System.out.println("Yes");
		
	}else{
		System.out.println("No");
		
	}
	
	}
}

Measured memory_bytes: 26184
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
#define intt long long

int main() {
	intt H, W; std::cin >> H >> W;
	std::vector<std::vector<char>> S(H + 2, std::vector<char>(W + 2));
	std::vector<std::vector<int>> SS(H + 2, std::vector<int>(W + 2));
	for (int i = 1; i < H + 1; ++i)
		for (int j = 1; j < W + 1; ++j)
			std::cin >> S[i][j];
	for (int i = 1; i < H + 1; ++i)
		for (int j = 1; j < W + 1; ++j)
			if (S[i][j] == '.') {
				int a = 0;
				if (S[i + 1][j] == '#')
					++a;
				if (S[i - 1][j] == '#')
					++a;

				if (S[i - 1][j - 1] == '#')
					++a;
				if (S[i][j - 1] == '#')
					++a;
				if (S[i + 1][j - 1] == '#')
					++a;

				if (S[i - 1][j + 1] == '#')
					++a;
				if (S[i][j + 1] == '#')
					++a;
				if (S[i + 1][j + 1] == '#')
					++a;
				SS[i][j] = a;
			}
	for (int i = 1; i < H + 1; ++i) {
		for (int j = 1; j < W + 1; ++j) {
			if (S[i][j] == '#') {
				std::cout << S[i][j];
			}
			else
				std::cout << SS[i][j];
		}
		std::cout << std::endl;
	}
}

Measured memory_bytes: 3640