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

using ull = unsigned long long;
using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define IN1(x) ll x; cin >> x;

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll temp = gcd(a, b); return temp ? (a / temp * b) : 0; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

template <typename T>
vector<T> pows(int n) {
    vector<T> ret;
    T x = 1;
    while (ret.size() < n) {
        ret.push_back(x);
        x *= 10;
    }
    return ret;
}

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

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }

template <typename T>
void out(T o) { cout << o << endl; }
template <typename T>
void out(vector<T> &out) { REP(i, (int)out.size()) { cout << out[i]; if (i == (int)out.size() - 1) cout << endl; else cout << " "; } }



int main(void)
{
    cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);

    IN1(A); IN1(B);

	bool ex = false;
	FOR(i, 1, 4) {
		if (odd(A * B * i)) ex = true;
	}
	if (ex) out("Yes");
	else out("No");

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <map>
#include<cmath>
#include <queue>
#include <numeric>

using lli = long long int;
int inf = 1000000007;
using namespace std;

int N;

int main()
{
	cin >> N;
	vector<lli> A(N);
	vector<lli> B(N);
	for (int i = 0; i < N; i++)cin >> A[i];
	sort(A.begin(), A.end());
	B[0] = A[0];
	for (int i = 1; i < N; i++)B[i] += A[i] + B[i - 1];
	int ans = 1;
	for (int i = N - 2; i >= 0; i--)
		if (A[i + 1] <= B[i] * 2)ans++;
		else break;
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
#define INF 1e+9
#define MAX_V 10000

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

void dijkstra(int s,vector<vector<pair<int,long double>>> &G,vector<long double> &d) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d.begin(), d.end(), (long double)4000000000);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (pair<int,long double> e: G[v]) {            
            if (d[e.first] > d[v] + e.second) {
                d[e.first] = d[v] + e.second;
                que.push(P(d[e.first], e.first));
            }
        }
    }
}
int main(){
  long double sx,sy,gx,gy;
  cin >> sx >> sy >> gx >> gy;
  int n;
  cin >> n;
  long double x[n+2];
  long double y[n+2];
  long double z[n+2];
  rep(i,n)cin >> x[i+1] >> y[i+1] >> z[i+1];
  n+=2;
  x[0]=sx;
  y[0]=sy;
  z[0]=(long double)0;
  x[n-1]=gx;
  y[n-1]=gy;
  z[n-1]=(long double)0;
  vector<vector<pair<int,long double>>> g(n);
  rep(i,n){
    rep(j,n){
      if(i==j)continue;
      else g[i].push_back(make_pair(j,max((long double)0,sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-(z[i]+z[j]))));
    }
  }
  vector<long double> d(n);
  dijkstra(0,g,d);
  cout << fixed << setprecision(10);
  cout << d[n-1] << endl;
}


Measured memory_bytes: 37596
/*
______________________________
                              |
Shubham Singhal               |
                              |
CodeChef          torque      |
HackerEarth       torque      |
SPOJ              torque      |
HackerRank        torquecode  |
CodeForces        torquecode  |
______________________________| */


// If Tyrion dies, I am gonna riot :P


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

# define MOD         1000000007
# define gc          getchar
# define LL          long long
# define L           long
# define pb          push_back
# define mp          make_pair
# define vi          vector<int>
# define MAXN        100005
# define INF         1e9

LL solve(LL n,LL x)
{
    LL dist=0;

    if(n%x==0)
    {
        LL d=n/x;
        dist=(2*d-1)*x;
        return dist;
    }
    else
    {
        LL mod=n%x,tn;
        tn=n-mod;
        LL td=tn/x;
        dist=(2*td-1)*x;
        dist+=solve(x,mod)+x;
        return dist;
    }



    /*if(2*x==n)
    {
        return x;
    }

    if((n-x)%(2*x)==0)
    {
        LL total=(n-x)/(2*x);
        dist=(total*3*x);
        return dist;
    }
    LL total=(n-x)/(2*x);
    dist=total*3*x;
    LL mod=(n-x)%(2*x);
    dist+=x;
    if(x%mod==0)
    {
        LL temp=x/mod;
        dist+=(temp*2-1)*mod;
        return dist;
    }
    else
    {
        LL temp=x/mod;
        LL m=x%mod;
        if(temp%2==0)
        {
            dist+=(2*temp*mod);
            dist+=solve(mod+m,m);
        }
    }*/



}
int main()
{
    LL n,x,dist=0,rem;
    cin>>n>>x;
    LL ans=solve(n-x,x)+n;
    cout<<ans<<endl;
    return 0;
}


// Can a man still be brave if he's afraid?  That is the only time a man can be brave !!


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<int, vector<int>, greater<int> > PQG;
#define REP(i, a, n) for(ll i = (ll) a;i < (ll) n;i++)
#define fi first
#define se second
#define pb push_back
#define INF 1000000009
#define MOD 1000000007
#define MAXN 103
#define MAXC 100000000000014
#define MAXV 1000000009

int n, ans = 0;
bool used[MAXN] = {false};
PA ab[MAXN], cd[MAXN];

int main()
{
    cin >> n;
    REP(i, 0, n){
        cin >> ab[i].se >> ab[i].fi;
    }
    REP(i, 0, n){
        cin >> cd[i].fi >> cd[i].se;
    }
    sort(ab, ab + n);
    sort(cd, cd + n);
    REP(i, 0, n){
        for(int j = n - 1;j >= 0;j--){
            if(ab[j].se < cd[i].fi && ab[j].fi < cd[i].se && !used[j]){
                ans++;
                used[j] = true;
                //printf("ax = %d ay = %d cx = %d cy = %d ans = %d\n", ab[j].se, ab[j].fi, cd[i].fi, cd[i].se);
                break;
            }
        }
    }
    cout << ans << endl;



    return 0;
}
















Measured memory_bytes: 256
N = int(input())
oisisa = list(map(int,input().split()))
result=0
for i in range(N):
    if oisisa[i] == 0:
            pass
    else:
        for j in range(N-i-1):
            result += oisisa[i]*oisisa[i+j+1]
print(result)

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

int main() {
	int n;
	cin>>n;
	char s[n];
	int num=3;
	for(int i=0;i<n;i++){
		cin>>s[i];
		if(s[i]=='Y'){
			num=4;
		}
	}
	if(num==3){
		cout<<"Three";
	}else{
		cout<<"Four";
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
  int a,b,n;

  while(cin >> a >>b >> n){
    int remain = a % b;
    int ret = 0;
    for(int i=0;i<n;i++){
      remain *= 10;
      //cout << remain / b << " ";
      ret += remain / b;
      remain = remain % b;
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a[ohara],b[ohara],c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n)ans+=max(0LL,a[i]-b[i]);
    Cout(ans);
    return 0;
}


Measured memory_bytes: 2812
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;


class Program
{
    
    static void Main(string[] args)
    {
        int n = crI();
        var map = mapInt(n);
        int count = 0;
        foreach(var ele in map)
        {
            if(ele[0] == ele[1])
            {
                count++;
            }
            else
            {
                count = 0;
            }
            if (count == 3)
            {
                Console.WriteLine("Yes");
                return;
            }
        }
        Console.WriteLine("No");

    }

   

   



    //入力受け取り用
    static string crS() { return Console.ReadLine(); }
    static int crI() { return int.Parse(Console.ReadLine()); }
    static long crL() { return long.Parse(Console.ReadLine()); }
    static int[] arrInt() { return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray(); }
    static long[] arrLong() { return Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray(); }
    static string[] arrStr() { return Console.ReadLine().Split(' ').ToArray(); }
    static List<int[]> mapInt(int h)
    {
        List<int[]> mapInt = new List<int[]>();
        for (int i = 0; i < h; i++)
        {
            mapInt.Add(arrInt());
        }
        return mapInt;
    }

    static List<long[]> mapLong(long h)
    {
        List<long[]> mapLong = new List<long[]>();
        for (int i = 0; i < h; i++)
        {
            mapLong.Add(arrLong());
        }
        return mapLong;
    }


    static List<string[]> mapStr(int h)
    {
        List<string[]> mapStr = new List<string[]>();
        for (int i = 0; i < h; i++)
        {
            mapStr.Add(arrStr());
        }
        return mapStr;
    }

    static List<char[]> mapChar(int h)
    {
        List<char[]> mapChar = new List<char[]>();
        for (int i = 0; i < h; i++)
        {
            string s = crS();
            mapChar.Add(s.ToCharArray());
        }
        return mapChar;
    }

    static List<char[]> mapCharCopy(List<char[]> map)
    {
        List<char[]> copyMap = new List<char[]>();
        foreach (var arr in map)
        {
            List<char> list = new List<char>();
            foreach (var ele in arr)
            {
                list.Add(ele);
            }
            copyMap.Add(list.ToArray());
        }
        return copyMap;
    }

    //二次元配列出力用
    static void output2DArray(int h , int w , int[,] map)
    {
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if (j == w - 1) Console.WriteLine(map[i, j]);
                else Console.Write(map[i, j] + " ");
            }
        }
    }
}

Measured memory_bytes: 28296
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean can = false;
		for(int i=1; i<10; i++) {
			if(n%i==0 && 1<=n/i && n/i<=9) {
				can = true;
				break;
			}
		}
		if(can) System.out.println("Yes");
		else System.out.println("No");
	}

}

Measured memory_bytes: 22612
/*
[arc077] D - 11
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

const int MAX_N = 1e5;
const int MOD = 1e9 + 7;

class gf {
public:
    int n;
    static gf mod_inv(int a, int m) {
        int u = 0, v = 1;
        while (a != 0) {
            int t = m / a;
            m -= t * a;
            u -= t * v;
            swap(a, m);
            swap(u, v);
        }
        return gf(u);
    }
    gf() : n(0) {}
    gf(int n) : n(n < 0 ? (n % MOD) + MOD : n % MOD) {}
    gf operator+(gf x) { return gf((n + x.n) % MOD); }
    gf operator-(gf x) { return gf((n - x.n + MOD) % MOD); }
    gf operator*(gf x) { return gf((1LL * n * x.n) % MOD); }
    gf operator/(gf x) { return *this * x.inv(); }
    gf& operator+=(gf x) { return *this = (*this + x); }
    gf& operator-=(gf x) { return *this = (*this - x); }
    gf& operator*=(gf x) { return *this = (*this * x); }
    gf& operator/=(gf x) { return *this = (*this / x); }
    gf inv() { return mod_inv(n, MOD); }
};

int N;
int a[MAX_N + 1];
int idx[MAX_N + 1];

void solve() {
    fill(idx, idx + N + 1, -1);
    int d;
    for (int i = 0; i < N + 1; i++) {
        if (idx[a[i]] >= 0) {
            d = i - idx[a[i]];
            break;
        }
        idx[a[i]] = i;
    }

    gf t = N + 1;
    gf r = 1;
    for (int k = 1; k <= N + 1; k++) {
        cout << (t - r).n << endl;
        t = t * (N - k + 1) / (k + 1);
        r = r * (N - d - k + 1) / k;
    }
}

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

    solve();

    return 0;
}


Measured memory_bytes: 2048
import sys

def main(n):
    c = "abcdefghijklmnopqrstuvwxyz"
    m = {}
    for i in range(0, 26):
        m[i+1] = c[i]

    s = ""
    while n > 0:
        if n%26 == 0:
            t = 26
            n //= 26
            n -= 1
        else:
            t = n%26
            n //= 26
        s = m[t] + s
    return s

n = int(sys.stdin.readline().strip())
print(main(n))


Measured memory_bytes: 9120
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    bool Map[25][25]={};
    for(int i=0;i<n;i++){
      int x,y;cin>>x>>y;
      Map[y][x]=true;
    }
    int m;cin>>m;
    int num=n;
    pair<int,int>now=mp(10,10);
    for(int i=0;i<m;i++){
      char ccc;int a;cin>>ccc>>a;
      switch(ccc){
      case 'N':
	for(int j=0;j<a;j++){
	  now.F++;
	  if(Map[now.F][now.S]){num--;Map[now.F][now.S]=false;}
	}break;
      case 'E':
	for(int j=0;j<a;j++){
	  now.S++;
	  if(Map[now.F][now.S]){num--;Map[now.F][now.S]=false;}
	}break;
      case 'S':
	for(int j=0;j<a;j++){
	  now.F--;
	  if(Map[now.F][now.S]){num--;Map[now.F][now.S]=false;}
	}break;
      case 'W':
	for(int j=0;j<a;j++){
	now.S--;
	if(Map[now.F][now.S]){num--;Map[now.F][now.S]=false;}
	}break;
      }
    }
    if(num)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3100
# include <bits/stdc++.h>
using namespace std;
const int maxn = 303;
int dp[maxn][maxn][maxn];
char s[maxn];
int main()
{
    int a;
    scanf("%s%d",s+1,&a);
    int len = strlen(s+1);
    for(int j=1; j<=len; ++j)
    {
        for(int i=j; i>=1; --i)
        {
            for(int k=0; k<=a; ++k)
            {
                if(i==j)
                {
                    dp[i][j][k] = 1;
                    continue;
                }
                dp[i][j][k] = max(dp[i+1][j-1][k]+((s[i]==s[j])?2:0),max(dp[i+1][j][k], dp[i][j-1][k]));
                if(k>0)
                {
                    dp[i][j][k] = max(dp[i][j][k], dp[i][j][k-1]);
                    dp[i][j][k] = max(dp[i][j][k], dp[i+1][j-1][k-1]+2);
                }
            }
        }
    }
    printf("%d\n",dp[1][len][a]);
    return 0;
}


Measured memory_bytes: 108416
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MAX=1e+9;
int main(){
  int A,B;
  cin>>A>>B;
  for(int i=0;i<=MAX;i++){
    if(abs(A-i)==abs(B-i)){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 3608
#include <stdio.h>
int main(){
   int n;
   scanf("%d",&n);
   int a[n];
   for(int b=0;b<n;b++){
       scanf("%d",&a[b]);
   }
   int c[2];
   int d;
   c[0]=0;
   c[1]=c[0];
    for(int e=0;e<n;e++){if(c[0]<=a[e]){c[1]=c[0];c[0]=a[e];d=e;}
                         else{if(c[1]<a[e]){c[1]=a[e];}}}
    for(int f=0;f<n;f++){if(f!=d){printf("%d\n",c[0]);}
                         else{printf("%d\n",c[1]);}
    }
    return 0;
}

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

int main()
{
  int64_t N,K;
  int64_t sum=0;
  cin >>N >>K;
  vector<int64_t> H(N);
  for(int i=0; i<N; i++)
  {
    cin >> H.at(i);
  }
  sort(H.begin(),H.end());
  if(H.size()<=K)
  {
    cout << 0 << endl;
  }
  else
  {
    for(int i=0; i<H.size()-K; i++)
    {
      sum+=H.at(i);
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>

using namespace std;

int main(void){
  int n, tmp, num=10000, max;
  cin >> n;
  vector<int> weight, sum;
  for(int i=0; i<n; i++){
    cin >> tmp;
    weight.push_back(tmp);
  }

  tmp = 0;
  for(int i=0; i<n; i++){
    tmp += weight[i];
    sum.push_back(tmp);
  }
  max = sum[n-1];
  // cout << max << endl;
  for(int i=0; i<n; i++){
    tmp = abs(sum[i] - (max - sum[i]));
    // cout << sum[i] << "<-front back->" << max - sum[i] << endl;
    if(num > tmp){
      num = tmp;
    }
  }

  cout << num << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int room[4][3][10];
    int b,f,r,v;
    int i,loop;

    for(b=0;b<4;b++){
        for(f=0;f<3;f++){
            for(r=0;r<10;r++){
                room[b][f][r]=0;
            }
        }
    }

    scanf("%d",&loop);

    for(i=0;i<loop;i++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        room[b-1][f-1][r-1]+=v;
    }

    for(b=0;b<4;b++){
        for(f=0;f<3;f++){
            for(r=0;r<10;r++){
                printf(" %d",room[b][f][r]);
            }
            printf("\n");
        }
        if(b<3) printf("####################\n");
    }

    return 0;
}

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

int main(void){
    int N;

    cin >> N;
    vector<int> V(N), C(N);

    for(int i = 0; i < N; i++)
        cin >> V[i];
    
    for(int i = 0; i < N; i++)
        cin >> C[i];

    int max = 0;
    for(int i = 0; i < N; i++){
        if(C[i] < V[i])
            max += V[i] - C[i];
    }
    cout << max << endl;
    
    return 0;
}

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

int H;
int W;
char as[114][514];
map<char, int> cnt;
int permit;
bool special;

int main() {
  scanf("%d%d", &H, &W);
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      scanf(" %c", &as[i][j]);
      cnt[as[i][j]]++;
    }
  }

  if (H%2 == 1) permit += W/2;
  if (W%2 == 1) permit += H/2;
  if (permit == W/2+H/2) {
    special = true;
  }

  for (auto itr : cnt) {
    if (itr.second%2 == 1) {
      if (!special) {
        puts("No");
        return 0;
      }
      special = false;
      itr.second--;
    }
    
    if (itr.second%4 != 0) {
      assert(itr.second%2 == 0);
      if (permit <= 0) {
        puts("No");
        return 0;
      }
      permit--;
    }
  }
  puts("Yes");

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long
#define fori(i,n) for (int i=0; i<int(n);i++)
#define srt(v) sort(v.begin(), v.end())
#define MOD 1000000007
const int INF = 1e9;
const double PI = 3.14159265358979323846;
ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}
ll spow(ll base, ll exp){
	ll ans = 1;
	for(ll i=0;i<exp;i++) ans = ans * base % MOD;
	return ans;
}
ll divide(ll a, ll b){
	return a * spow(b, MOD-2) % MOD;
}
void solve(){
	
}

int main(){
	//~ load;
	//~ int t;
	//~ cin >> t;
	//~ while(t--){
		//~ solve();
	//~ }
	
	int d, t, s;
	cin >> d >> t >> s;
	if (t*s >= d){
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	
	
}



Measured memory_bytes: 3600
import java.util.Scanner;

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

        int rank1=Character.getNumericValue(c[c.length-1]);

        if (rank1 == 2 || rank1 == 4 || rank1 == 5 || rank1 == 7 || rank1 == 9) {
            System.out.println("hon");
        } else if (rank1 == 0 || rank1 == 1 || rank1 == 6 || rank1 == 8) {
            System.out.println("pon");
        } else {
            System.out.println("bon");
        }

        sc.close();
    }
}

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

template<typename integer>
integer __lcm(integer a, integer b) {
  return (a * b) / __gcd(a, b);
}

int main() {
  int n;
  cin >> n;
  cout << 48 - n << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define debugP int debug_point; cin>>debug_point;
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/
typedef pair<ll,pair<ll,ll>> P;
bool pc(const P& f,const P& s){
    return f.second.second>s.second.second;
}

int main(){
    ll n,t;
    cin>>n>>t;
    vector<pair<ll,ll>> a(n);
    vec(max,n);
    rep(i,n){
        cin>>a[i].first;
        max[i]=a[i].first;
    }
    sort(all(max)); 
    vec(b,n);
    rep(i,n){
        b[i]=(max[max.size()-1]-a[i].first);
        max.erase(lower_bound(max.begin(),max.end(),a[i].first));
            
    
    }
    
    sort(all(b));
    repf(i,1,n-1){
        if(b[b.size()-i]!=b[b.size()-i-1]){
            op(i);
            return 0;
        }
    }
    op(n-1);
    return 0;
}

Measured memory_bytes: 3328
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>

#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF ll(1e9)
#define INFL ll(1e18)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int ctoi(char c) {return c - '0';}

class BPopularVote {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N, M; in >> N >> M;
	    int A[N];
	    int _sum = 0;
	    REP(i, N) {
	        in >> A[i];
	        _sum += A[i];
	    }
	    sort(A, A+N);
	    reverse(A, A+N);
        string ans = "Yes";
        REP(i, M) {
	        if (A[i] * 4 * M < _sum) {
	            ans = "No";
	            break;
	        }
	    }
	    out << ans << '\n';
	}
};


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

	BPopularVote solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void) {
	int n, k, i, j, g[13] = {}, ans;

	cin >> n >> k;
	
	if (n < 3) {
		cout << 0 << endl;
		return 0;
	}

	for (i = 0; i < 11; i++) {
		if (i > 0) g[i] = g[i - 1];
		for (j = 0; j < 5; j++) {
			if ((4 + i * 8 + j * 9) % 11 == k) g[i]++;
		}
	}

	ans = g[10] * ((n - 3) / 11) + g[(n - 3) % 11];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = (1LL<<31)-1;
const ll MOD = 1000000007;


struct SegmentTree{
private:
    ll n;
    vector<ll> node;

public:
    SegmentTree(vector<ll> v){
        ll sz = v.size();
        n = 1;
        while(n<sz)n*=2;
        node.resize(2*n-1,INF);
        for(int i=0;i<sz;i++) node[i+n-1]=v[i];
        for(int i=n-2;i>=0;i--) node[i] = min(node[2*i+1],node[2*i+2]);
    }

    void update(ll x, ll val){
        x += (n-1);
        node[x] = val;
        while(x > 0){
            x = (x-1)/2;
            node[x] = min(node[2*x+1], node[2*x+2]);
        }
    }

    //要求区間[a,b)での値を求める(ここではmin)
    //k : 自分がいるノードのインデックス
    //対象区間は[l,r)
    int find(ll a,ll b, ll k = 0, ll l = 0, ll r = -1){
        if(r < 0) r = n;

        //要求区間と対象区間が交わらない
        if(r <= a || b <= l) return INF;

        //要求区間が対象区間を完全に被覆
        if(a <= l && r <= b) return node[k];

        //一部を被覆
        //左の子がvl, 右がvr
        ll vl = find(a,b,2*k+1,l,(l+r)/2);
        ll vr = find(a,b,2*k+2,(l+r)/2,r);

        return min(vl,vr);
    }

};

//cout << fixed << setprecision(10);

int main() {
    ll N,Q;
    cin >> N >> Q;
    SegmentTree seg(vector<ll>(N,INF));
    for(int i=0;i<Q;i++){
        ll c;
        cin >> c;
        ll x,y;
        cin >> x >> y;
        if(c==0) seg.update(x,y);
        else cout << seg.find(x,y+1) << endl;
    }

    return 0;
}


Measured memory_bytes: 5752
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
if sum(s) % 10 != 0:
    print(sum(s))
    exit()
else:
    for i in s:
        if (sum(s) - i) % 10 != 0:
            print(sum(s) - i)
            exit()
print(0)

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

using namespace std;

const int N=1e6;
int a[N+2],cnt[N+2];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int i,j,n,x,temp,gcd=0;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        cin >> x;
        ++cnt[x];
        gcd=__gcd(x,gcd);
    }
    if(gcd > 1)
    {
        cout << "not coprime";
        return 0;
    }
    for(i=2;i<=N;i++)
    {
        temp=0;
        for(j=i;j<=N;j+=i)temp+=cnt[j];
        if(temp > 1)
        {
            cout << "setwise coprime";
            return 0;
        }
    }
    cout << "pairwise coprime";
    return 0;
}


Measured memory_bytes: 7504
N,L=map(int,input().split())
b=0
ans=0
for x in range(1,N+1):
  if b==0 and abs(L+x-1)<abs(L+x):
    b=1
  else:
    ans+=L+x-1
if b==0:
  ans -= L+N-1
print(ans)


Measured memory_bytes: 9176
#include<bits/stdc++.h>
#define ll long long
#define db long double
#define fi first
#define se second
#define  pb push_back
#define  pob pop_back
#define W while
#define fn(i,x) for(int i=0;i<x;i++)
#define fs(i,s,x) for(int i=s;i<x;i++)
#define fr(i,x) for(int i=x;i>=0;i--)
#define fit(it,s) for(auto it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 1000000007
#define MAX 1005
using namespace std;
vll graph[100005];
ll visited[100005]={0};
void dfs(ll par,ll cur)
{
   visited[cur]=1;
   ll len=graph[cur].size();

   fn(i,len)
   {
      ll node=graph[cur][i];
      if(!visited[node] && node!=par)
      dfs(cur,node); 
 
   }
} 
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);

    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    
    ll n,m;
    cin >> n >> m;
    
    fn(i,m){
      ll a,b,c;
      cin >> a >> b >> c;
      graph[a].pb(b);
      graph[b].pb(a);
    }
    ll ans = 0;
    fs(i,1,n+1){
      if(visited[i] == 0){
        ans++;
        dfs(0,i);
      }
    }
    cout << ans;


    return 0;

}

Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b;
    int k;
    cin>>a>>b>>k;
    for(int i=0;i<k;i++){
        if(i%2==0){
            a=a-a%2;
            b+=a/2;
            a/=2;
        }
        else{
            b=b-b%2;
            a+=b/2;
            b=b/2;
        }
    }
    cout<<a<<' '<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
/*
AuThOr GaRyMr
技巧:
1.区别对待大数据&小数据！
2.Dp难推时算贡献！
3.long long (尤其乘法)！
4.long long INF 要大
5.Dp on trees: 换根法，每次清空当前的节点和换到的子节点
6.long double | 输出浮点数
7.注意特判!(prince and princess)
8.是否可以记录两个值之间的关系 CSPday2 meal
9.括号-》数组or栈
10.是否可以先构造
11.网络流奇偶构图
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int diss[100000+10],dist[100000+10];
vector<int> each[100000+10];
void dfs1(int now,int prev,int dis){
	diss[now]=dis;
	for(auto it:each[now]){
		if(it!=prev) dfs1(it,now,dis+1);
	}
}
void dfs2(int now,int prev,int dis){
	dist[now]=dis;
	for(auto it:each[now]){
		if(it!=prev) dfs2(it,now,dis+1);
	}
}
int dis3[100000+10],res=0;
void dfs3(int now,int prev,int dis){
	if(diss[now]>dist[now]) return;	
	res=max(diss[now],res);
	if(diss[now]==dist[now]){
		return;
	}
	if(each[now].size()==1){
		res=max(res,dist[each[now][0]]);
	}
	for(auto it:each[now]){
		if(it!=prev) dfs3(it,now,-1);
	}
}
int main(){
	int n,s,t;
	cin>>n>>s>>t;
	rb(i,1,n) diss[i]=dist[i]=dis3[i]=INF;
	rb(i,1,n-1){
		int  u,v;
		scanf("%d %d",&u,&v);
		each[u].PB(v);
		each[v].PB(u);
	}
	dfs1(s,-1,0);
	dfs2(t,-1,0);
	dfs3(s,-1,0);
	cout<<res<<endl;
	return 0;
	
}


Measured memory_bytes: 10752
include Math

def get_length(x1, y1, x2, y2, x3, y3)
  a = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2))
  b = sqrt((x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3))
  c = sqrt((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1))
  return a, b, c
end

def get_radius(x1, y1, x2, y2, x3, y3)
  a, b, c = get_length(x1, y1, x2, y2, x3, y3)
  s = (a + b + c)/2.0
  area = sqrt(s*(s-a)*(s-b)*(s-c))
  (a*b*c)/(4.0*area)
end

def get_center(x1, y1, x2, y2, x3, y3)
  a1 = 2.0*(x2 - x1)
  b1 = 2.0*(y2 - y1)
  c1 = x1**2 - x2**2 + y1**2 - y2**2
  a2 = 2.0*(x3 - x1)
  b2 = 2.0*(y3 - y1)
  c2 = x1**2 - x3**2 + y1**2 - y3**2
  x = (b1*c2 - b2*c1)/(a1*b2 - a2*b1)
  y = (c1*a2 - c2*a1)/(a1*b2 - a2*b1)
  return x, y
end

max = gets.to_i
max.times.each do
  x1, y1, x2, y2, x3, y3 = gets.split(/\s/).map(&:to_f)

  # 外接円の半径を求める
  #=> http://ja.wikipedia.org/wiki/%E3%83%98%E3%83%AD%E3%83%B3%E3%81%AE%E5%85%AC%E5%BC%8F
  #=> http://blogs.yahoo.co.jp/oka_yadokary/5718559.html
  r = get_radius(x1, y1, x2, y2, x3, y3)

  # 外接円の中心座標を求める
  #=> http://www.h6.dion.ne.jp/~jpe02_tn/ki-5.html
  px, py = get_center(x1, y1, x2, y2, x3, y3)

  puts sprintf("%.3f %.3f %.3f", px, py, r)
end

Measured memory_bytes: 6196
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#include<cmath>
#include<string>
#include<algorithm>
#include<sstream>
#include<queue>
#include<list>
#include<deque>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<chrono>


/*  auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<milliseconds>(stop - start);
pr(duration.count());    */


#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define siz         100009
#define mp          make_pair
#define ll          long long int
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define pi          acos(-1.0)
#define all(x)      x.begin(),x.end()
#define ull		    unsigned long long int
#define m(a)	    memset(a,0,sizeof(a))
#define f(i,n)	    for(ll i=0;i<n;i++)
#define sc(a)	    scanf("%lld",&a)
#define pr(a)	    printf("%lld\n",a)
const ll inf = 5000000000000000;
ll in = 1000000000000000000;
using namespace std;

int main()
{
	FastIO;
	ll a,b,d, co, t, i, j, k, n,r;
	cin >> n >> r;
	vector<ll>v, dif;
	f(i, r)
	{
		cin >> a;
		v.push_back(a);
	}
	sort(all(v));
	f(i, r)
	{
		if (i)
		{
			d = v[i] - v[i - 1];
			dif.push_back(d);
		}
	}
	sort(all(dif));
	k = dif.size() - n + 1;
	ll sum = 0;
	f(i, k)
	{
		sum += dif[i];
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 2548
#include<iostream>

using namespace std;
int a[500000];
int b[500000];
int c =0;
void merge_sort(int l,int r){
    if (r-l==1)return;
    int mid = (l+r)/2;
    merge_sort(l,mid);
    merge_sort(mid,r);


    int lp=l,rp=mid;
    for(int i=l;i<r;i++){
        if (lp==mid){
            b[i]=a[rp];
            rp++;
        }
        else if(rp==r){
            b[i]=a[lp];
            lp++;
        }
        else if(a[lp]>a[rp]){
            b[i]=a[rp];
            rp++;
        }
        else{
            b[i]=a[lp];
            lp++;
        }
        c++;
    }
    for(int i=l;i<r;i++){
        a[i]=b[i];
    }
}

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    merge_sort(0,n);
    for (int i = 0;i < n;i++){
        cout << a[i];
        if(i<n-1){
            cout<<" ";
        }
    }
    cout<<endl;
    cout<<c<<endl;
}


Measured memory_bytes: 6984
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <numeric>    // accumulate
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int N, d1, d2;
  bool c = false, b = false, bb = false;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> d1 >> d2;
    bb = b;
    b = c;
    c = d1 == d2;
    if (c && b && bb) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3132
// Author : Nachiket Kanore
// Institute : PICT, Pune

#include <stdexcept>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cassert>
#include <cstring>
#include <cstdarg>
#include <cstdio>
#include <memory>
#include <random>
#include <cmath>
#include <ctime>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <complex>
#include <numeric>
#include <limits>
#include <bitset>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <array>
#include <list>
#include <map>
#include <set>

using namespace std;

#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
 
 
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
 
const int mod = 1e9+7;
const int inf = 1e18;

const int N = 2e5;
int a[N];

int32_t main(){
    FAST;

    int n , k , q;
    cin >> n >> k >> q;
    int qq = q;

    for(int x=1;x<N;x++)
        a[x] = k;

    while(q--){
        int t;  cin >> t;
        a[t]++;
    }

    for(int x=1;x<=n;x++){
        a[x] -= qq;
        cout << (a[x] > 0 ? "Yes" : "No") << endl;
    }

    return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int> > a(n, vector<int>(m));
	vector<int> b(m,0);
	vector<int> total(n, 0);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a.at(i).at(j);
		}
	}
	for (int i = 0; i < m; i++) {
		cin >> b.at(i);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			total.at(i) += a.at(i).at(j) * b.at(j);
		}
		cout << total.at(i) << endl;
	}
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
map<string,int>mp;
int main()
{


      int t;
      cin>>t;
      while(t--)
      {
         string s;
         cin>>s;
         mp[s]++;
      }

      int maxi=0;
      for(auto i:mp)
      {
        maxi=max(maxi,i.second);
      }

      for(auto i:mp)
      {
        if(i.second==maxi)
          cout<<i.first<<endl;
      }

}


Measured memory_bytes: 19232
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
typedef long long ll;

int t[4*MAXN];

ll sum(int v, int tl, int tr, int l, int r)
{
	if (l > r) return 0;
	if (l == tl && r == tr) return (ll)t[v];
	int tm = (tl + tr) / 2;
	return sum (v*2, tl, tm, l, min(r,tm)) + sum (v*2+1, tm+1, tr, max(l,tm+1), r);
}

void upd(int v, int tl, int tr, int pos, int x)
{
	if (tl == tr)
    {
        t[v] += x;
        return;
    }

    int tm = (tl + tr) / 2;
    if (pos <= tm) upd(v*2, tl, tm, pos, x);
    else upd(v*2+1, tm+1, tr, pos, x);
    t[v] = t[v*2] + t[v*2+1];
}


struct query
{
    int l, r;
} q[MAXN];


bool comp(query a, query b)
{
    return a.r - a.l < b.r - b.l;
}


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

    for (int i = 0; i < n; i++)
    {
        cin >> q[i].l >> q[i].r;
    }
    sort(q, q + n, comp);


    int it = 0;

    for (int d = 1; d <= m; d++)
    {
        while (it < n && q[it].r - q[it].l + 1 < d)
        {
            upd(1,0,m+1, q[it].l, 1);
            upd(1,0,m+1, q[it].r + 1, -1);
            it++;
        }
        int ans = 0;
        ans += n - it;
        for (int i = d; i <= m; i += d)
        {
            ans += sum(1,0,m+1, 1, i);
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 4352
#line 1 "../lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>

using namespace std;

#line 2 "tmp.cpp"

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

  ll k;
  cin >> k;
  vl ans(50);
  REP(i, 50) {
    if (i < k % 50) {
      ans[i] = k / 50LL + 50;
    } else {
      ans[i] = k / 50LL + 49 - (k % 50LL);
    }
  }

  cout << 50 << endl;
  REP(i, 50) { cout << ans[i] << (i == 49 ? "\n" : " "); }
  return 0;
}


Measured memory_bytes: 256
import sys
a = list(map(int,input().split()))
b = list(map(int,input().split()))

N = a[0]
M = a[1]

count = 0
b_sum = sum(b)

c = sorted(b,reverse = True)

for i in range(0,N):
    if c[i] >= (b_sum/(4*M)):
        count+=1
    else:
        break

if count >= M:
    print('Yes')
else:
    print('No')



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

int main(void)
{
    ll n, cnt = 0;
    cin >> n;

    rep(i,n){
        ll a;
        cin >> a;
        while(a%2 == 0){
            a /= 2;
            cnt++;
        }
    }
    
    cout << cnt << endl;
    return 0;
}

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

int main() {
	string s; cin>>s; int cnt=0;
	int len=s.length();//14
	for(int i=0;i<s.length();i++){
		if(s[i]=='o')cnt++;
	}	//7
	if(cnt>=8)cout<<"YES";
	else if(8-cnt<=15-len)cout<<"YES";
	else cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll k = 0;
  cin >> k;
  ll tenmod = 7;
  tenmod %= k;
  ll now = 0;
  for(int i = 1;i <= 10000000;i++){
    now += tenmod,now %= k;
    if(now == 0){
      cout << i << endl;
      return 0;
    }
    tenmod *= 10;
    tenmod %= k;
  }
  cout << -1 << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n,m;
    cin >> n >> m;
    ll ans = 0;
    if (n == 1 && m == 1) {
        ans = 1;
    } else if (n == 1) {
        ans = m-2;
    } else if (m == 1) {
        ans = n-2;
    } else {
        ans = (ll) max(n-2,0)*max(m-2,0);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

int main() {
	IN(int, n, k, c);
	IN(string, s);
	
	vector<int> L(n), R(n);
	int x = 0;
	inc(i, n) {
		if(s[i] == 'o') { L[i] = ++x; i += c; }
	}
	assert(x >= k);
	if(x > k) { exit(0); }
	
	x = 0;
	dec(i, n) {
		if(s[i] == 'o') { R[i] = ++x; i -= c; }
	}
	assert(x >= k);
	if(x > k) { exit(0); }
	
	inc(i, n) {
		if(L[i] + R[i] == k + 1) { OUT(i + 1); }
	}
}


Measured memory_bytes: 3332
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = 0;
		
		int d = 0;
		int e = sc.nextInt();
		int f = 0;
		
		int g = 0;
		int h = 0;
		int i = 0;
		int sum = 0;
		for (c = 0; c <= 100; c++) {
			sum = a + b + c; // r=1
			h = sum - b - e; // c=2
			i = sum - a - e; // x=\
			f = sum - c - i; // c=3
			g = sum - h - i; // r=3
			d = sum - a - g; // c=1
			if (sum == d + e + f && // r=2
				sum == c + e + g) { // x=/
				break;
			}
		}
		System.out.println(a + " " + b + " " + c);
		System.out.println(d + " " + e + " " + f);
		System.out.println(g + " " + h + " " + i);
	}
}


Measured memory_bytes: 23252
n,m = map(int,input().split())
matrix = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    matrix[a-1].append(b-1)
    matrix[b-1].append(a-1)

check = [False for i in range(n)]

ans = 0
def dfs(v):
    global ans

    if check.count(True) == n:
        ans += 1
        return
    else:
        for next in matrix[v]:
            if not check[next]:
                check[next] = True
                dfs(next)
                check[next] = False
        return

check[0] = True
dfs(0)

print(ans)

Measured memory_bytes: 3188