akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    while(1){
        cin>>n;
        if(n==0){break;}
        int ma[22][22]={};
        int x,y;
        for(int i=0;i<n;i++){
            cin>>x>>y;
            ma[x][y]++;
        }
        cin>>m;
        char d;
        int l;
        int sx=10,sy=10;
        int count=0;
        for(int i=0;i<m;i++){
            cin>>d>>l;
            if(d=='N'){
                for(int j=0;j<l;j++){
                    sy++;
                    if(ma[sx][sy]==1){
                        ma[sx][sy]--;
                        count++;
                    }
                }
            }
            else if(d=='E'){
                for(int j=0;j<l;j++){
                    sx++;
                    if(ma[sx][sy]==1){
                        ma[sx][sy]--;
                        count++;
                    }
                }
            }
            else if(d=='S'){
                for(int j=0;j<l;j++){
                    sy--;
                    if(ma[sx][sy]==1){
                        ma[sx][sy]--;
                        count++;
                    }
                }
            }
            else if(d=='W'){
                for(int j=0;j<l;j++){
                    sx--;
                    if(ma[sx][sy]==1){
                        ma[sx][sy]--;
                        count++;
                    }
                }
            }
        }
        if(count==n){
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,m;
	cin>>n>>m;
	vector<pair<long long,long long> > a(n);
	for(int i=0;i<n;i++){
		cin>>a[i].second>>a[i].first;
		a[i].second--; 
	}
	sort(a.rbegin(),a.rend());
	long long s=0;
	long long c=0;
	priority_queue<pair<long long,long long> > k;
	vector<long long> f(n);
	for(int i=0;i<m;i++){
		s+=a[i].first;
		if(f[a[i].second]==0) c++;
		else k.push(make_pair(-a[i].first,a[i].second));
		f[a[i].second]++;
	}
	s+=c*c;
	vector<long long> x;
	x.push_back(s);
	long long i=m;
	while(i<n && !k.empty()){
		if(f[a[i].second]!=0){
			i++;
			continue;
		}
		s-=c*c;
		s+=k.top().first;
		k.pop();c++;
		s+=c*c;s+=a[i].first;
		f[a[i].second]=1;
		x.push_back(s);
		i++;
	}
	sort(x.rbegin(),x.rend());
	cout<<x[0];
}

Measured memory_bytes: 6600
#include <stdio.h>

int main() {
	int A, B;
	scanf("%d %d",&A,&B);
	if ((double)(A + B) / 2 == (A + B) / 2) {
		printf("%d\n",(A + B) / 2);
	}
	else printf("IMPOSSIBLE\n");
	return 0;
}


Measured memory_bytes: 128
/*
 * D.cpp
 *
 *  Created on: 2017/09/30
 *      Author: litmc
 */

#define MYDEBUG
#include <bits/stdc++.h>

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define dbp4(w,x,y,z)
#define ifcin(x)
#endif
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)
#define REP(i, from, to) for(int i=from; i<=to; ++i)
#define EPS = 1e-14;
using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& v) {
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i] << endl;
  }
  return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last) {
      out << ",";
    }
  }
  out << "]";
  return out;
}

static const ll MAX_N = 100010;
int N, K;
int A[MAX_N];
ll B[MAX_N];
ll maxi, vr;
int r, kr;
void solve() {
  cin >> N >> K;
  rep(i,0,N)
  {
    cin >> A[i] >> B[i];
  }
  maxi = vr = 0;
  rep(i,0,N)
  {
    if ((K | A[i]) == K) {
      vr += B[i];
    }
  }
  maxi = vr;
  for (r = 0; r < 30; ++r) {
    if ((K >> r) % 2 == 1) { //下からr桁目が1
      kr = K & ~(1 << r);
      kr |= ((1 << r) - 1); //r桁目より下を1で埋める
//      cout << "K  = " << bitset<32>(K) << "\t";
//      cout << "Kr = " << bitset<32>(kr) << "\t";
//      cout << K << " >= " << kr << endl;
      vr = 0;
      rep(i,0,N)
      {
        if ((kr | A[i]) == kr) {
          vr += B[i];
        }
      }
      maxi = max(maxi, vr);
    }
  }
  cout << maxi << endl;
}

int main() {
  solve();
}



Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pi acos(-1)
#define mod 1000000007
#define inf INT_MAX
ll a[200005],b[200005];
int main()
{
    ll i,j,k,n,t,ans,mx,x,y,sum,m,up;
    cin>>n>>m>>k;
    a[0]=0;
    for(i=0; i<n; i++)
    {
        scanf("%lld",&x);
        a[i]+=x;
        a[i+1]=a[i];
    }
    b[0]=0;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&x);
        b[i]+=x;
        b[i+1]=b[i];
    }
    sum=k,mx=0;
    for(i=0; i<n; i++)
    {
        j=sum-a[i];
        up=upper_bound(b,b+m,j)-b;
        up--;

        if(j>=0)
            mx=max(mx,i+up+2);

    }
    for(i=0; i<m; i++)
    {
        j=sum-b[i];
        up=upper_bound(a,a+n,j)-a;
        up--;
        if(j>=0)
            mx=max(mx,i+up+2);
    }
    if(a[n-1]<=k)
        mx=max(mx,n);
    if(b[m-1]<=k)
        mx=max(m,mx);

    cout<<mx<<endl;
}


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

int main(){
	int N;
	cin >> N;
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	int k[Q];
	long long int D[N], M[N];
	for(int i=0; i<N; i++){	
		if(i == 0){
			if(S[i] == 'D'){
				D[0] = 1;
			}else{
				D[0] = 0;
			}
			if(S[i] == 'M'){
				M[0] = 1;
			}else{
				M[0] = 0;
			}
		}else{
			if(S[i] == 'D'){
				D[i] = D[i-1] + 1;
			}else{
				D[i] = D[i-1];
			}
			if(S[i] == 'M'){
				M[i] = M[i-1] + 1;
			}else{
				M[i] = M[i-1];
			}
		}
	}
	for(int i=0; i<Q; i++){
		cin >> k[i];
	}
	for(int x=0; x<Q; x++){
		long long int dmc[N], dm[N];
		dm[0] = 0, dmc[0] = 0;
		for(int i=1; i<N; i++){
			if(i+1 < k[x]){
				if(S[i] == 'M'){
					dm[i] = dm[i-1] + D[i-1];
				}else{
					dm[i] = dm[i-1];
				}
			}else{
				if(S[i-k[x]+1] == 'D' && S[i] == 'M'){
					dm[i] = dm[i-1] - M[i-1] + M[i-k[x]+1] + D[i-1] - D[i-k[x]+1];
				}else if(S[i-k[x]+1] == 'D'){
					dm[i] = dm[i-1] - M[i-1] + M[i-k[x]+1];
				}else if(S[i] == 'M'){
					dm[i] = dm[i-1] + D[i-1] - D[i-k[x]+1];
				}else{
					dm[i] = dm[i-1];
				}
			}
			if(S[i] == 'C'){
				dmc[i] = dmc[i-1] + dm[i-1];
			}else{
				dmc[i] = dmc[i-1];
			}
		}
		cout << dmc[N-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 32644
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker,"/stack:200000000")
#include <bits/stdc++.h>
using namespace std;

#define PI 2*acos(0.0)
#define print(x) return cout<<x<<endl,0
#define watch(x) cerr<<#x<<"-> "<<x<<endl
#define CLEAR(x,val) memset(x,val,sizeof(x))
// #define int long long

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

const int INF = 1000000000;
const int MOD = 1000000007; //998244353

vector <string> str = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
signed main()
{	
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	cin.tie(0), cout.tie(0);
	ios::sync_with_stdio(0);
	string s;
	cin >> s;
	int j;
	for(int i = 0; i < str.size(); i++)
		if(str[i] == s)
			j = i;
	++j;
	int res = 0;
	while(str[j++%str.size()]!="SUN")
		++res;
	return cout<<res+1<<endl,0;
}

Measured memory_bytes: 764
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int a,b;
	std::cin >> a >> b;
	for(int i=1;i<=3;i++) {
		if(i!=a && i!=b) print(i);
	}
	return 0;
}


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

int main()
{
    ll n;scanf("%lld",&n);
    if(n&1){puts("0");}
    else {
        n/=2;
        ll count=0;
        while(n){
            count+=n/5;
            n/=5;
        }
        printf("%lld",count);
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back

ll ans=1e18;
int ok=0;
void dfs(ll x,ll y,ll s,int p,ll cur) {
    if(cur >= ans) return;
    if((x^y) == s) {
        ok = 1; ans = min(ans, cur);
        return;
    }
    // check 0
    ll tmp = x ^ y;
    if((tmp>>p&1) == (s>>p&1)) {
        dfs(x, y, s, p+1, cur);
    }
    // check 1
    if(1ll<<p >= x) return;
    x -= 1ll<<p;
    y += 1ll<<p;
    tmp = x ^ y;
    if((tmp>>p&1) == (s>>p&1)) {
        dfs(x, y, s, p+1, cur+(1ll<<p));
    }
}
int main() {
    int n;
    cin>>n;
    ll x,y;
    cin>>x>>y;
    ll s=0;
    for(int i=3;i<=n;++i) {
        ll tmp;
        cin>>tmp;
        s^=tmp;
    }
    // choose minimum nonnegative k, make (x-k)^(y+k) == s
    // think about every bit of k
    // high bit will not make influence on low bit
    dfs(x,y,s,0,0);
    if(ok) cout<<ans<<endl;
    else cout<<-1<<endl;
}

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

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

#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
const int INF = 1001001001;
const ll mod = 1e9+7;

int main() {
  ll n,k;
  cin>>n>>k;
//  map <ll,ll> mp;
  vector<vector<ll>> v(n);// <d,t>


  rep(i,n){
    ll t1,d1;
    cin>>t1>>d1;
    t1--;
    v[t1].push_back(d1);

    //if (mp[t1]<d1) mp[t1]=d1;
  }
  std::priority_queue<ll, std::vector<ll>, std::greater<ll> > pq;
  priority_queue<ll>pq1;
  priority_queue<ll>pq2;

ll ans=0;
ll sm=0;
 rep(i,n){
   v[i].push_back(-INF);

    // kind++;
     sort(v[i].rbegin(),v[i].rend());
     pq2.push(v[i][0]);
    // sm+=v[i][0];
     rep(j,v[i].size()-1){
       pq1.push(v[i][j+1]);
     }
 }
rep(i,n){
  ll now=pq2.top();
  pq2.pop();
  if(i<k){
    sm+=now;
    pq.push(now);
  }
  else pq1.push(now);
}
ans=sm+k*k;
 rep(i,k){
//   cout<<sm<<' '<<ans<<endl;

   ll n1=pq.top();
   pq.pop();
   ll n2=pq1.top();
//   cout<<n1<<' '<<n2<<endl;
   pq1.pop();
   sm-=n1;
   sm+=n2;
   if (n1>=n2)break;
   ans=max(ans,sm+(k-i-1)*(k-i-1));

 }

   cout<<ans;


}


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

int main()
{
	double a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f)
	{
		if (a == 0)
		{
			double x = (c * f - b * e) / d;
			double y = b / c;
			printf("%.3f %.3f\n", x, y);
		}
		else
		{
			double x = (c / a) - (a * b * f - b * c * d) / (a * a * e - a * b * d);
			double y = (a * f - c * d) / (a * e - b * d);
			printf("%.3f %.3f\n", x, y);
		}
	}

	return 0;
}

Measured memory_bytes: 1236
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cassert>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<utility>
#define pii pair<int,int> 
#define mkpr make_pair
using namespace std;

const int N = 1e5;
multiset<int> ae[N+3];
map<pii,int> g;
queue<pii> que;
int n;

void insertedge(int u,int v)
{
	if(u==v) return;
	if(u>v) swap(u,v);
	ae[u].insert(v); ae[v].insert(u);
	g[mkpr(u,v)]++;
	if(g[mkpr(u,v)]==2) {que.push(mkpr(u,v));}
}

void deleteedge(int u,int v)
{
	ae[v].erase(ae[v].find(u));
	if(u>v) swap(u,v);
	if(g.count(mkpr(u,v))) {g.erase(mkpr(u,v));}
}

int main()
{
	scanf("%d",&n);
	for(int i=1; i<=2*(n-1); i++)
	{
		int u,v; scanf("%d%d",&u,&v);
		insertedge(u,v);
	}
	for(int i=1; i<n; i++)
	{
		while(1)
		{
			if(que.empty()) {puts("NO"); return 0;}
			int u = que.front().first,v = que.front().second; que.pop();
			if(!g.count(mkpr(u,v))) {continue;}
			if(ae[u].size()<ae[v].size()) swap(u,v);
			for(set<int>::iterator i=ae[v].begin(); i!=ae[v].end(); i++)
			{
				int x = *i;
				deleteedge(v,x);
				insertedge(u,x);
			}
			break;
		}
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 36736
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    for(int a=1; ; ++a){
        int cnt = 0;
        for(int i=1; i*i<=a; ++i){
            if(a % i == 0){
                ++ cnt;
                if(i * i < a)
                    ++ cnt;
            }
        }
        if(cnt == n){
            cout << a << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1160
#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++)
typedef long long ll;
#define all(x) (x).begin(),(x).end()
int INF = 1000000000;

int main() {
  int a; cin >> a;
  string s; cin >> s;
  if (a >= 3200) {
    cout << s << endl;
  }
  else {
    cout << "red" << endl;
  }
}

Measured memory_bytes: 256
def main():
    N, M, C = map(int, input().split())
    B = list(map(int, input().split())) # 配列として格納
    A = [[] for i in range(N)]
    for i in range(N):
        A[i] = list(map(int, input().split()))

    num = 0
    for i in range(N):
        sum = 0
        for j in range(M):
            sum = sum + A[i][j]*B[j]
        result = sum + C
        if (result > 0 ):
            num = num + 1
    print(num)
    return num

main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	char b; cin >> b;
	if( b == 'A') cout << 'T' << endl;
	if(b == 'T') cout << 'A' << endl; 
	if(b == 'C') cout << 'G' << endl;
	if(b == 'G') cout << 'C' << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ld long double
#define pi 3.14159265358979323846
#define int long long
#define mii map<int,int>
#define inf 1000000007 //10^9+7
#define sort(vec) sort(vec.begin(),vec.end());
#define rever(vec) reverse(vec.begin(),vec.end());
#define unsort(vec) sort(vec); rever(vec);
#define gcd __gcd
using namespace std;

signed main() {
  int n;
  cin>>n;
  vector<int>vec(n);
  int one=0;
  int two=0;
  int four=0;
  for(int i=0;i<n;i++) {
    cin>>vec.at(i);
    if(vec.at(i)%2==1) {
      vec.at(i)=1;
    }
    else {
      vec.at(i)%=4;
    }
  }
  sort(vec);
  for(int i=0;i<n;i++) {
    if(vec.at(i)==0) {
      four++;
    }
    else if(vec.at(i)==1) {
      one++;
    }
    else {
      two++;
    }
  }
  two%=2;
  if((one+two)<=(four+1)) {
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N;
	int d[55]={};

	cin >> N;
	for(int i=0;i<N;i++)
		cin >> d[i];
	
	int ans=0;
	for(int i=0;i<N;i++)
		for(int j=i+1;j<N;j++)
			ans+=d[i]*d[j];

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



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

int main(){
    int a[3],b,c;
    cin >> b >> c;
    a[0] = b + c;
    a[1] = b - c;
    a[2] = b * c;
    sort(a,a+3,greater<int>());
    cout << a[0] <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);
    
    int N;
    cin >> N;
    int a[100000];
    for(int i=0; i<N; i++) cin >> a[i];
    bool b[100000] = {};
    b[0] = true;
    int now = 0;
    int ans = 0;
    while(now != 1){
        now = a[now]-1;
        if(b[now]){
            cout << -1 << endl;
            return 0;
        }
        b[now] = true;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
int n,a;
int main(){
	scanf("%d%d",&n,&a);
	if(n%500 <= a) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll k;
    cin>>k;
    ll minsum=0;
    ll maxsum=0;
    vl mini,maxi;
    ll L=1e16;
    L+=1000;
    vl v;
    ll n;
    for(int i=2;i<=50;i++)
    {
        if(k<(i*L))
        {
            n=i;
            break;
        }
    }
    for(int i=0;i<n;i++)
    {
        ll left=(k-i+n)/(n+1);
        ll right=(L+k-i)/(n+1);
        minsum+=left;
        maxsum+=right;
        mini.pb(left);
        maxi.pb(right);
    }
    ll rem=k;
    for(int i=0;i<n;i++)
    {
        minsum-=mini[i];
        ll maxhere=maxi[i];
        ll a;
        if((maxhere+minsum)<=rem)
        {
            a=maxhere;
        }
        else
        {
            a=rem-minsum;
        }
        rem-=a;
        v.pb(i+(n+1)*a-k);
    }
    cout<<n<<'\n';
    for(auto it:v)
    {
        cout<<it<<' ';
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 15572
#include<stdio.h>
#define N 250
 
int parent(int i){
  return i/2;
}
 
int left(int i){
  return 2*i;
}
 
int right(int i){
  return 2*i+1;
}
 
int main(void){
  int heap_size, i, A[N];
   
  scanf("%d", &heap_size);
  for(i=1; i<=heap_size; i++) scanf("%d", &A[i]);
   
  for(i=1; i<=heap_size; i++){
     
    printf("node %d: key = %d, ", i, A[i]);
     
    if(parent(i) > 0) printf("parent key = %d, ", A[parent(i)]);
    if(left(i) <= heap_size) printf("left key = %d, ", A[left(i)]);
    if(right(i) <= heap_size) printf("right key = %d, ", A[right(i)]);
     
    printf("\n");
     
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first 
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define si size()


const int mod = 1e9 + 7;
const int N = 2e5 + 6;
int arr[N];
int DP[N][3];
string input;

int f(int idx, int cnt)
{
	if(idx >= input.size()) return 0;
	if(DP[idx][cnt] != -1) return DP[idx][cnt];
	if(idx == 0)
	{
		int ans1 = 1 + f(idx + 1, 1);
		int ans2 = 1 + f(idx + 2, 2);
		return DP[idx][cnt] = max(ans1, ans2);
	}
	else
	{
		if(cnt == 1)
		{
			int ans1 = -9999999999, ans2 = -9999999999;
			if(input[idx] != input[idx - 1]) 
			{
				ans1 = 1 + f(idx + 1, 1);
				ans2 = 1 + f(idx + 2, 2);
			}
			else if(idx != input.si - 1)
			{
				ans2 = 1 + f(idx + 2, 2);
			}
			return DP[idx][cnt] = max(ans1, ans2);
		}
		else
		{
			int ans1 = 1 + f(idx + 1, 1);
			return DP[idx][cnt] = ans1;
		}
	}
}

void solve()
{
	cin >> input;
	int n = input.size();
	memset(DP, -1, sizeof(DP));
	cout << f(0, 0);
}

int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
	// #endif
	solve();
	return 0;
}          

Measured memory_bytes: 12692
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

#define ll long long
const int maxN = 100005;
const ll INF = 1000000000000000000LL;

class TaskB {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int n;
		cin >> n;
		int ac = 0, wa = 0, tle = 0, re = 0;
		for(int i = 0; i < n; i++){
			string s;
			cin >> s;
			if(s == "AC"){
				ac++;
			}else if(s == "WA"){
				wa++;
			}else if(s == "TLE"){
				tle++;
			}else{
				re++;
			}
		}
		cout << "AC" << " x "<<ac<<endl;
		cout << "WA" << " x "<<wa<<endl;
		cout << "TLE" << " x "<<tle<<endl;
		cout << "RE" << " x "<<re<<endl;

	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskB solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 3656
N = int(input())
p = list(map(int, input().split()))
q = [0] * N
for i in range(N):
    q[p[i] - 1] = i
for i in range(N):
    print(30000 * i + 1, end = "")
    if i == N - 1:
        print()
    else:
        print(end = " ")
for i in range(N):
    print(30000 * (N - i) + q[i] + 1, end = "")
    if i == N - 1:
        print()
    else:
        print(end = " ")

Measured memory_bytes: 50992
#!/usr/bin/env python3


def main():
    import sys

    input = sys.stdin.readline

    N, Z, W = map(int, input().split())
    a = [int(x) for x in input().split()]

    if N == 1:
        print(abs(a[-1] - W))
    else:
        print(max(abs(a[-1] - W), abs(a[-2] - a[-1])))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9292
#include <cstdio>
using namespace std;

int max(int a, int b) { return a < b ? b : a; }

int board[2010][2010];

int main() {
    int N, K; scanf("%d%d", &N, &K);

    int sum = 0, white = 0;
    for(int i=0; i<N; i++) {
        int x, y; char c; scanf(" %d%d %c", &x, &y, &c);
        if(c=='W')y+=K;
        x %= 2*K, y %= 2*K;
        board[x+1][y+1]++;
    }

// ここから２次元累積和
    for(int i=1; i<=2*K; i++) {
        for(int j=1; j<=2*K; j++) {
            board[i][j] += board[i][j-1];
        }
    }

    for(int j=1; j<=2*K; j++) {
        for(int i=1; i<=2*K; i++) {
            board[i][j] += board[i-1][j];
        }
    }

// ここまで二次元累積和

    int ma = 0;
    for(int i=0; i<=K; i++) {
        for(int j=0; j<=K; j++) {
            int a = board[i][j];
            int b = board[i+K][j+K] - board[i+K][j] - board[i][j+K] + board[i][j];
            int c = board[2*K][j] - board[i+K][j];
            int d = board[i][2*K] - board[i][j+K];
            int e = board[2*K][2*K] - board[2*K][j+K] - board[i+K][2*K] + board[i+K][j+K];
            int tmp = a + b + c + d + e;
            ma = max(ma,max(tmp,N-tmp));
        }
    }
    printf("%d\n", ma);
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }

bool is_int(double t){
  return floor(t) == t;
}
int main()
{
  int n, d;
  cin >> n >> d;
  vvi x(n, vi(d));
  re(i, n) {
    re(j, d) {
      cin >> x[i][j];
    }
  }

  int cnt = 0;
  re(i, n) {
    re(j, n) {
      double dis = 0;
      if(i < j) {
        re(k, d) dis += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
        dis = sqrt(dis);
        if(is_int(dis)) cnt++;
      }
    }
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n+1) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    vector<bool> v(5);
    int a,b;
    cin >> a >> b;
    v[a] = true;
    v[b] = true;
    if(!v[1]) cout << 1 << '\n';
    else if(!v[2]) cout << 2 << '\n';
    else cout << 3 << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }


struct Point2D { 
	double x, y;
	Point2D (double a=0, double b=0) { x=a; y=b; }
};

typedef Point2D Vector2D;

double dist2D(const Point2D& a, const Point2D& b) { return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ); }

Vector2D sub_vector2D(const Vector2D& a, const Vector2D& b) {
	Vector2D ret;
	ret.x = a.x - b.x; ret.y = a.y - b.y;
	return ret;
}

double cross_product(const Vector2D& a, const Vector2D& b) { return a.x*b.y - a.y*b.x; }

double inner_product(const Vector2D& a, const Vector2D& b) { return a.x*b.x + a.y*b.y; }

int main() {
	int n; cin >> n;
	Point2D a, b, c, d;
	Vector2D x, y;
	
	while (n--) {		
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		
		x = sub_vector2D(b, a); y = sub_vector2D(d, c);
		
		if (fabs(cross_product(x, y)) < 1e-10) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;

int main(){
	int n,sw;cin>>n>>sw;
	int w[n],v[n];
	for(int i=0;i<n;i++) cin>>w[i]>>v[i];

	ll dp[n+1][100100];//第二項はvについて
	for(int i=0;i<=n;i++) for(int sum=0;sum<=100100;sum++) dp[i][sum]=INF;dp[0][0]=0;
	for(int i=0;i<n;i++){
		for(int sum=0;sum<100100;sum++){
			if(sum>=v[i]) dp[i+1][sum]=min(dp[i+1][sum],dp[i][sum-v[i]]+w[i]);//i個目をとる時元のとどっちが大きいか
			dp[i+1][sum]=min(dp[i][sum],dp[i+1][sum]);//取っても取らなくても0∼i個目の最大値をdpへ
		}
	}

	ll ans=0;
	for(int sum=0;sum<100100;sum++){
		if(dp[n][sum]<=sw) ans=sum;
	}
	cout<<ans<<endl;
}

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


int main(){
  
  unsigned long long n,tmp;
  cin >> n;
  int i=1;

  while(n>tmp){
    tmp+=pow(26,i);
    i++;
  }
  i--;
  
  //cout << i << endl;
  vector <char> rev(i);
  rep(j,i){
    char c;
    if(n%26!=0){
  	 c='a'+n%26-1;
      n/=26;
    }else{
     c='a'+25;
      n=n/26-1;
    }
    rev.at(j)=c;

   
  }
  

 reverse(rev.begin(),rev.end());
  
    rep(j,i)
      cout << rev.at(j);
  
  cout << endl;
      

  
}



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

using namespace std;
typedef long long ll;

int main(){
	int n; cin >> n;
	vector<int> T(n+1), X(n+1), Y(n+1), temp(n+1);
	T[0] = X[0] = Y[0] = temp[0] = 0;
	for(int i = 1; i <= n; i++){
		cin >> T[i] >> X[i] >> Y[i];
		temp[i] = X[i] + Y[i];
	}

	for(int i = 0; i < n; i++){
		int time = T[i+1] - T[i];
		int d = abs(temp[i+1] - temp[i]);
		if(time < d){
			cout << "No" << endl;
			return 0;
		}else{
			if(d % 2 != time % 2){
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;
}

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

struct Point
{
    int x;
    int y;
};

int main()
{
    Point s, t;
    cin >> s.x >> s.y >> t.x >> t.y;

    string result, s1, s2;
    int dx = t.x - s.x;
    int dy = t.y - s.y;
    for (int y=0; y < dy; y++)
    {
        s1 += "U";
        s2 += "D";
    }
    for (int x=0; x < dx; x++)
    {
        s1 += "R";
        s2 += "L";
    }
    result += s1 + s2;

    dx += 1;
    dy += 1;
    s1 = "L";
    s2 = "R";
    for (int y=0; y < dy; y++)
    {
        s1 += "U";
        s2 += "D";
    }
    for (int x=0; x < dx; x++)
    {
        s1 += "R";
        s2 += "L";
    }
    s1 += "D";
    s2 += "U";
    result += s1 + s2;
    cout << result << endl;

    return 0;
}

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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<double> point;
#define F first
#define S second

struct circle { point p; double r; };

const double eps = 1e-9;

// fix comparations on doubles with this two functions
int sign(double x) { return x < -eps ? -1 : x > eps; }

// circle-circle intersection
vector<point> intersect(circle C, circle D)
{
	double d = abs(C.p - D.p);
	if (sign(d - C.r - D.r) > 0) return {};      // too far
	if (sign(d - abs(C.r - D.r)) < 0) return {}; // too close
	double a = (C.r*C.r - D.r*D.r + d*d) / (2*d);
	double h = sqrt(C.r*C.r - a*a);
	point v = (D.p - C.p) / d;
	if (sign(h) == 0) return {C.p + v*a};         // touch
	return {C.p + v*a + point(0,1)*v*h,           // intersect
			C.p + v*a - point(0,1)*v*h};
}

int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, k;
	cin >> n >> k;
	vector<pair<point, double>> a(n);
	for (auto &i : a)
	{
		int x, y, c;
		cin >> x >> y >> c;
		i.F = { x, y };
		i.S = c;
	}

	auto f = [&](double x)
	{
		vector<point> v;
		vector<circle> c;
		for (auto i : a)
		{
			v.push_back(i.F);
			c.push_back({ i.F, x / i.S });
		}
		for (int i = 0; i < n; ++i)
			for (int j = i+1; j < n; ++j)
				for (auto z : intersect(c[i], c[j]))
					v.push_back(z);
		for (auto p : v)
		{
			int cnt = 0;
			for (auto i : c)
				cnt += abs(p - i.p) <= i.r + eps;
			if (cnt >= k)
				return true;
		}
		return false;
	};

	double l = 0, r = 1e6;
	for (int it = 200; it--; )
	{
		double md = (l + r) / 2.0;
		if (f(md))
			r = md;
		else
			l = md;
	}
	cout << setprecision(20) << fixed << l << '\n';

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for(int i=a;i<b;i++)
#define repds(i,a,b) for(int i=a+1;i<=b;i++)
#define rep(i,N) repd(i,0,N)
#define reps(i,N) repds(i,0,N)
#define debug(x) if(isDebugMode) cout<<#x<<"="<<x<<","
#define debugarr(arr,N,M){if(isDebugMode) rep(i,N+1){rep(j,M+1)\
	{if(arr[i][j]==INF)printf(" INF");\
		else printf(" %3d",arr[i][j]);} cout<<endl;}}
#define pb push_back
#define pob pop_back
#define cint(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long ll;
typedef pair<int,int> P;
const int INF=100000000;
const int dx[4]={ 0, 1, 0,-1};
const int dy[4]={ 1, 0,-1, 0};

bool isDebugMode=true;
//--------------------------------------//
string s;

int main(){
	cin>>s;
	if(s[0]!='A'){
		cout<<"WA"<<endl;
		return 0;
	}
	int wc=0;
	repd(i,1,s.size()){
		int c=s[i];
		if(wc==1){
			if(c<=90) {
			wc=0;break;}
		}
		else if(i>=2&&i<s.size()-1){
			if(s[i]=='C') wc++;
		}
		else{
			if(c<=90) {wc=0;break;}
		}
	}
	if(wc==1) cout<<"AC"<<endl;
	else 
		cout<<"WA"<<endl;
	return 0;
}


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

int main(){
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    sort(a,a+N);
    if(N == 1){
        cout << 1 << endl;
        return 0;
    }
    if(a[0]==1){
        if(a[1] == 1){
            cout << 0 << endl;
            return 0;
        }
        else{
            cout << 1 << endl;
            return 0;
        }
    }
    int INF = a[N-1];
    map<int,int> used;
    map<int,int> head;
    vector<int> v;
    for(int i =0; i < N; i++){
        if(used[a[i]] == 0){
            head[a[i]] = 1;
            v.push_back(a[i]);
            for(int j = a[i]; j <= INF; j+= a[i]){
                used[j] = 1;
            }
            // cout << "hoge" << endl;
        }
        else{
            if(head[a[i]] == 1) head[a[i]] = 2;
        }
    }
    int ans = 0;
    for(int i =0; i < v.size(); i++){
        if(head[v[i]] == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 54280
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

# mv_array = [set() for _ in range(n)]
score_mv_array = [[] for _ in range(n)]
score_array = [0]*n

def get_sum(array):
    score_array = [0]
    for i, a in enumerate(array):
        score_array.append(score_array[i]+a)
    return max(score_array)

def get_max(array, q, mod):
    if q == 0:
        m_score = get_sum(array[:mod])
    else:
        m_score = get_sum(array+array[:mod])
        m_score = sum(array)*(q-1) + m_score
    return m_score

for i in range(n):
    score = 0
    max_score = c[i]
    pos = i
    start_pos = p[pos]-1
    for j in range(k):
        pos = p[pos]-1
        # if pos in mv_array[i]:
        if j!=0 and pos == start_pos:
            len_mv = len(score_mv_array[i])
            q, mod = divmod(k-j, len_mv)
            score += get_max(score_mv_array[i], q, mod)
            max_score = max(score, max_score)
            break
        score += c[pos]
        # mv_array[i].add(pos)
        score_mv_array[i].append(c[pos])
        max_score = max(score, max_score)
    score_array[i] = max_score

print(max(score_array))

Measured memory_bytes: 296124
N, M = map(int, input().split())
lis = [int(x) for x in input().split()]
lis.sort()
if N >= M:
  print(0)
else:
  lis2 = []
  for i in range(M - 1):
    lis2.append(lis[i + 1] - lis[i])
  lis2.sort(reverse = True)
  k = 0
  for i in range(N - 1, M - 1):
    k += lis2[i]
  print(k)  

Measured memory_bytes: 13840
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long D = GetLong();
		long T = GetLong();
		long S = GetLong();
		WriteLine(T * S >= D ? "Yes" : "No");
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 27340
#include<stdio.h>

int main(void){
    
    int N,W[100],i,j,tmp,total=0,total1,total2,result;

    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&W[i]);
    }

    for(i=0;i<N;i++){
        total += W[i];
    }

    total1 = total;
    total2 = total;

    for(i = N-1;i >= 0;i--){
        if(total1 - W[i] * 2 >= 0){
            total1 -= W[i] * 2;
        }else{
            break;
        }
    }

    for(i = 0;i < N;i++){
        if(total2 - W[i] * 2 >= 0){
            total2 -= W[i] * 2;
        }else{
            break;
        }
    }

    if(total1 < total2){
        result = total1;
    }else{
        result = total2;
    }

    printf("%d\n",result);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <math.h>

using namespace std;

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

  long long sum = 0;
  for(int i = 1; i <= n; i++){
    if(i % 3 != 0 && i % 5 != 0){
      sum += i;
    }
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define pb push_back

using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
// const int N = 1e5 + 5;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int h, w; cin >> h >> w;
	if (h == 1 or w == 1) {cout << 1; return 0;}
	ll ans = 1LL*w*(h/2);
	if (h&1) ans += (w+1)/2;
	cout << ans;
}

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


int main()
{
  ll n;
  cin >> n;
  ll cur;
  cin >> cur;
  rep(n-1)
  {
    ll tmp;
    cin >> tmp;
    if(tmp<cur-1){
      cout << "No" << endl;
      return 0;
    } else if(tmp!=cur-1) {
      cur = tmp;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int n;
string s;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    cin>>s;

    vi r(n+1);
    vi g(n+1);
    vi b(n+1);
    FOR(i,1,n+1){
        r[i] = r[i-1] + (s[i-1]=='R'?1:0);
        g[i] = g[i-1] + (s[i-1]=='G'?1:0);
        b[i] = b[i-1] + (s[i-1]=='B'?1:0);
    }

    // DEBUG_VEC(r);
    // DEBUG_VEC(g);
    // DEBUG_VEC(b);

    ll ans=0;
    
    vector<char> c(4) ;
    c[1] = 'R';
    c[2] = 'G';
    c[3] = 'B';
    map<char,int> cm;
    cm['R'] = 1;
    cm['G'] = 2;
    cm['B'] = 3;

    REP(i,n){
        FOR(j,i+1,n){
            //DEBUG2(i,j);
            if(s[i] != s[j]){
                char k = c[6-cm[s[i]]-cm[s[j]]];
                //DEBUG2(s[i], s[j]);
                //DEBUG(k);

                auto pos = s.find(k, j+1);

                //DEBUG(pos);
                if(pos!=string::npos){
                    int ngpos=j+(j-i);
                    //DEBUG("ok");
                    //cout<<i<<" "<<j<<" "<<pos<<endl;
                    //cout<<s[i]<<s[j]<<k<<endl;
                    switch(k){
                        case 'R':
                            ans += r[n]-r[pos];
                            if(ngpos < n && ngpos >= pos && s[ngpos]=='R') ans--;
                            break;
                        case 'G':
                            ans += g[n]-g[pos];
                            if(ngpos < n && ngpos >= pos && s[ngpos]=='G') ans--;
                            break;
                        case 'B':
                            ans += b[n]-b[pos];
                            if(ngpos < n && ngpos >= pos && s[ngpos]=='B') ans--;
                            break;
                    }
                }
            }

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

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  ci(n);
  vll A(n+2);
  
  A[0]=0;
  A[n+1]=0;
    ll S=0;
  FOR(i,1,n+2){  
      ci(A[i])
    S+=abs(A[i]-A[i-1]);
  }
  FOR(i,0,n){
  co(S-abs(A[i+1]-A[i])-abs(A[i+1]-A[i+2])+abs(A[i]-A[i+2]))
}
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define fill(x,y) memset(x,y,sizeof(x))
#define name(x) #x
using namespace std;


const int INF = INT_MAX;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    int N;
    cin >> N;
    vector<double> p(N+1);
    for(auto i = 1; i<=N; i++){
        cin >> p[i];
    }
    
    VV(double) dp(N+1,vector<double>(N+1,0));
    
    dp[1][1] = p[1];
    dp[1][0] = 1-p[1];
    for(auto i = 2; i<=N; i++){
        for(auto j = 0; j<=N; j++){
            dp[i][j] = dp[i-1][j]*(1-p[i]);
            if (j-1>=0) dp[i][j]+=dp[i-1][j-1]*p[i];
        }
    }
    
    double ans = 0;
    
    for(auto i = N/2 +1; i<=N; i++){
        ans += dp[N][i];
    }
    
    printf("%.10lf\n",ans);
    
    return 0;
}




Measured memory_bytes: 70784