akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int N,a,b,ans=0;
	vector<int> hoge,fuga;
	cin>>N;
	for(int i=0;i<N;i++){
		b=i%2;
		cin>>a;
		if(b==a){
			hoge.push_back(0);
		}else{
			hoge.push_back(1);
		}
	}
	int check=hoge[0],seq=0;
	for(int i=0;i<N;i++){
		if(hoge[i]==check){seq++;
			if(i==N-1)fuga.push_back(seq);
		}else{
			fuga.push_back(seq);
			if(i==N-1)fuga.push_back(1);
			seq=1;
			check=hoge[i];
		}
		
	}
	fuga.push_back(0);
	fuga.push_back(0);//????´???°3?????????
	for(int i=0;i<fuga.size()-2;i++){
		ans=max(ans,fuga[i]+fuga[i+1]+fuga[i+2]);
		//cout<<fuga[i]<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1800
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	ans := "Good"
	for i := 0; i < len(s)-1; i++ {
		if s[i] == s[i+1] {
			ans = "Bad"
		}
	}
	fmt.Println(ans)
}


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

typedef vector<int> Adj_list;
typedef vector<Adj_list> Adj_lists;

void bfs(const int& i, const Adj_lists& adj_lists, vector<int>& distances){

  distances.at(i-1) = 0;

  queue<int> q;
  q.push(i);

  while(!q.empty()){
    // visit top of queue
    const int& visit = q.front();
    const Adj_list& adj_list = adj_lists.at(visit-1);

    // push adjecent node which is not visited yet
    for(const int& adj : adj_list){
      if(distances.at(adj-1) == -1){
        distances.at(adj-1) = distances.at(visit-1) + 1;
        q.push(adj);
      }
    }

    q.pop();
  }
}

int main(){

  int n;
  scanf("%d", &n);

  Adj_lists adj_lists(n);
  for(int i=0; i<n; i++){
    int u, k;
    scanf("%d %d", &u, &k);
    Adj_list adj_list(k);
    for(int j=0; j<k; j++){
      int v;
      scanf("%d", &v);
      adj_list[j] = v;
    }
    sort(adj_list.begin(), adj_list.end());
    adj_lists[u-1] = adj_list;
  }

  vector<int> distances(n);
  for(int& distance : distances) distance = -1;

  bfs(1, adj_lists, distances);

  for(int i = 0; i < distances.size(); i++){
    printf("%d %d\n", i+1, distances.at(i));
  }

  return 0;
}



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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

typedef long long ll;

using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    // g は無向グラフ
    vector<int> g[N];
    REP(i, M)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    int st = 0, goal = N - 1;
    bool success = false;
     // 二分探索のためにg[goal] をソートする
     sort(g[goal].begin(), g[goal].end());

    REP(i, g[st].size())
    {
        int node = g[st][i];
        if (g[goal].size() != 0)
        {
            // 二分探索を行う
            int min = 0, max = g[goal].size() - 1;
            int half = (min + max) / 2;
            if (half == 0)
            {
                if (g[goal][min] == node || g[goal][max] == node)
                {
                    success = true;
                }
            }
            else
            {
                while(true)
                {
                    if (half == min)
                    {
                        if (g[goal][max] == node)
                        {
                            success = true;
                        }
                        break;
                    }

                    if (g[goal][half] == node) 
                    {
                        success = true;
                        break;
                    }
                    else
                    {
                        if (g[goal][half] > node)
                        {
                            max = half;
                        }
                        else
                        {
                            min = half;
                        }
                    }
                    half = (min + max) / 2;
                }
            }
        }
    }

    string ans;
    if (success)
    {
        ans = "POSSIBLE";
    }
    else
    {
        ans = "IMPOSSIBLE";
    }

    cout << ans << endl;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repc(i, a, b) for(int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;



int main() {
  int n;
  cin >> n;
  ll k;
  cin >> k;
  vec<int> a(n+1);
  vec<int> visit(n+1, 0);
  repc(i, 1, n) cin >> a[i];  

  int len = 0;
  int now;
  int next = 1;
  repc(i, 1, n) {
    now = next;
    len++;
    visit[now] = len;
    next = a[now];
    if(len == k) {
      cout << next << endl;
      return 0;
    }
    if(visit[next] != 0) break;
  }
  
  int loop = len - visit[next] + 1;
  k -= visit[next] - 1;
  k %= loop;
  repc(i, 1, k) {
    now = next;
    next = a[now];
  }
  cout << next << endl;
  return 0;
}

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

int main(void) {
    double x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    double ans=0.0;
    ans=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    printf("%.8f\n",ans);
    return 0;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    vector<int>d(n);
    for(int i=0;i<n;i++){
        cin>>d.at(i);
        }
    if(n<=k){cout<<0<<endl;
                return 0;
                }
    sort(d.begin(),d.end());
    reverse(d.begin(),d.end());
    long long int ans=0;
    for(int i=k;i<n;i++){
        ans+=(long long int)d.at(i);
        }
    cout<<ans<<endl;
    }


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define MAXX 500005
#define PI 3.14159265358979323846264338327950
#define F first
#define S second
#define ll  long long int
#define mod  1000000007



int main()
{
	FAST;
	ll n, m;
	cin >> n >> m;
	vector<ll> v;
	for(ll i = 1; i * i < m; i ++){
		if(m % i == 0){
			v.push_back(i);
			v.push_back(m / i);
		}
	}
	if(floor(sqrt(m)) == ceil(sqrt(m))){
		v.push_back(sqrt(m));
	}
	sort(v.begin(), v.end());
	for(ll i = 0; i < v.size(); i ++){
		ll x = v[i];
		if(n <= v[i]){
			cout << m / v[i]; return 0;
		}
	}
	cout  << 1;
}

Measured memory_bytes: 3684
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;



int main() {
	int n, k;
	cin >> n >> k;
	int dig = 0;
	while (n > 0) {
		dig++;
		n /= k;
	}
	cout << dig << endl;
}



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

int main() {
    int n, amax = 0, amin = 1e6;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
        amax = max(amax, a[i]);
        amin = min(amin, a[i]);
    }
    if (amax - amin >= 2) {
        puts("No");
        return 0;
    }

    if (amax - amin == 0) {
        bool can1 = true, can2 = true;
        rep(i, n) {
            if (a[i] != n - 1) can1 = false;
            if (2 * a[i] > n) can2 = false;
        }
        puts((can1 || can2) ? "Yes" : "No");
        return 0;
    }
    int x = 0, y = 0;
    rep(i, n) {
        if (a[i] == amax - 1)
            x++;
        else if (a[i] == amax)
            y++;
    }
    puts((x + y == n && x < amax && 2 * (amax - x) <= y) ? "Yes" : "No");
}

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

ifstream f("date.in");
ofstream g("date.out");

const int NMax = 1e6 + 5;
const int mod = 1e9 + 7;

long long produs(long long a[], long long n)
{
	long long p = 1;
	for(int i = 1; i <= n; ++i) {
		p *= a[i];
	}

	return p;
}

int main()
{
	long long n, a[105];
	long long b[105];

	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
		b[i] = a[i] - 2;
	}

	int nr = 0;

    if(n == 1) {
        cout << 1;
        return 0;
    }

    int i = 1;
    while(i > 0)
    {
        b[i]++;
        if(abs(b[i] - a[i]) > 1)
        {
            b[i] = a[i] - 2;
            i--;
        }
        else {
            if(i == n){
                if(produs(b, n) % 2 == 0)
                    nr++;
            }
            else
                i++;
        }
    }

    cout << nr;

	return 0;
}


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

int main(int argc, char **argv)
{
    char S[10], T[10], U[10];
    int A, B;

    cin >> S >> T >> A >> B >> U;

    if (strcmp(S, U) == 0) cout << A - 1 << " " << B;
    else cout << A << " " << B - 1;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define endl "\n"
#define int ll
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef unsigned long long ull;

const int inf = 1e9 + 5;
const long double PI = 3.141592653589793;

void solve(){
  int n;
  cin>>n;
  int ans = 0;
  int k;
  for(int i=2;i*i<=n;i++){
    if(n%i==0){
      k = 0;
      while(n%i==0){
        n/=i;
        k++;
      }
      for(int j=1;j<10000;j++){
        if(k>=j){
          k-=j;
          ans++;
        }
        else{
          break;
        }
      }
    }
  }
  if(n>1){
    ans++;
  }
  cout<<ans<<endl;
}  
signed main(){
  fast;
  int t;
  //cin>>t;
  t = 1;
  while(t--){
    solve();
  }
}
/*
░░░░░░░░░░▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░██▀█▄░░▄██▀░░░░▄██▄░░░░░░░░░░░
░░░░░░░░██▄▄▄████████▄▄█▀░▀█░░░░░░░░░░░
░░░░░░░▄██████████████████▄█░░░░░░░░░░░
░░░░░░▄██████████████████████░░░░░░░░░░
░░░░░▄████████▀░▀█████████████░░░░░░░░░
░░░░░███████▀░░░░▀████████████▄░░░░░░░░
░░░░██████▀░░░░░░░░▀███████████▄▄▄▀▀▄░░
░▄▀▀████▀░░░▄▄░░░░░░░░░████████░░░░░█░░
█░░░▀█▀█░░░░▀▀░░░░░░██░░███░██▀░░░░▄▀░░
█░░░░▀██▄░░░▄░░░▀░░░▄░░░███░██▄▄▄▀▀░░░░
░▀▄▄▄▄███▄░░▀▄▄▄▀▄▄▄▀░░░███░█░░░░░░░░░░
░░░░░░████▄░░░░░░░░░░░░▄██░█░░░░░░░░▄▀▀
░░░░░░███▀▀█▀▄▄▄▄▄▄▄▄▄▀█████░░░░░░▄▀░░▄
░░░░░░█▀░░█░▀▄▄▄▄▄▄▄▄▄▀░███░█▀▀▀▄▀░░▄▀░
░░░░░░░░░▄▀░░░░░░░░░░░░░▀█▀░░█░░░░█▀░░░
░░░░░░░░░█░░░█░░░░░░░░░░░░░░░█░░░░░█░░░
░░░░░░░░░█▄▄█░▀▄░░█▄░░░░░░░░█░░▄█░░█░░░
░░░░░░░░░▀▄▄▀░░█▀▀█░▀▀▀▀█▀▀█▀▀▀▀█░█░░░░
hOi!!
I'm TemMie
*/

Measured memory_bytes: 3580
import sys
readline = sys.stdin.readline
from math import floor, log

def main():
    N = int(readline())
    dp = [i for i in range(N+1)]
    for i in range(N):
        dp[i+1] = min(dp[i+1], dp[i]+1)
        log9 = floor(log(N-i, 9))
        for e in range(1, log9+2):
            if i + 9**e <= N:
	            dp[i+9**e] = min(dp[i+9**e], dp[i]+1)
        log6 = floor(log(N-i, 6))
        for e in range(1, log6+2):
            if i + 6**e <= N:
            	dp[i+6**e] = min(dp[i+6**e], dp[i]+1)
    
    print(dp[N])


if __name__ == '__main__':
    main()


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

typedef long long ll;
constexpr ll MOD = ll(1e9+7);

ll power(ll x, ll n){
    ll res = 1;
    while(n > 0){
        if(n&1){
            res = res * x % MOD;
        }
        x = x*x % MOD;
        n >>= 1;
    }
    return res;
}

int main(){
    ll m, n, sum[10]{};
    string c;
    cin >> m >> c;
    n = c.size();
    for(int i=0;i<n;i++){
        sum[c[i]-'0'] += power(10,n-i-1);
        sum[c[i]-'0'] %= MOD;
    }
    vector<int> v(10);
    for(int i=0;i<=9;i++) v[i] = i;
    while(1){
        ll r = 0;
        for(int i=0;i<=9;i++){
            r += sum[i] * v[i];
            r %= MOD;
        }
        if(r == m && (v[c[0]-'0'] > 0 || n == 1)){
            for(int i=0;i<n;i++){
                cout << v[c[i]-'0'];
            }
            cout << endl;
            return 0;
        }
        if(!next_permutation(v.begin(),v.end())) break;
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3340
#include <iostream>
using namespace std;
int N, K, h, total;
int main() {
    cin >> N >> K;
    for (int i=1; i<=N; i++){
        while(cin >>h){
            if(h>=K){
                total++;
            }
        }
    }
    cout << total << endl;
    return 0;
}


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

#define rep(i,n) for(int i= 0; i < n; i++)
const int INF = 1 << 30;
int dp[2][10001][2];// dp[i][j][k] iÄÜÅÅjÂªWÌÜÜêÅãÌâÂªüÁÄ¢é©
int nums[10010];

int main(){
  int n;
  cin >> n;
  fill(&dp[0][0][0], &dp[1][10000][1] + 1, INF);
  rep(i, n-1) cin >> nums[i];
  dp[0][1][1] = 0; 
  dp[0][0][0] = 0;
  rep(i, n-1){
    dp[(i+1)%2][0][0] = dp[i%2][0][0];
    rep(j, i+1){
      dp[(i+1)%2][j+1][1] = min(dp[i%2][j][1], dp[i%2][j][0] + nums[i]);
      dp[(i+1)%2][j+1][0] = min(dp[i%2][j+1][0], dp[i%2][j+1][1] + nums[i]);
    }
    fill(&dp[i%2][0][0], &dp[i%2][10000][1]+1, INF);
  }
  cout << min(dp[1][n/2][0], dp[1][n/2][1]) << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long
#define ld long double

#define mod 1000000007
#define EULER 2.7182818284
#define INF 1000000000

#define pb push_back
#define ins insert
#define IT iterator
#define PQ priority_queue

#define fi first
#define se second
#define maxe max_element
#define mine min_element
#define er erase
#define lb lower_bound
#define ub upper_bound

#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>


#define mem(v,i) memset(v,i,sizeof(v)) // v is array. To set all elements to 0 or -1 only. mem(arr,0);


#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORd(i,a,b) for(int i=(a);i>=(b);i--)
#define FORl(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORN(i,n) for(int i=(0);i<(n);i++)
#define FORR(i,n) for(int i=(n);i>=0;i--)
#define bs bitset
#define bpc(a) __builtin_popcount(a)

ll max(ll a,ll b)
{
    if(a>b)return a;return b;
}
ll min(ll a,ll b)
{
    if(a<b)return a;return b;
}

ll mypow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
//..............................!!!!!!Get ready to fight!!!!!!............................

//vector<ll>vec[200005];

int main()
{
    fast
    
    ll i,j,p,k;
    cin>>k;
    ll sum=0;
    for(i=1;i<=k;i++)
    {
        for(j=1;j<=k;j++)
        {
            for(p=1;p<=k;p++)
            {
                sum+=gcd(gcd(i,j),p);
            }
        }
    }
    cout<<sum<<"\n";
    
    
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
#define REP(i,m,n) for(int i = (int)(m) ; i < (int) (n);i++)
#define rep(i,n) REP(i , 0 ,n)
using namespace std;

int a, b;


int main() {
	cin >> a >> b;
	if (a <= b * 2){
		cout << 0 << endl;
	}
	else cout << a - b * 2 << endl;





	return 0;
}


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

int movei[] = {0, 0, 1, -1, 1, 1, -1, -1};
int movej[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int N = 1e5+1;

bool equal(deque<char> &v, string &s){
    for(int i = 0; i<v.size(); i++){
        if(v[i] != s[i])
            return false;
    }
    return true;
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

    string s,t;
    cin >> s >> t;

    deque<char> v;
    int n = s.size();
    for(int i = 0; i<n; i++)
        v.push_back(s[i]);

    bool flag = false;
    while(n--){
        if(equal(v, t)){
            flag = true;
            break;
        }
        char c = v.back();
        v.pop_back();
        v.push_front(c);
    }
    cout << (flag ? "Yes" : "No");
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    if(s.size() == 1){
        cout << s << endl;
    }else{
        ll ans = 0;
        for(int i = 0; i < (1 << s.size()-1); i++){
            string t = s;
            rep(j, s.size()-1){
                if(i & (1 << j)){
                    string sub = t.substr(s.size()-1-j, t.size()-s.size()+j+1);
                    ans += stol(sub);
                    t = t.substr(0, s.size()-1-j);
                }
            }
            ans += stol(t);
        }
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
    long long int a[100100],i,n;
    scanf("%lld",&n);
    a[0]=1;
    a[1]=1;
    for(i=2;i<=100000;i++)
    {
        a[i]=a[i-1]*i;
        a[i]=a[i]%1000000007;
    }
    printf("%lld",a[n]);
    return 0;
}

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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, x, a[114];
	cin>>n>>x;
	REP(i, n){
		cin>>a[i];
	}
	sort(a, a+n);
	int ans=0;
	while(ans<n && x>0){
		x-=a[ans];
		++ans;
	}
	if(x!=0){
		--ans;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

struct node {
	int parent;
	int leftChild;
	int right;
};

int checkDepth(node *nodes, node node){
	int i = 0;
	while(node.parent != -1){
		i++;
		node = nodes[node.parent];
	}
	return i;
}

int main() {
	int n;
	scanf("%d", &n);
	
	node *nodes = new node[1+n];
	for(int i = 0; i <= n; i++){
		nodes[i].parent = nodes[i].leftChild = nodes[i].right = -1;
	}
	
	for(int i = 0; i < n; i++){
		int id, k;
		scanf("%d %d", &id, &k);
		
		vector<int> v;
		for(int j = 0; j < k; j++){
			int child;
			scanf("%d", &child);
			v.push_back(child);
		}
		v.push_back(-1);
		
		for(int j = 0; j < k; j++){
			nodes[v[j]].parent = id;
			nodes[v[j]].right = v[j+1];
		}
		nodes[id].leftChild = v[0];
	}
	
	
	for(int i = 0; i < n; i++){
		printf("node %d: parent = %d, depth = %d, %s, [", i, nodes[i].parent, checkDepth(nodes, nodes[i]), nodes[i].parent == -1 ? "root" : nodes[i].leftChild == -1 ? "leaf" : "internal node");
		if(nodes[i].leftChild == -1) printf("]\n");
		for(int k = nodes[i].leftChild; k != -1; k = nodes[k].right){
			printf("%d%s", k, (nodes[k].right == -1 ? "]\n" : ", "));
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 2840
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  int Acount = 0;
  int Bcount = 0;
  
  for(int i = 0; i < S.size(); i += 2){
    if(S.at(i) == 'R' || S.at(i) == 'U' ||S.at(i) == 'D'){
      Acount++;
    }
  }
  
  for(int i = 1; i < S.size(); i += 2){
    if(S.at(i) == 'L' || S.at(i) == 'U' ||S.at(i) == 'D'){
      Bcount++;
    }
  }
  
  if(S.size() % 2 == 1){
    if(Acount == S.size() / 2 + 1 && Bcount == S.size() / 2){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
  
  else{
    if(Acount == S.size() / 2 && Bcount == S.size() / 2){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << 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;
const long double eps = 1e-10;

struct point {
  long double x;
  long double y;
  point(long double x, long double y): x(x), y(y) {}
};
long double calc_dist(point p1, point p2) {
  long double dx = p1.x - p2.x;
  long double dy = p1.y - p2.y;
  return sqrt(dx*dx+dy*dy);
}
point operator+(point p1, point p2) {
  return point(p1.x+p2.x, p1.y+p2.y);
}
point operator/(point p, long double d) {
  return point(p.x/d, p.y/d);
}
point operator*(point p, long double d) {
  return point(d*p.x, d*p.y);
}
point operator*(long double d, point p) {
  return point(d*p.x, d*p.y);
}

int N;
vector<point> P;
vector<point> intersection(point p1, point p2, long double r) {
  point mid = (p1+p2)/2.0; // center
  long double dist = calc_dist(p1, p2); // distance
  point diff = point(p1.y-p2.y, -(p1.x-p2.x))/dist; // slope
  vector<point> ret; // intersection
  if(dist > r*2+eps) {
  } else {
    long double h = sqrt(r*r-(dist/2)*(dist/2));
    ret.push_back(mid+(h*diff));
    ret.push_back(mid+(-h*diff));
  }
  return ret;
}

bool testeach(int i, int j, long double k) {
  auto intr = intersection(P[i], P[j], k);
  if(intr.size() != 0) {
    for(auto i: intr) {
      bool ret = true;
      rep(j, N) {
        if(calc_dist(i, P[j]) > k+eps) {
          ret = false;
          break;
        }
      }
      if(!ret) continue;
      return true;
    }
  }
  return false;
}
bool test(long double k) {
  bool ret = false;
  rep(i, N) REP(j, i+1, N) ret |= testeach(i, j, k);
  return ret;
}

long double binary_search() {
  long double ng = 0, ok = 2000;
  rep(i, 50) {
    long double mid = (ok + ng) / 2;
    if(test(mid)) ok = mid;
    else ng = mid;
  }
  return ok;
}

int main() {
  cin >> N;
  P = vector<point>();
  rep(i, N) {
    int x, y;
    cin >> x >> y;
    P.push_back(point(x, y));
  }
  long double ans = binary_search();
  cout << setprecision(20) << ans << endl;
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    int ans=0, num; 
    for(int i=0; i<s.size(); i++) {
        num=0;
        for(int j=i; j<s.size(); j++) {
        if(s.at(j)=='A' || s.at(j)=='T') num++;
        else if (s.at(j)=='C' || s.at(j)=='G') num++;
        else break;
        }
        ans=max(ans, num);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 2005
vector<ll> graph[SIZE];
ll f[SIZE];
map<pll,ll> m;
ll dis[SIZE][SIZE];
bool vis[SIZE];
void BFS(ll s,ll N){
	for(ll i=1;i<=N;++i)
		vis[i]=false;
	queue<ll> q;
	q.push(s);
	dis[s][s]=0;
	while(!q.empty()){
		ll u=q.front();
		q.pop();
		for(auto v:graph[u]){
			if(!vis[v]){
				dis[s][v]=dis[s][u]+1;
				vis[v]=true;
				q.push(v);
			}
		}
	}
}
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll N;
	cin>>N;
	for(ll i=1;i<N;++i){
		graph[i].pb(i+1);
		graph[i+1].pb(i);
	}
	ll X,Y;
	cin>>X>>Y;
	graph[X].pb(Y);
	graph[Y].pb(X);
	for(ll s=1;s<=N;++s){
		BFS(s,N);
	}
	for(ll i=1;i<=N;++i){
		for(ll j=i+1;j<=N;++j){
			f[dis[i][j]]++;
		}
	}
	for(ll i=1;i<N;++i){
		cout<<f[i]<<endl;
	}
}

Measured memory_bytes: 31744
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int h, w;

bool search(int x, int y, vector<vector<char>> &s) {
  if (x+1 < h && s[x+1][y] == '#') return true;
  else if ( x-1 >= 0 && s[x-1][y] == '#') return true;
  else if (y+1 < w && s[x][y+1] == '#') return true;
  else if (y-1 >= 0 && s[x][y-1] == '#') return true;
  else return false;
}

int main() {
  
  cin >> h >> w;
  vector<vector<char>> s(h, vector<char>(w));
  rep(i, h) rep(j, w) cin >> s[i][j];
  rep(i, h) rep(j, w) {
    if (s[i][j] == '#' && !search(i, j, s)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

signed main(){

  int k, a, b; cin >> k >> a >> b;

  if(k == 1){
    cout << "OK" << endl;
    return 0;
  }

  int p = b / k * k;
  cout << (p >= a ? "OK" : "NG") << endl;

  return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define int long long int
#define MP make_pair
#define PB push_back
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VP;
typedef pair<PII, int> PPI;
const int INF = 3e18;

int n, x[100010], nx[100010];
int fast[100010];
int ans = 1;
signed main()
{
  cin >> n;

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

  int stock = 1, pre = 1;
  for(int i = 1; i < n; i++){
    if(pre + 1 == x[i]){
      stock++;
      ans *= stock;
      ans %= 1000000007;
      stock--;
    }
    else{
      stock++;
      pre += 2;
    }
  }

  while(stock){
    ans *= stock;
    ans %= 1000000007;
    stock--;
  }
  /*
  int next = 1;
  for(int i = 0; i < n; i++){
    if(x[i] >= next){
      x[i] = next;
      next += 2;
    }
    else{
      next += 1;
    }
  }

  int nownum = 1;
  nx[0] = 1;
  for(int i = 1; i < n; i++){
    nx[i] = nownum;
    if(x[i - 1] + 1 == x[i]){
      i++;
      nownum++;
      nx[i] = nownum;
    }
  }

  for(int i = 0; i < n; i++)
    fast[nx[i]]++;
  
  int kurikoshi = 0;
  for(int i = 1; i == 1 || kurikoshi; i++){
    kurikoshi += fast[i];
    ans *= kurikoshi;
    cout << kurikoshi << endl;;
    ans %= 1000000007;
    kurikoshi--;
  }
  
  for(int i = 0; i < n; i++){
    cout << i << ":" << x[i] <<endl;
  }
  for(int i = 1; i <= n; i++){
    cout << i << ":" << fast[i] <<endl;
  }
  */
  cout << ans << endl;
  return 0;
}


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

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

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

int n;
const int maxn = 20;
ll a[maxn];

ll dfs(int l, int xl, int r, int xr){
    if(r - l <= 1) return 0;
    ll ans = 1e18;
    for(int m = l + 1;m < r;m++){
        ans = min(ans, dfs(l, xl, m, xl + xr) + dfs(m, xl + xr, r, xr) + a[m] * (xl + xr));
    }
    return ans;
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
    }
    cout << a[1] + a[n] + dfs(1, 1, n, 1) << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
P = [(0,0,0)] + [tuple(int(x) for x in input().split()) for _ in range(N)]

def travelable(p,q):
    time = q[0] - p[0]
    dist = abs(q[1]-p[1]) + abs(q[2]-p[2])
    if dist <= time and time%2 == dist%2:
        return True
    else:
        return False
from itertools import zip_longest
print('Yes' if all(travelable(p,q) for p,q in zip_longest(P[:N],P[1:])) else 'No')

Measured memory_bytes: 23736
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll=long long;
int main()
{
    int a,b;
    cin>>a>>b;
    for(double i=1; i<=1100; ++i){
        if((int)(i*0.08)==a&&(int)(i*0.1)==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

k,x = [int(i) for i in input().split(' ')]

output = ''
n_max = max(-100000, x - k + 1)
n_min = min(100000, x + k)

for i in range(n_max, n_min):
    output += str(i)
    output += ' '

if n_max == n_min:
    print(n_max)
else:
    print(output[:-1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main() {
//string s,t;
int a,b,c,i,n,j,t;
int g,h,o;
    map<int,int> ma;
    map<int,int> :: iterator it;
vector<int> v;
    h=0;
cin>>n>>t>>c;
    for(i=0;i<t;i++){cin>>a;v.push_back(a);}
    b=0;
for(i=1;i<=n;i++){
        b = c;
    for(j=0;j<t;j++){
        cin>>a;
        b= b+(a*v[j]);
    }
    if(b>0){h++;}
}
cout<<h<<endl;
}

Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

#なお、任意の整数 M に対して M の −2 進数表現が一意に定まることが証明できます。
#2桁ごとに見るとよかった（もう実験したよ）
def resolve():
    N=bin(int(input())) 
    #print(N)
    print(2**(len(N)-3))
#%%submit!
resolve()


Measured memory_bytes: 38256
#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
#define ll long long
#define fast_io cin.tie(0);cout.tie(0);ios::sync_with_stdio(0)
using namespace std;

int main(){
    fast_io;
    int a,p,tp;
    cin>>a>>p;
    tp = (a*3)+p;
    int ans = tp/2;
    cout<<ans;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
if c%2==0:
    for _ in range(int(c/2)):
        if a %2 == 0:
            d=0
        else:
            a=(a-1)
        a=a/2
        b=a + b
        if b%2== 0:
            d=0
        else:
                b=(b-1)
        b=b/2
        a+=b
    print(int(a),int(b))



else:
    if c%2==1:
        for _ in range(int(c/2)):
            if a %2 == 0:
                d=0
            else:
                a=(a-1)
            a=a/2
            b=a + b
            if b%2== 0:
                d=0
            else:
                b=(b-1)
            b=b/2
            a+=b
        
        if a %2 == 0:
            d=0
        else:
            a=(a-1)
        a=a/2
        b=a + b
        print(int(a),int(b))


Measured memory_bytes: 3064
n = int(input())
a = []
b = []
for i in range(n):
    t1,t2 = map(int,input().split())
    a.append(t1)
    b.append(t2)
wa = []
for i in range(n):
    wa.append(a[i] + b[i])
c = zip(wa,a,b)
c = sorted(c, reverse = True)
wa, a, b = zip(*c)
ans = 0
flg = 0
for i in range(n):
    if flg == 0:
        ans +=a[i]
        flg = 1
    else:
        ans -=b[i]
        flg = 0
print(ans)

Measured memory_bytes: 102748
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	string s;
	cin>>s;
	vint dp(1<<26,INF);
	dp[0] = 0;
	int state = 0;
	for(char _c: s){
		int c = _c-'a';
		state ^= (1<<c);
		// cout<<c<<" "<<state<<endl;
		rep(i,26){
			mins(dp[state], dp[state^(1<<i)]+1);
		}
	}
	// cout<<state<<endl;
	cout<<max(dp[state],1)<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 262804
#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include<bits/stdc++.h>
using namespace std;
int main (){
    int n ,i;
    cin >>n;
    for ( i = 0; pow(2,i) <= n; i++);  
    cout <<pow(2,i-1) <<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  int ans = 0;
  cin >> s;
  t = s;
  reverse(s.begin(),s.end());
  for(int i = 0;i <(int)s.size() / 2;i++){
    if(s[i] != t[i])ans++;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
  int a,b,c,count=0,kazu;
  cin >> a >> b >> c;
  for(int i=a;i<=b;i++){
    
    kazu=c%i;
    if(kazu==0){
      count++;}
  }
  cout << count << endl;

	
  return 0;
  }

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

using namespace std;
using ll = long long;
using ld = long double;

namespace NyaGadget
{	// DFSライブラリ

	struct DFSedge
	{
		ll v = 0;	// 頂点
		DFSedge(ll vindex) { v = vindex; }
	};

	template <class TE = DFSedge> struct DFS
	{
		using Graph = vector<vector<TE>>;
		Graph graph;

		DFS(ll size) { graph.resize(size); }
		// 頂点xと接続されている頂点を全て取得したいときに使う演算子
		vector<TE>& operator [](int x) { return graph[x]; }

		/**
		@brief 辺を追加する関数
		@note
		 頂点v1とv2を結ぶ辺を追加する。
		**/
		void CreateEdge(ll v1, ll v2)
		{	// 後戻りも出来るようにv1→v2とv2→v1の両方の辺を追加する
			graph[v1].push_back(DFSedge(v2));
			graph[v2].push_back(DFSedge(v1));
		}
	};

}

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define ceil(a, b) ceil((ld) a / (ld) b);                         // div ceiling
#define each(e, collection) for(auto& e: collection)              // for each
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

using namespace NyaGadget;

/**
@brief 深さ優先探索
@param r 根
@param v 頂点
@param dfs 処理するDFSグラフ
@param memo 前処理したメモ(加算するべきカウンタの値)
@param ans 出力する答えを格納する配列
@note
 DFSで全てのノードを処理する。
**/
void Solve(ll r, ll v, DFS<>& dfs, vector<ll>& memo, vector<ll>& ans)
{
	if (r != -1)
		ans[v] = ans[r] + memo[v];

	each(e, dfs[v])
	{	// 後戻りしないようにする
		if (e.v == r)
			continue;

		Solve(v, e.v, dfs, memo, ans);
	}
}

int main(void)
{
	ll n, q; cin >> n >> q;

	ll u, v;
	DFS<> dfs(n);
	rep(i, 0, n - 1)
	{
		cin >> u >> v;
		--u; --v;
		dfs.CreateEdge(u, v);
	}

	vector<ll> p(q), x(q);
	rep(i, 0, q)
	{
		cin >> p[i] >> x[i];
		p[i]--;
	}

	// 頂点xで加算するべきカウンタの値をメモしておく。
	vector<ll> memo(n);
	rep(i, 0, q)
		memo[p[i]] += x[i];

	vector<ll> ans(n);
	ans[0] = memo[0];
	Solve(-1, 0, dfs, memo, ans);

	each (e, ans)
		cout << e << " ";

	return 0;
}


Measured memory_bytes: 35200
#include <iostream>
#include <string>
#include <map>
#include <cstdlib>
#include <cstring>
using namespace std;

typedef long long ll;
ll knapsack[1<<7][10005];
ll dp[8][1<<8], tsp[1<<8], profit[1<<8];
ll total[10005];
int value[7], weight[7];
int cn[8], cp[8][8], cv[8][8], cx[8], cy[8];


int main()
{
	int N,M,W,T;
	while(cin >> N >> M >> W >> T) {
		map<string, int> dic;
		for(int i=0; i<M; i++) {
			string s;
			int v,p;
			cin >> s >> v >> p;
			dic[s] = i;

			weight[dic[s]] = v;
			value[dic[s]] = p;
		}

		cn[0] = cx[0] = cy[0] = 0;
		for(int i=1; i<=N; i++) {
			cin >> cn[i] >> cx[i] >> cy[i];

			for(int j=0; j<cn[i]; j++) {
				string s;
				int v;
				cin >> s >> v;
				cv[i][j] = max(0, value[dic[s]] - v);
				cp[i][j] = dic[s];
			}
		}

		memset(profit, 0, sizeof(profit));
		memset(knapsack, -1, sizeof(knapsack));
		for(int i=0; i<(1<<N); i++) {
			knapsack[i][0] = 0;
			for(int j=1; j<=N; j++) {
				if(!(i >> (j-1) & 1)) continue; 
				for(int k=0; k<cn[j]; k++) {
					int id = cp[j][k];
					for(int l=0; l<=W - weight[id]; l++) {
						if(knapsack[i][l] == -1) continue;
						knapsack[i][l + weight[id]] = max(knapsack[i][l + weight[id]], knapsack[i][l] + cv[j][k]);
						profit[i<<1] = max(profit[i<<1], knapsack[i][l + weight[id]]);
					}
				}
			}
		}

		N++;
		for(int j=0; j<N; j++)
		for(int i=0; i<(1<<N); i++) {
			dp[j][i] = (1<<28);
			tsp[i] = (1<<28);
		}

		tsp[0] = tsp[1] = 0;
		for(int i=0; i<N; i++) {
			dp[i][1<<i] = abs(cx[i]) + abs(cy[i]);
		}

		for(int i=1; i<(1<<N); i++) {
			for(int j=0; j<N; j++) {
				for(int k=0; k<N; k++) {
					dp[k][i | (1<<k)] = min(dp[k][i | (1<<k)], dp[j][i] + abs(cx[j]-cx[k]) + abs(cy[j]-cy[k]));
					tsp[i | (1<<k) ] = min(tsp[i | (1<<k) ], dp[k][i] + (ll)abs(cx[k]) + (ll)abs(cy[k]));
				}
			}
		}


		memset(total, -1, sizeof(total));
		total[0] = 0;
		for(int i=0; i<(1<<N); i++) {
			for(int j=0; j<=T; j++) {
				if(j + tsp[i] > T) break;
				if(total[j] == -1) continue;
				total[j+tsp[i]] = max(total[j+tsp[i]], total[j] + profit[i]);
			}
		}

		ll res = 0;
		for(int i=0; i<=T; i++)
			res = max(res, total[i]);

		cout << res << endl;
	}
}

Measured memory_bytes: 10000
#include "bits/stdc++.h"
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

struct point{
	int x, y;
	bool operator < (const point & a){
		if(x == a.x){
			return y < a.y;
		}
		return x < a.x;
	}
} v[100];

point nexttotop(stack<point>& st){
	point t = st.top();
	st.pop();
	point r = st.top();
	st.push(t);
	return r;
}

int compare(point  a, point  b, point  c){
	point u, v;
	u.x = a.x-b.x;
	u.y = a.y-b.y;
	v.x = c.x-b.x;
	v.y = c.y-b.y;
	int val = v.x*u.y - v.y*u.x;
	if( val == 0) return 0;
	else if(val > 1) return 1;
	else return -1;
}

int main(){
	int a, b; cin >>  a>> b;
	if(a <= 9 && b <= 9)
		cout<<a*b;
	else
		cout<< -1;
	return 0;
}
 


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

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(v) ((int)(v).size())
#define fr(i, j, k) for(int i = j; i < k; i++)
#define nl "\n"
typedef pair<int, int> pii;
typedef vector <int> vi;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

const int inf = (1LL << 60), mod = 1e9+7, nn = 2e5+5;

void solve(){
    int x, y;
    cin >> x >> y;
    for(int i = 0; i <= x; i++) {
        int c = i * 2 + (x - i) * 4;
        if(c == y) {
            cout << "Yes";
            return;
        }
    }
    cout << "No";
}

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3688
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	ll sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	ll x = tx - sx;
	ll y = ty - sy;

	string res;
	for (ll i = 0; i < y; i++)
	{
		res = res + "U";
	}
	for (ll i = 0; i < x; i++)
	{
		res = res + "R";
	}

	for (ll i = 0; i < y; i++)
	{
		res = res + "D";
	}
	for (ll i = 0; i < x; i++)
	{
		res = res + "L";
	}

	//if (x == 1 || y == 1)
	{
		res = res + "L";
		for (ll i = 0; i <= y; i++)
		{
			res = res + "U";
		}
		for (ll i = 0; i <= x; i++)
		{
			res = res + "R";
		}

		res = res + "DR";

		for (ll i = 0; i <= y; i++)
		{
			res = res + "D";
		}
		for (ll i = 0; i <= x; i++)
		{
			res = res + "L";
		}

		res = res + "U";
	}

	println(res);

}

Measured memory_bytes: 384
n = int(input())

c = [[0 for i in range(0, 10)] for j in range(0, 10)]

for i in range(n):
    str_i = str(i+1)
    c[int(str_i[0])][int(str_i[len(str_i)-1])] += 1

ans = 0

for i in range(0, 10):
    for j in range(0, 10):
        ans += c[i][j] * c[j][i]

print(ans)


Measured memory_bytes: 3060
import std.stdio;
import std.string;
import std.conv;
import std.range;
import std.array;
import std.algorithm;

void main(){
  auto S=readln.chomp;
  if(S[0]=='a' && S[1]=='b' && S[2]=='c')writeln("Yes");
  else if(S[0]=='a' && S[1]=='c' && S[2]=='b')writeln("Yes");
  else if(S[0]=='b' && S[1]=='a' && S[2]=='c')writeln("Yes");
  else if(S[0]=='b' && S[1]=='c' && S[2]=='a')writeln("Yes");
  else if(S[0]=='c' && S[1]=='b' && S[2]=='a')writeln("Yes");
  else if(S[0]=='c' && S[1]=='a' && S[2]=='b')writeln("Yes");
  else writeln("No");
}    

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main :: IO ()
main = getLine >>= print . solve . map read . words
solve :: [Int] -> Int
solve (p:q:r:_) = minimum [p+q, q+r, r+p]

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

int main(){
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    int x = 0;
    for(int i = 0; i < N - 1; i++){
        int minj = i;
        for(int j = i; j < N; j++){
            if(A[minj] > A[j]) minj = j;
        }
        int tmp = A[i];
        A[i] = A[minj];
        A[minj] = tmp;
        if(minj != i) x++;
    }
    
    for(int i = 0; i < N; i++){
        cout << A[i] << ((i == N -1) ? "\n" : " " );
    }
    cout << x << endl;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

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

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    multiset <string> m2;
    int n=nxt(),l=nxt();
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        m2.insert(s);
    }
    for(auto i:m2)
        cout<<i;
    cout<<endl;
    
    return 0;   
}


 
 


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main(void) {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p[i];
  int cnt = 0;
  rep(i, n - 2) {
    if(p[i] < p[i + 1] && p[i + 1] < p[i + 2])
      cnt++;
    else if(p[i] > p[i + 1] && p[i + 1] > p[i + 2])
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
N = format(N, '060b')[::-1]
# N[i] := Nのiビット目としておく
N = [0] + list(map(int, N))

# dp[i][j] := iビット目まで見て、その桁までの値において、a+b がNより j*2^i 小さい通り数(j>=2はj=2で同一視)
dp = list2d(61, 3, 0)
dp[60][0] = 1
for i in range(60, 0, -1):
    # jの状態 j=0,1,2以上 の3通り
    for j in range(3):
        # 今回の桁でのa,bの選び方 (0,0)=0,(0,1)=1,(1,1)=2 の3通り
        for k in range(3):
            # 1桁下がる時に、現在のjは 2^i = 2*2^(i-1) から、*2される
            # Nのビットが立っている桁なら1を足す
            # 今回追加するk(0~2)を引く
            nxt = min(j*2 + N[i] - k, 2)
            # nxtがマイナスなら繰り上がりでNを超えるので遷移させない
            if nxt >= 0:
                dp[i-1][nxt] += dp[i][j]
                dp[i-1][nxt] %= MOD
print((dp[0][0]+dp[0][1]+dp[0][2])%MOD)


Measured memory_bytes: 3064