akhauriyash/Code-Regression huggingface dataset:
#include <set>
    #include <map>
    #include <list>
    #include <queue>
    #include <stack>
    #include <cmath>
    #include <ctime>
    #include <cstdio>
    #include <vector>
    #include <string>
    #include <bitset>
    #include <cctype>
    #include <cstdlib>
    #include <cstring>
    #include <utility>
    #include <numeric>
    #include <complex>
    #include <sstream>
    #include <fstream>
    #include <iomanip>
    #include <cassert>
    #include <iostream>
    #include <iterator>
    #include <algorithm>
    using namespace std;
    typedef long long ll;
    typedef vector<int> vint;
    typedef pair<int, int> pint;
    #define rep(i, n) REP(i, 0, n)
    #define all(v) v.begin(), v.end()
    #define REP(i, x, n) for(int i = x; i < n; i++)
    #define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d,x,flag=0,count=0;
  string s,s2;
  cin>>a;
  cout<<180*(a-2)<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100005], pref[100005], suff[100005];
int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++){
        scanf("%d", &a[i]);
        pref[i] = __gcd(pref[i-1], a[i]);
    }   
    for(int i=n;i>=1;i--){
        suff[i] = __gcd(suff[i+1], a[i]);
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
        ans = max(ans, __gcd(pref[i-1], suff[i+1]));
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1408
from fractions import gcd
from functools import reduce

def lcm_base(x, y):
  return (x * y) // gcd(x, y)

def lcm(*numbers):
  return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N = int(input())
A = list(map(int, input().split()))

LCM = lcm_list(A)
MOD = 10 ** 9 + 7
cnt = 0
for a in A:
  cnt += LCM // a

print(cnt % MOD)

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

//因数分解
map<int,int> prime_factor(int n){
  map<int,int> mp; //{約数,個数}
  for(int i = 2; i*i <= n; i++){
    while(n%i == 0){
      mp[i]++;
      n /= i;
    }
  }
  if(n != 1) mp[n] = 1; //n=素数
  return mp;
}

signed main(){

  int x; cin >> x;
  for(int i = x; ; i++){
    auto mp = prime_factor(i);
    if(mp[i] == 1){
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N, K; cin >> N >> K;
    if(N % K == 0) cout << 0 << endl;
    else cout << 1 << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 7;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans /= (i + 1);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll n,m,c = 0;
    cin >> n >> m;
    vector<ll> a(n);
    rep0(i, n){
        cin >> a[i];
        c += a[i];
    }
    ll cnt = 0;
    rep0(i, n)if(a[i] * 4 * m >= c)++cnt;
    if(cnt >= m)pf("Yes");
    else pf("No");
    return 0;
}



Measured memory_bytes: 256
let rec f n s =
  if n = 0 then s
  else
    let m = (n - 1) mod 26 in
    let c = char_of_int (m + int_of_char 'a') in
    f ((n - 1) / 26) (Char.escaped c ^ s)

let () =
  let n = read_int () in
  let s = f n "" in
  print_endline s


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,X;
  cin>>N>>X;
  vector<int>L(N);
  
  for(int i=0;i<N;i++){
cin>>L.at(i);
  }
  int ans=1;
  int sum=0;
  int che=0;
  for(int i=0;i<N;i++){
    sum+=L.at(i);
    ans++;
    if(sum>X){
      che++;
      break;
    }

  }
  if(che==1){
  cout<<ans-1<<endl;
  }

  else if(che==0){
cout<<ans<<endl;
  }
  
}
    

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
#define cn __builtin_popcount
typedef vector<int> vi;
const vi c[3]={{3,1,0,2},{2,0,1,3},{0,1,3,2}};
vi ngray(int n){
	vi s(1<<n);
	int i,j,k,x;
	s[1]=1;
	for(j=1;j<n;j+=2){
		for(i=(1<<j)-1;i>=0;i--){
			x=s[i];
			const vi&c=::c[i?i&1:2];
			for(k=0;k<4;k++)s[i<<2|k]=x<<2|c[k];
		}
	}
	return s;
}
vi cgray(int n){
	if(!n)return{0};
	vi s(1<<n);
	int i,j;
	s[1]=1;
	for(j=1;j<n;j++){
		for(i=0;i<1<<j;i++)s[(1<<(j+1))-1-i]=(1<<j)|s[i];
	}
	return s;
}
int main(){
	int n,i,j,k,a,b;
	vi p1,p0,pn,pc;
	int n1,n0,nn,nc;
	scanf("%d%d%d",&n,&a,&b);
	b^=a;
	for(i=0;i<n;i++)(b>>i&1?p1:p0).push_back(i);
	n1=p1.size();
	n0=p0.size();
	if(~n1&1){
		printf("NO");
		return 0;
	}
	pn=ngray(n1);
	pc=cgray(n0);
	nn=pn.size();
	nc=pc.size();
	printf("YES\n");
	for(i=0;i<nn;i++){
		for(j=0;j<nc;j++){
			b=0;
			for(k=0;k<n0;k++)b|=(pc[i&1?nc-1-j:j]>>k&1)<<p0[k];
			for(k=0;k<n1;k++)b|=(pn[i]>>k&1)<<p1[k];
			printf("%d ",b^a);
		}
	}
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  while(cin >>n){
    vector<int> ans;
    for(int i=512; i>=1; i/=2){
      if(n>=i){
	n-=i;
	ans.push_back(i);
      }
    }
    for(int i=ans.size()-1; i>=0; i--){
      if(i!=ans.size()-1) cout <<" ";
      cout <<ans[i];
    }
    cout <<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = "" + scanner.nextInt();
        scanner.close();
        if (s.contains("7")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 38708
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,k,a[200010],to[200010];
vector<int>v[200010],ans;
signed main(){
    cin>>n>>k;
    rep(i,n){
        cin>>a[i];
        v[a[i]].pb(i);
    }
    rep(i,n){
        if(v[a[i]].back()==i){
            to[i]=v[a[i]][0];
        }
        else{
            to[i]=*upper_bound(all(v[a[i]]),i);
        }
        to[i]=(to[i]+1)%n;
    }
    int period=0,now=0;
    while(1){
        if(to[now]<=now+1){
            period++;
            if(now==n-1&&to[now]==0)period++;
        }
        now=to[now];
        if(now==0)break;
    }
    k=(k-1)%period+1;
    int cnt=0,i;
    while(1){
        if(to[now]<=now+1){
            cnt++;
            if(now==n-1&&to[now]==0)cnt++;
            if(cnt>=k){
                i=now;
                break;
            }
        }
        now=to[now];
        if(now==0)break;
    }
    int st=i;
    while(st<=i&&i<n){
        if(i!=n-1&&to[i]==0)break;
        if(to[i]>i+1)i=to[i];
        else{
            ans.pb(a[i]);
            i++;
        }
    }
    rep(i,ans.size())cout<<ans[i]<<(i==ans.size()-1?"\n":" ");
    return 0;
}

Measured memory_bytes: 17652
//
//AtCoder Beginner Contest 144
//A - 9x9
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <functional>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int a, b;

    cin >> a >> b;

    int ans = -1;

    if(a<=9 && b<=9) ans = a * b;

    cout << ans << endl;

    return 0;
}


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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    int n;
    cin >> n;
    vll l(n + 1);
    l[0] = 2;
    l[1] = 1;
    FOR(i, 2, n + 1) {
        l[i] = l[i - 1] + l[i - 2];
    }
    cout << l[n] << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<set>
#include<vector>
using namespace std;

#define INF 1<<21
#define MOD 1000000007

int main(){
    char x,y;
    cin>>x>>y;
    if(x<y){
        cout<<"<"<<endl;
    }else if(x>y){
        cout<<">"<<endl;
    }else{
        cout<<"="<<endl;
    }
    
    return 0;
}


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

using namespace std;

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int counter = 0;
    for(int i = 0; i < s.length(); i++) {
        if(s[i] != t[i]) counter++;
    }
    cout << counter << endl;
}

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

using namespace std;
//#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int a,b,c,d,e,f;
signed main(){
  cin>>a>>b>>c>>d>>e>>f;
  int sw=0;int s=0;
  int al=(f/a/100)+1;int bl=(f/b/100)+1;
  al=31;bl=31;
  int anss=0;
  int anssw=100*a;
  rep(i,al+1){
    rep(j,bl+1){
      sw=100*i*a+100*j*b;
      int w=sw;
      //cout<<"i,j"<<endl;
      //cout<<i<<" "<<j<<endl;
      if(sw>f)break;
      if(sw==0)continue;
      int limit=w*e/100;
      int cl=(limit/c)+1;
      int dl=(limit/d)+1;
      cl=3000;dl=3000;
      rep(ci,cl+1){
        rep(di,dl+1){
          sw=w;
          int sugar=(ci*c)+(di*d);
          sw+=sugar;

          if(sugar>limit)break;
          //cout<<1<<endl;
          if(sw>f)break;
          //cout<<2<<endl;
          if(sugar==0)continue;
          //cout<<"ci,di"<<endl;
          //cout<<ci<<" "<<di<<endl;
          if(sugar==limit){
            anss=sugar;
            anssw=sw;
            //cout<<"FINE"<<endl;
            //cout<<i<<" "<<j<<" "<<ci*c<<" "<<di*d<<endl;
            goto FINE;
          }
          if(anss*sw<sugar*anssw){
            anss=sugar;
            anssw=sw;
            //cout<<anssw<<" "<<anss<<endl;
            //cout<<"here"<<endl;
          }
        }
      }
    }
  }
  FINE:
  cout<<anssw<<" "<<anss<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

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

const long long int mod=1e9+7;



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


	priority_queue<P> queue;
	REP(i,N)
	{
		int a,b;
		cin >> a >> b;
		queue.push(P(-a,b));
	}


	lint ans=0;

	priority_queue<int> tq;
	for(int i=1;i<=M;++i){
		while(!queue.empty()){
			int tmp=queue.top().first;
			//cout << tmp << " " << i << endl;
			if(tmp>=-i){
				tq.push(queue.top().second);
				//cout << "ok" << i << " " << queue.top().first << " " << queue.top().second << endl;
				queue.pop();
			}else{
				//cout << "no" << i << " "  << queue.top().first << " " << queue.top().second << endl;
				break;
			}
		}
		if(!tq.empty()){
			ans+=tq.top();
			tq.pop();
		}



	}

	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 1908
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

int n;
int t[5][5];

int solve(){
  int w[5][5];
  memset(w,0,sizeof(w));

  rep(i,n){
    rep(j,n){
      if(t[i][j] == 0) continue;

      if(i == 0){
        w[i][j] = 1;
      } else{
        w[i][j] = w[i-1][j] + 1;
      }
    }
  }

  int res = 0;
  rep(i,n){
    rep(j,n){
      int height = INT_MAX;
      REP(k,j,n){
        height = min(height,w[i][k]);
        res = max(res,height*(k-j+1));
      }
    }
  }
  return res;
}

int main(){
  n = 5;

  int T;
  cin>>T;

  while(T--){
    rep(i,n){
      rep(j,n){
        cin>>t[i][j];
      }
    }
    cout<<solve()<<endl;
  }
}

Measured memory_bytes: 0
//containing t test cases
#include<bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define mkp make_pair
#define fi first
#define se second
#define ll long long
#define scan(n) ll a[n]; for(ll i = 0 ; i<n ; i++) cin>>a[i]
#define scan1(b,n) for(ll i = 0 ; i<n ; i++) cin>>b[i]
#define sortt(a) sort(a.begin(),a.end());
#define print(a,n) for(ll i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define pi 3.1415926535897932384626433832795028841971
#define mem(a,b) memset(a , b , sizeof a ) ;
//#define int long long
using namespace std;
//typedef vector<int>vi ;
typedef vector<ll>vi ;
typedef vector<vector<ll> >vvl ; 
typedef pair<ll,ll> pll ;
typedef vector<pair<ll,ll> > vpll;
//cout<<fixed<<setprecision(15);
/*vi adj[200005];
ll vis[200005];
ll parent[200005];
ll level[200005];
ll arr[200005];
ll size[200005];*/
//endl mut bhool!!
void solve()
{
	ll n;
	cin>>n;
	string s1[4];
	s1[0]="AC";
	s1[1]="WA";
	s1[2]="TLE";
	s1[3]="RE";
	ll a[4]={0};
	rep(i,0,n)
	{
		string s;
		cin>>s;
		if(s=="AC")a[0]++;
		else if(s=="WA")a[1]++;
		else if(s=="TLE")a[2]++;
		else a[3]++;
	}
	rep(i,0,4)
	{
		cout<<s1[i]<<" x "<<a[i]<<endl;
	}

}
int main()
{
	fast;
	ll test=1;
	//cin>>test;
	while(test--)
	{
		solve();
	}
	return 0;
}
/*
cout<<"YES"<<endl;
cout<<"NO"<<endl;
*/

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

struct Sieve {
  vector<int> table, primes;
  // table[i] := i をふるいにかけた素数 p を記録

  Sieve(int N = 1) {
    table.resize(N+1);
    table.at(0) = table.at(1) = -1;
    for (long long i = 2; i <= N; i++) {
      if (table.at(i) > 0) continue;
      primes.push_back(i);
      table.at(i) = i;
      for (long long j = i*i; j <= N; j += i) {
        if (table.at(j) == 0) table.at(j) = i;
      }
    }
  }

  bool isPrime(int x) { return table.at(x) == x; }

  vector<pair<int, int>> prime_factorize(int x) {
    vector<int> factors;
    while (x != 1) {
      factors.push_back(table.at(x));
      x /= table.at(x);
    }
    if (factors.size() == 0) return {};
    vector<pair<int, int>> res;  // first: 素因数, second: 個数
    res.push_back(make_pair(factors.at(0), 0));
    for (int prime : factors) {
      if (res.back().first == prime) res.back().second++;
      else res.push_back(make_pair(prime, 1));
    }
    return res;
  }
};

int main() {
  long long N; cin >> N;
  Sieve s(N);
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    vector<pair<int, int>> pf = s.prime_factorize(i);
    long long f = 1;
    for (auto p : pf) f *= (p.second + 1);
    ans += i * f;
  }
  cout << ans << endl;
}

Measured memory_bytes: 46472
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = S()
    for i in n:
        if i == "1":
            print(9,end = "")
        else:
            print(1,end = "")
    print()
#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    A()


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


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

    ll L[87];

    L[0] = 2;
    L[1] = 1;

    for (int i = 2; i <= n; ++i) L[i] = L[i-2] + L[i-1];

    cout << L[n] << endl;

    return 0;
    
}

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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve() {
	string s;
	cin >> s;
	map<char, int> m;
	rep(i, s.length()) {
		m[s[i]]++;
	}
	for (auto it = m.begin(); it != m.end(); it++) {
		if (it->second != 1) {
			P("no");
			return;
		}
	}
	P("yes");
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

int in() { int x; scanf("%d", &x); return x; }

int main() {
  int N = in();

  if (N < 1200) {
    printf("ABC\n");
  } else if (N < 2800) {
    printf("ARC\n");
  } else {
    printf("AGC\n");
  }
  return 0;
}



Measured memory_bytes: 256
n = int(input())
s = list(map(int,input().split()))
un = 0
un_1 = 0


while un < n-1:
  s.sort()
  sign = 0
  for i in range(un_1,n):
    if s[i] == 0:
      un = i+1
      continue

    if i == un:
      continue
    
    temp = s[i] - (s[i]//s[un])*s[un]
    
    if 0 <= temp:
      s[i] = temp
    elif temp < 0:
      s[i] = 0
    
  un_1 = un
    
print(s[un])

Measured memory_bytes: 14228
S = input()
cnt = 0
for p in range(2 ** (len(S) - 1)):
  F = S[0]
  for i in range(len(S) - 1):
    F += '+' if p % 2 else ''
    F += S[i + 1]
    p //= 2
  cnt += sum([int(f) for f in F.split('+')])
print(cnt)

Measured memory_bytes: 3060
#include"bits/stdc++.h"
using namespace std;

int main(){
    string N;
    cin>>N;
    int size=N.size();
    long result=0;

    for(int tmp=0;tmp<(1<<(size-1));tmp++){
        bitset<9>n(tmp);
        long sum=0;
        int z=0;
        for(int i = 0; i < size-1; i++){
            if(n.test(i)){
                string x=N.substr(z,i+1-z);
                long y=stol(x);
                sum+=y;
                z=i+1;
            }
        }
        string t=N.substr(z);
        long s=stol(t);
        sum+=s;
        result+=sum;
    }
    cout<<result<<endl;
}

Measured memory_bytes: 256
import java. io.*;

class Main
{
     public static void main(String[] args) throws IOException
     {

	BufferedReader br =
    	 new BufferedReader (new InputStreamReader(System.in));
	
	String str1 = br.readLine();
	String str2[] = str1.split(" ");
	int a = Integer.parseInt(str2[0]);
	int b = Integer.parseInt(str2[1]);
	int c = a*b;
	int d = 2*(a+b);
	System.out.println( c + " " + d );
	
      }
}

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

#include <iostream>
using namespace std;

int main() {
	int a,b;
	cin >> a >> b;
	cout << a*b << " " << 2*(a+b) << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
  ll x;
  cin >> x;
  ll n = x / 500;
  x -= (n * 500);
  ll m = x / 5;
  ll ans = (n * 1000) + (m * 5);
  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 256
from collections import deque

N, M = map(int, input().split())
S = [set() for i in range(N)]
visited = [-1] * N
colorcount = [-1] * N

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    S[a].add(b)
    S[b].add(a)

q = deque()
for i in range(N):
    q.append(i)
    color = i
    cnt = 1
    while len(q):
        nt = q.popleft()
        if visited[nt] != -1:
            continue
        visited[nt] = color
        q.extend(S[nt])
        cnt += 1
    colorcount[color] = cnt - 1

print(max(colorcount))


Measured memory_bytes: 74352
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

template<int N> class AdjacentLoop {
private:
  const static array<int, N> dy, dx;

  struct Iterator {
    const int y, x, h, w;
    int val;

    Iterator(int y, int x, int h, int w, int val) : y(y), x(x), h(h), w(w), val(val) {
      for (; this->val < N; ++this->val) {
        int yy = y + dy[this->val];
        int xx = x + dx[this->val];
        if (0 <= yy && yy < h && 0 <= xx && xx < w) break;
      }
    }

    pair<int, int> operator*() {return make_pair(y + dy[val], x + dx[val]);}

    bool operator!=(Iterator& itr) {return val < itr.val;}

    void operator++() {
      while (++val < N) {
        int yy = y + dy[val];
        int xx = x + dx[val];
        if (0 <= yy && yy < h && 0 <= xx && xx < w) break;
      }
    }
  };

  Iterator i, n;

public:
  AdjacentLoop(int y, int x, int h, int w) : i(y, x, h, w, 0), n(y, x, h, w, N) {}

  Iterator& begin() {return i;}

  Iterator& end() {return n;}
};

template<> const array<int, 2> AdjacentLoop<2>::dy = {{0, 1}};
template<> const array<int, 2> AdjacentLoop<2>::dx = {{1, 0}};

template<> const array<int, 4> AdjacentLoop<4>::dy = {{0, -1, 0, 1}};
template<> const array<int, 4> AdjacentLoop<4>::dx = {{1, 0, -1, 0}};

template<> const array<int, 5> AdjacentLoop<5>::dy = {{0, -1, 0, 1, 0}};
template<> const array<int, 5> AdjacentLoop<5>::dx = {{1, 0, -1, 0, 0}};

template<> const array<int, 8> AdjacentLoop<8>::dy = {{-1, -1, -1, 0, 0, 1, 1, 1}};
template<> const array<int, 8> AdjacentLoop<8>::dx = {{-1, 0, 1, -1, 1, -1, 0, 1}};

template<> const array<int, 9> AdjacentLoop<9>::dy = {{-1, -1, -1, 0, 0, 0, 1, 1, 1}};
template<> const array<int, 9> AdjacentLoop<9>::dx = {{-1, 0, 1, -1, 0, 1, -1, 0, 1}};

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  cin >> s;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (s[i][j] == '.') continue;
      bool ok = false;
      for (auto p : AdjacentLoop<4>(i, j, h, w)) {
        if (s[p.first][p.second] == '#') ok = true;
      }
      if (!ok) {
        cout << false << endl;
        return 0;
      }
    }
  }
  cout << true << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int a, b;
  cin >> a >> b;
  if (a < 10 && b < 10) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int x, y;
		x = scanner.nextInt();
		y = scanner.nextInt();
		while (x + y != 0) {
			int n = scanner.nextInt();
			int a[] = new int[n];
			int b[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = scanner.nextInt();
				b[i] = scanner.nextInt();
			}
			System.out.println(f(x, y, 1, 1, a, b));
			x = scanner.nextInt();
			y = scanner.nextInt();
		}
	}

	public static int f(int x, int y, int a, int b, int n[], int m[]) {
		if ((a == x - 1 && b == y) || (a == x && b == y - 1)) {
			return 1;
		}
		int flag = 1;
		int k1 = 0, k2 = 0;

		if (a < x) {
			for (int i = 0; i < n.length; i++) {
				if (a + 1 == n[i] && b == m[i]) {
					flag = 0;
					break;
				}
			}
			if (flag == 1) {
				k1 = f(x, y, a + 1, b, n, m);
			}
		}

		flag = 1;

		if (b < y) {
			for (int i = 0; i < n.length; i++) {
				if (a == n[i] && b + 1 == m[i]) {
					flag = 0;
					break;
				}
			}
			if (flag == 1) {
				k2 = f(x, y, a, b + 1, n, m);
			}
		}

		return k1 + k2;
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

bool cmp(pii a, pii b){
    if(a.ft == b.ft) return a.sd < b.sd;
    return a.ft > b.ft;
}
void solve(){
    ll n, d, x;
     cin >> n >> d >> x;
     ll aa = 0;
     rep(i, n)
     {
         ll a; cin >> a;
         for(ll i = 0; i <= 100; i++){
            ll k = a*i+1;
            if(k <=d) aa++;
         }
     }
     cout << aa+x;
}
main(){
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int k;
  cin >> k;
  string s;
  cin >> s;
  int n=s.size();
  if(n<=k)cout << s << endl;
  else cout << s.substr(0,k)<<"..." << endl;
    
  return 0;     
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

template <class F,class C> struct MCF{
    const C inf;
    struct edge{
        int cd;
        F cp;
        C cs;
        size_t rv;
        bool f;
    };
    vector<vector<edge>> v;
    vector<C> pt,m;
    vector<int> pv,pe;
    MCF(int n):inf(numeric_limits<C>::max()),v(n){}
    void ad(int dm,int cd,F cp,C cs){
        v[dm].emplace_back((edge){cd,cp,cs,v[cd].size(),0});
        v[cd].emplace_back((edge){dm,0,-cs,v[dm].size()-1,1});
    }
    C mcf(int s,int t,F f){
        int n=v.size();
        C ret=0;
        priority_queue<pair<C,int>,vector<pair<C,int>>,greater<>> pq;
        pt.assign(n,0);
        pv.assign(n,-1);
        pe.assign(n,-1);
        while(f>0){
            m.assign(n,inf);
            pq.emplace(0,s);
            m[s]=0;
            while(!pq.empty()){
                auto p=pq.top();pq.pop();
                if(m[p.second]<p.first) continue;
                for(int i=0;i<v[p.second].size();++i){
                    edge &e=v[p.second][i];
                    C nc=m[p.second]+e.cs+pt[p.second]-pt[e.cd];
                    if(e.cp>0&&m[e.cd]>nc){
                        m[e.cd]=nc;
                        pv[e.cd]=p.second;pe[e.cd]=i;
                        pq.emplace(m[e.cd],e.cd);
                    }
                }
            }
            if(m[t]==inf) return -1;
            for(int i=0;i<n;++i) pt[i]+=m[i];
            F add=f;
            for(int i=t;i!=s;i=pv[i]) add=min(add,v[pv[i]][pe[i]].cp);
            f-=add;
            ret+=add*pt[t];
            for(int i=t;i!=s;i=pv[i]){
                edge &e=v[pv[i]][pe[i]];
                e.cp-=add;
                v[i][e.rv].cp+=add;
            }
        }
        return ret;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,f,u,v,c,d;
    cin>>n>>m>>f;
    MCF<int,int> mcf(n);
    fr(i,m){
        cin>>u>>v>>c>>d;
        mcf.ad(u,v,c,d);
    }
    cout<<mcf.mcf(0,n-1,f)<<endl;
}


Measured memory_bytes: 3240
#include <iostream>
#include <cstdio>

#define MAX_N 2010
#define MX 4000010
#define MOD 1000000007

using std::cerr;
using std::endl;

int N, K, f[MAX_N][MAX_N];
int fac[MX], ifac[MX], inv[MX];

int C(int x, int y){
	return 1ll * fac[x] * ifac[y] % MOD* ifac[x-y] % MOD;
}

int main(){
	fac[0] = ifac[0] = inv[1] = 1;
	for(int i = 2; i < MX; i++) 
		inv[i] = 1ll * (MOD-MOD/i) * inv[MOD%i] % MOD;
	for(int i = 1; i < MX; i++){
		fac[i] = 1ll * fac[i-1] * i % MOD;
		ifac[i] = 1ll * ifac[i-1] * inv[i] % MOD;
	}
	scanf("%d%d", &N, &K);
	if(K == 1){
		puts("1"); return 0;
	}
	for(int i = 0; i <= N; i++) f[i][0] = 1;
	for(int i = 1; i <= N; i++)
		for(int j = 1; j <= i; j++)
			f[i][j] = (f[i-1][j] + 1ll * f[i][j-1] * C((N-j+1)*(K-1)+(N-i)-1, K-2) % MOD) % MOD;
	f[N][N] = 1ll * f[N][N] * fac[N] % MOD;
	printf("%d\n", f[N][N]);
	return 0;
}

Measured memory_bytes: 62848
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = 2 * pow(10, 9) + 1;//+1しないとREになるかも(out of rangeになるんかな?? )

vector<int> dx = { -1, 0, 1, 0, -1, -1, 1, 1 };
vector<int> dy = { 0, -1, 0, 1, -1, 1, -1, 1 };

int main(void) {
	int N;
	cin >> N;
	
	vector<int> a(N), b(N), c(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i] >> c[i];

	}
	VVI act(N, vector<int>(3));
	for (int i = 0; i < N; i++) {
		act[i][0] = a[i];
		act[i][1] = b[i];
		act[i][2] = c[i];
	}
	
	VVI dp(N + 1, vector<int>(3 + 1, -1));//dp[i][j]:i日目にjをした時の最大幸福値
	dp[0][0] = act[0][0];
	dp[0][1] = act[0][1];
	dp[0][2] = act[0][2];
	for (int i = 1; i < N; i++) {
		for (int j = 0; j < 3; j++) {
			int act0 = j % 3;
			int act1 = (j + 1) % 3;//
			int act2 = (j + 2) % 3;
			dp[i][act0] = max(dp[i - 1][act1], dp[i - 1][act2]) + act[i][act0];
		}
	}

	int ans = max(dp[N-1][0], dp[N-1][1]);
	ans = max(ans, dp[N-1][2]);
	cout << ans << endl;

}


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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

int main(){
  ll H,W,N;
  cin >> H >> W >> N;
  map<PII, int> cnt;
  rep(i,N){
    int a,b;
    cin >> a >> b;
    a--,b--;
    rep(j,9){
      if(a+dy[j] < H-1 && a+dy[j] >= 1 && b + dx[j] < W-1 && b + dx[j] >= 1){
        //cout << a+dy[j] << " , " <<  b + dx[j] << endl;
        cnt[make_pair(a+dy[j], b + dx[j])]++;
      }
    }
  }

  VLL ans(10,0);
  ll sum = 0;
  for(auto x: cnt){
    //cout << x.first.first << " " <<x.first.second << endl;
    ans[x.second]++;
    sum++;
  }

  ans[0] = (H-2)*(W-2) - sum;
  rep(i,10){
    cout << ans[i] << endl;
  };
  return 0;
}


Measured memory_bytes: 56448
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		
		if( n % 2 == 0 ){
			System.out.println(n);
		}else{
			System.out.println(n*2);
			
		}
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string A, B;
    cin >> A >> B;
    if (A[0] == B[2] && A[1] == B[1] && A[2] == B[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <string.h>
#include <stdlib.h>

\
int main (){
    
  int a,b,t;
  int ans,n;
  
  scanf("%d %d %d",&a,&b,&t);
  
  n = t / a;
  ans = b * n;
  
  printf("%d",ans);
      return 0;
  
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

ll dp[100][2];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    ll K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N)cin >> A[i];
    for(int i=0;i<100;i++)dp[i][0] = dp[i][1] = -1;
    dp[45][0] = 0;
    for(int d=44;d>=0;d--){
        ll mask = 1LL << d;
        int num = 0;
        for(int i=0;i<N;i++)if(A[i]&mask)num++;

        if(dp[d+1][1]>=0)dp[d][1] = max(dp[d][1],dp[d+1][1] + mask*max(num,N-num));
        if(dp[d+1][0]>=0){
            if(K&(1LL<<d)){
                chmax(dp[d][1],dp[d+1][0] + mask*num);
                chmax(dp[d][0],dp[d+1][0] + mask*(N-num));
            }else{
                chmax(dp[d][0],dp[d+1][0] + mask*num);
            }
        }
    }
    cout << max(dp[0][0],dp[0][1]) << endl;
}

Measured memory_bytes: 1024
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = new Array(N);
  for(var i = 0; i < N; i++){
    list[i] = nextIntArray();
  }
  var avg = 0;
  dfs([]);
  var kaijo = 1;
  for(var i = 1; i <= N; i++){
    kaijo *= i;
  }
  myout(avg / kaijo);

  function dfs(used){
    if(used.length == N){
      var sum = 0;
      for(var i = 1; i < used.length; i++){
        var mae = list[used[i - 1]];
        var ato = list[used[i]];
        sum += Math.sqrt(Math.pow(Math.abs(mae[0] - ato[0]) , 2) + Math.pow(Math.abs(mae[1] - ato[1]) , 2));
      }
      avg += sum;
      return;
    }
    for(var i = 0; i < N; i++){
      if(used.indexOf(i) == -1){
        var tmp = makeClone(used);
        tmp.push(i);
        dfs(tmp);
      }
    }
  }
}


Measured memory_bytes: 37464
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,f;
int main(){
	cin>>n;
	for(int i=1;i<=9;++i)
		for(int j=1;j<=9;++j)
			if(i*j==n) f=1;
	puts(f?"Yes":"No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int n,res;
string s,ans;
map<string,int> mp;
vector<string> t;
int main() {
	std::ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> s;
		mp[s]++;
		res = max(res,mp[s]);
	}
	for (auto it : mp) {
		if (it.second == res) cout << it.first << endl;
	}
	
}

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

ll solve() {
    ll N;
    cin >> N;
    vector<ll> C(N-1), S(N-1), F(N-1);
    for ( int i = 0; i < N-1; i++ ) {
        cin >> C[i] >> S[i] >> F[i];
    }
    vector<ll> ans(N);
    for ( int n = 0; n < N-1; n++ ) {
        ll t = 0;
        for ( int i = n; i < N-1; i++ ) {
            if ( t <= S[i] ) {
                t = S[i] + C[i];
            } else {
                t = (t + F[i] - 1)/F[i] * F[i] + C[i];
            }
        }
        ans[n] = t;
    }
    ans[N-1] = 0;
    for ( int n = 0; n < N; n++ ) {
        cout << ans[n] << "\n";
    }

    return 0;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define all(cont) cont.begin(), cont.end()
#define unique(a)  sort(all(a)) , (a).erase(unique((a).begin(), (a).end()),(a).end())
#define rall(cont) cont.rbegin(), cont.rend()
#define sz(x) (int)(x).size()
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define f first
#define s second
#define mset(m,v) memset(m,v,sizeof(m))
#define mod 1000000007
const int N = 2e5 + 5;
#define PI acos(-1.0)
long double EPS = 1e-9;
typedef long long ll;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define pqll_max priority_queue<ll> // max heap. push(),pop(),top(),size(),empty()
#define pqll_min priority_queue<ll,vector<ll>,greater<ll> >
#define lb(v,val)   lower_bound(v.begin(),v.end(),val) //first equal to or lower than [------------
#define ub(v,val)   upper_bound(v.begin(),v.end(),val) //first greater than ------------)
#define bs(v,x) binary_search(v.begin(),v.end(),x)
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x; }
inline ll sub(int x, int y) { x -= y; if (x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return (x%mod * 1ll * y%mod) % mod; }
inline ll pwr(ll a, ll b) { ll x = 1 % mod; while (b) { if (b & 1) x = mul(x, a); a = mul(a, a); b >>= 1; }return x % mod; }
inline ll inv(ll a) { return pwr(a, mod - 2) % mod; }
ll gcd(ll a, ll b) { if (!a)return b % mod; return gcd(b%a, a) % mod; }
#define debug(x) cout << #x << " = " << x << endl;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#define in(container) for (auto &it : container) cin>>it;
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
void solve() {
	int x, y;
	cin >> x >> y;
	if ((4 * x - y) >= 0 && (4 * x - y) % 2 == 0 && (y - 2 * x) >= 0 && (y - 2 * x) % 2 == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}
signed main()
{
	fastio;
	//cout<<fixed<<setprecision(15);
	//clock_t begin = clock();
	int tc;
	tc = 1;
	//cin >> tc;
	while (tc--) {
		solve();
	}
	//clock_t end = clock();double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;cerr << elapsed_secs;
}


//Error?
// clear lists for every test case
// print new line for each tc
// check for int or ll
// check if problem can be solved without any heavy DS like priority_queue or map



Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include <vector>
#include <functional>
#include <map>
using namespace std;

int n;
int list[4][3][10];
int main(){

	cin >> n;

	for (int i = 0; i < n; ++i){
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		
		list[b - 1][f - 1][r - 1] += v;
	}

	for (int b = 0; b < 4; ++b){
		for (int f = 0; f < 3; ++f){
			for (int r = 0; r < 10; ++r){

				cout << " " << list[b][f][r];
			}
			cout << endl;
		}
		if (b != 3)
			cout << "####################" << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int gcd(int x, int y) { return y ? gcd(y,x%y) : x; }

int main(){
    int n; cin >> n;
    vector<int> A(n);
    rep(i,n) cin >> A[i];
    vector<int> L(n), R(n);
    L[0] = A[0]; R[n-1] = A[n-1];
    for(int i = 1; i < n; i++) L[i] = gcd(L[i-1], A[i]);
    for(int i = n-2; i >= 0; i--) R[i] = gcd(R[i+1], A[i]);
    int ans = 0;
    rep(i,n){
        if(i == 0) ans = max(ans, R[i+1]);
        else if(i == n-1) ans = max(ans, L[i-1]);
        else ans = max(ans, gcd(L[i-1], R[i+1]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>                                      
using namespace std;
int main(int argc, char *argv[]){
	int n; cin >> n;
	int cnt = 0;
	for(int i = 1; i < n; i++){
		for(int j = 1; j < n; j++){
			if(i * j >= n) break;
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}

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

int main() {
	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;

	int ans = A*X + B*Y;
	for (int c = 0; c <= max(X, Y); c++) {
		int nX = max(0, X - c);
		int nY = max(0, Y - c);
		int nZ = 2 * c;
		ans = min(ans, A*nX + B*nY + C * nZ);
	}

	cout << ans << endl;
}

Measured memory_bytes: 256