akhauriyash/Code-Regression huggingface dataset:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

N,M = map(int,input().split())
divs = make_divisors(M)
for d in divs:
    m = M // d
    if m >= N:
        ans = d
        break
print(d)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int h,w;
string s[100];

int main(){
	cin >> h >> w;
	rep(i,h)cin >> s[i];
	ll cnt[27] = {};
	rep(i,h){
		rep(j,w){
			cnt[s[i][j]-'a']++;
		}
	}
	int num = 0;
	rep(i,26){
		num += cnt[i]/4;
		cnt[i]%=4;
	}
	if(num<(h/2)*(w/2)){
		cout << "No" << endl;
		return 0;
	}
	bool f = true;
	if(h%2 == 0 && w%2 == 0){
		rep(i,26)if(cnt[i])f = false;
	}
	else{
		int c = 0;
		rep(i,26){
			if(cnt[i]%2)c++;
		}
		if(h%2 == 1 && w%2 == 1){
			if(c != 1)f = false;
		}
		else{
			if(c != 0)f = false;
		}
	}
	if(f)cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

long long gcd(long long a, long long b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main(){
    int N, K;
    long long p, n, M;
    bool b = false;
    cin >> N >> K;

    cin >> p;
    M = p;
    for (int i = 1; i < N; ++i){
        cin >> n;
        p = gcd(p, n);
        M = max(M, n);
        if (n == K) b = true;
    }

    cout << ( b||(K % p == 0 && K <= M) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
long long n;
int main()
{
    scanf("%lld",&n);
    for(int i=sqrt(n);i>=1;--i)
        if(n%i==0)
        {
            long long s=1,l=n/i;
            while(l>=10)
            {
                ++s;
                l/=10;
            }
            printf("%lld",s);
            return 0;
        }
}

Measured memory_bytes: 128
dd = int(input())
c = list(list(map(int, input().split())))
s = [[0]*26]*dd
v = [[0]*26]*dd
vs = [[0]*26]*dd
ans = [0]*dd
ans2 = [0]*dd
fdate = [0]*26
for i in range(dd):
    s[i] = list(list(map(int, input().split())))



for i in range(dd):

    for j in range(26):
        v[i][j] = s[i][j] + c[j] *(i-fdate[j]) *(i-fdate[j])
        if not i+1 == dd:
            vs[i][j] =  v[i][j]- c[j] *(i-fdate[j]+1)
    maxv = -100000000
    for j in range(26):
        if maxv < v[i][j] and vs[i][j]<v[i][j]:
            maxv = v[i][j]
            ans[i]=j+1
    fdate[ans[i]-1] =i+1

for a in ans:
    print(a)

Measured memory_bytes: 68348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int h,w,n;
  cin>>h>>w>>n;
  bool p[h][w];
  rep(i,0,h){
    rep(j,0,w){
      p[i][j]=true;
    }
  }
  rep(i,0,n){
    int x,y,a;
    cin>>x>>y>>a;
    if(a==1){
      rep(i,0,x){
        rep(j,0,w){
          p[i][j]=false;
        }
      }
    }
    else if(a==2){
      rep(i,x,h){
        rep(j,0,w){
          p[i][j]=false;
        }
      }
    }
    else if(a==3){
      rep(i,0,h){
        rep(j,0,y){
          p[i][j]=false;
        }
      }
    }
    else{
      rep(i,0,h){
        rep(j,y,w){
          p[i][j]=false;
        }
      }
    }
  }
  int ans=0;
  rep(i,0,h){
    rep(j,0,w){
      if(p[i][j]){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define zzz ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){return (a*b)/gcd(a, b);}

int main()
{
    zzz;
    int n; cin>>n;
    vector<int> a;
    int b;
    for(int i=0;i<n;++i)
    {
        cin>>b; a.push_back(b);
    }
    vector<int> x(a); sort(x.rbegin(),x.rend()); int ma = x[0],ma2=x[1];
    for(auto l : a)
    {
        if(l==ma) cout<<ma2<<'\n';
        else cout<<ma<<'\n';
    }
}


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

using namespace std;

int main(){

	int n,m;
	while(cin >> n >> m && !(n == 0 && m == 0)){
		int field[1000];
		for(int i = 0; i < n; i++){
			cin >> field[i];
		}
		int cp = 0;
		vector<int> mList;
		for(int i = 0; i < m; i++){
			int num;
			cin >> num;
			mList.push_back(num);
		}

		for(int i = 0; i < m; i++){
			int num = mList[i];
			// ツ出ツつスツ姪堋づ個づ板づアツつセツつッツ督ョツつゥツつキ
			cp += num;
			cp += field[cp];
			if(cp >= n - 1){
				cout << i + 1 << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[105];
int main()
{
	int n, mx;
	cin >> n >> mx;
	for(int i = 0; i < n; i++) cin >> a[i];
	int cnt = 1;
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		ans += a[i];
		if(ans > mx) break;
		else cnt++;
	}
	cout << cnt << endl; 
}

Measured memory_bytes: 256
def partition(A,p,r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = A[r], A[i+1]
    
    return i

def main():
    n = int(input())
    A = [int(x) for x in input().split()]

    q = partition(A, 0, n-1)

    left = A[:q+1]
    p = A[q+1]
    right = A[q+2:]
    print('{0} [{1}] {2}'.format(' '.join(map(str, left)), p, ' '.join(map(str, right))))
             
if __name__ == "__main__":
    main()


Measured memory_bytes: 16368
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 200001;

template<int SZ> struct DSU {
    int par[SZ], sz[SZ];
    DSU() {
        F0R(i,SZ) par[i] = i, sz[i] = 1;
    }
    
    int get(int x) { // path compression
    	if (par[x] != x) par[x] = get(par[x]);
    	return par[x];
    }
    
    bool unite(int x, int y) { // union-by-rank
    	x = get(x), y = get(y);
    	if (x == y) return 0;
    	if (sz[x] < sz[y]) swap(x,y);
    	sz[x] += sz[y], par[y] = x;
    	return 1;
    }
};

template<int SZ> struct Combo {
    ll fac[SZ+1], ifac[SZ+1];
    
    Combo() {
        fac[0] = ifac[0] = 1;
    	FOR(i,1,SZ+1) {
    	    fac[i] = i*fac[i-1] % MOD;
    	    ifac[i] = inv(fac[i]);
    	}
    }
    
    ll po (ll b, ll p) { return !p?1:po(b*b%MOD,p/2)*(p&1?b:1)%MOD; }
    ll inv (ll b) { return po(b,MOD-2); }
    
    ll comb(ll a, ll b) {
        if (a < b || b < 0 || a < 0) return 0;
        ll tmp = fac[a]*ifac[b] % MOD;
        tmp = tmp*ifac[a-b] % MOD;
        return tmp;
    }
};

Combo<MX> Com;
DSU<MX> D;
vpi num[MX];
vi co[MX];
ll ans = 1;
int N,C[MX],W[MX],X,Y;

ll mul(ll a, ll b) {
    return a*b%MOD;
}

void uniteSame() {
    FOR(i,1,N+1) {
        sort(all(num[i]));
        for (auto a: num[i]) if (a.f+num[i].front().f <= X) D.unite(a.s,num[i].front().s);
    }
}

void uniteDif() {
    vpi v;
    FOR(i,1,N+1) if (sz(num[i])) v.pb(num[i].front());
    sort(all(v));
    F0R(i,min(2,sz(v))) FOR(j,1,N+1) if (C[j] != C[v[i].s] && W[j]+W[v[i].s] <= Y) D.unite(j,v[i].s);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> X >> Y;
    FOR(i,1,N+1) {
        cin >> C[i] >> W[i];
        num[C[i]].pb({W[i],i});
    }
    uniteSame();
    uniteDif();
    FOR(i,1,N+1) co[D.get(i)].pb(C[i]);
    FOR(i,1,N+1) {
        int sum = sz(co[i]);
        ans = mul(ans,Com.fac[sum]);
        map<int,int> m;
        for (int j: co[i]) m[j] ++;
        for (auto j: m) ans = mul(ans,Com.ifac[j.s]);
    }
    cout << ans;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 27828
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	ll A,B;
	cin >> A >> B;

	ll ans=1;
	ll N=min(A,B);
	ll M=max(A,B);
	ll Max=sqrt(N);
	for(ll i=2; i<=Max; i++){
		if(N%i==0){
			while(N%i==0){
				N=N/i;
			}
			if(M%i==0){
				ans++;
			}
		}
	}
	if(N>Max && M%N==0){
		ans++;
	}

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  string s[n];
  for(int i = 0; n > i; i++){
    cin>>s[i];
  }
  string t;cin>>t;
  int mae = 0;
  int usi = 0;
  for(int i = 0; n > i; i++){
    bool non = true;
    for(int j = 0; min(s[i].size(),t.size()) > j; j++){
      if(s[i][j] == '?'){
        if(t[j] == 'z' || t[j] == 'a')continue;
        non = false;
        break;
      }
      if(s[i][j] < t[j]){
        mae++;
        non = false;
        break;
      }else if(s[i][j] > t[j]){
        usi++;
        non = false;
        break;
      }
    }
    if(non){
      if(s[i].size() < t.size()){
        mae++;
      }else if(s[i].size() > t.size()){
        usi++;
      }
    }
    //cout << s[i] << " " << t << endl;
    //cout << mae << " " << usi << endl;
  }
  for(int i = mae+1; n-usi+1 >= i; i++){
    cout << i;
    if(i!=n-usi+1)cout << " ";
  }
  cout << endl;
}

Measured memory_bytes: 896
n, z = [int(x) for x in input().split()]
z //= 1000
if n > z:
    print('-1 -1 -1')
    raise SystemExit
if n == z:
    print(0, 0, z)
    raise SystemExit

over = z - n
y = x = 0
while over >= 4 and z >= 5:
    y += 1
    z -= 5
    over -= 4
while over > 0 and y >= 2:
    x += 1
    y -= 2
    over -= 1
if over == 0:
    print(x, y, z)
else:
    print('-1 -1 -1')


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define mm(arr) memset(arr, 0, sizeof(arr))
#define scanArray(a,n) for(int i = 0; i < n; i++){cin >> a[i];}
#define pb push_back
#define PI 3.141592653589793
#define MOD 1000000007

using namespace std;
int main(){
    FAST
    int a,b; cin >> a >> b;
    cout << max(max(a*b,a-b),a+b)<<endl;





    return 0;
}





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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    ll a, b, k; cin >> a >> b >> k;

    if(a < k) cout << 0 << ' ';
    else{
        cout << a - k << ' ' << b << endl;
        return 0;
    }

    k -= a;
    if(b < k) cout << 0 << endl;
    else cout << b - k << endl;

    return 0;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

LL solve(string s){
  if(s[1]=='['){
    int count=0;
    int pre=1;
    list<LL> ans;
    for(int i=1;i<s.length()-1;i++){
      if(s[i]=='[') count++;
      else if(s[i]==']') count--;
      if(count==0){
        ans.push_back(solve(s.substr(pre,i-pre+1)));
        pre=i+1;
      }
    }
    vector<LL> an(ans.size());
    auto itr=ans.begin();
    for(int i=0;i<ans.size();i++,itr++){
      an[i]=(*itr);
    }
    sort(an.begin(),an.end());
    LL re=0;
    for(int i=0;i<(ans.size()+1)/2;i++){
      re+=an[i];
    }
    return re;
  }else{
    return (stoi(s.substr(1,s.length()-2))+1)/2;
  }
}

int main(){
  int n;
  cin >> n;
  string s;
  for(int i=0;i<n;i++){
    cin >> s;
    cout << solve(s) << endl;
  }
  return 0;
}



Measured memory_bytes: 3312
import numpy as np
H, W = map(int, input().split())
a_list = []
for i in range(H):
    a_list.append(list(map(str, input().split())))
dot = '....................................................................................................'

a_list2 = []
for i in range(H):
    if a_list[i] != [dot[0:W]]:
        a_list2.append([c for c in a_list[i][0]])

a_list3 = []
for i in range(len(a_list2[0])):
    if ''.join(list(np.array(a_list2)[:,i])) != dot[0:len(a_list2)]:
        a_list3.append(list(np.array(a_list2)[:,i]))

for i in range(len(a_list3[0])):
    print(''.join(list(np.array(a_list3).T[i,:])))

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

long long n,x[100005],x1[100005],c,v[100005],v1[100005],dpr[100005],dpr1[100005],fr[100005],fr1[100005],gr[100005],gr1[100005],rez;

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

    cin>>n>>c;
    for(long long i=1;i<=n;i++)
    {
        cin>>x[i]>>v[i];
        dpr[i]=dpr[i-1]+v[i];
        fr[i]=dpr[i]-x[i];
    }
    for(int i=1;i<=n;i++)
        gr[i]=max(gr[i-1],fr[i]);

    for(int i=0;i<=n;i++)
    {
        if(i==0)
            rez=max(rez,gr[n]);
        else
            rez=max(rez,(dpr[n]-dpr[n-i])-(c-x[n-i+1])+gr[n-i]-(c-x[n-i+1]));
    }//////////////////////////
    for(long long i=1;i<=n;i++)
    {
        x1[i]=c-x[n-i+1];
        v1[i]=v[n-i+1];
        dpr1[i]=dpr1[i-1]+v1[i];
        fr1[i]=dpr1[i]-x1[i];
    }
    for(int i=1;i<=n;i++)
        gr1[i]=max(gr1[i-1],fr1[i]);

    for(int i=0;i<=n;i++)
    {
        if(i==0)
            rez=max(rez,gr1[n]);
        else
            rez=max(rez,(dpr1[n]-dpr1[n-i])-(c-x1[n-i+1])+gr1[n-i]-(c-x1[n-i+1]));
    }

    cout<<rez<<endl;

    return 0;
}


Measured memory_bytes: 11468
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 233333,mo=1e9+7,inv2=(mo+1)/2;
int power(int a, int n){
	int res=1;
	while(n){
		if(n&1)res=1LL*res*a%mo;a=1LL*a*a%mo;n>>=1;
	}
	return res;
}
void add(int &x,int y){x=(x+y)%mo;}
void sub(int &x,int y){x=(x-y+mo)%mo;}
int n,a[N],v[N],pre[N],qz[N],ans,b[N],val[N],cnt[N],res;
void modify(int *v,int p, int x){while(p<=n)add(v[p],x),p+=p&-p;}
int qry(int *v,int p){int r=0;while(p>0)add(r,v[p]),p-=p&-p;return r;}
int main() {
	read(n);rep(i,1,n)read(a[i]),v[a[i]]++;
	per(i,n,1)v[i]+=v[i+1];
	rep(i,1,n)v[i]-=n-i;
	rep(i,1,n)if(v[i]<=0){puts("0");return 0;}
	ans=1;rep(i,1,n)ans=1LL*ans*v[i]%mo;
	for(int i=1,j=0;i<=n;i++,j=v[i]==1?i:j)pre[i]=j;
	rep(i,1,n)b[i]=1LL*(v[i]-1)*power(v[i],mo-2)%mo;
	rep(i,1,n){
		if(b[i])qz[i]=1LL*b[i]*qz[i-1]%mo;else qz[i]=1;
	}
	
//	rep(i,1,n)printf("%d ",b[i]);puts("");
	
	rep(i,1,n){
		add(res,1LL*ans*qz[a[i]]%mo*(qry(val,a[i])-qry(val,pre[a[i]]-1)+mo)%mo*inv2%mo);
		modify(val,a[i],power(qz[a[i]],mo-2));
	}
	memset(val,0,sizeof(val));
	per(i,n,1){
		add(res,1LL*ans*(qry(cnt,a[i]-1))%mo);
		if(pre[a[i]]<=a[i]-1){
			sub(res,1LL*ans*qz[a[i]]%mo*(qry(val,a[i]-1)-qry(val,pre[a[i]]-1)+mo)%mo*inv2%mo);
		}
		modify(val,a[i],power(qz[a[i]],mo-2));
		modify(cnt,a[i],1);
	}
	cout<<(res%mo+mo)%mo;
	return 0;
}


Measured memory_bytes: 6400
H, W = gets.chomp.split(' ').map(&:to_i)
grid = readlines.map { |line| line.chomp.split('').push('.') }.push(Array.new(W + 1, ('.')))
(0..H-1).each do |h|
  (0..W-1).each do |w|
    next if grid[h][w] == '.' || grid[h-1][w] == '#' || grid[h][w-1] == '#' || grid[h+1][w] == '#' || grid[h][w+1] == '#'
    puts :No
    exit
  end
end
puts :Yes


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

template <typename T>
T expt(T a, std::int64_t n){
    T power {1};
    while(n > 0){
        if(n & 1){power *= a;}
        a *= a;
        n >>= 1;
    }
    return power;
}

int D, N;

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

    std::cin >> D >> N;

    int n;

    if(N < 100){
        n = N * expt(100, D);
    }else{
        n = 101 * expt(100, D);
    }

    std::cout << n << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
int main()
{
    ull n,a,b;
    cin>>n>>a>>b;
    if(a == 0) {
        cout<<0<<endl;
    }
    else {
        ull val = n/(a+b);
        cout<<(val*a + min(n%(a+b), a))<<endl;
    }
    return 0;
}

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

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

const int INF = 100000000;
const double PI=3.14159265358979323846;

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

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

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

    ll nc,nd,ncd;
    
    nc = b/c-(a-1)/c;
    nd = b/d-(a-1)/d;
    ll tmp = lcm(c,d);
    ncd = b/tmp - (a-1)/tmp;

    ll ans = b-a+1-(nc+nd-ncd);

    cout << ans << endl;

}

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

#define mi           map<int,int>
#define pii          pair<int,int>
#define mpi          map<pii,int>
#define vi           vector<int>
#define vpi          vector<pii>
#define pb           push_back
#define mp           make_pair
#define x            first
#define y            second
#define all(a)       (a).begin(),(a).end()
#define fo(i,k,n)    for(int i=k;i<n;i++)
#define fod(i,k,n)   for(int i=k;i>=n;i--)
#define sz(x)        (int)x.size()

#define PI 3.141592653

typedef long long ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll> > vpl;
typedef pair<ll,ll> pll;

int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll res=0;
    int n;
    cin>>n;
    int a[n+1],b[n];
    fo(i,0,n+1) cin>>a[i];
    fo(i,0,n) cin>>b[i];
    fo(i,0,n){
        int x=a[i]+a[i+1];
        if(x<=b[i]) {

            res=res+x;
            a[i]=0;
            a[i+1]=0;
        }
        else{
            if(a[i]>=b[i]){
                res=res+b[i];
                a[i]=0;
            }
            else{
                res=res+b[i];
                int y=x-b[i];
                a[i]=0;
                a[i+1]=y;
            }
        }
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 1024
import sys
from heapq import *
input = sys.stdin.readline
n,Q = list(map(int, input().split()))
Y=[]
for j in range(n):
    a=list(map(int, input().split()))
    Y.append([a[0]-a[2],a[1]-a[2],a[2]])
q = [int(input()) for i in range(Q)]
Y.sort()
X=[]
p=0
for d in q:
    while p<n and Y[p][0]<=d:
        heappush(X,(Y[p][2],Y[p][1]))
        p+=1
    while X and X[0][1] <= d:
        heappop(X)
    if X:
        print(X[0][0])
    else:
        print(-1)



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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; }
const ll MOD = 1e9+7;

ll S[410][410];
ll DP[410][410];

int A[410];
int B[410];

ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

ll sum(int t, int i){
    int a = A[i];
    int b = B[i];
    ll ret = S[t][b];
    if(a > 0) ret -= S[t][a-1];
    ret += MOD;
    return ret % MOD;
}

int main(){
    int N, C;
    cin >> N >> C;
    REP(i,N){
        int a;
        cin >> a;
        A[i] = a;
    }
    REP(i,N){
        int b;
        cin >> b;
        B[i] = b;
    }

    for(int t = 0; t <= C; t++){
        for(int i = 0; i <= 400; i++){
            S[t][i] = mod_pow(i, t, MOD);
            if(i != 0) {
                S[t][i] += S[t][i-1];
                S[t][i] %= MOD;
            }
        }
    }

    //for(int i = 0; i <= C; i++) DP[0][i] = sum(i, 0);

    DP[0][0] = 1;
    for(int i = 0; i < N; i++){
        for(int j = 0; j <= C; j++){
            ll tmp = 0;
            for(int k = 0; k <= j; k++){
                tmp += DP[i][k] * sum(j-k, i);
                tmp %= MOD;
            }
            DP[i+1][j] = tmp;
        }
    }

    //REP(i,N+1){
    //    REP(j,C+1){
    //        printf("%lld ", DP[i][j]);
    //    }
    //    printf("\n");
    //}

    ll ans = 0;
    ans = DP[N][C];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2816
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		long R = 0;
		long G = 0;
		long B = 0;
		int i,j;
		long ans;
		for(i = 0;i < N;i++){
			if(S.charAt(i) == 'R'){
				R++;
			}else if(S.charAt(i) == 'G'){
				G++;
			}else if(S.charAt(i) == 'B'){
				B++;
			}
		}
		ans = R * B * G;
		for(i = 0;(1 + i) + (1 + i) < N;i++){
			for(j = 0;j + 1 + i + 1 + i < N;j++){
				if(S.charAt(j) != S.charAt(j + 1 + i) && S.charAt(j + 1 + i) != S.charAt(j + 1 + i + 1 + i) && S.charAt(j) != S.charAt(j + 1 + i + 1 + i)){
					ans--;
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 37784
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  int ans = 0;
  for (int d = 1; d <= 9; d++) {
    long long x = d;
    if (x > n) {
      break;
    }
    int sum = d;
    while (x * 10 + 9 <= n) {
      x = x * 10 + 9;
      sum += 9;
    }
    ans = max(ans, sum);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll; 
ll pow(int a,int b){
    ll ans=1;
    for(int j=0;j<b;j++){
        ans*=a;
    }
    return ans;
}
 
int main(){
    int n,p;
    cin>>n>>p;
    int a[n];
    for(int j=0;j<n;j++){
        cin>>a[j];
        if(a[j]%2==1){
            cout<<pow(2,n-1);
            return 0;
        }
    }
    if(p==0)cout<<pow(2,n);
    if(p==1)cout<<0;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <queue>

using namespace std;

int d[101];
int f[101];
bool isUsed[101];
int count = 0;

void dfs(vector< vector<int> >& G, int vertex);
void calclation();

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

void dfs(vector< vector<int> >& G, int vertex)
{
	d[vertex] = ++count;
	for (int i = 0; i < G[vertex].size(); ++i)
	{
		if (G[vertex][i] == 1 && isUsed[i] == false)
		{
			isUsed[i] = true;
			dfs(G, i);
		}
	}
	f[vertex] = ++count;
}

void calclation()
{
		int n;
	cin >> n;

	vector< vector<int> > G(n, vector<int>(n));
	for (int i = 0; i < n; ++i)
	{
		int h, k;
		cin >> h >> k;
		--h;
		for (int j = 0; j < k; ++j)
		{
			int v;
			cin >> v;
			--v;
			G[h][v] = 1;
		}
	}
	for (int i = 0; i < 101; ++i)
	{
		isUsed[i] = false;
	}
	for (int i = 0; i < n; ++i)
	{
		if (isUsed[i] == false)
		{
			isUsed[i] = true;
			dfs(G, i);
		}
	}
	for (int i = 0; i < n; ++i)
	{
		cout << i + 1 << " " << d[i] << " " << f[i] << endl;
	}
}



Measured memory_bytes: 3208
n = int(input())
cnt = 0
for i in range(1, n+1):
    if i%15==0 :
        continue 
    elif i%5==0 and i%3!=0:
        continue 
    elif i%3==0 and i%5!=0:
        continue 
    else :
        cnt += i
print(cnt)

Measured memory_bytes: 9112
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
string s,t;
bool a=false;

int main(){
	cin>>s>>t;
	for(int i=0;i<s.size();i++){
		if(s==t){
			a=true;
			break;
		}else{
			s=s[s.size()-1]+s;
			s.pop_back();
		}
	}
	if(a){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double x[110000];
double r[110000];
pair<double,int>ev[110000];
double eps=1e-9;
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++)scanf("%lf%lf",x+i,r+i);
		double left=0;
		double right=1100000;
		for(int i=0;i<100;i++){
			double M=(left+right)/2;
			int sz=0;
			for(int j=0;j<a;j++){
				if(M+eps<r[j]){
					double t=sqrt(r[j]*r[j]-M*M);
					ev[sz++]=make_pair(x[j]-t,-1);
					ev[sz++]=make_pair(x[j]+t,1);
				}
			}
			std::sort(ev,ev+sz);
			int now=0;
			double last=0;
			bool ok=false;
			for(int j=0;j<sz;j++){
				if(!now)last=ev[j].first;
				now+=ev[j].second;
				if(!now){
					if(ev[j].first-last>2*M)ok=true;
				}
			}
			if(ok)left=M;
			else right=M;
		}
		printf("%.12f\n",left*2);
	}
}

Measured memory_bytes: 3600
I=lambda:[int(i) for i in input().split()]

ans=0
inf=1<<65
n,m=I()
X=set([0,inf,-inf])
Y=set([0,inf,-inf])
R=[]
H=[]
for i in range(n):
    a,b,c=I()
    R.append(((a,b),c))
    Y.add(c)
    X.add(a)
    X.add(b)
 
n+=2
R.append(((-inf,inf),inf))
R.append(((-inf,inf),-inf))
 
for i in range(m):
    a,b,c=I()
    H.append((a,(b,c)))
    X.add(a)
    Y.add(b)
    Y.add(c)
 
m+=2
H.append((inf,(-inf,inf)))
H.append((-inf,(-inf,inf)))

xdc={}
c=1
for j in sorted(X):
    xdc[c]=j
    c+=1
nx=c-1
 
ydc={}
c=1
for j in sorted(Y):
    ydc[c]=j
    c+=1
ny=c-1
 
xdcr=dict(zip(xdc.values(),xdc.keys()))
ydcr=dict(zip(ydc.values(),ydc.keys()))
 
V=[[0]*(nx+1+1) for i in range(ny+1+1)]
U=[i[:]for i in V]

for (a,b),c in R:
    U[ydcr[c]][xdcr[a]]+=1
    U[ydcr[c]][xdcr[b]]+=-1
for i in range(ny+1):
    for j in range(nx):
        U[i][j+1]+=U[i][j]
        
for d,(e,f) in H:
    V[ydcr[e]][xdcr[d]]+=1
    V[ydcr[f]][xdcr[d]]+=-1
for j in range(nx+1):
    for i in range(ny):
        V[i+1][j]+=V[i][j]

R=[[0]*(nx+1) for i in range(ny+1)]
q=[(xdcr[0],ydcr[0])]
R[ydcr[0]][xdcr[0]]=1

while q:
    cx,cy=q.pop()
    ans+=(xdc[cx]-xdc[cx+1])*(ydc[cy]-ydc[cy+1])
    for dx,dy in [(-1,0),(1,0),(0,1),(0,-1)]:
        nbx=cx+dx
        nby=cy+dy
        if (0>nbx>=nx)or(0>nby>=ny)or R[nby][nbx]==1:
            continue
        if dy!=0:
            if U[-~dy//2+cy][cx]==0:
                q.append((nbx,nby))
                R[nby][nbx]=1
        else:
            if V[cy][-~dx//2+cx]==0:
                q.append((nbx,nby))
                R[nby][nbx]=1
if ans>=inf:
    ans='INF'
print(ans)


Measured memory_bytes: 541960
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,y;cin>>x>>y;
	int b=0,bok=0,f=0;
	if(y%2==0){
	while(bok<y){
		bok=b*2;
		if(((y-bok)%4==0)&&(((y-bok)/4)==x-b))
		{f=1; break;}b++;
		}
		}
	if(f)cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 3644
import std.stdio;
import std.string;

void main()
{
	auto n = readln;
	auto s = readln.strip;
	
	writeln( solve( s ) );
}

int solve( in string s )
{
	auto lc = new int[ s.length ];
	lc[ 0 ] = 0;
	foreach( i; 1 .. s.length )
	{
		lc[ i ] = lc[ i - 1 ] + ( s[ i - 1 ] == 'E' ? 0 : 1 );
	}
	
	auto rc = new int[ s.length ];
	rc[ $-1 ] = 0;
	foreach_reverse( i; 0 .. s.length-1 )
	{
		rc[ i ] = rc[ i + 1 ] + ( s[ i + 1 ] == 'W' ? 0 : 1 );
	}
	
	auto result = lc[ 0 ] + rc[ 0 ];
	foreach( i; 1 .. s.length )
	{
		auto lrc = lc[ i ] + rc[ i ];
		if( lrc < result ) result = lrc;
	}
	
	return result;
}

unittest
{
	assert( solve( "WEEWW" ) == 1 );
	assert( solve( "WEWEWEEEWWWE" ) == 4 );
	assert( solve( "WWWWWEEE" ) == 3 );
}


Measured memory_bytes: 3924
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>

using namespace std;

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

int main(){
    int turn=0;
    int b[10][10];
    char c;
    memset(b, -1, sizeof(b));
    for(int i=0;i<8;i++){
        for(int j=0;j<8;j++){
            cin >> c;
            if(c == 'o'){
                b[i+1][j+1] = 0;
            }else if(c == 'x'){
                b[i+1][j+1] = 1;
            }
        }
    }

    int cx,cy;
    int px,py;
    int prevnum=1,num,_num,tmp;
    vector<int> dir,tmpdir;
    while(1){
        dir.clear();
        num = 0;
        for(int i=1;i<=8;i++){
            for(int j=1;j<=8;j++){
                _num = 0;
                if(!turn){
                    cx = j;
                    cy = i;
                }else{
                    cx = 9-j;
                    cy = 9-i;
                }
                if(b[cy][cx] == -1){
                    //foreach direction
                    for(int k=0;k<8;k++){
                        tmp=1;
                        if(b[cy+dy[k]][cx+dx[k]] == turn ||
                           b[cy+dy[k]][cx+dx[k]] == -1){
                            //隣が空もしくは同色ならcontinue
                            continue;
                        }
                        while(b[cy+dy[k]*tmp][cx+dx[k]*tmp] == 1-turn){
                            tmp++;
                        }
                        if(b[cy+dy[k]*tmp][cx+dx[k]*tmp] == turn){
                            _num += tmp-1;
                            tmpdir.push_back(k);
                        }
                    }
                }
                if(num < _num){
                    num = _num;
                    px = cx;
                    py = cy;
                    dir = tmpdir;
                }
                tmpdir.clear();
            }
        }

        //置く
        if(dir.size()) b[py][px] = turn;
        for(int i=0;i<dir.size();i++){
            tmp = 1;
            while(b[py+dy[dir[i]]*tmp][px+dx[dir[i]]*tmp] != turn){
                b[py+dy[dir[i]]*tmp][px+dx[dir[i]]*tmp] = turn;
                tmp++;
            }
        }
        if(!prevnum && !num) break;        
        prevnum = num;
        turn = 1 - turn;
    }
    for(int i=1;i<=8;i++){
        for(int j=1;j<=8;j++){
            if(b[i][j] == 0){
                cout << 'o';
            }else if(b[i][j] == 1){
                cout << 'x';
            }else{
                cout << '.';
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 0
use std::io::{self, BufRead};

const M: i64 = 1000000007;

fn sum_range(a: i64, b: i64) -> i64 {
  (a + b) * (b - a + 1) / 2
}

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let line = lines.next().unwrap().unwrap();
  let vs: Vec<i64> = line.split(' ').map(|x| x.parse().unwrap()).collect();
  let n = vs[0];
  let k = vs[1];
  let mut total = 0;
  for i in k..=(n+1) {
    let min = sum_range(0, i - 1);
    let max = sum_range(n + 1 - i, n);
    total = (total + max - min + 1) % M;
  }
  println!("{}", total);
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define trace(x)  cerr << #x << ": " << x << endl;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;

int main()
{
	string s;cin>>s;ll ans=0;
	for(auto u:s)
	{
		ans+=(u-'0');
	}
	if(ans%9)cout<<"No\n";
	else cout<<"Yes\n";

}

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

int main() {
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int dp[n];
    dp[0] = 0;
    for (int i = 1; i < n; i++) {
        dp[i] = 1e9;
        int ind = i-1;
        int cnt = 1;
        while (ind >= 0 && cnt <= k) {
            dp[i] = min(dp[i], dp[ind] + abs(a[i]-a[ind]));

            ind--;
            cnt++;
        }
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>


int main(void) {
    int X,A,B;
    scanf("%d %d %d", &X, &A, &B);
    if(A >= B) {
        printf("delicious\n");
    } else {
        if(A+X >= B) {
            printf("safe\n");
        } else {
            printf("dangerous\n");
        }
    }
    return 0;
}


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

int main(){
  int N ;
  cin >> N ;
  N %= 100; N %= 10;
  if(N==2||N==4||N==5||N==7||N==9) cout << "hon" <<endl;
  else if(N==0||N==1||N==6||N==8) cout << "pon" << endl;
  else cout << "bon" << endl;
  
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int minval(string s) {
	vi v;
	int ans=0;
	for (char x : s) {
		v.push_back(x - '0');
	}
	sort(v.begin(), v.end());
	rep(i, v.size()) {
		ans = ans * 10 + v[i];
	}
	return ans;
}

int maxval(string s) {
	vi v;
	int ans = 0;
	for (char x : s) {
		v.push_back(x - '0');
	}
	sort(v.begin(),v.end(),greater<int>());
	rep(i, v.size()) {
		ans = ans * 10 + v[i];
	}
	return ans;
}

void solve(int n,int l) {
	int ans = 0;
	string s=to_string(n);
	range(i, s.size(), l) {
		s.push_back('0');
	}
	//cout << s << endl;
	vector<string> v;
	v.push_back(s);
	while (1) {
		ans++;
		int val = maxval(s) - minval(s);
		s = to_string(val);
		//cout << s << endl;
		for (int i = 0; i < v.size(); i++) {
			if (s == v[i]) {
				int a = stoi(s);
				cout << i <<" "<<a<<" " <<ans-i<< endl;
				return;
			}
		}
		v.push_back(s);
		range(i, s.size(), l) {
			s.push_back('0');
		}

		if (ans == 50) {
			cout << "err" << endl;
		}
	}
}

int main() {
	int n, m;
	while (cin >> n >> m, m) {
		solve(n, m);
	}
}


Measured memory_bytes: 3292
import bisect as b
n = int(input())

d = [0]*n
for el in map(int, input().split()):
    d[el-1] += 1

d.sort()

s = [0]*(n+1)
for i in range(n):
    s[i+1] = s[i] + d[i]

for k in range(1, n+1):
    l = 0
    r = n//k + 1
    while(l+1 < r):
        c = (l+r)//2
        i = b.bisect_left(d, c)
        total = s[i] + c * (n - i)
        if total >= k * c:
            l = c
        else:
            r = c
    print(l)

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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 x;
    cin >> x;
    for (i64 a = -1000; a <= 1000; a++) {
        for (i64 b = -1000; b <= 1000; b++) {
            if ((i64) (pow(a, 5) - pow(b, 5)) == x) {
                cout << a << " " << b << endl;
                return;
            }
        }
    }
}

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


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

int main() {
    int n;cin>>n;
    int tmp,a[3];
    for(int i=0;i<3;++i){
    a[i]=0;
    }
    
    for(int i=0;i<n;++i){
        cin>>tmp;
        if(tmp%4==0)a[0]++;
        else if(tmp%2==0)a[1]++;
        else a[2]++;
    }
    if(a[2] - 1>a[0]||(a[2] - 1==a[0]&&a[1]>0))cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
pair<string,int> a[100];
int main(){
	int t=0,g;
	string f;
	while(cin>>a[t].first>>a[t].second)t++;
	sort(a,a+t);
	cout<<a[0].first<<endl<<a[0].second;
	for(int i=1;i<t;i++){
		bool n=false;
		f=a[i].first,g=a[i].second;
		if(i)if(f==a[i-1].first)n=true;
		if(n)cout<<" "<<g;
		else cout<<endl<<f<<endl<<g;
	}
	cout<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const int N_MAX = 200002;

ll n;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    if(n & 1)
        cout << "0\n";
    else
    {
        n /= 2;
        ll ans = 0;
        for(ll i = 5; i <= n; i *= 5)
            ans += n / i;
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); ++i)
#define rep2(i, n) for(ll i = 1; i <= ll(n); ++i)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); ++i)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); ++i)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  string s;
  cin >> s;
  vl a(3);
  rep(i, s.size()) a[s[i]-'a']++;
  ll max=0, min=INF;
  rep(i, 3) {chmax(max, a[i]); chmin(min, a[i]);}
  if(max-min<=1) cout << "YES" << newl;
  else cout << "NO" << newl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int a[200000];
  int b[200000];
  int key = 0;
  int flag;
  
  cin >> n;

  flag = n % 2;
  for(int i = 0;i < n;i++){
    cin >> a[i];
  }
  
  for(int j = n - 1;j >= 0;j -= 2){
    b[key] = a[j];
    key ++;
  }
  
  for(int j = flag;j < n;j += 2){
    b[key] = a[j];
    key ++;
  }

  for(int i = 0;i < n;i++){
    cout << b[i] << ' ';
  }

  cout << endl;
  return 0;
}


Measured memory_bytes: 3712
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
 
#define N  2000005

pii ma[N];

ll int num(pii p)
{
	if(p.F>p.S) swap(p.F,p.S);
	ma[p.F*1005+p.S]=p;
	return p.F*1005+p.S;
}

ll int vis[N];

vi a[N];

ll int dp[N];

void print(ll int num)
{
	// cout<<ma[num].F<<" "<<ma[num].S<<endl;
}

ll int active[N];

void dfs_c(ll int node)
{
	vis[node]=1;
	active[node]=1;
	for(auto i:a[node])
	{
		if(!vis[i])
		{
			dfs_c(i);
		}
		else
		{
			if(active[i])
			{
				cout<<-1;
				exit(0);
			}
		}
	} 
	active[node]=0;
}

void dfs(ll int node)
{
	print(node);
	vis[node]=1;
	ll int maxi=1;
	for(auto i:a[node])
	{
		if(!vis[i])
		{
			dfs(i);
			maxi=max(maxi,1+dp[i]);
		}
		else
		{
			maxi=max(maxi,1+dp[i]);
		}
	}
	dp[node]=maxi;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	// cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll int n;
		cin>>n;
		int arr[n+1][n];
		for(ll int i=1;i<=n;i++)
		{
			for(ll int j=1;j<=n-1;j++)
			{
				cin>>arr[i][j];
			}
		}
		for(ll int i=1;i<=n;i++)
		{
			for(ll int j=1;j+1<=n-1;j++)
			{
				a[num({i,arr[i][j]})].pb(num({i,arr[i][j+1]}));
			}
		}	
		for(ll int i=1;i<=n;i++)
		{
			for(ll int j=1;j<=n;j++)
			{
				if(i!=j&&!vis[num({i,j})])
				{
					// cout<<"# "<<i<<" "<<j<<endl;
					dfs(num({i,j}));
					// cout<<endl;
				}
			}
		}
		memset(vis,0,sizeof(vis));
		ll int maxi=-1;
		for(ll int i=1;i<=n;i++)
		{
			for(ll int j=1;j<=n;j++)
			{
				if(i!=j)
				{
					maxi=max(maxi,dp[num({i,j})]);
				}
				if(i!=j&&!vis[num({i,j})])
				{
					dfs_c(num({i,j}));
				}
			}
		}
		cout<<maxi;
		// sort(dp,dp+N);
		// cout<<dp[N-1];
	}
	return 0;
}

Measured memory_bytes: 118144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
ll MOD = 1e9 + 7;
int main() {
    ll n, a, b, c, ans, s;
    cin >> n;
    vector<ll>x(n), y(n), d(n);
    rep(i, n) cin >> x[i] >> y[i];
    ll mi,ma;
    mi = 3e9;
    ma = 0;
    rep(i, n) {
        d[i] = x[i]+y[i];
        if (d[i] < mi) {
            mi = d[i];
        }
        if (d[i] > ma) {
            ma = d[i];
        }
    }
    b = ma - mi;
    mi = 3e9;
    ma = -3e9;
    rep(i, n) {
        d[i] = x[i]-y[i];
        if (d[i] < mi) {
            mi = d[i];
        }
        if (d[i] > ma) {
            ma = d[i];
        }
    }
    c = ma - mi;
    cout << max(b,c) << endl;
    return 0;
}



Measured memory_bytes: 7968
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int h, w, h2, w2;
  cin >> h >> w >> h2 >> w2;
  cout << h * w - h2 * w - w2 * h + h2 * w2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
#define int long long
int k,head[5002000],tot,dis[5000020],dl[5000020];
bool vis[5000200];
struct node{
	int t,nxt,w;
}e[5000020];
void add(int u,int v,int dis){
	e[++tot].t=v;
	e[tot].w=dis;
	e[tot].nxt=head[u];
	head[u]=tot;
}
void spfa(){
    int head1=1,tail=1;
    memset(dis,127/3,sizeof(dis));
    dl[1]=1;//模拟队列
    vis[1]=1;dis[1]=0;
    for(int v=1;head1<=tail;vis[v]=0,v=dl[++head1])//另类写法
        for(int p=head[v];p;p=e[p].nxt)
            if(dis[e[p].t]>dis[v]+e[p].w){
                dis[e[p].t]=dis[v]+e[p].w;
                if(!vis[e[p].t]) vis[e[p].t]=1,dl[++tail]=e[p].t;
            }
}
signed main(){
	scanf("%lld",&k);
	for(int i=1;i<k;i++){
		add(i,i*10%k,0);
		add(i,(i+1)%k,1);
	}
	spfa();
	printf("%lld",dis[0]+1);
	return 0;
}


Measured memory_bytes: 59520
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
    int n;
    cin >> n;
    vector<int> c(n),r(n);
    vector<int> d(n);
    rep(i,n){
        int a,b;
        cin >> a >> b;
        a--;b--;
        c[a]++;
        r[b]++;
        d[a] = b;
    }

    rep(i,n){
        if(c[i]!=1||r[i]!=1){
            cout << -1 << endl;
            return 0;
        }
    }
    int s = 0;
    rep(i,n){
        while(d[i]!=i){
            s++;
            int k = d[i];
            swap(d[i],d[k]);
        }
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3860