akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define int         ll int
#define float       double
#define	endl		'\n'
#define mii         map<int,int>
#define msi         map<string,int>
#define mis         map< int, string>
#define mpi         map<pair< int, int>, int>
#define pii         pair< int, int>
#define vi          vector< int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;

#define N  100005
signed main()
{
	fast;
    int n;
    cin>>n;
    int arr[n-1];
    int i,j,k;
    map <int,int> m;
    for(i=0;i<=n-2;i++)
    {
    	cin>>arr[i];
    	m[arr[i]]++;
	}
	int next=1;
	cout<<m[next++]<<endl;
	for(i=0;i<=n-2;i++)
	{
		cout<<m[next++]<<endl;
	}
	
}

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

#define vc vector
#define pb push_back
#define pf push_front
#define pr pair
#define mp make_pair
#define fi first
#define se second
#define uset unordered_set
#define umap unordered_map
#define str string
#define pq priority_queue
#define forn(i, a, b) for(int i = (a); i < (b); i++)
#define forr(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a) forn(i, 0, a)
#define all(x) x.begin(), x.end()
#define rev(x) x.rbegin(), x.end()
#define len(x) (int)x.size()
#define last(x) x[len(x)-1]
#define forall(i, x) for(auto &i : x)
#define endl '\n'

#define int long long
#define pii pr<int, int>
#define vi vc<int>

const int MAX = 5E5+5;

int t[MAX][26], n;

int sum(int r, int c){
	int result = 0;
	for (; r >= 0; r = (r & (r+1)) - 1)
		result += t[r][c];
	return result;
}

void inc(int i, int delta, int c){
	for (; i < n; i = (i | (i+1)))
		t[i][c] += delta;
}

int sum(int l, int r, int c){
	return sum(r, c) - sum(l-1, c);
}

inline void fastio(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

signed main()
{
    fastio();
    int q; cin >> n;
    rep(i, n) rep(j, 26) t[i][j] = 0;
    str s; cin >> s;
    rep(i, n){
        char c = s[i];
        inc(i, 1, c-'a');
    }
    cin >> q;
    rep(i, q){
        int a; cin >> a;
        if(a == 1){
            int b; char c; cin >> b >> c;
            if(s[--b] == c) continue;
            inc(b, -1, s[b]-'a');
            inc(b, 1, c-'a');
            s[b] = c;
        }else{
            int b, c, ans=0; cin >> b >> c;
            rep(j, 26){
                int v = sum(b-1, c-1, j);
                if(v) ans++;
            }
            cout << ans << endl;
        }
    }
}


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

int ds = 6;

void dprint( int a[] ){
	for( int i = 0; i < ds; i++ ) {
		cout << a[i] << ":";
	}
	cout << endl;

	return; 
}

void dsort( int a[], int i0, int i1, int i2, int i3 ) {
	int ta[] = { a[i0], a[i1], a[i2], a[i3] };
	int min = ta[0];
	for( int i = 0; i < 4; i++ ) {
		if( min > ta[i] ) {
			min = ta[i];
		}
	}

	int t = 0;
	while( true ) {
		if( a[i0] == min ) {
			break;
		}
		t = a[i0];a[i0]=a[i1];a[i1]=a[i2];a[i2]=a[i3];a[i3]=t;
	}

	return;
}

bool dcomp( int a[], int b[] )
{
	for( int i = 0; i < ds; i++ ) {
		if( a[i] != b[i] ) {
			return false;
		}
	}

	return true;
}

bool drollcomp( int a[], int b[], int i0, int i1, int i2, int i3 )
{
	bool ret = false;
	int t = 0;
	for( int i = 0; i < 4; i++ ) {
		t = b[i0];b[i0]=b[i1];b[i1]=b[i2];b[i2]=b[i3];b[i3]=t;
		ret = dcomp( a, b );
		if( ret == true ) {
			break;
		}
	}
	return ret;
}

bool dcheck( int a[], int b[] ) {
	bool ret = false;

	ret = dcomp( a, b );
	if( ret == true ) {
		return ret;
	}
	return ret;

	ret = drollcomp( a, b, 0, 1, 5, 4 );
	if( ret == true ) {
		return ret;
	}

	ret = drollcomp( a, b, 0, 3, 5, 2 );
	if( ret == true ) {
		return ret;
	}

	ret = drollcomp( a, b, 1, 2, 4, 3 );
	if( ret == true ) {
		return ret;
	}

	return ret;
}

int main()
{
	int n, dx[ds], dbuff[100][ds];
	bool ret = false;

	cin >> n;

	for( int i = 0; i < n; i++ ) {
		for( int j = 0; j < ds; j++ ) {
			cin >> dx[j];
		}
		dsort( dx, 0, 1, 5, 4 );
		dsort( dx, 0, 3, 5, 2 );
		dsort( dx, 1, 2, 4, 3 );

		for( int j = 0; j < i; j++ ) {
			ret = dcheck( dx, dbuff[j] );
			if( ret == true ) {
				break;
			}
		}
		if( ret == true ) {
			break;
		}

		for( int j = 0; j < ds; j++ ) {
			dbuff[i][j] = dx[j];
		}
	}

	cout << ( ret?"No":"Yes" ) << endl;

	return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
typedef long long ll;
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ld long double
#define ss second
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define PI 3.1415926535897932384626
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)

const int mod = 1'000'000'007;

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}


	
int main()
{
		fastio;
		ll t = 1;
		//cin >> t;
		rep(tt,1,t+1)
		{
			ll n;
			cin >> n;
			vector<vector<long double>> dp(n+1, vector<long double> (n+1));
			vector<ld> A(n);
			rep(i, 0, n)
			{
					cin >>A[i];
			}
			dp[0][0] = 1;
			rep(i, 1, n+1)
			{
				rep(j, 0, n+1)
				{
					if(i-1 >= 0 && j-1 >=0)
					dp[i][j] += dp[i-1][j-1]*A[i-1];
					if(i-1 >= 0)
					dp[i][j] += dp[i-1][j]*(1-A[i-1]);
				}
			}
			ld ans = 0;
			rep(i, n/2+1, n+1)
			{
				ans+= dp[n][i];
			}
			cout << setprecision(9) << ans << endl;
		}
		return 0;
	}
				


Measured memory_bytes: 144492
import math
N,H=map(int,input().split())
Katana=[[int(i) for i in input().split()] for i in range(N)]
a_max=max(list(zip(*Katana))[0])
B=list(list(zip(*Katana))[1])
B.sort(key=lambda x:(-1)*x)
n=N
for i in range(N):
  if B[i]<=a_max:
    n=i
    break
del B[n:N]
m=0
for b in B:
  if H>0:
    H-=b
    m+=1
if H>0:
  m+=math.ceil(H/a_max)
print(m)


Measured memory_bytes: 29852
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
const int dr[] = {+1, -1, +0, +0, +1, -1, +1, -1};
const int dc[] = {+0, +0, +1, -1, +1, -1, -1, +1};
const int kx[] = {+1, +2, -1, -2, +1, +2, -1, -2};
const int ky[] = {+2, +1, +2, +1, -2, -1, -2, -1};
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#else
#define debug(...) 47
#endif
const ll MAXN=5050;

int main(){
  fastIO();
  int n,ans=0;
  double d;
  cin>>n>>d;
  for(int i=0;i<n;i++){
    double x,y;
    cin>>x>>y;
    if(sqrt(pow(x,2)+pow(y,2))<=d)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3828
#include <stdio.h>

int main()
{
	int a[101] = {0};
	int n, m, x;
	scanf("%d%d%d", &n, &m, &x);
	int b[100];
	for (int i = 0; i < m; i++) scanf("%d", &b[i]);
	for (int i = 0; i < m; i++) a[b[i]] = 1;
	int l = 0, r = 0;
	for (int i = 0; i < x; i++) if (a[i] == 1) l++;
	for (int i = x; i < n; i++) if (a[i] == 1) r++;
	if (l < r) printf("%d\n", l); else printf("%d\n", r);
}

Measured memory_bytes: 128
#include<stdio.h>

int main(void)
{
  int n;
  char s[110];
  scanf("%d%s",&n,s);

  int i,j,a,b,ans=0,cnt;
  char c;
  for(i=1;i<n;i++){
    cnt=0;
    for(c='a';c<='z';c++){
      a = 0;  b = 0;
      for(j=0;j<i;j++){
        if(s[j]==c)
          a = 1;
      }
      for(j=i;j<n;j++){
        if(s[j]==c)
          b = 1;
      }
      if((a==1)&&(b==1))
        cnt++;
    }
    if(ans<cnt)
      ans = cnt;
  }

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

Measured memory_bytes: 1728
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h> 
int main() {
	int n, i;
	
	scanf("%d", &n);
	getchar();
	for(i = 0; i < n; i++) {
		int len[3] = {0};
		char buf[101], fir[101], sec[101], sum[101] = {0}, *p, *pFir = fir, *pSec = sec, *pSum = sum;
		fgets(buf,sizeof(buf),stdin); p = buf;
		while(isspace(*p) || *p == 48) p++;
		while(isdigit(*p)) *pFir++ = *p++, len[0]++;
		*pFir = 0;
		
		fgets(buf,sizeof(buf),stdin); p = buf;
		while(isspace(*p) || *p == 48) p++;
		while(isdigit(*p)) *pSec++ = *p++, len[1]++;
		*pSec = 0;
		
		if(len[0] > 80 || len[1] > 80) printf("overflow\n");
		else {
			if(len[0] == 0 && len[1] == 0) printf("0\n");
			else {
				int s, ca = 0;
				pFir = fir + len[0] - 1;
				pSec = sec + len[1] - 1;
				while(len[0] > 0 || len[1] > 0) {
					s = ca;
					if(len[0]-- > 0) s += *pFir-- - 48;
					if(len[1]-- > 0) s += *pSec-- - 48;
					if(s > 9) s -= 10, ca = 1;
					else ca = 0;
					*pSum++ = s + 48, len[2]++;
				}
				if(ca > 0) *pSum++ = ca + 48, len[2]++;
				*pSum = 0;
				if(len[2] > 80) printf("overflow");
				else while(len[2]-- > 0) putchar(*--pSum);
				printf("\n");
			}
		}
	}
	return 0;
}


Measured memory_bytes: 2036
#include <stdio.h>
#include <string.h>
int n, a, b; bool dp[1000001];
int main() {
	while (true) {
		scanf("%d%d%d", &n, &a, &b);
		if (n == 0 && a == 0 && b == 0) break;
		memset(dp, false, sizeof(dp));
		dp[0] = true;
		for (int i = 1; i <= n; i++) {
			if (i - a >= 0) dp[i] |= dp[i - a];
			if (i - b >= 0) dp[i] |= dp[i - b];
		}
		int ret = 0;
		for (int i = 1; i <= n; i++) {
			if (!dp[i]) ret++;
		}
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

template<class T> ll llpow(T x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    ll ans=0;
    ans+=2*min(b,c);
    int t=min(b,c);
    b-=t;
    c-=t;
    if(b>0)ans+=b;
    if(c>0){
        ans+=min(a,c);
        t=min(a,c);
        a-=t; c-=t;
        if(c>0)ans++;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
using System;
using System.Collections;

namespace _2198
{
	class Program
	{
		public class Comparer : IComparer
		{
			public int Compare(object x, object y)
			{
				Tuple<string, double> t1 = (Tuple<string, double>)x;
				Tuple<string, double> t2 = (Tuple<string, double>)y;
				if (t1.Item2 < t2.Item2) return 1;
				if (t1.Item2 > t2.Item2) return -1;
				return t1.Item1.CompareTo(t2.Item1);
			}
		}
		static void Main(string[] args)
		{
			while (true)
			{
				int n = int.Parse(Console.ReadLine());
				if (n == 0) break;
				Tuple<string, double>[] tuples = new Tuple<string, double>[n];
				for (int i = 0; i < n; i++)
				{
					string[] s = Console.ReadLine().Split();
					tuples[i] = new Tuple<string, double>(s[0], 0);
					double[] d = new double[9];
					for (int j = 1; j < 10; j++) d[j - 1] = double.Parse(s[j]);
					double time = d[1] + d[2] + d[3] + (d[4] + d[5]) * d[8];
					double price = d[6] * d[7] * d[8] - d[0];
					tuples[i] = new Tuple<string, double>(tuples[i].Item1, price / time);
				}
				IComparer Comp = new Comparer();
				Array.Sort(tuples, Comp);
				foreach (var tuple in tuples) Console.WriteLine(tuple.Item1);
				Console.WriteLine("#");
			}
		}
	}
}


Measured memory_bytes: 16756
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
using namespace std;

const long long INF = 100100100100100100;
const int MOD = 1000000007;
const int inf = 1001001001;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



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

    int N;cin >> N;
    vector<long long> retu(N);
    for(int i = 0;i<N;i++){
        cin >> retu.at(i);
    }
    long long ans = 0;
    for(int i = 0;i<N-1;i++){
        ans += retu.at(i)/2;
        retu.at(i) %= 2;
        if(retu.at(i) == 1 && retu.at(i+1) >= 1){
            ans++;
            retu.at(i+1)--;
        }
    }
    ans += retu.at(N-1)/2;
    cout << ans << endl;
}


Measured memory_bytes: 3992
#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

int N, M;

vector<int> dist;

void dfs(Graph& _G, int _v, int _cd, int& _counter){
  dist[_v] = _cd;
  bool is_all_checked = true;
  for(auto nv: _G[_v]){
    if(dist[nv]!=-1)continue;
    dfs(_G, nv, _cd+1, _counter);
    is_all_checked = false;
  }
  if(is_all_checked){
    if(dist[_v] == N-1) _counter+=1;
  }
  dist[_v] = -1;
}

int main(){

  cin >> N >> M;
  Graph G(N);
  for(int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  dist.assign(N, -1);

  int counter;
  counter=0;

  dfs(G, 0, 0, counter);

  cout << counter << endl;

  return 0;
}


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

const unsigned N = 100;
const unsigned K = 3;

int main()
{
  std::array<unsigned, N> a;
  a.fill(0);
  
  for(unsigned k=0; k<K; ++k)
  {
    unsigned x;
    std::cin >> x;
    ++a[x - 1];
  }
  
  unsigned c = 0;
  for(unsigned n=0; n<N; ++n)
  {
    if(a[n] > 0) ++c;
  }
  std::cout << c << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
bool cmp(const pii a, const pii b) {
    return a.S < b.S;
}
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin >> n;
    vector<pii> segments;
    forn(i, n) {
        int x, l;
        cin >> x >> l;
        segments.pb({x - l, x + l});
    }
    sort(all(segments), cmp);
    int ans = 1;
    pii cur = segments[0];
    for (int i = 1; i < n; i++) {
        if (segments[i].F >= cur.S) ans++, cur = segments[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vvi vector<vector<int> >
#define vb vector<bool>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define pii pair<int,int>
#define mii map<int,int>
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mkp make_pair
#define all(v) v.begin(),v.end()
#define input(a,b,n) for(i=b;i<n;i++){cin>>a[i];}
#define print(a) for(i=0;i<a.size();i++){cout<<a[i]<<" ";}cout<<endl;
#define trace1(a); cout<<"a="<<a<<endl;
#define trace2(a,b); cout<<"a="<<a<<" b="<<b<<endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int inf=0x3f3f3f3f3f3f3f3f;
int power(int a, int b){
    int res = 1;
    while(b!=0){
        if(b&1){
            res *= a; 
        }
        a = (a * a);
        b = (b / 2);
    }
    return res;
}
int32_t main()
{
	fast;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
    	string s,t;
      cin>>s>>t;
      int n=s.size();
      //int m=t.size();
      int i;
      int flag=1;
      for(i=0;i<n;i++)
      {
        if(s[i]!=t[i])
          flag=0;
	}
      if(flag==1)cout<<"Yes"<<endl;
      else
      {
        cout<<"No"<<endl;
      }
      }
    return 0;
}


Measured memory_bytes: 3620
a, b, c, k = map(int, input().split())

import sys

ans = 0

if k >= a:
    ans += (1*a)
    k -= a
else:
    ans += (1*k)
    print(ans)
    sys.exit()

if k >= b:
    k -= b
else:
    print(ans)
    sys.exit()

if k ==  c:
    ans += ((-1)*c)
else:
    ans += ((-1)*k)

print(ans)
    

Measured memory_bytes: 9160
c = [list(map(int,input().split())) for i in range(3)]

for a0 in range(0,100+1):
	b0 = c[0][0]-a0
	b1 = c[0][1]-a0
	b2 = c[0][2]-a0
	a1 = c[1][0]-b0
	a2 = c[2][0]-b0

if c[1][1] == a1+b1 and c[1][2] == a1+b2 and c[2][1] == a2+b1 and c[2][2] == a2+b2:
	print("Yes")
else:
	print("No")


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

int main(){
	string s;
	cin>>s;
	ll res=0;
	//010101...
	for(int i=0;i<s.length();i++){
		if(i%2==0){
			if(s[i]=='1')res++;
		}else{
			if(s[i]=='0')res++;
		}
	}
	//cout<<res<<endl;
	ll tmp=0;
	for(int i=0;i<s.length();i++){
		if(i%2==0){
			if(s[i]=='0')tmp++;
		}else{
			if(s[i]=='1')tmp++;
		}
	}
	//cout<<tmp<<endl;
	res = min(res,tmp);
	cout<<res<<endl;
}


Measured memory_bytes: 512
use std::collections::HashSet;
use std::io::*;
use std::str::*;

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

fn string() -> String {
    read()
}

fn main() {
    let cs: HashSet<char> = string().chars().collect();

    let mut uniq: Vec<char> = cs.into_iter().collect();
    uniq.sort();
    if uniq == vec!['E', 'N', 'S', 'W']
        || uniq == vec!['E', 'W'] || uniq == vec!['N', 'S'] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

int main() {
    int n, N[10000];
    int q, Q[500];
    int count = 0;

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

    cin >> q;
    for (int j = 0; j< q; j++) {
        cin >> Q[j];
    }

    for (int j = 0; j < q; j++) {
        for (int i = 0; i < n; i++) {
            for (int k = 0; k < i; k++) {
                if (N[k] == N[i]) goto SAME;
            }
            if (Q[j] == N[i]) count++;
            SAME:;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  char c;std::cin >> c;
  set<ll> s;
  if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
    std::cout << "vowel" << '\n';
  }else std::cout << "consonant" << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;


int main(){
   int x,y;
   cin>>x>>y;
   string ans;
   if(x!=4 && x!=6 && x!=9 && x!=11 && y!=2 && y!=4 && y!=6 && y!=9 && y!=11 && y!=2)ans="Yes";
   else if(x==2 && y==2)ans="Yes";
   else if((x==4 || x==6 || x==9 || x==11) && (y==4 || y==6 || y==9 || y==11))ans="Yes";
   else ans="No";
   cout<<ans<<endl;
}

   


Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

int main(void) {
    int N;
    ll Y;
    cin >> N >> Y;
    for (int i=0;i<=N;i++) for (int j=0;j<=N-i;j++) {
        int k = N-i-j;
        if (Y == 10000*i + 5000*j + 1000*k) {
            cout << i << " " << j << " " << k << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;

    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
int main(void)
{
    int n;
    cin>>n;
    int ans =0;
    vector<int> l(n+3);

    rep(i,n)
    {
        cin>>l[i];
    }

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<i;j++)
        {
            for(int k=0;k<j;k++)
            {
                if(l[i]<l[j]+l[k] && l[j]<l[i]+l[k])
                {
                    if(l[k]<l[i]+l[j])
                    {
                        if(l[i]!=l[j]&&l[j]!=l[k]) if(l[k]!=l[i]) ans ++;
                    }  
                }

            }
        }
        
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3196
#include <stdio.h> 
int main(){
 int b,n,d,i,j,a[200],s=0;
 scanf("%d",&n);
 for(i=1;i<=n;i++){
   scanf("%d",&a[i]); 
}
for(i=1;i<=n;i++){
for(j=n;j>i;j--){
 if(a[j]>a[j-1]){
 	d=a[j-1];
 	a[j-1]=a[j];
 	a[j]=d;
 }
}
}
for(i=1;i<=n;i++){
	if(i%2)s+=a[i];
	else s-=a[i];
}
printf("%d",s);
	return 0;
	
}

Measured memory_bytes: 128
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register ll i=(ll)(j);i<=(ll)(k);i++)
#define rrep(i,j,k) for(register ll i=(ll)(j);i>=(ll)(k);i--)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const ll maxn=100100;
int n;
ll a[maxn];
bool isp[maxn];
int pr[maxn],cnt;
int num[maxn][500];
set<ll> s;
map<ll,int> M;
map<ll,int> ind;
map<ll,int> used;

void init(){
	memset(isp,1,sizeof(isp));
	isp[0]=isp[1]=0;
	rep(i,2,3000){
		if(isp[i]){
			pr[++cnt]=i;
		}
		for(ll j=1;j<=cnt && i*pr[j]<=3000;j++){
			isp[i*pr[j]]=0;
			if(i%pr[j]==0) break;
		}
	}
}

bool pd(ll x){
	for(ll i=2;i*i<=x;i++){
		if(x%i==0) return 0;
	}
	return 1;
}

int main(){
#ifdef LZT
	//freopen("in","r",stdin);
#endif
	ll ans=0;
	n=read();
	rep(i,1,n) a[i]=read();
	init();
	rep(i,1,n){
		ll t=a[i];
		rep(j,1,cnt){
			while(t%pr[j]==0){
				t=t/pr[j];
				num[i][j]++;
			}
			num[i][j]%=3;
		}
		if(t>pr[cnt]){
			ll nw=sqrt(t);
			if(nw*nw==t){
				num[i][cnt+1]=nw;
				num[i][cnt+2]=2;
				t=1;
			}
			else{
				if(t<=100000 && pd(t)){
					num[i][cnt+1]=t;
					num[i][cnt+2]=1;
					t=1;
				}
			}
		}
		ll tt=1;
		rep(j,1,cnt){
			if(num[i][j]==1) tt=tt*pr[j];
			else if(num[i][j]==2) tt=tt*pr[j]*pr[j];
		}
		if(num[i][cnt+1]){
			tt=tt*num[i][cnt+1];
			if(num[i][cnt+2]==2) tt=tt*num[i][cnt+1];
		}
		if(t==1){
			s.insert(tt);
			M[tt]++;
			ind[tt]=i;
		}
		else ans++;
	//	cout<<a[i]<<':'<<' '<<tt<<' '<<t<<endl;
	//	for(ll j=1;j<=cnt;j++){
	//		if(num[i][j]) cout<<pr[j]<<' '<<num[i][j]<<endl;
	//	}
	//	if(num[i][cnt+1]) cout<<num[i][cnt+1]<<' '<<num[i][cnt+2]<<endl;
	}
	for(set<ll>::iterator it=s.begin();it!=s.end();it++){
		ll nw=*it;
		if(used[nw]) continue;
		used[nw]=1;
		ll i=ind[nw];
		ll t=1;
		for(ll j=1;j<=cnt;j++){
			if(num[i][j]==1) t=t*pr[j]*pr[j];
			else if(num[i][j]==2) t=t*pr[j];
		}
		if(num[i][cnt+1]){
			if(num[i][cnt+2]==1) t=t*num[i][cnt+1]*num[i][cnt+1];
			else t=t*num[i][cnt+1];
		}
	//	cout<<nw<<' '<<t<<endl;
		if(nw==t) ans++;
		else ans+=max(M[nw],M[t]);
		used[t]=1;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 226688
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())

using namespace std;

#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
typedef vector<ll> vecll;
const ll inf =1000000007;

void asolve(){
    string s,t;
    cin >> s >>t;
    bool can=true;

    for(ll i=0;i<s.size();i++){
        if(s[i]!=t[i]) can=false;
    }

    if(can) cout <<"Yes" << endl;
    else cout <<"No" << endl;


}

void bsolve(){

    ll a,b,c,k;
    cin >> a>> b>> c>>k;

    if(k<=a){
        kaku(k);
    }
    else if(k<=(a+b)){
        kaku(a);
    }
    else if (k<=a+b+c){
        kaku(a+a+b-k);
    }
    else {
        kaku(a-c);
    }

}

void csolve(){

    ll n,m,x;
    cin >> n >> m >>x;
    ll c[n];
    ll a[n][m];
    rep(i,n){
        cin >> c[i];
        rep(j,m){
            cin >> a[i][j];
        }
    }
    ll ri[m];
    ll ans=-1;
    for(ll bit=0;bit<(1LL<<n);bit++){
        rep(i,m) ri[i]=0;
        ll score=0;
        ll can=true;
        rep(i,n){
            if(bit & (1LL<<i)){
                score+=c[i];
                rep(j,m){
                    ri[j]+=a[i][j];
                }
            }
        }
        rep(i,m){
            if(x>ri[i]) can=false;
        }
        if(can){
            if(ans==-1) ans=score;
            else ans=min(ans,score);
        }
    }
    kaku(ans);
}

void dsolve(){

    ll n,k;
    cin >> n>> k;
    map<ll,ll> mp;
    rep(i,n){
        ll a;
        cin >>a;
        mp[i+1]=a;
    }
    ll now=1;

    vecll vec;//いった集合
    vec.pb(1);
    bool visit[n+1];
    rep(i,n+1) visit[i]=false;
    visit[1]=true;
    map<ll,ll> iku;//そこを訪れたのはなん回目か
    iku[1]=0;
    ll loop;
    bool d=false;

    for(ll i=1;i<=k;i++){
        now=mp[now];
        if(visit[now]){
            d=true;
            loop=i;
            break;
        }
        else{
            vec.pb(now);
            iku[now]=i;
            visit[now]=true;
        }
    }
    //loop~iku[now]でループ検出

    //ループ処理
    if(d){
        ll e=loop-iku[now];
        ll u=(k-iku[now])%e;

        now=vec[iku[now]+u];

        cout << now << endl;
    }
    else{
        cout << now << endl;
    }

}


int main(){
    asolve();
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
string s;
int sum;
int main()
{
    while (1>0)
    {
        s.clear();
        sum=0;
        getline(cin,s);
        if (s=="0") return 0;
        for(int i=0;i<s.size();i++)
            sum+=s[i]-'0';
        printf("%d\n",sum);
    }
}



Measured memory_bytes: 3336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
#define fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mem[3005][3005],a[3005];
bool vis[N],vis1[N];
vector<ll>v[N];
pair<ll,ll>p[N],p1[N];
set<int>s;
map<string,ll>mp;
queue<ll>q;
ll mod=1e9+7,n;
ll dp( int l ,int r)
{
    if(l==r)
        return a[l] ;
    ll &ret=mem[l][r];
    if(ret!=-1)
        return ret;

    return mem[l][r]=max(a[l]-dp(l+1,r),a[r]-dp(l,r-1));
}
main()
{
    fast_IO
    int n;
    cin>>n;
    memset(mem,-1,sizeof mem);
    for(int i=0;i<n;i++) cin>>a[i];
    cout<<dp(0,n-1);


}










Measured memory_bytes: 79108
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
count=0
for i in range(N):
 A=list(map(int,input().split()))
 p=C
 for j in range(M):p+=A[j]*B[j]
 if p>0:count+=1
print(count)

Measured memory_bytes: 3060
import math    
n,m = map(int,input().split())
mod = 10**9+7
dog = math.factorial(n)%mod
monkey = math.factorial(m)%mod
if abs(n-m) == 1:
    print(dog*monkey%mod)
elif abs(n-m) == 0:
    print(dog*monkey*2%mod)
else:
    print(0)

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    if (abs(a - c) <= d || abs(a - b) <= d && abs(b - c) <= d) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, s = 0, b;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
        s += a[i] * (i % 2 == 0 ? 1 : -1);
    }
    b = s;
    cout << b << ' ' << flush;
    for(int i = 1; i < n; i++){
        printf("%d ", b = 2 * a[i-1] - b);
    }
    cout << endl;
    return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

class UnionFind{
private:
  vector<ll> Parent; 
 public:
  UnionFind(ll N){
    Parent = vector<ll>(N, -1);
  }
  
  ll root(ll A){
    if(Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }
  
  ll size(ll A){
    return -Parent[root(A)]; 
  }
  
  bool connect(ll A, ll B){
    A = root(A);
    B = root(B);
    if(A == B){
      return false;
    }
    if(size(A) < size(B)) swap(A, B);
    Parent[A] += Parent[B];
    Parent[B] = A;
    return true;
  }
  
  bool isSame(ll A, ll B){
    return root(A) == root(B);
  }
};

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k,l; cin>>n>>k>>l;
  UnionFind uf1(n), uf2(n);
  rep(i,k){
    ll a,b; cin>>a>>b;
    a--,b--;
    uf1.connect(a,b);
  }
  rep(i,l){
    ll a,b; cin>>a>>b;
    a--,b--;
    uf2.connect(a,b);
  }
  map<pll,ll> m;
  rep(i,n){
    m[{uf1.root(i),uf2.root(i)}]++;
  }
  rep(i,n){
    cout<<m[{uf1.root(i),uf2.root(i)}]<<endl;
  }
}

Measured memory_bytes: 15104
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

n = k()
p = l()
for i in range(1,n-1):
    a = []
    a.append(p[i-1])
    a.append(p[i])
    a.append(p[i+1])
    a.sort()
    if a.index(p[i]) == 1:
        count += 1

print(count)


Measured memory_bytes: 9972
N, K = map(int, input().split())
hhh = list(map(int, input().split()))

dp = [0] * N
dp[0] = 0

for i in range(1, N):
    if i < K:
        dp[i] = min([abs(hhh[i] - hhh[i - k]) + dp[i - k]
                     for k in range(1, i + 1)])
    else:
        dp[i] = \
            min([abs(hhh[i] - hhh[i - k]) + dp[i - k]
                 for k in range(1, K + 1)])

print(dp[-1])


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

void solve()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b >= c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

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

int main() {
	ios::sync_with_stdio(false);
	vector<int> A(5, 0);
	for (int i = 0; i < 5; i++) {
		cin >> A.at(i);
	}

	int k = 0;
	cin >> k;

	//for (int i = 1; i < 5; i++) {
	//}

	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			if ((A.at(j)-A.at(i)) > k) {
				cout << ":(\n";
				return 0;
			}
		}
	}
	cout << "Yay!\n";
	return 0;
}

Measured memory_bytes: 256
from collections import Counter

n, m = map(int, input().split())
a = map(int, input().split())

abc = Counter(a).most_common()
for i in range(m):
    b, c = map(int, input().split())
    abc.append((c, b))

abc.sort(reverse=True)

ans = 0
count = n
for c, b in abc:
    rep = min(count, b)
    ans += c * rep
    count -= rep
print(ans)


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a % 2 == 1 && b % 2 == 1){
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 100000
#define fo(i,x,y) for(register int i=x;i<=y;i++)
char s[maxn];
int main(){
 	ios::sync_with_stdio(0); 
  	cin.tie(0);
  	cin>>s;
  	int flag=1;
  	fo(i,0,strlen(s)-1){
     	 int pos=i+1;
      	if(pos%2==0){
         	if(!(s[i]=='L' or s[i]=='U' or s[i]=='D'))
              flag=0;
        }
      	if(pos%2){
         	if(!(s[i]=='R' or s[i]=='U' or s[i]=='D')) 
              flag=0;
        }
    }
  	if(flag)
      cout<<"Yes";
  	else 
      cout<<"No";
  	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n,x,y=0;
		while(true){
		n=sc.nextInt();
		x=sc.nextInt();
		if(n==0 && x==0)break;
		for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
		for(int k=1;k<=n;k++){                     
		if(((i+j+k)==x) && (i<j) && (j<k))
		 {y++;
		 }
		 }
		 }
		 }
		System.out.println(y);
		 y=0;
		} 
	}
}

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

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x <<" = " << x << endl
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first  <<" " << v[i].second << endl;
#define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

const int dx[4] = {0,  0, 1, -1};
const int dy[4] = {1, -1, 0,  0};
const int N = 1e5 + 7;
int a[N];
int n;
int main() {
	ios_base::sync_with_stdio(0);
	cin >> n;
	forn(i,n){
		int x;
		cin >> x;
		while(x % 2 == 0){
			a[i]++;
			x = x / 2;
		}
	}
	sort(a, a + n);
	
	int l = 0;
	int r = n - 1;
	vector<int> v;
	while(l <= r) {
		v.push_back(a[l]);
		if (r != l)
			v.push_back(a[r]);
		r--;
		l++;
	}
	
	
	for(int i = 0; i < v.size() - 1; i++){
		if ((v[i] + v[i + 1]) < 2){
			cout << "No\n";
			return 0;
		}
	}
	
	cout << "Yes\n";
	return 0;
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define ins insert
#define mk make_pair
#define fr first
#define sc second
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,sum=0;
    cin>>n;
    for(ll a=1;a<=n;a++)
    {
    	for(ll b=1;b<=n;b++)
    	{
    		for(ll c=b;c<=n;c++)
    		{
    			if(b==c)
    			sum=sum+__gcd(a,__gcd(b,c));
    			else
    			sum=sum+(__gcd(a,__gcd(b,c)))*2;
			}
		}
	}
	cout<<sum;
}

Measured memory_bytes: 3652
n, m, x = map(int, input().split())
#n,m,x,i,j,l,money,k,o
books = []
for i in range(n):
    books.append(list(map(int, input().split())))
books = sorted(books, reverse=False)
#print(books)#

ans = 10 ** 10000
import itertools
for i in range(n+1):
    for j in itertools.combinations(books, i):#j:組み合わせ
#        print(j)#
        l = [0] * m #理解度
        money = 0
        for k in j:#k:組み合わせの中の１冊
#            print(k)#
            money += k[0]  #費用
#            print(money)#
            for o in range(1, m + 1):
                l[o-1] += k[o]  #lが理解度、kが本
#        print(money,l)#
        if all(a >=x for a in l):
            if money < ans:
                ans = money

if ans == 10 ** 10000:
    print(-1)
else:
    print(ans)

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

int main() {
    int n, k;
    cin >> n >> k;
    int ans = 1;

    for (int i = 0; i < n; i++) {
        if(ans < k) ans *= 2;
        else ans += k;
    }
    cout << ans << endl;    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a[200002],b[200002];
int main(){
	int sz=0,q=0,r=0;
	long long sum=0;
	scanf("%d",&sz); 
	for(int i=1;i<=sz;i++){
		scanf("%lld",&a[i]);
		sum+=a[i];
	}
	sum-=a[1];
	for(int i=2;i<=sz;i++){
		b[i]=sum%(1000000007);
		sum-=a[i];
	}
	long long ans=0;
	int p=0;
	for(int i=1;i<=(sz-1);i++){
		p=i+1;
		ans+=(a[i]*b[p]);
		ans%=(1000000007);
	}

	printf("%lld",ans);
}

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

string toUpper(string s){
    string t=s;
    for(int i=0;i<s.size();i++){
        t[i]=toupper(s[i]);
        
    }
    return t;
    
}
int main(){
    string target,source;
    cin>>target;
    target=toUpper(target);
    int cnt=0;
    while(1){
        cin>>source;
    if(source=="END_OF_TEXT")break;
    source=toUpper(source);
    if(target==source)cnt++;
}
cout<<cnt<<endl;
return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	string C[2];
	cin >> C[0] >> C[1];
	if (C[0][0] == C[1][2] && C[0][1] == C[1][1] && C[0][2] == C[1][0])cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


class SegmentTree:
    def __init__(self, N, X, func, init_v):
        self.N = N
        self.func = func
        self.init_v = init_v
        self.__build(X)

    def __build(self, X):
        self.node = [self.init_v] * (2 * self.N)  # 1-based index
        for i, x in enumerate(X, self.N):
            self.node[i] = x
        for i in range(self.N - 1, 0, -1):
            self.node[i] = self.func(self.node[i << 1], self.node[i << 1 | 1])

    def update(self, i, x):
        i += self.N - 1
        self.node[i] = x
        while i > 1:
            i >>= 1
            self.node[i] = self.func(self.node[i << 1], self.node[i << 1 | 1])

    def query(self, l, r):
        dst_l = self.init_v
        dst_r = self.init_v
        l += self.N - 1
        r += self.N - 1
        while l < r:
            if l & 1:
                dst_l = self.func(dst_l, self.node[l])
                l += 1
            if r & 1:
                r -= 1
                dst_r = self.func(self.node[r], dst_r)
            l >>= 1
            r >>= 1
        return self.func(dst_l, dst_r)


def main():
    N, Q = map(int, input().split())
    a = [2 ** 31 - 1] * N

    st = SegmentTree(N, a, func=min, init_v=float("inf"))

    ans = []
    for _ in range(Q):
        com, x, y = map(int, input().split())
        if com == 0:
            # update
            x += 1  # For AOJ input type (0-based index)
            st.update(x, y)
        else:
            # find
            x += 1  # For AOJ input type (0-based index)
            y += 1  # For AOJ input type (0-based index)
            ans.append(st.query(x, y + 1))

    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()



Measured memory_bytes: 13040
n = input()
result = input().split(" ")
count = 0

for i in range(len(result)):
    result[i] = int(result[i])


count = 0
def main(result):
    global count
    if len(result) == 0:
        count += 0
    elif len(result) == 1:
        count += result[0]
    elif 0 in result:
        index_num = result.index(0)
        main(result[:index_num])
        main(result[index_num+1:])
    else:
        min_num = min(result)
        count += min_num
        for i in range(len(result)):
            result[i] -= min_num
        main(result)

main(result)
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,a=1;
  cin >> N >>K;
  
  for(int i=0;i<N;i+=1){
    if(a*2<a+K){
      a*=2;
    }
    else{
      a+=K;
    }
  }
  cout<<a;
}
 

Measured memory_bytes: 3612
N = gets.to_i

num = []
for i in 1..N do
  num[i-1] = 0
end

for x in 1..100 do
  for y in 1..100 do
    for z in 1..100 do
      n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
      if n <= N then
        num[n-1] += 1
      end
    end
  end
end
  
puts num

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

int abs(int i, int j) {
  if (i - j > 0) {
    return i - j;
  } else {
    return j - i;
  }
}
int main() {
  int N, W;
  cin >> N >> W;
  int MV = 100001;
  vector<ll> dp(MV, INT_MAX);
  dp.at(0) = 0;
  rep(i, N) {
    int weight, value;
    cin >> weight >> value;
    for (int j = MV - value - 1; j >= 0; --j) {
      dp.at(j + value) = min(dp.at(j + value), dp.at(j) + weight);
    }
  }
  int ans = 0;
  rep(i, MV) {
    if (dp.at(i) <= W) {
      ans = i;
    }
  }
  cout << ans << endl;
}


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

public class Main {

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

		String strLine ="";
		BufferedReader stdReader =
				new BufferedReader(new InputStreamReader(System.in));

		int i = 0;
		int max = 1000;
		String[] result = new String [max];

		while ( i <= max && ((strLine = stdReader.readLine()) != null) ){

			if(i == 0){
				max = Integer.parseInt(strLine);

			}else{
				//??????????????§?????????
				String[] temp = strLine.split(" ",0);
				int[] tempInt = new int[3];
				tempInt[0] = Integer.parseInt(temp[0]);
				tempInt[1] = Integer.parseInt(temp[1]);
				tempInt[2] = Integer.parseInt(temp[2]);


				//????§???¢???????????????????????????????????????result???????´?
				result[i-1]=calc(tempInt);
				}

			i++;

		}


		//?????????????????????
		if(i > 1){
			for(int j = 0; j < max; j++){
				System.out.println(result[j]);
			}
		}

	}

	public static String calc(int[] tempInt){

		java.util.Arrays.sort(tempInt);

		if((tempInt[0]*tempInt[0])+(tempInt[1]*tempInt[1])==(tempInt[2]*tempInt[2])){

			return "YES";
		}else{
			return "NO";
		}


	}



}

Measured memory_bytes: 25944