akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool comp(int a, int b)
{
    return a > b;
}

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    int tmp;
    vector<int> A;
    vector<int> B;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        A.emplace_back(tmp);
    }

    B = A;
    sort(A.begin(), A.end(), comp);
    int max = A[0];
    int ans;

    for (int n : B)
    {
        if (n < max)
        {
            ans = max;
        }else
        {
            ans = A[1];   
        }
        cout << ans << endl;
        
    }
    
    return 0;
}

Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
#include<set>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N, count=0;
	string S;
	cin >> N >> S;
	FOR(i, 0, 1000)
	{
		string str = to_string(i);
		if(str.size()==1)
			str = "00" + str;
		else if(str.size()==2)
			str = '0' + str;
		int K = 0;
		FOR(j, 0, N)
		{
			if(S[j]==str[K]){
				if(K==2){
					count++;
					break;
				}
				else
					K++;
			}
		}
	}

	cout << count << endl;

	return 0;
}



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

using namespace std;

int main(){
    int n;
    double  div=1.,lon=0.;
    cin >> n;
    vector <int> x(n),y(n);
    for (int i=0;i<n;i++){
        cin >> x[i];
      	cin >> y[i];
        div *=i+1;
    }

    for(int h=0;h<n-1;h++){
        for(int j=h+1;j<n;j++){
            lon += 1.*pow(pow(x[h]-x[j],2)+pow(y[h]-y[j],2),0.5)*2/n;
          
        }
    }
    cout <<std::setprecision(20)<< lon <<endl;
}

Measured memory_bytes: 256
program hi;
type ars = array[1..200000] of string;
var 
    n, i, cnt: longint;
    s, tmp: ars;
 
procedure mSort(var a, tmp: ars; l, r: longint);
var m, i, i1, i2: longint;
begin
    if l < r then begin
        m := (l + r) div 2;
        mSort(a, tmp, l, m);
        mSort(a, tmp, m + 1, r);
        i := l; i1 := l; i2 := m + 1;
        while (i1 <= m) and (i2 <= r) do begin
            if a[i1] <= a[i2] then begin
                tmp[i] := a[i1];
                inc(i1);
            end else begin
                tmp[i] := a[i2];
                inc(i2);
            end;
            inc(i);
        end;
        if i1 <= m then 
            while i1 <= m do begin
                tmp[i] := a[i1];
                inc(i1); inc(i);
            end 
        else 
            while i2 <= r do begin
                tmp[i] := a[i2];
                inc(i2); inc(i);
            end;
        for i := l to r do 
            a[i] := tmp[i];
    end;
end;
 
begin
    readln(n);
    for i := 1 to n do 
        readln(s[i]);
    mSort(s, tmp, 1, n);
    cnt := 1;
    for i := 1 to n - 1 do 
        if s[i] <> s[i + 1] then
            inc(cnt);
    writeln(cnt);
end.

Measured memory_bytes: 59984
#include <stdio.h>

int main(void){
	char ch;
	int cnt[26] = {0};
	int num,i,len;

	while(scanf("%c", &ch) != EOF){
		if(ch >= 'a' && ch <= 'z'){
			num = ch - 'a';
			cnt[num]++;
		}else if(ch >= 'A' && ch <= 'Z'){
			num = ch - 'A';
			cnt[num]++;
		}
	}

	len = sizeof(cnt) / sizeof(cnt[0]);
	for(i = 0;i < len;i++){
		printf("%c : %d\n", 'a' + i, cnt[i]);
	}
	return 0;
}

Measured memory_bytes: 540
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int a[3][3],n;
	for (int j = 0; j < 3; j++) {
		for (int k = 0; k < 3; k++) {
			cin >> a[j][k];
		}
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		int b;
		cin >> b;
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (a[j][k] == b) {
					a[j][k] = 0;
				}
			}
		}
	}
	for (int j = 0; j < 3; j++) {
		for (int k = 0; k < 3; k++) {
			if (a[j][k] != 0) {
				break;
			}
			if (k == 2) {
				cout << "Yes" << endl;
				return 0;
			}
		}

		
	}
	for (int j = 0; j < 3; j++) {
		for (int k = 0; k < 3; k++) {
			if (a[k][j] != 0) {
				break;
			}
			if (k == 2) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	if ((a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) || (a[2][0] == 0 && a[1][1] == 0 && a[2][0] == 0)) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;

}

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

ll s(ll n){
    return n*(n-1)/2;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) a[i]--;
    vector<int> cnt(n);
    rep(i,n) cnt[a[i]]++;
    ll t = 0;
    rep(i,n){
        t += s(cnt[i]);
    }
    rep(i,n){
        ll ans = t;
        ans -= s(cnt[a[i]]);
        ans += s(cnt[a[i]]-1);
        cout << ans << endl;
    }
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
map<int,int> data;
pair<int,int> meh[2000005];
bool cmp(pair<int,int> a,pair<int,int> b){
	if(a.second != b.second) return a.second<b.second;
	return a.first < b.first;
}
int main(){
	int n,k;
	scanf("%d %d",&n,&k);
	for(int i=0;i<n;i++){
		int u;
		scanf("%d",&u);
		data[u]++;
	}
	int hit=0;
	for(map<int,int>::iterator it=data.begin();it!=data.end();it++){
		meh[hit]= make_pair(it->first,it->second);
		hit++;
	}
	sort(meh,meh+hit,cmp);
	for(int i=hit-1;i>=0;i--){
		if(k==0)break;
		n-=meh[i].second;
		k--;
	}
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 11136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	private List<Integer> G = new ArrayList<Integer>();
	private int cnt = 0;
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	private void run() throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(reader.readLine());
		}
		reader.close();
		
		shellSort(a, n);
		System.out.println(G.size());
		for (int i = G.size() - 1; i >= 0; i--) {
			System.out.print(G.get(i));
			if (i != 0) System.out.print(" ");
		}
		System.out.println();
		System.out.println(cnt);
		for (int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}

	private void shellSort(int[] a, int n) {
		int h = 1;
		while (h <= n) {
			G.add(h);
			h = h * 3 + 1;
		}
		for (int i = G.size()-1; i >= 0; i--) {
			insertionSort(a, n, G.get(i));
		}
	}

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



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

int main(){
      int n;cin >> n;
      int num = n;
      int t = 0;
      while(n > 0){
            t += n % 10;
            n /= 10;
      }
      if(num % t == 0)cout << "Yes";
      else cout << "No";
}

Measured memory_bytes: 256
//
// Created on 2020/09/26.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;

struct UnionFind {
    vector<int>d;//リンクの情報,子の場合は親の番号、親の場合は連結成分のsize*(-1)
    UnionFind(int n=0):d(n,-1){} //structの初期化。デフォルトのnを0に設定してdを-1(すなわち全ての成分は親であり、サイズは1にする
    int find(int x) {//根を探す
        if(d[x] < 0) return x;
        else  return d[x] = find(d[x]);//根じゃなかったら根を探しに行ってメモ化する。
    }
    bool unite(int x,int y) {//成分を連結する
        x = find(x);
        y = find(y);
        if (x == y) return false;//すでに同じ連結成分
        if(d[x] < d[y]) swap(x,y);//大きいのに小さいのをつける。x←y
        //x.size > y.size
        d[x] += d[y];//xのサイズをふやす
        d[y] = x;//yの根をxにする
        return true;
    }
    bool same(int x,int y) {return find(x)==find(y);}
    int size(int x) {return -d[find(x)];}

};

int main() {
    int n,m;
    cin>>n>>m;
    UnionFind load(n);
    for (int i = 0; i < m; ++i) {
        int a,b;
        cin>>a>>b;
        a--;b--;
        load.unite(a,b);
    }
    int ans =0;
    for (int i = 0; i < n; ++i) {
        if(load.d[i] < 0)ans++;
    }
    cout<<ans - 1<<endl;


    return 0;
}


Measured memory_bytes: 3696
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define set setprecision　//小数点以下何位まで知りたいか
#define mod 1000000007
#define pi 3.14159265
#include<numeric>
using namespace std;
int gcd(int a, int b)//最大公約数
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
int lcm(int a, int b)//最小公倍数
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);
}
int main() {
	int s, w;
	cin >> s >> w;
	if (s <= w)cout << "unsafe" << endl;
	else cout << "safe" << endl;
}


Measured memory_bytes: 3620
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int cnt9=0;
    while(a>0) {
    	if(a%10==9) {
    		cnt9++;
    	}
    	a/=10;
    }
    if(cnt9>0) {
    	System.out.println("Yes");
    }

    else{
    	System.out.println("No");
    }
  }
}

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

int main() {

  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;

  long long mini = 20000000000;

  for(int i = 0;i <= max(X,Y);i++) {
    long long sum = 2 * C * i + max(0,X - i) * A + max(0,Y - i) * B;
    mini = min(sum,mini);
  }

  cout << mini << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(n*a, b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <unordered_set>
#include <unordered_map>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
#define debug( fmt, ... ) \
        fprintf( stderr, \
                  fmt "\n", \
                  ##__VA_ARGS__ \
        )

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1 << 30;
const double EPS = 1e-10;

double zero(double d) {
    return d < EPS ? 0.0 : d;
}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
    os << '[';
    rep(i, a.size()) os << (i ? " " : "") << a[i];
    return os << ']';
}

string toString(int i) {
    stringstream ss;
    ss << i;
    return ss.str();
}

const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
    ll res = 1ll;
    ll x = a;
    while (k != 0) {
        if ((k & 1) == 1)
            res = (res * x) % M;
        x = (x * x) % M;
        k >>= 1;
    }
    return res;
}

struct prepare {
	prepare() {
	    cout.setf(ios::fixed, ios::floatfield);
	    cout.precision(8);
	    ios_base::sync_with_stdio(false);
	}
} _prepare;

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

    int ans = 0;
    while(X > 0) {
        ans++;
        X -= ans;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a[3];
  set<int> st;
  rep(i, 0, 3){
    cin >> a[i];
    st.insert(a[i]);
  }
  if(st.size() == 2) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;

vl eratos(ll n){
    vb isPrime(n+1,true);
    isPrime[0] = false;
    isPrime[1] = false;
    for(ll i = 2;i*i<=n;++i){
        if(isPrime[i]){
            for(ll j = i+i;j<=n;j+=i){
                isPrime[j] = false;
            }
        }
    }
    vl ret;
    rep(i,n+1){
        if(isPrime[i]) ret.push_back(i);
    }
    return ret;
}


int main(void) {
    vl primes = eratos(1000000);
    ll n;
    cin>>n;
    rep(i,primes.size()){
        if(primes[i] >= n){
            cout<<primes[i]<<endl;
            return 0;
        }
    }
	return 0;
}


Measured memory_bytes: 4336
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String result = "WA";
		if("A".equals(S.substring(0,1))) {
			S = S.substring(1);
			if(S.indexOf("C") > 0  && S.indexOf("C") < S.length()-1
					&& S.indexOf("C") == S.lastIndexOf("C")) {
				S = S.substring(0,S.indexOf("C")) + S.substring(S.indexOf("C")+1);
				String s = S.toLowerCase();
				if(S.equals(s)) {
					result = "AC";
				}
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 26884
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <array>
#include <list>
#include <set>
#include <map>
#include <cmath>
using namespace std;

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

typedef long long ll;

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 main() {
    int n, a, b;
    cin >> n >> a >> b;
    int maxa, mina;
    maxa = min(a, b);
    if ((a+b-n) > 0) {
        mina = a + b -n;
    } else {
        mina = 0;
    }
    cout << maxa << ' ' << mina;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int K,X;
  cin >> K >> X;
  int mi = max(-1000000,X-K+1);
  int ma = min(1000000,K+X-1);
  for(int i = mi;i < ma;i++) {
    cout << i << " ";
  }
  cout << ma << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define ll      long long 
#define double      long double
#define pii     pair<int ,int>
#define pld     pair<ld ,ld>
#define all(v)  v.begin(),v.end()
#define F       first
#define S       second
#define mod     1000000007
#define pb      push_back
#define MP      make_pair
#define mset(x) memset(x, 0, sizeof(x));
#define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inf     10000000000000007
#define PI 3.14159265
const int N=300005;
// ll a[N],BIT[N];
// void upd(ll x,ll y)
// {
//     for(;x<N;x+=x&-x)
//         BIT[x]+=y;
// }
// ll get(ll x)
// {
//     ll res=0;
//     for(;x;x-=x&-x)
//         res+=BIT[x];
//     return res;
// }
// void f(ll i,ll l,ll r){
//     ll lo,hi,mid,st,en;
//     lo=0;
//     hi=n-1;
//     st=n;
//     while(lo<=hi){
//         mid=(lo+hi)/2;
//         if(v[mid].F>=l) st=mid,hi=mid-1;
//         else lo=mid+1;
//     }
//     en=-1;
//     while(lo<=hi){
//         mid=(lo+hi)/2;
//         if(v[mid].F<=r) en=mid,lo=mid+1;
//         else hi=mid-1;
//     }
//     for(;st<=en;st++)
//         seg[i].pb(v[st].S);
//     mid=(l+r)/2;
//     f(2*i,l,mid);
//     f(2*i+1,mid+1,r);
// }
// ll g(ll i,ll l,ll r,ll x,ll y){
    
// }
// void run(int t){
//     cin>>n>>q;
//     for(i=0;i<n;i++)cin>>a[i];
//     for(i=0;i<n;i++)
//         v.pb(MP(a[i],i));
    
//     sort(all(v));
//     f(1,1,100000);
//     while(q--){
//         cin>>x>>y;
//         cout<<g(1,1,100000,x,y)<<"\n";
//     }


   


// }
 
void run()
{
    ll n,i;
    string s,t;
    cin>>n;
    cin>>s>>t;
    for(i=0;i<n;i++) cout<<s[i]<<t[i];
}
void setup(){
    ios;
    //cout << setprecision(20);
    // #ifndef ONLINE_JUDGE
    // freopen("input", "r", stdin);
    // freopen("output", "w", stdout);
    // #endif
}
 
signed main(){
    setup();
    int tests = 1;
    //cin >> tests;
    for(int i = 1; i <= tests; i++) run();
    return 0;
}


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

int main() {
	int n, T;
	long double A;
	cin>>n>>T>>A;
	long double ans=9999999;
	int ansidx;
	for (int i=1; i<=n; i++) {
		long double h; cin>>h;
		long double tmp = T-0.006*h;
		if (abs(tmp-A) < ans)
			ans=fabs(tmp-A), ansidx=i;
	}
	cout<<ansidx<<endl;
	return 0;
}


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

const int INF = 1e9;

int main() {
  long n;
  cin>>n;
  long s = (long)sqrt(n);

  for (long i=s; i>0; i--) {
    if (n % i == 0) {
      int m = max(i, n / i);
      cout<<(int)(log10(m))+1<<endl;
      break;
    }
  }
}

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

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

long long MOD = 1000000000 + 7;


int main(){
  ll N;
  ll max_val = 0;
  cout << setprecision(10);
  cin >> N;

  string S = to_string(N);

  max_val = (S.size()-1) * 9; //ベースライン

  ll tmp = 0;
  for(ll i = 0; i < S.size(); i++){
    // 残りの桁数は、S.size()-i
    if(S[i] == '0'){
      // そのまま
      continue;
    } else{
      // 1つ下げて残りを9
      ll now = S[i] - '0';
      ll now_val = tmp + (now-1) + 9 * (S.size() - 1 - i);
      if(max_val < now_val){
        max_val = now_val;
      }
      // そのまま
      tmp += S[i] - '0';
    }

    if(i == S.size()-1){
      max_val = max(max_val, tmp);
    }
  }
  cout << max_val << endl;

}


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

int w, h;
char mas[50][50];
int vb[50][50], vw[50][50];

map< char, int > c;

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

void rec(int y, int x, int color) {
    if(!(0 <= x && x < w && 0 <= y && y < h)) return;
    if(color != c[mas[y][x]] && mas[y][x] != '.') return;
    if((!color && vb[y][x]) || (color && vw[y][x])) return;
    if(color) vw[y][x] = 1;
    else vb[y][x] = 1;

    for(int i = 0; i < 4; i++) {
        rec(y + dy[i], x + dx[i], color);
    }
}

int main() {

    c['B'] = 0, c['W'] = 1, c['.'] = -1;

    while(cin >> w >> h, w) {
        memset(vb, 0, sizeof(vb));
        memset(vw, 0, sizeof(vw));
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                cin >> mas[i][j];
            }
        }

        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                if(mas[i][j] == 'B' && !vb[i][j]) rec(i, j, 0);
                if(mas[i][j] == 'W' && !vw[i][j]) rec(i, j, 1);
            }
        }

        int sumb = 0, sumw = 0;
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                if(vb[i][j] ^ vw[i][j] && mas[i][j] == '.') {
                    if(vb[i][j]) sumb++;
                    else sumw++;
                }
            }
        }

        cout << sumb << " " << sumw << endl;
    }
}



Measured memory_bytes: 3268
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int A = scanner.nextInt();
        int B = scanner.nextInt();

        int count = 0;
        for (int i = 1; i <= N; i++) {
            int temp = i;
            int ans = 0;
            while (temp > 0) {
                ans += temp % 10;
                temp /= 10;
            }
            if (ans >= A && ans <= B) {
                count += i;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23252
# 別解（むしろ想定解）のb→axc解法
import bisect
n=int(input())
# 面倒なので最初にソートしちゃいましょう。
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))

ret=0
# a<b[i]となるaの個数xb[i]<cとなるcの個数でいいですよね…
for i in range(n):
    numa = bisect.bisect_left(a,b[i])
    numc = len(c) - bisect.bisect_right(c,b[i])
    ret+=numa*numc
print(ret)

Measured memory_bytes: 22720
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

class stack {
public:
	stack();
	int top();
	int pop();
	void push(int add);
private:
	int *A;
	int index;
};

int main() {
	
	int i = 0;
	int n1 , n2;
	int addnum = 0;
	bool test = false;
	string A;
	
	stack n;
	
	while(cin >> A ) {
			
		for(int i=0;i<A.length();i++) {
			if( '0' <= A[i] && A[i] <= '9') {
				addnum = addnum + (A[i] - 48) * pow(10, A.length()-i-1);
				test = true;
			}
	}
		if( test) {
			n.push(addnum);
			addnum = 0;
		}
		
		test = false;
		
		if( "+" == A) {
			n2 = n.pop();
			n1 = n.pop();
			n.push(n1 + n2);
		}
		
		if( "-" == A) {
			n2 = n.pop();
			n1 = n.pop();
			n.push(n1 - n2);
		}
		
		if( "*" == A) {
			n2 = n.pop();
			n1 = n.pop();
			n.push(n1 * n2);
		}
		
		if( "/" == A) {
			 	n2 = n.pop();
				n1 = n.pop();
				n.push(n1 / n2);
		}
		
		if( getchar() =='\n') {
			cout << n.pop() << "\n";
			return 0;
		}
	}
	
	return 0;
} 

stack::stack() {
	A = new int [100];
	index = 0;
}

int stack::pop() {
	index--;
	return A[index];
}

void stack::push(int add) {
	A[index] = add;
	index++;
}


Measured memory_bytes: 3344
// fahadmd16(IIEST Shibpur)

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define ll                                      long long
#define pb                                      push_back
#define pf                                      push_front
#define eb                                      emplace_back
#define mp                                      make_pair
#define ff                                      first
#define ss                                      second
#define db                                      long double
#define pll                                     pair<ll, ll>
#define ALL(a)                                  (a).begin(),(a).end()
#define endl                                    "\n"

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define ford1(i, n) for (int i = int(n) - 1; i >= 1; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define forabd(i, a, b) for(int i = int(a); i >= int(b); i--)

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cerr.tie(0)

/// ---------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cout << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cout << endl; }
eni(!=) cout << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
/// --------------------------------------------------------------------


const ll sz = 1e5 + 5;
const ll mod = 1e9 + 7;
const db PI = acos(-1);
const db eps = 1e-10;
const ll INF = 1e18 + 5;


typedef vector<ll> VL;
typedef vector<pll > VLL;
typedef vector<vector<ll> > VVL;
typedef vector<vector<vector<ll> > > VVVL;


ll power(ll n, ll k, ll m) {
	ll ans = 1;
	while (k) {
		if (k & 1){
			ans = (ans * n) % m;
			k--;
		}
		else{
			n = (n * n) % m;
			k /= 2;
		}
	}
	return ans;
}

void solver() {
	ll n,w;cin>>n>>w;
	vector<array<ll,2>> a(n);forn(i,n)cin>>a[i][0]>>a[i][1];
	
	VL dp(w+1);
	dp[0]=0;
	forn(j,n){
		ford1(i,w+1){
			if(i>=a[j][0])
				dp[i]=max(dp[i],dp[i-a[j][0]]+a[j][1]);
		}
	}
	debug()<<imie(dp);
	cout<<dp[w]<<endl;
	
	
}

int main() {
	IOS;
	ll T = 1; //cin >> T;
	forn1(i, T + 1) {
		solver();
	}
	return 0;
}


Measured memory_bytes: 3940
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		long n=sc.nextLong();
		if(n>=b){
			System.out.println(a*(b-1)/b);
		}else{
			System.out.println(a*n/b);
		}
	}
}

Measured memory_bytes: 27008
// Isaunoya
#include<bits/stdc++.h>
using namespace std ;
using LL = long long ;
using uint = unsigned int ;
#define int long long
#define fir first
#define sec second
#define pb push_back
#define mp(x , y) make_pair(x , y)
template < typename T > inline void read(T & x) { x = 0 ; int f = 1 ; register char c = getchar() ;
  for( ; ! isdigit(c) ; c = getchar()) if(c == '-') f = -1 ;
  for( ; isdigit(c) ; c = getchar()) x = (x << 1) + (x << 3) + (c & 15) ;
  x *= f ;
}
template < typename T > inline void print(T x) {
  if(! x) { putchar('0') ; return ; }
  static int st[105] ;
  if(x < 0) putchar('-') , x = -x ;
  int tp = 0 ;
  while(x) st[++ tp] = x % 10 , x /= 10 ;
  while(tp) putchar(st[tp --] + '0') ;
}
template < typename T > inline void print(T x , char c) { print(x) ; putchar(c) ; }
template < typename T , typename ...Args > inline void read(T & x , Args & ...args) { read(x) ; read(args...) ; }
template < typename T > inline void sort( vector < T > & v) { sort(v.begin() , v.end()) ; return ; }
template < typename T > inline void unique( vector < T > & v) { sort(v) ; v.erase(unique(v.begin() , v.end()) , v.end()) ; }
template < typename T > inline void cmax(T & x , T y) { if(x < y) x = y ; return ; }
template < typename T > inline void cmin(T & x , T y) { if(x > y) x = y ; return ; }
const int Mod = LLONG_MAX ;
inline int QP(int x , int y) { int ans = 1 ;
  for( ; y ; y >>= 1 , x = (x * x) % Mod)
    if(y & 1) ans = (ans * x) % Mod ;
  return ans ;
}
template < typename T > inline T gcd(T x , T y) { if(y == 0) return x ; return gcd(y , x % y) ; }
template < typename T > inline T lcm(T x , T y) { return x * y / gcd(x , y) ; }
template < typename T > inline void mul(T & x , T y) { x = 1LL * x * y ; if(x >= Mod) x %= Mod ; }
template < typename T > inline void add(T & x , T y) { if((x += y) >= Mod) x -= Mod ; }
template < typename T > inline void sub(T & x , T y) { if((x -= y) < 0) x += Mod ; }

signed main() {
  int n ; read(n) ;
  int f = 0 , f2 = 0 ;
  for(register int i = 1 ; i <= sqrt(n) ; i ++)
    if(! (n % i)) f = i , f2 = n / i ;
  print(f + f2 - 2) ;
  return 0 ;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main{
	
	private final static String HEART = "H";
	private final static String SPADE = "S";
	private final static String CLUB  = "C";
	private final static String DIAMOND = "D";
	
	enum Suits {
		
		 SPADE(1,"S")
		,HEART(2,"H")
		,CLUB(3,"C")
		,DIAMOND(4,"D");
		
		private int rank;
		private String name;
		
		Suits(int rank,String name){
			this.rank = rank;
			this.name = name;
		}
		
		public int getRank(){
			return this.rank;
		}
		
		public String getAttrName(){
			return this.name;
		}
		
	}
	
	
	
	public static void main(String[] args){
		
		Map<String,HashSet<Integer>> cards = createCardBox();
		
		Scanner sc = new Scanner(System.in);
		
		int cardsInHand = Integer.parseInt(sc.next());
		
		for(int i = 0; i<cardsInHand;i++){
			
			String suits = sc.next();
			Integer number= Integer.parseInt(sc.next());
			
			HashSet<Integer> currentCards= cards.get(suits);
			currentCards.remove(number);
			
			cards.put(suits, currentCards);
		}
		
		printSuits(cards,SPADE);
		printSuits(cards,HEART);
		printSuits(cards,CLUB);
		printSuits(cards,DIAMOND);
		
		sc.close();
		
	}
	
	
	
	private static void printSuits(Map<String, HashSet<Integer>> cards,String suits) {
		
		HashSet<Integer> cardsInSuits; 
		cardsInSuits=  cards.get(suits);
		List<Integer> list = new ArrayList<Integer>();
		for(Integer i : cardsInSuits){
			
			list.add(i);
			
		}
		Collections.sort(list);
		
		for(Integer number : list){
			
			System.out.println(suits + " " + number);
		}
		
	}



	private static  Map<String,HashSet<Integer>> createCardBox(){
		
		Map<String,HashSet<Integer>> cards = new HashMap<String,HashSet<Integer>>();
		Set<String> suits = new HashSet<String>(){
			
			{add(HEART);}
			{add(SPADE);}
			{add(CLUB);}
			{add(DIAMOND);}
		};
		
		for(String suit: suits){
			
			HashSet<Integer> numbers = new HashSet<>();
			
			for(int j = 0; j<13;j++){
				
				numbers.add(j+1);
				
			}
			cards.put(suit, numbers);
		
		}
		
		return cards;
		
	}

}



Measured memory_bytes: 26064
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int linearSearch(int n, vector<int> v);

int main() {
	int n, q;

	cin >> n;
	vector<int> va(n);
	for (int i = 0; i < n; i++) {
		cin >> va.at(i);
	}

	cin >> q;
	vector<int> vb(q);
	for (int i = 0; i < q; i++) {
		cin >> vb.at(i);
	}

	int c = 0;
	for (int i = 0; i < q; i++) {
		if (linearSearch(vb.at(i), va) == 1) c++;
	}

	cout << c << endl;
}

int linearSearch(int n, vector<int> v) {
	for (int i = 0; i < v.size(); i++) {
		if (v.at(i) == n) {
			return 1;
		}
	}

	return -1;
}


Measured memory_bytes: 3224
#include <iostream>
using namespace std;
int N;
int A[200];
int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>A[i];
    int res=0;
    while(true){
        bool exist_odd=false;
        for(int i=0;i<N;i++){
            if(A[i]%2!=0)exist_odd=true;
        }
        if(exist_odd)break;
        for(int i=0;i<N;i++){
            A[i]/=2;
        }
        res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
x = gets.chomp.split.map(&:to_i)
ans = []

(x.min..x.max).each do |i|
  tmp = 0
  n.times do |j|
    tmp += (x[j] - i) ** 2
  end
  ans.push(tmp)
end 
 
puts ans.min
  

Measured memory_bytes: 3836
c = []
flag = True
for i in range(3):
    c1,c2,c3 = map(int ,input().split())
    c.append((c1,c2,c3))

diff1 = abs(c[0][0] - c[0][1])
diff2 = abs(c[0][1] - c[0][2])

for i in range(1,3):
    d1 = abs(c[i][0] - c[i][1])
    d2 = abs(c[i][1] - c[i][2])
    if d1 != diff1 or d2 != diff2:
        flag = False
        break

if flag:
    print("Yes")
else:
    print("No")


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

int main() {
  int A, B, C;
  string answer;
  cin >> A >> B >> C;
  if (A == B || B == C || A == C){
    if (A == B && B == C){
      answer = "No";
    }
    else{
      answer = "Yes";
    }
  }
  else{
    answer = "No";
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define DEBUG
 
// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
 
const int MOD = 1000000007;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep_(i,n) for(int i=0;i<(int)(n-1);i++)
#define rep__(i,n) for(int i=n-1;i>=0;i--)
 
int main(void) {
    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) cout << "No";
    else cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <algorithm>
#include <random>
#include <unordered_map>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it;}cout<<endl;}

int main(){
    ll h,w,d;
    cin>>h>>w>>d;
    ll a;
    ll cost[h*w+1];
    ll totcost[h*w+1];
    rep(i, h*w+1) totcost[i]=0;
    unordered_map<long, pair<long, long>> m;
    rep(i, h) rep(j, w) {
        cin >> a;
        m[a]=make_pair(i, j);
    }
    ll q;
    cin>>q;
    vector<ll> l(q),r(q);
    rep(i, q) cin>>l[i]>>r[i];
    
    fr(i,1, h*w+1){
        cost[i]=abs(m[i].first-m[i+d].first)+abs(m[i].second-m[i+d].second);
    }
    fr(i,1, d+1){
        for (auto j=i+d; j<h*w+1; j+=d) {
            totcost[j]=totcost[j-d]+cost[j-d];
        }
    }
//    fr(i,1, h*w+1){
//            pr(totcost[i]);
//    }
    rep(i, q){
        ll sum=0;
        while (l[i]!=r[i]) {
//            sum+=cost[l[i]];
//            l[i]+=d;
            sum=-totcost[l[i]]+totcost[r[i]];
            break;
        }
        pr(sum);
    }
    return 0;
}



Measured memory_bytes: 13436
using System;
using System.Linq;

namespace ABC145B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            if (N % 2 != 0)
            {
                Console.WriteLine("No");
                return;
            }

            if (S.Take(N / 2).SequenceEqual(S.Skip(N / 2)))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13268
#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>;

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

// import java.text.DecimalFormat; 
// import java.text.DecimalFormatSymbols; 
 
public class Main {


    
    public static void main(String args[] ) throws Exception {
        PrintWriter pw=new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        char[] c = sc.next().toCharArray();
        int ans=0;
        for(int i=0;i<c.length;i++){
            ans+= c[i]-'0';
        }
        if(ans%9==0){
            pw.println("Yes");
        } else {
            pw.println("No");
        }
        
        
       
        
        pw.close();
    }
    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   public static <T> void deb(T x){
       System.out.println(x);
   }
   
   
   static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		public String next(int k) {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "Not able to read";
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
		
	    
	}
   
}

Measured memory_bytes: 36656
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a,b = map(int, input().split())
    c,d = map(int, input().split())
    if d==1:
        print(1)
    else:
        print(0)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
using namespace std ;

#define MAXN 107
int n ;
int a[ MAXN ] ;

int ans[ MAXN ] ;

void input ( ) {
    scanf ( "%d" , &n ) ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        scanf ( "%d" , &a[ i ] ) ;
    }
}

void solve ( ) {
    for ( int i = 1 ; i <= n ; ++ i ) {
        if ( a[ i ] > i ) { printf ( "-1\n" ) ; return ; }
        for ( int j = i - 1 ; j >= a[ i ] ; -- j ) {
            ans[ j + 1 ] = ans[ j ] ;
        }
        ans[ a[ i ] ] = a[ i ] ;
    }
    for ( int i = 1 ; i <= n ; ++ i ) {
        printf ( "%d\n" , ans[ i ] ) ;
    }
}

int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


Measured memory_bytes: 256
ans = 0

def dfs(current_num, seven, five, three, n):
    if current_num > n:
        return
    
    if seven == 1 & five == 1 & three == 1:
        global ans
        ans += 1
    
    dfs(10 * current_num + 7, 1, five, three, n)
    dfs(10 * current_num + 5, seven, 1, three, n)
    dfs(10 * current_num + 3, seven, five, 1, n)

def solve_C():
    n = int(input())

    dfs(0, 0, 0, 0, n)
    return ans

print(solve_C())

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <set>
#include <iomanip>

int main()
{
    std::array<double, 1001> table = {0.0, 1.0};
    long double total = 1.0;
    for (int i = 2; i < 1001; i++) {
        total += i;
        table[i] = total / i;
    }

    int n{}, k{};
    std::cin >> n >> k;
    std::vector<int> nums(n);
    for (int i = 0; i < n; i++) {
        std::cin >> nums[i];
    }

    long double result{};
    for (int i = 0; i < k; i++) {
        result += table[nums[i]];
    }
    long double prev = result;
    for (int i = 1; i <= n - k; i++) {
        long double tmp{};
        if (i % 10 == 0) {
            for (int j = i; j < i + k; j++) {
                tmp += table[nums[j]];
            }
        } else {
            tmp = prev - table[nums[i - 1]] + table[nums[i + k - 1]];
        }
        prev = tmp;
        if (tmp > result) {
            result = tmp;
        }
    }

    std::cout<<std::fixed<<std::setprecision(10) << result << std::endl;
    
    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

template <typename T>
class FenwickTree
{
    int n;
    std::vector<T> bit;

  public:
    FenwickTree(int _n) : n(_n), bit(_n, 0) {}

    void add(int pos, const T &w)
    {
        assert(0 <= pos && pos < n);
        for (int i = pos; i < n; i |= i + 1)
            bit[i] += w;
    }
    // v[0] + ... + v[pos-1]
    T sum(int pos)
    {
        assert(0 <= pos && pos <= n);
        T res = 0;
        for (int i = pos - 1; i >= 0; i = (i & (i + 1)) - 1)
        {
            res += bit[i];
        }
        return res;
    }
    T sum(int l, int r)
    {
        assert(0 <= l && l <= r && r <= n);
        return sum(r) + (-sum(l));
    }
};

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

    int n, x;
    while (cin >> n >> x, n || x)
    {
        int ret = 0;
        for (int i = 1; i <= n; i++)
        {
            for (int j = i + 1; j <= n; j++)
            {
                for (int k = j + 1; k <= n; k++)
                {
                    if (i + j + k == x)
                        ret++;
                }
            }
        }
        cout << ret << endl;
    }
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  int total = a * 100, sugar = 0;
  rep(i, 30 / a + 1) rep(j, (30 - i * a) / b + 1)
      rep(k, e * (a * i + b * j) / c + 1)
          rep(m, (e * (a * i + b * j) - k) / d + 1) {
    int now_total = 100 * a * i + 100 * b * j + c * k + d * m;
    int now_sugar = c * k + d * m;
    if(now_total > 0 && now_total <= f &&
       c * k + d * m <= e * (a * i + b * j) &&
       (double)now_sugar / now_total > (double)sugar / total) {
      total = now_total;
      sugar = now_sugar;
    }
  }
  cout << total << ' ' << sugar << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

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

	cin >> N >> K;

	int cnt = 0;
	while (N > 0){
		cnt++;
		N -= 2;
	}

	if(cnt >= K){
		cout << "YES" << endl;
	}else{
		cout <<"NO" << endl;
	}



}

Measured memory_bytes: 256
n = gets.chomp.to_i
arr = gets.chomp.split(" ").map(&:to_i)
ngo = Array.new(n, 0)
(n-1).times do |i|
    ngo[arr[i] - 1] += 1
end
# (ngo.length - 1).times do |i|
#     print ngo[i+1].to_s + " "
# end
ngo.each do |nn|
    print nn.to_s + " "
end
puts





Measured memory_bytes: 35724
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define bang_bang ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define cases int t;cin>>t;while(t--)
#define pb push_back
#define ppb pop_back
#define mem(x,a) memset(x,a,sizeof(x));
#define ld long double
#define mp make_pair
#define limit 200005
#define inf 1e18
const int md = 998244353;

int movesx[3]={-1,0,1};
int movesy[3]={-1,0,1};

int moves[4][2]={{1,0},{-1,0},{0,1},{0,-1}};


bool cmp(int a,int b)
{
	return a>b;
}

int gcd(int a, int b){return b?gcd(b,a%b):a;}
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
int power(int base,int exponent,int mod=inf)
{
    if(exponent==0)
        return 1;
    int temp=power(base,exponent/2,mod);
    temp=(temp*temp)%mod;
    if(exponent%2!=0)
    {
        temp=(temp*base)%mod;
        return temp;
    }
    return temp;
}

int ncr(int a,int b)
{
    int dp[b+1];
    mem(dp,0)
    dp[0]=1;
    for(int i=1;i<=a;i++)
        for(int j=min(i,b);j>0;j--)
            dp[j]=(dp[j]+dp[j-1])%md;
            //C(n,r)=C(n-1,r-1)+C(n-1,r)
    return dp[b];
}
int n,t;
float p;


signed main(){
    bang_bang
    //cases
    {
        int n;
        cin>>n;
        if(n>=30) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3648