akhauriyash/Code-Regression huggingface dataset:
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=2e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=(xx<<3)+(xx<<1)+ch-'0';ch=getchar();}
    return xx*ff;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	fastio;

	int n,k; cin>>n>>k;
	int a[n]; forn(i,n) cin>>a[i];

	forsn(i,k,n){
		if(a[i] > a[i-k]) cout<<"Yes"<<ln;
		else cout<<"No"<<ln;
	}

	return 0;
}

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

using namespace std;
typedef long long int ll;

#define debug(val) "[ " << #val " : " << (val)
#define space " "
#define vi vector<int>
#define vl vector<ll>
#define vll vector<vector<ll>>
#define vii vector<vector<int>>
#define PI (double)(atan(1)*4)
#define pb push_back
#define pi pair<int , int >
#define ff first
#define ss second
#define INF 2000000000
vi dx = {-1, 0, 0, 1};
vi dy = {0, -1, 1, 0};
const int Mod = 1000 * 1000 * 1000 + 7;
const int maxN = 100000 * 5 + 3;
int fen[maxN], last[maxN], a[maxN];
int n;

void build() {
    for (int i = 0; i <= n; i++) fen[i] = 0;
    for (int i = 0; i <= n; i++) last[i] = -1;
}

int sum(int l) {
    int res = 0;
    while (l > 0) {
        res += fen[l];
        l -= (l & (-l));
    }
    return res;
}

int range_sum(int l, int r) {
    return sum(r) - sum(l - 1);
}

void update(int l, int delta) {
    while (l <= n) {
        fen[l] += delta;
        l += l & (-l);
    }
}

void solve() {
    int q;
    cin >> n >> q;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    build();
    vector<pair<pair<int,int> , int> > queries;
    vector<int> res(q) ;
    for (int i = 0; i < q; i++) {
        int L, R;
        cin >> L >> R;
        queries.pb({{R, L},i});
    }
    sort(queries.begin(), queries.end());
    int ptr = 1;
    for (int i = 0; i < q; i++) {
        int l = queries[i].ff.ss, r = queries[i].ff.ff;
        int q_idx = queries[i].ss ;
        for (int j = ptr; j <= r; j++) {
            int val = a[j];
            if (last[val] != -1) {
                update(last[val], -1);
            }
            ptr = r;
            last[val] = j;
            update(last[val], 1);
        }
     //   cout << "Solution of " << l << space << r << " is " << space;
        res[q_idx] = range_sum(l , r ) ;
    }
    for(int v : res) {
        cout << v << endl;
    }
}


int main() {
#ifdef _DEBUG
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0); // FAST IO
    int q = 1;
    //cin >> q;
    for (int i = 1; i <= q; i++) {
        solve();
    }
}

Measured memory_bytes: 17552
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;


int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<int>> c(10,vector<int>(10));
  vector<vector<int>> a(h,vector<int>(w));
  rep(i,10)rep(j,10){ cin>>c[i][j]; }
  rep(i,h)rep(j,w){ cin>>a[i][j]; }

  rep(k,10)rep(i,10)rep(j,10){ //k:via i:start j:goal
    if(c[i][j]>c[i][k]+c[k][j]){c[i][j]=c[i][k]+c[k][j];}
  }
  ll ans=0;
  rep(i,h)rep(j,w){
    if(a[i][j]==1 || a[i][j]==-1){ continue; }
    ans += c[a[i][j]][1];
  }

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


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
int main()
{
    Hello
    int n, ans = 0;
    cin >> n;
    int arr[n + 5];
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    bool numb = true;
    while(numb)
    {
        bool ok = true;
        numb = false;
        for(int i = 0; i < n; i++)
        {
            if(arr[i])
                numb = arr[i];
            if(arr[i] % 2 == 1)
            {
                ok = false;
                break;
            }
            arr[i] /= 2;
        }
        ans += ok;
        if(!ok)
            break;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;


int main()
{
   FAST/**/
   
   ll n;
   cin>>n;
   
   map<pair<ll,ll>,ll> ma;
   for(ll i=1;i<=n;i++)
   {
       ll temp = i;
       vector<ll> hold;
       while(temp>0)
       {
           hold.pb(temp%10);
           temp/=10;
       }
       
       if(hold.size() == 1)
            hold.pb(hold.back());
       
       ma[mp(hold[0],hold.back())]++;        
   }
   
   ll ans = 0;
   
   autoit(ma,it)
   {
       auto temp = it->ff;
       swap(temp.ff,temp.ss);
       if(ma.find(temp) == ma.end())
            continue;
       ans+=it->ss*ma[temp];        
   }
   
   cout<<ans;
        
   
   return 0;        
}  
   

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll n;cin >> n;
	vector<P> v;
	REP(i, n){
		ll a, b;cin >> a >> b;
		v.EB(b, a);
	}

	sort(ALL(v), greater<P>());

	ll now = INF;
	REP(i, n){
		now = min(now, v[i].FI);
		now -= v[i].SE;
	}

	if(now < 0)cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, x, n) for(long i = x; i < n; i++)
#define erep(i, x, n) for(long i = x; i <= n; i++)
const long MOD = 1000000007;
#define all(a) a.begin(), a.end()
#define show(ans)  cout << ans << endl;


int main() {long N, M;
cin >> N >> M; long ans;
if(N >= 2 && M >= 2){
    ans = (M-2)*(N-2);
}
else{
    ans = abs(max(N, M)-2);
}
show(ans);


  return 0;
 
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int n;cin>>n;
  int b[n-1];
  REP(i,n-1){
    cin>>b[i];
  }
  int ans = 0;
  REP(i,n){
    if(i==0){
      ans += b[0];
    }else if(i==n-1){
      ans += b[n-2];
    }else{
      ans += min(b[i],b[i-1]);
    }
  }

  cout<<ans<<endl;
 

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <bitset>

using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define pill pair<int, int>
#define mst(a, b)	memset(a, b, sizeof a)
#define REP(i, x, n)	for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 1e5 + 10;
const LL INF = 1e9 + 10;
char st[105];
int num[105];
bool isvis[105][105];
int sel[10];
priority_queue<int> Q;

int main(){
	mst(num, 0);
	int n, m;	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) {
		scanf("%s", st);
		for(int j = 0; j < strlen(st); ++j) {
			num[st[j] - 'a']++;
		}
	}
	mst(sel, 0);
	if(n % 2 == 0 && m % 2 == 0) {
		sel[4] = n * m / 4;
	} else if(n % 2 == 1 && m % 2 == 1) {
		sel[1] = 1, sel[2] = (n - 1) / 2 + (m - 1) / 2, sel[4] = (n * m - (n - 1) - (m - 1)) / 4;
	} else if(n % 2 == 0 && m % 2 == 1) {
		sel[2] = n / 2, sel[4] = (n * m - n) / 4;
	} else {
		sel[2] = m / 2, sel[4] = (n * m - m) / 4;
	}
	for(int i = 0; i < 26; ++i) {
		if(num[i] > 0)	Q.push(num[i]);
	}
	bool f = true;
	while(sel[4] > 0) {
		if(Q.empty()) {
			f = false;
			break;
		}
		int cur = Q.top();
		Q.pop();
		if(cur >= 4) {
			cur -= 4;
			if(cur > 0)
				Q.push(cur);
			sel[4]--;
		} else {
			f = false;
			break;
		}
	}
	while(sel[2] > 0) {
		if(Q.empty()) {
			f = false;
			break;
		}
		int cur = Q.top();
		Q.pop();
		if(cur >= 2) {
			cur -= 2;
			if(cur > 0)	Q.push(cur);
			sel[2]--;
		} else {
			f = false;
			break;
		}
	}
	while(sel[1] > 0) {
		if(Q.empty()) {
			f = false;
			break;
		}
		int cur = Q.top();
		Q.pop();
		if(cur >= 1) {
			cur -= 1;
			if(cur > 0)	Q.push(cur);
			sel[1]--;
		} else {
			f = false;
			break;
		}
	}
	if(f)	puts("Yes");
	else	puts("No");
	return 0;
}

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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

/*
signed main(){
    int x; cin >> x;
    //vector<int> ab(2*1e4+1);
    //vector<int> ab(2*1e4+1);
    vector<int> ab(2*1e2+1);
    for(int i=0; i<1e4; i++) ab.PB(pow(i,5));
    for(int i=0; i<1e4; i++) ab.PB(pow(i,5)*-1);
    sort(all(ab));
    rep(i,ab.size()){
        int a=x+ab[i];
        auto itr=lower_bound(all(ab),a);
        if(*itr-ab[i]==x) {
            if(*itr<0){
                *itr*=-1;
                cout<<-1*pow(*itr,1.0/5.0)<<' ';
            }else{
                cout<<pow(*itr,1.0/5.0)<<' ';
            }

            if(ab[i]<0){
                ab[i]*=-1;
                
                cout<<pow(ab[i],1.0/5.0)*-1<<endl;
                return 0;
            }else{
                
                cout<<pow(ab[i],1.0/5.0)<<endl;
                return 0;
            }
            //cout<<*itr<<' '<<ab[i]<<endl;
        }
    }
    */


    /*
    for(int i=0; i<ab.size(); i++){
        ab[i]=pow(i,5);
    }
    rep(i,ab.size()){
        int a=x-ab[i];
        int b=x+ab[i];
        auto itr1=lower_bound(all(ab),a);
        auto itr2=lower_bound(all(ab),b);
        if(*itr1-ab[i]==x) {cout<<*itr1<<' '<<ab[i]<<endl; return 0;}
        if(*itr1*-1-ab[i]==x) {cout<<*itr1*-1<<' '<<ab[i]<<endl; return 0;}
        if(*itr1*-1+ab[i]==x) {cout<<*itr1*-1<<' '<<-1*ab[i]<<endl; return 0;}
        if(*itr1*+ab[i]==x) {cout<<*itr1*-1<<' '<<ab[i]*-1<<endl; return 0;}
        if(*itr2-ab[i]==x) {cout<<*itr2<<' '<<ab[i]<<endl; return 0;}
        if(*itr2*-1-ab[i]==x) {cout<<*itr2*-1<<' '<<ab[i]<<endl; return 0;}
        if(*itr2*-1+ab[i]==x) {cout<<*itr2*-1<<' '<<-1*ab[i]<<endl; return 0;}
        if(*itr2*+ab[i]==x) {cout<<*itr2*-1<<' '<<ab[i]*-1<<endl; return 0;}

    }
    */
    /*
    for(int i=0; i<1e4; i++){
        ab[i]=-1*pow(i,5);
    }
    for(int i=1e4; i<2*1e4; i++){
        ab[i]=pow(i/1e4,5);
    }
    sort(all(ab));
    rep(i,ab.size()){
        int a=x-ab[i];
        auto itr=lower_bound(all(ab),a);
        if(*itr-ab[i]==x) {
            cout<<*itr << ' ' << ab[i]<<endl;
            return 0;
        }
    }
    */
   signed main(){
       int x; cin >> x;

       for(int i=-200; i<=200; i++){
           for(int j=-200; j<=200; j++){
               if(pow(i,5)-pow(j,5)==x){
                   cout<<i<<' '<<j<<endl;
                   return 0;
               }
           }
       }
   }




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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 110

template <typename T> T gcd(T a, T b) { while (a) { b %= a; swap(a, b); } return b; }
template <typename T> T lcm(T a, T b) { return a / gcd(a,b) * b; }

ll N;
ll T[MAX_N];

signed main()
{
    cin >> N;
    ll ans = 1;
    REP(i, N) {
        cin >> T[i];
        ans = lcm(ans, T[i]);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

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

int main(){
    std::ios::sync_with_stdio(false);
    int _a, _b, m;
    cin >> _a >> _b >> m;
    int a[_a] = {};
    int b[_b] = {};
    int x[m] = {};
    int y[m] = {};
    int c[m] = {};
    int min_a = 1 << 30;
    int min_b = 1 << 30;
    int ret = 0;
    for(int i=0;i<_a;++i)
    {
        cin >> a[i];
        min_a = min(min_a, a[i]);
    }

    for(int i=0;i<_b;++i)
    {
        cin >> b[i];
        min_b = min(min_b, b[i]);
    }
    ret = min_a + min_b;
    for(int i=0;i<m;++i)
    {
        cin >> x[i] >> y[i] >> c[i];
        x[i]--;
        y[i]--;
        ret = min(ret, a[x[i]] + b[y[i]] - c[i]);
    }

    cout << ret << endl;
}

Measured memory_bytes: 2176
#1st: Code Festival 2015 Qualifying B (0408)
if False:
    N,M=map(int,input().split())
    A=[int(i) for i in input().split()]
    B=[int(i) for i in input().split()]
    A.sort()
    B.sort()
    ans='YES'
    if N<M:
        ans='NO'
    else:
        while B:
            a=A.pop()
            b=B.pop()
            if b>a:
                ans='NO'
                break
    print(ans)

#2nd: CF2014QA-C
if False:
    A,B=map(int,input().split())
    def uruu(n):
        ret=0
        ret+=n//4
        ret-=n//100
        ret+=n//400
        return ret
    print(uruu(B)-uruu(A-1))

#3rd: Code Formula 2014 - C
if False:
    S=input()
    stack=list(S[::-1])
    # print(stack)
    user=[]
    s=stack.pop()
    while stack:
        # print(s)
        if s=="@":
            tmp=''
            x=stack.pop()
            while not(x in ('@',' ')):
                # print(x)
                tmp+=x
                if not stack:
                    break
                x=stack.pop()
            user.append(tmp)
            s=x
        else:
            s=stack.pop()
    user=list(set(user))
    user.sort()
    for u in user:
        if u:
            print(u)

#4th: Hitachi Programming Contest 2020 - A    
if True: 
    S=input()
    hi=['hi'*i for i in range(1,10)]
    print('Yes' if S in hi else 'No')


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

int main(){
    int k,s;
    cin >> k >> s;
    int res = 0;
    for(int i = 0;i<=k;i++){
        for(int j = 0;j<=k;j++){
            if(s-i-j >=0 && s-i-j <= k) res++;
        }
    }
    cout << res << endl;
}



Measured memory_bytes: 256
import sys
import math


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    H,W =map(int,input().split())
    A =[]
    mod =10**9+7
    for i in range(H):
        a =list(input())
        A.append(a)

    dp =[[0] *W for _ in range(H)]
    dp[0][0]=1
    for i in range(H):
        for j in range(W):
            if j+1<W and A[i][j+1]==".":
                dp[i][j+1] +=dp[i][j]
            if i+1<H and A[i+1][j] ==".":
                dp[i+1][j] +=dp[i][j]
                dp[i+1][j] %=mod

    print(dp[H-1][W-1]%mod)





if __name__ == "__main__":
    main()


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

int main()
{
	int N, M, K;
	cin >> N >> M >> K;
	bool res = false;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			if (i * M + j * N - i * j * 2 == K) {
				res = true;
			}
		}
	}
	cout << (res ? "Yes" : "No") << endl;
	return 0;
}


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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;
const double PI=3.1415926535897932;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

ll a,b;

int main(){
    cin >> a >> b;
    ll ans = 0;
    for(int i = 0; i < 2; i++){
        ans += max(a,b);
        if(a > b)   --a;
        else
        {
            --b;
        }
    }
    cout << ans << endl;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;


int main() {
    string s; cin >> s;
    int n = s.size();
    V<int> ans(n, 0);
    int r = 0, l = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R'){
            r++;
        }else{
            l++;
        }
        if(s[i] == 'L' && (s[i + 1] == 'R' || i == n - 1)){
            ans[i - l + 1] = l - (l / 2) + (r / 2);
            ans[i - l] = r - (r / 2) + (l / 2);
            r = l = 0;
        }
    }

    for(int i = 0; i < n; i++){
        if(i != n - 1) cout << ans[i] << " ";
        else cout << ans[i] << endl;
    }
}


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

int main(){
  int n;
  string s;
  cin>> n >> s;
  for (int i=0; i<s.size(); i++){
    int c=(int)s[i]+n;
    if (c>(int)'Z') c-=26;
    s[i]=(char)c;
  }
  cout<< s <<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int aCount = a % d == 0 ? a / d : a / d + 1;
    int bCount = c % b == 0 ? c / b : c / b + 1;
    System.out.println(aCount >= bCount ? "Yes" : "No");
  }

}

Measured memory_bytes: 35792
#include <stdio.h>
int selectionSort(int[], int);
int main(){
  int i,N;
  scanf("%d",&N);
  int A[N];
  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }
  selectionSort(A,N);
  return 0;
}

int selectionSort(int A[],int N){
  int i,j = 0,tmp;
  int minj;
  int count = 0;
  for(i = 0; i <= N-1; i++){
    minj = i;
    for(j = i; j <= N-1; j++){
      if(A[j] < A[minj]){
        minj = j;
      }
    }
    if( i != minj ){
     tmp = A[i];
     A[i] = A[minj];
     A[minj] = tmp;
     count++;
    }
  }
  for(i = 0; i < N; i++){
    if(0 < i){
      printf(" ");
    }
    printf("%d",A[i]);
  }
  printf("\n%d\n",count);
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int L[n];
    for(int i = 0 ; i < n ; i++ ) cin >> L[i];
    int count = 0;
    
    for( int i = 0 ; i < n ; i++ )
    {
        for( int j = i+1 ; j < n ; j++ )
        {
            for( int k = j+1 ; k < n ; k++ )
            {
                //cout << "L[i] = " << L[i] << " L[j] = " << L[j] << " L[k] = " << L[k] << "\n"; 
                if(L[i] != L[j] && L[j] != L[k] && L[i] != L[k])
                {
                    if( (L[i] + L[j] > L[k]) && (L[i] + L[k] > L[j]) && (L[k] + L[j] > L[i]) )
                    {
                        count++;
                    }
                }
            }
        }
    }
    cout << count;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

template <unsigned int mod>
struct ModInt {
    ll x;
    ModInt() : x(0) {}
    ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int) (1LL * x * p.x % mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }
    ModInt inverse() const { return pow(mod - 2); }
    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
};

const int mod = 1000000007;
using mint = ModInt<mod>;

int n, k;
vector<int> G[100000];
mint ans = 1;

void dfs(int v, int c, int p = -1) {
    ans *= c;
    if (p != -1) c = k - 1;
    for (auto u: G[v]) {
        if (u == p) continue;
        dfs(u, --c, v);
    }
}

void solve() {
    cin >> n >> k;
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(0, k);
    cout << ans << endl;
}

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


Measured memory_bytes: 12548
#include <stdio.h>

#define MAX 200000
long long merge(int A[],int l,int m,int r);
long long mergesort(int A[],int l,int r);

int n,c=0;
int L[MAX/2+2],R[MAX/2+2];

int main(){
  int i;
  long long re;
  int A[MAX];

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);

  re=mergesort(A,0,n);

  printf("%lld\n",re);

  return 0;
}

long long merge(int A[],int l,int m,int r){
  int n1,n2,i,j,k;
  long long cn=0;
  n1=m-l;
  n2=r-m;
  for(i=0;i<n1;i++) L[i]=A[l+i];
  for(i=0;i<n2;i++) R[i]=A[m+i];
  L[n1]=R[n2]=2000000000;
  i=0;
  j=0;
  for(k=l;k<r;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
      cn+=(n1)-i;
    }
  }
  return cn;
}

long long mergesort(int A[],int l,int r){
  long long p1,p2,p3;
  if(l+1<r){
    int m;
    m=(l+r)/2;
    p1=mergesort(A,l,m);
    p2=mergesort(A,m,r);
    p3=merge(A,l,m,r);
    return p1+p2+p3;
  }else return 0;
}



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

int main(){
    int n,k ;
    cin >> n >> k ;
    vector<bool> s(n,1) ;
    for (size_t i = 0; i < k; i++)
    {
        int d ;
        cin >> d ;
        for (int j = 0; j < d; j++)
        {
            int di ;
            cin >> di ;
            s.at(di-1) = 0 ;
        }
        
    }
    cout << accumulate(s.begin(),s.end(),0) << endl ;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,d,ans,x,y;
int main()
{
	scanf("%lld%lld",&n,&d),d=d*d;
	for(ll i=1;i<=n;i++)
	{
		scanf("%lld%lld",&x,&y);
		if(x*x+y*y<=d) ans++;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3820
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	sort.Ints(a)
	for i := 0; i < n-1; i++ {
		if a[i+1] == a[i] {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n)   for (int i = 0; i < (n); i++)
#define sz(x)       (int)x.size()
#define eb          emplace_back
#define pb          push_back
#define all(x)      x.begin(), x.end()
#define rall(x)     x.rbegin(), x.rend()
#define fi          first
#define se          second

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("io\\in.txt", "r", stdin);
    freopen("io\\out.txt", "w", stdout);
#endif

    int n, k, s;
    cin >> n >> k >> s;

    while (n--) {
        if (k) k--, cout << s;
        else if (s == 1e9) cout << 1;
        else cout << int(1e9);
        cout << ' ';
    }

    return 0;
}


Measured memory_bytes: 3668
/**
  @file b.cpp
  @title B - One Clue
  @url https://atcoder.jp/contests/abc137/tasks/abc137_b
**/

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

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

int main() {
  int K, X;
  cin >> K >> X;

  for (int i = 0; i < 2 * K - 1; i++) {
    cout << X - K + 1 + i << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

char a[105], b[105];
int n, j, aui, l, lmax;
int main()
{
    cin >> n;
    cin >> (a + 1) >> (b + 1);
    j = 1;
    for (int i = 1; i <= n; i++)
    {
        aui = i;
        l= 0;
        j =1;
        while (a[i] == b[j] && i <= n && j <= n)
        {
            i++;
            j++;
            l++;
        }
        if (i >= n)lmax = max(l , lmax);
        i = aui;
    }
    cout << 2*n - lmax;
    return 0;
}


Measured memory_bytes: 256
/*
*  Created By : solo_loser
*  OS : Ubuntu16.04
* 
*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inf 1000000007
#define fr first
#define sc second
#define eps 1e-9
#define sni(x) scanf("%d",&x)
#define snl(x) scanf("%lld", &x)
#define snc(x) scanf("%c", &c);
#define rep(i, n) for(int i = 0 ; i < n ;i ++)
#define FOR(i, x, y) for(int i = x ; i < y ; i ++)
#define DEC(i, x, y) for(int i = x ; i >= y ; i --)
#define all(v) v.begin(), v.end()
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

bool isUpper(char c) {return (c >= 'A' && c <= 'Z');}
bool isLower(char c) {return (c >= 'a' && c <= 'z');}
bool iplpha(char c) {return (c >= 'A' && c <= 'Z')||(c >= 'a' && c <= 'z');}
bool iplnum(char c) {return (c >= 'A' && c <= 'Z')||(c >= 'a' && c <= 'z')||(c >= '0' && c <= '9');}
char toUpper(char c){return isUpper(c)?c:c-'a'+'A';}
char toLower(char c){return isLower(c)?c:c+'a'-'A';}
template<typename t> t gcd(t a, t b){return ((b == 0) ? a : gcd(b, a%b));} 
template<typename t> t lcm(t a, t b){return (a * (b / gcd(a, b)));}
 

template <typename c>
int binary_search(c *a, int lo, int hi, c key){
    while(lo <= hi){
        int mid = (lo + hi) / 2;
        if(a[mid] == key){
            return mid;
        }else if(a[mid] < key){
            lo = mid + 1;
        }else{
            hi = mid - 1;
        }
    }
    return -1;
}

template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}

string toLowerCase(string s){
    rep(i, s.size()){
        if(!isLower(s[i])){
            s[i] = toLower(s[i]);
        }
    }
    return s;
}



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



void solve(){
    char a, b;
    cin >> a >> b;
    if(a < b){
        cout << "<\n";
    }else if(b < a){
        cout << ">\n";
    }else{
        cout << "=\n";
    }

}


int main(){
    std::ios::sync_with_stdio(0);
    // int start = clock();
    // freopen("input.in" , "r" , stdin);
    // freopen("output.txt", "w", stdout);
    solve();
    // cout << n;
    // int stop = clock();
    // cout << (stop - start) / 1000.0000<< endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;



int main() {
	int n; cin >> n;
	string s, t; cin >> s >> t;
	for (int i = 0; i < n; i++) {
		bool flag = true;
		for (int j = i; j < n; j++) flag &= s[j] == t[j - i];
		if (flag) {
			cout << n + i << endl;
			return 0;
		}
	}
	cout << 2 * n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <iomanip>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))

ll DET(ll a, ll b, ll c, ll d) {
  return a * d - b * c;
}

int main(void) {
  ll a,b,c,d,e,f;
  while (scanf("%lld%lld%lld%lld%lld%lld", &a, &b, &c, &d, &e, &f) == 6) {
    ll det = DET(a,b,d,e);
    ll det1 = DET(c,b,f,e);
    ll det2 = DET(a,c,d,f);
    double x = 1.0 * det1 / det;
    double y = 1.0 * det2 / det;
    printf("%.3lf %.3lf\n", x + eps, y + eps);
  }
  return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define se second
#define fi first
#define rep(i, l, r) for (ll i = (ll)(l); i < (ll)(r); i++)
#define repr(i, r, l) for (ll i = (ll)(r); i > (ll)(l); i--)
#define print(v) for (const auto itr : v){cout << itr << ' ';} cout << endl;
#define all(p) p.begin(), p.end()
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 998244353
#define endl "\n"
#define inf 1e18
using namespace std;
const ll INF = 1e18L + 5;
const ll maxn = 20005;
ll ceel(ll a, ll b){if (a % b == 0)return a / b;return a / b + 1;}
ll modneg(ll a,ll m){a = a % m;if(a<0)a=a+m;return a;}
ll powermod(ll x, unsigned ll y, ll p){ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); };


int main() 
{

fastIO;
ll test,a,b,c,d,i,j;
cin>>a>>b>>c;
cout<<ceel(a,b)*c;
return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
int main(void){
    int i,N,D;
    int count=0;
    scanf("%d%d",&N,&D);
    while(1){
        N=N-(2*D+1);
         count++;
        if(N<=0)
            break;
       
    }
    printf("%d\n",count);
}

Measured memory_bytes: 128
while input = gets.split(" ")
  if input[1] == "?" then
    exit
  elsif input[1] == "+" then
    printf "%d\n", input[0].to_i + input[2].to_i
  elsif input[1] == "-" then
    printf "%d\n", input[0].to_i - input[2].to_i
  elsif input[1] == "*" then
    printf "%d\n", input[0].to_i * input[2].to_i
  elsif input[1] == "/" then
    printf "%d\n", input[0].to_i / input[2].to_i
  end
end

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/11/29  Problem: 077_arc_c / Link: https://arc077.contest.atcoder.jp/tasks/arc077_a  ----- */
/* ------問題------

-----問題ここまで----- */
/* -----解説等-----

dequeさん…はじめて会ったね

----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	deque<int>dq;
	cin >> N;
	FOR(i, 0, N) {
		int a; cin >> a;
		if (SZ(dq) % 2 == N%2) { dq.push_back(a); }
		else { dq.push_front(a); }
	}
	FOR(i, 0, N) {
		cout << dq.front() << (i != N - 1 ? ' ' : '\n');
		dq.pop_front();
	}

	return 0;
}


Measured memory_bytes: 3072
n, k = map(int, input().split())

xs = [0] * n

for _ in range(0, k):
    input()
    tmp = map(int, input().split())
    for index in tmp:
        xs[index - 1] += 1

ans = 0
for a in xs:
    if a < 1:
        ans += 1

print(ans)


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

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
const ll MOD = 1e9+7;

/**グローバル変数**/
ll n,cnt;
string s;
ll cnt0[45], cnt1[45];

ll hoge(ll k, ll lim) {
  if (k == -1) return 0;
  ll ret = 0;
  if (lim >= (1LL<<(k+1))-1) {
    for (ll i = k; i >= 0; i--) {
      ret += (1LL << i) * max(cnt0[i], cnt1[i]);
    }
    return ret;
  }
  if (lim >= (1LL<<k)) {
    ret = max(hoge(k-1, lim) + cnt1[k] * (1LL<<k), hoge(k-1, lim - (1LL<<k)) + cnt0[k] * (1LL<<k));
  } else {
    ret = hoge(k-1, lim) + cnt1[k]*(1LL<<k);
  }
  return ret;
}

int main(){
//  ios::sync_with_stdio(false);
//  cin.tie(0);
  ll k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    ll tmp;
    cin >> tmp;
    for (int j = 0; j < 40; j++) {
      cnt1[j] += tmp & 1;
      tmp >>= 1;
    }
  }
  for (int i = 0; i < 40; i++) {
    cnt0[i] = n - cnt1[i];
  }
  cout << hoge(40, k) << endl;
  return 0;
}


Measured memory_bytes: 384
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  int n[5];
  for(int i = 0; 5 > i; i++){
    cin>>n[i];
  }
  int k;cin>>k;
  if(n[4]-n[0] > k)cout << ":(" << endl;
  else cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
using namespace std;

void solve(vector<vector<bool> > land)
{
	vector<vector<bool> > check(land.size(), vector<bool>(land[0].size(), false));

	int num = 0;
	for(unsigned i=1; i<land.size()-1; ++i){
		for(unsigned j=1; j<land[0].size()-1; ++j){
			if(!land[i][j] || check[i][j])
				continue;
			check[i][j] = true;
			++ num;

			queue<pair<int, int> > place;
			place.push(make_pair(i,j));
			while(!place.empty()){
				int y = place.front().first;
				int x = place.front().second;
				for(int dy=-1; dy<=1; ++dy){
					for(int dx=-1; dx<=1; ++dx){
						if(land[y+dy][x+dx] && !check[y+dy][x+dx]){
							check[y+dy][x+dx] = true;
							place.push(make_pair(y+dy, x+dx));
						}
					}
				}
				place.pop();
			}
		}
	}

	cout << num << endl;
}

int main()
{
	for(;;){
		int w, h;
		cin >> w >> h;
		if(w == 0 && h == 0)
			break;

		vector<vector<bool> > land(h+2, vector<bool>(w+2, false));
		for(int i=1; i<=h; ++i){
			for(int j=1; j<=w; ++j){
				int tmp;
				cin >> tmp;
				land[i][j] = (tmp == 1);
			}
		}

		solve(land);
	}

	return 0;
}

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


int root(int a[] ,int i)
{
    if(a[i] ==i )
    {
        return i ; 


    }
    else 
    return root(a , a[i]);
}

void union_1(int a[] , int size[] ,int i , int j)
{
    
    int root_A = root(a , i);

    int root_B = root(a, j);

    if(root_A ==root_B)
    {
        return ; 
    }
    if(size[root_A] >= size[root_B])
    {
        a[root_B] = a[root_A];
        size[root_A]+= size[root_B];
        size[root_B] =0 ; 
    }
    else 
    {
        a[root_A] = a[root_B];
        size[root_B]+=size[root_A];
        size[root_A] =0 ; 
    }
}
int main()
{
    int n,m; 
    cin>>n>>m; 

    int  a[n],size[n];

    for(int i=0 ; i<n;i++)
    {
        a[i] =i ;
        size[i] =1;  
    }

    for(int i=0 ; i<m;i++ )
    {
        int x,y;
        cin>>x>>y;

        union_1(a , size , x -1, y - 1); 



    }
     

    int max_1 = INT_MIN  ;
    for(int i=0 ; i<n;i++ )
    {

        max_1 = max(size[i] , max_1);

        

    }
    cout<<max_1 ; 


}

Measured memory_bytes: 5156
import sys
n,k=map(int,input().split())
if k==0:
    print(n**2)
    sys.exit()
ans=0
for i in range(k+1,n+1):
    ans+=(n//i)*(i-k)
    if n%i>=k:
        ans+=n%i-k+1
print(ans)

Measured memory_bytes: 38896
#include <bits/stdc++.h>
#define fi first
#define se second
using ll = long long;
using namespace std;

int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    vector<string> w {"Sunny", "Cloudy", "Rainy"};
    cout << w[(find(w.begin(), w.end(), s) - w.begin() + 1) % 3] << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

int main(){
    ll A;
    cin >> A;
    ll B;
    cin >> B;
    ll C;
    cin >> C;
    ll D;
    cin >> D;
    while(1){
        C-=B;if(C<=0){cout<<"Yes"<<endl;break;}
        A-=D;if(A<=0){cout<<"No"<<endl;break;}
    }

    return 0;
}


Measured memory_bytes: 3624
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main()
{
  ll n;
  cin >> n;
  vector<ll> a(n), b(n), c(n);
  for (ll i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  for (ll i = 0; i < n; i++)
  {
    cin >> b[i];
  }
  for (ll i = 0; i < n; i++)
  {
    cin >> c[i];
  }
  sort(a.begin(), a.end());
  sort(c.begin(), c.end());

  ll ans = 0;
  for (ll i = 0; i < n; i++)
  {
    vector<ll>::iterator lb = lower_bound(a.begin(), a.end(), b[i]);
    vector<ll>::iterator ub = upper_bound(c.begin(), c.end(), b[i]);
    ans += (lb - a.begin()) * (c.end() - ub);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define MOD 1000000007
typedef long long ll;
using namespace std;

string n;
int k;
ll dp[105][2][5];

int main(){
  cin >> n >> k;
  int nsize = (int)n.size();

  dp[0][0][0] = 1;

  for(int i=0;i<nsize;i++){
    for(int isless=0;isless<2;isless++){
      for(int j=0;j<=k;j++){
        int c = n[i] - '0';
        for(int num=0;num<=9;num++){
          
          if(c < num && isless == 0) continue;

          int isless_next = isless;
          if(num < c) isless_next = 1;

          int j_next = j;
          if(num != 0) j_next++;

          dp[i+1][isless_next][j_next] += dp[i][isless][j];

        }
      }
    }
  }

  cout << dp[nsize][0][k] + dp[nsize][1][k] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    int N;cin>>N;
    map<str, int> odd;
    map<str, int> even;
    set<str> m;
    map<str, int>::iterator ite;
    for(int i=1;i<=N;i++){
      str vv; cin>>vv; m.insert(vv);
      if(i%2==0) even[vv]++;
      else odd[vv]++;
    }

    vector<pair<int, str> > vodd;
    vector<pair<int, str> > veven;

    for(ite = odd.begin(); ite != odd.end() ; ++ite){
      vodd.push_back(make_pair(ite->second, ite->first));
    }
    for(ite = even.begin(); ite != even.end() ; ++ite){
      veven.push_back(make_pair(ite->second, ite->first));
    }

    sort(vodd.rbegin(), vodd.rend()); sort(veven.rbegin(), veven.rend());
    int ans;
    if(m.size()==1){
      ans = N - max(vodd[0].first, veven[0].first);
    }else if(vodd[0].second == veven[0].second){
      int ans1 = N - vodd[0].first - veven[1].first;
      int ans2 = N - vodd[1].first - veven[0].first;
      ans = min(ans1, ans2);
    }else{
      ans = N - vodd[0].first - veven[0].first;
    }

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


Measured memory_bytes: 18168
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std;
using ll = long long;
int main() {
    int i, t, temp;
    int minsize = 9999999;
    vector<int> v;
    int n;
  	cin >> n;
    for (i=0;i<n;i++) {
        cin >> t; 
        v.push_back(t);
    }
  	//cout << v[0] << endl;
    for (i=-100;i<101;i++) {
      	temp = 0;
        for (t=0;t<n;t++) {
            temp += (v[t]-i)*(v[t]-i);
            //cout << "aaa" << endl;
        }
        if (temp < minsize) minsize = temp;
    }
    cout << minsize << endl; 
}

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

#define pb push_back
#define ff first
#define ss second

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

ll n, a, b;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> a >> b;
	if (n == 1) {
		if (a ^ b)
			cout << 0 << endl;
		else
			cout << 1 << endl;
	}
	else
		cout << max(0LL, (n - 2) * b - (n - 2) * a + 1) << endl;
	return 0;
}


Measured memory_bytes: 256