akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ

int main()
{
    int N, X = 0;
    int y = 0;
    int ans = 1;
    int k = 0;
    cin >> N >> X;

    vector<int> ar;
    REP(i, N)
    {
        cin >> y;
        ar.push_back(y);
    }
    if (ar[0] > X)
    {
        cout << 1;
    }
    else
    {
        for (int j = 0; k <= X && j < N; j++)
        {
            if (j == 0)
            {
                k = ar[j];
            }
            else
            {
                k += ar[j];
            }
            if (k <= X)
            {
                ans++;
            }
        }
        cout << ans;
    }
}

Measured memory_bytes: 256
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cerr << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0); 

void solve(){
   int n;
   cin>>n;
   int x,ctr=0;
   rep(i,1,n+1){
      cin>>x;
      if(x&1 and i&1) ctr++;
   }
   cout<<ctr;
}

int main(){ 
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
   //  fastio;
    int t=1;
   //  cin>>t;
    while(t--)
        solve();
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = int64_t;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[5001][5002];

template<class X, class OP>
class SegTree{
    int n;
    std::vector<X> dat;
    OP op;
    X e;
    public:
    SegTree(int n_, OP op, X e) : op(op), e(e) {
        n = 1;
        while (n < n_) { n *= 2; }
        dat.resize(2 * n);
        for (int i = 0; i < 2 * n - 1; i++) {
            dat[i] = e;
        }
    }
    void update(int k, X v) {
        k += n - 1;
        dat[k] = v;
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = op(dat[2 * k + 1], dat[2 * k + 2]);
        }
    }
    X querySub(int a, int b) const {
        X left = e;
        X right = e;
        a += n - 1;
        b += n - 1;
        while (a < b) {
            if ((a & 1) == 0) {
	            left = op(left, dat[a]);
            }
            if ((b & 1) == 0) {
	            right = op(dat[b - 1], right);
            }
            a = a / 2;
            b = (b - 1) / 2;
        }
        return op(left, right);
    }
    X query(int a, int b) const {
        return querySub(a, b + 1);
    }
};

ll e = pow(2,31) - 1;

signed main(){
	ll n, q;
	cin >> n >> q;
	function<ll(ll, ll)> myMin = [](ll x, ll y){return min(x, y);};
	SegTree<ll, function<ll(ll, ll)>> st(n, myMin, e);
	REP(i, q){
		ll com, x, y;
		cin >> com >> x >> y;
		if(com == 0)st.update(x, y);
		else dump(st.query(x, y));
	}
}


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

int main( void )
{
  int num[ 3 ];

  for( int i = 0; i < 3; i++ ){
    cin >> num[ i ];
  }

  sort( num, num + 3 );

  for( int i = 0; i < 3; i++ ){
    cout << num[ i ];
    if( i < 3 - 1 ){
      cout << " ";
    }
  }
  cout << endl;

  return( 0 );
}

Measured memory_bytes: 1180
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

int n, a, b;
int popcnt(int x) {
	int r = 0;
	for (int i = 0; i < 17; i++)
		r += (x >> i) & 1;
	return r;
}
bool recv(int x) {
	if (x == 1)
		return true;
	return recv(x / 2) & (x & 1);
}
vector<int> r;
void rec(int d, int f) {
	if (f == 0)
		return;
	int x = d & -d;
	d ^= x, f ^= x;

	if (!d) {
		rec(f & -f, f);
		r.emplace_back(x);
		rec(f & -f, f);
	}
	else {
		int cnt = popcnt(d);
		int y = d & -d;
		int z = d ^ y;

		rec(y, f);
		r.emplace_back(x);
		rec(z, f);
	}
}
int main() {
	scanf("%d %d %d", &n, &a, &b);
	bool valid = popcnt(a ^ b) & 1;
	printf(valid ? "YES\n" : "NO\n");
	if (!valid)
		return 0;
	rec(a ^ b, (1 << n) - 1);

	printf("%d", a);
	for (int i = 0; i < r.size(); i++)
		printf(" %d", a ^= r[i]);
	printf("\n");
}

Measured memory_bytes: 1656
a,b,c,d = map(int,input().split())
while True:
    c -= b 
    if a <= 0:
        print('No')
        exit()
    if c <= 0:
        print('Yes')
        exit()
    
    a -= d
    if a <= 0:
        print('No')
        exit()
    if c <= 0:
        print('Yes')
        exit()

Measured memory_bytes: 9064
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;
signed main(){
  int n;cin>>n;
  int a,b;cin>>a>>b;
  if(a<b)swap(a,b);
  if((a-b)%2==0){
    cout<<(a-b)/2<<endl;
    return 0;
  }
  cout<<min(b-1,n-a)+(a-b+1)/2<<endl;
  
  return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void)
{
  char str[300002];
  int q,x,total=0,f,r=0,l=0;
  scanf("%s",str);
  scanf("%d",&q);
  char left[q],right[q];
  for(int i=0;i<q;i++){
    scanf("%d",&x);
    if(x==1) total++;
    else if(x==2){
      char tmp,tmp1;
      scanf("%d",&f);
      scanf("%c",&tmp1);
      scanf("%c",&tmp);
      //scanf("%c",&tmp1);
      //printf("%c\n",tmp);
      if(total%2==0){
        if(f==1){
          left[l]=tmp;
          l++;
        }else if(f==2){
          right[r]=tmp;
          r++;
        }
      }else if(total%2==1){
        if(f==1){
          right[r]=tmp;
          r++;
        }else if(f==2){
          left[l]=tmp;
          l++;
        }
      }//iftotal
    }//ifx
    //printf("%d\n",total);
  }//for
  int len;
  len=strlen(str);
  
  if(total%2==0){
    for(int i=l-1;i>=0;i--) printf("%c",left[i]);
    for(int i=0;i<len;i++) printf("%c",str[i]);
    for(int i=0;i<r;i++) printf("%c",right[i]);
  }else if(total%2==1){
    for(int i=r-1;i>=0;i--) printf("%c",right[i]);
    for(int i=len-1;i>=0;i--) printf("%c",str[i]);
    for(int i=0;i<l;i++) printf("%c",left[i]);
  }
    
  //for(int i=0;i<q;i++) printf("%c",right[i]);
  //printf("%d",f);
  return 0;
}

Measured memory_bytes: 768
from collections import defaultdict
from heapq import heappop, heappush

K = int(input())


class Graph(object):
    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    def __init__(self, graph, start):
        g = graph.graph

        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0
        self.prev = defaultdict(lambda: None)

        Q = []
        heappush(Q, (self.dist[start], start))

        while Q:
            dist_u, u = heappop(Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(Q, (alt, v))

    def shortest_distance(self, goal):
        return self.dist[goal]

    def shortest_path(self, goal):
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]


g = Graph()
for i in range(K - 1):
    g.add_edge(i, i + 1, 1)
    g.add_edge(i, (i * 10) % K, 0)
g.add_edge(K - 1, 0, 1)
g.add_edge(K - 1, ((K - 1) * 10) % K, 0)

d = Dijkstra(g, 1)
print(d.shortest_distance(0) + 1)

Measured memory_bytes: 62368
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
#define inf 0x7fffffff
/*------------------------------------------------------------*/
char a[200][200]; 
int main(){
//	freopen("1.out","w",stdout);
	int n,m;
	in2(n,m);
	if(m>n){
		n--;
		FOR(i,1,100)
			FOR(j,1,100)
				a[i][j]='.';
		for(int i=5;i<=95;i+=4)
			for(int j=5;j<=95;j+=4)
				if(m)a[i][j]='#',m--;
		for(int i=5;i<=95;i+=4)
			for(int j=5;j<=95;j+=4)
				if(n)a[i][j+1]=a[i][j-1]=a[i-1][j+1]=a[i-1][j-1]=a[i-2][j]=a[i-2][j-1]=a[i-2][j+1]='#',n--;
	}
	 else {
	 	m--;
	 	FOR(i,1,100)
			FOR(j,1,100)
				a[i][j]='#';
		for(int i=5;i<=95;i+=4)
			for(int j=5;j<=95;j+=4)
				if(n)a[i][j]='.',n--;
		for(int i=5;i<=95;i+=4)
			for(int j=5;j<=95;j+=4)
				if(m)a[i][j+1]=a[i][j-1]=a[i-1][j+1]=a[i-1][j-1]=a[i-2][j]=a[i-2][j-1]=a[i-2][j+1]='.',m--;
	}
	out2(100,100);
	FOR(i,1,100){
		FOR(j,1,100)
			printf("%c",a[i][j]);
		printf("\n");
	}
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define MOD 1000000007
using namespace std;



int main(){
    int N;
    cin >> N;
    double x[N],y[N];

    double ans = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> x[i] >> y[i];
    }

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            ans += sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
        }
    }
    
    ans /= (double)N;
    printf("%.8lf\n",ans);

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

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

	for (int i = 0; i <= 1114514; i++)
	{
		int m = i * 0.08;
		int n = i * 0.1;
		if (m == a && n == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
/*
	* Keep on coding, do not let yourself get distracted
	* Get your self be ready for any situation
	* Never let your self get easy
	* Gmail: nhatminh1803lqd@gmail.com
*/
#include <bits/stdc++.h>

#define bug "bug "
#define ii pair  < int, int >
#define iii pair < int, ii  >
#define iv pair  < ii , ii  >

#define fi first
#define se second

#define FOR(i , x , n)  for(int i = x; i <= n ; ++i)
#define REP(i , n)      for(int i = 0; i <  n ; ++i)
#define FORD(i , x , n) for(int i = x; i >= n ; --i)

#define ll long long
#define int long long

#define fast ios::sync_with_stdio(0);cin.tie(0);
#define eps 1e-9

using namespace std;

const int N = 1e5 + 10;
const int oo = 1e9 + 7;
const int MAXELEMENT = 1e6 + 10;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

int n, k;
int a[N], f[N];

main()
{
	fast;
	srand(time(NULL));
	//freopen ("Frog2.inp", "r", stdin);
	//freopen ("Frog2.out", "w", stdout);

	cin >> n >> k;
	FOR(i, 1, n) {
		cin >> a[i];
	}

	FOR(i, 0, n) {
		f[i] = oo;
	}
	f[1] = 0;
	FOR(i, 2, n) {
		FOR(j, 1, k) {
			if (j <= i) {
				f[i] = min(f[i], f[i - j] + abs(a[i - j] - a[i]));
			}
		}
	}

	/* FOR(i, 1, n) {
		cout << f[i] << " ";
	}
	cout << endl; */

	cout << f[n] << endl;

}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  ll x; std::cin >> x;
  ll ans = x / 500 * 1000;
  x -= (x / 500) * 500;
  ans += x / 5 * 5;
  std::cout << ans << "\n";
}


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

using namespace std;
#define M 110000
int main(){
  int N, a[M], i, j, num=0;
  cin >> N;
  for (i = 0; i < N; i++)
    cin >> a[i];
  for (i = 0; i < N; i++){
    if (a[i]%2)
      num ++;
  }
  if (num%2)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 640
<?php
fscanf(STDIN, '%d', $a);
fscanf(STDIN, '%d', $b);
fscanf(STDIN, '%d', $c);
fscanf(STDIN, '%d', $d);
fscanf(STDIN, '%d', $e);
fscanf(STDIN, '%d', $k);
if ($e - $a > $k) $ans = ':(';
else $ans = 'Yay!';
echo $ans . PHP_EOL;

Measured memory_bytes: 4856
# -*- coding: utf-8 -*-


def main():
    import sys
    input = sys.stdin.readline

    n = int(input())
    a = list(map(int, input().split()))
    q = int(input())
    d = [0 for _ in range(10 ** 5)]
    ans = sum(a)

    for ai in a:
        d[ai - 1] += 1

    for i in range(q):
        bi, ci = map(int, input().split())

        bi_count = d[bi - 1]
        ans += (ci - bi) * bi_count
        print(ans)

        d[ci - 1] += d[bi - 1]
        d[bi - 1] = 0


if __name__ == '__main__':
    main()


Measured memory_bytes: 20260
h,n = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
answer = "No"
for i in 0..n-1 do
  h -= a[i]
  if h<=0 then
    answer = "Yes"
    break
  end
end
print answer

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

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

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;


int main(){
    int N; cin >> N;
    vi B(N-1);
    for(int i=0; i<N-1; i++){
        cin >> B[i];
    }
    ll res=B[0]+B[N-2];
    for(int i=0; i<N-2; i++){
        if(B[i] < B[i+1]){
            res+=B[i];
        }
        else{
            res+=B[i+1];
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3588
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[] count = new int[n];
        for (int i = 0; i < m; i++) {
            count[scanner.nextInt() - 1]++;
            count[scanner.nextInt() - 1]++;
        }
        for (int i : count) {
            System.out.println(i);
        }
    }
}

Measured memory_bytes: 21716
#include <stdio.h>

main(){
  int a,b,i,p,c,d=0;

  while(1){
    scanf("%d %d", &a, &b);
    if(a==0 && b==0) break;

    p=0;
    if(d==1){
      printf("\n");
    }
    for(i=a;i<=b;i++){
      c=0;
      if(i%4==0){
	c=1;
	p=1;
      }
      if(i%100==0){
	p=0;
	c=0;
	if(i%400==0){
	  p=1;
	  c=1;
	}
      }
      if(c==1) printf("%d\n", i);
    }
    if(p==0) printf("NA\n");
    d=1;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#define EPS 1e-8
using namespace std;

typedef complex<double> P;

class ufo{
public:
  P u;
  double r,v;
  ufo(void){}
  ufo(double x,double y, double z,double w){u.real()=x;u.imag()=y;r=z;v=w;}
};

double dot(P a,P b){return a.real()*b.real()+a.imag()*b.imag();}

double cross(P a,P b){return a.real()*b.imag()-a.imag()*b.real();}

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > EPS)return +1;
  if (cross(b, c) < -EPS)return -1;
  if (dot(b, c) < -EPS)return +2;
  return 0;
}

bool cross_l_c(P a,P b,ufo c){
  double dis = abs(cross(b-a,c.u-a))/abs(b-a);
  if(dis>c.r+EPS)return false;
  P n = b*P(0,1) + c.u;
  P u = b/abs(b);
  P cp = a + (b-a)*cross(n-c.u,c.u-a) / cross(n-c.u,b-a);
  double len = sqrt(c.r*c.r-dis*dis);
  P p1 = cp+len*u,p2 = cp-len*u;
  return (!ccw(a,b,p1) || !ccw(a,b,p2));
}

int main(){
  int n;
  double R,x,y,r,v;

  for(;;){
    cin >> R >> n;
    if(!R && !n)break;

    vector<ufo> ob;
    for(int i=0;i<n;i++){
      cin >> x >> y >> r >>v;
      ob.push_back(ufo(x,y,r,v));
    }

    int ans = 0;
    while(ob.size()){
      P m(10000,10000);
      for(int i=0;i<(int)ob.size();i++){
	if(abs(ob[i].u)+EPS<ob[i].v)ob[i].u = P(0.0,0.0);
	else ob[i].u -= ob[i].u*ob[i].v/abs(ob[i].u);
      }

      for(int i=0;i<(int)ob.size();i++){
	if(abs(ob[i].u) < R+EPS){
	  ans++;
	  ob.erase(ob.begin()+i--);
	}else if(abs(ob[i].u)<abs(m)+EPS)m = ob[i].u;
      }

      P l = m*R/abs(m);
      for(int i=0;i<(int)ob.size();i++){
	if(cross_l_c(l,m,ob[i]))ob.erase(ob.begin()+i--);
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
#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;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int a, b, c, d; cin >> a >> b >> c >> d;

  int left = a + b, right = c + d;
  if (left == right) cout << "Balanced\n";
  else if (left < right) cout << "Right\n";
  else cout << "Left\n";
  
  return (0);
}

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

#define ll long long int

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

ll mod=1000000007;
string k;
ll d;

ll dp[10005][105][3];

ll recur(ll ind,ll rem,ll check){
	if(ind==k.size() && rem==0){return 1;}
	if(ind==k.size())return 0;
	if(dp[ind][rem][check]!=-1)return dp[ind][rem][check];
	
	ll ans=0;
	if(check)
	{
		for(ll i=0;i<=9;i++)
		{
			ans=(ans+recur(ind+1,(rem+i)%d,1))%mod;
		}
	}
	else
	{
		for(ll i=0;i<=k[ind]-'0';i++)
		{
			if(i<k[ind]-'0')
				ans=(ans+recur(ind+1,(rem+i)%d,1))%mod;
			else
				ans=(ans+recur(ind+1,(rem+i)%d,0))%mod;
		}
	}
	dp[ind][rem][check]=ans;
	return ans;
}

int main()
{
	fastio();
	cin>>k>>d;
	memset(dp,-1,sizeof(dp));
	ll ans=recur(0,0,0)-1;
	if(ans<0)ans+=mod;
	cout<<ans;
}


Measured memory_bytes: 25856
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1000005;
int n,a[maxn],b[maxn],ans=1e9;
char s[maxn];
inline void work(int x){
	int cnt=0,now=n;
	for (int i=0;i<=n;i++){
		if(s[i]=='?'&&b[i]+cnt+2<=x) cnt+=2;
		now=min(now,cnt+a[i]);
	}
	ans=min(ans,x-now);
}
int main(){
	scanf("%s",s+1);n=strlen(s+1);
	for (int i=1;i<=n;i++) b[i]=a[i]=a[i-1]+(s[i]=='1'?1:-1);
	for (int i=n;i;i--) b[i-1]=max(b[i-1],b[i]);
	work(b[0]),work(b[0]+1);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 10496
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <string>
using namespace std;

void Print(int sx, int sy, int ex, int ey)
{
    int row = ex - sx;
    int col = ey - sy;
    for(int i = 0; i < abs(col); i++)
    {
        if(col>0) printf("U");
        else  printf("D");
    }
    for(int i = 0; i < abs(row); i++)
    {
        if(row>0) printf("R");
        else  printf("L");
    }
}
int main()
{
    int x1, y1, x2, y2;
    while(~scanf("%d %d %d %d", &x1, &y1, &x2, &y2))
    {
        Print(x1, y1, x2, y2);
        Print(x2, y2, x1, y1);
        printf("L");
        Print(x1-1, y1, x2, y2+1);
        printf("DR");
        Print(x2+1,y2, x1, y1-1);
        printf("U\n");
    }
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	set<char> Sc;
	for (int i = 0; i < S.length(); i++) {
		Sc.insert(S[i]);
	}

	if (Sc.size() == S.length()) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}

}






Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#define ios std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI acos(-1.0) //3.14159265358
#define EPS 1e-9 //epsilon, 10^-9, checking for equality 
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define isort(x) sort(x.begin(),x.end())
#define dsort(x) sort(x.rbegin(),x.rend())
const int inf=1e9+7; //10^9 +7
const int modc=998244353;
typedef long long int ll;typedef vector<int> vi;typedef vector<ll> vll;
typedef pair<int,int> ii;typedef map<int,int> mii;
inline void rvi(vi &v, int n){int temp; rep(i,n){cin>>temp;v.pb(temp);}}
inline void rvll(vll &v, int n){ll temp;rep(i,n){cin>>temp;v.pb(temp);}}
inline void prvi(vi &a){rep(i,sz(a)){cout<<a[i]<<" ";}cout<<endl;}
inline void prvll(vll &a){rep(i,sz(a)){cout<<a[i]<<" ";}cout<<endl;}
inline vll prefixsum(vi &a){vll b;b.pb(a[0]);for(int i=1;i<sz(a);i++){b.pb(a[i]+b[i-1]);}return b;}
inline vll suffixsum(vi &a){vll b(sz(a));b[sz(a)-1]=a[sz(a)-1];for(int i=sz(a)-2;i>=0;i--){b[i]=a[i]+b[i+1];}return b;}
inline vll prefixsum(vll &a){vll b;b.pb(a[0]);for(int i=1;i<sz(a);i++){b.pb(a[i]+b[i-1]);}return b;}
inline vll suffixsum(vll &a){vll b(sz(a));b[sz(a)-1]=a[sz(a)-1];for(int i=sz(a)-2;i>=0;i--){b[i]=a[i]+b[i+1];}return b;}
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
void solve();int main(){ios;solve();return 0;}
//--------SOLVE--------------------------------------------------------------------
int dp[102][100005];
void solve()
{
	int n,we;cin>>n>>we;
	vi w(n+1),v(n+1);
	ll sum=0;
	rep(i,n)
	{
		cin>>w[i+1]>>v[i+1];
		sum+=v[i+1];
	}
	for(int i=0;i<=n;i++)
	{
		for(int j=1;j<=sum;j++)
		{
			dp[i][j]=inf;
		}
	}
	for(int i=1;i<=n;i++)
	{
		dp[i][0]=0;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=sum;j++)
		{
			if(j<v[i])
				dp[i][j]=dp[i-1][j];
			else
				dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
		}
	}
	ll ans=-1;
	for(int j=0;j<=sum;j++)
	{
		if(dp[n][j]<=we)
		{
			if(j>ans) ans=j;
		}
	}
	cout<<ans<<endl;

	// for(int i=1;i<=n;i++)
	// {
	// 	for(int j=0;j<=sum;j++)
	// 	{
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
}

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

template <typename T>
struct BinaryIndexedTree {
    vector<T> data;

    BinaryIndexedTree() = default;

    explicit BinaryIndexedTree(size_t sz) : data(sz + 1, 0) {}

    explicit BinaryIndexedTree(const vector<T> &vs) : data(vs.size() + 1, 0) {
        for (size_t i = 0; i < vs.size(); i++) data[i + 1] = vs[i];
        for (size_t i = 1; i < data.size(); i++) {
            size_t j = i + (i & -i);
            if (j < data.size()) data[j] += data[i];
        }
    }

    void add(int k, const T &x) {
        for (++k; k < (int)data.size(); k += k & -k) data[k] += x;
    }

    T query(int k) const {
        T ret = T();
        for (++k; k > 0; k -= k & -k) ret += data[k];
        return ret;
    }

    T query(int l, int r) const { return query(r - 1) - query(l - 1); }

    int lower_bound(T x) const {
        int i = 0;
        for (int k = 1 << (__lg(data.size() - 1) + 1); k > 0; k >>= 1) {
            if (i + k < data.size() && data[i + k] < x) {
                x -= data[i + k];
                i += k;
            }
        }
        return i;
    }

    int upper_bound(T x) const {
        int i = 0;
        for (int k = 1 << (__lg(data.size() - 1) + 1); k > 0; k >>= 1) {
            if (i + k < data.size() && data[i + k] <= x) {
                x -= data[i + k];
                i += k;
            }
        }
        return i;
    }
};

using i64 = int64_t;

int main() {
    int n, q;
    cin >> n >> q;
    vector<i64> a(n);
    for (auto &x : a) cin >> x;
    BinaryIndexedTree<i64> bit(a);
    for (int i = 0; i < q; i++) {
        int t, x, y;
        cin >> t >> x >> y;
        if (t == 0)
            bit.add(x, y);
        else
            cout << bit.query(x, y) << '\n';
    }
}

Measured memory_bytes: 12132
# -*- coding: utf-8 -*-
def watering(h, hk):
    count = 0
    need_water_pre_flower = False
    for i in h:
        need_water = i >= hk
        count += 1 if need_water and not need_water_pre_flower else 0
        need_water_pre_flower = need_water

    return count

_ = input()
h = list(map(int, input().split()))

max_h = max(h)
count_watering = 0
for i in range(1, max_h + 1):
    count_watering += watering(h, i)

print(count_watering)


Measured memory_bytes: 3060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
using ld = long double;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
template<typename T1, typename T2> ll ceill(T1 a, T2 b){ return (a+b-1)/b; }
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) for (auto vvv : vv) cout << vvv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class CSqrtInequality {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ld a, b, c;
	    in >> a >> b >> c;

	    ld rab=sqrt(a*b);
	    //cout << ra sp rb sp rc << endl;
	    ans(c-a-b-2*rab > 0.0, out);
	}
};


int main() {
	CSqrtInequality solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let A: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let ans = 1.0 / A.iter().map(|&a| 1.0 / (a as f64)).sum::<f64>();

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
        double q1,h1,s1,d1;
        long long n,q,h,s,d,ans=0;
        cin>> q >> h >> s >> d >> n;
        q1= q*4.0; h1= h*2.0; d1= (d*1.0)/2.0,s1=s;
        if(d1<=q1 && d1<=s1 && d1<=h1){
                ans += (n/2)*d;
                n= n%2;
        }
        if(s<=h1 && s<=q1){
                ans += n*s;
                n=0;
        }
        if(h1<=q1){
                ans+= n*h*2;
                n=0;
        }
        ans+= n*q*4;
        cout << ans << endl;
}


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

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define int long long

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

// const int kMaxN = 100002;

int A, B;
string grid[100];

int x, y;

signed main() {
  cin >> A >> B;

  REP(i, 50) { REP(j, 100) { grid[i].push_back('#'); } }
  REP(i, 50) { REP(j, 100) { grid[i+50].push_back('.'); } }
  --A; --B;

  x = 0; y = 0;
  while (A--) {
    grid[x][y] = '.';
    y += 2;
    if (y >= 100) { x += 2; y = 0; }
  }
  x = 51; y = 0;
  while (B--) {
    grid[x][y] = '#';
    y += 2;
    if (y >= 100) { x += 2; y = 0; }
  }

  cout << "100 100" << endl;
  REP(i, 100) { cout << grid[i] << endl; }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,v,sum=0,cnt;
    
    while (scanf("%d %d",&n,&v)!=EOF) {
    cnt=0;
    sum = n+v;
        while (0!=sum) {
            sum=sum/10;
            cnt++;
        }
        printf("%d\n",cnt);
    }
    return 0;
}


Measured memory_bytes: 2060
#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define int long long
#define hh puts("")
using namespace std;
int x,y;
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-ff;ch=getchar();}
    while(isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch^48);ch=getchar();}
    return ret*ff;
}
signed main(){
	x=read(),y=read();
	if(x<=5){
		printf("0");
	}
	else if(x>=6&&x<=12){
		printf("%d",y/2);
	}
	else printf("%d",y);
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()

def isok(na , index , key):
    if na[index] >= key:
        return True
    else:
        return False
    
def bs(nar,key):
    left = -1
    right = len(nar)
    
    while (right - left) > 1:
        mid = left + (right - left) // 2
        
        if isok(nar , mid , key):
            right = mid
        else:
            left = mid
            
    return right

ans = 0
for i in b:
    q = bs(a,i)
    r = bs(c,i+1)
    
    ans += q*(n-r)
print(ans)

Measured memory_bytes: 105444
N = int(input())
F = [100000000000, 1]

for a in range(1, int(N ** 0.5) + 1):
    if N % a == 0:
        b = int(N / a)
        f = [a, b]
        if max(len(str(f[0])), len(str(f[1]))) < max(len(str(F[0])), len(str(F[1]))):
            F = f

print(max(len(str(F[0])), len(str(F[1]))))

Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.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 (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using namespace std;
const ll INF = 100100100100100;

int main(){
    // 入力
    ll n; cin >> n;
    vector<ll> x(n), y(n), p(n), ans(n+1,INF);
    rep(i,n) cin >> x[i] >> y[i] >> p[i];
    // 前処理
    vector<vector<ll>> prex(1<<n,vector<ll>(n)), prey(1<<n,vector<ll>(n));
    rep(i,1<<n){
        rep(j,n) { prex[i][j] = abs(x[j]); prey[i][j] = abs(y[j]); }
        rep(j,n) if(i & 1<<j) rep(k,n) { chmin(prex[i][k],abs(x[k]-x[j])); chmin(prey[i][k],abs(y[k]-y[j])); }
    }
    // 本処理
    ll count = 1; rep(i,n) count *= 3;
    rep(i,count){
        ll xnum = 0, ynum = 0;
        ll num = 1, bit = n, save = i, save2;
        rep(j,n){
          save2 = save % 3; save /= 3;
            if(save2 == 0) bit--;
            else if(save2 == 1) xnum += num;
            else if(save2 == 2) ynum += num;
            num *= 2;
        }
        ll change = 0; rep(j,n) change += min(prex[xnum][j],prey[ynum][j]) * p[j];
        chmin(ans[bit],change);
    }
    rep(i,n+1) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 12992
N = int(input())
S = input()
L = int(N) // 2
G  = 0
if N % 2 == 0:
        for i in range(L):
            if S[i] == S[L+i]:
                G += 1
            else:
                print("No")
                break
            if G == L:
                print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

	a := nextInt()
	b := nextInt()

	if a <= b * 2 {
		fmt.Println(0)
		return
	}

	fmt.Println(a - b*2)
}

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

int main( int argc, char *argv[] )
{
int iA;
int iB;
int iC;
char A[ 110 ];
char B[ 110 ];
char C[ 110 ];
char X;
char cPre;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	iA = 0;
	iB = 0;
	iC = 0;

	cin >> A;
	cin >> B;
	cin >> C;

	cPre = 'A';
	X = A[ iA ];
	iA++;
	while( X != '\0' )
	{
		switch( X )
		{
		case 'a':
			cPre = 'A';
			X = A[ iA ];
			iA++;

			break;
		case 'b':
			cPre = 'B';
			X = B[ iB ];
			iB++;

			break;
		case 'c':
			cPre = 'C';
			X = C[ iC ];
			iC++;

			break;
		}
	}

	cout << cPre << endl;

	return 0;
}



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


int A[105];
int B[105];

int main()
{
    int n;
    cin>>n;
    for(int i=1;i<n;i++)
        cin>>B[i];

    A[n]=B[n-1];
    for(int i=n-1;i>=1;i--){
        A[i]=min(B[i],B[i-1]);
    }
    int sum=0;
    A[1]=B[1];
    for(int i=0;i<=n;i++)
    sum+=A[i];

    cout<<sum;


}

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

#define MOD (1.0e9 + 7)

using namespace std;

int main(void)
{
    int n;
    vector<int> p;

    cin>>n;
    for(int i = 0;i < n;i++)
    {
	int temp;
	cin>>temp;
	p.push_back(temp);
    }

    int counter = 0;
    if(p[n-1] == n)
    {
	int temp = p[n-1];
	p[n - 1] = p[n - 2];
	p[n - 2] = temp;
	counter++;

    }
    for(int i = 0;i < n-1;i++)
    {
	int index = i+1;

	if(p[i] == index)
	{
	    counter++;
	    int temp = p[i];
	    p[i] = p[i+1];
	    p[i+1] = temp;
	}
    }

    cout<<counter<<endl;

    return 0;
}



Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
int main()
{
  char str[4];
  cin>>str;
  if(strcmp(str,"AAA")==0 || strcmp(str,"BBB")==0)
  {
    cout<<"No\n";
  }
  else
   	cout<<"Yes\n";
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
   char a[100000];
   int i;
   int x=0,y=0;
   
    scanf("%s", a);
    i=0;
     while(a[i]!='\0'){
         if(i%2==0){
           if(a[i]=='0')
             x++;
            if(a[i]=='1')
              y++;
         }
         if(i%2==1){
            if(a[i]=='1')
            x++;
           if(a[i]=='0')
             y++;
         }
       i++;
       }  
       if(x>y)
          printf("%d",y);
      else
          printf("%d",x);
      
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

ll int power(ll int x, ll int y, ll int p)  
{  
   ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
int n,m;
bool isval(int x,int y)
{
  if(x<0||x>n-1||y<0||y>m-1)
    return false;
  return true;
}

int main()
{
  fastio();
ll int T;
T=1;


while(T--)
{
string s,t;
cin>>s>>t;
if(t.substr(0,s.size())==s)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
    return 0;
}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();

		@SuppressWarnings("unused")
		String temp = "";

		str = str.replaceAll("apple", "temp");
		str = str.replaceAll("peach", "apple");
		str = str.replaceAll("temp", "peach");

		System.out.println(str);
	}

}

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

#define FIO ios_base::sync_with_stdio(0); cin.tie(0);
#define T() int tt; cin >> tt; rep1(qq,1,tt)
#define rep(i,start,lim) for(int i=start;i<lim;i++)
#define rep1(i,start,lim) for(int i=start; i<=lim; ++i)
#define repd(i,start,lim) for(int i=start;i>=lim;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define br cout<<"\n"
#define MOD (1000000007LL)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define eps (1e-6)
#define what_is(x) cerr << #x << " is " << x << "\n";
#define int long long int
#define infll 9e18
#define inf 1e12

#define lnode (2 * node + 1)
#define rnode (2 * node + 2)

using namespace std;

typedef pair<int, int> pii;

const int N = 3 * 1e6 + 2;

int n, k;
int a[N];

int32_t main(){

  FIO
  //cout << fixed << setprecision(10);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  cin >> n >> k;
  rep1(i,1,n) cin >> a[i];
  vector<int> vis(n + 1, 0);
  int i = 1;
  vector<int> walk;
  while(!vis[i]){
    vis[i] = 1;
    walk.pb(i);
    i = a[i];
  }
  // cycle starts at i
  int m = walk.size();
  if(k < m) return cout << walk[k % m] << '\n', 0;
  k -= m;
  vector<int> cycle;
  while(vis[i] != 2){
    vis[i] = 2;
    cycle.pb(i);
    i = a[i];
  }
  int z = cycle.size();
  cout << cycle[k % z];
  


	return 0;
}


Measured memory_bytes: 10708
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    int dx = tx - sx;
    int dy = ty - sy;
    REP(i,0,dx) cout << 'R';
    REP(i,0,dy) cout << 'U';
    REP(i,0,dx) cout << 'L';
    REP(i,0,dy) cout << 'D';
    cout << 'D';
    REP(i,0,dx+1) cout << 'R';
    REP(i,0,dy+1) cout << 'U';
    cout << 'L';
    cout << 'U';
    REP(i,0,dx+1) cout << 'L';
    REP(i,0,dy+1) cout << 'D';
    cout << 'R';
}

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

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if a[i] + a[i+1] >= b[i]:
        if a[i] >= b[i]:
            cnt += b[i]
        else:
            a[i+1] = a[i] + a[i+1] - b[i]
            cnt += b[i]
    else:
        cnt += a[i] + a[i+1]
        a[i+1] = a[i] = 0
print(cnt)

Measured memory_bytes: 18624
def insertion_sort(a, n, g, cnt)
  g.upto(n-1) do |i|
    v = a[i]
    j = i - g
    while j >= 0 && a[j] > v do
      a[j+g] = a[j]
      j = j - g
      cnt += 1
    end

    a[j+g] = v
  end

  return a, cnt
end

def shell_sort(a, n)
  g = [1]
  h = 1

  while true do
    break if (h * 3 + 1) > n

    h = h * 3 + 1
    g << h
  end

  m = g.size

  out_a = []
  cnt = 0

  g.reverse!
  m.times do |i|
    out_a, cnt = insertion_sort(a, n, g[i], cnt)
  end

  puts m
  puts g.join(' ')
  puts cnt
  out_a.each { |oa| puts oa }
end

n = gets.to_i
a = (0..n-1).map { |i| gets.to_i }

shell_sort(a, n)


Measured memory_bytes: 14812
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main(){

	int n,count = 0;
	cin >> n;
	while( count*count <= n ){
		count++;
	}
	count--;
	cout << count*count <<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(string, s, t);
    ll ans = 10000;
    for(int i = 0; i <= s.size() - t.size(); i ++){
        ll a = 0;
        For(j, t.size()){
            if(s[i+j] != t[j]) a ++;
        }
        Mini(ans, a);
    }
    Cout(ans);
}


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

int main(){
   long long S;
   const long long mod=1000000007;
   cin>>S;
   long long dp[S+10];
   for(int i=0;i<S+10;i++){
       dp[i]=0;
   }
   dp[0]=1;
   for(int i=0;i<S;i++){
       for(int k=3;k<=S-i;k++){
           dp[i+k]+=dp[i]%mod;
       }
   }
   cout<<dp[S]%mod<<endl;
}

Measured memory_bytes: 3584
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[i]+L[k]>L[j] and L[i] != L[j] and L[j] != L[k] and L[i] != L[k]:
                ans += 1

print(ans)

Measured memory_bytes: 9212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll a[2005];
void pre(){
    a[0]=a[1]=a[2]=1;
    for(int i=3;i<=2000;i++) a[i]=(a[i-3]+a[i-1])%mod;
}
int main()
{
    pre();
    int n;
    cin>>n;
    if(n<3) cout<<0;
    else cout<<a[n-3];
    return 0;
}


Measured memory_bytes: 3604