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

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};
 
//const int mod = 998244353;
 
struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};



int main()
{	
	string s, t; cin>> s >> t;
	cout<<t+s;
	return 0;
}


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

int main()
{
    long long a, b, x;
    cin >> a >> b >> x;
    long long count = 0;
    count += b / x;
    count -= a / x;
    if (a % x == 0)
    {
        count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
using namespace std;
using lint = long long;
template<class T> using grid = vector<vector<T>>;
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; }
static const lint MOD = (lint)1e9+7;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    rep (i, N) { cin >> h[i]; }

    int cnt = 0;
    rep (i, N)
    {
        if (h[i] >= K)
        {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}


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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;

int main(int argc, char const* argv[])
{
  int h, n;
  cin >> h >> n;

  vector<Pair> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
  }

  vector<vector<int>> dp(n+1);
  dp[0] = vector<int>(h+1, 1001001001);
  dp[0][0] = 0;
  REP(i, n) {
    dp[i+1] = vector<int>(h+1, 1001001001);
    REP(j, h+1) {
      int j_idx = j-p[i].first > 0 ? j-p[i].first : 0;
      dp[i+1][j] = min(dp[i][j], dp[i+1][j_idx] + p[i].second);
    }
  }

  cout << dp[n][h] << endl;

  return 0;
}

Measured memory_bytes: 39424
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010;
int dx[5]={0,1,0,-1,0};
int dy[5]={1,0,-1,0,0};
int main(){
    int n;cin>>n;
    int a[110];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){
            ans++;i++;
        }
    }
    cout<<ans<<endl;
}


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

#define ll long long


using namespace std;

deque < ll > dq[100005];

int main()
{
    ll i,j,k,l,m,n;
    cin >> n >> m;
    dq[1].push_back(2);
    for(i=2;i<=n;i++)
        dq[i].push_back(1);

    for(i=0;i<m;i++)
    {
        cin >> j >> k;

        ll u= dq[j].front();
        if(u==2)
            dq[k].push_front(2);
        else
            dq[k].push_back(1);
       // cout << dq[j].size() << endl;
        dq[j].pop_back();
       //cout << dq[j].size() << endl;
       //cout << i << " " << dq[j].front() << endl;

    }
    ll countt=0;
    for(i=1;i<=n;i++)
    {
        if((dq[i].front()==2)&&(dq[i].size()!=0))
            countt++;
    }
    cout << countt << endl;

}


Measured memory_bytes: 119040
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
struct TTL{
	int x,v;
}p[200010];
const int mod=1000000007;
int L[200010],R[200010];
int f[200010],q[200010];
int lsh[600010],cnt;
int read()
{
	int ans=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') ans=ans*10+ch-'0',ch=getchar();
	return ans;
}
bool cmp(TTL a,TTL b)
{
	return a.x<b.x;
}
int ycl()//左边最大 右边最小 
{
	int maxn=0,minn=2e9;
	for (int i=1;i<=n;i++)
	{
		maxn=(maxn>p[i].v)?maxn:p[i].v;
		R[i]=maxn;
		lsh[++cnt]=maxn;
	}
	for (int i=n;i>=1;i--)
	{
		minn=(minn<p[i].v)?minn:p[i].v;
		L[i]=minn;
		lsh[++cnt]=minn;
	}
///	for (int i=1;i<=n;i++)
//		printf("%d %d\n",L[i],R[i]);
}
void plu(int &a,int b)
{
	a+=b;
	if (a>=mod) a-=mod;
}
void jian(int &a,int b)
{
	a-=b;
	if (a<0) a+=mod;
}
int main()
{
	n=read();
	for (int i=1;i<=n;i++)
		p[i].x=read(),p[i].v=read(),lsh[++cnt]=p[i].v;
	sort(p+1,p+1+n,cmp);
	ycl();
	sort(lsh+1,lsh+1+cnt);
	cnt=unique(lsh+1,lsh+1+cnt)-1-lsh;
	for (int i=1;i<=n;i++)
	{
		L[i]=lower_bound(lsh+1,lsh+1+cnt,L[i])-lsh;
		R[i]=lower_bound(lsh+1,lsh+1+cnt,R[i])-lsh;
	//	printf("%d %d\n",L[i],R[i]);
	}
	int head=0,tail=1;
	int sum=1;
	L[0]=0;R[0]=0;f[0]=1;
	n++;
	L[n]=n;R[n]=n;
	for (int i=1;i<=n;i++)
	{
		while (head<tail&&L[i]>R[q[head+1]]+1)
			jian(sum,f[q[head+1]]),head++;
		f[i]=sum;
		plu(sum,f[i]);
		q[++tail]=i;
	//	cout<<sum<<endl;
	}
	printf("%d",f[n]);
} 

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

int main()
{
    int x, y, z;
    cin >> x >> y >> z;

    int tmp;
    tmp = x;
    x = z;
    z = y;
    y = tmp;
    
    cout << x << " " << y << " " << z << " " << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in));

		String[] d1labeldata = br.readLine().split(" ");
		String[] d2labeldata = br.readLine().split(" ");

		Dice d1 = new Dice(d1labeldata);
		Dice d2 = new Dice(d2labeldata);

		int top;
		for (top = 0; top < 6; top++) {
			if ( d1.label[0].equals(d2.label[top]) ) break;
		}

		//System.out.println(top);

		switch (top) {
		case 0:
			break;
		case 1:
			d2.koroN();
			break;
		case 2:
			d2.koroW();
			break;
		case 3:
			d2.koroE();
			break;
		case 4:
			d2.koroS();
			break;
		case 5:
			d2.koroN().koroN();
			break;
		default:
			System.out.println("No");
		}

		int front;
		for (front = 1; front <= 4; front++) {
			if ( d1.label[1].equals(d2.label[front]) ) break;
		}

		//System.out.println(front);

		switch (front) {
		case 1:
			break;
		case 2:
			d2.kaitenTokei();
			break;
		case 3:
			d2.kaitenHanTokei();
			break;
		case 4:
			d2.kaitenTokei().kaitenTokei();
			break;
		default:
			System.out.println("No");
		}

		if ( d1.label[2].equals(d2.label[2]) ) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}

class Dice {
	String[] label;

	Dice(String[] labeldata) {
		label = new String[labeldata.length];

		for (int i = 0; i < labeldata.length; i++) {
			label[i] = labeldata[i];
		}
	}

	Dice koroN() {
		String temp;
		temp = label[0];
		label[0] = label[1];
		label[1] = label[5];
		label[5] = label[4];
		label[4] = temp;
		return this;
	}

	Dice koroS() {
		String temp;
		temp = label[0];
		label[0] = label[4];
		label[4] = label[5];
		label[5] = label[1];
		label[1] = temp;
		return this;
	}

	Dice koroE() {
		String temp;
		temp = label[0];
		label[0] = label[3];
		label[3] = label[5];
		label[5] = label[2];
		label[2] = temp;
		return this;
	}

	Dice koroW() {
		String temp;
		temp = label[0];
		label[0] = label[2];
		label[2] = label[5];
		label[5] = label[3];
		label[3] = temp;
		return this;
	}

	Dice kaitenTokei() {
		String temp;
		temp = label[1];
		label[1] = label[2];
		label[2] = label[4];
		label[4] = label[3];
		label[3] = temp;
		return this;
	}

	Dice kaitenHanTokei() {
		String temp;
		temp = label[1];
		label[1] = label[3];
		label[3] = label[4];
		label[4] = label[2];
		label[2] = temp;
		return this;
	}

}

Measured memory_bytes: 24444
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        list.add(1);
        int nine = 9;
        for(int i = 0;i < 6;i++){
            list.add(nine);
            nine *= 9;
        }
        int six = 6;
        for(int i = 0;i < 6;i++){
            list.add(six);
            six *= 6;
        }
        Collections.sort(list);
        int[] dp = new int[n+1];
        for(int i = 1;i <= n;i++){
            dp[i] = 1000000000;
        }
        for(int i = 1;i <= n;i++){
            for(Integer v : list){
                if(v > i){
                    continue;
                }
                dp[i] = Math.min(dp[i],dp[i-v]+1);
            }
        }
        System.out.println(dp[n]);

    }
    public static int sub(int n,List<Integer> x){
        int i = x.size();
        if(n <= 0){
            return 0;
        }
        while(n-x.get(i-1) < 0){
            i--;
        }
        return i-1;
    }
}


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

using namespace std;
#define ll long long
#define int long long

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
	#define lcout(a) cout << a;
	#define lcoutln(a) cout << a << endl;
	#define lcerr(a) cerr << a;
	#define lcerrln(a) cerr << a << endl;
#else
	#define lcout(a) 
	#define lcoutln(a) 
	#define lcerr(a) 
	#define lcerrln(a) 
#endif

#define MOD 1000000007

string s;
int l;

bool ch1()
{
	rep(i, l-1) {
		if (s[i] == s[i+1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return true;
		}
	}
	return false;
}	

bool ch2()
{
	rep(i, l-2) {
		if (s[i] == s[i+2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return true;
		}
	}
	return false;
}	

signed main()
{
	cin >> s;
	l = s.length();
	if (ch1()) return 0;
	if (ch2()) return 0;
	cout << "-1 -1" << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int w[100];long long int v[100];long long int  dp[100][100001];
long long int knapsack(int n,int W)
{if(W<0||n==0)
 return 0;
 if(dp[n-1][W]!=-1)
 return dp[n-1][W];
 if (w[n-1] > W) 
       return knapsack( n-1,W); 
 dp[n-1][W]=max(knapsack(n-1,W-w[n-1])+v[n-1],knapsack(n-1,W));
return dp[n-1][W];
}
int main()
{
int n,W;
cin>>n>>W;
memset(dp,-1,sizeof(dp));
for(int i=0;i<n;++i)
cin>>w[i]>>v[i];
long long result=knapsack(n,W);
cout<<result;


	
	
}

Measured memory_bytes: 78336
require 'pp'

N, K = readline.chomp.split.map(&:to_i)

ans = 0.0
(1..N).each do |n|
  win = 0
  while n < K
    win += 1
    n *= 2
  end
  ans += (1.0/N) * (0.5)**win
end

puts ans



Measured memory_bytes: 2172
#include <iostream>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>

namespace TokorotenLab
{
    /*
    Arguments:
        Search range: [begin, end)
        Target function: f(x)
    Requirement:
        f(x) => { false, ..., false, true, ..., true }
    Judge:
        true_bound == begin => All f(x) are true
        true_bound == end => All f(x) are false
    */
    std::pair<long long, long long> binary_search(long long begin, long long end, std::function<bool(long long)> f)
    {
        long long false_bound = begin - 1LL; // ( ..., false_bound] => false
        long long true_bound = end; // [true_bound, ... ) => true
        long long x;

        while(true_bound - false_bound > 1LL)
        {
            x = false_bound + (true_bound - false_bound) / 2LL;
            if(f(x))
            {
                true_bound = x;
            }
            else
            {
                false_bound = x;
            }
        }

        return std::make_pair(false_bound, true_bound);
    }
}

using namespace std;

int digit(int n)
{
    int res = 0;

    while(n > 0)
    {
        n /= 10;
        ++res;
    }

    return res;
}

int main()
{
    int n;
    int ans = 0;

    cin >> n;

    while(n > 0)
    {
        if(digit(n) % 2 == 1)
        {
            ++ans;
        }
        --n;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
inline long long tonum(string s) {long long v;istringstream sin(s);sin>>v;return v;}



int n;
string str;

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> str;
        string str2 = str;
        sort(ALL(str)); sort(ALL(str2), greater<char>());
        
        int res = tonum(str2) - tonum(str);
        cout << res << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1244
#include <stdio.h>
#define rep2(i,l,r) for((i)=(l);(i)<=(r);(i)+=2)
int solve(int i){
    int j,ans=0;
    for(j=1;j<=i;j++){
        if(i%j==0)ans++;
    }
    if(ans==8)return 1;
    else return 0;
}
int main(){
    int n,i,ans=0;
    scanf("%d",&n);
    if(n<=105){
        ans=n/105;
        printf("%d",ans);
    }
    else{
        ans++;
        rep2(i,107,n){
            if(solve(i)==1)ans++;
        }
        printf("%d",ans);
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
// #define int ll
using namespace std;

signed main(void) {
    int N, A, B;
    cin >> N >> A >> B;
    int ma = min(A, B);
    int mi = max((A+B-N), 0);
    cout << ma << " " << mi << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
x = input()

def count(n):
    cnt = 0
    while n:
        cnt += n % 2
        n //= 2
    return cnt

LIMIT = 5*10**5
dp = [0] * LIMIT
for i in range(1, LIMIT):
    dp[i] = dp[i % count(i)]+1

c = x.count("1")
a = int(x,2) % (c+1)

if c == 1:
    for i in range(n):
        if x[i] == "0":
            print(dp[(a + pow(2, n-i-1, c+1)) % (c+1)] + 1)
        else:
            print(0)
    exit()

b = int(x,2) % (c-1)
for i in range(n):
    if x[i] == "0":
        print(dp[(a + pow(2, n-i-1, c + 1)) % (c + 1)] + 1)
    else:
        print(dp[(b - pow(2, n-i-1, c - 1)) % (c - 1)] + 1)


Measured memory_bytes: 13480
S = input()
N = len(S)
center_i = N//2
center = S[center_i]

ans = N//2
l = r = center_i
if N%2==0:
    l -= 1
while l >= 0:
    if not (S[l] == center == S[r]):
        break
    l -= 1
    r += 1
    ans += 1
print(ans)

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    char u = 'U', r = 'R', d = 'D', l = 'L';

    if (tx < sx && ty > sy)
        swap(r, l);
    else if (tx > sx && ty < sy)
        swap(u, d);
    else if (tx < sx && ty < sy)
    {
        swap(r, l);
        swap(u, d);
    }

    rep(i, abs(ty - sy)) cout << u;
    rep(i, abs(tx - sx)) cout << r;
    rep(i, abs(ty - sy)) cout << d;
    rep(i, abs(tx - sx)) cout << l;

    cout << d;
    rep(i, abs(tx - sx) + 1) cout << r;
    rep(i, abs(ty - sy) + 1) cout << u;
    cout << l;
    cout << u;
    rep(i, abs(tx - sx) + 1) cout << l;
    rep(i, abs(ty - sy) + 1) cout << d;
    cout << r;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp> 

#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace boost::multiprecision;
using namespace std;


template <typename T> 
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U> 
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}

int main()	
{
	#ifdef SANS
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\inputf.txt","r",stdin);
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\outputf.txt","w",stdout);
	#endif
	fast
	int t=1;
	// cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		int256_t ans=1, boundry=1, temp;
		for(int i=0; i<18; i++)
			boundry*=10;
		bool flag=false, zero=false;
		for(int i=0; i<n; i++)
		{
			cin>>temp;
			ans*=temp;
			if(temp==0)
				zero=true;
			if(ans>boundry)
				flag=true;
		}
		if(flag && !zero)
			cout<<-1;
		else
			cout<<ans;
	}
	#ifdef SANS
		cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
	#endif
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N,Q;
int A[100100];
int X[100100];
ll rui[100100];
ll U[100100];
int Count(int l,int r){ //[l,r]
	if(r<l)return 0;
	return upper_bound(A,A+N,r)-lower_bound(A,A+N,l);
}
int check(int k,int x){
	int tar = A[N-k];
	int b = abs(x-tar);
	int c = Count(x-b,min(x+b,tar));
	return c;
}
ll up(int i){
	if(i==0)return U[N-1];
	return U[N-1]-U[i-1];
}
int main(){
	cin >> N >> Q;
	for(int i=0;i<N;i++)scanf("%d",&A[i]);
	for(int i=0;i<Q;i++)scanf("%d",&X[i]);
	rui[0]=A[0];
	rui[1]=A[1];
	for(int i=2;i<N;i++)rui[i]=rui[i-2]+A[i];
	U[0]=A[0];
	for(int i=1;i<N;i++)U[i]=U[i-1]+A[i];
	sort(A,A+N);
	for(int i=0;i<Q;i++){
		int l = 0 ,r = N+1;
		while(r-l>1){
			int mid = (l+r)/2;
			if(check(mid,X[i])>mid)l=mid;
			else r = mid;
		}
		//cout << "l : " << l << endl;
		ll ans = up(N-l);
		//cout << "up: " << up(N-l) << endl;
		if(check(l+1,X[i])>l){
			ans += A[N-l-1];
			if(N>=2*(l+1)+1)ans += rui[N-2*(l+1)-1];
		}else{
			if(N>=2*l+1)ans += rui[N-2*l-1];
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 4096
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define fi first
#define se second
#define db double
#define U unsigned
#define P std::pair<int,int>
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

int main(){
    int h1,m1,h2,m2,k;
    scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
    int mi = (h2-h1)*60+(m2-m1);
    printf("%d\n",std::max(0,mi-k));
    return 0;
}


Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  string tmp=s;
  long long sum=0;
  sort(tmp.begin(),tmp.end());
  int w=upper_bound(tmp.begin(),tmp.end(),'W')-lower_bound(tmp.begin(),tmp.end(),'W');
  for(int i=0;i<s.size();i++){
    if(s[i]=='W') w--;
    else sum+=w;
  }
  cout<<sum;
}

Measured memory_bytes: 772
#include<stdio.h>
#include<math.h>

static int N=100;

int main(){

  int n,p[N+1],m[N+1][N+1];
  int i,j,l,k;
  
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&p[i-1]);
    scanf("%d",&p[i]);
  }

  for(i=1;i<=n;i++) m[i][i] = 0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i+l-1;
      m[i][j] = 1<<21;

      for(k=i;k<=j-1;k++){
	m[i][j] = fmin(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      
	  }
    }
  }

  printf("%d",m[1][n]);
  printf("\n");

  return 0;
}



Measured memory_bytes: 2828
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int N;
vector<int> p;
int main(){
  cin >> N;
  p.resize(N);
  rep(i,0,N - 1) cin >> p[i];
  rep(i,0,N - 1) p[i]--;
  vector<int> dp(N,0);
  int ans = 0;
  rep(i,0,N - 1){
    dp[p[i]] = dp[p[i] - 1] + 1;
    ans = max(ans , dp[p[i]]);
  }

  cout << N - ans << endl;
}


Measured memory_bytes: 1920
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[][] ss = new int[n][26];
    for(int i = 0; i < n; i++) {
      String s = sc.next();
      for(int j = 0; j < s.length(); j++) {
        ss[i][s.charAt(j) - 'a']++;
      }
    }
    int[] anss = new int[26];
    for(int i = 0; i < 26; i++) {
      anss[i] = 100;
    }
    for(int i = 0; i < 26; i++) {
      for(int j = 0; j < n; j++) {
        anss[i] = Math.min(anss[i], ss[j][i]);
      }
    }
    String ans = "";
    for(int i = 0; i < 26; i++) {
      String str = "";
      char cc = (char)('a' + i);
      String c = String.valueOf(cc);
      for(int j = 0; j < anss[i]; j++) {
        str += c;
      }
      ans += str;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 39292
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b) {
			System.out.println("a < b");
		} else if (a > b) {
			System.out.println("a > b");
		} else {
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 25956
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
const int inf = 1e9;
const int mod = 1e9+7;

int N, a, c;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  FOR(i, 0, N){
    cin >> a;
    if (a & 1) c++;
  }
  cout << ((c & 1) ? "NO" : "YES") << endl;
}


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

int main(){
  ll n,ans=0;
  cin>>n;
  ll l[n];
  for(int i=0;i<n;i++)cin>>l[i];
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(l[i]+l[j]>l[k] && l[j]+l[k]>l[i] && l[k]+l[i]>l[j] && l[i]!=l[j] && l[j]!=l[k] && l[k]!=l[i])ans++;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3632
def comb(n, r, p):
    x, y = 1, 1
    for i in range(n, n - r, -1):
        x *= i
        y *= i + r - n
        x %= p
        y %= p
    return pow(y, p - 2, p) * x % p

n, k = map(int, input().split())
r = n - k
ans = 0
mod = 10 ** 9 + 7
for i in range(1, k + 1):
    if i <= r + 1:
        ans = comb(r + 1, min(i, r + 1 - i), mod) * comb(k - 1, min(i - 1, k - i), mod)
    else:
        ans = 0
    print(ans % mod)

Measured memory_bytes: 3316
#include <stdio.h>
#define N 100
#define INF 1234567890

void MatrixChain(int *, int);
int min(int, int);

int A[N];
int m[N][N];

int main(){

  int i = 0;
  int n = 0,r = 0, c = 0;
  int p[N];

  scanf("%d",&n);
  
  for(i = 0; i < n; i++){
    scanf("%d%d",&p[i],&p[i+1]);
  }
  
  MatrixChain(p,n);
  
  printf("%d\n",m[1][n]);
  
  return 0;
  
}

void MatrixChain(int *p, int n){
  
  int i = 0, j = 0, k = 0, l = 0;
  int q = 0;
  
  for(i = 1; i <= n; i++){
    m[i][i] = 0;
  }
  
  for(l = 2; l <= n; l++){
    
    for(i = 1; i <= n-l+1; i++){
      j = i+l-1;
      m[i][j] = INF;
      
      for(k = i; k <= j-1; k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j] = min(m[i][j],q);
      }

    }
    
  }
  
}

int min(int a, int b){
  
  if(a < b)return a;
  else return b;
  
}



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

int main() {
//    int _;
//    scanf("%d", &_);
//    while(_--) {
        int n, x, t;
        scanf("%d%d%d", &n, &x, &t);
        printf("%d\n", (n + x - 1) / x * t);
//    }

    return 0;
}


Measured memory_bytes: 3812
def _input():
    number = input()
    array = input().split()
    number_array = []
    for i in array:
        number_array.append(int(i))
    return number_array

def composition(number_array):
    number_array.sort()
    total_value = 0
    counter_flag = 0
    for i in number_array:
        if counter_flag >= 1:
            total_value = (total_value + i) / 2
        else:
            total_value = i
        counter_flag += 1

    return total_value

if __name__ == "__main__":
    array = _input()
    print(composition(array))    


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<random>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;

vector<int> csort(vector<int> a, int k){
  int n = a.size();
  vector<int> c(k+1, 0);
  vector<int> b(n+1, 0);
  for(int i=0; i<n; i++) c[a[i]]++;
  for(int i=1; i<=k; i++) c[i] += c[i-1];
  for(int i=0; i<n; i++){
    b[c[a[i]]] = a[i];
    c[a[i]]--;
  }
  return b;
}

int main(void) {

  int n;
  while(cin >> n){
    if( n == 0 ) break;
    vector<int> x(n);
    for(int i=0; i<n; i++) cin >> x[i];

    vector<int> a = csort(x, *max_element(x.begin(), x.end()));
    for(int i=1; i<n+1; i++){
      if( i != n ) cout << a[i] << " ";
      else cout << a[i] << endl;
    }

  }




  return 0;
}

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int n,a;

main() {
    cin >> n >> a;
    if (n%500 > a) ct("No")
    else ct("Yes")
}






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

int main(){
#ifdef LOCAL
     freopen("in.txt", "r", stdin);
     //freopen("out.txt", "w", stdout);
#else
 //fastIO;
#endif
//*****************/******************/*************<<
    ll k=0,c=0;
    ll dinero=100;
    cin>>k;
    while(dinero<k){
        dinero+=(dinero/100);
        c++;
    }
    cout<<c<<endl;
}


Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x=0,ans=0,n;
	cin>>n;
	string S;
	cin>>S;
	for(int i=0;i<n;i++)
		if(S[i]=='I')
		{
			x++;
			ans=max(ans,x);
		}
		else	x--;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())

ans = 0 
for b in range(1,n+1):
  x = n // b
  r = n % b
  ans += x * max(0, b - k)
  ans += max(0, r - k + 1)
  if k == 0:
    ans -= 1
    
print(ans)    

Measured memory_bytes: 3064
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    L, R = LI()

    ans = 2018    
    for i, j in itertools.combinations(range(L, min(L + 2018, R) + 1), 2):
        ans = min(i * j % 2019, ans)

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10112
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 998244353
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;
ll dp[3333][3333];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,s;cin>>n>>s;
  vi A(n);
  for(auto &a:A){
    cin>>a;
  }
  dp[0][0] = 1;
  for(int i=0;i<n;i++){
    for(int j=0;j<=s;j++){
      dp[i+1][j] += dp[i][j]*2;
      dp[i+1][j] %= MOD;
      if(j+A[i] <= s){
	dp[i+1][j+A[i]] += dp[i][j];
      }
    }
  }
  cout<<dp[n][s]<<endl;
  return 0;
}


Measured memory_bytes: 81804
import sys
n,m = map(int, input().split())

# it watches only end of union
# for i in range(m):
#     l,r,d = map(int, input().split())
#     if ml[l] == -1 and ml[r] == -1:
#         ml[l] = 0
#         ml[r] = d
#     elif ml[l] != -1 and ml[r] == -1:
#         ml[r] = d + ml[l]
#         if ml[r] > n:
#             print('R', i, ml[l], ml[r], flush=True)
#             print('No', flush=True)
#             sys.exit()
#     elif ml[l] == -1 and ml[r] != -1:
#         ml[l] = ml[r] - d
#         if ml[l] < 1:
#             print('L', i, ml[l], ml[r], flush=True)
#             print('No', flush=True)
#             sys.exit()
#     else:
#         if ml[r] - ml[l] != d:
#             print('B', i, l, ml[l], r, ml[r], d, flush=True)
#             print('No', flush=True)
#             sys.exit()
# print('Yes', flush=True)

class UnionfindWithWeight():
    def __init__(self,n):
        self.parents=[-1]*n
        self.ranks=[0]*n
        self.dist=[0]*n
    def find(self,x):
        if self.parents[x]<0:
            return self.dist[x],x
        else:
            tmp=self.find(self.parents[x])
            self.dist[x]+=tmp[0]
            self.parents[x]=tmp[1]
            return self.dist[x],self.parents[x]
    def union(self,x,y,d):
        rx=self.find(x)[-1]
        ry=self.find(y)[-1]
        diff=d+self.dist[x]-self.dist[y]
        if rx==ry:
            if diff!=0:
                return True
            return False
        if self.ranks[ry]>self.ranks[rx]:
            rx,ry=ry,rx
            diff=-diff
        self.parents[ry]=rx
        self.dist[ry]=diff
        if self.ranks[ry]==self.ranks[rx]:
            self.ranks[rx]+=1
        return False
lrd = []
for i in range(m):
    l,r,d = list(map(int, input().split()))
    lrd.append([l,r,d])
v=UnionfindWithWeight(n)
for i in lrd:
    l, r, d = i
    if v.union(l-1,r-1,d):
        print('No')
        import sys
        sys.exit()
print('Yes')


Measured memory_bytes: 111120
while 1:
    n = int(input())
    if n == 0:
        break

    ice = [0] * 10
    for _ in range(n):
        c = int(input())
        ice[c] += 1

    for i in ice:
        if i == 0:
            print("-")
        else:
            print("*" * i)



Measured memory_bytes: 5620
import math

def main():
    a,b,d = map(float,input().split())
    d = d*math.pi/180.0
    S = a*b*math.sin(d)/2.0
    c = (a*a+b*b-2.0*a*b*math.cos(d))**(0.5)
    h = S/a*2.0
    print (S,a+b+c,h)



if __name__ == '__main__':
    main()




Measured memory_bytes: 5700
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define vi vector<int>
#define MAX_N 200005
#define i197 1000000007

using namespace std;


typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,P1> P2;
const int inf=1000000000;
P1 xy[MAX_N]={};

int main() {
	int n;
	cin>>n;
	int a[1001];
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	int k=1000000000;
	rep(i,n-3){
		if(a[i+1]-a[i]<k){
			k=a[i+1]-a[i];
		}
	}
	double r=((double)a[n-1]+(double)a[n-2])/(double)k;
	r=max(r,((double)a[n-1]+(double)a[n-4])/((double)a[n-2]-(double)a[n-3]));
	r=max(r,((double)a[n-3]+(double)a[n-4])/((double)a[n-1]-(double)a[n-2]));
	printf("%.5f",r);
	return 0;
}



Measured memory_bytes: 6348
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N, M, p;
    cin>>N>>M>>p;
    vector<int> d(M);
    for (int &t: d)
        cin>>t;

    sort(d.begin(), d.end());
    d.push_back(d[0]+N);

    int ans = N;
    for (int i=0; i<M; i++)
    {
        int t = min(
            min(abs(p-d[i]%N), N-abs(p-d[i]%N)),
            min(abs(p-d[i+1]%N), N-abs(p-d[i+1]%N))
        );
        //  cout<<N<<" "<<t<<" "<<t+N-(d[i+1]-d[i])<<endl;
        ans = min(ans, t+N-(d[i+1]-d[i]));
    }
    cout<<ans*100<<endl;
}

Measured memory_bytes: 3204
#include <iostream>
#include <string>

using namespace std;

int main(){
    int ans = 0;
    char c;
    string s;
    cin >> s;


    for(int i = 0;i < s.size();i++){
        if(i == 0)c = s[i];
        else if(c == s[i] && c == '1'){
            s[i] = '0';
            ans++;
        }else if(c == s[i] && c == '0'){
            s[i] = '1';
            ans++;
        }
        c = s[i];
    }

    cout << ans << endl;
    

    return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
T GCD(T a, T b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
T LCM(T a, T b) {
	return a / GCD(a, b) * b;
}
template<class T>
inline T round_int(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	if (a <= c && c <= b) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int N;
    cin>>N;
    if(N%1000==0)cout<<0;
    else cout<<1000-N%1000;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int main(void)
{
    int N, M;

    cin >> N >> M;

    if (N == M)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

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

const long long MOD = 1000000007;
vector<char> c={'a','b','c','d','e','f','g','h','i','j'};
set<long long> a;
int n;

void so(int x,ll p,int cnt){
  if(x==n){
    a.insert(p);
    return;
  }
  else{
    p *= 10;
    rep(i,cnt+1){
      if(i==cnt){
        so(x+1,p+i,cnt+1);
      }
      else{
        so(x+1,p+i,cnt);
      }
    }
  }
  return;
}

int main(){
  cin >> n;
  so(0,0,0);
  for(ll p:a){
    rep(i,n){
      cout << c.at( ( p % (int)pow(10,n-i) )/(int)pow(10,n-i-1) );
    }
    cout << endl;
  }
  
}



Measured memory_bytes: 6912
#include <stdio.h>

int main(){
    int n;
    char s[100];
    int a[26], b[26], i, j, k, cnt, cntmax=0;

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

    for(i=0; i<26; i++){
        a[i] = 0;
        b[i] = 0;
    }
    
    for(i=1; i<n; i++){
        for(j=0; j<26; j++){
            a[j] = 0;
            b[j] = 0;
        }
        for(j=0; j<26; j++){
            for(k=0; k<i; k++){
                if(s[k] == 'a' + j)
                    a[j]++;
            }

            for(k=i; k<n; k++){
                if(s[k] == 'a' + j)
                    b[j]++;
            }
        }

        cnt=0;

        for(j=0; j<26; j++){
            if(a[j] > 0 && b[j] > 0)
                cnt++;
        }
        
        if(cntmax < cnt)
            cntmax = cnt;
    }

    printf("%d\n", cntmax);

    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(){
  int n, r;
  cin >> n >> r;
  if(n < 10) cout << r + 100 * (10 - n) << endl;
  else cout << r << endl;
  return 0;
}



Measured memory_bytes: 3548
# region header
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
import copy
# @lru_cache(maxsize=None)
# sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7
# endregion
# region input function


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


# endregion
x = inp()
if x:
    print(0)
else:
    print(1)


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

#define SIZE_OF_ARRAY(array) sizeof(array)/sizeof(array[0])
typedef long long ll;

int main() {
    ll N;
    cin >> N;
    vector<ll> X;
    for(ll i = 0; i < N; i++){
        ll x;
        cin >> x;
        X.push_back(x);
    }
    sort(X.begin(),X.end());
    ll min = LLONG_MAX;
    
    for(ll i = 0; i <= X.at(X.size()-1); i++){
        ll sum = 0;
        for(ll j = 0; j < N; j++){
            sum += (i-X.at(j))*(i-X.at(j));
        }
        if(min > sum){
            min = sum;
        }
    }
    cout << min << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

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

	cout << ((n*m % 2 == 0) ? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

int n;
P p[105];
int height[105];

// C
signed main(){
  cin>>n;
  int h=-1;
  for(int i=0; i<n; i++){
    int a,b,c; cin>>a>>b>>c;
    p[i].first=a; p[i].second=b; height[i]=c;
    if(c>0) h=i;
  }

  for(int i=0; i<=100; i++){
    for(int j=0; j<=100; j++){
      int ans=abs(p[h].first-i)+abs(p[h].second-j)+height[h];
      bool ok=true;
      for(int k=0; k<n; k++){
        if(height[k]!=max(ans-abs(p[k].first-i)-abs(p[k].second-j),(int)0)) ok=false;
      }
      if(ok){
        cout<<i<<" "<<j<<" "<<ans<<en;
      }
    }
  }
}


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

int main()
{
		int W, H, x, y, r;
		cin >> W >> H >> x >> y >> r;

		if (x>=0 && y>=0 && x+r>=0 && y+r>=0 && x+r<=W && y+r<=H) {
				cout << "Yes\n";
		} else {
				cout << "No\n";
		}
}

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

#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

void Main() {
  string S;
  cin >> S;
  string ans;
  if (S == "Sunny") ans = "Cloudy";
  if (S == "Cloudy") ans = "Rainy";
  if (S == "Rainy") ans = "Sunny";
  cout << ans << endl;
  return;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
//package atcoder;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String [] args)  {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int D = sc.nextInt();
		int x[] = new int[N];
		int y[] = new int[N];
		for(int i=0;i<N;i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		int count = 0;

		//System.out.println(x[1]);
		//System.out.println(y[1]);
		double kyori = 0;
		for(int j=0;j<N;j++) {
			kyori = Math.sqrt((Math.pow(x[j], 2)+Math.pow(y[j], 2)));
			//System.out.println(kyori);
			if(kyori<=D) {
				count ++;
			}
		}
		System.out.println(count);
		
	}
}

Measured memory_bytes: 61128
def calc_log2_int(n):
  """
  calc maximum integer m, such that 2 ^ m <= n 
  """
  left = -1
  right = 100    # 2^100 = 10^30
  while right - left > 1:
    mid = (right + left) // 2
    if pow(2, mid) > n:
      right = mid
    else:
      left = mid
  return left


x, y = map(int, input().split())
n = y // x
print(calc_log2_int(n) + 1)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	long long W, H;
	while(cin >> W >> H){
		vector< pair<int, int> > p(W+H);
		for(int i=0;i<W;i++){
			int v; cin >> v;
			p[i] = make_pair(v, 0);
		}
		for(int i=0;i<H;i++){
			int v; cin >> v;
			p[i+W] = make_pair(v, 1);
		}
		sort(p.begin(), p.end());
		long long res = 0;
		++W; ++H;
		for(int i=0;i<p.size();i++){
			if(p[i].second == 0){
				res += p[i].first * H;
				--W;
			} else {
				res += p[i].first * W;
				--H;
			}
		}
		cout << res << endl;
	}
}


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

using namespace std;

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(t) for(ll i =0;i<t;i++)
// #define bs(a,x) binary_search(a.begin(),a.end(),x)
#define ll long long int
#define ul unsigned long int
#define ld long double
#define umpi unordered_map<int,int> 
#define umpl unordered_map<ll,ll> 
#define vi vector<int>
#define vl vector<ll>
#define fill(a,p) memset(a,p,sizeof(a))
#define pb push_back
#define mod 998244353
#define N 10000000
#define all(a) a.begin(),a.end()
#define point pair<ll,ll>
#define endl "\n"

const int inf = 1000000007;
const ll linf = 1ll * inf * inf;
const ll MAXIMUM =2005;

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll max(ll a, ll b){return a>b?a:b;}
inline ll minim(ll a, ll b){return a<b?a:b;}

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

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

int main()
{
	fio;
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll i=0;
	while(a>0 && c>0){
		if(i%2==0){
			c=c-b;
		}else{
			a=a-d;
		}
		i++;
	}
	if(a>0){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
}




Measured memory_bytes: 3652