akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String S = br.readLine();
	String T = br.readLine();
	if (T.length() == S.length() + 1 && T.substring(0, S.length()).equals(S)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
}

Measured memory_bytes: 32228
N = int(input())
h = [int(_) for _ in input().split()]


def count(A):
    minimum = min(A)
    stack = [[]]
    for num in A:
        if num > minimum:
            stack[-1] += [num - minimum]
        else:
            stack += [[]]
    return minimum + sum([count(array) for array in stack if array != []])


print(count(h))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
class SegTree {
    int n;// 葉の数
    vector<T> data;// データを格納するvector
    T def; // 初期値かつ単位元
    function<T(T, T)> operation; // 区間クエリで使う処理
    function<T(T, T)> update;// 点更新で使う処理

    // 区間[a,b)の総和。ノードk=[l,r)に着目している。
    T _query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return def; // 交差しない
        if (a <= l && r <= b)
            return data[k]; // a,l,r,bの順で完全に含まれる
        else {
            T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子
            T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子
            return operation(c1, c2);
        }
    }

    public:
    // _n:必要サイズ, _def:初期値かつ単位元, _operation:クエリ関数,
    // _update:更新関数
    SegTree(size_t _n, T _def, function<T(T, T)> _operation,
        function<T(T, T)> _update)
        : def(_def), operation(_operation), update(_update) {
        n = 1;
        while (n < _n) {
            n *= 2;
        }
        data = vector<T>(2 * n - 1, def);
    }

    // 場所i(0-indexed)の値をxで更新
    void change(int i, T x) {
        i += n - 1;
        data[i] = update(data[i], x);
        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
        }
    }

    // [a, b)の区間クエリを実行
    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }

    // 添字でアクセス
    T operator[](int i) {
        return data[i + n - 1];
    }
};
int main(){
    ll n,x;cin >> n >>x;
    SegTree<ll> st(2*n,(ll)INF,[](ll a,ll b){return min(a,b);},[](ll a,ll b){return b;});
    ll ans=INF;
    rep(i,n){
        ll a;cin >> a;
        st.change(i,a);
        st.change(i+n,a);
    }
    rep(i,n){
        ll tmp=i*x;
        rep(j,n){
            tmp+=st.query(n+j-i,n+j+1);
        }
        chmin(ans,tmp);
    }
    cout <<ans <<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 100000
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int n;
int ans;
int gcd(int x,int y){
	if(y==0)return x;
	return gcd(y,x%y);
}
signed main() {
	cin>>n>>ans;
	rep(i,n-1){
		int a;
		cin>>a;
		ans=gcd(ans,a);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int p1 = sc.nextInt();
		int p2 = sc.nextInt();
		int p3 = sc.nextInt();
		int j1 = sc.nextInt();
		int j2 = sc.nextInt();
		int p = p1, j = j1, r;
		
		if(p<=p2){
			if(p3<p) p = p3;
		}else if(p>p2){
			if(p2<=p3) p = p2;
			else if(p3<p2)p = p3;
		}
		if(j2<j)j = j2;
		r = p+j-50;
		System.out.println(r);
	}

}

Measured memory_bytes: 26116
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    string S;
    cin>>S;
    sort(S.begin(),S.end());
    if(S[0]==S[1] && S[2]==S[3] && S[1]!=S[2])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

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

a = list(map(int,input().split()))

d = [[0]*w for i in range(h)]

I = 0
J = 0
for i in range(n):
    while a[i] > 0:
        d[I][J] = i+1
        a[i] -= 1
        if I%2 == 0 and J == w-1:
            I += 1
        elif I %2 == 1 and J == 0:
            I += 1
        else:
            if I%2 == 0:
                J += 1
            else:
                J -= 1

for i in range(h):
    print(*d[i])

Measured memory_bytes: 42608
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int N, K;
int parent[100005];
int doub[32][100005];
int depth[100005];
int ok[100005];
vector<vector<int> > edge(100005);

void prepare() {
  for(ll i=0;i<N;++i) {
    doub[0][i] = parent[i];
  }
  for(ll i=1;i<32;++i) {
    for(ll j=0;j<N;++j) {
      doub[i][j] = doub[i-1][doub[i-1][j]];
    }
  }
}

void getdepth(ll u, ll dist) {
  depth[u] = dist;
  for(ll i=0;i<edge[u].size();++i) {
    getdepth(edge[u][i], dist+1);
  }
  return;
}

void getok(ll u) {
  ok[u] = true;
  for(ll i=0;i<edge[u].size();++i) {
    getok(edge[u][i]);
  }
  return;
}

ll getcut(ll u) {
  ll h=K-1;
  ll two;
  ll ans=u;
  ll tmp;
  while(h>0) {
    two = 1;
    tmp = 0;
    while(2*two<h) {
      two *= 2;
      tmp++;
    }
    h -= two;
    ans = doub[tmp][ans];
  }
  return ans;
}

int main() {
  cin>>N>>K;
  ll tmp;
  ll ans = 0;
  for(ll i=0;i<N;++i) {
    cin>>tmp;
    tmp--;
    if(i==0 && tmp!=0) ans++;
    if(i!=0) {
      parent[i] = tmp;
      edge[tmp].push_back(i);
    }
  }
  prepare();
  /**
  for(ll i=0;i<10;++i) {
    for(ll j=0;j<N;++j) {
      cout<<doub[i][j]<<" ";
    }
    cout<<endl;
  }
  **/
  getdepth(0, 0);
  vector<pair<ll, ll> > arr(N);
  for(ll i=0;i<N;++i) arr[i] = mp(depth[i], i);
  sort(arr.begin(), arr.end(), greater<pair<ll, ll> >());
  ll cut;
  ll now;
  bool can;
  for(ll i=0;i<N;++i) {
    if(ok[arr[i].se]) continue;
    if(arr[i].fi<=K) continue;
    now = arr[i].se;
    can = false;
    for(ll j=0;j<K;++j) {
      if(ok[now]) {
        can = true;
        break;
      }
      ok[now] = true;
      now = parent[now];
    }
    if(!can) ans++;
    /**
    cut = getcut(arr[i].se);
    getok(cut);
    **/
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 28692
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
typedef long long ll;
int n;
int a,b;
int main()
{
  scanf("%d%d",&a,&b);
  if ((a>=1)&&(a<=9)&&(b>=1)&&(b<=9)) cout<<a*b<<endl;
  else cout<<"-1"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main () {
	int i, k, m, n, data[200][3], hantei[200][3];
	int sum[200] = { 0 };
	scanf("%d",&n);
	for (i = 0; i < n; i++) {
		for(k = 0; k < 3; k++) {
			scanf("%d",&data[i][k]);
			hantei[i][k] = 0;
		}
	} 
	for (k = 0; k < 3; k++) {
		for (m = 0; m < n; m++) {
			for (i = 0; i < n; i++) {
				if (data[m][k] == data[i][k]) {
					hantei[m][k] = hantei[m][k] + 1;
				}
			}
		}
	}
	for (i = 0; i < n; i++) {
		for (k = 0; k < 3; k++) {
			if (hantei[i][k] <= 1) {
				sum[i] = sum[i] + data[i][k];
			}
		}
		printf("%d\n",sum[i]);
	}
}

Measured memory_bytes: 1028
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
using namespace std;

int main()
{
    int n;
    int i, j, p;
    
    cin >> n;
    
    int c[n-1], s[n-1], f[n-1];
    int count[n-1];
    
    for(i = 0; i < n - 1; i++) {
        cin >> c[i] >> s[i] >> f[i];
        count[i] = 0;
    }
    
    for(i = 0; i < n - 1; i++) {
     
        for(j = i; j < n - 1; j++) {
            
            if((count[i] % f[j]) == 0) {
                p = count[i] / f[j];
            } else {
                p = (count[i] / f[j]) + 1;
            }
            
            if((p * f[j]) <= s[j]) {
                count[i] = s[j] + c[j];
            } else {
                count[i] = (p * f[j]) + c[j];
            }
        }
        
        cout << count[i] << endl;
    }
    
    cout << "0\n";
    
    return 0;
}

Measured memory_bytes: 256
import math

N, D = map(int, input().split())

ll = [list(map(int, input().split())) for _ in range(N)]

cnt = 0
for i in range(N):
    for j in range(i):
        a = ll[i]
        b = ll[j]
        ans = 0
        for iii in range(D):
            ans += (a[iii] - b[iii]) ** 2
        t = math.sqrt(ans)
        if t == int(t):
            cnt += 1
print(cnt)

Measured memory_bytes: 3064
import sys
def input():
    return sys.stdin.readline()[:-1]

S = list(map(int, list(input())))
num = 0
dict = {}
dict[0] = 1
ans = 0

for i , n in enumerate(S[::-1]):
    num += n * pow(10,i,2019)
    cand = num % 2019
    if cand in dict.keys():
        dict[cand] += 1
    else:
        dict[cand] = 1

for key in dict.keys():
    ans += dict[key] * (dict[key] - 1) // 2
print(ans)


Measured memory_bytes: 88056
/*
   Created by Rahul Goel.
*/

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c) (c).begin(), (c).end()
#define pii pair < ll, ll >
#define vi vector < ll >
#define vb vector < bool >
#define vvi vector < vector < ll > >
#define vvb vector < vector < bool > >
#define vpii vector < pair < ll, ll > >
#define vvpii vector < vector < pair < ll, ll > > >
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define min_pq(t) priority_queue < t, vector < t >, greater < t > >
#define max_pq(t) priority_queue < t >
#define pb push_back
#define ff first
#define ss second

ll mod_sum() { return 0ll; }
template<typename T, typename... Args>
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%mod + mod)%mod; }

ll mod_prod() { return 1LL; }
template<typename T, typename... Args>
T mod_product(T a, Args... args) { return (a*mod_product(args...))%mod; }

// --------------------------------------------------------------

ll solve(){
    map < ll, ll > mapper;
    ll n, ans = 0;
    cin >> n;
    for(ll i=1; i<=n; i++){
        ll val;
        cin >> val;
        if(present(mapper, i-val))
            ans += mapper[i-val];
        mapper[i+val]++;
    }
    cout << ans << endl;
    return 0;
}

int main(){
    fastio;

    ll t = 1;
    while(t--)
        solve();

    return 0;
}



Measured memory_bytes: 16120
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x=5;
         int i=1;
        while(x!=0){
          
            x= scanner .nextInt();
            if(x==0){
                break;
            }
            System.out.println("Case "+i+": "+x);
              i++;
            
        }
    }

}

Measured memory_bytes: 42372
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    char ch;
    set<int> S;
    for (int i = 0; i < n; ++i) {
        cin >> ch;
        S.insert(ch);
    }

    if (S.size() == 3) {
        cout << "Three\n";
    } else {
        cout << "Four\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int ans = 1, t = 1;
    while(t < n){
        ans++;
        t = (1+ans)*ans/2;
    }
    cout<<ans;


    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int N , a , b , c ;
	scanf("%d", &N);
	if(N>=100 && N<=999)
    {
     a=N/100;
     b=(N%100)/10;
     c=N%10 ;
     if(a==c)
     printf("Yes");
     else
     printf("No");
    }
}


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

using namespace std;

int main(){
    int N,ans=0;
    bool high=false;
    cin >> N;
    vector<int> h(N),m;
    for(int i=0;i<N;i++){
        cin >> h[i];
    }

    m=h;
    sort(m.begin(),m.end());

    for(int i=1;i<101;i++){
        for(int j=0;j<N;j++){
            if(h[j]<i && high){
                high = false;
            }else if(i<=h[j] && !high){
                ans++;
                high = true;
            }
        }
        high = false;
        if(m.back()==i){
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		sc.close();
		System.out.println(Math.max(C-(A-B), 0));
	}
}

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

using namespace std;

int main() {
  double h;
  scanf("%lf", &h);
  double a = h, i = h;
  while (scanf("%lf", &h) == 1) {
    a = max(a, h);
    i = min(i, h);
  }
  printf("%f\n", a - i);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll X, Y;
        cin >> X >> Y;

        if (Y % 2 == 1) {
                cout << "No" << endl;
                return 0;
        }
        ll a = (4 * X - Y) / 2;
        ll b = X - a;
        if (a >= 0 and b >= 0) {
                cout << "Yes" << endl;
        } else {
                cout << "No" << endl;
        }
}

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

ll dp[103][2][4];

int main(){
	string n;
	cin >> n;
	int k;
	cin >> k;
	
	ll l = n.size();
	
	dp[0][0][0] = 1;
	
	rep(i,l){
		rep(smaller,2){
			rep(j,k+1){
				rep(x,10){
					int D = n[i] - '0';
					int nsmaller = smaller;  int nj = j;
					if(smaller == 0){
						if(x > D) continue;
						if(x != 0) nj++;
						if(x < D) nsmaller = 1;
						if(nj > k) continue;
					}else{
						if(x != 0) nj++;
						if(nj > k) continue;
					}
					dp[i+1][nsmaller][nj] += dp[i][smaller][j];
				}
			}
		}
	}
	
	cout << dp[l][1][k] + dp[l][0][k] << endl;
	
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A=new int[M];
        int[] B=new int[M];
        Unionfind uf = new Unionfind(N+1);
        for(int i=0; i<M; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            uf.union(A[i],B[i]);
        }
        
        int res=0;

        for(int i=0; i<N; i++){
            res = Math.max(res,uf.getSize(i));
        }
        System.out.println(res);
}


static class Unionfind {
		 
    private int[] data;
    private int []size;
    
    public Unionfind(int size) {
        this.data = new int [size];
        this.size = new int [size];
        for(int i = 0 ;i < size ;i++) {
            initnode(i);
        }
        clear();
    }
    
    public void initnode(int i) {
        size[i] = 1;
    }
    
    public void clear() {
        Arrays.fill(data, -1);
    }
    
    public void union(int x , int y ) {
        if((x = root(x)) != (y = root(y))) {
            if(data[y] < data[x]) {
                final int t = x;
                x = y;
                y = t;
            }
            data[x] += data[y];
            size[root(x)] += size[root(y)];
            data[y] = x;
        }
    }
    
    public int getSize(int i) {
        return size[root(i)];
    }
    
    public int root(int x) {
        if(data[x] < 0) {
            return x;
        }
        else {
            return data[x] = root(data[x]);
        }
    }
    
    public boolean same(int x, int y) {
        return root(x) == root(y);
    }
    
}
}

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

int main(){
    int k,a,b;
    cin >> k >> a >> b;
    int tmp1=a/k,tmp2=b/k;

    if(a%k==0) cout << "OK" << endl;
    else if(tmp1==tmp2) cout << "NG" << endl;
    else cout << "OK" << endl;
}

Measured memory_bytes: 3588
N,K = map(int,input().split())
twos = [2]
a = 2
per = 0

while True:
    if a > 100000:
        break
    a = a*2
    twos.append(a)

for i in range(N):
    b = K / (i+1)
    if b <= 1:
        per += 1/N
    else:
        for j in range(len(twos)):
            if twos[j] >= b:
                per += 1/N * (1/2) ** (j+1)
                break
        

print(per)

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

Measured memory_bytes: 580
#include<iostream>
#include<stdio.h>
#include<string>
#include <cctype>
using namespace std;

int change(char);

int change(char str[]){
	int num=0,co=1;
	int i;
	for(i = 0 ; str[i] ; i++){
	if(str[i]=='m') num+=1000*co;
	if(str[i]=='c') num+=100*co;
	if(str[i]=='x') num+=10*co;
	if(str[i]=='i') num+=1*co;
	
	if(str[i]=='0'||str[i]=='1'||str[i]=='2'||str[i]=='3'||str[i]=='4'||str[i]=='5'||str[i]=='6'||str[i]=='7'||str[i]=='8'||str[i]=='9'){
		co = str[i]-'0';
	}else{
		co = 1;
	}
	}
	return num;
}
	
int main(){
	int n;
	int sum;
	int i,j;
	char str1[10],str2[10];
	
	cin >> n;
	
	for(i = 0 ; i < n ; i++){
		cin >> str1 >> str2;
		
	sum=change(str1)+change(str2);
		if(sum/1000 > 1){
			cout << sum/1000;
			}
		if(sum/1000){
			printf("m");
			}
		sum %= 1000;
		if(sum/100 > 1){
			cout << sum/100;
			}
		if(sum/100){
			printf("c");
			}
		sum%=100;
		if(sum/10 > 1){
			cout << sum /10;
			}
		if(sum/10){
			printf("x");
			}
		sum%=10;
		if(sum>1){
			cout << sum;
			} 
		if(sum){
			printf("i");
			}
		
		cout << endl;
		
	}
	return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1e9 + 7

long long a,b,c;

long long dp(long long x,long long y)
{
    if(y==0 and x==0) return 0;
    if(y==0) return min(a,c*2)*x;
    if(x==0) return min(b,c*2)*y;
    long long tmp = min(x,y);
    return dp(x-tmp,y-tmp)+tmp*c*2;
}

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

    long long x,y;

    cin >> a >> b >> c >> x >> y;

    if(a+b<=c*2){ cout << a*x+b*y; return 0; }

    cout << dp(x,y);
}


Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     lp(i,a,n)     for(ll i=a;i<n;i++)
#define     lp2(i,n,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<int,int>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            '\n'
#define     Endl            '\n'
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightX[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightY[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e5+1,oo=0x3f3f3f3f,MOD=1e9;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int n;
    cin>>n;
    vii v(n);
    lp(i,0,n)
        cin>>v[i].f>>v[i].s;
    lp(i,0,n-2){
        if(v[i].f==v[i].s&&v[i+1].f==v[i+1].s&&v[i+2].f==v[i+2].s){
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    int t=1;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3604
nk = input('')
n = int(nk.split()[0])
k = int(nk.split()[1])

alist = list(map(int,input('').split()))

for i in range(1,n-k+1):
    removed = alist[i-1]
    inserted = alist[i+k-1]
    if inserted > removed:
        print('Yes')
    else:
        print('No')


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

const int maxn = 100010;
int n, a[maxn];
deque<int> q;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a + 1, a + n + 1);
    q.push_back(a[n]);
    int l = 1, r = n - 1, cur = 1;
    while (l < r) {
        int cnt = 1, x, y;
        if (cur == 1) {
            x = a[l++];
            if (l < r) y = a[l++], cnt++;
        } else {
            x = a[r--];
            if (l < r) y = a[r--], cnt++;
        }
        if (cnt == 1) {
            abs(q.front() - x) < abs(q.back() - x) ? q.push_back(x) : q.push_front(x);
        } else {
            if (abs(q.front() - x) + abs(q.back() - y) < abs(q.front() - y) + abs(q.back() - x)) {
                q.push_front(y), q.push_back(x);
            } else {
                q.push_front(x), q.push_back(y);
            }
        }
        cur ^= 1;
    }
    if (l == r) {
        abs(q.front() - a[l]) < abs(q.back() - a[l]) ? q.push_back(a[l]) : q.push_front(a[l]);
    }
    int pre = q.front(); q.pop_front(); long long ans = 0;
    while (!q.empty()) {
        ans += abs(q.front() - pre), pre = q.front(), q.pop_front();
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 1e9+7;
const ll INF = 1LL<<40;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll a[3300];
int main(){
  ll n,k,ans=0;
  cin>>n;
  rep(i,0,n){cin>>a[i];ans+=a[i]-1;}
  cout<<ans;
}

Measured memory_bytes: 256
N,A,B,K = map(int, raw_input().split())


mod=998244353
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, N+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))


def ncr(n,r):
	if n < 0 or r < 0 or n < r:
		return 0
	else:
		return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

y=0
ans=0
for x in range(N+1):
	if (K-A*x)%B==0:
		if K-A*x<0: break
		y=(K-A*x)/B
		if y>N: continue
		ans+=(ncr(N,x))%mod*(ncr(N,y))%mod

print ans%mod


Measured memory_bytes: 77852
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        v.push_back(a);
    }

    int q;
    cin >> q;
    for (int l = 0; l < q; ++l) {
        int m;
        cin >> m;

        vector<int> available;
        for (int i : v) {
            vector<int> tmp;
            tmp.push_back(i);
            for (int j : available) {
                tmp.push_back(j);
                tmp.push_back(i + j);
            }
            swap(available, tmp);
        }

        if (find(begin(available), end(available), m) != end(available)) {
            cout << "yes" << endl;
        }
        else {
            cout << "no" << endl;
        }
    }
}

Measured memory_bytes: 15172
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

n = int(input())
state_list = [[-1 for _ in range(n)] for _ in range(n)]

for i in range(n):
    a = int(input())
    for j in range(a):
        x,y = list(map(int,input().split()))
        state_list[i][x-1] = y

from itertools import product
pattern_list = list(product("10",repeat=n))

def check(pattern):
    true_people = [i for i,v in enumerate(pattern) if v=="1"]
    for i in true_people:
        for j,v in enumerate(state_list[i]):
            if (v==0 and j in true_people) or (v==1 and j not in true_people):
                return 0
    return len(true_people)
ret = 0
for i in pattern_list:
    ret = max(ret,check(i))
print(ret)

Measured memory_bytes: 8892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const char nl = '\n';

// INT VS LL

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

    int n,x;
    cin>>n>>x;
    if (n*500>=x){
    	cout<<"Yes"<<nl;
    }
    else cout<<"No"<<nl;

    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
ll n,m;  
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>n>>m;
	if(n*2<=m) cout<<(n*2+m)/4;
	else cout<<m/2;
	re 0;
}

Measured memory_bytes: 3620
h, w, K = map(int, input().split())
grid = []
for i in range(h):
    grid.append(input())

ans = 1000000
for i in range(2**(h-1)):
    b = format(i, "0{}b".format(h-1))
    ans_temp = b.count("1")
    white_after = [0]*(ans_temp+1)
    index = 0
    flag = 1
    for j in range(w):
        for k in range(h):
            if grid[k][j] == "1":
                white_after[index] += 1
            if k != h-1:
                if b[k] == "1":
                    index += 1
        if max(white_after) <= K:
            white_before = white_after[:]
        else:
            try:
                for k in range(len(white_after)):
                    white_after[k] -= white_before[k]
                    if white_after[k] > K:
                        flag = 0
                white_before = white_after[:]
                ans_temp += 1
            except:
                flag = 0
                break
        index = 0
    if flag == 0:
        continue
    ans = min(ans, ans_temp)

print(ans)


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

#define ll long long
#define ld long double
#define pi 3.14159265359
int main(){
    int N, M; cin >> N >> M;
    int Ncnt = 0, Mcnt = 0;
    if (N > 1) {
        Ncnt = (N * (N - 1)) / 2;
    }
    if (M > 1) {
        Mcnt = (M * (M - 1)) / 2;
    }
    int ans = Ncnt + Mcnt;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

void solve() {
    ll h, w; cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w));
    rep(i, 0, h) rep(j, 0, w) cin >> s[i][j];

    bool ans = true;
    rep(i, 0, h) rep(j, 0, w) {
        if(s[i][j] == '#'){
            bool f = false;
            if(i != 0 && s[i-1][j] == '#') f = true;
            if(i != h-1 && s[i+1][j] == '#') f = true;
            if(j != 0 && s[i][j-1] == '#') f = true;
            if(j != w-1 && s[i][j+1] == '#') f = true;
            if(!f) ans = false;
        }
    }

    if(ans) cout << "Yes" << "\n";
    else cout << "No" << "\n";
}

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

    solve();
    return 0;
}
 


Measured memory_bytes: 256
#!/usr/bin/python
# coding: UTF-8

n,m = input().split()

n = int(n)
m = int(m)

min = 1
max = n
for i in range(m):
    _min,_max = input().split()
    _min = int(_min)
    _max = int(_max)

    if min < _min:
        min = _min

    if max > _max:
        max = _max

if max - min + 1 > -1:
    print(max - min + 1)
else:
    print(0)


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

int main() {
    int x, a, b; cin >> x >> a >> b;
    if (a >= b) cout << "delicious" << endl;
    else if (b > a && b-a <= x) cout << "safe" << endl;
    else if (b > a && b-a > x) cout << "dangerous" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n,i,x,sum=0;
  cin>>n>>x;
  ll a[n];
  for(i=0;i<n;i++)
  {
    cin>>a[i];
    sum+=a[i];
  }
  if(x>sum) {cout<<n-1;return 0;}
  i=0;
  sum=0;
  sort(a,a+n);
  if(a[0]>x) {cout<<0;return 0;}
  while(i<n && sum<x) 
  {
    sum+=a[i];
    i++;
  }
  if(sum==x)  cout<<i;
  else cout<<i-1;
  return 0;
}

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

int N,M;
bool to[200020] = {0},from[200020] = {0};

int main()
{
    scanf("%d%d",&N,&M);
    for(int i = 0; i < M; i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        if(a == 1 || b == 1)to[a] = to[b] = true;
        if(a == N || b == N)from[a] = from[b] = true;
    }
    for(int i = 2; i < N; i++)
    {
        if(to[i] && from[i])
        {
            printf("POSSIBLE\n");
            return 0;
        }
    }
    printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 640
N = int(input())
arr = list(map(int, input().split()))
Q = int(input())
que = [list(map(int, input().split())) for _ in range(Q)]

count_list=[0]*(10**5+1)

for i in range(N):
    count_list[arr[i]] +=1

ans = sum(arr)

for i in que:
    keep = count_list[i[0]]
    c_ans = ans+keep*(i[1]-i[0])
    print(c_ans)
    ans =c_ans

    count_list[i[1]] += count_list[i[0]]
    count_list[i[0]] = 0

Measured memory_bytes: 92376
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e6 + 5;
int n;
int a[N];
int b;
int main (){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> a[i] , b ^= a[i];
    for(int i = 0; i < n; ++i) cout << (b ^ a[i]) << " ";
}


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

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n;cin>>n;
	vector<int> v(n,0);
	int arr=0;

	for(int i=0;i<n;i++){
		cin>>v[i];
		arr=arr^v[i];
	}

	for(int i=0;i<n;i++){
		cout<<(arr^v[i])<<" ";
	}


	return 0;
}

Measured memory_bytes: 3948
#include<bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define PB push_back
#define MP make_pair
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
 
const int maxn = 2005;
const int p[10][3] = {{0, 1, 2}, {0, 1, 3}, {0, 1, 4}, {0, 2, 3}, {0, 2, 4}, {0, 3, 4}, {1, 2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4}};
const int q[10][3] = {{3, 4}, {2, 4}, {2, 3}, {1, 4}, {1, 3}, {1, 2}, {0, 4}, {0, 3}, {0, 2}, {0, 1}};
 
inline void umax(int &x, int y){ x = max(x, y); }
 
class Upd{
public:
	int x, y, v;
	Upd(int x_, int y_, int v_): x(x_), y(y_), v(v_){}
};
 
int n, dlt, mx = -0x3f3f3f3f, ans; 
int a[maxn * 3], cmx[maxn];
int dp[maxn][maxn];
vector<Upd> upd;
 
inline void p2p(int x, int y, int z){
	upd.PB(Upd(x, y, dp[z][z] + dlt + 1));
	upd.PB(Upd(x, y, mx + dlt));
	return;
}
 
inline void r2r(int x, int z){
	FOR(k, 0, n)
		upd.PB(Upd(k, z, dp[x][k] + dlt + 1));
	return;
}
 
inline void r2p(int z){
	FOR(k, 0, n)
		upd.PB(Upd(k, z, cmx[k] + dlt));
	return;
}
 
inline void update(Upd u){
	int x = u.x, y = u.y, v = u.v;
	int res = max(dp[x][y] + dlt, v) - dlt;
	dp[x][y] = dp[y][x] = res;
	umax(cmx[x], res);
	umax(cmx[y], res);
	umax(mx, res);
	return;
}
 
inline void init(){
	FOR(i, 0, 10)
		dp[a[q[i][0]]][a[q[i][1]]] = (a[p[i][0]] == a[p[i][1]] && a[p[i][1]] == a[p[i][2]]);
	FOR(i, 0, n) FOR(j, 0, n){
		umax(cmx[i], dp[i][j]);
		umax(cmx[j], dp[i][j]);
		umax(mx, dp[i][j]);
	}
	return;
}
 
inline void print(){
	FOR(i, 0, n){
		FOR(j, 0, n)
			printf("%d ", dp[i][j] + dlt);
		puts("");
	}
	return;
}
 
int main(){
	scanf("%d", &n);
	FOR(i, 0, n * 3)
		scanf("%d", a + i), --a[i];
	
	if(n == 1){
		printf("%d\n", a[0] == a[1] && a[1] == a[2]);
		return 0;
	}	

	FOR(i, 0, n) FOR(j, 0, n)
		dp[i][j] = -0x3f3f3f3f;	
	FOR(i, 0, n)
		cmx[i] = -0x3f3f3f3f;
	init();
	
	REP(i, 1, n - 2){
//		printf("i = %d\n", i);
//		print();
		
		int x = a[i * 3 + 2], y = a[3 * i + 3], z = a[3 * i + 4];
		upd.clear();
		
		p2p(x, y, z);
		p2p(x, z, y);
		p2p(y, z, x);
		
		if(x == y)
			r2r(x, z);
		if(x == z)
			r2r(x, y);
		if(y == z)
			r2r(y, x);
		r2p(x);
		r2p(y);
		r2p(z);
		
		if(x == y && y == z)
			++dlt;
		FOR(j, 0, upd.size()){
			update(upd[j]);
		}
	}
	
	FOR(i, 0, n) FOR(j, 0, n){
		umax(ans, dp[i][j] + dlt + (i == j && i == a[3 * n - 1]));
	}
	
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 19640
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<iostream>
using namespace std;
int const maxn=1e4+5;
long long a[maxn],b[maxn];
int main()
{
    long long suma=0,sumb=0,n;
    scanf("%lld",&n);
    for(int i=0;i<n;i++)
    scanf("%lld",&a[i]);
    for(int i=0;i<n;i++)
    scanf("%lld",&b[i]);
    for(int i=0;i<n;i++)
    {
        if(a[i]>b[i])
        {
            sumb+=a[i]-b[i];
        }
        if(a[i]<b[i])
        {
            long long t=b[i]-a[i];
            if(t%2==0)
            {
                suma+=(t/2);
            }
            else
            {
                suma+=((t+1)/2);
                sumb+=1;
            }
        }
    }
    if(suma>=sumb) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=10000000;
int dp[11][200001];
int main(){
    int D,G;
    cin >> D >> G;
    G/=100;
    int p[D],c[D];
    for(int i=0;i<D;i++){
        cin >> p[i] >> c[i];
        c[i]/=100;
    }
    for(int i=0;i<=D;i++){
        for(int j=0;j<200001;j++){
            dp[i][j]=INF;
        }
    }
    dp[0][0]=0;
    for(int i=0;i<D;i++){
        for(int j=0;j<=p[i];j++){
            for(int k=0;k<G;k++){
                if(j==p[i]) dp[i+1][min(G,k+(i+1)*j+c[i])]=min(dp[i+1][min(G,k+(i+1)*j+c[i])],dp[i][k]+j);
                else dp[i+1][min(G,k+(i+1)*j)]=min(dp[i+1][min(G,k+(i+1)*j)],dp[i][k]+j);
            }
        }
    }
    int ans=INF;
    for(int k=0;k<=D;k++){
        ans=min(ans,dp[k][G]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8960
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int a[200005], b[200005];
int n;
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]), b[i] = a[i];
	sort(b + 1, b + 1 + n);
	if (b[n] == b[n-1]) {
		for (int i = 1; i <= n; ++i)
			printf("%d\n", b[n]);
	} else {
		for (int i = 1; i <= n; ++i) {
			if (a[i] == b[n])
				printf("%d\n", b[n-1]);
			else
				printf("%d\n", b[n]);	
		}
	}
	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	vector <int> v_c;
	v_c.resize(3);
	double e =2.0;
	int N;
	//data set
	cin >> N;
	for(int i = 0; i < N; ++i)
	{
		cin >> v_c[0] >> v_c[1] >> v_c[2];
		sort(v_c.begin(),v_c.end(),greater<int>());
		if( pow(v_c[0],e) == (pow(v_c[1],e)+pow(v_c[2],e)))
		{
			cout << "YES"<<endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1204
import java.util.*;
import java.lang.Math;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String[] line = sc.nextLine().split(" ");
		double a= Double.parseDouble(line[0]);
		double b= Double.parseDouble(line[1]);
		double c= Double.parseDouble(line[2]);
		double s=Math.sin(c/180*Math.PI)*a*b/2;
		double l=a+b+Math.sqrt(a*a+b*b-2*a*b*Math.cos(c/180*Math.PI));
		double h=Math.sin(c/180*Math.PI)*b;
		System.out.printf("%.5f",s);
		System.out.println();
		System.out.printf("%.5f",l);
		System.out.println();
		System.out.printf("%.5f",h);
		System.out.println();
		
	}
}

Measured memory_bytes: 26424
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

struct unionfind{
  vector<int> par;
  vector<int> rank;
  unionfind(int n=1){
    init(n);
  }
  void init(int n=1){
      par.resize(n); rank.resize(n);
      for(int i=0;i<n;++i) par[i]=i,rank[i]=0;
  }
  int root(int x){
    if(par[x]==x){
      return x;
    }
    else{
      int r=root(par[x]);
      return par[x]=r;
    }
  }
  bool issame(int x,int y){
    return root(x)==root(y);
  }
  bool merge(int x,int y){
    x=root(x); y=root(y);
    if(x==y) return false;
    if(rank[x]<rank[y]) swap(x,y);
    if(rank[x]==rank[y]) ++rank[x];
    par[y]=x;
    return true;
  }
};

int main(){
  int N,K,L;
  cin >> N >> K >> L;
  unionfind ufa(N);
  unionfind ufb(N);
  rep(i,K){
    int a,b;
    cin >> a >> b;
    a--; b--;
    ufa.merge(a,b);
  }
  rep(i,L){
    int a,b;
    cin >> a >> b;
    a--; b--;
    ufb.merge(a,b);
  }
  map<i_i,int> mp;
  rep(i,N){
    mp[i_i(ufa.root(i),ufb.root(i))]++;
  }
  rep(i,N){
    if(i==N-1){
      cout << mp[i_i(ufa.root(i),ufb.root(i))] << endl;
      continue;
    }
    cout << mp[i_i(ufa.root(i),ufb.root(i))] << " ";
  }

}

Measured memory_bytes: 15104
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define vvi vector<vi >
#define str string
#define vs vector<str>
#define vb vector<bool>
#define slli set<lli>
#define mii map<int, int>
#define mlli map<int, lli>
#define msi map<str, int>
#define mp make_pair
#define pii pair<int, int>
#define pll pair<lli, lli>
#define vpii vector<pii >
#define vpll vector<pll >
#define pb push_back
#define loop(i, s, l, j) for(int i = s; i < l; i += j)
#define rloop(i, s, l, j) for(int i = s; i >= l; i -= j)
#define rep(i, n) loop(i,0,n,1)
#define rrep(i, n) rloop(i,n-1,0,1) 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ft first
#define sd second
#define all(a) a.begin(),a.end()
#define rev(a) reverse(all(a))
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define mod 1000000007
#define inf 100000000
#define limit 200005
#define minval -100000000000000000
#define maxval 1000000000000000
/**********************************************************************************************************************************************/
int dx4[4] = {0, -1, 0, 1};
int dy4[4] = {1, 0, -1, 0};
int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Power(int base,int exp){int ans=1;  while(exp > 0){if(exp&1)ans=(1LL*ans*base)%mod; exp=exp>>1; base=(1LL*base*base)%mod;}  return ans;}
/**********************************************************************************************************************************************/ 
void input()
{
    lli d, t, s;
    cin >> d >> t >> s;
    cout << (d <= s*t ? "Yes" : "No");
}
int main()
{
   /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   */
    fastio();
    int q = 1;
    //cin >> q;
    while(q--)
        input();
}


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

int n;
string s[50];

signed main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) { cin >> s[i]; }
	
	int minCnt[26];
	for (i = 0; i < 26; i++) minCnt[i] = 114514;
	
	for (i = 0; i < n; i++) {
		int cnt[26] = {0};
		for (j = 0; j < s[i].length(); j++) {
			cnt[s[i][j] - 'a']++;
		}
		for (j = 0; j < 26; j++) {
			minCnt[j] = min(minCnt[j], cnt[j]);
		}
	}
	
	for (i = 0; i < 26; i++) {
		for (j = 0; j < minCnt[i]; j++) {
			cout << (char)('a' + i);
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
ll n,i,m,c=0;
cin>>n;
vector<ll>v;
for(i=0;i<n;i++)
{
    cin>>m;
    v.pb(m);
}
sort(v.begin(),v.end());
c=n/2;
cout<<v[c]-v[c-1]<<endl;
}


Measured memory_bytes: 1400
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    string s; cin>>s;
    int ncnt = 0, scnt = 0, ecnt = 0, wcnt = 0;
    for(int i=0; i<n; i++){
        ncnt += ('A' <= s[i] && s[i] <= 'M');
        scnt += ('N' <= s[i] && s[i] <= 'Z');
        ecnt += ('a' <= s[i] && s[i] <= 'm');
        wcnt += ('n' <= s[i] && s[i] <= 'z');
    }

    cout << max(ncnt, scnt) - min(ncnt, scnt) + max(ecnt, wcnt) - min(ecnt, wcnt) << endl;
    for(int i=0; i<max(ncnt, scnt) - min(ncnt, scnt); i++){
        if(ncnt > scnt) cout << 'A';
        else cout << 'N';
    }
    for(int i=0; i<max(ecnt, wcnt) - min(ecnt, wcnt); i++){
        if(ecnt > wcnt) cout << 'a';
        else cout << 'n';
    }
    cout << endl;

    return 0;
}


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

typedef long long int ll;
typedef long long unsigned int ull;
typedef long double ld;
typedef vector<int> vr;
typedef pair<int, int> pr;
#define pb push_back
#define ff first
#define ss second
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
#define endl "\n"
//cout << fixed << setprecision(2);


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string n;
    cin >> n;
    ll sum = 0;
    for (int i = 0; i < n.length(); i++)
    {
        ll num = n.at(i) - '0';
        assert(0 <= num && num <= 9);
        sum += num;
    }
    if(sum % 9 == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

#define print(s) cout << (s) << endl;
#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n) 
#define all(a) a.begin(), (a).end()
#define inf = 9876543210
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    int i = 1;
    int v = 111;
    while(n>v){
    v+=111;
    }
    print(v);
}

Measured memory_bytes: 256