akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<class T>
auto divisors(T n){
    vector<T>v;
    for(T i = 1; i *  i <= n;i++){
        if(n % i)continue;
        v.push_back(i);
        if(i != 1 and i * i != n)
            v.push_back(n /i);
    }
    // input : 6 ->  1 2 3 6
    // input : 1 -> 1
    // input : 2 -> 2
    if(n != 1) v.push_back(n);
    sort(v.begin(),v.end());
    return v;
}
int main(){
    Int N; cin >> N;
    Int ans = 0;
    set<Int>SS;
    for(auto K : divisors(N)){
        if(K == 1)continue;
        Int tN = N;
        while(tN % K == 0 && tN >= K) tN /= K;
        if(tN % K == 1)SS.emplace(K);
    }
    for(auto K : divisors(N - 1)){
        if(K == 1) continue;
        SS.emplace(K);
        ++ans;
    }
    cout << SS.size() << endl;
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int n,a[300001],b[300001],f1[300001],f2[300001],sol[300001],aux[300001];
set<pii> s;
set<int> s2;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        f1[a[i]]++;
    }
    bool ok=1;
    for(int i=1;i<=n;i++)
    {
        cin>>b[i];
        if(a[i]==b[i])
            ok=0;
        f2[b[i]]++;
        s2.insert(b[i]);
    }
    for(int i=1;i<=n;i++)
    {
        if(f2[i]>0)
            s.insert({f1[i],i});
        aux[i]=f2[i];
    }
    if(ok)
    {
        cout<<"Yes\n";
        for(int i=1;i<=n;i++)
            cout<<b[i]<<" ";
        return 0;
    }
    for(int i=1;i<=n;i++)
        if(f1[i]>n/2&&f2[i]>n/2)
        {
            cout<<"No";
            return 0;
        }
    bool found=1;
    for(int i=1;i<=n;i++)
    {
        bool deleted=0;
        if(f2[a[i]]>0)
        {
            s.erase({f1[a[i]],a[i]});
            deleted=1;
        }
        if(s.empty())
        {
            found=0;
            break;
        }
        auto it=s.end();
        it--;
        int nr=(*it).second;
        sol[i]=nr;
        f2[nr]--;
        if(f2[nr]==0)
            s.erase({f1[nr],nr});
        if(deleted&&f2[a[i]]>0)
            s.insert({f1[a[i]],a[i]});
        if(f2[a[i]]>0)
        {
            s.erase({f1[a[i]],a[i]});
            f1[a[i]]--;
            s.insert({f1[a[i]],a[i]});
        }
    }
    if(found)
    {
        cout<<"Yes\n";
        for(int i=1;i<=n;i++)
            cout<<sol[i]<<" ";
        return 0;
    }
    for(int i=1;i<=n;i++)
        f2[i]=aux[i];
    for(int i=1;i<=n;i++)
    {
        bool deleted=0;
        if(s2.find(a[i])!=s2.end())
        {
            s2.erase(a[i]);
            deleted=1;
        }
        if(s2.empty())
        {
            cout<<"No";
            return 0;
        }
        auto it=s2.end();
        it--;
        int nr=*it;
        sol[i]=nr;
        f2[nr]--;
        if(f2[nr]<=0)
            s2.erase(nr);
        if(deleted)
            s2.insert(a[i]);
    }
    cout<<"Yes\n";
    for(int i=1;i<=n;i++)
        cout<<sol[i]<<" ";
    return 0;
}


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

#define int long long

using namespace std;

int u[3001][101];
int ok[101];

int get (string a, char po) {
	memset (u, 0, sizeof u);
	memset (ok, 0, sizeof ok);
	int mn = 0;
	for (int i = 0;i < a.size ();i ++) {
		if (a[i] == po) mn ++;
	}
	if (mn == a.size ()) return 0;
	string ne = "";
	bool ko = 0;
	for (int i = 0;i < a.size ();i ++) {
		if (a[i] == po) {
			ok[i - 1] = 1;
			ok[i] = 1;
		}	
	}
	for (int i = 0;i < a.size () - 1;i ++) {
		if (ok[i] == 1) {
			ne += po;
		}
		else {
			ne += a[i];
		}
	}
	return get (ne, po) + 1;
}

 main () {
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	string a;
	cin  >> a;
	int anq = 1e9 + 7;
	for (char f = 'a';f <= 'z';f ++) {
		anq = min (anq, get (a, f));
	}
	cout << anq;
	return 0;
}


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

int main() {
    int a, b, c;
    int count=0;
    cin >> a >> b >> c;
    for(int i=a; i<=b; i++){
        if(c%i==0){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

// Scan and Debug
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F f, R... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

const int MAX = 100001;
int n, negc = 0,
	arr[MAX];
bool zero = false;
ll tot = 0;

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

	scan(n);

	for (int i = 0; i < n; ++i) {
		scan(arr[i]);
		negc += arr[i] < 0;
		zero |= arr[i] == 0;
		tot += abs(arr[i]);

		arr[i] = abs(arr[i]);
	}
	sort(arr, arr + n);

	if (zero || (negc % 2 == 0))
		cout << tot << "\n";
	else
		cout << tot - (arr[0] << 1) << "\n";

	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main(void){
  string S, T;
  cin >> S >> T;
  int N = S.size(), ans = 0;
  for(int i = 0; i < N; i++){
      if(S[i] != T[i]){
          ans++;
      }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3912
#include <iostream>
#include <map>
#define ll long long

using namespace std;

map <ll,int> mp;

int main()
{
    ll n,ans=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
       ll x;
       cin>>x;
       ans+=mp[i-x];
       mp[i+x]++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 26324
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}
const int N=555;
int a[N][N];

int32_t main(){
    int n;
    cin>>n;
    forn(i,n-1){
        for(int j=i+1;j<n;++j){
            int x=(i^j),ft;
            forn(b,32){
                if(x>>b&1){
                    ft=b;
                    break;
                }
            }
            cout<<ft+1<<' ';
        }
        cout<<'\n';
    }


    return 0;
}


Measured memory_bytes: 512
a = [int(input()) for _ in range(5)]
ans = 0
f = 0
for x in a:
    if x % 10:
        ans += x + 10 - x % 10
        f = 1
    else:
        ans += x
if f:
    ans -= 10
    ans += min([x % 10 for x in a if x % 10])
print(ans)


Measured memory_bytes: 2940
n=int(input())
A=sorted(map(int,input().split()))
B=sorted(map(int,input().split()))
C=sorted(map(int,input().split()))

def bisect_l(b):
    l=-1
    r=n
    while l+1<r:
        m=(l+r)//2
        if A[m]<b:
            l=m
        else:
            r=m
    return l

def bisect_r(b):
    l=-1
    r=n
    while l+1<r:
        m=(l+r)//2
        if C[m]>b:
            r=m
        else:
            l=m
    return r
r=0
for b in B:
    a=bisect_l(b)+1
    c=n-bisect_r(b)
    r+=a*c
print(r)

Measured memory_bytes: 105444
import java.util.Scanner;

public class Main {
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        for (int i = 1; i <= n; i++) {
            if (i % 3 == 0 || Integer.toString(i).contains("3")) {
                System.out.print(" "+i);
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 29464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sz(a) (int)(a.size())
const int N = 1005;
ll res = 0;
int merge(int a , int b , ll times)
{
	if(a == -1)
		return b;
	if(a + b >= 10)
	{
		res += 2 * times;
	}
	else
		res += times;
	return (a + b) / 10 + (a + b) % 10;
}
int solve(int digit , ll cnt)
{
	if(cnt == 1)
		return digit;
	if(cnt % 2 == 0)
	{
		return solve(merge(digit , digit , cnt / 2) , cnt / 2);
	}
	else
		return merge(solve(digit , cnt - 1) , digit , 1);
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	int curNumber = -1;
	
	for(int i = 0; i < n; i++)
	{
		int digit;
		ll cnt;
		cin >> digit >> cnt;
		curNumber = merge(curNumber , solve(digit , cnt) , 1);
	}
	cout << res;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const ll mod=1e+9;
typedef pair<ll,ll> P;
#define fi first
#define se second

int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int a,b;
cin>>a>>b;
if((abs(a-b))%2==1)cout<<"IMPOSSIBLE"<<endl;
else cout<<max(a,b)-(abs(a-b))/2<<endl;
}


Measured memory_bytes: 256
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && 0<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int ans=0;

  for(string s,t;cin>>s;){

    t=s;
    reverse(ALL(s));
    ans+=s==t;

  }

  cout<<ans<<endl;

  return 0;

}



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

int main(void){
    int n,m;
    cin >> n >> m;
    int a[m];
    map<int,int> mp;
    for(int i = 0;i < m;i++){
        cin >> a[i];
        mp[a[i]]++;
    }
    
    ll mod = 1e9+7;
    vector<ll> dp(n+1,0);
    
    dp[0] = 1;
    if(mp[1] != 1)dp[1] = 1;
    
    for(int i = 2;i <= n;i++){
        dp[i] = max(dp[i],dp[i-1] + dp[i-2]) % mod;
        if(mp[i] == 1)dp[i] = 0;
    }
    
    cout << dp[n] << endl;
}

Measured memory_bytes: 9060
# shortest path on line

n, m = map(int, input().split())

graph = {i: {} for i in range(1, n + 1)}

for i in range(1, n):
    graph[i + 1][i] = 0

for _ in range(m):
    l, r, c = map(int, input().split())
    if not (r in graph[l].keys()):
        graph[l][r] = c
    else:
        graph[l][r]=min(graph[l][r],c)


###############################################################

import heapq

def dijkstra(s, graph, n):
    # ｓからのグラフの最短最短距離をまとめたデータを返す
    dist = [10**20 for i in range(n + 1)]
    dist[s] = 0
    pq = []
    heapq.heapify(pq)
    # 全ての接点を一度優先度付きキューに挿入する
    heapq.heappush(pq, (0, s))
    while pq:
        x = heapq.heappop(pq)
        node, mini_dis = x[1], x[0]
        for point in graph[node].keys():
            w = graph[node][point]
            # nodeからpointに対して伸びる辺の長さ
            newlen = dist[node] + w
            if newlen < dist[point]:
                heapq.heappush(pq, (newlen, point))
                dist[point] = newlen

    return dist
###############################################################


A = dijkstra(1, graph, n)
if A[n]<10**20:
    print(A[n])
else:
    print(-1)


Measured memory_bytes: 101220
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint n;
llint a[105], b[105];
llint num[105][105];
llint dp[105];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i], a[i]--;
	
	llint mul = 1;
	for(int i = 1; i <= n; i++){
		mul *= modpow(2, max(0LL, a[i] - max(a[i-1], a[i+1]))), mul %= mod;
		a[i] = min(a[i], max(a[i-1], a[i+1]));
	}
	
	for(int i = 1; i <= n-1; i++) b[i] = min(a[i], a[i+1]);
	
	for(int l = 1; l <= n-1; l++){
		for(int r = 1; r <= n-1; r++){
			if(l > r) continue;
			llint sum = 0;
			for(int i = l-1; i <= r; i++){
				if(b[i+1] >= b[i]) sum += b[i+1]-b[i];
				else{
					llint d = b[i]-b[i+1], x = min(sum, d);
					num[l][r] += x, num[l][r] %= mod-1, sum -= x;
				}
			}
		}
	}
	
	dp[0] = 1;
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < i; j++){
			dp[i] += dp[j] * modpow(2, num[j+1][i-1]) % mod;
			dp[i] %= mod;
		}
	}
	
	llint ans = dp[n];
	ans *= mul, ans %= mod;
	ans *= 2, ans %= mod;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
'''ika tako  色は1～からの番号で表すとする。
適当な頂点①から、順に辺で繋がった頂点を探索し、辺の色を、
まだ使われてない最小の色で確定していけば、条件を満たすように作れる。
①--- 1 ---②--- 2 ---⑤
 |           `-- 3 ---⑥
 |--- 2 ---③--- 1 ---⑦
 |           `-- 3 ---⑧
 `--- 3 ---④--- 1 ---⑨
             `-- 2 ---⑩
木の場合は、根から順に確定する限り、相手先の頂点の他の辺が必ず
未確定である（後でその頂点の処理時に何とでも調整できる）ので、
この方法が使える。
'''
import sys
 
n = int(input())
links = [set() for _ in range(n)]
for i, line in enumerate(sys.stdin):
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add((i, b))
    links[b].add((i, a))

ans = [-1] * (n - 1)
k = max(map(len, links))
q = [(0, -1)]
fixed = set()
 
while q:
    v, c = q.pop()
    color = 1
    if c == color:
        color += 1
    for i, u in links[v]:
        if ans[i] != -1:
            continue
        ans[i] = color
        q.append((u, color))
        color += 1
        if c == color:
            color += 1
print(k)
print('\n'.join(map(str, ans)))

Measured memory_bytes: 57148
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
#define int long long
#define ls(x) ( x << 1 )
#define rs(x) ( x << 1 | 1 )
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 5e5 + 5 ; 
const int M = 2e4 + 5 ; 
char s[N] ; 
int n, m, a[N], b[N] ;
int tree[N] ;  
struct Tree {
	int w ; 
} tr[N << 2] ;
void build( int x, int l, int r ) {
	if( l == r ) {
		tr[x].w = ( 1ll << a[l] ) ;
		return ; 
	}
	int mid = ( l + r ) >> 1 ; 
	build( ls(x), l, mid ), build( rs(x), mid + 1, r ) ;
	tr[x].w = ( tr[ls(x)].w | tr[rs(x)].w ) ;
}
int query( int x, int l, int r, int ql, int qr ) {
	if( l >= ql &&  r <= qr ) return tr[x].w ;
	if( l > qr || r < ql ) return 0 ; 
	int mid = ( l + r ) >> 1 ;
	return ( query( ls(x), l, mid, ql, qr ) | query( rs(x), mid + 1, r, ql, qr ) ) ;
}
void change( int x, int l, int r, int wh, int c ) {
	if( l == r ) {
		tr[x].w = ( 1ll << c ) ;
		return ; 
	}
	int mid = ( l + r ) >> 1 ; 
	if( mid >= wh ) change( ls(x), l, mid, wh, c ) ;
	else change( rs(x), mid + 1, r, wh, c ) ;
	tr[x].w = ( tr[ls(x)].w | tr[rs(x)].w ) ;
}
signed main()
{
	n = gi(), scanf("%s", s + 1 ) ;
	m = gi() ; int opt, l, r ;
	char c ; 
	rep( i, 1, n ) a[i] = s[i] - 'a' ;
	build( 1, 1, n ) ;
	rep( i, 1, m ) {
		opt = gi(), l = gi() ; 
		if( opt == 1 ) {
			scanf("%c", &c ) ; 
			r = c - 'a', 
			change( 1, 1, n, l, r ) ;
		}
		else {
			r = gi() ; int ans = 0 ;
			int u = query( 1, 1, n, l, r ) ;
			rep( i, 0, 26 ) if( ( u >> i ) & 1 ) ++ ans ;
			printf("%lld\n", ans ) ;
		}
	}
	return 0 ;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(x) x.begin(),x.end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

int a,b,c,k;
ll solve(){
   ll ans=0;
   

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

    cin>>a>>b>>c>>k;
    while(b<=a){
        k--;
        b*=2;
    }

    while(c<=b){
        k--;
        c*=2;
    }
    if(k<0){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    //cout<<solve()<<endl;
    return 0;
}

Measured memory_bytes: 3636
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,k=gsmi
hp=desc gsmi

putsend 0 if n<=k

#hp[0,k]
puts sum hp[k..-1]

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N;
	vector<llong> A;
	map<llong,int> m;
	m[0]++;

	cin >> N;
	A.resize(N);
	llong sum = 0, ans = 0;
	for(int i = 0; i < N; i++){
		cin >> A[i];
		sum += A[i];
		ans += m[sum];
		m[sum]++;
	}

	cout << ans << endl;



	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n;
  rep(i,n){
    cin >> s;
    if(s[0] != '>'|| s.size() < 6 || s.size()%2 == 1|| (s[1] != '\'' && s[1] != '^') ){
      cout << "NA"<<endl;
    }
    else if(s[1] == '\''){
      int cnt = 0;
      bool f = true;
      REP(i,2,s.size()-1){
        if(s[i] == '#' && f){
          cnt *= -1;
          f = false;
        }
        else if(s[i] == '='){
          ++cnt;
        }
        else{
          cnt = -1;
          break;
        }
      }
      if(cnt != 0 || s[s.size()-1] != '~'){
        cout << "NA"<<endl;
      }
      else{
        cout << "A"<<endl;
      }
    }
    else{
      bool f = false;
      for(int i = 2; i < s.size(); i+=2){
        if(!(s[i] == 'Q' && s[i+1] == '=')){
          if(s[i] == '~' && s[i+1] == '~' && i == s.size()-2){
            cout << "B"<<endl;
            f = true;
          }
          else{
            break;
          }
        }
      }
      if(!f) cout << "NA"<<endl;
    }
  }
  return 0;
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

int main(){
#define int ll
  int n,k; cin >> n >> k;

  int ans = 0;
  FOR(a,1,n+1){
    if((a << 1) % k == 0){
      int tmp = int((n+a)/k) - int(a/k);
      ans += pow(tmp,2);
      dump(ans);
    }
  }
  cout << ans << endl;
}

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

const function<ll(ll, ll)> maxQll = [](ll l, ll r) { return max(l, r); };

template <typename T>
class SegmentTree {
	using func_t = function<T(T, T)>;
	const int n;
	const T id;
	func_t merge;
	vector<T> data;
	int size(int n) {
		int res;
		for (res = 1; res < n; res <<= 1);
		return res;
	}
public:
	SegmentTree(int n_, T id_, func_t merge_) :
		n(size(n_)), id(id_), merge(merge_), data(size(n_) * 2, id_) {}
	void Init(const vector<T>& data_) {
		for (int i = 0; i < (int)data_.size(); i++)
			data[i + n] = data_[i];
		for (int i = n - 1; i >= 0; i--)
			data[i] = merge(data[i * 2], data[i * 2 + 1]);
	}
	void Update(int p, T val) {
		p += n;
		data[p] = val;
		while (p >>= 1) data[p] = merge(data[p * 2], data[p * 2 + 1]);
	}
	void Add(int p, T val) {
		p += n;
		data[p] += val;
		while (p >>= 1) data[p] = merge(data[p * 2], data[p * 2 + 1]);
	}
	T Find(int i) {
		return data[i + n];
	}
	T Find(int l, int r) {
		if (r < l) return id;
		l += n; r += n + 1;
		T res1 = id, res2 = id;
		while (l != r) {
			if (l & 1) res1 = merge(res1, data[l++]);
			if (r & 1) res2 = merge(data[--r], res2);
			l >>= 1; r >>= 1;
		}
		return merge(res1, res2);
	}
};

int main()
{
	cin.sync_with_stdio(false);
	int n;
	cin >> n;
	SegmentTree<ll> st(n, 0, maxQll);
	for (int i = 0, x; i < n; i++) {
		cin >> x; x--;
		st.Update(x, st.Find(0, x - 1) + x + 1);
	}
	cout << (ll)n * (n + 1) / 2 - st.Find(0, n - 1) << endl;
	return 0;
}

Measured memory_bytes: 4940
#include <iostream>

using namespace std;

int main(){
    int n,m,x,i=0;
    int lmax=1,rlow=100000;
    scanf("%d %d",&n,&m);
    x=m;
    for(int i=0;i<x;i++){
        int l,r;
        cin >> l >> r;
        if(lmax<l){
            lmax=l;
        }
        if(r<rlow){
            rlow=r;
        }
    }
    if((rlow-lmax)<0){
        printf("0\n");
    }else{
    printf("%d\n",rlow-lmax+1);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main() {
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  vector<int> res;
  reverse(s.begin(), s.end());
  int cnt = -1;
  int prev = 0;
  for (int i = 0; i < n+1; i++) {
    int ng = s[i] - '0';
    ++cnt;
    //cout << i << " " << cnt << endl;
    if (cnt <= m && !ng) prev = cnt;
    
    if (cnt == m){
      if (prev == 0) {
        cout << -1 << endl;
        return 0;
      }
      res.emplace_back(prev);
      cnt -= prev;
      prev = 0;
    }

  }
  
  if (cnt != 0) res.emplace_back(cnt);
  reverse(res.begin(), res.end());
  for (auto e : res) cout << e << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 1144
n, m = [int(x) for x in input().split()]
f_set = set()
t_set = set()
for _ in range(m):
    a, b = [int(x) for x in input().split()]
    if a == 1:
        f_set.add(b)
    elif b == n:
        t_set.add(a)
print("POSSIBLE" if len(f_set & t_set) >= 1 else "IMPOSSIBLE")

Measured memory_bytes: 24104
n = int(input())
t_p = 0
h_p = 0
for i in range(n):
    t_w, h_w= input().split()
    if t_w > h_w:
        t_p += 3
    elif t_w < h_w:
        h_p += 3
    else:
        t_p += 1
        h_p += 1
print(t_p, h_p)


Measured memory_bytes: 5596
import sys
read = sys.stdin.read
def main():
    k, n = map(int, input().split())
    a = tuple(map(int, input().split()))
    dis_max = (k - a[-1]) + a[0]
    for i1 in range(1, n):
        dis = a[i1] - a[i1-1]
        dis_max = max(dis_max, dis)
    print(k - dis_max)
if __name__ == '__main__':
    main()


Measured memory_bytes: 33344
#d...縦で入力された複数の要素を配列で取得
n = int(input())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
a = [int(m) for m in d]#int型に直す

for i in range(n):
    if i == 0:
        k = a[i]
    else:
        k = a[k - 1]
    if k == 2:
        print(i + 1)
        exit()
print(-1)

Measured memory_bytes: 13356
def root1():
    """Xから0までのルートでかかる費用を求める
    """
    cost = 0
    for fee_station in fee_station_list:
        if fee_station < X:
            cost += 1

    return cost


def root2():
    """XからNまでのルートでかかる費用を求める
    """
    cost = 0
    for fee_station in fee_station_list:
        if X < fee_station < N:
            cost += 1

    return cost


N, M, X = map(int, input().split())
fee_station_list = list(map(int, input().split()))

cost1 = root1()
cost2 = root2()

print(min(cost1, cost2))


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

int main() {
	int n;
	string s;
	cin >> n >> s;

	int ans = 1;
	for (int i = 0; i < n - 1; i++) {
		if (s.at(i) != s.at(i+1)) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(){
	char l='A',c1,c2;
	while(scanf("%c,%c",&c1,&c2)!=EOF){
		if(c1==l)l=c2;
		else if(c2==l)l=c1;
	}
	printf("%c\n",l);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
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 N;
    cin>>N;
    vector<int> B(N-1);
    rep(i,N-1) cin>>B.at(i);
    vector<int> A(N);
    ll ans=0;
    rep(i,N){
        if(i==0) A.at(i)=B.at(i);
        if(0<i && i<N-1) A.at(i)=min(B.at(i-1),B.at(i));
        if(i==N-1) A.at(i)=B.at(i-1);
    }
    rep(i,N) ans+=A.at(i);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solvetask(){
    int n; cin >> n;
    vector<long long> a(n);
    long long mx = 0, ans = 0;
    for (int i=0; i<n; i++){
        cin >> a[i];
        ans += max(0LL, mx - a[i]);
        mx = max(a[i], mx);
    }
    cout << ans << endl;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1; //cin >> t;
    while(t--) solvetask();
}

Measured memory_bytes: 4784
import java.util.Scanner;
import java.util.ArrayList;
import java.util.LinkedList;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int[] dg=new int[n];
		ArrayList<Integer>[] list=new ArrayList[n];
		for(int i=0; i<n; i++){
			list[i]=new ArrayList<>();
		}
		for(int i=0; i<n+m-1; i++){
			int a =sc.nextInt()-1;
			int b =sc.nextInt()-1;
			dg[b]++;
			list[a].add(b);
		}
		int root=0;
		for(int i=0; i<n; i++){
			if(dg[i]==0){
				root=i;
				break;
			}
		}
		int[] ans=new int[n];
		LinkedList<Integer> que=new LinkedList<>();
		que.add(root);
		while(!que.isEmpty()){
			int g=que.poll();
			for(int i:list[g]){
				dg[i]--;
				if(dg[i]==0){
					ans[i]=g+1;
					que.add(i);
				}
			}
		}
		for(int i=0; i<n; i++){
			System.out.println(ans[i]);
		}
	}
}


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

#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define sec second
#define fori(i, a, b) for(int i = int(a); i < int(b); i++)
#define cc(x)	cout << #x << " = " << x << endl
#define ok		cout << "ok" << endl

typedef pair<int,int> ii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

const long long N = 1e5 + 10; 
long long n, k, cost[N];
long long dp[N];

long long pog(long long at, long long n, long long k){
	if(at >= n) return 0;

	long long &r = dp[at];
	if(r != -1) return r;
	
	if(k == 1) r = pog(at+1, n, k) + abs(cost[at+1]-cost[at]);

	if(k != 1){
		long long L = pog(at+1, n, k) + abs(cost[at+1]-cost[at]);
		long long R = pog(at+2, n, k) + abs(cost[at+2]-cost[at]);

		r = min(L, R);

		for(int i = 3; i <= k; i++)
			r = min(r, pog(at+i, n, k) + abs(cost[at+i]-cost[at]));
	}	
	return r;
}

int main(){
	ios_base::sync_with_stdio(false);

	memset(dp, -1, sizeof dp);
	cin >>n >>k;

	for(int i = 1; i <= n; i++)
		cin >>cost[i];
	
  	for(int i = 1; i <= k; i++)
      	cost[n+i] = INF;
	
	cout <<pog(1, n, k) <<endl;
	return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <stack>

using namespace std;

struct rect {
    int pos, height;
};

int main() {

    int H, W;
    cin >> H >> W;

    int T[H][W];

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            int c;
            cin >> c;
            if (i == 0) {
                T[i][j] = (c ? 0 : 1);
            } else {
                T[i][j] = (c ? 0 : T[i - 1][j] + 1);
            }
        }
    }

    //solve
    int ans = 0;

    for (int i = 0; i < H; i++) {
        stack<rect> stk;
        for (int j = 0; j <= W; j++) {
            int pos, height;
            pos = j;
            if (j == W) {
                height = 0;
            } else {
                height = T[i][j];
            }
            if (stk.empty() || stk.top().height < height) {
                stk.push((rect) {pos, height});
            } else if (stk.top().height > height) {
                while (!stk.empty() && stk.top().height >= height) {
                    rect &pre = stk.top();
                    stk.pop();
                    ans = max(ans, pre.height * (j - pre.pos));
                    pos = pre.pos;
                }
                stk.push((rect) {pos, height});
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 10652
import java.math.BigDecimal;
import java.util.Scanner;
 
class Main {
 
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();

        int d = a / b;
        int r = a % b;
        double f = 1.0 * a / b;
        BigDecimal g = new BigDecimal(f);
        g = g.setScale(5,BigDecimal.ROUND_HALF_UP);
        System.out.printf("%d" + " " + "%d" + " " + "%.5f",d, r, g);
    }
}

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

using namespace std;

typedef long long llint;

const llint INF = 1e13;

llint n, s, sol = INF;
vector <llint> v;

llint f (llint b, llint x) {
    if (x < b) return x;
    return f(b, x / b) + x % b;
}

void gen () {
    if (n == s) v.push_back(n + 1);
    for (llint i=2; i * i <= n; i++) {
        v.push_back(i);
    }
    llint val = n - s;
    if (val <= 0) return;
    for (llint d = 1; d * d <= val; d++) {
        if (val % d == 0) {
            v.push_back(d + 1);
            v.push_back(val / d + 1);
        }
    }
}

int main () {
    cin >> n >> s;
    gen();
    for (auto b : v) {
        if (f(b, n) == s && b < sol) {
            sol = b;
        }
    }
    if (sol == INF) cout << -1; else cout << sol;
    return 0;
}


Measured memory_bytes: 6384
// author -> LetsGoAc
#include "bits/stdc++.h"
using    namespace std;
typedef  long double ld;
#define  int long long
typedef  pair<int,int> pii;
#define  RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  rep(i,n) for(i=0; i <n; i++)
#define  repv(i,k,n) for(int i=k; i<=n; i++)
#define  pb push_back
#define  mp make_pair
#define  F  first
#define  S  second
#define  sz(x)  (int)x.size()
#define  all(v) v.begin(),v.end()
#define  endl '\n'
#define  deb(x) c out<<#x<<" = "<<x<<endl
#define  gcd   __gcd
#define  inf   LLONG_MAX
#define  minf  LLONG_MIN 
#define  gi  greater<int> 
#define  gpi greater<pii>  
#define  sp(n) fixed<<setprecision(n)
const int mod = (int)(1e9+7);
int power(int x,int n)
{   
    if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}
int pct(int x)
{   return __builtin_popcountll(x);}
int  lcm(int a,int b){return a*b/gcd(a,b);}
bool is_power_2(int n){ return log2(n)==floor(log2(n));}
bool is_prime(int n){for(int i=2; i*i<=n; i++)if(n%i==0)return 0; return 1;}
void db()
{   
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
void timeit()
{  
    #ifndef ONLINE_JUDGE
        cout<<"\nTime Elapsed: " <<sp(5)<< 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}
int     dx []    =  {-1 , 0 , 1 , 0 ,-1,-1, 1,  1};
int     dy []    =  { 0 , 1 , 0 ,-1 ,-1, 1, 1, -1};
char    dir[]    =  {'U','R','D','L'};
/* ---------------------- 1.cpp --------------------------------- */
const int maxn = 1e6+5;
void solve(int tc)
{
    // cout<<"Case #"<<tc<<": ";
    int n,i,j,k,m,q,l,r;
    cin>>n>>m;
    k = 0;
    m*=m;
    rep(i,n)
    {
        int a,b;
        cin>>a>>b;
        int temp = a*a + b*b;
        if(temp <= m)
            k++;
    }
    cout<<k;
}   
signed main()
{
    // 1.cpp
    RAGE;
  //  db();    
    int t=1;
    //cin>>t;
    for(int i=1; i<=t; i++)
    {
        solve(i);
    }
  //  timeit();
    return 0;
}
/*
    1. To find 2's complement , reverse all the bits after 1st set bit. (right - >left.)

*/

Measured memory_bytes: 3688
using System;
     
    namespace abc076_c
    {
        class Program
        {
            static void Main(string[] args)
            {
                string s = Console.ReadLine();
                string t = Console.ReadLine();
                string ret = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
                for (int i = 0; i <= s.Length - t.Length; i++)
                {
                    bool flag = true;
                    char[] now = s.ToCharArray();
                    for (int j = 0; j < t.Length; j++)
                    {
                        if (s[i + j] != '?' && s[i + j] != t[j])
                        {
                            flag = false;
                        }
                        else
                        {
                            now[i + j] = t[j];
                        }
                    }
                    string x = null;
                    for (int j = 0; j < now.Length; j++)
                    {
                        x += now[j];
                    }
                    if (flag)
                    {
                        ret = ret.CompareTo(x) > 0 ? x : ret;
                    }
                }
                Console.WriteLine(ret == "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ" ? "UNRESTORABLE" : ret.Replace('?', 'a'));
            }
        }
    }

Measured memory_bytes: 13404
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

int n, a, b;
long long ct;
vector <pair<int, int>> v;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}
int main() {
    cin >> n;
    ct = 0;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        v.push_back({a, b});
    } 
    ct = 0;
    sort(v.begin(), v.end(), compare_by_b);
    for (int i = 0; i < n; i++) {
        ct += v[i].first;
        if (ct > v[i].second) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 4992
S = input().strip()
C = {"N":0,"S":0,"E":0,"W":0}
for i in range(len(S)):
    C[S[i]] += 1
if (C["N"]*C["S"]>0 or (C["N"]==0 and C["S"]==0)) and (C["E"]*C["W"]>0 or (C["E"]==0 and C["W"]==0)):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ll long long
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

int main()
{
    int n;

    cin >> n;

    cout << "ABC" << n << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll res[52][52];
ll x[52][52];
ll mod=1e9L+7;
ll n;
void mul_r()
{
	ll i,j,k;
	ll temp[52][52]={0};
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			for(k=0;k<n;k++)
				temp[i][j]=(temp[i][j]+(x[i][k]*res[k][j])%mod)%mod;
		}
	}
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
			res[i][j]=temp[i][j];
}
void mul_x()
{
	ll i,j,k;
	ll temp[52][52]={0};
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			for(k=0;k<n;k++)
				temp[i][j]=(temp[i][j]+(x[i][k]*x[k][j])%mod)%mod;
		}
	}
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
			x[i][j]=temp[i][j];
}
void print_res()
{
	ll i,j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
			cout<<res[i][j]<<" ";
		cout<<"\n";
		}
}
void print_x()
{
	ll i,j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
			cout<<x[i][j]<<" ";
		cout<<"\n";
		}
}
void f(ll y)
{
	while(y)
	{
		/*cout<<"y= "<<y<<"\n";
		if(1&y)
		{
		cout<<"before\n";
		print_res();
		cout<<"\n\n after\n";
		mul_r();
		print_res();
		cout<<"\n\n";
		}
		y/=2;
		//print_x();
		cout<<"before x \n";
		print_x();
		mul_x();
		cout<<"\n\n after x\n";
		print_x();
		cout<<"\n\n";*/
		if(1&y)
			mul_r();
		y/=2;
		mul_x();
	}
}
int main()
{
	ll k;
	cin>>n>>k;
	ll i,j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			cin>>x[i][j];
			if(i==j)
				res[i][j]=1;
		}
		
	}
	ll ans=0;
	f(k);
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			//cout<<res[i][j]<<" ";
			ans=(ans+res[i][j])%mod;
		}
	//	cout<<"\n";
	}
	cout<<ans;
	return 0;
}

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

int main(void){
    int N, Abuf;
    multiset<int> A;
    bool IfDistinct = true;

    cin >> N;
    for(int i=0; i<N; i++){
        cin >> Abuf;
        if(IfDistinct){
            if(A.find(Abuf) != A.end()){
                IfDistinct = false;
            }else{
                A.insert(Abuf);
            }
        }
    }

    if(IfDistinct){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 9600
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==1) a=14;
    if(b==1) b=14;
    if(a>b) puts("Alice");
    else if(a<b) puts("Bob");
    else puts("Draw");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(int n)
{
	int count = 0;

	while (n > 0)
	{
		n /= 10;

		count++;
	}
	return count;
}
int digit(int n)
{

	int ans = 0;
	while (n > 0)
	{
		ans += n % 10;
		n /= 10;
	}
	return ans;
}
ll combination(ll n, ll r)
{
	if (r * 2 > n)
		r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i)
	{
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}
vector<int> divisor(int n)
{
	vector<int> value;
	FOR(i, 1, pow(n, 0.5) + 1)
	{
		if (i <= sqrt(n))
		{
			if (n % i == 0)
			{
				value.push_back(i);
				if (i * i != n)
				{
					value.push_back(n / i);
				}
			}
		}
	}
	return value;
}

int main()
{
	int n,p;
	cin >> n>>p;
	int even=0,odd=0;
	rep(i,n){
		int a;
		cin>> a;
		if(a%2==0){
			even++;
		}else{
			odd++;
		}
	}
	ll ans=0;
	rep(i,odd+1){
		if(i%2==0){
		 ans+=combination(odd,i);
		}
	}
	//cout<<ans<<endl;
	ans=ans*pow(2,even);
	if(p==1){
		ans=powl(2,n)-ans;
	}
	cout<<ans<<endl;
	
	
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
	Scanner sc = new Scanner (System.in);
	long inputA = sc.nextLong();
	long inputB = sc.nextLong();
	long inputK = sc.nextLong();

	if(inputA >= inputK){
		inputA = inputA - inputK;
		inputK = 0;
	}else{
		inputK = inputK - inputA;
		inputA = 0;
	}

	if(inputK > 0){
		if(inputB >= inputK){
			inputB = inputB - inputK;
			inputK = 0;
		}else{
			inputK = 0;
			inputB = 0;
		}
	}

	System.out.println(inputA + " " + inputB);
}
}


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

int a, b;
int gcd(int x, int y)
{
    if(x < y)   swap(x,y);
    int r;
    while(y>0)
    {
        r = x%y;
        x = y;
        y = r;
    }
    return x;
}
int main()
{
    cin >> a >> b;
    cout << gcd(a,b) << endl;
    return 0;
}

Measured memory_bytes: 3068
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)1e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
vvi g(mxn+1);bool vis[mxn+1];vi t;
void topo(int i){
	vis[i]=1;
	for(auto j:g[i]) if(!vis[j]) topo(j);
	t.pb(i);
}
int main(){
	int n,m,u,v,i;cin>>n>>m;for(i=0;i<m;i++) cin>>u>>v,g[u].pb(v);
	for(i=1;i<=n;i++) if(!vis[i]) topo(i);vi d(n+1,0);
	reverse(all(t));for(i=0;i<n;i++) for(auto j:g[t[i]]) d[j]=max(d[j],d[t[i]]+1);
	cout<<*max_element(all(d))<<endl;
}


Measured memory_bytes: 9588
package main

import (
	"io"
	"os"

	"fmt"
)

func solve1(n int) int {
	if n%2 == 0 {
		return n
	}

	return n * 2
}

func Solve(in io.Reader, out io.Writer) {
	var n int
	fmt.Fscan(in, &n)

	fmt.Fprintln(out, solve1(n))
}

func main() {
	Solve(os.Stdin, os.Stdout)
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    int n,e=0,o=0;
    cin >> n;

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a&1) {
            o++;
        }else{
            e++;
        }
    }

    cout << (int)(pow(3,n) - pow(2,e)) << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256