akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
bool is_proper(unsigned int in);
int main() {
  unsigned int a = 0, b = 0;
  cin >> a >> b;
  while(!is_proper(a) || !is_proper(b)){
    cin >> a >> b;
  }
  if ((a+b)%2!=0){
    cout << (a+b)/2 + 1 << endl;
  } else {
    cout << (a+b)/2 << endl;
  }
}

bool is_proper(unsigned int in){
  if (in>=1&&in<=100){
    return true;
  }
  return false;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int h,w;
int ans[1001][1001];

int main(void){
	int a,b;
	scanf("%d%d%d%d",&h,&w,&a,&b);
	for(int i=0;i<b;i++){
		for(int j=a;j<w;j++){
			ans[i][j]=1;
		}
	}
	for(int i=b;i<h;i++){
		for(int j=0;j<a;j++){
			ans[i][j]=1;
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			printf("%d",ans[i][j]);
		}
		printf("\n");
	}
	return 0;
}


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

#define rep(i, n) for(int i = 0 ; i < n ; i ++)
#define vi vector<int>
int main(void){
  int n, ret = 0, a, b;
  cin>>n;
  rep(i,n){
    cin>>a>>b;
    ret += b - a + 1;
  }
  cout<<ret<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define MAXN ((int)1e6+5)
#define ll long long

int n,m;
ll w[MAXN],c[MAXN];
ll dp[MAXN];

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

	cin >> n >> m;

	for (int i = 0; i < n; ++i)
		cin >> w[i] >> c[i];

	for (int j = 0; j < n; ++j)
	{
		for (int i = m-1; i >= 0; --i)
			if(dp[i] || i == 0)
				dp[i+w[j]] = max(dp[i+w[j]] , dp[i] + c[j]);
	}

	ll maxx = 0;	
	for (int i = 1; i <= m; ++i)
		maxx = max(maxx, dp[i]);

	cout << maxx << endl;
	return 0;
}


Measured memory_bytes: 5888
# 30 あ
x1, y1, x2, y2 = map(int, input().split(' '))

x2 -= x1
y2 -= y1
x3 = x4 = -x1
y3 = y4 = -y1

#
x4 = -y2
y4 = x2
x3 = x2 + x4
y3 = y2 + y4
print(x3 + x1, y3 + y1, x4 + x1, y4 + y1)

Measured memory_bytes: 9188
A, B = input().split()

a10 = int(''.join(list(reversed(A[0:2]))))
a34 = int(A[3:5])
if a10 < a34:
  amin = int(A[1:3]) + 1
else:
  amin = int(A[1:3])

b10 = int(''.join(list(reversed(B[0:2]))))
b34 = int(B[3:5])
if b10 <= b34:
  bmin = 100 - int(B[1:3]) - 1
else:
  bmin = 100 - int(B[1:3])

n0 = int(B[0]) - int(A[0]) + 1

print(n0 * 100 - amin - bmin)

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

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int H,W;
char S[400][400] = {0};
int visited[400][400] = {0};
int black = 0;
LL white = 0;
int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};

void f(int i, int j, char pre){
    if(!(0<=i && i<H && 0<=j && j<W))return;
    if(visited[i][j])return;
    char now = S[i][j];
    if(now == pre)return;
    visited[i][j] = 1;
    if(now == '#')black++;
    if(now == '.')white++;
    f(i+1, j, now);
    f(i-1, j, now);
    f(i, j+1, now);
    f(i, j-1, now);
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>H>>W;
    REP(i,H)REP(j,W)cin>>S[i][j];
    LL ans = 0;
    REP(i,H)REP(j,W){
        black = 0;
        white = 0;
        f(i, j, 'X');
        ans += black * white;
    }
    PUTS(ans);
}

Measured memory_bytes: 6016
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,sum=0;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  for(int i=0;i<k;i++)
  {
    sum+=a[i];
  }
  cout<<sum;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
 string s,ans="";
 cin >> s;

 for(int i=0;i<s.size();i++){\
   if(s[i]=='0')
     ans+='0';
   else if(s[i]=='1')
     ans+='1';
   else if(ans.size()!=0)
     ans.erase(ans.size()-1,1);

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


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

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const string YES = "Yes";
const string NO = "No";

void solve(std::string S) {
    bool f = false;
    rep (i, S.size()) {
        if (S[i] == 'C') f = true;
        if (f && S[i] == 'F') {
            cout << YES << endl;
            return;
        }
    }
    cout << NO << endl;
}

int main() {
    std::string s;
    std::cin >> s;
    solve(s);
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>


int main()
{
	char array[100];
	int flag = 1;
	int i;
	int c;
	int cnt = 0;
	for (i = 0; i < 100 - 1 && (c = getchar()) != '\n'; ++i) {
		array[i] = c;
		if (array[i] == 'L' || array[i] == 'U' || array[i] == 'D' || array[i] == 'R') {
			cnt++;
		}
	}
	for (i = 0; i < cnt; i++) {
		if (i & 1) {
			if (array[i] == 'L' || array[i] == 'U' || array[i] == 'D') {

			}
			else {
				flag = 0;
			}
		}
		else {
			if (array[i] == 'R' || array[i] == 'U' || array[i] == 'D') {

			}
			else {
				flag = 0;
			}
		}
	}

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

Measured memory_bytes: 256
import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

def sol():
    N = int(input())

    ans = N**3
    print(ans)


sol()

Measured memory_bytes: 3316
/* ----------------------- reclone_rk -------------------------*/ 
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int mod=1e9+7;

int gcd(int a, int b){ if(a == 0) return b; return gcd(b%a, a);}
int MOD(int n){ return ((n%mod)+mod)%mod;}
int power(int a,int b){ if(b==0)return 1LL;int s=power(a,b/2LL);s*=s;s%=mod;if(b&1LL)return (s*a)%mod;return s;}
int inv(int a){return power(a,mod-2);}
int nCr(int n,int r){if(r>n)return 0LL;if(n-r<r)r=n-r;int ans=1;for(int i=0;i<r;i++){ans*=(n-i);ans=MOD(ans);ans*=inv(i+1);ans=MOD(ans);}return ans;}
 
signed main()
{
	int n, m;
	cin>>n>>m;
	vector<int>a(n);
	int sum = 0;
	for(int i=0; i<n; i++)
	{
		cin>>a[i];
		sum += a[i];
	}
	// sort(a.begin(), a.end());
	float val = sum/(4*m*1.0);
	int cnt = 0;
	for(int i=0; i<n; i++)
	{
		if((float)a[i] >= val)
			cnt++;
	}
	if(cnt >= m)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ちゃんとユニークな配列にする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int N, H;
  cin >> N >> H;
  vector<int> a;
  vector<int> b;
  priority_queue<int> bPQ;
  rep(i, N) {
    int ai, bi;
    cin >> ai >> bi;
    a.pb(ai);
    b.pb(bi);
    bPQ.push(bi);
  }

  // 最大Aを求める、一番効率の良い切りを取得
  int maxA = 0;
  rep(i, N) {
    maxA = max(maxA, a[i]);
  }

  // 全部投げフェーズ (ただし最大A)
  int throwAllTry = 0;
  int count = 0;
  
  while(!bPQ.empty() && throwAllTry < H) {
    int attack = bPQ.top();
    bPQ.pop();
    if(attack >= maxA) { // 切るより効率が良いやつだけ投げる
      throwAllTry += attack;
      count++;
    }
  }

  // DEBUG(throwAllTry);
  // DEBUG(count);

  if(throwAllTry >= H) {
    cout << count << endl;
    return 0;
  }

  // 投げずに最大でカウント (ただし最後は投げる)
  int minCount = INF;
  int totalDamage = 0;
  int countNotThrow = 0;

  rep(i, N) {
    if(b[i] >= maxA) { // 切るより効率がいいやつだけ投げる
      totalDamage += b[i];
      countNotThrow++;
    }
  }

  while (totalDamage < H) {
    totalDamage += maxA;
    countNotThrow++; 
  }

  cout << countNotThrow << endl;
}


Measured memory_bytes: 1644
#include <stdio.h>

int main()
{
  int s[5];
  int i;
  for(i=0; i<5; i++)
    scanf("%d",&s[i]);
  for(i=0; i<5; i++)
  {
    if(s[i] != i+1) printf("%d",i+1);
  }
  return 0;
}


Measured memory_bytes: 2124
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <utility>

using namespace std;

int main() {
  int h1, m1, h2, m2, k;

  cin >> h1 >> m1 >> h2 >> m2 >> k;

  int min1 = h1 * 60 + m1;
  int min2 = h2 * 60 + m2;

  cout << min2 - min1 - k << endl;

  return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;


int main(){
  int x,y,a,b,c;
  cin>>x>>y>>a>>b>>c;
  vector<ll>p(a);
  vector<ll>q(b);
  vector<ll>r(c);
  rep(i,a)cin>>p[i];
  rep(i,b)cin>>q[i];
  rep(i,c)cin>>r[i];
  sort(p.begin(),p.end(),greater<>());
  sort(q.begin(),q.end(),greater<>());
  sort(r.begin(),r.end(),greater<>());
  vector<ll>s(x);
  vector<ll>t(y);
  rep(i,x)s[i]=p[i];
  rep(i,y)t[i]=q[i];
  ll ans=0;
  rep(i,x)ans+=s[i];
  rep(i,y)ans+=t[i];
  vector<ll>z;
  rep(i,x)z.push_back(s[i]);
  rep(i,y)z.push_back(t[i]);
  sort(z.begin(),z.end());
  rep(i,min(c,(int)z.size())){
    if(z[i]<r[i]){
      ans-=z[i];
      ans+=r[i];
    }
  }
  cout<<ans<<endl;
  return(0);
}


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

int main(){
  int n,x;
  cin >> n>> x;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  int count=1;
  int d=0;
  for(int i=0;i<n;i++){
    d+=vec.at(i);
    if(d>x){
      break;
    }
        count++;
  }
  cout <<count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    /*
    int a, b;
    cin >> a >> b ;
    */

    //*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a * b % 2 == 0 ){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    //*/
    
    cout << vec.at(2) * 10 + vec.at(0) + vec.at(1) << endl;

    return 0; 
}


Measured memory_bytes: 3568
#include<stdio.h>
int main()
{
 int N,m,p=0,sum=0;
 scanf("%d",&N);
 m=N;
 for(;N!=0;)
 {
 	p=N%10;
 	sum+=p;
 	N/=10; 
 }
 if(m%sum==0)printf("Yes");
 else printf("No");
 return 0;
}

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

#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long int
#define MAX 1e9
#define MIN -1e9
#define mod 998244353
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define output(x) cout << ( x ? "Yes" : "No" ) << '\n' ;
#define mxn 100005
using namespace std;

void solve(){
    int n,k;
    cin >> n >> k;
    int l[k],r[k];
    for(int i = 0; i < k; i++){
        cin >> l[i] >> r[i];
    }
    int dp[n + 5] = {};
    int pref[n + 5] = {};
    dp[1] = 1;
    pref[1] = 1;
    for(int i = 2; i <= n; i++){
        for(int j = 0; j < k; j++){
            if(i <= l[j]){
                continue;
            }
            int left = l[j];
            int right = min(r[j], i - 1);
            // cout << i - l[j] << " " << i - (r[j]) - 1 << ' ' ;
            int val = (pref[i-l[j]] - pref[i- right - 1] + mod) % mod;
            dp[i] = (dp[i] + val ) % mod;
            // cout << dp[i] << "\n";
            // dp[i] %= mod;
        }
        // cout << '\n';
        pref[i] = (pref[i - 1] % mod + dp[i] % mod) % mod;
    }
    cout << dp[n] ;
}

int32_t main()
{
    FLASH
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 6744
#include <iostream>
#include <vector>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <stdio.h>
#include <list>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <memory.h>
#include <utility>
#include <cctype>
#include <complex>
#include <fstream>
#include <sstream>
#include <climits>
using namespace std;

#define ll long long
#define mod 1000000007
#define infinity (ll)1e8
#define epsilon 1e-6

#define pll pair<ll, ll>
#define pdd pair<double, double>
#define pii pair<int,int>
#define MP make_pair

#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(ll i = (b) - 1; i >= a; --i)
#define REPEAT(n) FOR(counter1488, 0, (n))

#define vi vector<int>
#define vvi vector<vi>
#define ALL(V) V.begin(), V.end()

int main()
{
	int n; cin >> n;
	int c, k;
	cin >> c >> k;

	vector<int> a(n);
	FOR(i, 0, n)
		cin >> a[i];


	sort(ALL(a));
	int counter = 1;
	int prevBus = a[0];
	int prevInd = 0;
	FOR(i, 1, n)
	{
		if (prevBus + k < a[i])
		{
			prevBus = a[i];
			counter++;
			prevInd = i;
		}
		if (i - prevInd + 1 > c)
		{
			prevBus = a[i];
			counter++;
			prevInd = i;
		}
	}
	cout << counter;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n, q;
    cin >> n >> q;

    vector<int64_t> a(n);
    vector<int64_t> sum;
    vector<int64_t> psum;
    for (auto&& aa : a) {
        cin >> aa;

        sum.push_back(sum.empty() ? 0 : sum.back());
        sum.back() += aa;
        psum.push_back(psum.size() >= 2 ? psum[psum.size() - 2] : 0);
        psum.back() += aa;
    }

    vector<int64_t> border(n);
    for (auto i : irange(0L, n)) {
        if (i == n - 1) {
            border[i] = (1L << 40);
            continue;
        }
        auto k = (n - i + 1) / 2;
        auto b = (i == 0 ? -(1L << 40) : a[i - 1]);
        auto c = a[i];
        auto d = a[n - k - 1];
        auto e = a[n - k];

        // auto xs = max({1, b + 1, (b + d) / 2 + 1});
        auto xe = min({e - 1, (c + e) / 2});

        border[i] = xe;
    }

    for (auto _ : irange(0L, q)) {
        int64_t x;
        cin >> x;

        auto it = partition_point(border.begin(), border.end(), [x](int64_t b) {
            return b < x;
        });

        auto i = it - border.begin();
        auto k = (n - i + 1) / 2;

        // cerr << i << " " << k << endl;

        int64_t ans = 0;
        ans += sum.back() - sum[n - k - 1];
        // cerr << ans << endl;
        // cerr << sum[n - k - 1] << endl;

        if (n - 2 * k == i) {
            if (i > 0) {
                ans += psum[i - 1];
            }
        } else if (i >= 2) {
            ans += psum[i - 2];
        }

        cout << ans << endl;
    }
}

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

typedef long long ll;
const int N = (int)1e7 + 50;
const ll mod = 998244353;

int n;
ll fac[N], facinv[N];
ll inv[N], pw[N];

ll fp(ll x, ll k){
    if(k == 0) return 1;
    ll hf = fp(x, k/2);
    return k % 2 ? hf * hf % mod * x % mod: hf * hf % mod;
}

ll comb(int n, int k){
    return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

void init_fac() {
    inv[1] = 1;
    for(int i = 2; i < N; i++) inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
    fac[0] = 1;
    for(int i = 1; i <= N-1; i++) fac[i] = fac[i-1] * i % mod;
    facinv[N-1] = fp(fac[N-1], mod - 2);
    for(int i = N-1 - 1; i >= 0; i--) facinv[i] = facinv[i+1] * (i+1) % mod;
    pw[0] = 1;
    for(int i = 1; i < N; i++) pw[i] = pw[i-1] * 2 % mod;
}

ll ssum[N];


int main(){
    init_fac();
    cin >> n;
    n /= 2;
    for(int i = n; i >= 1; i--) {
        ssum[i] = (comb(n, i) * pw[n - i] + ssum[i+1]) % mod;
    }
    ll comp = 0;
    for(int i = 0; i <= n; i++) {
        comp += comb(n, i) * pw[i] % mod * ssum[i+1] % mod;
        comp %= mod;
    }
    ll res = 1;
    for(int i = 0; i < n; i++) res = (res * 9) % mod;
    cout << ((res - comp * 2) % mod + mod) % mod << endl;
}


Measured memory_bytes: 354048
#include "bits/stdc++.h"
using namespace std;

map<int, int>mp;
const int MAX_INT = 1000000;
int is_prime[MAX_INT + 1];
void calc(int N) {
	while (-1 != is_prime[N]) {
		int p = is_prime[N];
		while (0 == N % p) {
			N /= p;
		}
		mp[p]++;
	}
	return;
}
//エラトステネスの篩(n以下の素数のリストの作成)
void sieve(int  n) {
	for (int m = 0; m <= n; ++m) {//初期化
		is_prime[m] = -1;
	}
	for (int m = 2; m <= n; ++m) {
		if (-1 == is_prime[m]) {
			for (int l = m; l <= n; l += m) {
				is_prime[l] = m;
			}
		}
	}
	return;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	vector<int>A(N);
	int maxA = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		maxA = max(maxA, A[i]);
	}
	sieve(maxA);
	for (int i = 0; i < N; ++i) {
		calc(A[i]);
	}

	bool b1 = true;
	bool b2 = false;
	for (auto p : mp) {
		if (1 != p.second) {
			b1 = false;
		}
		if (N == p.second) {
			b2 = true;
		}
	}
	if (b1) {
		cout << "pairwise coprime" << endl;
	}
	else if (!b2) {
		cout << "setwise coprime" << endl;
	}
	else {
		cout << "not coprime" << endl;
	}
	return 0;
}

Measured memory_bytes: 14700
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>



#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;

vector<vector<ll>> graph;
ll n;
ll c;

void dfs(ll v, vector<ll> used) {
	if (used.size() == n) {
		c++;
		return;
	}
	bool deadEnd = true;
	rep(i, 0, n) {
		if (find(used.begin(), used.end(), i) == used.end()) {
			deadEnd = false;
			if (graph[v][i] > 0) {
				vector<ll> newUsed = used;
				newUsed.push_back(i);
				dfs(i, newUsed);
			}
		}
	}
	return;
}

//ABC 54
int main(void) {
	ll m;
	cin >> n >> m;
	graph = vector<vector<ll>>(n, vector<ll>(n,-1));
	rep(i, 0, m) {
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		graph[a][b] = 1;
		graph[b][a] = 1;
	}

	ll ans = 0;
	ll v = 0;
	c = 0;
	dfs(v, vector<ll>(1,0));
	
	cout << c << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return float(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()



def main():
	nn=II()
	A=LI()
	ans="pairwise coprime"

	n = 500005
	primes = set(range(2, n+1))
	for i in range(2, int(n**0.5+1)):
		primes.difference_update(range(i*2, n+1, i))
	primes=set(primes)

	#print(primes)


	B=set(range(1,5*10**5+5))
	C=set()
	for i in A:
		a=set()
		while i%2==0:
			a.add(2)
			i//=2
		f=3
		while f*f<=i:
			if i in primes:
				break
			elif i%f==0:
				a.add(f)
				i//=f
			else:
				f+=2
		if i!=1:
			a.add(i)
		B&=a
		if C&a:
			ans="setwise coprime"
		C|=a

	if B:
		ans="not coprime"

	print(ans)





















if __name__ == "__main__":
	main()


Measured memory_bytes: 206368
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll>vi;
vector<ll> :: iterator vt;
ll arr[200009];
int main()
{
    ll n,t,mul=1,flag =0,i,j,k,maxi=LONG_LONG_MIN ,mini=LONG_LONG_MAX,sum=0,c=0;
    map<char,ll>mp;
    map<char,ll> :: iterator mt;
    string s, ss;

    cin>>n;
    cin>>s;
    ll w=0 ,e=0,w1=0,e1=0,x;
    for(i = 0 ;i<n ;i++)
    {
        if(s[i]=='W')
            w++;
        if(s[i]=='E')
        e++;
    }
    for(i = 0 ;i<n ;i++)
    {
        if(s[i]=='W'){
            w--;
            x= e+w1;
            w1++;
        }
        if(s[i]=='E')
        {
            e--;
            x=e+w1;
        }
         mini = min(x,mini);

    }
    cout<<mini<<endl;




   return 0;
}


Measured memory_bytes: 900
#include <iostream>
#include <queue>
#include <algorithm>

using namespace std;

struct Sushi
{
    int kind;
    u_int64_t score;
};

bool isPicked[100'000];
Sushi sushi[100'000];

int main()
{
    int N, K;
    cin >> N >> K;
    for (int i = 0; i < N; i++)
    {
        cin >> sushi[i].kind >> sushi[i].score;
        sushi[i].kind--;

        isPicked[i] = false;
    }

    sort(sushi, sushi + N, [](const auto &lh, const auto &rh) {
        return lh.score > rh.score;
    });

    u_int64_t kinds = 0;
    u_int64_t base = 0;
    auto cmp = [](const Sushi &lh, const Sushi &rh) {
        return lh.score > rh.score;
    };
    auto rcmp = [](const Sushi &lh, const Sushi &rh) {
        return lh.score < rh.score;
    };
    priority_queue<Sushi, vector<Sushi>, decltype(cmp)> cands(cmp);
    priority_queue<Sushi, vector<Sushi>, decltype(rcmp)> noCands(rcmp);

    for (int i = 0; i < N; i++)
    {
        if (i < K)
        {
            if (!isPicked[sushi[i].kind])
            {
                kinds++;
            }
            else
            {
                cands.push(sushi[i]);
            }
            base += sushi[i].score;
            isPicked[sushi[i].kind] = true;
            continue;
        }

        noCands.push(sushi[i]);
    }

    u_int64_t totalMax = base + kinds * kinds;
    while (!cands.empty())
    {
        Sushi nextCand;
        bool found = false;

        while (!noCands.empty())
        {
            Sushi top = noCands.top();
            noCands.pop();
            if (!isPicked[top.kind])
            {
                nextCand = top;
                found = true;
                break;
            }
        }

        if (!found)
        {
            break;
        }

        Sushi worstCand = cands.top();
        cands.pop();
        base -= worstCand.score;
        base += nextCand.score;
        kinds++;
        isPicked[nextCand.kind] = true;

        u_int64_t total = base + kinds * kinds;
        totalMax = max(totalMax, total);
    }

    cout << totalMax << endl;
}

Measured memory_bytes: 4120
#include <stdio.h>

int main(){
    int a,b,d,r;
    double f;
    
    scanf("%d%d",&a,&b);
    d=a/b;
    r=a%b;
    f=(double)a/(double)b;
    
    printf("%d %d %.5f\n",d,r,f);
    return(0);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};

struct D21{
  int is,js;
  D21(int isize,int jsize){
    is = isize;
    js = jsize;
  }
  int operator()(int i,int j){
    return i*js+j;
  }
};


void Main(){
  int n,k;
  cin>>n>>k;
  vi h(n);
  cin>>h;
  rep(i,k) h.pb(INF);
  vi dp(n+k,INF);
  dp[0] = 0;
  rep(i,n){
    srep(j,1,k+1)
      chmin(dp[i+j] , dp[i] + abs(h[i+j]-h[i]) );
  }
  cout<<dp[n-1]<<endl;

} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 1024
using System;
using System.Linq;
namespace DPL_1_C
{
    class Program
    {
        static void Main(string[] args)
        {
            String [] first = Console.ReadLine().Trim().Split(' ');
            var n = 0;
            var w = 0;
            int.TryParse(first[0],out n);
            int.TryParse(first[1],out w);
            int [] valueList = new int [w + 1];
            for (int i = 0; i < n; i++)
            {
                String [] line = Console.ReadLine().Trim().Split(' ');
                var l_v = 0;
                var l_w = 0;
                int.TryParse(line[0], out l_v);
                int.TryParse(line[1], out l_w);
                for (int weight = 0; weight < w + 1; weight++){
                    if(weight >= l_w){
                        valueList[weight] = valueList[weight - l_w] +  l_v > valueList[weight] ? valueList[weight - l_w] +  l_v : valueList[weight];
                    }
                }
            }
            Console.WriteLine(valueList.Max());
        }
    }
}


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

int main() {
    string a, b; cin >> a >> b;
    int n = a.size(), m = b.size();
    if (n > m) puts("GREATER");
    else if (n < m) puts("LESS");
    else {
        for (int i = 0; i< n; i++) {
            if (a[i] > b[i]) { puts("GREATER"); return 0; }
            else if (a[i] < b[i]) { puts("LESS"); return 0; }
            if (i == n - 1) puts("EQUAL");
        }
    }
    return 0;
}

Measured memory_bytes: 256
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄█████████████  █▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const ll INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1000000007;
// const ll MAXN = 3e5;
const ld eps = 1e-6;
const ld eps2 = 1e-9;
const ll MOD2 = 998244353;
const ll dosz = 5e5;
const ll SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("input.txt", "r", stdin);
       // freopen("output.txt", "w", stdout);
#endif
}

void solve(){
    int n, m;
    cin >> n >> m;
    int sum = 0;
    for(int i=0; i<m; i++){
        int beta;
        cin >> beta;
        sum += beta;
    }
    if(sum>n){
        cout << -1 << endl;
    } else{
        cout << n-sum << endl;
    }
}

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed << setprecision(6);
    // cin >> q;
    while(q--){
        solve();
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int time = 0;
  for(int i=1; i <= n ; i++){
  	int x = i;
    if(x % 2== 0){
    	continue;
    }
    int count = 0;
    for(int j = 1;j <= i ; j++){
    	if(i % j==0){
        	count++;
        }
    }
    if(count==8){
    	time++;
    }
  }
  cout << time << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] array = new int[n];
      for(int i = 0;i < array.length;i++){
      	array[i] = sc.nextInt();
      }
      
      int count1 = 0;
      for(int i = 0;i < array.length;i++){
      	if(array[i] != i+1) count1++;
      }
      
      if(count1 == 0 || count1 == 2 ) System.out.print("YES");
      else System.out.println("NO");
    }
}


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

int main()
{
    string s,t;
    cin >> s >> t;
    vector<char> ss(s.size()),tt(t.size());
    for(int i = 0; i < s.length(); i++){
        ss[i] = s[i];
    }
    for(int i = 0; i < t.length(); i++){
        tt[i] = t[i];
    }
    sort(ss.begin(),ss.end());
    sort(tt.begin(),tt.end(),greater<int>());
    for(int i = 0; i < min(ss.size(),tt.size()); i++){
        if(ss[i] > tt[i]){
            cout << "No" << endl;
            return 0;
        }else if(ss[i] < tt[i]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    if(ss.size() < tt.size()) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
using ll = long long int;
using lc = complex<double>;

int main(void) {
    constexpr ll MOD = 1e9 + 7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(32);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n;
    cin >> n;
    ll r = 0;
    for(ll a=2; a*a<=n; a++) {
        if(n%a>0) continue;

        ll e = 0;
        while(n%a==0) e++, n/=a;

        ll ok = 0, ng = 1e9;
        while(abs(ok-ng)>1) {
            ll mid = (ok+ng)/2;
            (mid*(mid+1)/2 <= e ? ok : ng) = mid;
        }
        r += ok;
    }
    if(n>1) r++;
    cout << r << endl;
}


Measured memory_bytes: 3652
from sys import stdin,stdout


if __name__=="__main__":

    n=int(stdin.readline())
    b=[int(x) for x in stdin.readline().split()]
    b.append(1000000)

    s=b[0]

    for i in range(n-1):
        if b[i]>b[i+1]:
            s+=b[i+1]
        else:
            s+=b[i]
    stdout.write(str(s)+"\n")
    


Measured memory_bytes: 9168
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
  int n=0;
  vector<int> v;
  for(int i=0;i<5;i++) {
    cin>>n;
    v.push_back(n);
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  for(int i=0;i<5;i++){
    cout<<v[i];
if(i!=4)
cout<<" ";
}
  cout<<endl;

    
  return 0;
}



Measured memory_bytes: 3140
N = int(input())
p = list(map(float, input().split()))

dp=[[0 for i in range(N+1)] for j in range(N+1)]
dp[0][1]=1-p[0]
dp[1][1]=p[0]
#print(dp)
for i in range(2,N+1):
    for j in range(N+1):
        dp[j][i]=dp[j][i-1]*(1-p[i-1])+dp[j-1][i-1]*p[i-1]
num=0
for i in range((N+1)//2):
    num+=dp[i][N]
print(1-num)

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

typedef long long ll;

int main()
{
    int N, prev;
    int count = 1;
    int ans = 0;
    cin >> N;
    cin >> prev;
    for (int i = 0; i < N - 1; ++i)
    {
        int now;
        cin >> now;
        if (now == prev)
        {
            ++count;
        }
        else
        {
            ans += count / 2;
            count = 1;
        }
        prev = now;
    }
    ans += count / 2;
    cout << ans << endl;
}


Measured memory_bytes: 3636
sx,sy,tx,ty=map(int,input().split())
ans='R'*(tx-sx)+'U'*(ty-sy)+'L'*(tx-sx)+'D'*(ty-sy+1)+'R'*(tx-sx+1)+'U'*(ty-sy+1)+'L'+'U'+'L'*(tx-sx+1)+'D'*(ty-sy+1)+'R'
print(ans)

Measured memory_bytes: 3060
s_in=input()
fore=int(s_in[:2])
aft=int(s_in[2:])

if 1<=fore<=12:
    if 1<=aft<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=aft<=12:
        print('YYMM')
    else:
        print('NA')

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


int main(){
        
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);    
        double s,d,t;
        cin>>d>>t>>s;

        if(s>=d/t){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }

   return 0;

}

Measured memory_bytes: 3736
fn main() {
    proconio::input! {
        n: usize,
        a: [u64; n],
    }

    let mut r = 1000u64;
    for i in 0..n - 1{
        if a[i] < a[i + 1] {
            r += (r / a[i]) * (a[i + 1] - a[i]);
        }
    }
    println!("{}", r);
}


Measured memory_bytes: 2176
import sys
class Node:
    parent = -1
    left = -1
    right = -1

    def __init__(self, key):
        self.key = key

    def __repr__(self):
        return "k:{},p:{},l:{},r:{}".format(self.key, self.parent, self.left, self.right)

root_node_no = -1

def insert(nodes :dict, in_node :Node):
    global root_node_no

    cur_node_no = root_node_no
    parent_node_no = -1
    while cur_node_no != -1:
        parent_node_no = cur_node_no
        if in_node.key < cur_node_no:
            cur_node_no = nodes[cur_node_no].left
        else:
            cur_node_no = nodes[cur_node_no].right

    in_node.parent = parent_node_no

    if root_node_no == -1:
        root_node_no = in_node.key
    elif in_node.key < parent_node_no:
        nodes[parent_node_no].left = in_node.key
    else:
        nodes[parent_node_no].right = in_node.key

    nodes[in_node.key] = in_node

def inorder_tree_walk(nodes, node_no ,inorder):
    if node_no == -1:
        return
    inorder_tree_walk(nodes, nodes[node_no].left, inorder)
    inorder.append(node_no)
    inorder_tree_walk(nodes, nodes[node_no].right, inorder)

def preorder_tree_walk(nodes, node_no, preorder):
    if node_no == -1:
        return
    preorder.append(node_no)
    preorder_tree_walk(nodes, nodes[node_no].left, preorder)
    preorder_tree_walk(nodes, nodes[node_no].right, preorder)


def find(nodes, tgt_node_no):
    cur_node_no = root_node_no
    while cur_node_no != -1:
        cur_node = nodes[cur_node_no]
        if cur_node.key == tgt_node_no:
            return True
        elif tgt_node_no < cur_node.key:
            cur_node_no = cur_node.left
        else:
            cur_node_no = cur_node.right

    return False


def main():
    num_com = int(input())
    commands = sys.stdin.readlines()
    nodes = {}
    for i in range(num_com):
        if commands[i][0] == 'i':
            insert(nodes, Node(int(commands[i][7:])))
        elif commands[i][0] == 'p':
            # inorder
            inorder = []
            inorder_tree_walk(nodes, root_node_no, inorder)
            print(" " + " ".join(map(str, inorder)))
            # preorder
            preorder = []
            preorder_tree_walk(nodes, root_node_no, preorder)
            print(" " + " ".join(map(str, preorder)))
        elif commands[i][0] == 'f':
            if find(nodes, int(commands[i][5:])):
                print('yes')
            else:
                print('no')


main()


Measured memory_bytes: 230124
class Card:

    def __init__(self, data):
        self.mark = data[0]
        self.number = int(data[2:])

    def __str__(self):
        return f"{self.mark} {self.number}"

    def __eq__(self, other):
        return self.number == other.number

    def __ne__(self, other):
        return self.number != other.number

    def __le__(self, other):
        return self.number <= other.number

    def __lt__(self, other):
        return self.number < other.number

    def __ge__(self, other):
        return self.number >= other.number

    def __gt__(self, other):
        return self.number > other.number


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


def quickSort(p, r):
    if p < r:
        q = partition(p, r)
        quickSort(p, q - 1)
        quickSort(q + 1, r)


def is_stable():
    count = 0
    for i, a in enumerate(A):
        if i == len(A) - 1:
            return True
        k = 0
        for o in Origin:
            if a.number == o.number:
                if count != k:
                    k += 1
                    continue
                if a.mark != o.mark:
                    return False
                else:
                    break
        if a.number != A[i + 1].number:
            count = 0
        else:
            count += 1

A = []
n = int(input())
for i in range(n):
    A.append(Card(input()))
Origin = A.copy()
quickSort(0, len(A) - 1)
print("Stable" if is_stable() else "Not stable")
print("\n".join(str(a) for a in A))



Measured memory_bytes: 34172
#include<iostream>
#include<string>

using namespace std;

int main(){
    int H, W, i, j, d;
    string S[50];
    int x[8] = {1, 0, 1, -1, -1, 1, 0, -1};
    int y[8] = {0, -1, -1, -1, 0, 1, 1, 1};
    cin >> H >> W;
    for (i = 0; i < H; ++i){
        cin >> S[i];
    }
    for (i = 0; i < H; ++i){
        for (j = 0; j < W; ++j){
            int count = 0;
            if(S[i][j] == '#'){
                continue;
            }
            for(d = 0; d < 8; ++d){
                int ni = i + y[d];
                int nj = j + x[d];
                if(ni < 0 or H <= ni or nj < 0 or W <= nj){
                    continue;
                }
                if(S[ni][nj] == '#'){
                    count += 1;
                }
            }
            S[i][j] = char(count + '0');
        }
    }
    for (i = 0; i < H; ++i){
        cout << S[i] << endl;
    }
    return 0;
}

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

int main()
{
	int A,B,C;
	scanf("%d %d %d",&A,&B,&C);
	if(C<A || C>B)
	{
		printf("No");
		return 0;
	}
	printf("Yes");
	return 0;
}

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

int main() {
  int N, x, sum =0, lsum = 0, ans = INT_MAX;
  vector<int> arr;
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> x;
    arr.push_back(x);
    sum += x;
  }
  ans = sum;
  for(int i = 0; i < N; i++) {
    lsum += arr[i];
    int rsum = sum - lsum;
    ans = min(ans, abs(lsum-rsum));
  }
  cout << ans;
}




Measured memory_bytes: 256
n, k = map(int,input().split())
a = list(map(int,input().split()))

i = k
# while i < k:
#     now *= a[i]
#     i += 1
while i < n:
    old = a[i-k]
    now = a[i]
    print("Yes" if now > old else "No")
    i += 1
    # old = now
    # now = (now / a[i-k]) * a[i]
    # print("Yes" if now > old else "No")
    # i += 1


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

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

  string s;
  cin >> s;
  int cnt = -1;
  char prev = '$';
  for (auto &c : s) {
    cnt += c != prev;
    prev = c;
  }
  cout << cnt << '\n';
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,x,y;
int dis[2010][2010];
int ans[2010];
signed main(){
    cin>>n>>x>>y;
    x--,y--;
    rep(i,n){
        rep(j,n){
            if(i<j){
                int mi=INF;
                chmin(mi,j-i);
                chmin(mi,abs(i-x)+abs(j-y)+1);
                ans[mi]++;
            }
        }
    }
    for(int i=1;i<n;i++)cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 2304
import sys
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

MOD = 10**9+7

ok = set([i+1 for i in range(n)]) - set(a)
ok = list(ok)
ok.sort()

MAX_N = 10**5+5
dp = [0]*MAX_N

for i in ok:
    if i == 1:
        dp[i] = 1
    elif i == 2 and dp[1] == 0:
        dp[i] = 1
    elif i == 2:
        dp[i] = 2
    else:
        dp[i] = dp[i-2] + dp[i-1]
        dp[i] %= MOD
        
print(dp[n])

Measured memory_bytes: 26780
N,M = map(int,input().split())
S = input()
a = [0]
ans = 0
for i in range(1,N):
  if S[i - 1] == 'A' and S[i] == 'C':
    a.append(a[-1] + 1)
  else:
    a.append(a[-1])

for i in range(M):
  l,r = map(int,input().split())
  print(a[r - 1] - a[l - 1])
  

Measured memory_bytes: 6100
from sys import maxsize

l, r = [int(i) for i in input().split()]

min = maxsize
m = l
while m <= r:
    n = m + 1
    while n <= r:
        mod = m * n % 2019
        if mod < min:
            min = mod
        if mod == 0:
            break
        n += 1
    else:
        m += 1
        continue
    break

print(min)


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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    int a[100010] = {}, b[100010] = {};
    rep(i, n / 2){
        a[v[2 * i]] ++;
        b[v[2 * i + 1]] ++;
    }
    //rep(i,10) cout << a[i] << " " << b[i] << endl;
    vector<pair<int, int>> A, B;
    rep(i, 100010){
        if(a[i] != 0) A.push_back(make_pair(a[i], i));
        if(b[i] != 0) B.push_back(make_pair(b[i], i));
    }
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    sort(B.begin(),B.end());
    reverse(B.begin(),B.end());

    //rep(i, A.size()) cout << A[i].first << " " << A[i].second << endl;
    //rep(i, B.size()) cout << B[i].first << " " << B[i].second << endl;

    int a1, a2 = 0, b1, b2 = 0;
    a1 = A[0].first;
    if(A.size() > 1) a2 = A[1].first;
    b1 = B[0].first;
    if(B.size() > 1) b2 = B[1].first;

    int ans;

    if (A[0].second != B[0].second) ans = n - a1 - b1;
    else ans = min(n - a1 - b2, n - a2 - b1);

    cout << ans << endl;
}

Measured memory_bytes: 2428
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)
#define AAA (1000000007)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;



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

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


int main() {
	int i, j, k;
	ll N, M, K;
	ll ans = 0;

	ll H;
	
	vector<int> A;
	cin >> N >>K;
	rep(i, 0, N) {
		int a;
		cin >> a;
		ans += a;
		A.push_back(a);
	}

	sort(A.begin(), A.end());

	K = min(N, K);
	rep(i, 0, K) {
		ans -= A[N-i-1];


	}
	cout << ans;

	return 0;


}


Measured memory_bytes: 1400
n = int(input())
a = list(map(int, input().split()))

a.sort()
am = a[-1]

memo = [0] * (am+1)

for ai in a:
    memo[ai] = 1

p = -1

for ai in a:
    if ai == p:
        memo[ai] = 0
        continue
    for j in range(2, am // ai + 1):
        memo[ai * j] = 0
    p = ai

print(sum(memo))

Measured memory_bytes: 132804
use std::vec::Vec;
use std::collections::VecDeque;
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let MOD: u64 = 1_000_000_000 + 7;
  let n: usize = read();
  let mut dp = vec![vec![vec![vec![0; 4]; 4]; 4]; n+1];
  // 長さ０の文字列は１
  dp[0][3][3][3] = 1;
  // 文字列の文字数
  for len in 0..n {
    // 最後から１文字目の文字
    for i in 0..4 {
      // 最後から２文字目の文字
      for j in 0..4 {
        // 最後から3文字目の文字
        for k in 0..4 {
          // 条件に当てはまる物が無い場合はcontinue
          if dp[len][i][j][k] == 0 { continue; }

          // 新しく追加する文字
          for a in 0..4 {
            // ダメな５つの条件をカットする
            if a == 2 && i == 1 && j == 0 { continue; }
            if a == 2 && i == 0 && j == 1 { continue; }
            if a == 1 && i == 2 && j == 0 { continue; }
            if a == 2 && i == 1 && k == 0 { continue; }
            if a == 2 && j == 1 && k == 0 { continue; }

            // ダメな条件を抜けたら、aを足した文字列が作れる
            dp[len + 1][a][i][j] += dp[len][i][j][k];
            dp[len + 1][a][i][j] %= MOD;
          }
        }
      }
    }
  }

  let mut ans = 0;

  for i in 0..4 {
    for j in 0..4 {
      for k in 0..4 {
        ans += dp[n][i][j][k];
        ans %= MOD;
      }
    }
  }

  println!("{}", ans);
}


Measured memory_bytes: 4352