akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)
 
ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

int main(){
    set<ll> s;
    REP(i,0,123){
        s.insert(i);
    }
    ll X=ii(), N=ii();
    REP(i,0,N){
        ll p=ii();
        s.erase(p);
    }
    ll ret;
    ll m=100000;
    for(ll p : s){
        if(abs(p-X) < m){
            ret = p;
            m = abs(p-X);
        }
    }
    oie(ret);
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;
using P = pair<int, int>;

const int N_MAX = 605;
vector<int> edge[N_MAX];

vector<double> dp;

int main(){
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int s, t;
        cin >> s >> t;
        edge[s].push_back(t);
    }
    dp.assign(n+3, 0);
    dp[n] = 0;
    for(int i = n-1; i >= 1; i--){
        int num = edge[i].size();
        for(auto u: edge[i]){
            dp[i] += (1 + dp[u])/(double)num;
        }
    }
    double ans = dp[1];
    for(int i = 1; i < n; i++){
        if (edge[i].size() == 1)continue;
        int l = 0;
        double dpmax = 0;
        for(auto u: edge[i]){
            if (dp[u] > dpmax){
                l = u;
                dpmax = dp[u];
            }
        }
        for(int j = i; j >= 1; j--){
            int num = edge[j].size();
            if (j == i)num--;
            dp[j] = 0;
            for(auto u: edge[j]){
                if (j == i && u == l)continue;
                dp[j] += (1 + dp[u])/(double)num;
            }
        }
        ans = min(ans, dp[1]);
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 4368
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main() { 
  ll n,m;
  while(cin>>n>>m){
    if(n==0 && m==0) return 0;
  
    vector<ll> C(m),X(n+1);
    rep(i,m) cin>>C[i];
    rep(i,n) cin>>X[i+1];
    
    ll dp[20001][256];
    rep(i,20001){
      rep(j,256) dp[i][j]=1e9;
    }
    dp[0][128]=0;
    
    for(int i=0;i<n;i++){
      for(int j=0;j<=255;j++){
        for(int k=0;k<m;k++){
          if(dp[i][j]==1e9) continue;
          if(j+C[k]>255) dp[i+1][255]=min(dp[i+1][255],dp[i][j]+(255-X[i+1])*(255-X[i+1]));
          else if(j+C[k]<0) dp[i+1][0]=min(dp[i+1][0],dp[i][j]+X[i+1]*X[i+1]);
          else dp[i+1][j+C[k]]=min(dp[i+1][j+C[k]],dp[i][j]+(j+C[k]-X[i+1])*(j+C[k]-X[i+1]));
        }
      }
    }
    
    ll ans=1e9;
    for(int j=0;j<=255;j++) ans=min(ans,dp[n][j]);
    cout<<ans<<endl;
  }
}


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

using namespace std;

#define MOD (1000000007ll)

int main(void){
	long long int n,m,i,ans=0ll,fac=1ll;
	cin >> n >> m;
	if(n==m){
		for(i=2; i<=n; i++){
			fac *= i;
			fac %= MOD;
		}
		ans = (fac * fac * 2)%MOD;
	}else if((n-m)==1){
		ans++;
		for(i=2; i<=m; i++){
			fac *= i;
			fac %= MOD;
		}
		ans *= fac;
		fac *= n;
		fac %= MOD;
		ans *= fac;
		ans %= MOD;
	}else if((n-m)==-1){
		ans++;
		for(i=2; i<=n; i++){
			fac *= i;
			fac %= MOD;
		}
		ans *= fac;
		fac *= m;
		fac %= MOD;
		ans *= fac;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,cnt=0;
	scanf("%d%d",&n,&k);
	while(n--){
		int c;
		scanf("%d",&c);
		if(c>=k)++cnt;
	}
	printf("%d",cnt);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 105
#define M 5
#define ll long long
#define set(a,v) memset(a,v,sizeof(a)) 
int n,m,a[N];ll dp[N][M];
void swp(int &x,int &y) {int t=x;x=y;y=t;} 
void rd(int a[])
{
	char c=0;while(!isdigit(c)) c=getchar();
	while(isdigit(c)) a[++n]=c&15,c=getchar();
	for(int i=1;i<=n>>1;++i) swp(a[i],a[n-i+1]);
}
ll dfs(int u,bool lim,int cnt)
{
	if(cnt>m) return 0;if(!u) return cnt==m;
	if(!lim && ~dp[u][cnt]) return dp[u][cnt];
	ll res=0;int up=lim?a[u]:9;
	for(int i=0;i<=up;++i) res+=dfs(u-1,lim&(i==up),cnt+(i!=0));
	if(!lim) dp[u][cnt]=res;return res;
}
int main()
{
	rd(a);scanf("%d",&m);set(dp,-1);
	printf("%lld\n",dfs(n,1,0));return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring> 
using namespace std;
int main()
{
	long long n,w;
	cin>>n>>w;
	long long wt[n+1],v[n+1];
	for(long long i=1;i<=n;i++)
	cin>>wt[i]>>v[i];
	long long dp[100005];
	memset(dp,0x3f,sizeof(dp));
		dp[0]=0;
	for(int i=1;i<=n;i++)
	 for(int j=100000;j>=v[i];j--)
	 dp[j]=min(dp[j],dp[j-v[i]]+wt[i]);
	long long ans=0;
	for(long long i=1;i<=100000;i++)
		if(dp[i]<=w)
		ans=max(ans,i);
		cout<<ans;
	
 } 

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


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


  
  ll n = s.size();

  map<char, vector<ll>> ma;
  rep(i, 26) ma['a'+i] = vector<ll>();

  rep(i, n) ma[s[i]].push_back(i);


  ll idx = -1;
  bool ok = true;
  ull cnt = 0;
  rep(i, t.size()){
    if(ma[t[i]].empty()){
      ok = false;
      break;
    }
    ll id = upper_bound(all(ma[t[i]]), idx) - ma[t[i]].begin();
    if(id == ma[t[i]].size()) id = 0, cnt++;
    idx = ma[t[i]][id];
  }

  if(!ok) cout << -1 << endl;
  else    cout << cnt*(ull)s.size()+(ull)idx+1 << endl;
  
  
  return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#define MOD 1000000000+7
using namespace std;

int main(void){
    int n;
    cin>>n;
    int a_count[n] = {};
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        a_count[a] ++;
    }
    long long ans=1;
    for(int i= (n%2)+1;i<n;i+=2){
        if(a_count[i] == 2){
            ans *= 2;
            ans %= MOD;
        }else{
            ans = 0;
            break;
        }
    }
    if(n%2 == 1 && a_count[0] !=1) ans =0;
    
    cout<<ans<<endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

#define scani(i) scanf("%d", &(i))
#define scanc(c) scanf("%c", &(c))
#define scand(d) scanf("%lf", &(d))

#define printi(i) printf("%d\n", (i))

#define NUM (100)

int main()
{
    long long int n;
    scanf("%lld", &n);
    
    double r = sqrt(n);
    long long int i = (long long int)r;
    if(i == 1){
        printf("%lld\n", n - 1);
        return 0;
    }
    
    while(n % i){
        i--;
    }
    
    long long int j = n / i;
    printf("%lld\n", i + j - 2);
    
    return 0;
}


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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

  ll n;
  cin >> n;
  vector < ll > a(n + 1), p(n + 1, 0);
  for(int i = 1; i <= n; i++){
    cin >> a[i];
    p[i] = p[i - 1] + a[i];
  }
  vector < vector < ll > > dp(n + 1, vector < ll > (n + 1, inf));

  for(int i = 1; i <= n; i++) dp[i][i] = 0;

  for(int i = n; i > 0; i--){
    for(int j = i + 1; j <= n; j++){
      for(int k = i; k < j; k++){
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j] + p[j] - p[i - 1]);
      }
    }
  }

  cout << dp[1][n] << '\n';
}


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

int comb(int n, int r){
    return n == (r | (n-r));
}

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

    vector<int> A(N);
    for(int i=0; i<N; i++) A[i] = S[i] - '1';

    int num[3] = {0};
    for(int a : A) num[a]++;
    if(num[1]){
        int res = 0;
        for(int i=0; i<N; i++){
            res += A[i] * comb(N-1, i);
            res %= 2;
        }
        cout << res << endl;
    }else{
        for(int& a : A) a /= 2;
        int res = 0;
        for(int i=0; i<N; i++){
            res += A[i] * comb(N-1, i);
            res %= 2;
        }
        cout << res*2 << endl;
    }

    return 0;
}


Measured memory_bytes: 5252
#include <bits/stdc++.h>
#define N 200005

using namespace std;

int n;
int a[N], c[N];

inline int read() {
	int x = 0; bool neg = false; char ch = getchar();
	while(!isdigit(ch)) (ch == '-') && (neg = true), ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return neg ? -x : x;
}

int main() {
	n = read();
	for(int i = 1; i <= n; ++i)
		a[i] = read(), ++c[a[i]];
	long long ans = 0;
	for(int i = 1; i <= n; ++i)
		ans += (c[i] - 1LL) * c[i] / 2;
	for(int i = 1; i <= n; ++i) {
		long long res = ans - c[a[i]] + 1;
		printf("%lld\n", res);
	}
	return 0;
}

Measured memory_bytes: 3712
#include <cstdio>
#include <algorithm>

const int N = 100000;
int n, m, v, p, a[N];

bool test(int t) 
{
	t = n - t;
	int amt = v - t - 1;
	int i;
	for (i = n - 1; a[t] + m < a[i]; --i, --amt);
	long long to = 0;
	for (int j = i; j > t; --j) to += a[t] + m - a[j];
	for (; i > t && to < (long long)amt * m; --i) {
		--amt;
		to -= a[t] + m - a[i];
	}
	return n - i <= p;
}

int main() 
{
	scanf("%d%d%d%d", &n, &m, &v, &p);
	for (int i = 0; i < n; ++i) scanf("%d", a + i);
	std::sort(a, a + n);
	int l = p, r = n;
	int ans;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (test(m)) {
			ans = m;
			l = m + 1;
		}
		else r = m - 1;
	}
	printf("%d\n", ans);
	return 0;
}


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

int main() {
	string s;
	const string rs = "yuiophjklnm";
	
	while(cin >> s,s!="#"){
		bool r;
		int count=0;
		
		if((int)rs.find(s[0]) != -1) r=true;
		else r = false;
		
		for(int i=1;i<s.size();i++){
			if((int)rs.find(s[i]) != -1 && r == false){
				r = true;
				count++;
			}else if((int)rs.find(s[i]) == -1 && r == true){
				r = false;
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1188
N,K=map(int,input().split())
P=list(map(int,input().split()))

maxind=-1
cur=sum(P[:K])
maxval=cur
for i in range(K,N):
  cur=cur+P[i]-P[i-K]
  if cur>maxval:
    maxval=cur
    maxind=i

# i-K+1～iまでの期待値を求める
ans=0
for i in range(maxind-K+1,maxind+1):
    ans+=(P[i]*(P[i]+1)//2)/P[i]
    
print(ans)

Measured memory_bytes: 25060
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

string s1, s2; 

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

    cin >> s1 >> s2;
    int len1 = s1.size(), len2 = s2.size();

    int res = 0;
    rep(L, min(len1, len2) + 1){
        const int M = 'z' - 'a' + 1;
        vi hist(M);
        rep(i, L){
            hist[s1[i] - 'a']++;
        }

        set<vi> dic;
        rep(i, L - 1, len1){
            if(i >= L){
                hist[s1[i] - 'a']++;
                hist[s1[i - L] - 'a']--;
            }
            dic.insert(hist);
        }

        hist = vi(M);
        rep(i, L){
            hist[s2[i] - 'a']++;
        }
        rep(i, L - 1, len2){
            if(i >= L){
                hist[s2[i] - 'a']++;
                hist[s2[i - L] - 'a']--;
            }
            if(dic.find(hist) != end(dic)){
                res = L;
                break;
            }
        }
    }

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
 
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(200010);

int main(){
    ll N, K;
    cin >> N >> K;
    K = min(K,N-1);
    mint ans = 0;
    rep(i,K+1){
        ans += comb(N,i)*comb(N-i+i-1,i);//N-i kokara chofuku i ko 
    }
    cout << ans << endl;
}


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

int main(){
    const int p = 1e9+7;
    int n, m;
    cin >> n >> m;
    vector<bool> blk(n+1);
    rep(i,m){
        int x;
        cin >> x;
        blk.at(x) = true;
    }
    vector<ll> pats(n+1);
    pats[0] = 1;
    pats[1] = blk[1] ? 0 : 1;
    for(int i=2;i<n+1;i++){
        if(blk[i]) pats[i] = 0;
        else {
            pats[i] = (pats[i-2] + pats[i-1]) % p;
        }
    }
    cout << pats[n] << endl;

    return 0;
}

Measured memory_bytes: 1152
//求n个m维的点之间的最大曼哈顿距离

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
#define inf 0x7fffffff
int a[200050][2];        
int n,m;
int GetManhattan(int p[][2], int n, int dem)
{
	int ans = 0, Min, Max;
	for (int i = 0; i < (1 << (dem)); i++) {   
		Min = inf, Max = -inf;
		for (int j = 0; j < n; j++) {   
			int sum = 0;
			for (int k = 0; k < m; k++) {   
				int t = i & 1 << k;  
				if (t) sum += p[j][k];
				else sum -= p[j][k];
			}
            Max = max(Max, sum);
            Min = min(Min, sum);
		}
        ans = max(ans, Max - Min);
    }
	return ans;
}

int main() {
    int n;
    cin >> n;
    m = 2;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            cin >> a[i][j];
    cout << GetManhattan(a, n, m);

    return 0;
}

Measured memory_bytes: 5160
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>
#include <unordered_set>

int main()
{
    int A, B;
    std::cin >> A >> B;

    std::cout << A * B - (A + B - 1) << std::endl;

    return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int r, s, p;
  cin >> r >> s >> p;
  string t;
  cin >> t;
  vector<int> dpr(n), dps(n), dpp(n);
  for (int i = 0; i < n; ++i) {
    if (i < k) {
      if (t[i] == 'r') {
        dpp[i] = p;
      } else if (t[i] == 'p') {
        dps[i] = s;
      } else {
        dpr[i] = r;
      }
    } else {
      dpr[i] = (t[i] == 's' ? r : 0) + max(dps[i - k], dpp[i - k]);
      dps[i] = (t[i] == 'p' ? s : 0) + max(dpr[i - k], dpp[i - k]);
      dpp[i] = (t[i] == 'r' ? p : 0) + max(dpr[i - k], dps[i - k]);
    }
  }
  int res = 0;
  for (int i = n - k; i < n; ++i) {
    res += max({dpr[i], dpp[i], dps[i]});
  }
  cout << res << '\n';
}


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

//public class Problem0014_Integral {
public class Main {
	public static void main(String[] args) {
		try {
		//	Problem0014_Integral test = new Problem0014_Integral();
			Main test = new Main();
			
			
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line;
			while((line = reader.readLine()) != null) {
				try {
					int number = Integer.parseInt(line);
					System.out.println(test.getSummationArea(number));
				} catch(NumberFormatException e) {
					break;
				}
			}
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	int getSummationArea(int gap) {
		int x = 0;
		int summationArea = 0;
		while(x < 600) {	//600ÌñªInputÌf[^Å é±Æ©çAíÉ x=600 ÆÈéªI
			summationArea += getArea(x, gap);
			x += gap;
		}
		
		return summationArea;
	}
	int getArea(int start, int width) {
		int height = start * start;
		int area = width * height;
	//	System.out.println("x:" + start + "\theight:" + height + "\twidth:" + width + "\tarea:" + area);
		return area;
	}
}

Measured memory_bytes: 9324
#include <bits/stdc++.h>
#define LL long long
using namespace std;
inline LL read(){
	static LL x,f; x = 0,f = 1; static char c; c = getchar();
	while (!isdigit(c)){ if (c == '-') f = -1; c = getchar(); }
	while (isdigit(c)){ x = x * 10 + c - '0',c = getchar(); }
	return x * f;
}
const int N = 100005;
LL n,s,x[N],a[N],tot;
inline LL work(int l,int r){
	if (s <= x[l]){ tot += x[r] - s; return x[r]; }
	if (s >= x[r]){ tot += s - x[l]; return x[l]; }
	if (a[l] < a[r]){
		a[r] += a[l],tot += work(l+1,r) - x[l];
		return x[l];
	}
	a[l] += a[r],tot += x[r] - work(l,r-1);
	return x[r];
}
int main(){
	int i;
	n = read(),s = read();
	for (i = 1; i <= n; ++i) x[i] = read(),a[i] = read();
	int l = 1,r = n;
	work(1,n);
	cout << tot << '\n';
	return 0;
}

Measured memory_bytes: 8916
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int a, b, c;
    int k;
    int n;
 
    scanf("%d%d%d", &a, &b, &c);
    n = 0;
    for (k = a; k <= b; k++) {
        if (c % k == 0) n++;
    }
    printf("%d\n", n);
    return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    string s;
    cin>>s;
    int i;
    bool is = false;
    FOR0(i, 3) if(s[i] == '7') is = true;
    if(is) cout<<"Yes";
    else cout<<"No";
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <vector>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <math.h>
#include <bitset>
#include <stack>
#include <queue>
#include <complex>
using namespace std;
#define endl '\n'
// #define exp 2.7182818284590452353602874713527
// #define pi 3.1415926535897932384626433832795
// typedef complex<double> comp;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// #define int long long
double p[3000];
double dp[3000][3000];
void solve()
{
    int n;
    scanf("%d", &n);
    for(int i = 1;i <= n;i++)
        cin >> p[i];
    dp[1][0] = 1-p[1];
    dp[1][1] = p[1];
    for(int i = 2;i <= n;i++)
        dp[1][i] = 0;
    for(int i = 2;i <= n;i++)
    {
        dp[i][0] = dp[i-1][0]*(1-p[i]);
        for(int j = 1;j <= n;j++)
        {
            if(j > i)
            {
                dp[i][j] = 0;
                continue;
            }
            dp[i][j] = dp[i-1][j]*(1-p[i]) + (dp[i-1][j-1]*p[i]);
        }
    }
    double ans = 0;
    for(int j = ceil(n/2.0);j <= n;j++)
        ans += dp[n][j];
    cout << setprecision(12) << ans;
}
int32_t main()
{
    double t1 = clock();
    int t;
    t = 1;
    // cin >> t;
    while(t--)
        solve();
    cerr << setprecision(10) << (clock()-t1)/CLOCKS_PER_SEC << "\n";
    return 0;
}

Measured memory_bytes: 70528
#include<stdio.h>

int main() {
	int H, W;
	while (1) {
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0)break;

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (j % 2 == i % 2)printf("#");
				else printf(".");
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 2684
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int N, M;
int a[1000], b[1000], c[1000];
int cost[100][100];

signed main(){
	scanf("%d%d", &N, &M);
	rep(i, N){
		rep(j, N){
			cost[i][j] = 1'000'000'000;
		}
	}
	rep(i, N){
		cost[i][i] = 0;
	}

	rep(i, M){
		scanf("%d%d%d", a+i, b+i, c+i);
		a[i]--; b[i]--;
		cost[a[i]][b[i]] = c[i];
		cost[b[i]][a[i]] = c[i];
	}
	rep(i, N){
		rep(j, N){
			rep(k, N){
				cost[j][k] = min(cost[j][k], cost[j][i]+cost[i][k]);
			}
		}
	}

	int ans = 0;
	rep(i, M){
		if(cost[a[i]][b[i]] != c[i]) ans++;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 3864
#include <stdio.h>
#include <string.h>

int main(void){
  int i,w;
  char s[1000];
  
  scanf("%s",s);
  scanf("%d",&w);
    
  for(i=0; i<strlen(s); i+=w) printf("%c",s[i]);
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
template<class T>
void puta(T&&t){cout<<t<<endl;}
template<class H,class...T>
void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}

int popcnt(int x){return __builtin_popcount(x);}
int popcnt(ll x){return __builtin_popcountll(x);}
int bsr(int x){return 31 - __builtin_clz(x);}
int bsr(ll x){return 63 - __builtin_clzll(x);}
int bsf(int x){return __builtin_ctz(x);}
int bsf(ll x){return __builtin_ctzll(x);}

/*他のライブラリを入れる場所*/

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	vl a(n);
	rep(i,n)cin>>a[i];
	vl dp(n,INF);
	dp[0]=0;
	rep(i,n){
		range(j,1,k+1){
			if(i+j<n)dp[i+j]=min(dp[i+j],dp[i]+abs(a[i]-a[i+j]));
		}
	}	
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		r = new int[8];
		Arrays.fill(r, -1);
		int k = sc.nextInt();
		for (int i = 0; i < k; i++) {
			r[sc.nextInt()] = sc.nextInt();
		}
		
		used = new boolean[8];
		perm = new int[8];
		permutation(0, 8);
		
    	String[] q = {"Q.......", ".Q......", "..Q.....", "...Q....", "....Q...", ".....Q..", "......Q.", ".......Q"};
    	for (int i = 0; i < 8; i++) {
    		System.out.println(q[res[i]]);
    	}
    	
        sc.close();
	}

	static int[] r;
	static int[] res;
	static boolean[] used;
	static int[] perm;

	// {0, 1, 2, 3, ...., n - 1}???????????????n!?????????????????????
	static void permutation(int pos, int n) {
		if (pos == n) {
			// perm[] ??????????????????
			for (int i = 0; i < n; i++) {
				if (r[i] != -1 && r[i] != perm[i]) {
					return;
				}
			}

			if (res == null) {
				// check
				boolean flag = true;
				for (int i = 0; i < n; i++) {
					for (int j = i + 1; j < n; j++) {
						if (perm[i] < n - (j - i) && perm[j] == perm[i] + j - i) {
							flag = false;
							break;
						}
						if (perm[i] >= j - i && perm[j] == perm[i] - (j - i)) {
							flag = false;
							break;
						}
					}
				}
				if (flag) {
					res = perm.clone();
				}
			}
			
			return;
		}
		// perm[]???pos?????????0???n-1?????????????????????????????????
		for (int i = 0; i < n; i++) {
			if (!used[i]) {
				perm[pos] = i;
				// i????????£????????§????????°???true
				used[i] = true;
				permutation(pos + 1, n);
				// ?????£????????????????????°?????????
				used[i] = false;
			}
		}
		
		return;
	}
}

Measured memory_bytes: 24372
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;

string u[4] = { "eraser","dreamer", "erase","dream" };
int main() {
	string s, t;


	cin >> s;
	int len = s.length();
	for (int i = 0; i < 4; i++) {
		int l = len;
		int fd = s.rfind(u[i], len-1);
		bool flg = fd >= l;
		if (s.rfind(u[i], len -1) != string::npos && len - fd == u[i].length()) {
			len -= u[i].length();
			i = -1;
			if (len <= 0) break;
		}
	}
	len <= 0 ? cout << "YES" : cout << "NO";
	cout << endl;
	return 0;
}


Measured memory_bytes: 512
x, k, d = map(int, input().split())
x = abs(x)
k_needed = x // d
if x > k*d:
  print(x-k*d)

else:
  if (k - k_needed) % 2 == 0:
    print(abs(x - k_needed*d))
  else:
    print(abs(abs(x - k_needed*d) - d))

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
ll const mod=998244353;
const ll MAX=300000;
using vi=vector<int>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


//////////////////////////////////////


int main(){
   int h,w;
   cin>>h>>w;
   int n;
   cin>>n;
   vi a(n);
   rep(i,n)cin>>a[i];
   vvi ans(h,vi(w));
   int index=1,x=0,y=0;
   rep(i,n){

       while(a[i]>0){
           ans[x][y]=i+1;
           a[i]--;
           if(y+index<w&&y+index>=0)y+=index;
           else {
               x++;
               index*=-1;
           }
       }
   }
   rep(i,h){
       rep(j,w)cout<<ans[i][j]<<" ";
       cout<<endl;
   }
}

Measured memory_bytes: 384
#include<stdio.h>
 
int main(void){
 
    int X,ans = 0,i;
 
    scanf("%d",&X);
 
    for(i = X/2;i <= X;i++){
        if((int)(i*1.08) == X){
            ans = i;
            break;
        }
    }
 
    if(ans == 0){
        printf(":(\n");
    }else{
        printf("%d\n",ans);
    }
 
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;

namespace ABC133_B
{
    class Program
    {
        static void Main(string[] args) {
            string[] input = Console.ReadLine().Split();
            long n = long.Parse(input[0]);
            long d = long.Parse(input[1]);
            long[,] points = new long[n, d];
            for (long i = 0; i < n; i++) {
                input = Console.ReadLine().Split();
                for(long j = 0; j < d; j++) {
                    points[i, j] = long.Parse(input[j]);
                }
            }

            long ans = 0;
            for (long row = 0; row < n - 1; row++) {
                for(long j = row + 1; j < n; j++) {
                    double sum = 0;
                    for (long column = 0; column < d; column++) {
                        sum += Math.Pow(points[row, column] - points[j, column], 2);
                        
                    }
                    
                    sum = Math.Sqrt(sum);
                    double marume = Math.Floor(sum);
                    if (sum == marume) {
                        ans++;
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

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

const int DMAX = 1e5+10;

inline int two(int n) { return 1 << n; }
inline int test(int n, int pos) { return (bool) (n & two(pos)); }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }

vector <int> V[DMAX];

bool uz[10];

int n;

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

    int t,i,j;

    cin>>i>>j;
    uz[i]=true;
    uz[j]=true;
    for(i=1;i<=3;i++)
        if(!uz[i])
            cout<<i<<'\n';
    return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>

int calGreatestCommonDiv(int, int);
int main(void){
	int x, y, ans;
	
	scanf("%d %d\n", &x, &y);
	ans = x >= y ? calGreatestCommonDiv(x, y) : calGreatestCommonDiv(y, x);
	printf("%d\n", ans);	
	
	return 0;
}

int calGreatestCommonDiv(int n, int m){
	if(n%m == 0){
		return m;
	}else{
		return calGreatestCommonDiv(m, n%m);
	}
}



Measured memory_bytes: 2072
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    string S;cin>>S;
    const int size = S.size();
    int prefix = 3;
    for(int i = 0; i < S.size(); i++)
    {   
        //cout<<prefix<<":"<<i<<endl;
        if(prefix==3){
           prefix = (int)S[i]-48;
        }
        else if(prefix + (int)S[i]-48 == 1){
        //cout<<"drop"<<i<<endl;
        S.erase(S.begin()+i);
        S.erase(S.begin()+i-1);
            if(i>=2){
                prefix = (int)S[i-2]-48;
                i -= 2;
            }
             else{
                 prefix = 3;
                 i = - 1;
            }
        }else{
            prefix = (int)S[i]-48;
        }
    }
    cout<<size - S.size()<<endl;
}

Measured memory_bytes: 512
class UnionFind:
    def __init__(self, n):
        self.par = list(range(n))
        self.rank = [0] * n
        self.size = [1] * n

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1
        elif self.rank[x] < self.rank[y]:
            x, y = y, x

        self.par[y] = x
        self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        return self.size[self.find(x)]


N, M, K = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]
Y = [list(map(int, input().split())) for _ in range(K)]

friend = [[] for _ in range(N + 1)]
for a, b in X:
    friend[a].append(b)
    friend[b].append(a)

blocked = [[] for _ in range(N + 1)]
for c, d in X:
    blocked[c].append(d)
    blocked[d].append(c)

tree = UnionFind(N + 1)
for a, b in X:
    tree.unite(a, b)

ans = [0] * (N + 1)
for i in range(1, N + 1):
    ans[i] = tree.get_size(i) - len(friend[i]) - 1

for c, d in Y:
    if tree.is_same(c, d):
        ans[c] -= 1
        ans[d] -= 1

print(*ans[1:])


Measured memory_bytes: 136592
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pll pair<ll,ll>
#define sll set<ll>
#define msll multiset<ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define vpl vector<pll>
#define gll greater<ll>
#define gpl greater<pll>
#define spl set<pll>
#define mspl multiset<pll>
#define lb lower_bound
#define bp __builtin_popcount
#define ub upper_bound
#define prq priority_queue
#define mp make_pair
#define pb push_back
#define mem(x,y) memset(x, y, sizeof x)
#define endl "\n"
#define sz(x) (ll)x.size()
#define sqr(x) x*x
#define rapido ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long int ll;
typedef long double ld;
ll mx=INT_MAX;
ll mn=INT_MIN;
ll MOD=1e9+7;
const ll maxs=1e5+10;
ll max2d=1e3+3;
ll INF = 1e18;
const ll lg=22; 

void code_idhr_h(){
    ll A,V,B,W; cin>>A>>V>>B>>W;
    ll T; cin>>T;
    if(A==B){
        cout<<"YES";
        return;
    }   
    if(A>B) swap(A , B);
    if((A+V*T)>=(B+W*T)) cout<<"YES";
    else cout<<"NO";
}

int main(){
    rapido;
    ll T=1; //cin>>T;
    while(T--){
        code_idhr_h();
    }
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int 	     	  long long   // [9,223,372,036,854,775,807 to -9.....808] 19 digits
#define pb                push_back 
#define all(x)            (x).begin(),(x).end()
#define mp                make_pair
#define vi                vector<int> 
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define x                 first
#define y                 second 
#define mem(a,x)          memset(a,x,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define sz(x)             (int)((x).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order()  // order_of_key

//const int32_t hellhsh = 444440583533; const double pi=2*acos(0.0); 
const int32_t mod = 1e9+7;
const int32_t maxn=2e5+5;

void solve(){
    int n;cin>>n;
    int a[n];rep(i,0,n) cin>>a[i];
    sort(a,a+n);
    int ans=a[n-1];int k=n-2;
    for(int i=n-2;i>=0 and k;i--){
        ans+=a[i];k--;
        if(k){
            ans+=a[i];
            k--;
        }
    }
    cout<<ans;
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1,k=1;                                                                                                                  
    //cin>>tc;
    while(tc--){
        //cout<<"Case #"<<k++<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 5220
N, H = map(int, input().split())
A = 0
B = []

for i in range(N):
    a, b = map(int, input().split())
    A = max(A, a)
    B.append(b)

B = sorted(B, reverse=True) + [0]

i = 0
while B[i] >= A:
    i += 1
B = B[:i]

ans = 0
for i in range(len(B)):
    H -= B[i]
    ans += 1
    if H <= 0:
        print(ans)
        exit()
print(ans + (H - 1) // A + 1)


Measured memory_bytes: 14524
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

import java.util.*;

public class Main{
  static char[] s, t;

  public static void main(String[] args){
    FastScanner sc = new FastScanner();

    s = sc.next().toCharArray();
    t = sc.next().toCharArray();

    Arrays.sort(s);
    Arrays.sort(t);
    char[] tp = new char[t.length];
    for(int i = 0; i < t.length; i++){
      tp[i] = t[t.length - i - 1];
    }

    String ss = new String(s);
    String tt = new String(tp);
    if(ss.compareTo(tt) < 0){
      System.out.println("Yes");
    }
    else{
      System.out.println("No");
    }
  }
}

class FastScanner {
  private static final InputStream in = System.in;
  private static final PrintWriter out = new PrintWriter(System.out);
  private final byte[] buffer = new byte[2048];
  private int p = 0;
  private int buflen = 0;

  public FastScanner(){
  }

  private boolean hasNextByte() {
    if(p < buflen){
      return true;
    }
    p = 0;
    try{
      buflen = in.read(buffer);
    }catch (IOException e) {
      e.printStackTrace();
    }
    if(buflen <= 0){
      return false;
    }
    return true;
  }

  public boolean hasNext() {
    while(hasNextByte() && !isPrint(buffer[p])){
      p++;
    }
    return hasNextByte();
  }

  private boolean isPrint(int ch) {
    if(ch >= '!' && ch <= '~'){
      return true;
    }
    return false;
  }

  private int nextByte() {
    if(!hasNextByte()){
      return -1;
    }
    return buffer[p++];
  }

  public String next() {
    if(!hasNext()){
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = -1;
    while(isPrint((b = nextByte()))){
      sb.appendCodePoint(b);
    }
    return sb.toString();
  }

  public int nextInt() {
    return Integer.parseInt(next());
  }

  public long nextLong() {
    return Long.parseLong(next());
  }

  public double nextDouble() {
    return Double.parseDouble(next());
  }
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std; 
long long  digits(long long a )
{
	long long length=0; 
	while(a!=0)
	{
		
		a/=10; 
		length++; 
	}
	return length; 
}



long long  f( long long int a , long long int b )
{
	return max(digits(a),digits(b)); 
}

long long min_self(long long a, long long b )
{
	return (a<b)?a:b ; 
}
int main(){
	
long long int n; cin>>n; 
int mini=13; 
for(long long  i=1;i*i<=n;i++)
{

	if(n%i==0) 
	{
		
		mini=min_self(mini,f(i,n/i)); 
		
	}
}

cout<<mini<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<map>
using namespace std;
#define N 200010
typedef long long LL;
LL a[N],s[N],t[N];
map<LL,LL> p;
int main()
{
    int n,i,j,k;
    LL ans;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    s[0]=0;
    for(i=1;i<=n;i++)
        s[i]=s[i-1]+a[i];
    ans=0;
    for(i=1;i<=n;i++)
    {
       p[s[i]]++;
       if(s[i]==0)
        ans=ans+p[s[i]];
       else
        ans=ans+p[s[i]]-1;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 15872
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math

def main():
    kouji_num, person_num = map(int, input().split())
    koji_data = [list(map(int, input().split())) for i in range(kouji_num)]
    person_data = [int(input()) for i in range(person_num)]

    event_list = [0 for i in range(kouji_num * 2)]
    now_kouji = set()

    for i in range(kouji_num):
        start, fin, position = koji_data[i]
        event_list[2 * i] = (start - position - 0.25, 1, position)
        event_list[2 * i + 1] = (fin - position - 0.75, 0, position)
    event_list.sort(key=lambda x: x[0])

    ans = 10 ** 9 + 1
    now_ind = 0
    for i in range(person_num):
        person_start = person_data[i]
        while now_ind < kouji_num * 2:
            time_data, flg, position = event_list[now_ind]
            if time_data > person_start:
                break

            if flg:
                now_kouji.add(position)
                ans = min(ans, position)
            else:
                now_kouji.remove(position)
                if len(now_kouji) == 0:
                    ans = 10 ** 9 + 1
                elif ans == position:
                    ans = min(now_kouji)

            now_ind += 1
        if ans == 10 ** 9 + 1:
            print(-1)
        else:
            print(ans)





if __name__ == '__main__':
    main()



Measured memory_bytes: 131184
#include<iostream>
int main(){
  int a,b,c;
  std::cin >> a >> b >> c;
  int cnt;
  if(a == 5){
    cnt++;
  }
  if(b == 5){
    cnt++;
  }
  if(c == 5){
    cnt++;
  }
  if(a + b + c == 17 && cnt == 2){
    std::cout << "YES" <<std::endl;
  }
  else{
    std::cout << "NO" <<std::endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  int i;
  for(i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  int sum_A=0,sum_B=0;
  for(i=0;i<n-1;i+=2){
    sum_A+=vec.at(i);
    sum_B+=vec.at(i+1);
  }
  if(n%2!=0){
    sum_A+=vec.at(n-1);
  }
  cout << sum_A-sum_B;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, K;
  cin >> N >> K;
  if (N <= K) {
    cout << 0 << endl;
    return 0;
  }
  vector<int>hp(N);
  for (int i = 0; i < N; i ++) cin >> hp[i];
  sort(hp.begin(), hp.end());
  long long ans = 0;
  for (int i = 0; i < N - K; i ++) ans += (long long)hp[i];
  cout << ans << endl;
}

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

#define ll long long
#define up(i,a,b) for(register int i=a;i<=b;i++)
#define Auto(i,x) for(register int i=h[x];i;i=e[i].nxt)
#define re register
using namespace std;
struct ios{
	template <typename ty> inline ios& operator >> (ty &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^48);
		x*=f;return *this;
	}
	template <typename ty> inline ios& operator << (ty x)
	{
		if(x<0) x=-x,putchar('-');
		if(x>9) *this << x/10;
		putchar(x%10+48);
		return *this;
	}
	inline ios& operator << (char x){putchar(x);return *this;}
}io;
const int N = 1005;
int n,m,a,b;
int s[N][N];

int main()
{
	io >> n >> m >> a >> b;
	if((n==1 && b!=0) || (m==1 && a!=0)){
		puts("-1");
		return 0;
	}
	if(m/2<a || n/2<b){
		puts("-1");
		return 0;
	}
	for(int i=1;i<=b;i++)
		for(int j=1;j<=a;j++) s[i][j] =1;
	for(int i=b+1;i<=n;i++)
		for(int j=a+1;j<=m;j++) s[i][j] = 1;
//	fill(1,1,a,b);
//	fill(a+1,b+1,5,5);
	up(i,1,n) 
	{
		up(j,1,m) io << s[i][j];
		puts("");
	}
	return 0;
}

Measured memory_bytes: 5120
package main

import (
	"fmt"
)

func main() {
	var n, k, v int
	fmt.Scan(&n)
	fmt.Scan(&k)

	var vs []int
	for i := 0; i < n; i++ {
		fmt.Scan(&v)
		vs = append(vs, v)
	}
	fvs := make([]int, len(vs))
	copy(fvs, vs)

	max := 0
	var hands []int

	for i := 0; i <= k; i++ {
		for j := 0; j <= k - i; j++ {
			vs = fvs
			hands = []int{}

			a, b := 0, 0
			for x := 0; x < i; x++ {
				if len(vs) == 0 {
					break
				}
				hands = append(hands, opeA(&vs))
				a++
			}

			for x := 0; x < j; x++ {
				if len(vs) == 0 {
					break
				}
				hands = append(hands, opeB(&vs))
				b++
			}

			for x := 0; x < k - a - b; x++ {
				opeC(&hands)
			}

			vSum := sum(hands)
			if max < vSum {
				max = vSum
			}
		}
	}

	fmt.Println(max)
}

func opeA(vs *[]int) int {
	v := (*vs)[0]
	*vs = (*vs)[1:]

	return v
}

func opeB(vs *[]int) int {
	v := (*vs)[len(*vs) - 1]
	*vs = (*vs)[:len(*vs) - 1]

	return v
}

func opeC(vs *[]int) {
	if len(*vs) == 0 {
		return
	}

	minIndex := 0
	min := (*vs)[0]

	for pos, v := range *vs {
		if v < min {
			min = v
			minIndex = pos
		}
	}

	if min < 0 {
		*vs = append((*vs)[:minIndex], (*vs)[minIndex+1:]...)
	}
}

func sum(vs []int) int {
	sum := 0
	for i := 0; i < len(vs); i++ {
		sum += vs[i]
	}
	return sum
}

Measured memory_bytes: 5248
#include<cstdio>
#include<map>
#include<queue>
#include<cstring>
using namespace std;

typedef pair<int,int> P;
int n,q,a,v,f[1000001];

int main(){
  scanf("%d%d",&n,&q);
  memset(f,0,sizeof(f));
  priority_queue<P> p;
  for(int i=0;i<q;i++){
    scanf("%d%d",&a,&v);
    f[a]+=v; p.push(P(f[a],-a));
    for(;;){
      P t=p.top(); a=-t.second; v=t.first;
      if(v==f[a]){ printf("%d %d\n",a,v); break; }
      p.pop();
    }
  }
}

Measured memory_bytes: 5848
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

#define INF 1000000007
#define LINF 1000000000000000001

using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;

Int gcd(Int x, Int y){
	if(y == 0)
		return x;
	return gcd(y, x % y);
}

Int lcm(Int x, Int y){
	return x * y / gcd(x, y);
}

Int n, x[100001], a, b;

int main(){
	cin >> n >> a >> b;
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	Int ans = 0;
	for(int i = 0; i < n-1; i++){
		ans += min((x[i+1] - x[i]) * a, b);
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024