akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define int ll

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

vl s;
pll divide(int l, int r)
{
  ll ok = l, ng = r;
  ll ds = s[r] - s[l-1];

  while(ng - ok > 1){
    ll m = (ok+ng) / 2;
    ll ps = s[m] - s[l-1];
    if(ps*2 <= ds) ok = m;
    else ng = m;
  }

  pll ret1 = mp(s[ok]-s[l-1], s[r]-s[ok]);
  pll ret2 = mp(s[ok+1]-s[l-1], s[r]-s[ok+1]);

//  printf("%d %d %d]\n", l, x, r);

  if(ret1.first-ret1.second > ret2.second-ret2.first){
    return ret1;
  }else{
    return ret2;
  }
}

signed main()
{
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];

  s.resize(n+1, 0);
  rep(i, n) s[i+1] = s[i] + a[i];

  ll ans = inf;
  repi(i, 2, n-1){
    vl v(4);
    pii p = divide(1, i);
    v[0] = p.first;
    v[1] = p.second;
    p = divide(i+1, n);
    v[2] = p.first;
    v[3] = p.second;

/*
    cout << i << " : ";
    rep(j, 4) cout << v[j] << " ";
    cout << endl;
*/

    sort(all(v));
    ans = min(ans, v[3]-v[0]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < int(n); ++ (i))
#define REP_R(i, n) for (int i = (n) - 1; (i) >= 0; -- (i))
#define ALL(x) begin(x), end(x)
using namespace std;
template <class T> inline void chmax(T & a, T const & b) { a = max(a, b); }
 
template <class Monoid>
struct segment_tree {
    typedef typename Monoid::underlying_type underlying_type;
    int n;
    vector<underlying_type> a;
    Monoid mon;
    segment_tree() = default;
    segment_tree(int a_n, underlying_type initial_value = Monoid().unit(), Monoid const & a_mon = Monoid()) : mon(a_mon) {
        n = 1; while (n < a_n) n *= 2;
        a.resize(2 * n - 1, mon.unit());
        fill(a.begin() + (n - 1), a.begin() + ((n - 1) + a_n), initial_value); // set initial values
        REP_R (i, n - 1) a[i] = mon.append(a[2 * i + 1], a[2 * i + 2]); // propagate initial values
    }
    void point_set(int i, underlying_type z) { // 0-based
        a[i + n - 1] = z;
        for (i = (i + n) / 2; i > 0; i /= 2) { // 1-based
            a[i - 1] = mon.append(a[2 * i - 1], a[2 * i]);
        }
    }
    underlying_type range_concat(int l, int r) { // 0-based, [l, r)
        underlying_type lacc = mon.unit(), racc = mon.unit();
        for (l += n, r += n; l < r; l /= 2, r /= 2) { // 1-based loop, 2x faster than recursion
            if (l % 2 == 1) lacc = mon.append(lacc, a[(l ++) - 1]);
            if (r % 2 == 1) racc = mon.append(a[(-- r) - 1], racc);
        }
        return mon.append(lacc, racc);
    }
};
struct plus_monoid {
    typedef int underlying_type;
    int unit() const { return 0; }
    int append(int a, int b) const { return a + b; }
};
 
int policy_1(int n, vector<int> const & a, vector<int> const & b) {
    int b_max = *max_element(ALL(b));
    segment_tree<plus_monoid> l(b_max + 1);  // can be a BIT
    segment_tree<plus_monoid> r(b_max + 1);
    REP (i, n) {
        l.point_set(b[i], l.range_concat(b[i], b[i] + 1) + 1);
        r.point_set(a[i], r.range_concat(a[i], a[i] + 1) + 1);
    }
    int result = 0;
    REP (i, n) {
        chmax(result, n - l.range_concat(0, a[i] + 1) - r.range_concat(b[i], b_max + 1));
    }
    return result;
}
 
int policy_2(int n, vector<int> const & a, vector<int> const & b) {
    int b_max = *max_element(ALL(b));
    vector<int> imos(b_max + 1);
    REP (i, n) {
        imos[a[i]] += 1;
        imos[b[i]] -= 1;
    }
    REP (x, b_max) {
        imos[x + 1] += imos[x];
    }
    return *max_element(ALL(imos));
}
 
int main() {
    // input
    int n; scanf("%d", &n);
    vector<int> a(n), b(n);
    REP (i, n) scanf("%d%d", &a[i], &b[i]);
    // solve
    int s1 = policy_1(n, a, b);
    int s2 = policy_2(n, a, b);
    // output
    printf("%d %d\n", s1, s2);
    return 0;
}

Measured memory_bytes: 6524
#include <bits/stdc++.h>
using namespace std;
#define pD pair <double, double>
#define fr first
#define sc second
#define mp make_pair

int n, l;
deque <pD> Q;
int main()
{
    scanf("%d%d", &n, &l);
    double x = 0, y = 0;
    for (int i = 1; i <= n; ++ i)
    {
        double t, v;
        scanf("%lf%lf", &t, &v);
        if (i == 1)
        {
            Q.push_back(mp(0, 0));
            Q.push_back(mp(v, t * v));
        }
        else
        {
            x -= v;
            y -= 1.0 * t * v;
            while (Q.size() >= 2)
            {
                pD b = Q.back(); Q.pop_back(); pD a = Q.back();
                if (a.fr - x > l) continue;
                Q.push_back(mp(x + l, a.sc + (x + l - a.fr) * (b.sc - a.sc) / (b.fr - a.fr)));
                break;
            }
            while (Q.size() >= 2)
            {
                pD a = Q.front(); Q.pop_front(); pD b = Q.front();
                if ((a.sc - y) * (b.fr - x) < (b.sc - y) * (a.fr - x)) continue;
                Q.push_front(a);
                break;
            }
            Q.push_front(mp(x, y));
        }
        printf("%.10lf\n", (Q.back().sc - y) / (Q.back().fr - x));
    }
}


Measured memory_bytes: 18708
#include <bits/stdc++.h>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    ll t,n,q,m,k,x,y,ss=0,aa=0,b=0,c=0,d=0;
    cin>>n>>m>>k;
    char a[n][m];
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++){
            cin>>a[i][j];
            if(a[i][j]=='#')
                ss++;
        }
    int row[n]={0};
    int col[m]={0};
    for(int i=0;i<n;i++){
        int s=0;
        for(int j=0;j<m;j++){
            if(a[i][j]=='#')
                s++;
        }
        row[i]=s;
    }
    for(int i=0;i<m;i++){
        int s=0;
        for(int j=0;j<n;j++){
            if(a[j][i]=='#')
                s++;
        }
        col[i]=s;
    }
    x = pow(2,n);
    y = pow(2,m);
    for(int i=0;i<x;i++)
        for(int j=0;j<y;j++){
            vector<int> v1,v2;
            for(int p=0;p<10;p++)
                if(i&(1<<p))
                    v1.push_back(p);
            for(int p=0;p<10;p++)
                if(j&(1<<p))
                    v2.push_back(p);
            int val = ss;
            for(int p=0;p<v1.size();p++)
                val -= row[v1[p]];
            for(int p=0;p<v2.size();p++)
                val -= col[v2[p]];
            for(int p=0;p<v1.size();p++)
                for(int q=0;q<v2.size();q++)
                    if(a[v1[p]][v2[q]]=='#')
                        val++;
            if(val==k){
                c++;
                //cout<<i<<" "<<j<<endl;
            }
        }
    cout<<c<<endl;
    return 0;
}







Measured memory_bytes: 4044
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }
        int [] b = new int[n];
        int c = gcd(a[0], a[1]);
        b[0] = c;
        for (int i = 1 ; i < n ; i++) {
            b[i] = gcd(b[i - 1], a[i]);
        }


        System.out.println(b[n-1]);
    }
    private static int gcd(int m, int n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
}


Measured memory_bytes: 51744
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() { cin.tie(nullptr); ios_base::sync_with_stdio(false); }
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

int N, K;
int a[100100];
int dp[100100][2];

int slv(int rem, bool taro)
{
  // printf("rem: %d, %s\n", rem, taro? "taro" : "jiro");
  if(rem <= 0) {
    return taro ? 0 : 1;
  }
  int &ret = dp[rem][taro];
  if (~ret) { return ret; }

  if (taro) {
    ret = 0;
    for (int i = 0; i < N; ++i) {
      if (rem >= a[i]) chmax(ret, slv(rem - a[i], false));
    }
  }
  else {
    ret = 1;
    for (int i = 0; i < N; ++i) {
      if (rem >= a[i]) chmin(ret, slv(rem - a[i], true));
    }
  }
  return ret;
}

signed main()
{
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }

  memset(dp, -1, sizeof(dp));

  cout << (slv(K, true) ? "First" : "Second") << endl;

  return 0;
}



Measured memory_bytes: 7296
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int n;cin>>n;
	ll arr[n];
	for(int i=0;i<n;i++){
		ll a;cin>>a;
		arr[i] = a;
	}
	sort(arr,arr+n);
	vector<pair<ll,ll> > v;
	v.push_back(make_pair(arr[0],1));
	for(int i=1;i<n;i++){
		if(arr[i]==v[v.size()-1].first){
			v[v.size()-1].second++;
		}
		else{
			v.push_back(make_pair(arr[i],1));
		}
	}
	ll ans=0;
	for(int i=0;i<v.size();i++){
		for(int j=i+1;j<v.size();j++){
			for(int k=j+1;k<v.size();k++){
				ll maxi = max(max(v[i].first,v[j].first),v[k].first);
				ll sum = v[i].first + v[j].first + v[k].first;
				if(sum>2*maxi){
					ans += v[i].second*v[j].second*v[k].second;
				}
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;


int main()
{
    int n,m; 
    cin >> n >> m;
    if(n == m){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
h = [int(i) for i in input().split()]
lose = [False]*n
ans = n
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    if lose[u] and lose[v]:
      continue
    elif lose[u] and not lose[v]:
      if h[v] > h[u]:
        continue
      else:
        lose[v] = True
        ans -= 1
    elif not lose[u] and lose[v]:
      if h[u] > h[v]:
        continue
      else:
        lose[u] = True
        ans -= 1
    elif not lose[u] and not lose[v]:
      if h[u] > h[v]:
        lose[v] = True
        ans -= 1        
      elif h[v] > h[u]:
        lose[u] = True
        ans -= 1        
      elif h[v] == h[u]:
        lose[u] = True
        lose[v] = True
        ans -= 2
print(ans)

Measured memory_bytes: 83680
n = int(input())
for i in range(n):
    a,b= map(int, input().split( ))

    #解説参照
    #何度見ても解けない
    #どちらかは高橋君より良い
    #a<=bとする
    #a=b (1~a-1)*2
    #a<b c**2<abとする
    #c(c+1)>=ab？2c-2 / 2c-1

    if a==b:
        print(2*a-2)
    else:
        c = int((a*b)**(1/2))
        if c*c==a*b:
            c -= 1
        if c*c+c>=a*b:
            print(2*c-2)
        else:
            print(2*c-1)


Measured memory_bytes: 38480
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 200005;
const int inf = 1e9 + 5;
int n, k, c;
string s;
int levo[maxn], desno[maxn];
int main()
{
	cin >> n >> k >> c >> s;
	levo[0] = -inf; 
	int brojac = 1;
	for(int i=0;i<n;i++){
		if(s[i] == 'o' && i - levo[brojac - 1] - 1 >= c && brojac <= k)levo[brojac++] = i;
	}
	desno[k + 1] = inf;
	brojac = k;
	for(int i=n-1;i>=0;i--){
		if(s[i] == 'o' && desno[brojac + 1] - i - 1 >= c && brojac >= 0)desno[brojac--] = i;
	}
	for(int i=1;i<=k;i++){
		if(levo[i] == desno[i])cout << levo[i] + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3332
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

guchoku=0
for i,b in enumerate(B):
    t = A[i] - b
    if t <= -1:
        zen = max(A[i+1] + t, 0)
        guchoku += A[i+1] - zen
        A[i+1] = zen
    guchoku += min(A[i], b)
print(guchoku)


Measured memory_bytes: 18604
#include<bits/stdc++.h>
using namespace std;
char arr[1002][1002];
long long int dp[1001][1001];
long long int path( int i, int j)
{ if(arr[i-1][j-1]=='#') return 0;
  if(i==1&&j==1) return 1;
  if(dp[i][j]!=-1) return dp[i][j];
  if(i==1)
  dp[i][j]= path(i,j-1)%(1000000000+7);
  else if(j==1)
  dp[i][j]= path(i-1,j)%(1000000000+7);
  else
  dp[i][j]= (path(i-1,j)+path(i,j-1))%(1000000000+7);
  return dp[i][j];
}
int main()
{int H,W;
cin>>H>>W;
for(int i=0;i<H;++i)
for(int j=0;j<W;++j)
cin>>arr[i][j];
memset(dp,-1,sizeof(dp));
long long int result=path(H,W);

cout<<result;
	
	
	
}

Measured memory_bytes: 9216
N,Z,W=map(int,input().split())
A=list(map(int,input().split()))
A.append(Z)
A.append(W)


dpx=[[0 for j in range(0,N+2)] for k in range(0,N+1)]
dpy=[[0 for j in range(0,N+2)] for k in range(0,N+1)]

for i in range(0,N+2):
    dpx[N-1][i]=abs(A[N-1]-A[i])
    dpy[N-1][i]=abs(A[N-1]-A[i])


for i in range(1,N):
    for j in range(0,N+2):
        I=N-1-i
        dpx[I][j]=max(dpy[I+1][I],dpx[I+1][j],abs(A[N-1]-A[j]))
        dpy[I][j]=min(dpx[I+1][I],dpy[I+1][j],abs(A[N-1]-A[j]))

print(dpx[0][N+1])

Measured memory_bytes: 112092
import collections
n, m = [int(i) for i in input().split()]
todc = collections.defaultdict(lambda: [])
lendc = collections.defaultdict(lambda: -1)


for k in range(m):
    i, j = [int(n) for n in input().split()]
    todc[j] += [i]


def maxlen(n):
    if len(todc[n]) == 0:
        lendc[n] = 0
        return 0
    else:
        m = 0
        for i in todc[n]:
            if lendc[i] == -1:
                lendc[i] = maxlen(i)
            m = max(m, lendc[i]+1)
        return m
       

def maxlen_stack(org_n):
    stack = [org_n]
    while stack:
        n = stack.pop()
        if lendc[n] != -1:
            continue        
        if len(todc[n]) == 0:
            lendc[n] = 0
        else:
            m = 0
            recursive = []
            for i in todc[n]:
                if lendc[i] == -1:
                    recursive.append(i)
                else:
                    m = max(m, lendc[i]+1)
            if recursive:
                stack += [n] + recursive
            else:
                lendc[n] = m         
    return lendc[org_n]

k = 0
for i in range(1, n+1):
    if lendc[i] == -1:
        #lendc[i] = maxlen(i)
        lendc[i] = maxlen_stack(i)
    k = max(k, lendc[i])
print(k)


Measured memory_bytes: 42320
m=-1e9
n=int(raw_input())
N=range(n)
B=[[0]*(n+1) for _ in range(n+1)]
for _ in N:
  A=map(int,raw_input().split())
  for j in N:
    s=0
    for k in N[j:]:
      s+=A[k]
      B[j][k]=max(B[j][k],0)+s
      m=max(B[j][k],m)
print m

Measured memory_bytes: 4516
#include<cstdio>
#include<iostream>

using namespace std;

int main(void){
	
	int a=0,b=0,c=0,d=0,e=0,k=0;
	
	cin>>a>>b>>c>>d>>e>>k;
	
	if(e-a<=k)
		cout<<"Yay!"<<endl;
	else
		cout<<":("<<endl;	
	
	
	return 0;
}

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

const int inf = 1e15 + 10, N = 3e5 + 10;
int a[N], n;
long long dp[N][6], ans = inf;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
		
	for (int i = 0; i < n; i++)
		for (int j = 0; j < 5; j++)
			dp[i][j] = inf;
		
	for (int i = 0; i < n; i++){
		for (int j = 0; j < 5; j++){
			int w = 0;
			if(a[i] == 0 && j != 0 && j != 4)
				w = 1 + (j % 2);
			else if(j == 2 && a[i] % 2 == 0)
				w = 1;
			else if((j == 1 || j == 3) && a[i] % 2 != 0)
				w = 1;
			else if((j == 0 || j == 4))
				w = a[i];
				
			for (int k = 0; k <= j; k++)
				dp[i][j] = min(dp[i - 1][k] + w, dp[i][j]);	
		}
	}
	
	for (int i = 0; i < 5; i++)
		ans = min(ans, dp[n - 1][i]);
	
	cout << ans;
}

Measured memory_bytes: 13184
#include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int main() {
    int n;
    while((cin>>n)){
        if(n==0){
            break;
        }
        int a[n];
        for(int i=0; i<n; i++){
            cin >> a[i];
        }
        
        int max = -99999999;
        for(int i=0; i<n; i++){
            int sum=0;
            for(int j=i; j<n; j++){
                sum += a[j];
                if(max<sum){
                    max=sum;
                }
            }

        }
        cout<<max<<endl;
    }
    return 0;
}

Measured memory_bytes: 1168
s = input()
p = 2019
t = 1
y = 0
c = [0] * p
c[0] = 1
for x in map(int, s[::-1]):
    y = (y + t*x) % p
    c[y] += 1
    t = (t*10) % p
print(sum(i*(i-1)//2 for i in c))


Measured memory_bytes: 9216
#include <bits/stdc++.h>
//#define int ll
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int MAX = 1e5 + 10;
using namespace std;

void solve() {
    string s,t;
    cin>>s>>t;
    int maxn=-1;
    for (int i = 0; i <=s.size()-t.size(); ++i) {
        int sum=0;
        for (int ii=i,j = 0; j < t.size(); ++j,++ii) {
            if (s[ii]==t[j])sum++;
        }
        if (maxn<sum)maxn=sum;
    }
    cout<<t.size()-maxn<<endl;
}

signed main() {
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int _ = 1;
//    cin>>_;
    while (_--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3592
import java.io.*;
import java.util.*;
import java.util.function.*;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer in=new StringTokenizer("");
		int n=Integer.parseInt(br.readLine());
		Map<String,Long> mp=new HashMap<>();
		Consumer<String> fun=(s)->mp.put(s, mp.getOrDefault(s, 0L)+ 1L);
		for(int i=0;i<n;i++)fun.accept(Arrays.toString(br.readLine().chars().mapToObj(it -> (char) it).sorted().toArray()));
		System.out.println(mp.values().stream().mapToLong(it -> it * (it - 1) / 2).sum());
	}
}

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

string str;
void solve() {
	cin >> str;
	int index = str.length();
	index -=2;
	while (index > 0) {
		if (str.substr(0, index/2) == str.substr(index/2, index/2)) {
			cout << index << endl;
			break;
		}
		index-=2;
	}
}
int main() {
	solve();
	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<min(b/a,c)<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3568
{-# LANGUAGE MultiWayIf #-}
import Data.List (sort,group)
import Control.Arrow ((&&&))

main = do
  n <- read <$> getLine :: IO Int
  as <- map (head&&&length).group.sort.map read.words <$> getLine :: IO [(Int,Int)]
  putStrLn $ case length as of
    1 -> let m = (fst.head) as
         in if | m == 1 -> "Yes"
               | m == n-1 -> "Yes"
               | n `div` m > 1 -> "Yes"
               | otherwise -> "No"
    2 -> let [(s,i),(t,j)] = as
         in if | s == t-1 && s==i -> "Yes"
               | s == t-1 && s<i -> "No"
               | s == t-1 && (n-i)`div`(s-i+1) > 1 -> "Yes"
               | otherwise -> "No"
    _ -> "No"


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=0,a,b,c,d,cmpx[10000000],cmpy[10000000],cmp[10000000],m,h,w,x,y,sum=0,pos,q;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

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

       cin >> h >> w >> d;
       rep(i,h){
           rep(j,w){
               cin >> a;
               cmpx[a]=j;
               cmpy[a]=i;
           }
       }
       rrep(i,d+1,h*w+1){
           cmp[i]=cmp[i-d]+Abs(cmpx[i],cmpx[i-d])+Abs(cmpy[i],cmpy[i-d]);
       }
       cin >> q;
       rep(i,q){
           cin >> b >> c;
           Cout(cmp[c]-cmp[b]);
       }
       
return 0;
}


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

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

  int ans = 0;
  int a = 1;
  rep(i, n+1){
    int a = i;
    int count = 0;
    while(a != 0) { a /= 10; count++; }
    if ((count % 2) == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<algorithm>
#include<cassert>
using namespace std;
typedef long long ll;
int N,M,Q;
ll s[4000];
string t[4000];

ll func(string str){
  ll res=0;
  for(int i=0;i<(int)str.size();i++)
    if(str[i]=='1')res+=(1LL<<i);
  return res;
}

int main(){
  char change[36];
  change[0]='0';
  for(int i=1;i<10;i++)change[i]=change[i-1]+1;
  change[10]='A';
  for(int i=11;i<36;i++)change[i]=change[i-1]+1;

  while(1){
    cin>>N>>M>>Q;
    if(N==0&&M==0&&Q==0)break;
    for(int i=0;i<Q;i++){
      string str;
      cin>>str>>t[i];
      s[i]=func(str);
      if(i)s[i]=s[i]^s[i-1];
    }

    for(int i=0;i<M;i++){
      ll f=(1LL<<N)-1;
      for(int j=0;j<Q;j++){
	if(t[j][i]=='1'){
	  f=f&s[j];
	}else {
	  f=f&(~s[j]);
	}
      }
      assert(__builtin_popcountll(f)!=0);
      if(__builtin_popcountll(f)==1){
	int ans=0;
	for(ans=0;ans<N;ans++){
	  if(f==(1LL<<ans))break;
	}
	cout<<change[ans];
      }else{
	cout<<'?';
      }
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 2296
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int r = sc.nextInt();
    int a = 0;

    if(n>=10){
      System.out.println(r);
    }else{
      a = r+(100*(10-n));
      System.out.println(a);
    }
  }
}


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

typedef long long Int;
typedef pair<int,Int> PII;
typedef vector<int> VInt;
 
#define FOR(i, a, b) for(i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(i = (a) - 1; i >= (b); --i)
#define EACH(it, a) for(auto it = (a).begin(); it != (a).end(); ++it)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
#define MP make_pair

#define LIMIT 12

vector<PII> R[1 << 18];
int V[1 << 18];
int W[1 << 18];

Int f(int a, VInt& v, int pos, Int limit, Int value)
{
    if(limit < 0) return 0;
    if(pos == -1)
    {
        auto p = lower_bound(ALL(R[a]), PII(limit + 1, 0));
        --p;
        return p->second + value;
    }
    return max(f(a, v, pos - 1, limit, value), f(a, v, pos - 1, limit - W[v[pos]], value + V[v[pos]]));
}

void solve(int test)
{
    int n, q;
    cin >> n;
    int i, j;
    FOR(i, 0, n) cin >> V[i] >> W[i];
    cin >> q;
    vector<PII> vq(q);
    FOR(i, 0, q) cin >> vq[i].first >> vq[i].second;

    R[0].push_back(PII(0, 0));
    R[0].push_back(PII(W[0], V[0]));
    FOR(i, 1, (1 << LIMIT) - 1)
    {
        vector<PII>& a = R[(i - 1) >> 1];
        vector<PII> b = a;
        FOR(j, 0, SIZE(b))
        {
            b[j].first += W[i];
            b[j].second += V[i];
        }
        int ia = 0, ib = 0;
        Int mx = 0;
        while(ia < SIZE(a) || ib < SIZE(b))
        {
            if(ia < SIZE(a) && ib < SIZE(b) && a[ia].first == b[ib].first)
            {
                R[i].push_back(max(a[ia], b[ib]));
                ++ia;
                ++ib;
            }
            else if(ia < SIZE(a) && (ib == SIZE(b) || a[ia].first < b[ib].first))
            {
                R[i].push_back(a[ia]);
                ++ia;
            }
            else
            {
                R[i].push_back(b[ib]);
                ++ib;
            }
            R[i].back().second = max(R[i].back().second, mx);
            mx = max(mx, R[i].back().second);
        }
    }

    FOR(i, 0, q)
    {
        int a = vq[i].first - 1;
        Int limit = vq[i].second;

        VInt t;
        while(a >= (1 << LIMIT) - 1)
        {
            t.push_back(a);
            a = (a - 1) >> 1;
        }

        cout << f(a, t, SIZE(t) - 1, limit, 0) << endl;
    }
}

int main()
{
    int T = 1, t;
    //cin >> T;
    FOR(t, 0, T) solve(t);
    return 0;
}


Measured memory_bytes: 188052
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
bingo=[[False]*3 for i in range(3)]
for i in range(N):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if(A[j][k]==b):
                bingo[j][k]=True
for i in range(3):
    if(bingo[i]==[True]*3):
        print("Yes")
        exit()
for j in range(3):
    if(bingo[0][j]==True and bingo[1][j]==True and bingo[2][j]==True):
        print("Yes")
        exit()
if(bingo[0][0]==True and bingo[1][1]==True and bingo[2][2] ==True):
    print("Yes")
    exit()
elif(bingo[0][2]==True and bingo[1][1]==True and bingo[2][0]==True):
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 200010;

// aのn乗を求める。計算量はO(logn)
ll modpow(ll a, ll n) {
    if(n == 0) {
        return 1;
    }
    if(n%2 == 1) {
        return (a * modpow(a, n-1))%mod;
    }
    return (modpow(a, n/2) * modpow(a, n/2))%mod;
}

ll inverse(ll a) {
    return modpow(a, mod-2);
}

ll inv[MAX_N];  // inv[i] : iの逆数のmod
ll fact[MAX_N];  // fact[i] : iの階乗のmod
ll invfact[MAX_N];

void init() {
    inv[0] = fact[0] = invfact[0] = 1;
    inv[1] = 1;
    for(ll i = 1; i < MAX_N; i++) {
        if(i >= 2) {
            inv[i] = mod - inv[mod%i]*(mod/i)%mod;
        }
        fact[i] = (i*fact[i-1])%mod;
        invfact[i] = inverse(fact[i]);
    }
}
 
ll Comb(ll n, ll r) {
    if(r < 0 || n < 0 || n < r) {
        return 0;
    }
    ll res = fact[n];
    res = (res * invfact[r])%mod;
    res = (res * invfact[n-r])%mod;
    return res;
}

//--- main関数でinit()を呼び出すのを忘れるな ---//

// 素因数分解。計算量はO(√n)
map<ll, ll> primefactor(ll n) {  // (nのi番目の素因数, その素因数の個数)のmapを返す(n = 720 = (2^4)*(3^2)*(5^1)なら{(2, 4), (3, 2), (5, 1)}のように)
    map<ll, ll> res;
    for(ll i = 2; i*i <= n; i++) {
        while(n%i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) {
        res[n] = 1;
    }
    return res;
}

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

    init();

    map<ll, ll> mp = primefactor(m);
    ll ans = 1;
    for(auto p : mp) {
        ll k = p.second;
        ans *= Comb((n-1)+k, k);
        ans %= mod;
    }

    out(ans);
    re0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int n,p; cin >> n >> p;
    string s; cin >> s;
    if(p==2){
        ll ans=0;
        rep(i,n){
            if((s[i]-'0')%2==0) ans+=i+1;
        }
        cout << ans << endl;
    }else if(p==5){
        ll ans=0;
        rep(i,n){
            if((s[i]-'0')==0||(s[i]-'0')==5) ans+=i+1;
        }
        cout << ans << endl;
    }else{
        map<ll,ll> mp;
        mp[0]++;
        ll res=0;
        ll ans=0;
        ll k=1;
        for(int i=n-1;i>=0;i--){
            res+=(s[i]-'0')*k;
            res%=p;
            ans+=mp[res];
            mp[res]++;
            k*=10;  k%=p;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 1028
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    string S;
    cin >> S;
    const int slen = (int) S.size();

    // dp[i][j]: the last position from position j after 2^i steps
    vector<vector<int>> dp(21, vector<int>(slen));
    for (int i = 0; i < slen; i++) {
        if (S[i] == 'R') {
            dp[0][i] = i + 1;
        } else {
            dp[0][i] = i - 1;
        }
    }

    for (int i = 0; i < 20; i++) {
        for (int j = 0; j < slen; j++) {
            dp[i + 1][j] = dp[i][dp[i][j]];
        }
    }

    vector<int> pos(slen, 1);

    // 10^5 = 2^5 + 2 ^7 + 2^9 + 2^10 + 2^15 + 2^16
    vector<int> as = {5, 7, 9, 10, 15, 16};
    for (auto a : as) {
        vector<int> tmp_pos(slen, 0);
        for (int i = 0; i < slen; i++) {
            tmp_pos[dp[a][i]] += pos[i];
        }
        pos = move(tmp_pos);
    }

    vector<int> ans = move(pos);
    cout << ans[0];
    for (int i = 1; i < slen; i++) {
        cout << " " << ans[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 12364
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;

signed main() {
    int N;
    cin >> N;
    int R_count =0;
    int B_count =0;
    RANGE(i,N){
        char s;
        cin >> s;
        if(s=='R')R_count++;
        else B_count++;
    }
    if(R_count > B_count) cout << "Yes" <<endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
def main():
    s = input()
    K = int(input())
    lst = sorted(set(s))
    ans = []

    def dfs(sub):
        if len(ans) < K:
            ans.append(sub)
            for c in lst:
                if sub + c in s:
                    return dfs(sub + c)
        return

    for c in lst:
        dfs(c)
    print(ans[-1])
    return


main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=300001 ;
ll  power(ll  i,ll  j)
{
    if(i==0)
        return 0 ;

    if(j==0)
    return 1 ;
    ll t=power(i,j/2)%maa ;
    if(j%2==0)
    return (t%maa*t%maa)%maa ;
    else
    return ((t%maa*t%maa)%maa*(i%maa)%maa)%maa ;
}
int main()
{
   fast ;
   ll n,k ;
   cin>>n>>k ;
   ll d[k+1] ;
   d[k]=1 ;

   for(ll i=k-1;i>=1;i--)
   {
       d[i]=power(k/i,n) ;
       for(ll j=2*i;j<=k;j+=i)
       {
           d[i]=(d[i]-d[j])%maa ;
           d[i]+=maa ;
           d[i]%=maa ;
       }

   }
   ll ans=0 ;
   for(ll i=1;i<=k;i++)
   {
       ll x=i*d[i] ;
      // cout<<i<<" "<<d[k/i]<<endl ;
       x%=maa ;
       ans=(ans+x)%maa ;
   }
   cout<<ans ;



}



Measured memory_bytes: 4424
#include <iostream>
#define INF 1000000
#define MAX 101

using namespace std;
int cost[MAX][MAX];
int mincost[MAX];
bool used[MAX];
int V;
int prim(){
  for(int i = 0 ; i < V ; ++i ){
    mincost[i] = INF;
    used[i] = false;
  }
  mincost[0] = 0;
  int res = 0;
  while(true){
    int v = -1;
    for(int u = 0 ; u < V ; ++u ){
      if(!used[u] && (v == -1 || mincost[u] < mincost[v]))v = u;
    }
    if(v == -1)break;
    used[v] = true;
    res += mincost[v];
    for(int u = 0 ; u < V ; u++ ){
      mincost[u] = min(mincost[u],cost[v][u]);
    }
  }
  return res;
}
int main(){
  int m;
  while( cin >> V >> m ,V+m){
  for(int i = 0 ; i < V ; i++ ){
    for(int j = 0 ; j < V ; j++ ){
      cost[i][j] = INF;
    }
  }
  for(int i = 0 ; i < m ; i++ ){
    int a,b,c;
    cin >> a >> b >> c;
    cost[a][b] = cost[b][a] = c;
  }
  cout << prim() << endl;
  }
  return 0;
}

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

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ull unsigned long long
#define rep(n) for(ll i = 0 ; i<n ; i++) 
#define rep2(n) for(ll j=0 ; j<n ; ++j )
#define repd(n) for(ll i = n-1 ; i>=0 ; i--)
#define MOD 1000000007
#define pii pair<ll,ll>
#define vll vector<ll>
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); 
#define nl "\n"
#define INF 0x3f3f3f3f
#define sz(a) a.size() 
#define all(a) a.begin(),a.end()
#define M 998244353

void solve() {
	int n,a,b; cin>>n>>a>>b;
	int c=0;
	rep(n) {
		int tmp; cin>>tmp;
		if(tmp>=b || tmp<a) ++c;
	}
	cout << c << nl ;
}


int main() {

    fast ; 
	ll t=1;
	// cin>>t;
	while(t--) {
		solve() ; 
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=b-1; (ll)(a)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
string YES[2] = {"NO", "YES"};
string yes[2] = {"No", "Yes"};

int main(){
    ll n, m;    cin >> n >> m;
    vector<ll> x(m);
    rep(i, m)   cin >> x[i];
    sort(ALL(x));
    vector<ll> dis;
    rep(i, m-1) dis.push_back(abs(x[i+1]-x[i]));
    sort(ALL(dis));
    ll res=0;
    rep(i, dis.size()-n+1) res += dis[i];
    cout << res << endl;
}


Measured memory_bytes: 5036
#include<stdio.h>
int main(void)
{
  int flag=0,i,N,S,a[100000];


  scanf("%d",&N);

  if(N-90 > 0){
    flag=1;
  }

  while(N-10 > 0){
    N=N-10;
  }

  if(N==9){
    flag=1;
  }

  
  if(flag == 1){
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  
  return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

signed main(){
	int N;
	cin>>N;
	vint ub(N,1001001001);
	rep(i,N-1){
		int b;cin>>b;
		chmin(ub[i],b);
		chmin(ub[i+1],b);
	}
	cout<<accumulate(all(ub),0ll)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX 1000
#define NIL -1

int n;

int max(int x, int y){
  if(x > y)return x;
  else return y;
}


int lcs(char s1[MAX+1], char s2[MAX+1]){

  int C[MAX+1][MAX+1],i,j;
  int m = strlen(s1);
  int n = strlen(s2);
  int maxl = 0;
  char str1[MAX+1],str2[MAX+2];

  
  
  for(i=0; i<m; i++)C[i][0] = 0;
  for(j=0; j<n; j++)C[0][j] = 0;

  for(i=1; i<=m; i++){
    for(j=1; j<=n; j++){
      if(s1[i-1] == s2[j-1]) C[i][j] = C[i-1][j-1]+1;
      else C[i][j] = max(C[i-1][j], C[i][j-1]);
      maxl = max(maxl, C[i][j]);
    }
  }
  return maxl-1;
}


int main(){
  int i,j;
  char s1[MAX+1],s2[MAX+1];
  scanf("%d",&n);

  for(i=0; i<n; i++){
    scanf("%s",s1);
    scanf("%s",s2);
    printf("%d\n",lcs(s1,s2)+1);  
  }
  return 0; 
}



Measured memory_bytes: 5696
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
        var tmp = ReadIntArray();
        int a = tmp[0], b = tmp[1], x = tmp[2];
        bool cond = a <= x && x <= a+b;
        WriteLine(cond ? "YES" : "NO");
    }
}


Measured memory_bytes: 13396
def main():
    import heapq

    x, y, z, k, *abc = map(int, open(0).read().split())
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:]
    d = []

    a.sort(reverse=True)
    b.sort(reverse=True)
    c.sort(reverse=True)

    h = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
    heapq.heapify(h)
    ans = []
    for _ in range(k):
        p, i, j, k = heapq.heappop(h)
        ans.append(-p)
        for p, q, r in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]:
            if i + p < x and j + q < y and k + r < z:
                if (i + p, j + q, k + r) not in d:
                    d.append((i + p, j + q, k + r))
                    v = - (a[i + p] + b[j + q] + c[k + r])
                    heapq.heappush(h, (v, i + p, j + q, k + r))

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 4852
#include <iostream>
#include <algorithm>

using namespace std;

int H, W;
int h, w;

int main()
{
    cin >> H;
    cin >> W;
    cin >> h;
    cin >> w;
    cout << (H * W) - (h * W) - (w * H) +(w * h);

    return 0;
}



Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

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

        S = S.replaceAll("eraser", "-");
        S = S.replaceAll("erase", "-");
        S = S.replaceAll("dreamer", "-");
        S = S.replaceAll("dream", "-");
        S = S.replaceAll("-", "");

        PrintWriter out = new PrintWriter(System.out);

        if (S.length() == 0) {
            out.println("YES");
        } else {
            out.println("NO");
        }

        sc.close();
        out.flush();
    }
}

Measured memory_bytes: 43464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};



int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;cin >> a >> b;
	if(a<b) cout << 0 << endl;
	else cout << 10 << endl;
}


Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == 1)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(vector<int>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}


int heap[1000], sz = 0;


void solve(void)
{
  int N;
  cin>>N;
  int K;
  cin>>K;
  double ANS = 0;
  for (int i = 1; i <= N; i++)
  {
    double Target = double(K)/double(i);
    double D_TIME =log(Target)/log(2);
    // DEBUG(D_TIME);
    D_TIME = ceil(D_TIME);
    D_TIME = max((double)0,D_TIME);
    double Prob = pow(0.5,D_TIME);
    // DEBUG(Target);
    ANS +=  Prob/(double)(N);
  }
  cout<<ANS<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  for(int i=0; i<N; i++) cin >> H.at(i);
  int ans=1;
  for(int i=1; i<N; i++){
    int cnt=0;
    for(int j=0; j<i; j++){
      if(H.at(j)<=H.at(i)) cnt++;
    }
    if(cnt==i) ans++;
  }
  cout << ans << endl;
}

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

int main(){
  int n; cin >>n;
  int sum = 0;
  vector<int> s(n);
  rep(i,n){
    cin >>s[i];
    sum += s[i];
  }
  if(sum%10!=0){
    cout << sum << endl;
    return 0;
  }
  sort(s.begin(), s.end());
  rep(i,n){
    if((sum-s[i])%10!=0){
      cout << sum - s[i] << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0; 
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 1e9 + 7;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> muls;
    for (int i = 1; i*i <= m; ++i) {
        if (m%i == 0) {
            muls.push_back(i);
            muls.push_back(m/i);
        }
    }   
    sort(all(muls));
    int di = upper_bound(all(muls), m/n) - muls.begin(); 
    cout << muls[di-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
int n,d[300000],m,t[300000];
int main(){
	cin >> n;
	REP(i,n)
		cin >> d[i];
	cin >> m;
	REP(i,m)
		cin >> t[i];

	map<int,int> s;
	REP(i,n){
		if(s.find(d[i]) == s.end()){
			s[d[i]] = 1;
		}else{
			s[d[i]]++;
		}
	}

	REP(i,m){
		if(s.find(t[i]) == s.end() || s[t[i]] < 1){
			cout << "NO" << endl;
			return 0;
		}else{
			s[t[i]]--;
		}
	}
	cout << "YES" << endl;
	return 0;
}


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


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

  vector<vector<int>> table(26, vector<int>(26));
  string s, t;
  cin >> s >> t;
  int n = s.size();
  for(int i = 0; i < n; i++) {
  	table[s[i] - 'a'][t[i] - 'a']++;
  }
  for(int i = 0; i < 26; i++) {
  	int cnt = 0;
  	bool flag = true;
  	for(int j = 0; j < 26; j++) {
  		if(table[i][j] != 0) {
  			cnt++;
  		}
  	}
  	if(cnt != 1 && cnt != 0){
  		flag = false;
  	}
  	cnt  = 0;
  	for(int j = 0; j < 26; j++) {
  		if(table[j][i] != 0) {
  			cnt++;
  		}
  	}
  	if(cnt != 1 && cnt != 0) {
  		flag = false;
  	}
  	if(!flag) {
  		cout << "No" << endl;
  		return 0;
  	}
  }
  cout << "Yes" << endl;
  return 0;
}	


Measured memory_bytes: 916
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		HashMap<Integer, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (map.containsKey(a)) {
				map.put(a, map.get(a) + 1);
			} else {
				map.put(a, 1);
			}
		}
		Integer[] arr = map.values().toArray(new Integer[0]);
		Arrays.sort(arr);
		int ans = 0;
		for (int i = 0; i < arr.length - k; i++) {
			ans += arr[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 99040
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	char  a[3];
	int i;

	for (auto i = 0; i < 3; i++) {
		cin >> a[i];
	}
	
	if (a[0] == a[1] && a[1] == a[2]) {
		cout << "No";
	}
	else {
		cout << "Yes";
	}

}


Measured memory_bytes: 256