akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <cmath>

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

ll sum = 0;
ll N;
void add(ll A){
    if(A <= N) {
        add(A * 10 + 3);
        add(A * 10 + 5);
        add(A * 10 + 7);
    }
    map<char,bool> cnt;
    for(char i : to_string(A)){
        cnt[i] = true;
    }
    if(cnt.size() == 3 and A <= N){
        sum++;
    }
}
int main() {
    cin >> N;
    add(0);
    cout << sum << endl;
}

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

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

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


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main(void){
  char buf[4];
  int ans=700;
  
  scanf("%s", &buf);
  
  for (int i=0; i<3; i++){
    ans += buf[i]=='o'?100:0;
  }
  
  printf("%d\n", ans);
  return 0;
}
  

Measured memory_bytes: 128
n,k=map(int,input().split())
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l1=sorted(l1)
l2=sorted(l2)
l2=l2[::-1]
l3=[]
for i in range(n):
  l3.append(l1[i]*l2[i])
left=0
right=10**12
while left<right:
  mid=(left+right)//2
  if mid==left:
    num=0
    for i in range(n):
      if l3[i]<=left:
        pass
      else:
        dis=l3[i]-left#いくつ減らす必要がある？
        num+=((dis-1)//l2[i])+1
    if num<=k:
      print(left)
      exit()
    else:
      print(right)
      exit()
  num=0
  for i in range(n):
    if l3[i]<=mid:
      pass
    else:
      dis=l3[i]-mid
      num+=((dis-1)//l2[i])+1
  if num<=k:
    right=mid
  else:
    left=mid
print(left)


Measured memory_bytes: 122572
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;

using namespace std;

int main()
{
	int a,b;
	int ans=0;
	
	cin>>a>>b;
	if((a*b)%2==0)
	{
		cout<<"Even"<<endl;
	}else{
		cout<<"Odd"<<endl;
	}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int poww[200001];

int to_num(char c){
    return c - '0';
}

ll choose2(int x){
    return (ll)(x) * (x-1) / 2;
}

int main(){
    int n, p; cin >> n >> p;
    string s; cin >> s;
    ll ans = 0;
    if (p == 2 or p == 5){
        for (int i = n-1; i >= 0; --i){
            if ((s[i]-'0') % p == 0){
                ans += i + 1;
            }
        }
    }
    else{
        poww[n-1] = 1;
        for (int i = n-2; i >= 0; --i){
            poww[i] = poww[i+1] * 10;
            poww[i] %= p;
        }
        map<int, int> counter;
        counter[0]++;
        int ui = (s[n-1]-'0') % p; counter[ui]++;
        
        for (int i = n-2; i >= 0; --i){
            int uip = (ui % p + ( (to_num(s[i]) % p) * (poww[i]) ) % p) % p;
            counter[uip]++;
            ui = uip;
        }
        
        for (pair<int, int> x : counter){
            ans += choose2(x.second);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1668
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

void solve() {
	ll A, B, C, D;
	scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
	C--;
	ll K = 1;
	K = max(K, (A + B) / (min(A, B) + 1));
	ll l = 0, r = A + 1;
	while(r - l > 1) {
		ll m = (l + r) / 2;
		ll rA = A - K * m, rB = B - m + 1;
		if (rA < 0 || rB < 0) {
			r = m;
			continue;
		}
		if ((rA + 1) * K < rB)
			r = m;
		else
			l = m;
	}
	if (l != 0) {
		while(C < K && C < D) {
			printf("A");
			C++;
		}
		C -= K;
		D -= K;
		A -= K;
		l--;
		ll L = (K + 1) * l;
		while(C < L && C < D) {
			if (C % (K + 1) == 0)
				printf("B");
			else
				printf("A");
			C++;
		}
		C -= L;
		D -= L;
		A -= K * l;
		B -= l;
		if (B > 0) {
			if (C == 0 && C < D) {
				printf("B");
				C++;
			}
			C--;
			D--;
			B--;
		}
	}
	if (D <= 0) return;
	l = 0;
	r = min(A, K) + 1;
	while(r - l > 1) {
		ll m = (l + r) / 2;
		ll rA = A - m, rB = B;
		if ((rA + 1) * K < rB)
			r = m;
		else
			l = m;
	}
	while(C < l && C < D) {
		printf("A");
		C++;
	}
	A -= l;
	C -= l;
	D -= l;
	if (D <= 0) return;
	l = 0;
	r = min(B, K);
	while(r - l > 1) {
		ll m = (l + r) / 2;
		ll rA = A, rB = B - m;
		if (rA * K < rB)
			l = m;
		else
			r = m;
	}
	while(C < r && C < D) {
		printf("B");
		C++;
	}
	B -= r;
	C -= r;
	D -= r;
	while(C < D) {
		if (C % (K + 1) == 0)
			printf("A");
		else
			printf("B");
		C++;
	}
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int t;
	scanf("%d", &t);
	while(t--) {
		solve();
		printf("\n");
	}

	return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>

using namespace std;

int main() {

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

    cout << min(B / A, C) << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define pb(v, a) v.push_back(a)
#define sz(s) (ll)s.size()
#define print(d) cout << fixed << setprecision(15) << d
#define pii pair<ll,ll>
#define ppii pair<ll,pii>
#define ff first
#define ss second
const ll MOD = 1000000007;
const ll MAXN = 1e6 + 5;
const ll inf = 2e18;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
tree_order_statistics_node_update> ord_set;
#define debug(x) cerr << #x << " = " << x << endl


ll power(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 


int main()
{
    fast
   ll h,a;
   cin >> h >> a;
   ll sum=0;
   fr(i,0,a)
   {
    ll x;
    cin >> x;
    sum+=x;
   }
   if(sum<h)
   {
    cout << "No\n";
   }
   else
    cout << "Yes\n";

    return 0;

}










Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N;
    scanf("%d", &N);
    if (N % 2){
        printf("%f", (N / 2 + 1) / (double)N);
    } else {
        printf("%f", (N / 2) / (double)N);
    }
    return 0;
}

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

int main() {
  string a,b;
  cin >> a >> b;
  if(a==b) {
    cout << "=" << endl;
  }
  else if(a<b){
    cout  << "<" << endl;
  }
  else {
    cout << ">" << endl;
  }
}

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

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

    ll r,c,k;
    std::cin >> r>>c>>k;
    
    vector<vector<ll>> rcv(r,vector<ll>(c,0));
    for (int i = 0; i < k; i++) {
        ll rr,cc,vv;
        std::cin >> rr>>cc>>vv;
        rr--;
        cc--;
        rcv[rr][cc] = vv;
    }
    
    vector<vector<vector<ll>>> dp(r,vector<vector<ll>>(c,vector<ll>(4,0)));
    dp[0][0][1] = rcv[0][0];
    
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            for (int k = 0; k <= 3; k++) {
                if(i>0)dp[i][j][0] = max(dp[i][j][0], dp[i-1][j][k]);
                if(j>0)dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k]);
            }
            if(rcv[i][j]!=0){
                for (int k = 1; k <= 3; k++) {
                    auto &d = dp[i][j][k];
                    if(j>0)d = max(d,dp[i][j-1][k-1]+rcv[i][j]);
                }
                for (int k = 0; k <= 3; k++) {
                    auto &d = dp[i][j][1];
                    if(i>0)d = max(d,dp[i-1][j][k]+rcv[i][j]);
                }
            }
        }
    }
    
    std::cout << max({dp[r-1][c-1][0],dp[r-1][c-1][1],dp[r-1][c-1][2],dp[r-1][c-1][3]}) << std::endl;
}


Measured memory_bytes: 706044
import heapq
n,q = map(int, input().split())
S = [[] for i in range(n)]

for i in range(q):
    a = input().split()
    t = int(a[1])
    
    if a[0] == '0':
        heapq.heappush(S[t],-int(a[2]))
    elif a[0] == '1' and S[t]:
        print(-S[t][0])
    elif a[0] == '2' and S[t]:
        heapq.heappop(S[t])


Measured memory_bytes: 13180
#include<cstdio>
#include<cstring>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int n,m;
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%d",&n,&m);
	if(n>=m)
		swap(n,m);
	if(n==1&&m==1)
		printf("1\n");
	else if(n==1)
		printf("%d",m-2);
	else if(n==2)
		printf("0");
	else
		printf("%lld",(long long)(n-2)*(m-2));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;

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;}

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))

int main() {
	int N, K;
	cin >> N >> K;
	int D[10]; SET_ZERO(D);
	for (int i = 0; i < 9; i++) {
		int d;
		cin >> d;
		D[d] = 1;
	}
	int n;
	for (n = N; ; n++) {
		int flag = 1;
		for (int p = n; p > 0; p /= 10) {
			for (int i = 0; i < 10; i++) {
				if (D[i] == 1 && p % 10 == i) {
					flag = 0;
					break;
				}
			}
			if (!flag) break;
		}
		if (flag) break;
	}
	cout << n << endl;
}


Measured memory_bytes: 256
import bisect
a,b,q=map(int,input().split())
ls=[-10**11]
lg=[-10**11]
for i in range(a):
  ls.append(int(input()))
for i in range(b):
  lg.append(int(input()))
ls.append(10**11)
lg.append(10**11)
ls=sorted(ls)
lg=sorted(lg)
for i in range(q):
  x=int(input())
  i1=bisect.bisect_left(ls,x)
  i2=bisect.bisect_left(lg,x)#xはi-1~iにある
  l1=[i1-1,i1]
  l2=[i2-1,i2]
  ans1=10**12
  ans2=10**12
  for k in l1:
    for j in l2:
      ans3=abs(x-ls[k])+abs(ls[k]-lg[j])
      if ans3<ans1:
        ans1=ans3
      ans4=abs(x-lg[j])+abs(ls[k]-lg[j])
      if ans4<ans2:
        ans2=ans4
  print(min(ans1,ans2))

Measured memory_bytes: 12168
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 998244353
#define INF 1000000000000000000

int main(){
  string S;
  cin>>S;
  int N=S.size();
  if(S[N-1]=='s'){
    cout<<S<<"es"<<endl;
  }else{
    cout<<S<<"s"<<endl;
  }
}


Measured memory_bytes: 3592
from sys import stdin, setrecursionlimit
from heapq import heapify, heappop, heappush


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    bc = [list(map(int, input().split())) for _ in range(m)]
    bc.sort(key=lambda x: -x[1])
    heapify(a)

    for i in range(m):
        b, c = bc[i]
        for _ in range(b):
            ai = heappop(a)
            if ai < c:
                heappush(a, c)
            else:
                heappush(a, ai)
                break

    print(sum(a))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 82488
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<functional>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

int main(){
    int A,B;
    cin >>A>>B;
    if(B%A==0){
        cout<<A+B;
    }else{
        cout<<B-A;
    }
    return 0;
}

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

const int N = 1e5+7;
long long a[N], b[N];

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

    int n;
    cin>>n;

    for (int i=1; i<=n; i++)    cin>>a[i]>>b[i];

    long long ans = 0;
    for (int i=n; i>0; i--) {
        long long tt = a[i];
        a[i] += ans;
        if (a[i]%b[i])  a[i] += b[i]-a[i]%b[i];
        ans = a[i] - tt;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main() {

    long a, b, x;
    scanf("%ld %ld %ld", &a, &b, &x);

    long cnt01 = b / x;
    long cnt02;

    if (a == 0) {
        cnt02 = 0;
        cnt01++;
    } else {
        cnt02 = (a - 1) / x;

    }

    

    printf("%ld", cnt01 - cnt02);

    return 0;
}


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

void solve() {
	int k, a, b;
	bool flag = true;

	cin >> k;
	cin >> a >> b;
	
	for(int i = a; i <= b; ++i) {
		if (i % k == 0) {
			cout << "OK" << endl;
			flag = false;
			break;
		}
	}

	if (flag) {
		cout << "NG" << endl;
	}
}

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

Measured memory_bytes: 3612
from collections import deque

n,k = map(int, input().split())
al = list(map(int, input().split()))

for a1,a2 in zip(al[0:n-k], al[-(n-k):]):
    # print(a1,a2)
    if a1 < a2:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 96820
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N;
    vector<int> a(N);
    cin >> a;
    REP(i, N - 1) {
        a[i + 1] = a[i] + a[i + 1];
    }
    if (a[0] < 0) {
        REP(i, N)
        a[i] *= -1;
    }
    dump(a);
    int base = 0;
    if (a[0] == 0) {
        base++;
        ans++;
    }
    REP(i, N) {
        if (i == 0)
            continue;
        if (i & 1) {
            int tmp = (a[i] + base) - (-1);
            if (tmp > 0) {
                ans += tmp;
                base -= tmp;
            }
        } else {
            int tmp = 1 - (a[i] + base);
            if (tmp > 0) {
                ans += tmp;
                base += tmp;
            }
        }
    }
    int hoge = ans;
    ans = 0;
    REP(i, N)
    a[i] *= -1;
    base = 1 - a[0];
    ans += 1 - a[0];
    REP(i, N) {
        if (i == 0)
            continue;
        if (i & 1) {
            int tmp = (a[i] + base) - (-1);
            if (tmp > 0) {
                ans += tmp;
                base -= tmp;
            }
        } else {
            int tmp = 1 - (a[i] + base);
            if (tmp > 0) {
                ans += tmp;
                base += tmp;
            }
        }
    }
    dump(hoge, ans);
    ans = min((ll)hoge, ans);
    cout << ans << endl;
}


Measured memory_bytes: 4040
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<long long,long long> P;
typedef pair<long long,P> PP;
long long n;
long long a[12];
long long ans;
long long p;
int main()
{
	p=1;
	ans=1;
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n)
	{
		ans*=3;
		if(a[i]%2==0)p*=2;
	}
	cout<<ans-p<<endl;
	return 0;
}

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

int main () {
  int N;
  cin >> N;
  int half_N = N/2;
  if (N % 2 == 0) {
    cout << N / 2 * N / 2 << endl;
  } else {
    cout << (half_N + 1) * half_N << endl;
  }
}

Measured memory_bytes: 3616
s = [str(i) for i in input()]
s.sort()
x = s[0]
cnt = 0
for i in range(1,len(s)):
    if x == s[i]:
        cnt = 1
        break
    else:
        x = s[i]
if cnt == 0:
    print('yes')
else:
    print('no')


Measured memory_bytes: 3060
use proconio::input;
use proconio::marker::{Chars};
use std::iter::Iterator;
use std::collections::HashSet;

fn main() {
    input! {
    n: i32,
    }

    let ans = n % 10;

    if ans == 2 || ans == 4 || ans == 5 || ans == 7 || ans == 9 {
        println!("hon");

    }else if ans == 0 || ans == 1 || ans == 6 || ans == 8 {
        println!("pon");

    }else{
        println!("bon");

    }

}


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

int main(){
    int a,b;
    cin >> a >> b;
    string s;
    cin >> s;
    bool ok = false;
    if(s[a] == '-') ok = true;
    int cnt = 0;
    rep(i,a+b){
        if(s[i] == '-') cnt++;
        if(cnt > 1) ok = false;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

vector<int> G[MAX];
int ans;

int dist[MAX];
void dfs(int n, int d) {
    dist[n] = d;
    for (int next : G[n]) {
        if (dist[next] == INF) dfs(next, d + 1);
    }
}

int vis[MAX];
void dfs2(int n, int d) {
    vis[n] = 1;
    if (dist[n] <= d) {
        ans = max(ans, dist[n]);
        return;
    }
    for (int next : G[n]) {
        if (!vis[next]) dfs2(next, d + 1);
    }
    ans = max(ans, dist[n] - 1);
}

int main(){
    int N, v, u;
    cin >> N >> v >> u;
    v--, u--;
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    rep(i, N) dist[i] = INF;
    dfs(u, 0);

    ans = 0;
    dfs2(v, 0);
    cout << ans << endl;
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	FIO();
	double d, t, s; cin >> d >> t >> s;
	double time = d / s;
	//cout << time << '\n';
	if (time <= t)
	{
		cout << "Yes" << '\n';
	}
	else
	{
		cout << "No" << '\n';
	}
	return 0;
}

Measured memory_bytes: 3720
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long int llint;

int main(){
	int N;
	cin >> N;
	llint S[N+1];
	S[0]=0;
	for(int i=1;i<=N;i++){
		llint a;
		cin >> a;
		S[i]=S[i-1]+a;
	}

	llint minCost=-1;
	for(int i=1;i<=N-1;i++){
		llint lenR=S[i];
		llint lenL=S[N]-S[i];
		llint cost=abs(lenR-lenL);
		if(minCost==-1 || cost<minCost){
			minCost=cost;
		}
	}

	cout << minCost << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll M = 1e9 + 7;

int main() {
  int n,k;
  string s;
  cin >> n;
  cin >> s;
  cin >> k;

  char x = s[k-1];
  rep(i,n) if(s[i] != x) s[i] = '*';
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3592
import math
A,B = map(int, input().split())
answerA = math.ceil(A/0.08)
answerAA = math.ceil((A+1)/0.08 -1)
answerB = math.ceil(B/0.1)
answerBB = math.ceil((B+1)/0.1 -1)
if answerA == answerAA:
    if answerA >= answerB and answerA <= answerBB:
        print(answerA)
elif answerB == answerBB:
    if answerB >= answerA and answerB <= answerAA:
        print(answerB)
else:
    if answerB > answerAA:
        print("-1")
    elif answerB == answerAA:
        print(answerAA)
    elif answerA < answerB and answerAA > answerB:
        print(answerB)
    elif answerA == answerB:
        print(answerB)
    elif answerB < answerA and answerBB >= answerA:
        print(answerA)
    elif answerBB < answerA:
        print("-1")
    else:
        print("-1")


Measured memory_bytes: 38384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	a, b := nextInt(), nextInt()
	if a <= 0 && b >= 0 {
		fmt.Println("Zero")
		return
	}

	if a > 0 {
		fmt.Println("Positive")
		return
	}

	if b < 0 {
		cnt := b - a + 1
		if cnt%2 == 0 {
			fmt.Println("Positive")
		} else {
			fmt.Println("Negative")
		}
	}
}


Measured memory_bytes: 640
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] C=new int[N];
		int[] S=new int[N];
		int[] F=new int[N];

		for (int i = 0; i < N-1; i++) {

			C[i]=sc.nextInt();
			S[i]=sc.nextInt();
			F[i]=sc.nextInt();

		}




		for (int i = 0; i < N; i++) {

			int t = 0;

			for (int j = i; j < N-1; j++) {

				if(t<S[j]) {
					t=S[j];
				}else if(t%F[j]==0) {

				}else {
					t=t+F[j]-t%F[j];
				}

				t+=C[j];

			}

			System.out.println(t);

		}

	}

	public static int func(int a,int d,int n) {

		if(n<=a) {
			return a;
		}

		int bunsi=(n-a+d);
		int bunbo=d;

		int index=(bunsi+bunbo-1)/bunbo;

		return a+d*(index-1);
	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

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

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


Measured memory_bytes: 26696
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<ll, ll>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f;
const ll mod = 998244353LL;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
int n;
ll ans;
ll a[N];
priority_queue<pii> q;

void solve()
{
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    sort(a + 1, a + n + 1, greater<ll>());
    if (n == 2)
        return printf("%lld\n", a[1]), void();
    int l = 1, r = 1;
    ans += a[1] + min(a[1],a[2]);
    r = 4;
    q.push({a[2], a[1]});
    q.push({a[3], a[1]});
    q.push({a[3], a[2]});
    for (int i = 4; i <= n; ++i)
    {
        pii now = q.top();
        q.pop();
        ans += now.first;
        q.push({min(a[i], now.first), max(a[i], now.first)});
        q.push({min(a[i], now.second), max({a[i], now.second})});
    }
    cout << ans;
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 9020
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3F3F3F3F;
const int maxn = 2e5 + 555;
const int MOD = 1e9 + 7;
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    cout << fixed;
    int n;
    cin >> n;
    int ans = 0;
    vector<int> V(n);
    for (int &i : V)
        cin >> i;
    for (int i = 0; i < n; i++) {
        ans += (((i + 1) & 1) == 1 && (V[i] & 1) == 1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define o 300005
using namespace std;
int a[o];
char s[o];
int ans,n;
int main(){
	scanf("%d",&n);
	ans=n;
	scanf("%s",s);
	for(int i=0;i<n;i++) a[i]= s[i]=='W'?0:1;
	int cnt=0;
	for(int i=n-1;i;i--) if(a[i]) cnt++;
	for(int i=0;i<n;i++){
		ans=min(ans,cnt);
		if(!a[i]) cnt++;
		if(a[i+1]) cnt--;
	} 
	cout<<ans;
}

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

using namespace std;

typedef long long ll;

map <ll, ll> dp[18][18];
ll A[22];
ll n;

ll f(ll l, ll r, ll x, ll y)
{
	if(l > r) return 0;
	if(l == r) return A[l] * x + A[l] * y;
	if(dp[l][r][x * 10000 + y]) return dp[l][r][x * 10000 + y];
	
	ll ret = 1e18, i;
	
	for(i=l; i<=r; i++){
		ret = min(ret, f(l, i - 1, x, x + y) + f(i + 1, r, x + y, y) + A[i] * (x + y));
	}
	
	return dp[l][r][x * 10000 + y] = ret;
}


int main()
{
	ll i;
	
	scanf("%lld", &n);
	
	for(i=0; i<n; i++){
		scanf("%lld", A + i);
	}
	
	printf("%lld\n", f(1, n - 2, 1, 1) + A[0] + A[n - 1]);
	
	return 0;
}


Measured memory_bytes: 8448
N = int(input())

lv1 = 10
lv2 = 1000
lv3 = 100000

mod1 = 100
mod2 = 10000

if (N / mod1 < 1):
    if (N < lv1):
        print(N)
    else:
        print(lv1 - 1)
elif (N / mod2 < 1):
    if (N < lv2):
        print(N - (mod1 - 1) + (lv1 - 1))
    else:
        print(lv2 - mod1 + lv1 - 1)
else:
    if (N < lv3):
        print(N - (mod2 - 1) + lv2 - mod1 + lv1 - 1)
    else:
        print(lv3 - mod2 + lv2 - mod1 + lv1 - 1)


Measured memory_bytes: 3060
from decimal import Decimal
# round=lambda x:(x*2+1)//2
a,b,c=[int(i) for i in input().split()]
num1=(Decimal(b)/Decimal(c))
if(a%c==0):
    num2=int(Decimal(a)/Decimal(c))-1
else:
    num2=int(Decimal(a)/Decimal(c))

print(int(num1-num2))

Measured memory_bytes: 5588
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
  string a;
  cin>>a;
  if(a=="ABC"){
   cout<<"ARC";
  }
  else{
cout<<"ABC";
  }
}


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

using namespace std;

int n,q;
int edge[100001];
vector<int> G[100001];
int par[100001];
int flag[100001];
char s[100001];
int v[100001];

void init(){
	for(int i=1;i<=n;i++){
		par[i]=i;
		G[i].clear();
	}
	memset(flag,0,sizeof(flag));
}

int find(int x){
	if(par[x]==x)return x;
	return par[x]=find(par[x]);
}

void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x!=y){
		par[x]=y;
	}

}

void unite_dfs(int v,int p){
	if(flag[v]==0)unite(v,p);
	else p=v;
	for(int i=0;i<G[v].size();i++){
		unite_dfs(G[v][i],p);
	}
}

int main(void){
	while(1){
		scanf("%d %d",&n,&q);
		if(n+q==0)break;
		init();
		for(int i=2;i<=n;i++){
			scanf("%d",&edge[i]);
			G[edge[i]].push_back(i);
		}
		flag[1]++;
		for(int i=0;i<q;i++){
			cin >> s[i] >> v[i];
			if(s[i]=='M'){
				flag[v[i]]++;
			}
		}
		unite_dfs(1,1);
		long long res=0;
		for(int i=q-1;i>=0;i--){
			if(s[i]=='Q'){
				res+=(long long)find(v[i]);
			}
			if(s[i]=='M'){
				flag[v[i]]--;
				if(flag[v[i]]==0)unite(v[i],edge[v[i]]);
			}
		}
		printf("%lld\n",res);

	}
	return 0;
}

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

struct node {
    int data;
    node* left, *right;
};

struct node* create(int val) {
    struct  node* root = new node;
    root->data = val;
    root -> left = NULL;
    root -> right = NULL;
    return root;
}

int ans, sum;

void preorder(node* root) {
    if(root != NULL) {
        sum += root -> data;
        if(root -> left == NULL && root -> right == NULL) {
            ans = max(ans, sum);
        }
        preorder(root -> left);
        preorder(root -> right);
        sum -= root->data;
    }
}

int f(int x, int y) {
    if(x == 0 || y == 0) {
        return 1;
    }
    return f(x-1, y) + f(x, y-1);
}

int main() {
    string s;
    cin >> s;
    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << 3 << endl;
    else if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')) cout << 2 << endl;
    else if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R') cout << 1 << endl;
    else cout << 0 << endl; 
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int ans = 3;
if (a == b){
    ans-=1 ;
}
    if (a == c){
        ans-=1;
    }
        if (b == c){
            ans-=1;
        }
            if(ans == 0){
                ans+=1;
}
cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    vector<pii> nums(2*N);
    rep(i,N) cin>>nums[i].first, nums[i].second=0;
    rep(i,N) cin>>nums[i+N].first, nums[i].second=1;
    
    sort(all(nums));
    
    ll total=1;
    int pc=0, pw=0;
    rep(i,2*N){
        if(nums[i].second){
            if(pw){
                total = total*pw%MOD;
                pw--;
            }else{
                pc++;
            }
        }else{
            if(pc){
                total = total*pc%MOD;
                pc--;
            }else{
                pw++;
            }
        }
    }
    cout1(total)
}

Measured memory_bytes: 1920
n, m = gets.split.map(&:to_i)
heights = gets.split.map(&:to_i)
adj = n.times.map{Array.new}
m.times do
  a, b = gets.split.map{|s| s.to_i - 1}
  adj[a].push b
  adj[b].push a
end

count = 0
n.times do |i|
  height = heights[i]
  higher = adj[i].select{|j| heights[j] >= height}
  count += 1 if higher.empty?
end

puts count


Measured memory_bytes: 26988
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define br break
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace2(a,b) cerr <<"a is " << a << " b is " << b << el;
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
ll n , a ;
vl v ;
ll dp[55][2750][55];
ll solve(ll curr , ll sum , ll cnt)
{
    ///cout << "curr is " << curr << " sum is " << sum << " cnt is " << cnt << el ;
    if(curr < 0) return 0 ;
    if(curr == 0){
        if(cnt == 0) return 0;
        ll res = sum % cnt ;
        if(res) return 0 ;
        ll ziz = sum / cnt ;
        if(ziz == a) return 1 ;
    }
    if(dp[curr][sum][cnt] != -1) return dp[curr][sum][cnt] ;
    ll no = solve(curr - 1 , sum , cnt) ;
   /// cout << "here curr is " << curr << " v curr is " << v[curr] << el ;
    ll yes = solve(curr - 1 , sum + v[curr] , cnt + 1) ;
    ll ans = yes + no ;
    dp[curr][sum][cnt] = ans ;
    return ans ;
}
int main()
{
    ios;
    cin >> n >> a ;
    memset(dp , -1 , so dp) ;
    v.pb(-1);
    forn(i , 1 , n ){
       ll x;
       cin >> x;
       v.pb(x);
    }
    sort(all(v));
    ll foo = solve(n ,  0 , 0) ;
    cout << foo << el ;
}



























Measured memory_bytes: 65280
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a=nxt();
    string s;
    cin>>s;
    if(a>=3200)
        cout<<s<<endl;
    else
        cout<<"red\n";
    
    return 0;   
}


 
 


Measured memory_bytes: 256
using System;

class Plogram
{
    static void Main()
    {

        int num = int.Parse(Console.ReadLine());
        
        for(int i=0;i<num;i++)
        {
            for(int j=0;j<num;j++)
            {
                if(num == i*4 + j*7)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
        }

        Console.WriteLine("No");
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;
int main()
{
    string s;
    cin >> s;
    int n = s.size();
    vector<int> l(n + 1), r(n + 1);

    int inc = 0;
    int dec = 0;
    int cur = 0;
    l[0] = 0;
    rep(i, n)
    {
        if (s[i] == '>')
        {
            inc = 0;
        }
        else
        {
            inc++;
        }
        l[i + 1] = inc;
    }
    r[n] = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        if (s[i] == '>')
        {
            dec++;
        }
        else
        {
            dec = 0;
        }
        r[i] = dec;
    }
    ll ans = 0;
    rep(i, n + 1)
    {
        ans += max(l[i], r[i]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4740
import qualified Data.ByteString.Char8 as BC
import qualified Data.IntMap as M
import Data.Maybe (fromJust)
import Data.List

main = do
  [n,h] <- map read . words <$> getLine :: IO [Integer]
  [a, b] <- transpose <$> getInt2DListBC
  let aMax = maximum a
      b' = filter (> aMax) b
      bSum = sum b'
      bSorted = reverse $ sort b'
      remain = h - bSum
      count = if mod remain aMax == 0
                then div remain aMax
                else (+1) $ div remain aMax
  if bSum > h
    then print $ solve h bSorted
    else print $ (length b') + (fromInteger count)

solve :: Integer -> [Integer] -> Integer
solve h [] = 0
solve h (b:bs)
  | h > 0 = 1 + (solve (h-b) bs)
  | otherwise = 0

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getInt2DListBC :: IO [[Integer]]
getInt2DListBC = map (map (toInteger . bsToInt) . BC.words) . BC.lines <$> BC.getContents


Measured memory_bytes: 46460
//g++ -std=c++11 -Wall test.cpp -o test -lm -g -O2
#include <bits/stdc++.h>
using namespace std;
#define sws                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define qi queue<int>
#define si stack<int>
#define s string
#define ll long long;
int sum(int n)
{
    int ans = 0;
    while (n)
    {
        ans += n % 10;
        n /= 10;
    }
    return ans;
}
int main()
{
    sws;
    int n;
    cin >> n;
    string ans = n % sum(n) == 0 ? "Yes\n" : "No\n";
    cout << ans;
}

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

typedef long long ll;
const ll InF = 1e15;


int main() {
  int N,M;
  cin>>N>>M;
  int min_val,max_val;
  min_val = 0;
  max_val = N + 1;
  for (int i = 0; i < M; i++) {
    int l,r;
    cin>>l>>r;
    if (l > min_val) min_val = l;
    if (r < max_val) max_val = r;
  }
  int ans = max_val - min_val + 1;
  if (ans > 0) cout<<ans<<endl;
  else cout<<0<<endl;
  return 0;
}

Measured memory_bytes: 256
X = int(input())

if 400 <= X < 600:
  print('8')
elif 600<= X < 800:
  print('7')
elif 600 <= X < 1000:
  print('6')
elif 800 <= X < 1200:
  print('5')
elif 1000 <= X < 1400:
  print('4')
elif 1200 <= X < 1600:
  print('3')
elif 1400 <= X < 1800:
  print('2')
elif 1800 <= X < 2000:
  print('1')

Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
long int n;
int main()
{
    cin>>n;
    long long a[n+2];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    long long int maxx = a[1];
    long long int sum=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]<maxx)
        {
            sum += maxx-a[i];
        }
        else maxx = a[i];
    }
    cout<<sum;
}


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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int k; cin >> k;
    string s; cin >> s;
    if(k >= (int)(s.length())) cout << s << endl;
    else{
        cout << s.substr(0, k) << "..." << endl;
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <iomanip> 

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    double ans = (double) W * H / 2.0;
    string ans2 = (x * 2 == W && y * 2 == H) ? "1" : "0";

    cout << setprecision(10) << ans << ' ' << ans2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  string s;
  cin >> s;
  sort(s.begin(),s.end());
  if(s[0]==s[1]&&s[1]!=s[2]&&s[2]==s[3])puts("Yes");
  else puts("No");
}

Measured memory_bytes: 256
# cook your dish here
def sum_dig(n):
    sum = 0 
    n=str(n)
    for ele in n:
        sum+=int(ele)
    return sum

ans = 328932998329823983298

n = int(input())

for i in range(1,n):
    ans = min(sum_dig(i)+sum_dig(n-i),ans)
print(ans)    

Measured memory_bytes: 2940
//package abc174;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		
		String str = br.readLine();
		
		int ptr1 = 0;
		int ptr2 = str.length()-1;
		
		long ans = 0;
		
		while(ptr1 < ptr2) {
			if(str.charAt(ptr1) == 'W' && str.charAt(ptr2) == 'W') {
				ptr2--;
			}else if(str.charAt(ptr1) == 'R' && str.charAt(ptr2) == 'R') {
				ptr1++;
			}else if(str.charAt(ptr1) == 'W' && str.charAt(ptr2) == 'R') {
				ans++;
				ptr1++;
				ptr2--;
			}else {
				ptr1++;
				ptr2--;
			}
		}
		
		System.out.println(ans);
	}	

}


Measured memory_bytes: 35968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n,m;
  cin>>n>>m;
  int s[10],c[10];
  for(int i=0;i<m;i++) cin>>s[i]>>c[i];
  
  for(int i=0;i<=999;i++) {
    bool flag=true;
    string num=to_string(i);

    if(n!=num.size()) continue;

    for(int i=0;i<m;i++) {
      if(num[s[i]-1]-'0'!=c[i]) flag=false;
    }

    if(flag) {
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}


Measured memory_bytes: 3696
N, M = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

tenbo = [[] for j in range(N + 1)]

for a, b in AB:
    tenbo[a].append(b)
    tenbo[b].append(a)

ans = 0
for i in range(1, N + 1):
    x = H[i - 1]
    f = True
    for t in tenbo[i]:
        if x > H[t - 1]:
            continue
        else:
            f = False
            break
    if f:
        ans += 1

print(ans)



Measured memory_bytes: 108940