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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/f.in", "r", stdin);
//  freopen("../IO/f.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

constexpr int P = 998244353;
int dp[3000 + 5];
void solve(std::istream &in, std::ostream &out) {
  int n, S;
  in >> n >> S;
  dp[0] = 1;
  int ans = 0;
  for (int _ = 0, x; _ < n; ++_) {
    in >> x;
    for (int i = S - x; i >= 0; --i) {
      (dp[i + x] += (dp[i + x] + dp[i]) % P) %= P;
    }
    for (int i = 0; i < x; ++i) {
      (dp[i] += dp[i]) %= P;
    }
//    (ans += dp[S]) %= P;
  }
  out << dp[S] << '\n';
}

Measured memory_bytes: 3636
#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 N;
vector<int> A;
string S;
unsigned long long B[101010];

int ok(int v) {
	int i;
	ZERO(B);
	FOR(i,N) B[i/64] |= (1LL*(A[i]>=v))<<i%64;
	int len=N;
	FORR(c,S) {
		if(c=='m') {
			for(i=0;i*64<=len;i++) B[i]=(B[i]&(B[i]>>1)) | ((B[i+1]<<63)&B[i]);
		}
		else {
			for(i=0;i*64<=len;i++) B[i]=(B[i]|(B[i]>>1)) | ((B[i+1]<<63)|B[i]);
		}
		len--;
		B[len/64] &= ~(1LL<<(len%64));
	}
	return B[0];
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>x, A.push_back(x);
	cin>>S;
	
	int ret=0;
	for(i=16;i>=0;i--) if(ok(ret+(1<<i))) ret+=1<<i;
	cout<<ret<<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: 1784
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

// https://github.com/koba-e964/contest/blob/master/comm/SegTree.cpp
template <class I>
class SegmentTree {
 public:
  using Op = function<I(I, I)>;

 private:
  int n;
  vector<I> dat;
  Op op;
  I e;

 public:
  SegmentTree(int n_, const Op& op, const I& e) : op(op), e(e) {
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1, e);
  }
  SegmentTree(const vector<I>& init, const Op& op, const I& e)
      : SegmentTree(init.size(), op, e) {
    for (int i = 0; i < init.size(); i++) {
      dat[i + n - 1] = init[i];
    }
    for (int i = n - 2; i >= 0; i--) {
      dat[i] = op(dat[i * 2 + 1], dat[i * 2 + 2]);
    }
  }
  void update(int k, const I& a) {
    k += n - 1;
    dat[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = op(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  // [a, b)
  I query(int a, int b) const {
    a += n - 1;
    b += n - 1;
    I vl = e;
    I vr = e;
    while (a < b) {
      if ((a & 1) == 0) vl = op(vl, dat[a]);
      if ((b & 1) == 0) vr = op(dat[b - 1], vr);
      a = a / 2;
      b = (b - 1) / 2;
    }
    return op(vl, vr);
  }
};

int main() {
  int n, q;
  while (cin >> n >> q) {
    SegmentTree<int> seg(n, [&](int a, int b) { return min(a, b); },
                         numeric_limits<int32_t>::max());
    for (int i = 0; i < q; i++) {
      int com, x, y;
      cin >> com >> x >> y;
      if (com == 0) {
        seg.update(x, y);
      } else {
        int ans = seg.query(x, y + 1);
        cout << ans << endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3816
#include <stdio.h>

int main(void){
	int n, con;
	int inp;
	long min, max, sum = 0;

	do{
	scanf("%d\n", &n);

	if(n <= 0) break;
	else{
	for(con = 0; con < n; con++){
		scanf("%d", &inp);
		sum += inp;
		if(con == 0) {min = inp; max = inp;}
		if(inp < min) min = inp;
		if(inp > max) max = inp;
	}
	}

	printf("%ld %ld %ld\n", min, max, sum);
	} while (n <= 0);

	return 0;
}

Measured memory_bytes: 1852
/*
    Sk arman Hossain
    University of Barisal

    Problem name :
    Algorithm :
 */

#include<bits/stdc++.h>
#define nl printf("\n");
#define N 200001
#define PR pair<int,int>
#define sf(n) scanf("%d", &n)
#define sff(n, m) scanf("%d %d",&n,&m)
#define sfl(n) scanf("%lld", &n)
#define sfu(n) scanf("%llu", &n)
#define sffl(n, m) scanf("%lld %lld",&n,&m)
#define pfn(n) printf("%d\n",n)
#define pf(n) printf("%d ",n)
#define pfl(n) printf("%lld ",n)
#define pfln(n) printf("%lld\n",n)
#define pfu(n) printf("%llu\n",n)
#define pfs(s) printf("%s",s)
#define YES printf("YES\n")
#define NO printf("NO\n")
#define PB push_back
#define PI 3.1415926536
#define VST(v) sort(v.begin(),v.end())
#define fori(i,n) for(;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define MP make_pair
#define first ff
#define second ss
int dx[]= {0,0,1,-1};
int dy[]= {1,-1,0,0};
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
vector<ll>V,V2,V3;
vector<ll> :: iterator it1,it2;
void CLEAR(){
    V.clear();
    V2.clear();
    V3.clear();
}
int main()
{
    ///freopen("1input.txt","r",stdin);
    int tcase=1;
    //sf(tcase);
    for(int test=1;test<=tcase;test++)
    {
        int n,ans=0;
        sf(n);
        int a;
        for(int i=1;i<n;i++){
            sf(a);
            V.PB(a);
        }
        ans+=V[0];
        for(int i=0;i<n-2;i++){
            ans+=min(V[i],V[i+1]);
        }
        ans+=V[n-2];

        printf("%d\n",ans);
    }
///*****************************  ALHAMDULILLAH  *****************************/
}



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

using namespace std;

typedef long long ll;

char str[105];

int main() {
  int k;
  scanf("%s%d",str+1,&k);
  int n=strlen(str+1);
  bool ok=1;
  for(int i=1;i<=n;i++)
    if (str[i]!=str[1]) {
    	ok=0;
    	break;
	}
  if (ok) {
  	printf("%lld\n",(ll)n*k>>1);
  	return 0;
  }
  int last=1,s=0;
  bool v=1;
  for(int i=1;i<=n+1;i++)
    if (str[i]!=str[last]) {
    	s+=((i-last)>>1);
    	if ((i==n+1||last==1)&&!((i-last)&1)) v=0;
    	last=i;
	}
  if (str[1]!=str[n]) v=0;
  printf("%lld\n",(ll)s*k+v*(k-1));
  return 0;
}

Measured memory_bytes: 256
def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    append = peaks.append
    for i in xrange(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            else:
                append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        else:
            append(upPeak)
            append(downPeak)
    print(max(peaks))

N,L = map(int,raw_input().strip().split())
ices = [int(raw_input().strip()) for _ in xrange(N)]

orderN(N,L,ices)

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

using namespace std;

int main(void) {
  long long N;
  cin >> N;
  vector<pair<long long, long long>> AB(N);
  for (int i = 0; i < N; i++) {
    long long x, y;
    cin >> x >> y;
    AB[i] = pair<long long, long long>(y, x);
  }

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

  long long t = 0;
  for (int i = 0; i < N; i++) {
    t += AB[i].second;
    if (t > AB[i].first) {
      cout << "No" << endl;
      return (0);
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3328
from heapq import heappush, heappop
from math import inf

import numpy as np


n = int(input())
A = []
[heappush(A, (-v, i)) for i, v in enumerate(map(int, input().split()), 1)]
dp = np.full((n + 1, n + 1), -inf, dtype=int)
dp[0][0] = 0

for i in range(n):
    v, j = heappop(A)
    v = -v
    dp[i + 1, 1:] = np.maximum(dp[i, :-1] + v * np.abs(j - np.arange(1, n + 1)), dp[i + 1, 1:])
    dp[i + 1, :-1] = np.maximum(dp[i, :-1] + v * np.abs(j - np.arange(n - i, n + n - i)), dp[i + 1, :-1])

print(dp[-1,].max())


Measured memory_bytes: 58564
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;
  cin >> a >> b >> c;
  if(a+b>=c){
    cout << max(c-a,0LL) << endl;
  }else{
    cout << "NA" << endl;
  }
  return 0;
}



Measured memory_bytes: 3132
#include <stdio.h>
#include <stdlib.h>

typedef struct P{
    int num;
    int left;
    int right;
}Node;

void pre(Node node[],int n){
    if(n==-1){return;}
    printf(" %d",node[n].num);
    pre(node,node[n].left);
    pre(node,node[n].right);
}

void ino(Node node[],int n){
    if(n==-1){return;}
    ino(node,node[n].left);
    printf(" %d",node[n].num);
    ino(node,node[n].right);
}

int insert(Node node[],int n,int x,int num){
    int ii=0;
    if(n==-1||node[n].num==-1){
        node[x].num = num;
        return x;
    }else if(node[n].num>num){
        ii = insert(node,node[n].left,x,num);
        if(ii!=0){
            node[n].left = ii;
        }
    }else{
        ii = insert(node,node[n].right,x,num);
        if(ii!=0){
            node[n].right = ii;
        }
    }
    return 0;
}

int main(void){
    int n,i,j,x,y;
    char str[7];
    Node *node;
    scanf("%d",&n);
    node = (Node*)malloc(sizeof(Node)*n);
    for(i=0;i<n;i++){
        node[i].num = -1;
        node[i].left = -1;
        node[i].right = -1;
    }
    x = 0;
    for(i=0;i<n;i++){
        scanf("%s",str);
        if(str[0]=='i'){
            scanf("%d",&y);
            insert(node,0,x,y);
            x++;
        }else{
            ino(node,0);
            printf("\n");
            pre(node,0);
            printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 7576
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
long long dp[2][1100000];
int w[110];
int v[110];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)scanf("%d%d",w+i,v+i);
	for(int i=1;i<1100000;i++)dp[0][i]=inf;

	for(int i=1;i<=a;i++){
		int t=i%2;
		for(int j=0;j<1100000;j++)dp[t][j]=inf;
		for(int j=0;j<1100000;j++){
			dp[t][j]=min(dp[t][j],dp[!t][j]);
			if(j-v[i-1]>=0)dp[t][j]=min(dp[t][j],dp[!t][j-v[i-1]]+w[i-1]);
		}
	}
	int ret=0;
	for(int i=0;i<1100000;i++)if(dp[a%2][i]<=b)ret=i;
	printf("%d\n",ret);
}

Measured memory_bytes: 18560
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
#define erase(s) s.erase(s.end()-1) //文字列sの末尾削除

ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
string RLE(string s){
  ll n=s.size();
  char now='.';
  ll count=1;
  string press;
  loop(i,n){
    if(s[i]!=now){
      if(i){
        press+=now;
        press+=to_string(count);
      }
      now=s[i];
      count=1;
      continue;
    }
    else count++;
  }
  press+=now;
  press+=to_string(count);
  return press;
}
int main() {
  cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  ll ans=0;
  loop(i,n){
    ll t=i+1;
    if(t%2==0)continue;
    ll count=0;
    Loop(j,1,sqrt(t))if(t%j==0)count++;
    if(count==4)ans++;
  }
  putout(ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    int m = 0;
    for (int i = n; i > 0; i--) {
        if (a[i]) {
            m++;
            for (int j = 1; j * j <= i; j++) {
                if (i % j == 0) {
                    a[j] ^= 1;
                    if (j * j != i) a[i / j] ^= 1;
                }
            }
            a[i] = 1;
        }
    }

    cout << m << '\n';
    for (int i = 1; i <= n; i++) {
        if (a[i]) cout << i << '\n';
    }

    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {

  int am,pm;
  char class[20];

  int i;

  
  for(i=0;i<9;i++) {

    scanf("%s %d %d",class,&am,&pm);
    
    printf("%s %d %d\n",class,am+pm,am*200+pm*300);
    
  }

  return 0;

}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int h, w; cin >> h >> w;
	int a[h][w];
	for( int i = 0; i < h; ++i ){
		for( int j = 0; j < w; ++j ){
			cin >> a[i][j];
		}
	}
	vector<tuple<int, int, int, int>> ans;
	for( int i = 0; i < h; ++i ){
		for( int j = 0; j < w-1; ++j ){
			if( a[i][j] % 2 == 1 ){
				int x = i+1, y = j+1;
				ans.emplace_back(x, y, x, y+1);
				--a[i][j];
				++a[i][j+1];
			}
		}
	}
	for( int i = 0; i < h-1; ++i ){
		if( a[i][w-1] % 2 == 1 ){
			int x = i+1, y = w;
			ans.emplace_back(x, y, x+1, y);
			--a[i][w-1];
			++a[i+1][w-1];
		}
	}
	cout << ans.l_ength() << endl;
	for( auto t : ans ){
		cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << " " << get<3>(t) << endl;
	}
	return 0;
}

Measured memory_bytes: 5104
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <math.h>


using namespace std;


int main(){
    uint64_t N;
    uint64_t A[100001];
    uint64_t X[100001];

    cin>>N;
    for(uint64_t i=1; i<=N; i++){
        cin>>A[i];
        A[i]*=2;
    }

    double tmp_sum = 0;
    for (uint64_t i=1; i<=N; i++){
        if(i%2!=0)
            tmp_sum+=A[i];
        else
            tmp_sum-=A[i];
    }

    double x1 = tmp_sum/2;
    X[1] = x1;
    for(uint64_t i=2; i<=N; i++){
        X[i] = A[i-1] - X[i-1];
    }

    for(uint64_t i=1; i<=N; i++ ){
        cout << X[i] << " ";
    }
    cout<<endl;

    return 0;

}

Measured memory_bytes: 2816
#include<cstdio>
using namespace std;
int a[105];
int main()
{
	int x,n,q;
	scanf("%d%d",&x,&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&q);
		a[q]=1;
	}
	if(a[x]!=1)
	{
		printf("%d\n",x);
		return 0;
	}
	for(int i=1;i<=101;i++)
	{
		int l=x-i;
		int r=x+i;
		if(a[l]==0)
		{
			printf("%d\n",l);
			return 0;
		}
		if(a[r]==0)
		{
			printf("%d\n",r);
			return 0;
		}
	}
	return 0;
} 

Measured memory_bytes: 1732
#include<stdio.h>
#include<math.h>
int main( )
{ 
	int n;
	int i;
	int a,b;
	scanf("%d",&n);
	scanf("%d %d",&a,&b);
	for(i=a;i<=b;i++)
	if(i%n==0)
	{printf("OK");return 0;}
	 printf("NG");return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

int n, k;

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

    cin >> n >> k;
    vector<double> a(n+1), pref(n+1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        double tmp = (1+a[i])*a[i];
        tmp /= 2;
        a[i] = tmp / a[i];
    }

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

    double ans = 0;
    for (int i = k; i <= n; i++) {
        double cur = pref[i] - pref[i-k];
        ans = max(ans, cur);
    }

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





    return 0;
}


Measured memory_bytes: 3328
# include <bits/stdc++.h>
# define rep(i, n) for (ll i = 0; i < (n); i++)
# define reps(i, n) for (ll i = 1; i <= (n); i++)
# define foreps(i, m, n) for (ll i = (m); i < (n); i++)
# define len(x) ((int)(x).size())
# define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
const long long mod = 1e9 + 7;
const long long inf = 1e18;

int main() {
    ll N; cin >> N;
    vector<ll> A(N);
    ll sum = 0;
    rep(i, N) {
        cin >> A[i], sum += A[i];
    }

    ll ans = 1e18, alter = 0;
    for (ll i = 0; i < N - 1; i++) {
        alter += A[i];
        ll alt = sum - alter;
        ans = min(ans, abs(alt - alter));
    }
    cout << ans << endl;
}

Measured memory_bytes: 4844
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int64, int64> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int64 n;
  cin >> n;
  vector<ii> a;
  for (int64 i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      int cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      a.push_back({i, cnt});
    }
  }
  if (n > 1) a.push_back({n, 1});
  int ret = 0;
  for (auto& [p, k] : a) {
    int cnt = 0, sum = 0;
    for (int i = 1; sum + i <= k; ++i) {
      sum += i;
      ++cnt;
    }
    ret += cnt;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 3136
#include<iostream>
#include<vector>
using namespace std;
int main(){
    string s;
    cin>>s;
    vector<bool>dp(26,false);
    for(int i=0;i<s.size();i++)
    {
        dp[s[i]-'a']=true;
    }
    int index=-1;
    for(int i=0;i<26;i++)
    {
        if(!dp[i]){
            index=i;
            break;
        }
    }
    if(index!=-1){cout<<char(index+'a');}
    else
    {
        cout<<"None"<<endl;
    }
    
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
    using namespace std;
     long long int n,w[100006],v[100006],c[100006],dp[102][100006],m;
     long long int cal(int x,int c){
         if(x==n+1)return 0;
         if(dp[x][c]!=-1)return dp[x][c];
         long long int sol1=-1;
         if(c+w[x]<=m) sol1=cal(x+1,c+w[x])+v[x];
         long long int sol2=cal(x+1,c);
         return dp[x][c]=max(sol1,sol2);
     } 
    int main()
    {
      cin>>n>>m;
      for(int i=1;i<=n;i++){ 
          cin>>w[i]>>v[i];
      } 
       memset(dp,-1,sizeof dp);
      cout<<cal(1,0)<<"\n";
      
        
     
        return 0;
    }

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

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
inline int in() { int x; cin >> x; return x; }

int counte;
vector<bool> seen;
vector<bool> watch;
vector<int> member;
vector<int> F[100100];
vector<int> B[100100];
int answer[100100];
void dfs(int v) {
  if (!seen[v]) {
    counte++;
    member.push_back(v);
  }
  seen[v] = true;
  watch[v] = true;
  for (auto next_v : F[v]) {
    if (seen[next_v]) continue;
    dfs(next_v); // 再帰的に探索
  }
}

int main(){
  int N = in(), M = in(), K = in();
  watch.assign(N,false);
  REP(i,M) {
    int a = in()-1, b = in()-1;
    F[a].push_back(b);
    F[b].push_back(a);
  }
  REP(i,K) {
    int a = in()-1, b = in()-1;
    B[a].push_back(b);
    B[b].push_back(a);
  }
  REP(i,N) {
    if (watch[i] == 0) {
      counte = 0;
      seen.assign(N,false);
      member.assign(0,0);
      dfs(i);
      REP(j,member.size()){
        int counter = 0;
        int mj = member[j];
        REP(l,B[mj].size()){
          if(seen[B[mj][l]] == 1)counter++;
        }
        REP(l,F[mj].size()){
          if(seen[F[mj][l]] == 1)counter++;
        }
        answer[mj] = counte - counter - 1;
      }
    }
  }
  REP(i,N) cout << answer[i] << endl;
}


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

int main(){
    int n;
    cin>>n;
    vector<int>a(n),b(n);
    rep(i,n){
        cin>>a[i];
        b[i]=a[i];
    }
    map<int,int>mp;
    sort(b.begin(),b.end());
    rep(i,n){
        mp[b[i]]=i;
    }
    int ans=0;
    rep(i,n){
        if(i%2!=mp[a[i]]%2)ans++;
    }
    cout<<ans/2<<endl;
}

Measured memory_bytes: 8780
# abc119 B
n = gets.to_i
r = 0
p n.times.map {
  xx, yy = gets.split
  x = xx.to_f
  y = yy.chomp
  case y
  when 'JPY' then x
  when 'BTC' then x * 380000
  end
}.inject(:+)











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

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

  int cnt = 0;
  rep(i, h) rep(j, w) if (a[i][j] == '#') ++cnt;
  if (cnt == h + w - 1) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}

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

int main() {
	int a[200001];
	int n;
	cin >> n;
	if (n){
	    for(int i=1;i<=n;++i){
	        cin >>a[i];
	   }
	    if (n==1){
	        cout<<a[1];
	        return 0;
	    }
	    if (n%2){
	       
	        for(int i=n;i>=1;i-=2)
	            cout<<a[i]<<" ";
            for(int i=2;i<n-1;i+=2)
                cout<<a[i]<<" ";
                cout<<a[n-1];
                cout<<endl;
	    }
	    else{
             for(int i=n;i>=1;i-=2)
                 cout<<a[i]<<" ";
            for(int i=1;i<n-1;i+=2)
               cout<<a[i]<<" ";
               cout<<a[n-1];
           cout<<endl;
	    }
	}
	return 0;
}

Measured memory_bytes: 3072
# -*- coding: utf-8 -*-
"""
B - Golden Apple
https://atcoder.jp/contests/abc134/tasks/abc134_b

"""
import sys


def solve(N, D):
    ans = 1
    covered = D + 1 + D
    while covered < N:
        ans += 1
        covered += (2*D + 1)
    return ans


def main(args):
    N, D = map(int, input().split())
    ans = solve(N, D)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    string s;
    cin>>s;

    sort(s.begin(),s.end());
    if(s=="abc")
        cout<<"Yes\n";
    else
        cout<<"No\n";              
}

// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long int64;

const int kInf = 1e9+10;
const int kMod = 1e9+7;
const int kMaxN = 1e5+10;

int pre1[kMaxN], pre2[kMaxN];

void solve() {
	string s, t;
	cin >> s >> t;

	for (int i = 1; i <= s.length(); ++i) {
		pre1[i] = pre1[i-1] + (s[i-1] == 'A' ? 1 : 2);
		pre2[i] = pre2[i-1] + (t[i-1] == 'A' ? 1 : 2);
	}

	int q;
	cin >> q;

	for (int i = 1; i <= q; ++i) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		int sum1 = pre1[b] - pre1[a-1];
		int sum2 = pre2[d] - pre2[c-1];
		if (sum1 % 3 == sum2 % 3) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}
	}
}

int main() {
	int tests = 1;

	for (;tests; --tests) {
		solve();
	}
}

Measured memory_bytes: 1664
#include<stdio.h>
int main(void)
{
	int n,k,a,b,x,i;
	scanf("%d %d", &n, &k);
	for(i=0; i<k; i++)
	{
		scanf("%d %d", &a, &b);
		x=a;
		if(x>n-a+1)
		x=n-a+1;
		if(x>b)
		x=b;
		if(x>n-b+1)
		x=n-b+1;
		x%=3;
		if(x==0)
		x=3;
		printf("%d\n", x);
	}
	
	return 0;
}


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

kitai = [(1+p[i])/2 for i in range(n)]

total = sum(kitai[i] for i in range(k))
ans = total

for i in range(0, n-k):
  total = total - kitai[i] + kitai[i+k]
  if total > ans:
    ans = total

print(ans)

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


int main(){
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	return 0;
}

Measured memory_bytes: 1096
#include <stdio.h>

int main() {
    
    int w,h,x,y,r;
    
    scanf("%d %d %d %d %d", &w,&h,&x,&y,&r);
    
    if(x>=r && x+r<=w && y>=r && y+r<=h){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 2100
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextDouble()
    val a:Int = (n / 2).toInt()
    val b:Int = (n % 2).toInt()
    val res = ((a + b) / n)
    println(res)
}

Measured memory_bytes: 29596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll t, n, a, b, c, d;
map<ll, ll> m;

ll dp(ll x) {
	if (x == 0) return 0;
	else if (x == 1) return d;
	else if (x == 2) return min(a, d) + d;
	else if (m[x] != 0) return m[x];
	
	ll res = 0;
	if (x > LLINF/d) res = 1e18;
	else res = d*x;
	
	res = min({res, dp(x/2)+a+d*(x%2), dp(x/2+1)+a+d*(2-x%2)});
	res = min({res, dp(x/3)+b+d*(x%3), dp(x/3+1)+b+d*(3-x%3)});
	res = min({res, dp(x/5)+c+d*(x%5), dp(x/5+1)+c+d*(5-x%5)});
	
	return m[x] = res;
}

int main() {
	fastio; cin >> t;
	while (t--) {
		m.clear();
		cin >> n >> a >> b >> c >> d;
		cout << dp(n) << "\n";
	}
}


Measured memory_bytes: 4752
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()

	fmt.Println(n/2 + (n % 2))
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 640
def main():
    n = int(input())
    dp = [[0 for i in range(3)] for j in range(n)]

    for i in range(n):
        a,b,c = map(int,input().split())
        if i == 0:
            dp[i][0] = a
            dp[i][1] = b
            dp[i][2] = c
        else:
            dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a
            dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b
            dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c


    print(max(dp[-1]))


main()


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

int main()
{
  int a,b,x;
  cin >> a >> b >> x;

  if(a > x){
    std::cout << "NO" << '\n';
    return 0;
  }

  if((a+b) < x){
    std::cout << "NO" << '\n';
    return 0;
  }

  std::cout << "YES" << '\n';

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func Max(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}

func solve() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)

	ans := Max(a+b, Max(a-b, a*b))

	fmt.Println(ans)
}

func main() {
	solve()
}


Measured memory_bytes: 512
import java.util.Scanner;

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

        int ab = sc.nextInt();
        int bc = sc.nextInt();
        int ca = sc.nextInt();

        System.out.println(ab * bc / 2);
        //int min_m = 1000;
        //int n = sc.nextInt();
        //int x = sc.nextInt();
        //
        //int ans = n;
        //
        //for(int i = 0; i < n ; i++) {
        //    int tmp = sc.nextInt();
        //
        //    x -= tmp;
        //
        //    min_m = Math.min(tmp,min_m);
        //}
        //
        ////System.out.println(min_m);
        //
        //for(; x - min_m >= 0;) {
        //    ans++;
        //    x -= min_m;
        //    //System.out.println(x);
        //}
        //
        //System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
int n;
bool f[200005];
ll a[200005],b[200005],c[200005],d[200005],ans;
/*---define function---*/

/*---main code---*/
int main()
{
	FIO;
	cin>>n;
	for(int i=0;i<n;++i)
	{
		cin>>a[i];
	}
	for(int i=0;i<n;++i)
	{
		cin>>b[i];
	}
	for(int i=0;i<=30;++i)
	{
		ll T=((ll)1<<i);
		for(int j=0;j<n;++j)
		{
			c[j]=a[j]%(2*T);
			d[j]=b[j]%(2*T);
		}
		sort(d,d+n);
		for(int j=0;j<n;++j)
		{
			ll y=2*T-c[j];
			ll x=T-c[j];
			int p1=lower_bound(d,d+n,x)-d;
			int p2=lower_bound(d,d+n,y)-d;
			if(d[p2]>=y)
			{
				--p2;
			}
			if(p2>=n)
			{
				--p2;
			}
//			cout<<p1<<' '<<p2<<"		";
			if(p2>=p1&&(p2-p1+1)%2)
			{
				f[i]=!f[i];
			}
			y=4*T-c[j];
			x=3*T-c[j];
			p1=lower_bound(d,d+n,x)-d;
			p2=lower_bound(d,d+n,y)-d;
			if(d[p2]>=y)
			{
				--p2;
			}
			if(p2>=n)
			{
				--p2;
			}
//			cout<<p1<<' '<<p2<<'\n';
			if(p2>=p1&&(p2-p1+1)%2)
			{
				f[i]=!f[i];
			}
		}
	}
	for(int i=0;i<=30;++i)
	{
		if(f[i])
		{
			ans|=((ll)1<<i);
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 6528
a,b = [int(_) for _ in input().split()]

a_bun = []
b_bun = []

i = 2
a_target = a
while i <= a_target: # 3 < 41
  if a_target % i == 0:
    a_bun.append(i)
    a_target = int(a_target /i)
  else:
    i= i + 1

i = 2
b_target = b
while i <= b_target: # 2 < 228
  if b_target % i == 0:
    b_bun.append(i)
    b_target = int(b_target /i)
  else:
    i= i + 1
#  print("{}\t{}".format(i,b_target))

result = 1
for i in a_bun:
  result = result * i
  if i in b_bun:
    b_bun.remove(i)

for j in b_bun:
  result = result * j

print(result)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>


int IsPrime(int);

int p[1000001] = {0};

int main()
{
	int i, j, n, count, buf[1000] = {0};
	for(i=2; i<=1000000; i++)
		p[i] = 1;
	j = 0;
	for(i=0; i<=1000; i++){
		if(IsPrime(i) == 1){
			buf[j] = i;
			j++;
		}
	}
	for(i=0; i<168; i++){
		for(j=2*buf[i]; j<=1000000; j+=buf[i])
			p[j] = 0;
	}

	while(scanf("%d", &n) != EOF){
		count=0;
		for(i=0; i<=n; i++)
			count += p[i];
		printf("%d\n", count);
	}

	return 0;
}


int IsPrime(int n)
{
    int i;
 
    if(n < 2)
        return 0;
    else if(n == 2)
        return 1;
 
    if(n % 2 == 0)
        return 0;
 
	for(i = 3; i * i <= n; i += 2){
         if(n % i == 0)
            return 0;
	}
    return 1;
}

Measured memory_bytes: 4500
/* *
 *
 * Author: Hamkor
 *
 * */
 
#include <bits/stdc++.h>

/* * * *   Knacks   * * * */
typedef long long ll;
const int oo = 1e9;
/* * * *   * * *   	* * * */

using namespace std;

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, m = 0; cin>>n;
	int a[3][n], b[3][n];
	for (int i=0; i<n; ++i) for(int j= 0; j<3; ++j) cin>>a[j][i];
	for(int i=0; i<3; ++i) b[i][0] = a[i][0];
	for(int i=1; i<n; ++i){
		for (int j=0; j<3; ++j){
			m = 0; 
			for (int k=0; k<3; ++k) if (k!=j) m = max(m, b[k][i-1]);
			b[j][i] = a[j][i] + m;
		}
	}
	for(int i=0; i<3; ++i) m = max(b[i][n-1], m);
	cout<<m;
	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

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

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

//素因数分解
vector<pair<ll, int>> factorize(ll n) {
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; i++) {
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

int main()
{
    int n;
    cin >> n;
    vi a(n);
    int x = 0;
    rep(i, n) {
        cin >> a[i];
        x ^= a[i];
    }
    rep(i, n) {
        int ans = x ^ a[i];
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 4060
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N, K = MAP()
A = LIST()

for i in range(K, N):
    if A[i] > A[i-K]:
        Yes()
    else:
        No()


Measured memory_bytes: 31904
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

int N=1<<18;
class StarrySkyTree{
public:
  ll Mi[555555],A[555555];
  void init(){memset(Mi,0,sizeof(Mi)),memset(A,0,sizeof(A));}
  void add(int a,int b,ll x,int k=0,int l=0,int r=N) {
    if(r<=a||b<=l) return;
    if(a<=l&&r<=b){
      A[k]+=x;
      while(k){
        k=(k-1)/2;
        Mi[k]=min(Mi[k*2+1]+A[k*2+1],Mi[k*2+2]+A[k*2+2]);
      }
      return;
    }
    add(a,b,x,k*2+1,l,(l+r)/2);
    add(a,b,x,k*2+2,(l+r)/2,r);
  }
  ll getMin(int a,int b,int k=0,int l=0,int r=N) {
    if(r<=a||b<=l)return LLONG_MAX;if(a<=l&&r<=b)return Mi[k]+A[k];
    ll left=getMin(a,b,k*2+1,l,(l+r)/2),right=getMin(a,b,k*2+2,(l+r)/2,r);
    return min(left,right)+A[k];
  }
};

vector<int> v[200000];
P a[200000];
void calc() {
  int k=0;
  stack<P> s;
  s.push(P(0,-1));
  while(!s.empty()) {
    P q=s.top();s.pop();
    int x=q.F,p=q.S;
    if(x<0||!x&&p>0) {
      a[-x].S=k;
      continue;
    }
    s.push(P(-x,-p));
    a[x].F=k++;
    for(int i=0; i<v[x].size(); i++) {
      int y=v[x][i];
      if(y==p) continue;
      s.push(P(y,x));
    }
  }
}

StarrySkyTree t;

void Main() {
  ll n,T;
  cin >> n >> T;
  rep(i,n-1) {
    ll x,y;
    cin >> x >> y;
    x--,y--;
    v[x].pb(y);
    v[y].pb(x);
  }
  calc();
  while(T--) {
    ll x,y;
    cin >> x >> y;
    x--;
    t.add(a[x].F,a[x].S,y);
  }
  rep(i,n) {
    if(i) cout << " ";
    cout << t.getMin(a[i].F,a[i].F+1);
  }
  ln;
}

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


Measured memory_bytes: 22952
#include <iostream>

using namespace std;

int main()
{
    int A , B , C;
    cin>>A>>B>>C;
    if(-100<=A && A<=100 && -100<=B && B<=100 && -100<=C && C<=100)
    {
        if(A==B && C!=A)
        {
            cout<<C<<endl;
        }
        else if(A==C && B!=A)
        {
            cout<<B<<endl;
        }
        else if(B==C && A!=B)
        {
            cout<<A<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

const MAX = 501
const NIL = -3000000000

var T [MAX]int
var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func print(id int, w io.Writer) {
	// node 1: key = 7, left key = 8, right key = 1,
	fmt.Fprint(w, "node ", id, ": ")
	fmt.Fprint(w, "key = ", T[id], ", ")
	if T[id/2] != NIL {
		fmt.Fprint(w, "parent key = ", T[id/2], ", ")
	}
	if T[id*2] != NIL {
		fmt.Fprint(w, "left key = ", T[id*2], ", ")
	}
	if T[id*2+1] != NIL {
		fmt.Fprint(w, "right key = ", T[id*2+1], ", ")
	}
}

func main() {
	for i := range T {
		T[i] = NIL
	}

	n := scanInt()
	for i := 1; i <= n; i++ {
		v := scanInt()
		T[i] = v
	}
	w := bufio.NewWriter(os.Stdout)
	for i := 1; i <= n; i++ {
		print(i, w)
		fmt.Fprintln(w)
	}
	w.Flush()
}



Measured memory_bytes: 1176
#include<stdio.h>

#define MAX 100000005

int A[MAX], n, i;

void maxHeapify(int i){

  int largest, l, r, tmp;

  l = 2 * i;
  r = 2 * i + 1;

  if(l <= n && A[l] > A[i])
    largest = l;

  else
    largest = i;

  if(r <= n && A[r] > A[largest])
    largest = r;

  if(largest != i){
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;

    maxHeapify(largest);
  }
}

int main(){

  scanf("%d", &n);

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

  for(i = n / 2; i >= 1; i--)
    maxHeapify(i);

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

  for(i = n / 2; i >= 1; i--)
    maxHeapify(i);

  for(i = 1; i <= n; i++)
    printf(" %d", A[i]);

  printf("\n");

  return 0;
}



Measured memory_bytes: 3696
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = A[::-1]
B = B[::-1]


ans = 0

if B[0] >= A[0]:
    ans += A[0]
    B[0] -= A[0]
else:
    ans += B[0]
    B[0] = 0
    
A = A[1:]
B.append(0)

for i in range(N):
    if B[i] >= A[i]:
        ans += A[i]
    else:
        A[i] -= B[i]
        ans += B[i]
        if B[i+1] >= A[i]:
            ans += A[i]
            B[i+1] -= A[i]
        else:
            ans += B[i+1]
            B[i+1] = 0
print(ans)

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

int main(void){
  int i, n, x, l, point = 0, jump = 1;
  cin >> n >> x;
  for(i = 0; i < n; i++){
    cin >> l;
    point += l;
    if(point <= x) jump++;
  }
  cout << jump << endl;
  return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
b=list(range(1,n+1))
a=[]

for i in range(k):
	d=int(input())
	c=list(map(int,input().split()))
	a.extend(c)

a=list(set(a))

ans=0
for i in b:
	if not i in a:
		ans += 1

print(ans)

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
#define mp make_pair

ll gcd(ll a, ll b) {
	if (b > a) {
		swap(a, b);
	}
	ll r = a%b;
	while (r != 0) {
		a = b;
		b = r;
		r = a%b;
	}
	return b;
}

const int MAXN = 301000;

ll mod_pow(ll x, ll p, ll M = MOD) {
	ll a = 1;
	while (p) {
		if (p % 2)
			a = a*x%M;
		x = x*x%M;
		p /= 2;
	}
	return a;
}

ll mod_inverse(ll a, ll M = MOD) {
	return mod_pow(a, M - 2, M);
}

void set_fact(ll n, vl &fact, vl &rfact, ll M = MOD) {
	fact[0] = fact[1] = rfact[0] = rfact[1] = 1;
	for (ll i = 2; i <= n; i++) {
		fact[i] = i * fact[i - 1] % M;
		rfact[i] = mod_inverse(fact[i], M);
	}
    
}

ll nCr(ll n, ll r, vl &fact, vl &rfact, ll M = MOD) {
  if (r > n) return 0; 
  ll ret = fact[n];
  ret = (ret*rfact[r]) % M;
  ret = (ret*rfact[n - r]) % M;
  return ret;
}

const int MAX = 300010;
vl fact(MAX + 5), fact2(MAX + 5), rfact(MAX + 5), rfact2(MAX + 5);
vll dp(8, vl(MAX)), dp2(8, vl(MAX));


int main() {
  int x, y;
  cin >> x >> y;
  cout << x + y/2 << endl;
}
  


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

typedef long long ll;

int main()
{

    //freopen("input.txt", "r", stdin);


    int n;
    scanf("%d", &n);

    int* a = new int[n];
    for (int* it = a; it < a + n; ++it)
        scanf("%d", it);

    if (a[0])
    {
        printf("-1");
        return 0;
    }

    int last = 0;
    ll ans = 0;
    for (int i = 1; i < n; ++i)
    {
        if (a[i] == 0)
            last = i;

        if (i - a[i] < last)
        {
            printf("-1");
            return 0;
        }
        if (a[i] > a[i - 1])
        {
            if (a[i] - a[i - 1] > 1)
            {
                printf("-1");
                return 0;
            }
        }
        else
            ans += a[i - 1];
    }
    ans += a[n - 1];

    printf("%lld", ans);

}


Measured memory_bytes: 1024