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

int main() {
    int N;
    string S;
    cin >> N;
    cin >> S;
    int w[300010] = {0};
    int e[300010] = {0};
    if (S[0] == 'W') {
        w[0] = 1;
    }
    else {
        e[0] = 1;
    }
    for (int i=1; i<N; i++) {
        if (S[i] == 'W') {
            w[i] = w[i-1] + 1;
            e[i] = e[i-1];
        } else {
            w[i] = w[i-1];
            e[i] = e[i-1] + 1;
        }
    }
    int ans = e[N-1] - e[0];
    for (int i=1; i<N; i++) {
        int count = w[i-1] + e[N-1] - e[i];
        if (count < ans) ans = min(ans, count);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;

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

    ll ans = 0;
    for (ll i = 0; i < n; i++) {
        if (i >= k) ans += h[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
package main

import "fmt"

var adj [1e5][]uint32

const mod uint64 = 1e9 + 7

func dfs(cur, parent uint32) (uint64, uint64) {
	var black, white uint64 = 1, 1
	for _, child := range adj[cur] {
		if child != parent {
			b, w := dfs(child, cur)
			black = (black * w) % mod
			white = (white * (b + w)) % mod
		}
	}
	return black, white
}

func main() {
	var n int
	var x, y uint32
	fmt.Scan(&n)
	for i := 1; i < n; i++ {
		fmt.Scan(&x, &y)
		x--
		y--
		adj[x] = append(adj[x], y)
		adj[y] = append(adj[y], x)
	}

	b, w := dfs(0, 0)
	fmt.Println((b + w) % mod)
}


Measured memory_bytes: 31872
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

ll modadd(ll x, ll y) {
    return ((x + y) % mod + mod) % mod;
}

ll modminus(ll x, ll y) {
    return (x - y + mod) % mod;
}

ll multiply(ll x, ll y) {
    return (x % mod) * (y % mod) % mod;
}

ll modpower(ll x, ll y) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else if (y % 2 == 0) {
        ll p = modpower(x, y / 2);
        return p * p % mod;
    } else {
        ll p = modpower (x, y / 2);
        return (p * p) % mod * (x % mod) % mod;
    }
}

ll dp[405][405];

ll posum[405][405];

int main() {
    ll N, C;
    cin >> N >> C;
    ll A[N], B[N];
    REP(i, 0, N) {
        cin >> A[i];
    }
    REP(i, 0, N) {
        cin >> B[i];
    }
    REP(i, 0, 405) {
        fill(dp[i], dp[i] + 405, 0);
    }
    dp[0][0] = 1;
    // REP(i, 0, N) {
    //     REP(j, 0, C + 1) {
    //         ll po = 1;
    //         PER(k, j, -1) {
    //             dp[i + 1][j] = modadd(dp[i + 1][j], multiply(dp[i][k], po));
    //             po = multiply(po, A[i]);
    //         }
    //     }
    // }
    REP(i, 0, 405) {
        posum[i][0] = 1;
        REP(j, 1, 405) {
            posum[i][j] = multiply(posum[i][j - 1], i);
        }
    }
    REP(i, 1, 405) {
        REP(j, 0, 405) {
            posum[i][j] += posum[i - 1][j];
        }
    }
    // REP(i, 0, 10) {
    //     REP(j, 0, 10) {
    //         cout << posum[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    REP(i, 0, N) {
        REP(j, 0, C + 1) {
            PER(k, j, -1) {
                ll po = modminus(posum[B[i]][j - k], posum[A[i] - 1][j - k]);
                //cout << po << " ";
                dp[i + 1][j] = modadd(dp[i + 1][j], multiply(dp[i][k], po));
            }
            //cout << endl;
        }
    }
    ll ans = dp[N][C];
    cout << ans << endl;
}


Measured memory_bytes: 2816
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<bitset>
#include<set>
#define N (500010)
#define M ()
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
#define spa print(' ')
#define ent print('\n')
#define rand() (((rand())<<(15))^(rand()))
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
namespace fastIO1{
	inline char read(){
		static const int IN_LEN=1000000;
		static char buf[IN_LEN],*s,*t;
		return (s==t?t=(s=buf)+fread(buf,1,IN_LEN,stdin),(s==t?-1:*s++):*s++);
	}
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=read();!isdigit(c);c=read()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=read())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
	inline char readc(char &c){
		for(c=read();!isalpha(c)&&!isdigit(c);c=read())
		if(c==-1)return 0;
	}
	const int OUT_LEN = 10000000;
	char obuf[OUT_LEN],*ooh=obuf;
	inline void print(char c){
		if(ooh==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
		*ooh++=c;
	}
	template<class T>
	inline void print(T x){
		static int buf[30],cnt;
		if(x==0)print('0');
		else{
			if(x<0)print('-'),x=-x;
			for(cnt=0;x;x/=10)buf[++cnt]=x%10+48;
			while(cnt)print((char)buf[cnt--]);
		}
	}
	inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
}
namespace fastIO2{
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=getchar();!isdigit(c);c=getchar()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=getchar())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
}
using namespace fastIO1;
struct edge{
	int x,y,c;
}e[N];
int n,m,g,P,Q,fa[N],pos[N][2][3],res,tot; bool can[1000010][2];
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ask(int x){return fa[x]==x?x:fa[x]=ask(fa[x]);}
void unite(int x,int y){
	x=ask(x),y=ask(y);
	if(x!=y)fa[x]=y;
}
int main(){
//	freopen("01.txt","r",stdin);
//	freopen("my.out","w",stdout);
	read(n),read(m),read(Q),read(P),g=P; 
	for(int i=1;i<=m;i++)
	read(e[i].x),read(e[i].y),read(e[i].c),
	g=gcd(g,(int)abs(e[i].c-e[1].c));
//	cout<<g<<endl; 
	P=gcd(P,3*g),res=e[1].c%g;
	for(int i=1;i<=n*6;i++)fa[i]=i;
	for(int i=0,x=res;i<=P;i++,x=(x+x)%P)can[x][i&1]=1;
	for(int i=1;i<=n;i++)
	for(int j=0;j<=1;j++)
	for(int k=0;k<=2;k++)
	pos[i][j][k]=++tot;
	for(int i=1;i<=m;i++){
		int w=(e[i].c-res)%P/g,x=e[i].x,y=e[i].y;
		for(int j=0;j<=1;j++)
		for(int k=0;k<=2;k++)
		unite(pos[x][j][k],pos[y][j^1][(2*k+w)%3]);
	}
	while(Q--){
		int x,y,z; bool fl=0;
		read(x),read(y),read(z);
		for(int i=0;i<=1;i++)
		for(int j=0;j<=2;j++)
		fl|=(ask(pos[y][0][0])==ask(pos[x][i][j]))&&can[(z+res+(3-j)*g)%P][i];
		puts(fl?"YES":"NO");
	}
}

Measured memory_bytes: 9600
N=int(input())
T=[]

A=[1,1]

for i in range(N):
	t=list(map(int,input().split()))
	
	n0 = (A[0]-1)//t[0] + 1
	n1 = (A[1]-1)//t[1] + 1
	n = max(n0,n1)

	A[0]=t[0]*n
	A[1]=t[1]*n


print(sum(A))

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

using namespace std;

const int maxN = 105;
const int maxW = 1e5+5;
const long long INF = 1e18;

long long DP[maxW];
pair<int, int> A[maxN];
int n, w;



void solve() {
    cin >> n >> w;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        A[i] = {a, b};
    }
    for(int i = 1; i < maxW; i++)
        DP[i] = INF;
    for(int i = 0; i < n; i++){
        int price = A[i].second;
        int weight = A[i].first;
        for(int j = maxW-1; j >= 0; j--){
            if(j-price < 0) break;
            DP[j] = min(DP[j], DP[j-price]+weight);
        }
    }
    int best = 0;
    for(int i = 1; i < maxW; i++)
        if(DP[i] <= w) best = i;
    cout << best << "\n";

}

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

    bool multitest = false;
    //multitest = true;
    if (multitest) {
        int t; cin >> t;
        while (t--)
            solve();
    }
    else
        solve();
}


Measured memory_bytes: 4380
#include<cstdio>
    #include<cstdlib>
    #include<cmath>
    #include<iostream>
    #include<string>
    #include<stack>
    #include<queue>
    #include<vector>
    #include<map>
    #include<algorithm>
     
    #define INT unsigned long long int
    #define FOR1(n) for(int i=0;i<n;i++)
    #define FOR2(j, n) for(int j=0;j<n;j++)
    #define FOR3(i, m, n) for(int i=m;i<=n;i++)
    #define PINT(d) printf("%d\n", d);
    #define PDOUBLE(lf) printf("%lf\n", lf);
    #define PSTR(s) printf("%s\n", s);
    #define ALL(c) c.begin(), c.end()
    #define MOD 1000000007
    #define MAX_N 100000
     
    using namespace std;
     
    main(){
        INT a,b,c,ans;
        cin >> a >> b >> c;
        INT minp = a * b, max = c;
        if(minp > b * c){
            max = a;
            minp = b * c;
        }
        if(minp > a * c){
            max = b;
            minp = a * c;
        }
        if(max % 2 == 0){
            ans = 0;
        }else{
            ans = minp;
        }
        cout << ans;
    }

Measured memory_bytes: 256
#include <stdio.h>
#define N 1000000

int main(void) {

    int i, j, k;
    int n, H[N], W[N];

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

    i = 0;
    while (1) {
        scanf("%d%d", &H[i], &W[i]);
        if ((H[i] == 0) && (W[i] == 0)) {
            break;
        }
        i++;
    }
    n = i;

    for (i = 0; i < n; i++) {
        for (j = 1; j <= H[i]; j++) {
            for (k = 1; k <= W[i]; k++) {
                if ((j == 1) || (j == H[i])) {
                    printf("#");
                } else {
                    if ((k == 1) || (k == W[i])) {
                        printf("#");
                    } else {
                        printf(".");
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
    }

    return 0;

}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    lint x, y, z, k;
    cin >> x >> y >> z >> k;

    vector<lint> a(x), b(y), c(z);
    rep(i, x){
        cin >> a[i];
    }
    rep(i, y){
        cin >> b[i];
    }
    rep(i, z){
        cin >> c[i];
    }

    vector<lint> v;
    rep(i, x){
        rep(j, y){
            v.emplace_back(a[i] + b[j]);
        }
    }
    SORT_INV(v);

    vector<lint> t;
    rep(i, min(k, x * y)){
        rep(j, z){
            t.emplace_back(v[i] + c[j]);
        }
    }
    SORT_INV(t);

    rep(i, k){
        cout << t[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 43368
#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>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <tuple> 
#include <memory>
#include <random>
#include <iterator>

using namespace std;

//ユニークな要素数
template <typename T>
unsigned long long UniqueElementNum(const vector<T>& data)
{
	auto copy = data;

	sort(begin(copy), end(copy));
	copy.erase(unique(begin(copy), end(copy)), end(copy));

	return copy.size();

	//set<unsigned long long>(begin(copy), end(copy)).size();
}

//最小公倍数
long long gcd(long long a, long long b)
{
	long long c;

	if (a < b) {
		a += b; b = a - b; a -= b;
	}

	while (b != 0) {
		c = a % b;
		a = b;
		b = c;
	}

	return a;
}

//要素数Nと各要素をコンテナに格納
//#TODO いろんなコンテナに対応
template <typename ElementNum, typename Container>
void InputNumAndElement(ElementNum& num, Container& container)
{
	cin >> num;

	container.resize(num);
	for (auto& d : container) {
		cin >> d;
	}
}

//コンテナの内容をstreamへ出力
//今はてきとーにcoutへ改行しながら　果たしてこの書き方は便利なのか…？
//#TODO 引数増やしたりオーバーロード増やしたり
template <typename Container>
void ShowContainer(const Container& container)
{
	ostream_iterator<string> outItr(cout, "\n");
	copy(container.begin(), container.end(), outItr);
	cout << endl;
}

int main() {
	unsigned long long N, M;
	vector<string> bludCardList, redCardList;
	InputNumAndElement(N, bludCardList);
	InputNumAndElement(M, redCardList);

	//ShowContainer(bludCardList);
	//ShowContainer(redCardList);

	vector<string> blueCopy = bludCardList;
	sort(begin(blueCopy), end(blueCopy));
	blueCopy.erase(unique(begin(blueCopy), end(blueCopy)), end(blueCopy));

	long long maxValue = 0;
	for (const auto& u : blueCopy) {
		long long value = count(begin(bludCardList), end(bludCardList), u) - count(begin(redCardList), end(redCardList), u);
		maxValue = std::max(value, maxValue);
	}

	cout << maxValue;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,m ;
  int a[105];
  cin >> n >> m;
  FOR(i,n) cin >> a[i];
  sort(a,a+n);
  int ans=0;
  while(m>=0 && ans<n ){
    m-=a[ans];
    ans++;
  }
  if(ans==n && m==0) ans++;
  cout << ans-1 fin;
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip> 
#include <bits/stdc++.h>
using namespace std;
double pi=3.14159265358979323846264338;
const int MOD=1000000007;
vector<int>arr[100001];
vector<int>arr2[100001];
queue<int>que;
int arr3[100001];
const int ad='A'-'a';

int main() {
	int n;
	cin>>n;
	for(int i=1;i<n;i++){
		int a,b,c;
		cin>>a>>b>>c;
		if(!(c%2)){
			//cout<<a<<b<<c<<endl;
			arr[a].push_back(b);
			arr[b].push_back(a);
		}
		else{
			//cout<<a<<b<<c<<c%2<<endl;
			arr2[a].push_back(b);
			arr2[b].push_back(a);
		}
	}
	que.push(1);
	arr3[1]=1;
	while(!que.empty()){
		int cur=que.front();
		que.pop();
		for(auto c:arr[cur]){
			if(!arr3[c]){
				arr3[c]=arr3[cur];
				que.push(c);
				//cout<<arr3[c]<<" "<<cur<<" "<<arr3[cur]<<endl;
			}
		}
		for(auto c:arr2[cur]){
			if(!arr3[c]){
				arr3[c]=3-arr3[cur];
				que.push(c);
			}
		}
	}
	for(int i=1;i<=n;i++){
		cout<<arr3[i]-1<<endl;
	}
  return 0;
}




Measured memory_bytes: 12896
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,m;
ll dp[5010][5010];
//dp[i][j]=i回でj文字になる場合の数
char s[5010];
int main(){
	scanf("%lld %s",&n,s);
	m=strlen(s);
	dp[0][0]=1;
	rep(i,0,n)rep(j,0,i+1){
		dp[i+1][j+1]=(dp[i+1][j+1]+dp[i][j]*2)%MOD;
		dp[i+1][max(0,j-1)]=(dp[i+1][max(0,j-1)]+dp[i][j])%MOD;
	}
	printf("%lld",dp[n][m]*invp(pom(2,m,MOD),MOD)%MOD);
}

Measured memory_bytes: 194048
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

int main () {
  ll n;
  cin >> n;
  vector<ll> t(n), a(n);
  rep(i,n) cin >> t[i] >> a[i];

  ll nt = t[0], na = a[0];
  rep(i,n-1) {
    ll m = max(dup(nt,t[i+1]),dup(na,a[i+1]));
    nt = m*t[i+1];
    na = m*a[i+1];
  }

  cout << nt+na << endl;
}

Measured memory_bytes: 256
a = [int(i) for i in input().split()] 
b = []
for i in a:
    if i in [2, 3, 5, 6, 8]:
        print("NO")
        break
    elif i in b:
        print("NO")
        break
    else:
        b.append(i)
        if len(b) == 4:
            print("YES")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
  int n,x,ans;
  int count = 0;
  while(cin>>n>>x){
    if(n==0&&x==0) break;
    for(int i=1;i<=n;i++){
      for(int j=1;j<=n;j++){
	for(int k=1;k<=n;k++){
	  if(i==j==k) continue;
	  else if(i==j||i==k||j==k) continue; 	 
	  else if(i>j||i>k||j>k) continue;
	  ans = i + j + k;
	  if(ans==x) count++;
	}
      }
    }
    cout << count << endl;
    count = 0;
  } 
  return 0;
}

Measured memory_bytes: 1160
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let s: usize = read().unwrap();
    let w: usize = read().unwrap();
    if w >= s {
        println!("unsafe");
    } else {
        println!("safe");
    }
}


Measured memory_bytes: 2096
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int isprime(int n){
    int count =0;
    for(int i=2;i<=sqrt(n);i++)
    if(n%i==0)count++;
    if(count)return 0;
    return 1;
}
int main()
{
 int n,k;
 cin>>n>>k;
 int h[n];
   for(int i=0;i<n;i++)
   cin>>h[i];
   int dp[n];
   dp[0]=0;
   dp[1]=abs(h[1]-h[0]);
   for(int i=2;i<n;i++){
       dp[i]=INT_MAX;
       int p =min(k,i);
      for(int j=1;j<=p;j++)
         dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
   }
   cout<<dp[n-1];
   
    return 0;
}

Measured memory_bytes: 1024
N,X,Y=map(int,input().split())

d=[[0 for _ in range(N)] for _ in range(N)]

for i in range(N):
    for j in range(i+1,N):
        d[i][j]=min(abs(i-j),abs(X-1-i)+abs(Y-1-j)+1,abs(X-1-j)+abs(Y-1-i)+1)

ans=[0 for _ in range(N)]
for k in range(N):
    for l in range(k+1,N):
        if d[k][l]<N:
            ans[d[k][l]]+=1
    
for o in range(N-1):
    print(ans[o+1])

Measured memory_bytes: 82652
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll MOD=1000000007;
mat mul(mat A, mat B){
    mat C(A.size(), vec(B[0].size()));
    rep(i,0,A.size()){
        rep(k,0,B.size()){
            rep(j,0,B[0].size()){
                C[i][j]+=A[i][k]*B[k][j];
            }
        }
    }
    return C;
}
int N,M,C;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>M>>C;
    mat B(M+1,vec(1,1));
    rep(i,0,M) cin>>B[i][0];
    mat A(N,vec(M+1,C));
    rep(i,0,N){
        rep(j,0,M){
            cin>>A[i][j];
        }
    }
    A=mul(A,B);
    int ans=0;
    rep(i,0,N){
        if(A[i][0]>0) ans++;
    }
    cout <<ans<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  vector<string> result(N);
  for(int i=0;i<N;i++)
    cin >> result[i];
  vector<int> save_1;
  vector<int> save_2;
  
  for (int i = 0; i < N; i++){
    int flag = 0;
    for (int j = 0; j < M; j++){
      if (result.at(i).at(j) == '#'){
        flag = 1;
        break;
      }
    }
    if (flag==0) save_1.push_back(i);
  }
  for (int i = 0; i < M; i++){
    int flag = 0;
    for (int j = 0; j < N; j++){
      if (result.at(j).at(i) == '#'){
        flag = 1;
        break;
      }
    }
    if (flag==0) save_2.push_back(i);
  }
  
  
  for (int i = 0;i < N;i++){
    int flag2 = 0;
    for (int s1 =0; s1 < save_1.size();s1++){
      if (save_1.at(s1) == i) flag2 = 1;
    }
    if (flag2 == 1) continue;
    
    for (int j =0;j < M;j++){
      int flag3 = 0;
      for (int s2 =0; s2 < save_2.size();s2++){
        if (save_2.at(s2) == j) flag3 = 1;
      }
      if (flag3 == 1) continue;
      cout << result.at(i).at(j);
    }
  cout << endl;
  }
}

Measured memory_bytes: 256
//BISMILLAHIR RAHMANIR RAHEEM
                                                //ALLAH IS WATCHING ME

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█


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

#define ull    unsigned long long
#define ll    long long
#define ios    ios::sync_with_stdio(0);cin.tie(0);
#define ses   "\n"

string digit="0123456789";
string small="abcdefghijklmnopqrstuvwxyz";

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

/////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////

//main function is here.........

int main()
{
    //ios
ll h,n,sum=0;
cin>>h>>n;
ll arr[n];
for(ll i=0;i<n;i++){cin>>arr[i];sum+=arr[i];}
if(sum>=h)cout<<"Yes";
else cout<<"No";
}




//Alhamdulillah


Measured memory_bytes: 1024
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , q ;
ll LCM(ll x , ll y){ return x/__gcd(x,y)*y; }
int main ( ){
int t ;
cin >> t ;
ll lcm , x ;
cin >>x ;
lcm = x ;
t--;
while (t--){
cin >> x ;
lcm = LCM(lcm,x);

}
cout << lcm;
return 0 ;
}


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

int main(){
  int n; cin>>n;
  double t,a,dif = 1000; cin>>t >>a;
  int ans=0;
  
  for(int i=0;i<n;i++){
    double h; cin>>h;
    dif = min(dif,abs(t-h*0.006 - a));
    if(dif == abs(t-h*0.006 - a)){
      ans = i+1;
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define LL long long int
#define MAXN 200000

LL factorial[MAXN + 3];

LL fastExponentiation(LL base, LL p) {
    if (p == 0)
        return 1;

    LL half = fastExponentiation(base, p/2);
    LL halfhalf = (half * half)%MOD;

    if (p % 2 == 0) return halfhalf;
    if (p % 2 == 1) return (halfhalf * base)%MOD;
}

LL C(int n, int k) {
    if (k > n) return 0;

    LL numerator = factorial[n];
    LL denominator = (factorial[n - k] * factorial[k])%MOD;
    return (numerator * fastExponentiation(denominator, MOD - 2))%MOD;
}

int main() {
    factorial[0] = 1;
    for (int i = 1; i <= MAXN; i++) {
        factorial[i] = (factorial[i - 1] * i)%MOD;
    }

    int N, M, K;

    cin >> N >> M >> K;

    LL answer, sumHorizontal = 0, sumVertical = 0;

    //sum horizontal distances
    for (int dist = 1; dist < M; dist++) {
        LL temp = 1;

        temp = (temp * (M - dist))%MOD; //There are (M - dist) ways to choose the first two place with distance dist
        temp = (temp * N * N)%MOD; //Number of ways to choose the rows of the first two place
        temp = (temp * C(N * M - 2, K - 2))%MOD; //Spread K - 2 leftovers into other cells
        temp = (temp * dist)%MOD; //Each of them contributes dist to answer

        sumHorizontal = (sumHorizontal + temp)%MOD;
    }

    //sum vertical distances (similar to the previous)
    for (int dist = 1; dist < N; dist++) {
        LL temp = 1;

        temp = (temp * (N - dist))%MOD;
        temp = (temp * M * M)%MOD;
        temp = (temp * C(N * M - 2, K - 2))%MOD;
        temp = (temp * dist)%MOD;

        sumVertical = (sumVertical + temp)%MOD;
    }

    answer = (sumHorizontal + sumVertical)%MOD;

    cout << answer << endl;
}


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

int main(void)
{
    int n, m;
    cin >> n >> m;
    
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        string str;
        cin >> str;
        
        ans += count(str.begin(), str.end(), '#');
    }
    
    if (ans == n + m - 1)
        cout << "Possible";
    else
        cout << "Impossible";

    return 0;
}


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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

typedef struct nodP{
  int k;
  int v;
} node;

node *deque;
int front;
int last;
int size;
int len;

void push(int k,int v){
  size++;
  front=(front-1+len)%len;
  deque[front].k=k;
  deque[front].v=v;
  return;
}

void append(int k,int v){
  size++;
  deque[last].k=k;
  deque[last].v=v;
  last=(last+1)%len;
  return;
}

void pop(int *k,int *v){
  if(size==0){
    printf("ERROR\n");
    exit(1);
  }
  *k=deque[front].k;
  *v=deque[front].v;
  front=(front+1)%len;
  return;
}

void init(int n){
  deque=(node *)malloc(sizeof(node)*n);
  front=last=0;
  len=n;
  size=0;
  return;
}

void run(void){
  int n;
  scanf("%d",&n);
  while(n%2==0) n/=2;
  while(n%5==0) n/=5;
  if(n==1){
    printf("1\n");
    return;
  }
  const int m=n;
  int *dp=(int *)calloc(m,sizeof(int));
  init(4*m);
  push(1,1);
  while(dp[0]==0){
    int k,v;
    pop(&k,&v);
    if(dp[v]>0) continue;
    dp[v]=k;
    push(k,10*v%m);
    append(k+1,v+1);
  }
  printf("%d\n",dp[0]);
  return;
}

int main(void){
  run();
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n;
	string s; cin>>n>>s;
	vector<int> v(n);
	rep(i,n) v[i]=(s[i]=='o');

	vector<int> ans(n);
	rep(i,2) rep(j,2) {
		ans[0]=i;
		ans[1]=j;
		rep(x,n-2) ans[x+2]=(ans[x+1]==v[x+1]?ans[x]:!ans[x]);

		bool ng=false;
		ng|=(ans[ 0 ]==v[ 0 ])^(ans[1]==ans[n-1]);
		ng|=(ans[n-1]==v[n-1])^(ans[0]==ans[n-2]);
		if(!ng){
			rep(i,n) cout<<(ans[i]?'S':'W');
			cout<<'\n';
			return 0;
		}
	}
	cout<<"-1\n";

	return 0;
}


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

int main(){
  int n,k;
  cin>>n>>k;
  vector<int> d(n);
  rep(i,k){
    int m;
    cin>>m;
    rep(j,m){
      int a;
      cin>>a;
      d[a-1]=1;
    }
  }
  int ans=0;
  rep(i,n) if(d[i]==0) ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 3480
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	long ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

signed main() {
	int ans = 0;
	string s;
	cin >> s;
	string t;
	cin >> t;
	rep(i, s.size()) {
		if (s[i] == t[i])ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(x - a) >= abs(x - b)){
		cout << 'B'<<endl;
		return 0;
	}
	else{
		cout << 'A' << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
using P = pair<ll,ll>;


void solve(){
  int n, m; cin >> n >> m;
  V<P> v;
  FOR(i,0,n){
    int a, b; cin >> a >> b;
    if(a>m) continue;
    v.emplace_back(a,b);
  }
  sort(ALL(v));
  reverse(ALL(v));
  ll ans = 0;
  priority_queue<P> que;
  IFOR(d,0,m){
    while(!v.empty()){
      auto p = v[v.size()-1];
      if(p.first+d>m) break;
      que.push(P(p.second, p.first));
      v.pop_back();
    }
    if(!que.empty()){
      auto p = que.top();
      que.pop();
      ans += p.first;
    }
  }
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 4848
#include <iostream>
#include <list> 

using namespace std;

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

    list<long> lst(0);

    for(long i = 0; i < n; i++)
    {
        cin >> num;
        if(i % 2 == 0) lst.push_back(num);
        else lst.push_front(num);
    }

    if(n % 2 != 0) lst.reverse();

    for(auto itr = lst.begin(); itr != lst.end(); ++itr) 
    {
        std::cout << *itr << " ";
    }
    cout << endl;
}

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

int heihou(int n){
  int count=0;
  for(int i=1;i<32000;i++){
    if(i*i==n){
      count++;
    }
  }
  return count;
}

int main(){
  int n;
  cin >> n;
  for(int i=n;;i--){
    if(heihou(i)==1){
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll div_ceil(ll, ll);

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

int main() {
  int N;
  std::cin >> N;
  int W[N];
  REP(i, N) std::cin >> W[i];
  ll sum = 0;
  REP(i, N) sum += W[i];
  ll min_ = sum;
  ll left = 0;
  ll right = sum;
  REP(i, N) {
    min_ = min(min_, abs(left - right));
    left += W[i];
    right -= W[i];
  }
  std::cout << min_ << '\n';
}

ll div_ceil(ll a, ll b) {
  ll quotient = a / b;
  ll remainder = a % b;
  if (remainder == 0) {
    return quotient;
  } else {
    return quotient + 1;
  }
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def calc(num):
    ret = 0
    left = num
    count = 1
    while True:
        if left >= count:
            ret = count
            left -= count
            count += 1
        else:
            break
    return ret


n = int(input())

ret = factorization(n)

val = 0

for tmp, num in ret:
    if tmp == 1:
        continue
    val += calc(num)

print(val)


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

using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
int T;
vector <ll> A,B,C,D;
ll gcd( ll m, ll n)
{
    ll l;
    // 引数に０がある場合は０を返す
    if ( ( 0 == m ) || ( 0 == n ) )
            return 0;
    
    // ユークリッドの方法
    while(1)
    {
        l = m % n;
        if(l==0) break;
        m = n;
        n = l;
    }
    return n;
}//gcd

void solve() {
    ll i,j; string s;
    bool exit = false; 
    cin>>T;
    FOR(i,T){
        ll input;
        cin>>input;
        A.push_back(input);
        cin>>input;
        B.push_back(input);
        cin>>input;
        C.push_back(input);
        cin>>input;
        D.push_back(input);
        
    }
    vector <string> ret;
    FOR(i,T){
        //A[i],B[i],C[i],D[i]
        if(A[i]-B[i]<0 || D[i]-B[i] < 0){
            ret.push_back("No");
            continue;
        }
        ll x = A[i] - B[i];
        ll m = D[i] - B[i];
        ll y = B[i];
        ll z = C[i]+1-B[i];
        //cout<< m <<endl;
        if(m==0){
            if(x % B[i] <= C[i]){
                ret.push_back("Yes");
                continue;
            }else{
                ret.push_back("No");
                continue;
            }
        }
        x %= m;
        y %= m;

        ll g = gcd(m,y);
        //cout<<g<<endl;
        //if(C[i]+1-B[i]>=0){
        //    ret.push_back("Yes");
        //    continue;
        //}
        ll dif;
        if(z+m<0){
            ret.push_back("No");
            continue;
        }
        

        if(g==0){
            dif = (x%m - (z+m)%m + m) % m;
        }else{
            dif = (x%m%g - (z+m)%m%g + g) % g;
        }
        if(z+dif<0){
            ret.push_back("No");
            continue;
        }else{
            ret.push_back("Yes");
            continue;
        }
    }
    FORR(s,ret)
        cout<<s<<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256
#include <iostream>

int main()
{
    int N, K;
    std::cin >> N >> K;
    int A[N+1];
    A[0] = 1;
    for(int i=1; i<=N; i++){
        std::cin >> A[i];
    }

    for(int i=K+1; i<=N; i++){
        if(A[i] > A[i-K]){
            std::cout << "Yes" << std::endl;
        }else{
            std::cout << "No" << std::endl;
        }
    }



    //int end;
    //std::cin >> end;
    return 0;
}

Measured memory_bytes: 4416
N,M = map(int,input().split())
A = []
B = []
for i in range(N):
	a,b = map(int,input().split())
	A.append([a,b])
for i in range(M):
	c,d = map(int, input().split())
	B.append([c,d])
#print(A,B)

for i in range(N):
	z = A[i]
	ans = []
	for j in range(M):
		ch = B[j]
		d = abs(z[0]-ch[0]) + abs(z[1]-ch[1])
		ans.append([j,d])
	#print(ans)
	ans.sort(key=lambda x:x[1])
	#print(ans)
	print(ans[0][0]+1)



Measured memory_bytes: 3064
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{n:String};
    println!("ABC{}", n);
}


Measured memory_bytes: 4352
k, n, *a = map(int, open(0).read().split())

dis_max = 0

for i in range(1, len(a)):
  dis_i = a[i] - a[i-1]
  if dis_i > dis_max:
    dis_max = dis_i

if (k-a[-1]+a[0]) > dis_max:
  dis_max = (k-a[-1]+a[0])

ans = k - dis_max

print(ans)

Measured memory_bytes: 91564
_ = gets
t, a = gets.chomp.split.map(&:to_i)
h = gets.chomp.split.map.with_index {|x, i| [i, (t - 0.006 * x.to_i - a).abs] }
h.sort_by! {|_, d| d }
puts h[0][0] + 1

Measured memory_bytes: 2044
def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    if V-W <= 0:
        print("NO")
        return

    if abs(A-B) <= (V-W)*T:
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    main()


Measured memory_bytes: 9176
// OBツ嘉ッツ嘉債宿2011 Day3 B : Sleeping Time

#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

double search(int depth, int K, double R, double L, double P, double E, double T){
	if(min(abs(L-T), abs(R-T)) > E && (T < R || L < T)) return 0.0;
	if(max(abs(L-T), abs(R-T)) < E) return 1.0;
	double mid = 0.5*(L+R);
	if(depth == K) return abs(mid-T) < E ? 1.0 : 0.0;
	double Pr = search(depth+1, K, R, mid, P, E, T);
	double Pl = search(depth+1, K, mid, L, P, E, T);
	return mid < T-1e-10 ? (1-P)*Pl + P*Pr : (1-P)*Pr + P*Pl;
}

int main(){
	int K, R, L;
	while(cin >> K >> R >> L){
		double P, E, T; cin >> P >> E >> T;
		printf("%.8lf\n", search(0, K, R, L, P, E, T));
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 5e18+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
long double pi = 3.141592653589793238;
signed main() {
    int K;
    cin >> K;
    string ans = "";
    for(int i = 0; i < K; i++) {
        ans += "ACL";
    }
    cout << ans << endl;
}


Measured memory_bytes: 3572
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static long mod = 998244353;
	static void Main(string[] args) {

		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res="";
		//int res = 0; ;
		//int t = int.Parse(Console.ReadLine());
		//string str = Console.ReadLine();
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//int n = int.Parse(Console.ReadLine());
		//string res="";

		long res = 0;
		int n = int.Parse(Console.ReadLine());

		long[] vals = parseAryL(Console.ReadLine().Split(cs));

		long[] a = new long[n];
		long[] b = new long[n];
		a[0] = vals[0];
		for ( int i = 1; i < n; i++ ) {
			a[i]=gcd(a[i - 1], vals[i]);
		}

		b[n - 1] = vals[n - 1];
		for ( int i = n-2; i >- 1 ; i-- ) {
			b[i] = gcd(b[i + 1], vals[i]);
		}

		res = b[1];
		for ( int i = 1; i < n-1; i++ ) {
			res=Math.Max(res,gcd(a[i - 1], b[i + 1]));
		}
			res=Math.Max(res,a[n-2]);


			Console.WriteLine(res);


		return;
	
	}

	static public long gcd(long a, long b) {
		if ( b == 0 ) { return a; }
		return gcd(b, a % b);
	}


	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}

}

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

int main() {
    int N, l, r;
    std::cin >> N;
    
    int ans;
    for (int i=0; i<N; i++) {
        std::cin >> l >> r;
        ans += (r-l+1);
    }
    std::cout << ans << std::endl;
}

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

int main() {
  int n;
  int count = 0;
  int max = 0;

  cin >> n;
  int h[n];

  for (int i = 0; i < n; i++) cin >> h[i];
  
      for (int k = 1; k < n; k++)
      {
          if (h[k-1] >= h[k])
          {
             count++; 
             if (count >= max)
              {
                  max = count;
              }
          } else {
              if (count >= max)
              {
                  max = count;
              }
              count = 0;
          }
      }
      
  cout << max << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	int c[3] = {};
	int a, b;
	cin >> a >> b;
	a--; b--;
	c[a]++;
	c[b]++;
	rep(i, 0, 3){
		if(c[i] == 0){
			cout << i + 1 << endl;
		}
	}
}

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

typedef long long ll;
typedef long double ld;

#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

int main(){

    vector<ll> A(3);

    rep(i, 3)
        cin >> A[i];

    sort(all(A));

    cout << A[0] + A[1] + A[2] * 10 << endl;

    return 0;
}

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

vector<vector<int>> edges;

vector<int> dp;

int dfs(int e){
    int v=0;
    if(dp[e] != -1){
        return dp[e];
    }

    for(int i =0;i<edges.at(e).size();i++){
        int to = edges[e][i];
        // cerr << "edge=" << e <<"to=" << to << endl;
        v = max(v, dfs(to) +1);
    }
    dp[e] = v;
    // cerr << "e=" << e << v << endl;
    return v;
}


int main(){
    int N,M;
    cin >> N >> M;
    edges.resize(N,vector<int>(0));
    dp.resize(N,-1);
    for(int i=0;i<M;i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        edges[a].push_back(b);
    }
    int ans =0;
    for(int i=0;i<N;i++){
        ans = max(ans,dfs(i));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8832