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

int main(void)
{
    int D;
    cin >> D;

    vector<int> c(27,0);

    for(int i = 1; i <= 26; ++i)
    {
        int tmp;
        cin >> tmp;

        c[i] = tmp;
    }

    int s[D+1][27] = {};

    for(int i = 1; i <= D; ++i)
    {
        for(int j = 1; j <= 26; ++j)
        {
            int tmp;
            cin >> tmp;
            s[i][j] = tmp;
        }
    }
    
// question definition

    vector<int> t(D+1,0);
/*
    for(int i = 1; i <= D; ++i)
    {
        int tmp;
        cin >> tmp;
        t[i] = tmp;
    }
*/
    vector<int> lastd(27,0);
    vector<int> ccp(27,0);
    vector<int> ccm(27,0);
    int ans=0;

    for(int i = 1; i <= D; ++i)
    {
        for(int j = 1; j <= 26; ++j)
        {
            ccm[j] = -c[j]*(i - lastd[j]);
        }
        for(int j = 1; j <= 26; ++j)
        {
            ccp[j] = s[i][j] + ccm[j] + c[j]*(i - lastd[j]);
        }
        
        std::vector<int>::iterator iter = std::max_element(ccp.begin(), ccp.end());
        int index = std::distance(ccp.begin(), iter);
        t[i] = index;
        lastd[t[i]] = i;

    }

    for(int i = 1; i <= D; ++i)
    {
        cout << t[i] << endl;
    }    

    return 0;
}



Measured memory_bytes: 3672
import Data.Array.Unboxed

main :: IO ()
main = do
    c <- listArray ((1,1), (3,3)) . concatMap (map read . words) . lines
        <$> getContents :: IO (Array (Int,Int) Int)
    let b = listArray (1,3) [c!(1,j) | j <- [1..3]] :: Array Int Int
        a = listArray (1,3) [c!(i,1) - (b!1) | i <- [1..3]] :: Array Int Int
    putStrLn $ if all (==True) [ a!i + b!j == c!(i,j) | i <- [1..3], j <- [1..3] ]
                   then "Yes" else "No"


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

int main() {
  int n,ans = 0;
  cin >> n;
  vector<P>a(n),b(n);
  rep(i,0,n) cin >> a[i].first >> a[i].second;
  rep(i,0,n) cin >> b[i].first >> b[i].second;
  sort(b.begin(),b.end());
  vector<bool>used(n,false);
  rep(i,0,n){
    int x = b[i].first,y = b[i].second,my = -1,py;
    rep(j,0,n){
      if(a[j].first < x && a[j].second > my && a[j].second < y && !used[j]){
        my = a[j].second;
        py = j;
      }
    }
    if(my != -1){
      ans++;
      used[py] = true;
    }
  }
  cout << ans << endl;
}

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

int main(){
	int S;
	int h,m,s;
	cin>>S;
	h=S/3600;
	S=S%3600;
	m=S/60;
	s=S%60;
	cout<<h<<":"<<m<<":"<<s<<endl;
	return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> T;
  int sum = 0;
  for(int i = 0; i < N; i++){
    int t;
    cin >> t;
    sum += t;
    T.push_back(t);
  }

  int M;
  cin >> M;
  for(int i = 0; i < M; i++){
    int p, x = 0;
    cin >> p >> x;
    cout << sum - T[p - 1] + x << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#include<iostream>
#include<cstring>
using namespace std;
int W,H;
char fie[102][102];
int cost[102][102];
char df[]={'>','v','<','^'};
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
  while(1){
    cin >> H >> W;
    memset(fie,-1,sizeof(fie));
    memset(cost,0,sizeof(cost));
    if(W==0 && H==0) break;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	cin >> fie[j][i];
      }
    }
    int x=0,y=0;
    bool f=false;
    cost[x][y]=1;
    while(fie[x][y]!='.'){
      for(int i=0;i<4;i++){
	
	if(fie[x][y]==df[i]){
	  x+=dx[i];
	  y+=dy[i];
	}
      }
      if(cost[x][y]){
	f=true;
	break;
      }
      cost[x][y]=1;
    }
    if(!f) printf("%d %d\n",x,y);
    else puts("LOOP");
  }
}

Measured memory_bytes: 1204
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main(void){
    int A,B,H,M;
    long double thetaA,thetaB;
    long double l;
    long double radAB;

    cin>>A>>B>>H>>M;
    thetaA = (360.0/720.0*((long double)M+(long double)H*60));
    thetaB = (360.0/60.0*(long double)M);
    radAB = (thetaA - thetaB)*M_PI/180.0;
    //radAB = radAB%(M_PI/2);
    l = sqrt((long double)(A*A+B*B)-(long double)(2*A*B*cos(radAB)));
    cout << fixed;
    cout<<setprecision(20)<<l<<endl;
    return 0;
}

Measured memory_bytes: 4092
n, k = list(map(int, input().split()))
b = list(map(int, input().split()))
a = [0 for i in range(n)]
m = set(b)
ans = 0
for l in range(n):
    a[b[l]-1] += 1
c = [item for item in a if item != 0]
c.sort(reverse=True)
balls = sum(c[0:k])
print(n-balls)

Measured memory_bytes: 26812
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi pair<ll,int> 
#define pii pair<int,ll>
 
ll mod = 1e9+7;
ll INF = 1e17;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
int main()
{
    IOS
    ll n,m;
    cin>>n>>m;
    ll arr[n];
    for(ll i=0;i<n;i++)
    arr[i]=-1;
    ll c1,c2,flag=0;
    while(m--)
    {
        cin>>c1>>c2;
        if(arr[c1-1]==-1)
        arr[c1-1]=c2;
        else if(arr[c1-1]!=c2)
        flag=1;
    }
    if(flag==1)
    cout<<-1<<endl;
    else
    {
        if(arr[0]==0 && n!=1)
        cout<<-1<<endl;
        else
        {
        ll m1=0;
        for(ll i=0;i<n;i++)
        {
            if(arr[i]!=-1)
            m1+=arr[i]*pow(10,n-i-1);
        }
        ll c=0;
        for(ll i=m1;i!=0;i/=10)
        c++;
        if(c!=n && !(c==0 && n==1))
        {
            m1+=pow(10,n-1);
        }
        cout<<m1<<endl;
    }
    }
    return(0);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		//  1 <= x <= 1000
		int x = scanner.nextInt();
		int ans = 0;
		ans = exponential(x);
		System.out.println(ans);
		
	}
	
	public static int exponential(int x) {
		int ans = 0;
		for (int i = 31; i >= 1; i--) {
			for (int j = 9; j >= 2; j--) {
				if (Math.pow((double)i, (double)j) <= x) {
					ans = Math.max(ans, (int)Math.pow((double)i, (double)j));
//					System.out.println(i + "," + j);
				}
			}
		}
		return ans;
	}

}


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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

int main(){
	int n;
	int k;

	cin >> n >> k;
	int ans = 0;
	
	rep(i, n){
		int h;
		cin >> h;
		if(h >= k) ans++;
	}

	cout << ans;
	return 0;
}

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

int main()
{
    string s;
    int k;
    cin >> k >> s;

    if (s.size() <= k)
    {
        cout << s << endl;
    }
    else
    {
        cout << s.substr(0, k) + "..." << endl;
    }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;

int main() {
    int n;
    cin >> n;
    vi a(n);
    map<int, int> m;
    rep(i, n) {
        cin >> a[i];
        m[a[i]]++;
    }
    int cnt = 0;
    for (auto x : m) {
        if (x.first < x.second) {
            cnt += x.second - x.first;
        } else if (x.first > x.second) {
            cnt += x.second;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 8060
#include <iostream>
#include <cstring>

using namespace std;



int a[200005];
int dp[1 << 26];
const int INF = 1e9;

int main() {
  string s;
  cin >> s;

  for(int i = 0; i < s.size(); i++) {
    a[i+1] = (1 << (s[i] - 'a')) ^ a[i];
    //  cout << a[i+1] << endl;
  }

  for(int i = 0; i < (1 << 26); i++) dp[i] = INF;

  dp[0] = 0;

  int tmp;
  for(int i = 1; i <= s.size(); i++) {
    tmp = dp[a[i]];
    for(int j = 0; j < 26; j++) {
      int s = (1 << j);
      tmp = min(tmp,dp[a[i] ^ s]);
    }
    dp[a[i]] = min(dp[a[i]],tmp + 1);
    //  cout << a[i] <<"   "<<dp[a[i]] << endl;
  }
  cout << tmp + 1 << endl;
}


Measured memory_bytes: 263556
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e5;
const long inf=1e9;
int main(){
	string s;cin>>s;
	if(s=="AAA"||s=="BBB") cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

int nmax = 1e9 + 7;

long long kaijou(int N){
  long long ans = 1;
  for (int i = 1; i <= N ; i++){
    ans = ans * i;
    ans = ans % nmax;
  }
  return ans;
}

int main(){

  int N; cin >> N;
  string S; cin >> S;
  
  long long start = 0, ans = 1;


  for (int i = 0; i < 2 * N; i++){
    if (S[i] == 'B' && i % 2 == 0){
      start++;
    }else if(S[i] == 'W' && i % 2 != 0){
      start++;
    }else{
      ans = ans * start;
      ans = ans % nmax;
      start--;
    }
  }
  
  if (start != 0){
    ans = 0;
  }
  

  ans = ans * kaijou(N);
  ans = ans % nmax;
  cout << ans << endl;
  

  return 0;

}


Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef double          D;
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define pb              push_back
#define GCD(a, b)       __gcd(a, b)
#define PI              2.0*acos(0.0)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define Rep(i,a,b)      for(int i = a; i <= b; i++)
#define rep(i,a,b)      for(int i = a; i >= b; i--)
#define boost		    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)

#define si(x)           scanf("%d",&x)
#define pi(x)           printf("%d",x)
#define ss(str)         scanf("%s",str)
#define pl(x)           printf("%lld",x)
#define sl(x)           scanf("%lld",&x)
#define sii(x,y)        scanf("%d %d",&x,&y)
#define sll(x,y)        scanf("%lld %lld",&x,&y)
#define siii(x,y,z)     scanf("%d %d %d",&x,&y,&z)
#define slll(x,y,z)     scanf("%lld %lld %lld",&x,&y,&z)
using namespace std;


/*

bool bs(LL l,LL r)
{
    int mid,res=-1;

    while(l<=r)
    {
        mid=l+(r-l)/2;



    }

    return res;
}


*/

//--------------------------code starts here---------------------------------------
/*
LL sum[400002];
LL num[100002];

//call with buildSegemntTree(1,1,n)
void buildSegmentTree(int at,int L,int R)
{
    sum[at]=0;

    if(L==R)
    {
        sum[at]=num[L];

        return;
    }

    int mid=(L+R)/2;

    buildSegmentTree(at*2,L,mid);
    buildSegmentTree(at*2+1,mid+1,R);


    sum[at]=sum[at*2]+sum[at*2+1];
}


void updateSegemntTreeWithNew(int at,int L,int R,int pos,LL value)
{
    if(pos>R || pos<L)
    {
        return;
    }

    if(L>=pos  && R<=pos)
    {
        sum[at]=value;
        return;
    }


    int mid=(L+R)/2;

    updateSegemntTreeWithNew(at*2,L,mid,pos,value);

    updateSegemntTreeWithNew(at*2+1,mid+1,R,pos,value);

    sum[at]=sum[at*2]+sum[at*2+1];
}


//call with querySegmentTree(1,1,n,l,r)

LL querySegmentTree(int at,int L,int R,int l,int r)
{
    if(r<L  || R<l)
        return 0;

    if(l<=L  && R<=r) return sum[at];

    int mid=(L+R)/2;

    LL x=querySegmentTree(at*2,L,mid,l,r);
    LL y=querySegmentTree(at*2+1,mid+1,R,l,r);

    return x+y;
}*/
vector<LL> adj[100005];

int main()
{
    int n;
    si(n);
    LL sum=0,x,y,q;
    Rep(i,1,n)
    {
        sl(x);
        sum+=x;
        adj[x].pb(i);
    }

    //buildSegmentTree(1,1,n);

    sl(q);


    Rep(i,1,q)
    {
        sll(x,y);

        if(adj[x].size()==0)
            {

            }
        else
        {
            for(int j=0;j<adj[x].size();j++)
            {
                adj[y].pb(adj[x][j]);
                sum-=x;
                sum+=y;
            }
        }

        adj[x].clear();


        cout<<sum<<nl;
    }



    return 0;

}


Measured memory_bytes: 52740
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int now = -1;
		int count = 0;
		int ans = 0;
		for(int i=0;i<N;++i){
			int next = sc.nextInt();
			if(now != next){
				ans += count/2;
				count = 1;
				now = next;
			}else{
				count++;
			}
		}
		ans += count/2;
		System.out.println(ans);
		return;
	}
}

Measured memory_bytes: 21844
N,A,B = map(int,input().split())
if A%2 != 0 and B%2 == 0:
  ans = (B-A-1)//2 + min(A-1,N-B) + 1
elif A%2 == 0 and B%2 != 0:
  ans = (B-A-1)//2 + min(A-1,N-B) + 1
else:
  ans = (B-A)//2
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int r,g,b;
    cin >> r >> g >> b;
    if((100 * r + 10 * g + b) % 4 == 0)
    {
        cout << "YES";
    }
    else
    {
        cout << "NO";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>

double MinkovskiDistance(int n, int *x, int *y, double p){
  double sum = 0.0;

  for(int i=0; i<n; i++){
    sum += pow(std::abs(x[i] - y[i]), p);
  }
  return pow(sum, 1/p);
}

double ChebyshevDistance(int n, int *x, int *y){
  double max = 0.0, sub;

  for(int i=0; i<n; i++){
    sub = std::abs(x[i] - y[i]);
    if(sub > max) max = sub;
  }
  return max;
}

int main(){
  int n;
  int x[1000], y[1000];

  std::cin >> n;
  for(int i=0; i<n; i++) std::cin >> x[i];
  for(int i=0; i<n; i++) std::cin >> y[i];

  printf("%.8f\n%.8f\n%.8f\n%.8f\n",
        MinkovskiDistance(n, x, y, 1.0),
        MinkovskiDistance(n, x, y, 2.0),
        MinkovskiDistance(n, x, y, 3.0),
        ChebyshevDistance(n, x, y));
}



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

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (b < a) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

class mint {
  private: 
    ll x;

  public:
    constexpr mint(const ll x = 0) noexcept : x((x % MOD + MOD) % MOD) {}
    constexpr ll value() noexcept { return x; }
    constexpr mint operator += (const mint right) noexcept {
      if ((x += right.x) >= MOD) x -= MOD;
      return *this;
    }
    constexpr mint operator -= (const mint right) noexcept {
      if ((x += MOD - right.x) >= MOD) x -= MOD;
      return *this;
    }
    constexpr mint operator *= (const mint right) noexcept {
      x = x * right.x % MOD;
      return *this;
    }
    constexpr mint operator /= (const mint right) noexcept {
      return *this *= right.inv();
    }
    constexpr mint operator + (const mint right) const noexcept {
      return mint(*this) += right;
    }
    constexpr mint operator - (const mint right) const noexcept {
      return mint(*this) -= right;
    }
    constexpr mint operator / (const mint right) const noexcept {
      return mint(*this) /= right;
    }
    constexpr mint operator * (const mint right) const noexcept {
      return mint(*this) *= right;
    }
    constexpr mint inv() const {
      return pow(MOD-2);
    }
    constexpr mint pow(ll n) const {
      if (n == 0) return 1;
      mint a = pow(n>>1);
      a *= a;
      if (n & 1) a *= *this;
      return a;
    }
};

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int n; cin >> n;
  
  mint ans(1);
  rep2(i, 2, n) ans *= i;

  cout << ans.value() << endl;
  
  return (0);
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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 dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
/*----------------------------------------------------------------------------------*/


int main() {
    int n; cin >> n;
    vector<int> a(n), b(n);
    ll asum = 0, bsum = 0;
    rep(i,n) cin >> a[i], asum += a[i];
    rep(i,n) cin >> b[i], bsum += b[i];

    if (bsum < asum) {
        cout << "No" << endl;
        return 0; 
    }

    ll cnt = bsum - asum;

    ll acnt = 0, bcnt = 0;
    rep(i,n) {
        if (a[i] < b[i]) {
            acnt += (b[i]-a[i]+1)/2;
            if ((b[i]-a[i])%2==1) bcnt++;
        } else if (a[i] > b[i]) {
            bcnt += a[i]-b[i];
        }
    }

    if (acnt < bcnt) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define lli long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()

#define forn(i, n)  for(int i=0;i<n;++i)
#define rforn(i,start) for(int i = start; i >= 0;--i)
#define forsn(i,start,end) for(int i=start;i<end;++i)
#define rforsn(i,start,end) for(int i=start;i>=end;--i)
#define debug(x) cout<<#x<<" = "<<x<<"\n";
const int CONST = 1e9 + 7;




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

    int n, m;
    cin>>n>>m;
    

    vector<vector<int> >adj(n+1, vector<int>());
    forn(i, m){
        int u, v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }

    int par[n+1];
    par[1]=0;
    queue<int> q;
    q.push(1);
    memset(par, -1, sizeof(par));

    while(!q.empty()){
        int u= q.front();
        q.pop();
        for(int v: adj[u]){
            if(par[v]==-1){
                par[v]=u;
                q.push(v);
            }  
        }
    }

    forsn(i, 1, n+1){
        if(par[i]==-1){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes\n";
    forsn(i, 2, n+1){
        cout<<par[i]<<endl;
    }
	return 0;
}


Measured memory_bytes: 10044
#include <iostream>
 using namespace std ;
 int main()
 {
   int A, B, c, d, e;
   cin>>A;
   cin>>B;
   c =(A + B);
   d =(A - B);
   e =(A * B);
   if (c >= e&&c >= d)
   {
   cout<<c<<endl;
   }
else   if (e >= d&&e >= c)
   {
     cout<<e<<endl;
   }
  else  if (d >= e&&d >= c) 
   {
     cout<<d<<endl;
   }
   }

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

int main(void){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    
    while(true){
        C -= B;
        if(C <= 0){
            cout << "Yes" << endl;
            return 0;
        }
        
        A -= D;
        if(A <= 0){
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3624
n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
a.reverse!
if n.even?
  puts a.slice(1..((n-2)/2)).sum*2+a[0]
else
  puts a.slice(1..((n-3)/2)).sum*2+a[0]+a[n/2]
end

Measured memory_bytes: 29604
#include<stdio.h>

int dp[50];

int fib(int n)
{
	if(n == 0 || n == 1) return dp[n] = 1;
	if( dp[n] != -1) return dp[n];
	return dp[n] = fib(n-1)+fib(n-2);
}

int main()
{
	int n , i;
	for( i = 0; i < 50; i++)
	{
		dp[i] = -1;
	}
	scanf("%d",&n);
	printf("%d\n",fib(n));
	return 0;
}



Measured memory_bytes: 2104
// Author: Zark84010 (Aditya Ranjan)

#include <bits/stdc++.h>
 
using namespace std;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"
 
#define sz(a) ((int)(a).size())
#define all(v) (v).begin(), (v).end()
#define tr(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); it++)
#define pres(c, val) ((c).find(val) != (c).end())      //
#define cpres(c, val) (find(all(c), val) != (c).end()) //

#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define forf(i, a, b) for (int i = (a); i < (b); i++)
#define forb(i, a, b) for (int i = (b); i >= (a); i--)
#define fo(i, n) forf(i, 0, n)
#define fob(i, n) forb(i, 0, n - 1)
 
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
 
const int INF = 9e18;
// const int N = 1e9 + 7;
const int N = 998244353;
const double eps = 1e-9;
 
const auto start_time = std::chrono::high_resolution_clock::now();
 
void zark() {
  #ifdef ZARK
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time - start_time;
    cerr << "Time Taken : " << diff.count() << "s\n";
  #endif
}
 
#ifdef ZARK
  #include "/home/aranjan/Desktop/CP/header.h"
  #else
  #define dbg(args...)
#endif

/* ------------------ Actual Coding Starts ------------------ */

vi fac;

int mpow(int a, int n) {
	if(n == 0) return 1;
	else if(n == 1) return a%N;
	if(n&1) return ((a%N)*(mpow(a, n-1)%N)%N);
	else {
		int k = mpow(a, n/2)%N;
		return (k*k)%N;
	}
}

int inv(int a) {
	return mpow(a, N-2);
}

int c(int n, int k) {
	int ans = fac[n];
	ans = (ans*(inv(fac[n-k]) % N))%N;
	ans = (ans*(inv(fac[k]) % N))%N;
	return ans;
}

void solve() {
	int n,m,K;
	cin>>n>>m>>K;
	int mx = max(n, m);
	fac = vi(mx+1);
	fac[0] = 1;
	fo(i, mx) fac[i+1] = (((i+1)%N)*(fac[i]%N))%N;
	int ans = 0;
	fo(k, K+1) {
		int a = c(n-1, k);
		a = ((a%N)*(m%N))%N;
		a = ((a%N)*(mpow(m-1, n-k-1)))%N;
		ans = ((ans%N)+a)%N;
	}
	cout << ans << endl;
}

int32_t main() {
  fastio;
  #ifdef ZARK
  freopen("input.in", "r", stdin);
  #endif
 
  // freopen("txt.in", "r", stdin);
  // freopen("txt.out", "w", stdout);
  // cout << fixed << setprecision(35);
 
  solve();
  zark();
  return 0;
}

Measured memory_bytes: 4768
#include<iostream>
#include <numeric>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <bits/stdc++.h> 
using namespace std;
 
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) 
\
 
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b && c!=a) || (b==c && a!=c) || (c==a && b!=a))
    cout<<"Yes";
  else
    cout<<"No";
  
  return 0;
}

Measured memory_bytes: 256
package main

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

// input に使うやつ
var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

// string から int へ
func atoi(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}

// 一つの文字を int として読み込み
func readInt() int {
	return atoi(readLine())
}

// 複数の文字を int のスライスとして読み込み
func readInts() []int {
	in := readLine()
	ins := strings.Split(in, " ")
	out := make([]int, len(ins))
	for i, v := range ins {
		out[i] = atoi(v)
	}
	return out
}

// sortしたスライスを返す
func sorted(a []int) []int {
	sort.Ints(a)
	b := a
	return b
}

// 逆順のsort
func reverse(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	b := a
	return b
}

func main() {
	n := readInt()
	a := make([]int, n+1)
	for i, v := range readInts() {
		a[i+1] = v
	}

	b := make([]int, n+1)
	for i := n; i >= 1; i-- {
		var sum int
		for j := i + i; j <= n; j += i {
			sum ^= b[j]
		}
		b[i] = sum ^ a[i]
	}

	var ans []int
	for i := 1; i <= n; i++ {
		if b[i] == 1 {
			ans = append(ans, i)
		}
	}
	fmt.Println(len(ans))

	for i, v := range ans {
		if i == len(ans)-1 {
			fmt.Printf("%v", v)
		} else {
			fmt.Printf("%v ", v)
		}
	}
	if len(ans) != 0 {
		fmt.Println("")
	}
}


Measured memory_bytes: 12832
#pragma region Macros
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

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;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

vector<int> prime_factors(int n) {
  vector<int> ret;
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret.emplace_back(i);
      n /= i;
    }
  }
  if (n != 1) {
    ret.emplace_back(n);
  }
  return ret;
}

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

  int n;
  cin >> n;
  cout << n << ':';
  for (auto v : prime_factors(n)) {
    cout << " " << v;
  }
  cout << '\n';

  return 0;
}


Measured memory_bytes: 3212
def main():
    N = int(input())
    X = []
    Y = []

    for _ in range(N):
        x, y = (int(i) for i in input().split())
        X.append(x + y)
        Y.append(x - y)

    ans = max(max(X) - min(X), max(Y) - min(Y))
    print(ans)


if __name__ == '__main__':
    main()


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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

int main()
{
    int N, T;
    cin >> N >> T;
    vector<pair<int, int>> v(N);
    for (int i = 0; i < N; i++) cin >> v[i].first >> v[i].second;

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

    for (int i = 0; i < N; i++)
    {
        if (v[i].second <= T)
        {
            cout << v[i].first << endl;
            return 0;
        }
    }
    cout << "TLE" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

int main()
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll rcnt = 0;
    ll gcnt = 0;
    ll bcnt = 0;
    for(char c : s)
    {
        if(c == 'R') rcnt++;
        else if(c == 'G') gcnt++;
        else if(c == 'B') bcnt++;
    }
    ll cnt = 0;
    for(ll i=0; i<n; i++)
    {
        for(ll j=i+1; j<n; j++)
        {
            ll k = 2*j - i;
            if(k >= n) continue;
            if(s.at(i) != s.at(j) && s.at(j) != s.at(k) && s.at(k) != s.at(i)) cnt++;
        }
    }
    // cout << rcnt << endl;
    // cout << gcnt << endl;
    // cout << bcnt << endl;
    // cout << cnt << endl;
    cout << rcnt * gcnt * bcnt - cnt << endl;
    return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main(){
	int x, y;
	while(true){
		cin >> x >> y;
		if(x == 0 && y == 0) break;
		cout << min(x, y) << " " << max(x, y) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
//Modulo Calculation
const int MOD = 998244353;
//ModInt
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
  
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    ModInt &operator++ () { *this += 1; return *this;}
    ModInt operator++ (int) { *this += 1; return *this - 1;}
    ModInt &operator-- () { *this -= 1; return *this;}
    ModInt operator-- (int) { *this -= 1; return *this + 1;}
    bool operator==(ModInt rhs) const { return x == rhs.x; }    
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    bool operator<=(ModInt rhs) const { return x <= rhs.x; }
    bool operator>=(ModInt rhs) const { return x >= rhs.x; }
    bool operator<(ModInt rhs) const { return x < rhs.x; }
    bool operator>(ModInt rhs) const { return x > rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
  
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
using mint = ModInt<MOD>;

//二項定理計算
const int MAX = 1000010;
mint fac[MAX],finv[MAX],inv[MAX];
//テーブル作成
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*(mint)i;
        inv[i]=(mint)MOD-inv[MOD%i]*(mint)(MOD/i);
        finv[i]=finv[i-1]*inv[i];
    }
}

//nCkを求める
mint COM(int n,int k){
    if(n < k or n < 0 or k < 0)return 0;
    return fac[n]*finv[k]*finv[n-k];
}

struct maketable{
    maketable(){COMinit();}
}maketable_;

mint res;
int main(){
    int n, k;
    cin >> n >> k;
    for(int r = n; r <= k; r++) res += COM(k, r) - COM(k, 2 * r - n + 1);
    cout << res << '\n';
}

Measured memory_bytes: 15352
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
double ans = 0;
int main() {
	cin >> N >> K;
	for (int n = 1; n <= N; n++) {
		if (n >= K) {
			ans += 1.0 / N;
		}
		else {
			int i = n;
			double tmp = 1.0 / N;
			while (i < K) {
				i *= 2;
				tmp *= 0.5;
			}
			ans += tmp;
		}
	}
	printf("%.15f\n", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int L, R, d;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> L >> R >> d;
	int ans = 0;
	rep(x, L, R + 1) if (x % d == 0) ans++;
	cout << ans << endl;
}







Measured memory_bytes: 3548
result = (0..9).to_a.repeated_permutation(4).map { |a| a.inject(:+) }.each_with_object(Hash.new(0)) { |e, a| a[e] += 1 }
STDIN.read.split("\n").map(&:chomp).map(&:to_i).each { |n| puts result[n] || 0 }

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

int main(){
  int N;
  cin >> N;
  vector<vector<pair<string,int>>> V(N+1,vector<pair<string,int>>(0));
  V[1].push_back(make_pair("a",1));
  
  for(int i=1;i<N;i++){
    for(int j=0;j<V[i].size();j++){
      for(int k=0;k<=V[i][j].second;k++){
        if(k==V[i][j].second) V[i+1].push_back(make_pair(V[i][j].first+char(k+'a'),V[i][j].second+1));
        else V[i+1].push_back(make_pair(V[i][j].first+char(k+'a'),V[i][j].second));
      }
    }
  }
  
  sort(V[N].begin(),V[N].end());
  for(int i=0;i<V[N].size();i++) cout << V[N][i].first << endl;
  return 0;
}


Measured memory_bytes: 10736
n=int(input())
w = []
flag = "Yes"
s = input()
w.append(s)
l = s[-1]
for _ in range(n-1):
    s=input()
    if s in w:
        flag = "No"
    else:
        w.append(s)
        if s[0] != l:
            flag = "No"
        else:
            l = s[-1]
print(flag)


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

typedef long long ll;

int main() {
	int n;
	vector<int> p;
	vector<int> j;
	while(cin >> n, n) {
		p.resize(n);
		j.resize(n-1);
		for(int i = 0; i < p.size(); i++)
			cin >> p[i];
		for(int i = 0; i < j.size(); i++)
			cin >> j[i];

		ll sum = 0;
		for(int i = 0; i < p.size(); i++)
			sum += p[i];

		sort(j.rbegin(), j.rend());
		ll res = n * sum;
		for(int i = 0; i < j.size(); i++) {
			sum += j[i];
			res = max(res, (n-(i+1)) * sum);
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 1532
A, B, C, X, Y = map(int, input().split())
    

if X >= Y:
    ans = min(A*X + B*Y, 2*C*Y + A*(X-Y), 2*C*X)
else:
    ans = min(A*X + B*Y, 2*C*X + B*(Y-X), 2*C*Y)

print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {

    private static ArrayList<String> list = new ArrayList<>();

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < n; i++) {
            builder.append(sc.nextInt());
        }
        String p = builder.toString();
        builder = new StringBuilder();
        for (int i = 0; i < n; i++) {
            builder.append(sc.nextInt());
        }
        String q = builder.toString();
        builder = new StringBuilder();
        for (int i = 1; i <= n; i++) {
            builder.append(i);
        }

        permutation(builder.toString(), "");

        System.out.println(Math.abs(list.indexOf(p) - list.indexOf(q)));
    }

    private static void permutation(String q, String ans) {
        // Base Case
        if (q.length() <= 1) {
            list.add(ans + q);
        }
        // General Case
        else {
            for (int i = 0; i < q.length(); i++) {
                permutation(q.substring(0, i) + q.substring(i + 1),
                        ans + q.charAt(i));
            }
        }
    }
}


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

vector<int> phi16(int n){
	vector<int> v(n+1);
	for(int i = 0 ; i <= n ; i++)
		v[i] = i;

	for(int i = 2 ; i <= n ; i++){
		if(v[i] == i){
			for(int j = i ; j <= n ; j += i){
				v[j] -= v[j] / i;
			}
		}
	}
	return v;
}

long long sum[1000001];

int main(){
	vector<int> w = phi16(1000000);
	for(int i = 1 ; i <= 1000000 ; i++){
		sum[i] = sum[i-1] + w[i];
	}
	int t;
	cin >> t;
	while(t--){
		int n; cin >> n;
		cout << sum[n] + 1 << endl;
	}
}

Measured memory_bytes: 12000
inf = float("inf")
N,M,X = map(int,input().split())
CA = [list(map(int,input().split())) for _ in range(N)]

A = [0]*M #[0, 0, 0, …]を生成
for ca in CA: #CAの行を抽出
    for i in range(1,M+1): #CAの行の中の要素を抽出
        a = ca[i]
        A[i-1]+=a #それぞれの理解度の合計を計算

if min(A) < X:
    print(-1)
else:
    K = 2**N #2のN乘
    ans = inf #無限大を定義
    for i in range(K):
        b = bin(i) #iを2進数に変換(型は文字列)
        b = b.lstrip("0b") #bから'0b'を除去
        while (len(b)) < N:
            b = "0"+b

        A = [0]*M
        cost = 0
        for j in range(N):
            if b[j] == "1":
                ca = CA[j]
                for k in range(M+1):
                    if k == 0:
                        cost+=ca[k] #合憲金額を計算
                    else:
                        A[k-1] += ca[k]

        if min(A) >= X:
            ans = min(ans,cost)

    print(ans)


Measured memory_bytes: 9172
import numpy as np
import math as mt
N,M=map(int, input().split())
A=list(map(int,input().split()))
boader=1/(4*M)
A.sort(reverse=True)
for i in range(0,M):
    if A[i]<(sum(A)*(1/(4*M))):
        print("No")
        break
    elif i==M-1:
        print("Yes")

Measured memory_bytes: 12500
//****************************//
/**********  main *************/
//****************************//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(i=0;i<n;i++)
#define FOR(i,a,b) for(i=a;i<b;i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
 
 
int main() {
 
	std::cin.tie(0);
 
	ll n,a,b;
	cin >> n >> a >> b;
 
	ll tmp,i,res;

	if(a == 0 ) {
		cout << 0 << endl ;
		return 0;
	}
	if(a == 0 && b == 0 ) {
		cout << 0 << endl ;
		return 0;
	}
    
    
	tmp = n/(a+b);
	ll mod = n%(a+b);
	
	if(mod<=a){
	    res = tmp*a + mod;
	} else {
	    res = tmp*a + a;
	}

	cout << res << endl ;
 
 
    return 0;
}

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

void solve(long long N){
    vector<int> l{0, 1, 3, 6, 10, 15, 21, 28, 36, 45};
    long long count = 0;
    for (long long p = 2; p <= 1e6; p++) {
        long long i = 0;
        while (N % p == 0) {
            N /= p;
            i++;
        }
        int j = upper_bound(l.begin(), l.end(), i) - l.begin()-1;
        count += j;
    }
    if (N > 1e6) count += 1;

    cout << count << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
int main(void){
int h,w,i,n;
while(1){
scanf("%d %d",&h,&w);
if(h==0&&w==0){break;}else
{
for(i=0;i<h;i++){
for(n=0;n<w;n++){
if(i==0||i==h-1||n==0||n==w-1){printf("#");}
else{printf(".");}
}
printf("\n");
}
}
printf("\n");
}
return 0;
}

Measured memory_bytes: 572
/* Name        : b
 * Creat       : Fri Jul 12 22:19:06 CST 2019
 * Accept      : Fri Jul 12 22:24:29 CST 2019
 * Author      : landcold7
 * Action speaks louder more than words
 */
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define sz(x) ((int)(x).size())
#ifndef _has_trace
#define trace(...)
#endif
typedef long long ll;

void solve() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  vector<int> d(n + 2);
  int ans = (d[1] <= x);
  for (int i = 2; i <= n + 1; ++i) {
    d[i] = d[i - 1] + a[i - 1];
    if (d[i] <= x) {
      ans++;
    }
  }
  trace(d);
  cout << ans << "\n";
}

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


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 10
//#define DEBUG

#ifdef DEBUG
#define DBGPRINTF(...) printf(__VA_ARGS__)
#else
#define DBGPRINTF(...)
#endif

int main( int argc, char *argv[] )
{
    int i, j, tmp;
    int m[MAX] = { 0 };

    DBGPRINTF( "argc: %d\n", argc );

//    if ( argc > 1 )
    {
        DBGPRINTF( "input value\n" );

#if 0
        for ( i = 0; i < argc - 1; i++ )
        {
            DBGPRINTF("%s\n", argv[i + 1] );
            sscanf( argv[i + 1], "%d", &m[i] );
            DBGPRINTF("%d\n", m[i] );
            DBGPRINTF("%s\n", argv[i + 1] );
        }

#else
        for ( i = 0; i < MAX; i++ )
        {
            scanf( "%d", &m[i] );
        }
#endif

        DBGPRINTF( "\n" );

        for ( i = 0; i < MAX - 1; i++ )
        {
            for ( j = 1; j < MAX; j++ )
            {
                DBGPRINTF( "m[%d]: %d, m[%d]: %d\n", j-1, m[j-1], j, m[j] );
                if ( m[ j - 1 ] < m[ j ] )
                {
                    tmp = m[ j - 1 ];
                    m[ j - 1 ] = m[ j ];
                    m[ j ] = tmp;
                }
            }
            DBGPRINTF( "processing output value\n" );
            for ( j = 0; j < MAX; j++ )
            {
                DBGPRINTF("%d\n", m[ j ] );
            }
            DBGPRINTF( "\n" );

        }

        DBGPRINTF( "output value\n" );
        for ( i = 0; i < MAX; i++ )
        {
            DBGPRINTF( "%d\n", m[ i ] );
        }

        DBGPRINTF( "\ntop3\n" );
        for ( i = 0; i < 3; i++ )
        {
            printf( "%d\n", m[ i ] );
        }
        
    }

    return 0;

}

Measured memory_bytes: 600
# include <iostream>
# include <string>
using namespace std;
int main(void)
{
	int n,ans = 0;
	string a[100],b[100];
	scanf("%d",&n);
	for(int i = 0;i < n;i++)
	{
		cin>>a[i];
		b[i] = a[i];
	}
	for(int i = 0;i < n-1;i++)
	{
		for(int j = n-1;j > i;j--)
			if(a[j][1] < a[j-1][1]) swap(a[j],a[j-1]);
	}
	for(int i = 0;i < n;i++) cout<<a[i]<<(i == n-1?"\n":" ");
	cout<<"Stable"<<endl;
	for(int i = 0;i < n-1;i++)
	{
		int index = i;
		for(int j = i+1;j < n;j++)
			if(b[j][1] < b[index][1]) index = j;
		swap(b[i],b[index]);
	}
	for(int i = 0;i < n;i++) cout<<b[i]<<(i == n-1?"\n":" ");
	for(int i = 0;i < n;i++)
	{
		if(b[i] != a[i])
		{
			cout<<"Not stable"<<endl;
			return 0;
		}
	}
	cout<<"Stable"<<endl;
	return 0;
}


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

long long KnapSack(int W, vector<int> wt, vector<int> val, int n){
    vector<vector<long>> dp(n+1,vector<long>(W+1));
    for(int i=0;i<=n;i++){
        for(int j=0;j<=W;j++){
            if(i==0||j==0)
                dp[i][j]=0;
            else if(wt[i-1]<=j)
                dp[i][j] = max(val[i-1]+dp[i-1][j-wt[i-1]],dp[i-1][j]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    return dp[n][W];
}

int main(){
    int n,W;
    cin>>n>>W;
    vector<int> wt(n), val(n);
    for(int i=0;i<n;i++)
        cin>>wt[i]>>val[i];
    cout<<KnapSack(W,wt,val,n);
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    int t = 0,x = 0,y = 0;
    for(int i = 0;i < N;i++){
        int a,b,c;
        cin >> a >> b >> c;
        int dif = (a - t) - (abs(x - b) + abs(y - c));
        if(dif < 0 || dif & 1){
            cout << "No" << endl;
            return 0;
        }
        t = a,x = b,y = c;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
'use strict'
function main(input) {
    input = input.split('\n');
    const args = input[0].split(' ');
    let A = parseInt(args[0]);
    let B = parseInt(args[1]);
    let ans = Math.max(A + B, A - B, A * B);
    if (ans === -0) ans = 0;
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define MAX 100
#define inf 1<<29
#define linf 1e16
#define eps (1e-8)
#define mod 1000000007
#define pi acos(-1)
#define phi (1.0+sqrt(5))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int n,m;
string a[MAX],b[MAX];
bool flag=false;

bool check(int c,int d){
  FOR(i,0,m)
    FOR(j,0,m)
      if(a[i+c][j+d]!=b[i][j])return false;
  return true;
}

int main()
{
  cin>>n>>m;
  FOR(i,0,n)cin>>a[i];
  FOR(i,0,m)cin>>b[i];
  
  FOR(i,0,n-m+1){
    FOR(j,0,n-m+1){
      if(check(i,j))flag=true;
    }
  }
  cout<<(flag ? "Yes" : "No")<<endl;
  return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete



main = getInts >>= print . uncurry (+) . apply2 divMod
    



Measured memory_bytes: 3624