akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define nl          '\n'
#define fori(n)			for(int i = 0; i < n; ++i) 
#define forj(n)			for(int j = 0; j < n; ++j)
#define fork(n)			for(int k = 0; k < n; ++k)
#define forl(n)			for(int l = 0; l < n; ++l)
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define ppb push_back
typedef long long ll;typedef pair<int,int> pii;typedef vector<bool> vbool;
typedef vector<int> vint;typedef vector<ll> vll;typedef long double ld;
typedef vector<vector<int>> vvi; typedef vector<vbool> vvb;

const ll N = 100010;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin >> n;
	map<string, int> c;
	string in;
	fori(n) {
		cin >> in;
		c[in]++;
	}
	vector<pair<int, string>> d;
	for(auto x : c)
		d.push_back( {x.second, x.first} );
	sort(d.begin(), d.end());
	fori(d.size()) 
		if (d[i].first == d[d.size()-1].first) cout << d[i].second << nl;
	
	#if DEBUG
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << " s" << nl;
	#endif
	return 0;
}


Measured memory_bytes: 28272
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5 2 2");
            WillReturn.Add("1 2 3 4 5");
            //4.500000
            //1
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("4 2 3");
            WillReturn.Add("10 20 10 10");
            //15.000000
            //3
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("5 1 5");
            WillReturn.Add("1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996");
            //1000000000000000.000000
            //1
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("50 1 50");
            WillReturn.Add("1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1");
            //1.000000
            //1125899906842623
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int A = wkArr[1];
        int B = wkArr[2];

        long[] VArr = InputList[1].Split(' ').Select(X => long.Parse(X)).ToArray();
        Array.Sort(VArr, (pA, pB) => pB.CompareTo(pA));

        decimal MaxAvg = (decimal)VArr.Take(A).Sum() / (decimal)A;
        Console.WriteLine(MaxAvg);

        long MaxVal = VArr[0];
        long MinVal = VArr[A - 1];
        long PatternCnt = 0;
        for (int I = A; I <= B; I++) {
            if (A < I && VArr[I - 1] < MaxVal) break;

            int NonMinCnt = VArr.Count(pA => pA > MinVal);
            int MinValCnt = VArr.Count(pA => pA == MinVal);
            PatternCnt += DeriveCombi(MinValCnt, I - NonMinCnt);
        }
        Console.WriteLine(PatternCnt);
    }

    //nCrを求める
    static long DeriveCombi(long pN, long pR)
    {
        long WillReturn = 1;
        pR = Math.Min(pR, pN - pR);

        var DivList = new List<long>();
        for (long I = 2; I <= pR; I++) {
            DivList.Add(I);
        }

        for (long I = pN - pR + 1; I <= pN; I++) {
            WillReturn *= I;

            for (int J = DivList.Count - 1; 0 <= J; J--) {
                if (WillReturn % DivList[J] == 0) {
                    WillReturn /= DivList[J];
                    DivList.RemoveAt(J);
                }
            }
        }
        return WillReturn;
    }
}


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

int main(){
	int n;	cin>>n;
	int m[n+1];	for(int i=0;i<=n;i++)cin>>m[i];
	int p[n];		for(int i=0;i<n;i++)cin>>p[i];

	long long ans=0;
	for(int i=0;i<n;i++){
		if(m[i]<=p[i]){
			ans+=m[i];
			p[i]-=m[i];
			//m[i]=0;
			if(p[i]){
				if(p[i]>=m[i+1]){
					ans+=m[i+1];
					m[i+1]=0;
				}else{
					ans+=p[i];
					m[i+1]-=p[i];
				}
			}
		}else{
			ans+=p[i];
		}
	}

	cout<<ans<<endl;




	return 0;
}


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

int main() {
  string t, s;
  cin >> t >> s;
  bool a = true;
  for(int i = 0; i < t.size(); i++) {
    if(s.at(i) != t.at(i)) {
      a = false;
      break;
    }
  }
  if(a) cout << "Yes" << endl;
  else cout << "No" << endl;
} 



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define prec fixed << setprecision(12)
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define test int t; cin >> t; while(t--)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

void solve() {
	string s, t;
	cin >> s >> t;
	int ans = 0 ;
	rep(i, 0, sz(s) - 1) {
		if (s[i] != t[i])
			ans++;
	}
	cout << ans;
}

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

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

#define TEST 0

	if (TEST) {
		test;
		solve();
	} else {
		solve();
	}

	return 0;
}

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

int digsum(int x){
	int dsum = 0;
	while(x){
		dsum += x%10;
		x /= 10;
	}
	return dsum;
}

int main(){
	int n, mds = 1e5;
	cin >> n;
	for(int i = 1; i < n; i++)
		mds = min(mds, digsum(i) + digsum(n-i));
	cout << mds << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char a = s.charAt(0);
		char b = s.charAt(1);
		char c = s.charAt(2);
		boolean ans = true;

		if (a == b || a == c || b == c) {
			ans = false;
		}
		System.out.println(ans ? "Yes" : "No");
	}
}


Measured memory_bytes: 35532
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(N):
    m = i
    for j in range(i, N):
        if (A[j] < A[m]):
            m = j
    if (m != i):
        A[i], A[m] = A[m], A[i]
        count += 1
print(*A)
print(count)

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

int main(){
  string s;cin>>s;
  rep(i,s.size()){
    if((i+1)%2==1)cout<<s[i];
  }

  return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,cc,n) for(int i=cc;i<(n);++i)
#define dreps(i,cc,n) for(int i=cc;i>(n);--i)
#define llreps(i,cc,n) for(long long i=cc;i<(n);++i)
#define ALL(v) begin(v),end(v)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

int main()
{
	int a;
	//string str;
	cin >> a;
	cout << a + a * a + a * a*a << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
	std::string to_string (char val) {
		return std::string (1, val);
		// return std::string{val};
	}
	//if( str.find ("r") != string::npos)
}

using namespace std;
typedef long long int llint;

int main (void) {
	int n; char c; cin >> n;
	int x = 0;
	int max = 0;
	for (int i = 0; i < n; i++) {
		cin >> c;
		if(c=='I') x++;
		else if(c=='D') x--;

		if(x > max) max = x;
	}
	cout << max << endl;
	return 0;
}

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

int n;
string s[310];

void change(){
    string t=s[0];
    for(int i=0;i<n-1;i++){
        string tmp=s[i];
        s[i]=s[i+1];
        s[i+1]=tmp;
    }
    s[n-1]=t;
}
bool solve(){
    bool res=true;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(s[i][j]!=s[j][i])res=false;
        }
    }
    return res;
}

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

    cin>>n;
    for(int i=0;i<n;i++)cin>>s[i];
    int ans=0;
    for(int k=0;k<n;k++){
        change();
        if(solve())ans++;
    }
    ans*=n;
    cout<<ans<<endl;

}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////


//long long  Prime[3000000],nPrime;
//long long  mark[10000002];
//
//void seive(long long int n)
//{
//	long long int i,j,limit=sqrt(n*1.0)+2;
//	mark[1]=1;
//	for(i=4; i<=n ;i+=2)
//	mark[i]=1;
//	Prime[nPrime++]=2;
//	for(i=3; i<=n; i+=2)
//	{
//		if(!mark[i])
//		{
//			Prime[nPrime++]=i;
//			if(i<=limit)
//			{
//				for(j=i*i; j<=n ;j+=i*2)
//				{
//					mark[j]=1;
//				}
//			}
//		}
//	}
//}

int main()
{
    FASTIO;

    string s1 , s2;

    cin >> s1 >> s2;


    ll cnt = 0;



    for(int i=0; i<s1.length(); i++)
    {
        if(s1[i]!=s2[i]) cnt++;
    }

    cout << cnt << endl;





    return 0;
}



Measured memory_bytes: 3780
use std::collections::VecDeque;
use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let hw = lines.next().unwrap().unwrap();
    let mut hw = hw.split_whitespace();
    let h: usize = hw.next().unwrap().parse().unwrap();
    let w: usize = hw.next().unwrap().parse().unwrap();
    let maze: Vec<Vec<char>> = (0..h)
        .map(|_| lines.next().unwrap().unwrap().chars().collect())
        .collect();

    let mut ans = 0;
    for i in 0..h {
        for j in 0..w {
            if maze[i][j] == '#' {
                continue;
            }
            let mut visited: Vec<Vec<bool>> = vec![vec![false; w]; h];
            visited[i][j] = true;
            let mut queue: VecDeque<(usize, usize, usize)> = VecDeque::new();
            queue.push_back((i, j, 0));
            while let Some((i, j, d)) = queue.pop_front() {
                ans = std::cmp::max(ans, d);
                if 0 < i && maze[i - 1][j] == '.' && !visited[i - 1][j] {
                    queue.push_back((i - 1, j, d + 1));
                    visited[i - 1][j] = true;
                }
                if i < h - 1 && maze[i + 1][j] == '.' && !visited[i + 1][j] {
                    queue.push_back((i + 1, j, d + 1));
                    visited[i + 1][j] = true;
                }
                if 0 < j && maze[i][j - 1] == '.' && !visited[i][j - 1] {
                    queue.push_back((i, j - 1, d + 1));
                    visited[i][j - 1] = true;
                }
                if j < w - 1 && maze[i][j + 1] == '.' && !visited[i][j + 1] {
                    queue.push_back((i, j + 1, d + 1));
                    visited[i][j + 1] = true;
                }
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int i,j,len,flg[26]={0};
char s[10000001];
int main(void)
{
	cin >> s;
	len=strlen(s);
	for(i=0;i<len;i++){
		flg[s[i]-'a']=1;
	}
	for(i=0;i<26;i++){
		if(flg[i]==0){
				cout << (char)(i+'a') << endl;
				return 0;
		}	
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
#define INFTY 2000000000
int count=0;
void merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int *L=new int[n1+1];
  int *R=new int[n2+1];
  for(int i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1]=INFTY;
  R[n2]=INFTY;
  int i=0;
  int j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
    }
    count++;
  }
  delete[] L;
  delete[] R;
}
void mergeSort(int A[],int left,int right){
  if(left+1>=right)
    return;
  int mid=(left+right)/2;
  mergeSort(A,left,mid);
  mergeSort(A,mid,right);
  merge(A,left,mid,right);
}

int main(){
  int n;
  cin>>n;
  int A[n];
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  mergeSort(A,0,n);
  for(int i=0;i<n-1;i++){
    cout<<A[i]<<' ';
  }
  cout<<A[n-1]<<endl;
  cout<<count<<endl;
}



Measured memory_bytes: 6740
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;

typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int,int> P;

const int MOD = 1000000007;

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

ll mod_factrial_up(ll start, ll end){
  ll sum=1;
  for(ll i=start;i>=end; i--){
    sum = (sum * i) % MOD;
  }
  return sum;
}

// mod_factrial(N,k+1): nCkの分母：(n-k)^p-2 * (n-k-1)^p-2 * ... * 1^p-2 を計算
ll mod_factrial_down(ll start, ll end){
  ll sum=1;
  for(ll i=start; i>=end;i--){
    // sum = (sum * i) % MOD;
    sum = (sum * modpow(i,MOD-2) ) % MOD;
  }
  // sum = modpow(sum,MOD-2);
  return sum;
}


int main(int argc, const char * argv[]) {
  ll N,a,b; cin >> N >> a >> b;
  ll sum = (modpow(2,N)-1 - (mod_factrial_up(N,N-a+1) * mod_factrial_down(a,1))%MOD - (mod_factrial_up(N,N-b+1) * mod_factrial_down(b,1))%MOD ) %MOD;
  if (sum<0) sum += MOD;
   cout << sum << endl;
  //  cout << -1 % MOD << endl;
}


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

string s;

int main()
{
	cin >> s;
	for(int i = 0; i+1 < s.size(); i ++) 
	if(s[i] == s[i+1])
	{
		cout<<"Bad";
		return 0;
	}
	cout<<"Good";
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
void solve(){
    ll n,i,j;
           cin>>n;
           ll divs[n+5]={0};
           ll ans=0;
           for(i=1;i<=n;i++){
            for(j=i;j<=n;j+=i){
                divs[j]++;
            }
           }
           for(i=1;i<=n;i++)
            ans+=i*divs[i];
           cout<<ans<<endl;
}
int main() {
	int t=1;
	//cin>>t;
	while(t--){
	    solve();
	}
	return 0;
}


Measured memory_bytes: 81728
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define repr(i, n) for(int i=(n-1); 1<=i; i--)
#define repr2(i, from, to) for(int i=(from-1); (int)(to)<=i; i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
typedef long long ll;

using namespace std;

struct Point { int x, y; };
struct Edge { int to, cost; };
struct gNode { int from, to, cost; };
struct tNode { int value; int parent; vector<int> child; };


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

int gcd(int a, int b){ return a % b == 0 ? b : gcd(b, a%b); }
int lcm(int a, int b){ return a * b/ gcd(a, b); }
int extgcd(int a, int b, int& x, int& y){
	int d = a;
	if(b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	} else{
		x = 1; y = 0;
	}
	return d;
}
ll mod_pow(ll x, ll n){
	if(n == 0) return 1;
	ll res = mod_pow(x*x % MOD, n/2);
	if(n & 1) res = res * x % MOD;
	return res;
}

int main(void){
	int n, k; cin >> n >> k;
	string s; cin >> s;

	int ans = 0;
	rep(i, n) if(s[i] == s[i+1]) ans++;
	ans += k*2;
	if(n <= ans) ans = n-1;

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

Measured memory_bytes: 512
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007


signed main(){
    int N,K;
    cin>>N>>K;
    cout<<N-K+1<<endl;
}


Measured memory_bytes: 3636
import java.util.Scanner;
public class Main{
	public static void main(String[] argv){
		Scanner scan = new Scanner(System.in);
		palace(scan);
	}
	public static void palace(Scanner scan){
		//入力値の中で，最もAに近いもののインデックスを出力
		int N = scan.nextInt(); 
		int T = scan.nextInt(); int A = scan.nextInt();
		int in = scan.nextInt();
		int index = 1;
		double min = Math.abs(A-T+0.006*in);
		for(int i=2;i<=N;i++){
			in = scan.nextInt();
			double dif = Math.abs(A-T+0.006*in);
			if(min>dif){
				min = dif;
				index = i;
			}
		}
		System.out.println(index);
	}
}

Measured memory_bytes: 22228
#include<stdio.h>
#define Max 10000
#define None -1

typedef struct{
  int parent, left ,right;
}Node;
Node Tree[Max];
int n,Depth[Max],Height[Max];
int Dep(int,int);
int  Hei(int);
void print_out(int );
int Sibling(int);
int main()
{
  int v,l,r,i;
  int root =0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    Tree[i].parent=None;
    for(i=0;i<n;i++){
      scanf("%d%d%d",&v,&l,&r);
      Tree[v].left=l;
      Tree[v].right=r;
      if(l!=None)Tree[l].parent=v;
      if(r!=None)Tree[r].parent=v;
    }
    for(i=0;i<n;i++)if(Tree[i].parent==None)root=i;

    Dep(root,0);
    Hei(root);
    for(i=0;i<n;i++)print_out(i);
    return 0;
}
  
  Dep(int u,int d){
  if(u==None) return;
  Depth[u] = d;
  Dep(Tree[u].left,d+1);
  Dep(Tree[u].right,d+1);
}
int Hei(int u){
  int h1=0;
  int h2=0;
  if(Tree[u].left!=None)
    h1=Hei(Tree[u].left)+1;
  if(Tree[u].right!=None)
    h2= Hei(Tree[u].right)+1;
      if(h1>h2)return Height[u]=h1;
      else return Height[u]=h2;
}

int Sibling(int u){
  if(Tree[u].parent==None)return None;
  if(Tree[Tree[u].parent].left!=u&&Tree[Tree[u].parent].left!=None)
    return Tree[Tree[u].parent].left;
  if(Tree[Tree[u].parent].right!=u&&Tree[Tree[u].parent].right!=None)
    return Tree[Tree[u].parent].right;
     return None;
     }
  void print_out(int u){
    printf("node %d: ",u);
    printf("parent = %d, ",Tree[u].parent);
    printf("sibling = %d, ",Sibling(u));
    int deg =0;
    if(Tree[u].left!=None)deg++;
    if(Tree[u].right!=None)deg++;
    printf("degree = %d, ",deg);
    printf("depth = %d, ", Depth[u]);
    printf("height = %d, ",Height[u]);

    if(Tree[u].parent ==None){
      printf("root\n");
    }  else if(Tree[u].left == None && Tree[u].right == None){
	printf("leaf\n");
      }else{
	printf("internal node\n");
      }
    }

Measured memory_bytes: 620
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"

int main()
{
	int n,m,s=0,t;
	cin>>n;
	vi a(n);
	for0(i,n){
		cin>>a[i];
		s += a[i];
	}
	m = s;
	for0(i,n-1){
		s -= 2*a[i];
		t = abs(s);
		m = min(m,t);
	}
	cout<<m<<nw;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <queue>
#include <math.h>
using namespace std;
typedef long long int ll;

ll dp[2020][2020];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<pair<ll,int>> v(n);
	for(int i=0;i<n;i++){
		cin >> v[i].first;
		v[i].second=i;
	}
	sort(v.rbegin(),v.rend());
	for(int i=0;i<n;i++){
		for(int j=0;j<=i;j++){
			dp[j+1][i-j]=max(dp[j+1][i-j],dp[j][i-j]+v[i].first*(ll)(abs(j-v[i].second)));
			dp[i-j][j+1]=max(dp[i-j][j+1],dp[i-j][j]+v[i].first*(ll)(abs(n-(j+1)-v[i].second)));
		}
	}
	ll res=0;
	for(int i=0;i<=n;i++){
		res=max(res,dp[i][n-i]);
	}
	printf("%lld\n",res);
}

Measured memory_bytes: 26444
#include<bits/stdc++.h> 
using namespace std;
#define N 1000000
int a[N];

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	int j;
	for(j=0;j<n;j++){
		if(a[j]==a[j+1]) break;
	}
	if(j==n){
		cout<<"YES";
	}
	else cout<<"NO";
	return 0;
}

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

int main(void)
{
    int N, Y;
    cin >> N >> Y;

    for (int x = 0; x <= N; x++)
    {
        for (int y = 0; y <= (N - x); y++)
        {
            int z = N - (x + y);
            if (x * 10000 + y * 5000 + z * 1000 == Y)
            {
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
N, *Ss = readlines.map(&:chomp)

as, os, cs = [], 0, 0
Ss.each do |s|
  o, c = 0, 0
  s.chars.each do |x|
    if x == ')'
      o == 0 ? c += 1 : o -= 1
    else
      o += 1
    end
  end
  if o == 0
    cs += c
  elsif c == 0
    os += o
  else
    as << [c, o]
  end
end

as.sort_by{|c, o| c - o}.each do |c, o|
  os -= c
  break if os < 0
  os += o
end
puts os == cs ? 'Yes' : 'No'

Measured memory_bytes: 162572
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;
const int tth=10000;
const int fth=5000;
const int th=1000;
int main(){
    ll n,y;
    cin>>n>>y;
    for(int i=0;i<n+1;i++){
        for(int j=0;j<=n-i;j++){
            int k=n-i-j;
            if(y==i*tth+j*fth+k*th){
                cout<<i<<" "<<j<<" "<<k<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1<<endl;    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;

int main() {
    int x, a, b;
    cin >> x >> a >> b;

    if (abs(a - x) >= abs(b - x)) {
        cout << "B" << endl;
    }
    else {
        cout << "A" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    pair<pair<string, int>, int> list[110];

    for (int i = 0; i < n; i++) {
        string s;
        int p;
        cin >> s >> p;
        list[i] = make_pair(make_pair(s, -p), i);
    }

    sort(list, list + n);

    for (int i = 0; i < n; i++) {
        cout << list[i].second + 1 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };

int main()
{
	int n;
	cin >> n;
	ll a;
	ll ma = -inf, mi = inf;
	rep(i, n) {
		cin >> a;
		ma = max(ma, a);
		mi = min(mi, a);
	}
	cout << ma - mi << endl;
}

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

int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    while(1){
        C-=B;
        if(C<=0){
            cout << "Yes" << endl;
            return 0;
        }
        A-=D;
        if(A<=0){
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3556
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;

int main() {
	string S;
	cin >> S;

	int N = S.length();

	ll ans = 0;
	for (int i = 0; i < 1<< (N - 1); i++){
		ll sum = 0;
		ll a = S[0] - '0';
		for (int j = 0; j < N - 1; j++) {
			if (i & (1 << j)) {
				sum += a;
				a = 0;
			}
			a = a * 10 + S[j + 1] - '0';
		}
		sum += a;
		ans += sum;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
S = input()
T = input()

SS = sorted(list(S))
TT = sorted(list(T))
SSS = []
TTT = []
numS = 0
numT = 0
checkS = 1
checkT = 1

for i in range(len(S)-1):
    if SS[i] != SS[i+1]:
        SSS.append(checkS)
        checkS = 1
    elif i == len(S)-2:
        SSS.append(checkS+1)
    else:
        checkS += 1

    if TT[i] != TT[i+1]:
        TTT.append(checkT)
        checkT = 1
    elif i == len(S)-2:
        TTT.append(checkT+1)
    else:
        checkT += 1
SSS.sort()
TTT.sort()
if SSS == TTT:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 8904
import sys
import os


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

    a, b, c, d = str(sys.stdin.readline().rstrip())
    print("Yes" if a == b == c or b == c == d else "No")


if __name__ == '__main__':
    main()


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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

// 繰り返し二乗法
ll power(ll a, ll b){
    if(a==1)return a;
    // if(a==0)re
    ll res=1;
    while(b>0){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}

const int MAX=2100000;

ll fact[MAX], fact_inv[MAX];

void init_fact(ll n){
    fact[0]=1;
    // 階乗の計算
    for(ll i=0; i<n; i++) fact[i+1]=fact[i]*(i+1)%MOD;
    fact_inv[n]=power(fact[n], MOD-2);
    // 逆元の計算
    for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}

ll comb(ll n, ll r){
    return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

ll perm(ll n, ll r){
    return (fact[n]*fact_inv[n-r])%MOD;
}

int main() {
    cout<<fixed<<setprecision(10);

    ll k; cin>>k;
    ll ans = 0;
    rep(a,k){
        rep(b,k){
            rep(c,k){
                ans += gcd(a+1,gcd(b+1,c+1));
            }
        }
    }
    cout<<ans<<endl;

    return 0;

}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
const int maxn=45;
const int zero=4000;
const int INF=0x3f3f3f3f;
int n,a[maxn],b[maxn],val[maxn],cost[maxn],dp1[zero*2+5],dp2[zero*2+5],ans;
void solve(int s)
{
	memset(dp1,-1,sizeof(dp1));
	dp1[val[s]+zero]=cost[s];
	for(int i=s+1;i<=n;i++)
	{
		memset(dp2,0x3f,sizeof(dp2));
		for(int j=0;j<=zero*2;j++)
		{
			if(dp1[j]!=-1) dp2[j]=dp1[j];
			int pre=j-val[i];
			if(0<=pre&&pre<=zero*2&&dp1[pre]!=-1)
				dp2[j]=min(dp2[j],dp1[pre]+cost[i]);
			if(dp2[j]==INF) dp2[j]=-1;
		}
		for(int j=0;j<=zero*2;j++)
			dp1[j]=dp2[j];
	}
	if(dp1[zero]!=-1)
		ans=min(ans,dp1[zero]);
}
void fl()
{
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
}
int main()
{
//	  fl();
	int Ma,Mb;
	scanf("%d%d%d",&n,&Ma,&Mb);
	memset(dp1,-1,sizeof(dp1));
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d%d",&a[i],&b[i],&cost[i]);
		val[i]=b[i]*Ma-a[i]*Mb;
	}
	ans=INF;
	for(int i=1;i<=n;i++)
		solve(i);
	printf("%d\n",ans==INF?-1:ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using ll = long long;
struct Edge {
  ll st,com;
  ll cost;
  Edge(ll st, ll com, ll cost):
  st(st),com(com),cost(cost){}
};

ll n, m;
map<ll, vector<Edge>> mp[100005];
map<ll, ll>min_cost[100005];
queue<Edge> que;

int main() {
  cin >> n >> m;
  for (int i=0;i<m;i++) {
    ll s, t, c;
    cin >> s >> t >> c;
    
    mp[s][c].push_back(Edge(t,c,0));
    mp[s][c].push_back(Edge(s,-1,1));
    mp[s][-1].push_back(Edge(s,c,0));
    mp[t][c].push_back(Edge(s,c,0));
    mp[t][c].push_back(Edge(t,-1,1));
    mp[t][-1].push_back(Edge(t,c,0));
  }
  
  que.push(Edge(1,-1,1));
  while(!que.empty()) {
    Edge p = que.front(); que.pop();
    ll st = p.st;
    ll com = p.com;
    ll cost = p.cost;
    
    for (int i=0;i<mp[st][com].size();i++) {
      ll nst = mp[st][com][i].st;
      ll ncom = mp[st][com][i].com;
      ll ncost = cost+mp[st][com][i].cost;
      
      if (min_cost[nst].find(ncom) ==
          min_cost[nst].end()) min_cost[nst][ncom]=1ll<<60ll;
      if (min_cost[nst][ncom]>ncost) {
        min_cost[nst][ncom]=ncost;
        que.push(Edge(nst,ncom,ncost));
      }
    }
  }
  
  ll ans=1ll<<60ll;
  for (auto x:min_cost[n]){
    ans=min(ans,x.second);
  }
  
  if (ans < (1ll<<60ll)) cout << ans << endl;
  else cout << -1 << endl;
}

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

int main(int argc, char **argv) {
  unsigned int A[5];
  unsigned int max_ = 0;

  for (int i = 0; i < 5; i++) {
    cin >> A[i];
    if (A[i] % 10 != 0 & (A[i] % 10) < (A[max_] % 10))
      max_ = i;
  }

  unsigned int ans = 0;
  for (int i = 0; i < 5; i++) {
    // align A[i] with 10
    if (i != max_)
      ans += ((A[i] + 9) / 10) * 10;
  }
  ans += A[max_];

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


Measured memory_bytes: 256
n=int(input())
l1=[]
l2=[]
for i in range(n):
  a,b=map(int,input().split())
  l1.append(a)
  l2.append(b)
l1.reverse()
l2.reverse()
ad=0
for i in range(n):
  a=l1[i]+ad
  b=l2[i]
  if a%b!=0:
    if a<b:
      ad+=b-a
    else:
      x=a//b+1
      ad+=b*x-a
print(ad)

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

using namespace std;

struct p{
    int l;
    int r;
}a[1000000];

bool cmp(p xx,p yy){
    return xx.l>yy.l;
}

int main(){
    int n,h;
    int c=0;
    scanf("%d%d",&n,&h);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[c++].l);
        a[c].r=1;
        scanf("%d",&a[c++].l);
    }
    sort(a,a+c,cmp);
    int sum=0;
    for(int i=0;i<c;i++)
    {
        if(a[i].r==1)
        {
            sum++;
            h-=a[i].l;
            if(h<=0)
            {
                printf("%d",sum);
                return 0;
            }
        }
        else if(a[i].r!=1)
        {
            if(h%a[i].l==0) sum+=h/a[i].l;
            else sum+=h/a[i].l+1;
            printf("%d",sum);
            return 0;

        }
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e5)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

int main()
{
    ll N;
    cin >> N;
    vector<ll> H(N);
    rep(i, N) { 
        cin >> H[i];
    }
    ll ma = 0;
    ll cnt = 0;
    rep(i, N-1) {
        if (H[i] >= H[i+1]) cnt++;
        else {
            ma = max(ma, cnt);
            cnt = 0;
        }
    }
    print(max(ma, cnt));
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

int solve(int N, int K) {
	vector<int>P(N);
	rep(i, N)P[i] = i;
	int ans = 0;
	do {
		int flag = 1;
		rep(i, N)if (abs(P[i] - i) == K) { flag = 0; break; }
		ans += flag;
		ans %= 924844033;

	} while (next_permutation(ALL(P)));
	return ans;
}

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

	
	int N, A, B;
	cin >> N >> A >> B;
	int ans = 0;
	rep(i, N) {
		int t;
		cin >> t;
		if (A <= t && t < B)continue;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<sstream>
using namespace std;
int m,n,pos;
string str;
vector<int> t;

bool check(int x){
  if(x%15==0)return (str=="FizzBuzz");
  if(x%5==0)return (str=="Buzz");
  if(x%3==0)return (str=="Fizz");
  if('0'<=str[0]&&str[0]<='9'){
    stringstream ss;
    ss<<str;
    int num;
    ss>>num;
    return (num==x);
  }else return false;
}

int main(){
  while(cin>>m>>n&&m&&n){
    t.clear();
    for(int i=0;i<m;i++)t.push_back(i+1);
    pos=0;
    for(int i=1;i<=n;i++){
      cin>>str;
      if(t.size()==1)continue;
      if(!check(i)){
	t.erase(t.begin()+pos);
	pos--;
      }
      pos++;
      if(pos==(int)t.size())pos=0;
    }
    for(int i=0;i<(int)t.size();i++){
      if(i)cout<<' ';
      cout<<t[i];
    }
    cout<<endl;
  }
  return 0;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int Len[51], Pat[51];

int rec(int k, int x) {
   if (x == Len[k]) return Pat[k];

   int ans = 0;

   x--;

   if (x > 0) {
      int l = min(x, Len[k-1]);
      ans += rec(k-1, l);
      x -= l;
   }

   if (x > 0) {
      ans++;
      x--;
   }

   if (x > 0) {
      int l = min(x, Len[k-1]);
      ans += rec(k-1, l);
      x -= l;
   }

   return ans;
}

signed main() {
   int N, X;
   cin >> N >> X;

   Len[0] = Pat[0] = 1;
   for (int i = 1; i <= N; i++) {
      Len[i] = Len[i-1] * 2 + 3;
      Pat[i] = Pat[i-1] * 2 + 1;
   }

   cout << rec(N, X) << endl;

   return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace C_Vacation
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            int[][] a = new int[100010][];
            int[][] dp = new int[100010][];
            for (int i = 0; i < 100010; i++)
            {
                
                a[i] = new int[3];
                
                dp[i] = new int[3];
            }
            for (int i = 0; i < N; i++)
            {
                var input = Console.ReadLine().Split(' ');
                for (int j = 0; j < 3; j++)
                {
                    a[i][j] = int.Parse(input[j]);
                }
            }

            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (j != k)
                        {
                            dp[i + 1][k] = Chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
                        }
                    }
                }
            }

            int res = 0;
            for (int i = 0; i < 3; i++)
            {
                res = Chmax(res, dp[N][i]);
            }
            Console.WriteLine(res);
        }
        public static int Chmax(int a, int b)
        {
            return a < b ? b : a;
        }
    }
}


Measured memory_bytes: 28216
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int n = 3;

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

    sort(a, a + n);

    cout << a[2] * 10 + a[1] + a[0] << endl;

    return 0;
}


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

int main()
{
  int n;

  cin >> n;

  vector<double> v(n);

  rep(i, n) cin >> v.at(i);

  double ans = 0;

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

  // ans = (v.at(0) + v.at(1))/2;
  // ans = (ans + v.at(n-1))/2;

  double hidari = 0, migi = 0;

  for (int i = 0; i < n-1; i++){
    hidari = v.at(i);
    migi = v.at(i + 1);
    v.at(i + 1) = (hidari + migi) / 2;
  }

  cout << v.at(n-1);
}


Measured memory_bytes: 3772
// author::mohammad faisal
#include<bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  cin >>n;
  set<string> lis;
  string s;
  for(int i=0;i<n;i++)
  {
    cin >> s;
    lis.insert(s);
  }
  cout<<lis.size();
  return 0;
}

Measured memory_bytes: 19116
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll s;
ll bin_search(ll l,ll r)
{
    ll mid=(l+r)/2;
    if(l==r)
        return l;
    if((mid*mid)<s)
        bin_search(mid+1,r);
    else
        bin_search(l,mid);
}
int main()
{
    ll i,j,k;
    scanf("%lld",&s);
    ll a,b,c;
    a=bin_search((ll)0,(ll)1000000000);
    //printf("%lld %lld\n",a,a*a);
    b=a;
    if(a*a-s>(s-(a-1)*(a-1)))
        b--;
    c=a*b-s;
    //printf("%lld\n",a*a-c);
    //printf("%lld %lld %lld %lld\n",a,a*a,s-a*a,s-(a-1)*(a-1));
    printf("%lld %lld %lld %lld %lld %lld",c,b,0,0,a,1);

}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll memo[MAX];
ll N;

ll rec(ll n) {
    if(n==0) return 0;
    if(memo[n]!=-1) return memo[n];
    
    ll res=n;
    for(ll i=1; i<=n; i*=6) {
        res=min(res, rec(n-i)+1);
    }
    for(ll i=1; i<=n; i*=9) {
        res=min(res, rec(n-i)+1);
    }
    
    return memo[n]=res;
}


int main() {
    cin >> N;
    memset(memo, -1, sizeof(memo));
    
    pr(rec(N));
    
    
    
    
}


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

using namespace std;

#define ll          long long int
#define endl        '\n'
#define pii         pair <int, int>
#define mk          make_pair

static const int maxn = 2e5 + 5;

signed main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr);

      double r;
      cin >> r;
      double pi = acos(-1.0);
      double cir = 2 * pi * r;
      cout << cir << endl;
}


Measured memory_bytes: 3796
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Usize1},
};

use itertools::zip;

#[fastout]
fn main() {
    input! {
        s: Bytes,
        t: Bytes,
    }
    println!(
        "{}",
        s.windows(t.len())
            .map(|s| zip(s, &t).filter(|&(s, t)| s != t).count())
            .min()
            .unwrap()
    );
}


Measured memory_bytes: 2116
#coding: UTF-8

import math


if __name__ == "__main__":
	data = list(map(int,input().split()))
	a = data[0]
	b = data[1]
	x = data[2]
	if a%x == 0:
		print((b-a)//x+1)
	else:
		if x > b:
			print("0")
		else: 
			if x < a:
				print((data[1]-(a+(x-a%x)))//data[2]+1)
			else:
				print((data[1]-data[2])//data[2]+1)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



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

  int ans = 0;
  REP(i, s.size()){
    if(s[i]== '+') ++ans;
    else --ans;
  }

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


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <map>
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0,tmp;
  std::vector<ll> sosu;
  cin >> n >> m;
  k = gcd(n,m);
  tmp = k;
  for(i=1;i<=(ll)sqrtl(k);i++){
    if(k==i){
      sosu.push_back(1);
      continue;
    }
    if(tmp%(k/i)==0) sosu.push_back(k/i);
    if(i==1){
      sosu.push_back(1);
      continue;
    }
    if(tmp%(i)==0) sosu.push_back(i);
  }
  sort(sosu.begin(),sosu.end());
  for(auto p : sosu){
    if(tmp%p!=0) continue;
    result++;
    if(p==1){
      continue;
    }
    while(tmp%p==0) tmp /= p; 
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 384
// D - Disjoint Set of Common Divisors
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

ll p_count(ll n){
	ll count = 0;
	for(ll p=2; p*p<=n; ++p){
		if(n%p) continue;
		count++;
		while(n%p == 0) n /= p;
	}
	if(n != 1) count++;
	return ++count;
}

int main(){
	ll A,B; cin>>A>>B;
	cout<< p_count(gcd(A,B)) <<endl;;
}

Measured memory_bytes: 256
N, L = map(int, input().split())

sum=0

if(L>=0):
    for i in range(2,N+1):
        sum += L+i-1
#        print(i)
else:
    if(abs(L)>=N):
        for i in range(1,N):
            sum += L+i-1
#            print("i=",i,"L+i-1=",L+i-1)
            #print(i)
    else:
        for i in range(1,N+1):
            sum += L+i-1
#            print("i=",i,"L+i-1=",L+i-1)

print(sum)

Measured memory_bytes: 3064