akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pi acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define sf scanf
#define pf printf
#define nl printf("\n")
#define ps(s) printf("%s",s.c_str())
#define inf (ll)1e15
#define mod 1000000007
#define mem(x,val) memset(x,val,sizeof x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend() 
#define sz(x) (int)(x).size()
#define test_case int ___t;scanf("%d", &___t);for(int cs=1;cs<=___t;cs++)

using namespace __gnu_pbds;
using namespace std;

inline string str_inp(int n){char ch[n+5];sf(" %s",ch);return string(ch);}
inline string line_inp(int n)
{char ch[n+5];fgets(ch,n+5,stdin);string s=string(ch);s.pop_back();return s;}

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;


const int S=100100;
ll n,m;
ll x[S+5],y[S+5];

int main()
{
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //#endif
    while(~sf("%lld %lld",&n,&m))
    {
        for(int i=0;i<n;i++)sf("%lld",&x[i]);

        for(int i=0;i<m;i++)sf("%lld",&y[i]);

        ll in_sum=0;
        for(int i=0;i<m;i++)
        {
            in_sum+=(y[i]*i);
            in_sum-=(y[i]*(m-1-i));
            in_sum%=mod;
        }

        ll out_sum=0;
        for(int i=0;i<n;i++)
        {
            out_sum+=(x[i]*i);
            out_sum-=(x[i]*(n-1-i));
            out_sum%=mod;
        }
        ll ans=(in_sum*out_sum)%mod;
        pf("%lld\n",ans);
    }
    return 0;
}
 






































Measured memory_bytes: 5360
S=input()
bf=int(S[:2])
af=int(S[2:])
if 1 <= bf <= 12 and 1<= af <=12:
  print("AMBIGUOUS")
elif (bf>12 and af==0) or (af>12 and bf==0) or  (af==0 and bf==0) or (af>12 and bf>12):
  print('NA')
elif bf>12 or bf==0:
  print('YYMM')
else:
  print('MMYY')

Measured memory_bytes: 3064
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
    int N;
    int x = 0;

    cin >> N;
    while(x < N)x += 1000;

    cout << x - N << endl;
    
    return 0;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<=b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main()
{
    INIT;
    int s;
    cin >> s;
    bool YYMM = false;
    bool MMYY = false;
    int zenhan = s / 100;
    int kohan = s - zenhan * 100;
    if(IN(0, zenhan, 99) && IN(1, kohan, 12) ) YYMM = true;
    if(IN(1, zenhan, 12) && IN(0, kohan, 99)) MMYY = true;
    if(YYMM&&MMYY){
        cout << "AMBIGUOUS\n"; 
    }else if(YYMM){
        cout << "YYMM\n";
    }else if(MMYY){
        cout << "MMYY\n";
    }else{
        cout << "NA\n";
    }
    /*
    cout << s << endl;
    cout << zenhan << " " << kohan << endl;
    */
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,a,b;
  cin >> x >> a >> b;
  if(a >= b)
    cout << "delicious" << endl;
  else if(a < b && b - a <= x)
    cout << "safe" << endl;
  else
    cout << "dangerous" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define mk make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N,K; cin >> N >> K;
    vc<pi> p;
    if((N-1)*(N-2)/2 < K) cout << -1 << endl;
    else {
        rep(i,N-1){
            p.pb(mk(1,i+2));
        }
        int cnt = (N-1)*(N-2)/2-K;
        rng(i,2,N){
            rng(j,i+1,N+1){
                if(!cnt) break;
                p.pb(mk(i,j));
                cnt--;
            }
            if(!cnt) break;
        }
        cout << p.size() << endl;
        for(auto a:p){
            cout << a.fi <<" "<< a.se << endl;
        }
    }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sf3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define sl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sd(x) scanf("%lf",&x);
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
#define PRINT_CASENL  printf("Case %d:\n",tc++)
#define mx 100005
#define lnd tree[ind<<1]
#define rnd tree[(ind<<1)+1]
#define cnd tree[ind]
#define lndp b,(b+e)>>1,(ind<<1)
#define rndp ((b+e)>>1)+1,e,(ind<<1)+1
#define IN(a,x,y) (a>=x && a<=y)
typedef long long ll;
typedef long long int lln;
ll INF=1<<28;
//typedef long long lld;
const double pi=acos(-1.0);
int fx[]={1,-1,0,0}; //direction array
int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};
const long double EPS=1e-7;
//#define INF 10000
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

bool cmp(int a, int b)
{
    return a<b;
}

struct compare
{
  bool operator()(const int& l, const int& r)
  {
      return l>r;
  }
};
ll inf=1e18;
int mod=1e9+7;

int tim=0;
int color;
int dp[100005];
int arr[3005];
int n,h;
int fun(int k)
{
//    cout<<k<<endl;
    if(k<0)
        return 0;
    if(k==0)
    {
        return 1;
    }
    if(dp[k]!=-1)
        return dp[k];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        ans|=fun(k-arr[i]);
    }
    return dp[k]=!ans;
}
int main()
{
//    READ;
    mem(dp,-1);
    int k;
    sf2(n,k);
    for(int i=0;i<n;i++)
    {
        sf(arr[i]);
    }
    if(!fun(k))
    {
        cout<<"First"<<endl;
    }
    else
        cout<<"Second"<<endl;
    return 0;
}


Measured memory_bytes: 5504
#include<iostream> 
#include<cmath> 
#include <algorithm>
using namespace std;
int n, x, c; 
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		for (int j = 2; j <= (int)sqrt(x); j++)
		{
			if (x % j == 0) { c++; break; }
		}
	}
	cout << n - c << endl;
	return 0;
}


Measured memory_bytes: 3084
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli a, b;
    cin>>a>>b;
    if(a<6){ 
        b=0;
    }
    out((a<13?b/2:b));
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
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;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> v; 
    rep(i, 5){
        int t; cin>>t;
        v.push_back(t);
    }
    int k; cin>>k;
    string ans = "Yay!";
    for(int i=0; i<5;i++){
        for(int j=i+1; j<5; j++) {
            if(abs(v[i]-v[j]) > k){
                ans = ":(";
                break;
            }
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())

A_lst = []
for i in range(H):
    tmp = list(input())
    A_lst.append(tmp)

#print(A_lst)

def judge(A_lst): 
    for i in range(1, H):
        for j in range(1, W):
            if A_lst[i][j-1] == "#" and A_lst[i-1][j] == "#":
                return False
    return True

if judge(A_lst):
    print("Possible")

else:
    print("Impossible")

Measured memory_bytes: 3060
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template <class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int m, d;
	cin >> m >> d;
	int ans = 0;
	for (int i = 1; i <= d; ++i) {
		int a = i / 10, b = i % 10;
		if (a < 2 || b < 2)continue;
		if (a * b <= m)ans++;
	}
	cout << ans << endl;
}

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





int main() {
  int64_t n;
  cin>>n;
  
  vector<int> prime(n+1,1);
  
  prime.at(0)=0;
  prime.at(1)=0;
  
  for (int i=2;i<=n;i++){
    if (prime.at(i)==1){
      for (int j=2*i;j<=n;j+=i){
        prime.at(j)=0;
      }
    }
  }
  

  
  int64_t answer=1;
  
  
  for (int i=1;i<=n;i++){
    int x=n;
    if (prime.at(i)==1){
      int64_t tmp=0;
      while (x>0){
        tmp+=x/i;
        x/=i;
      }
      

      answer*=(tmp+1)%(1000000007);
      answer=answer%1000000007;
    }
  }
      
      
      
        
  cout<<answer<<endl;
  
  
}












Measured memory_bytes: 384
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}

vector<ll> A;
int main() {
	ll N;
	cin >> N;

	A.resize(N);

	rep(i, N) {
		cin >> A[i];
	}

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

	vector<pair<ll, ll>> retu;

	ll ind = A[A.size()-1];
	for (int i = 1; A[i] < 0 && i < A.size()-1; i++) {
		
		retu.push_back({ ind, A[i] });
		ind -= A[i];
	}

	ll ind2 = A[0];
	for (int i = A.size()-2; A[i] >= 0 && i >= 1; i--){

		retu.push_back({ ind2, A[i] });
		ind2 -= A[i];
	}


	retu.push_back({ ind, ind2 });

	cout << (ind - ind2) << endl;
	rep(i, retu.size()) {
		cout << retu[i].first << " " <<  retu[i].second << endl;

	}

	return 0;
}

Measured memory_bytes: 4336
#include <bits/stdc++.h>
using namespace std;
char a[10009];
char s[10009];
int main()
{
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	int len=0;
	gets(s);
	int l=strlen(s);
	for (int i=0;i<l;i++)
	{
		if (s[i]=='0'||s[i]=='1')
		{
			len++;
			a[len]=s[i];
		}
		else
		{
			if (len==0) continue;
			len--;
		}
	}
	if (len==0) return 0;
	for (int i=1;i<=len;i++) cout<<a[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
   long long a,b,k,i;
   cin>>a>>b>>k;
   if(2*k>=b-a+1)
   {
       for(i=a;i<=b;i++)
       {
           if(i!=b) cout<<i<<endl;
           else cout<<i;
       }
   }
   else
   {

       for(i=a;i<=a+k-1;i++)
       cout<<i<<endl;
          for(i=b-k+1;i<=b;i++)
             {
           if(i!=b) cout<<i<<endl;
           else cout<<i;
       }
   }
}


Measured memory_bytes: 256
n = int(input())

a = []
b = []
for i in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)

a.sort()
b.sort()

if n % 2 == 0:
    start = (a[n//2-1] + a[n//2]) / 2
    end = (b[n//2-1] + b[n//2]) / 2
    print(int((end-start) * 2 + 1))
else:
    print(b[(n+1)//2-1] - a[(n+1)//2-1] + 1)

Measured memory_bytes: 98972
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	cout << ((long long)(n - 1) * n) / 2 << "\n";
	return 0;
}

Measured memory_bytes: 256
let scan_int () = Scanf.scanf " %d" (fun x -> x)
let print_int n = Printf.printf "%d\n" n

let rec solve i n k ret =
  if i = n then ret
  else
    let a = scan_int() in
    if a < k then solve (i+1) n k ret
    else solve (i+1) n k (ret+1)

let () =
  let n = scan_int() and k = scan_int() in
  print_int (solve 0 n k 0)


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9 + 7;

using Graph = V<V<int>>;
Graph g;
V<bool> seen;
int n, m;
int ans = 0, cnt = 0;

void dfs(int v) {
    seen[v] = true;
    cnt++;
    if(cnt == n) ans++;
    for (auto next_v : g[v]) {
        if (seen[next_v]) continue;
        dfs(next_v);
    }
    cnt--;
    seen[v] = false;
}

int main() {
    cin >> n >> m;

    g.resize(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);
    }

    seen.resize(n);
    dfs(0);
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long int li;
typedef unsigned long long int ull;
typedef long double ld;
#define Max 200002
#define mod 1000000007
#define rep(i,a,b) for(i=a;i<=b;i++)
#define rrep(i,a,b) for(i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define mkp make_pair
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define endl "\n"
void bye()
{
	
	exit(0);
}
signed main()
{
	fast;
	ll t,pro=1,n,m,temp,k,l,r,mid,i,j,x,y,z,rem,ind,ans=0,mx=LONG_LONG_MIN,mn=LONG_LONG_MAX,cnt=0,curr=0,prev,sum=0,flag=0,i1=-1,i2=-1;
	cin>>n;
	int index[n+1];
	rep(i,1,n)
	{
	    cin>>temp;
	    index[temp]=i;
	}
	set<int> ms={0,n+1};
	rep(i,1,n)
	{
	    auto it=ms.lb(index[i]);
	    r=*it;
	    l=*(--it);
	    ans+=i*(r-index[i])*(index[i]-l);
	    ms.insert(index[i]);
	}
	cout<<ans;
	return 0;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

vector<int> chidx;
int n;

int check(){
    REP(i, 0, n){
        if(chidx[i] != n-1){
            return 1;
        }
    }
    return 0;
}

int main(){
    cin >> n;
    chidx = vector<int>(n, 0);
    vector<vector<int> > lis(n, vector<int>(n-1));
    REP(i, 0, n){
        REP(l, 0, n-1){
            cin >> lis[i][l];
            lis[i][l]--;
        }
    }
    int ans = 0;
    while(check() == 1){
        ans++;
        vector<int> used(n, 0);
        int f = 0;
        REP(i, 0, n){
            if(chidx[i] == n-1){
                continue;
            }
            int to = lis[i][chidx[i]];
            if(used[i] == 1 || used[to] == 1){
                continue;
            }
            if(chidx[to] == n-1){
                cout << -1 << endl;
                return 0;
            }
            if(lis[to][chidx[to]] == i){
                chidx[i]++;
                chidx[to]++;
                used[i] = 1;
                used[to] = 1;
                f = 1;
            }
        }
        if(f == 0){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 7560
import numpy as np

def main():
    N, M = map(int, input().split())
    acc = [False] * (N+1)
    pen = [0] * (N+1)
    for _ in range(M):
        p, S = input().split()
        p = int(p)
        if S[0] == 'A':
            acc[p] = True
        else:
            if not acc[p]:
                pen[p] += 1
    n_pen = 0
    for i in range(1, N+1):
        if acc[i]:
            n_pen += pen[i]
    print('{} {}'.format(sum(acc), n_pen))

    

if __name__ == '__main__':
    main()

Measured memory_bytes: 15944
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N; cin >> N;
  for(int i = 1; i < 10; i++) {
    for(int j = 1; j < 10; j++) {
      if(i * j == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String input = scan.nextLine();
	char[] inputArray = new char[input.length()];
	for (int i = 0; i < input.length(); i++) {
	    char alpabet = input.charAt(i);
	    if (Character.isUpperCase(alpabet)) {
		inputArray[i] = Character.toLowerCase(alpabet);
	    } else if (Character.isLowerCase(alpabet)){
		inputArray[i] = Character.toUpperCase(alpabet);
	    } else {
		inputArray[i] = alpabet;
	    }
	}
	System.out.println(String.valueOf(inputArray));
    }
}

Measured memory_bytes: 26224
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;

    int N, K;
    io.read(N, K);
    auto x = io.read_vec<int>(N);
    int ans = 0;
    for(int i = 0; i < N; i++){
        ans += min(x[i] * 2, abs(K - x[i]) * 2);
    }
    cout << ans;
    return 0;
}

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

using namespace std;

int main()
{
    vector<int> v = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int K;
    cin >> K;
    cout << v[K - 1] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define int long long
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	int N;
	cin >> N;
	cout << CEIL(N,2);
}

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

int main(){
  
  int N, i, max = 0;
  cin >> N;
  string s;
  map<string, int> S;
  
  for(i = 0; i < N; i++){
    
    cin >> s;
    S[s]++;
    if(max < S[s]) max = S[s]; 
  }
  
  for(auto _s : S){
    
    if (_s.second == max){
      
      cout << _s.first << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 25216
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{

   long d, a, b;
   char *s1, *s2, *s3;
   char s[100];

   fgets(s,100,stdin);

   s1 = strtok(s, " ");
   s2 = strtok(NULL, " ");
   s3 = strtok(NULL, " ");

   d = atol(s1);
   a = atol(s2);
   b = atol(s3);

   if(a >= b){
       printf("delicious");
   }else if(b - a <= d){
       printf("safe");
   }else{
       printf("dangerous");
   }

   return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

//region TEMPLATE
#define double long double
typedef long long ll;
typedef unsigned long long ull;

template<typename T>
void __read(T &a) { cin >> a; }

template<typename T, typename ... Args>
void __read(T &a, Args &... args) {
    cin >> a;
    __read(args...);
}

#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T>
void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
template<class T>
static auto __super_speed__ = (ios_base::sync_with_stdio(0), cin.tie(
        0)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
//endregion


int32_t main() {
    make(int, n, m);
    cout << (n * 500 >= m ? "Yes" : "No");
    return 0;
}

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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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

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

void solve();

int main()
{
    solve();
}

void solve()
{
    string s;
    int q;
    in2(s, q);
    int flag = 0;
    string k = "";
    string l = "";
    rep(i, q)
    {
        int t;
        in(t);
        if (t == 1)
        {
            if (flag)
            {
                flag = 0;
            }
            else
            {
                flag = 1;
            }
        }
        else
        {
            int f;
            in(f);
            char c;
            in(c);
            if (f == 1)
            {
                if (flag == 0)
                {
                    k = c + k;
                }
                else
                {
                    l = l + c;
                }
            }
            else
            {
                if (flag == 1)
                {
                    k = c + k;
                }
                else
                {
                    l = l + c;
                }
            }
        }
    }
    s = k + s + l;
    if (flag)
    {
        reverse(s.begin(), s.end());
    }
    out(s);
}

Measured memory_bytes: 1512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		if( a < b) { System.out.println("a < b");}
		else if ( a > b ){ System.out.println("a > b");}
		else System.out.println("a == b");
	}
}

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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (int i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (int i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;

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

    int mn = min(a, c);
    ans += mn;
    c -= mn;
    a -= mn;

    if (c > 0) {
    	mn = min(b, c);
    	ans += 2 * mn;
    	b -= mn;
    	c -= mn;
    }

    if (c > 0) ans ++;
    ans += b;
    cout << ans;
    return Accepted;
}

// Coded By OB

Measured memory_bytes: 18688
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}
fn main() {
    let n: String = read();
    let mut dp = vec![vec![0; 13]; n.len() + 1];
    let big_int = 1000_000_000 + 7;
    dp[0][0] = 1; // pos, mod13

    for (i, c) in n.chars().enumerate() {
        if c == '?' {
            for j in 0..13 {
                for k in 0..10 {
                    let idx3: usize = (j * 10 + k) % 13;
                    dp[i + 1][idx3] += dp[i][j];
                    dp[i + 1][idx3] %= big_int;
                }
            }
        } else {
            for j in 0..13 {
                let idx3: usize = (j * 10 + c.to_digit(10).unwrap() as usize) % 13;
                dp[i + 1][idx3] += dp[i][j];
                dp[i + 1][idx3] %= big_int;
            }
        }
    }
    // debug!(dp);
    println!("{:?}", dp[n.len()][5]);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 14588
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
ll gcd(ll a, ll b)
{
	for (;;)
	{
		if (a < b)swap(a, b);
		a %= b;
		if (a == 0)return b;
	}
}
ll d[101010];
ll solve(int num)
{
	ll s = 0;
	ll r = 0;
	for (int i = 0; i < num; i++)
	{
		s += d[i];
		if (i % 2 == 0)
		{
			if (s <= 0)r += 1 - s, s = 1;
		}
		else
		{
			if (s >= 0)r += s + 1, s = -1;
		}
	}
	return r;
}
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num; i++)scanf("%lld", &d[i]);
	ll t = solve(num);
	for (int i = 0; i < num; i++)d[i] = -d[i];
	ll s = solve(num);
	printf("%lld\n", min(t, s));
}

Measured memory_bytes: 1024
// Created by code_sm
//
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int> 
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) s.size()
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
void solve()
{
fastio
	int a,b,h;
	cin>>a>>b>>h;
	h/=2;
	cout<<(a+b)*h;
}
int main()
{
//code
	
fastio	
int t;
t=1;
while(t--)
{
	solve();
	cout<<endl;
}
}


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

int main(){
    string s;
    cin >> s;
    string ans = "";
    for(int i=0;i<3;i++){
        if(s[i]=='9'){
            ans += '1';
        }else{
            ans += '9';
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
int a,b;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
    
    cin >> a >> b;
    if(a<=9 && b<=9){
    	cout << a*b << endl;
    }
    else {
    	cout << -1 << endl;
    }
    

return 0;
}
///....


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int a[3];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a[0]>>a[1]>>a[2];
    sort(a,a+3);
    int ca=a[2]-a[0];
    int cb=a[2]-a[1];
    int ans=0;
    while(ca>1){
        ca-=2;
        ans++;
    }
    while(cb>1){
        cb-=2;
        ans++;
    }

    if(ca==0&&cb==0){

    }
    else if((ca==1&&cb==0)||(ca==0&&cb==1)){
        ans+=2;
    }
    else{
        ans++;
    }
    cout << ans  << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 1e18
#define ll long long int
using namespace std;
int main(void){
  int i,j,n,k;
  cin>>n>>k;
  ll a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  ll dp[n+1];
  for(i=0;i<=n;i++)
    dp[i]=inf;
  dp[1]=0;
  dp[2]=abs(a[1]-a[0]);

  for(i=3;i<=min(n,k);i++){
	  //cout<<"**"<<endl;
    for(j=1;j<i;j++)
    dp[i]=min(dp[j]+llabs(a[i-1]-a[j-1]),dp[i]);
    }
    
    for(i=k+1;i<=n;i++){
		//cout<<"&&"<<endl;
      for(j=i-k;j<i;j++)
    dp[i]=min(dp[j]+llabs(a[i-1]-a[j-1]),dp[i]);
    }

  cout<<dp[n];
}


Measured memory_bytes: 1792
from collections import Counter
n = int(input())
a = list(map(int, input().split()))

count = Counter(a)
t = 4
s = []
for i in sorted(count.items(), key=lambda x: x[0], reverse=True):
  if i[1] >= 4 and t == 4:
    print(i[0]**2)
    exit()
  if i[1] >= 2 and t != 0:
    t -= 2
    s.append(i[0])
  elif t == 0: break
    
if len(s) != 0: print(s[0]*s[1])
else: print(0)

Measured memory_bytes: 27212
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <complex>

using namespace std;

#define mod 1000000007

vector<vector<int> > solve(vector<int> v)
{
	vector<vector<int> > res;
	vector<int> parent;
	vector<int> sizes;
	parent.push_back(-1);
	parent.push_back(0);
	sizes.push_back(v[0]);
	sizes.push_back(v[1]);
	vector<int> tmp;
	tmp.push_back(1);
	res.push_back(tmp);
	tmp.clear();
	tmp.push_back(0);
	res.push_back(tmp);
	int nownum = 1;
	for(int i = 2; i < v.size(); i++){
		// cout << i << endl;
		if(v[i] > 0){
			parent.push_back(nownum);
			sizes.push_back(v[i]);
			res[nownum].push_back(res.size());
			tmp.clear();
			tmp.push_back(nownum);
			res.push_back(tmp);
			nownum = res.size() - 1;
		} else {
			int partner = nownum;
			for(int j = 0; j < -v[i]; j++){
				partner = parent[partner];
			}
			res[partner].push_back(nownum);
			res[nownum].push_back(partner);
		}
		while(parent[nownum] >= 0 && res[nownum].size() == sizes[nownum]) nownum = parent[nownum];
	}
	// for(int i = 0; i < res.size(); i++){
	// 	cout << i + 1 << " " << parent[i] + 1 << endl;
	// }
	// cout << endl;
	return res;
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		vector<int> v;
		int tmp;
		cin >> tmp;
		while(tmp != 0){
			v.push_back(tmp);
			cin >> tmp;
		}
		vector<vector<int> > res = solve(v);
		for(int i = 0; i < res.size(); i++){
			cout << i + 1 << " ";
			sort(res[i].begin(), res[i].end());
			for(int j = 0; j < res[i].size(); j++){
				cout << res[i][j] + 1;
				if(j == res[i].size() - 1) cout << endl;
				else cout << " ";
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3096
#include<stdio.h>
#include<string.h>

int main (void)

{  char s[25];
int l,i;
    scanf("%s",&s);
    l=strlen(s);
    for(i=l-1;i>=0;i--)
        printf("%c",s[i]);
    printf("\n");

    return 0;
}



Measured memory_bytes: 1928
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<unordered_map>
#define ll long long int
using namespace std;
#define mod 998244353

ll power(ll a, int p)
{
	if (p == 0)
		return 1;
	if (p % 2 == 0)
	{
		ll k = power(a, p / 2) % mod;
		return k * k % mod;
	}

	return a * power(a, p - 1) % mod;

}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, m, k;
	cin >> n >> m >> k;

	ll coeff[k + 1];
	coeff[0] = 1;
	ll ans = 0;
	for (int i = 1; i <= k; i++)
	{
		coeff[i] = coeff[i - 1] * (n - 1 - i + 1) % mod * power(i, mod - 2) % mod;
	}

	for (int i = 0; i <= k; i++)
	{
		ans += m * power(m - 1, n - 1 - i) % mod * coeff[i] % mod;
		ans %= mod;
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 5068
//他者回答参考
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

ll now;
string s, t;
ll nxt[26][200005];

int main(void) {
    cin >> s >> t;
    ll S = (ll)s.size();
    ll T = (ll)t.size();

    s += s;
    for (ll i=0; i<26; i++) nxt[i][S*2] = S*2;
    for (ll i=S*2-1; i>=0; i--) {
        for (int ch=0; ch<26; ch++) {
            nxt[ch][i] = nxt[ch][i+1];
            nxt[s[i]-'a'][i] = i+1;
        }
    }

    for (ll i=0; i<T; i++) {
        char ch = t[i]-'a';
        ll x = now%S;
        if (nxt[ch][x] == S*2) {
            puts("-1");
            return 0;
        }
        now += nxt[ch][x]-x;
    }
  
    printf("%lld\n", now);

	return 0;
}


Measured memory_bytes: 41344
#include<iostream>
#include<vector>
#include<algorithm>
#include<fstream>
#include<utility>
#include<string>
#include<iomanip>
#include<queue> 
#include<cmath>
#include<utility>
#include<set>
using namespace std;
bool compare(int a, int b)
{
  return a > b;
}
int main()
{
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  int a, b;
  cin >> a >> b;
  if(a==b)
  	cout << "Yes\n";
  else
  	cout << "No\n";
}


Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>

using namespace std;

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const db PI = acos(-1);
const db ERR = 1e-12;

const int MX = 100005;

int main()
{
	int N, M, a;
	map<int, int> L;
	scanf("%d", &N);
	for(int i = 1; i <= N; i++){
		scanf("%d", &a);
		L[a] += 1;
	}
	scanf("%d", &M);
	for(int i = 1; i <= M; i++){
		scanf("%d", &a);
		if( L[a] == 0 ) return !printf("NO\n");
		L[a] -= 1;
	}
	printf("YES\n");
}


Measured memory_bytes: 9600
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>

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

//#define SIZE (10*10*10*10*10)
#define SIZE (100)

typedef struct _tmp_t {
  int val;
} tmp_t;

int compare(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->val > y->val) return 1;
  if (x->val < y->val) return -1;

  return 0;
}

int compare_reverse(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->val < y->val) return 1;
  if (x->val > y->val) return -1;

  return 0;
}

void qsort_tmp (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare);
}

void qsort_tmp_rev (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_reverse);
}

tmp_t W[SIZE];

int main()
{
  int cnt;
  int N;
  int i;
  int result = 0;
  int A=0;
  int B=0;
  int min;

  cnt = scanf("%d", &N);

  for (i=0; i<N; i++) {
    cnt = scanf("%d", &W[i].val);
    B += W[i].val;
  }

  min = B;
  
  for (i=0; i<N; i++) {
    A += W[i].val;
    B -= W[i].val;
    min = MIN(min, ABS((A-B)));
  }
  
  printf("%d", min);

  return 0;
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define eps 1e-6
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, k=0, i, j,l=2e9+7;
  string s, r, y;
  cin>>n>>a>>b>>m;
  cout<<max(max(n*b,n*m),max(a*b,a*m));
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
  // cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, a[100100], total, l, r, put2[30], lim_l[100100], lim_r[100100], maxx[100100];

ll calc_lim_r(int index) {
    if (index <= 27)
        return min(put2[index], a[index] + maxx[index + 1]);
    return a[index] + maxx[index + 1];
}

int main() {
    put2[0] = 1;
    for (int i = 1; i <= 27; i++)
        put2[i] = put2[i - 1] * 2;
    cin.tie(0); ios::sync_with_stdio(0);

    cin >> n;
    for (int i = 0; i <= n; i++)
        cin >> a[i];

    maxx[n] = a[n];
    for (int i = n - 1; i >= 0; i--)
        maxx[i] = maxx[i + 1] + a[i];

    l = r = a[n];
    lim_l[n] = l;
    lim_r[n] = r;

    if (l > calc_lim_r(n)) { /// prea multe noduri finale
        cout << -1;
        return 0;
    }

    for (int i = n - 1; i >= 0; i--) {
        l = (l + 1) / 2 + a[i];
        r += a[i];
        r = min(r, calc_lim_r(i));

        if (l > r || l <= 0) {
            cout << -1;
            return 0;
        }

        lim_l[i] = l;
        lim_r[i] = r;
    }

    ll act = 1;
    for (int i = 0; i <= n; i++) {
        if (!(lim_l[i] <= act && act <= lim_r[i])) {
            cout << -1;
            return 0;
        }
        total += act;
        act = min((act - a[i]) * 2, lim_r[i + 1]);
    }

    cout << total;
    return 0;
}


Measured memory_bytes: 6632
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, intmax_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, intmax_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    size_t A, B, Q; cin >> A >> B >> Q;

    vector<intmax_t> s(A + 2), t(B + 2);
    for (size_t i = 1; i <= A; ++i) {
        cin >> s[i];
    }

    for (size_t i = 1; i <= B; ++i) {
        cin >> t[i];
    }

    s[0] = t[0] = -LINF;
    s[A + 1] = t[B + 1] = LINF;

    const auto dist = [&](intmax_t x, intmax_t left, intmax_t right) -> intmax_t {
        if (left > right) swap(left, right);
        if (left == -LINF || right == LINF) return LINF;

        if (x <= left && left <= right) return llabs(x - right);
        if (left <= right && right <= x) return llabs(x - left);

        intmax_t value1 = llabs(x - right) * 2 + llabs(x - left);
        intmax_t value2 = llabs(x - left) * 2 + llabs(x - right);

        return min<intmax_t>(value1, value2);
    };

    while (Q--) {
        intmax_t x; cin >> x;

        intmax_t minv = LINF;
        auto itr_s = lower_bound(s.begin(), s.end(), x);
        auto itr_t = lower_bound(t.begin(), t.end(), x);

        chmin(minv, dist(x, *itr_s, *itr_t));
        chmin(minv, dist(x, *prev(itr_s), *itr_t));
        chmin(minv, dist(x, *itr_s, *prev(itr_t)));
        chmin(minv, dist(x, *prev(itr_s), *prev(itr_t)));

        cout << minv << "\n";
    }

    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <utility>
#include <numeric>
using namespace std; 

int func(int n){
	if(n%2==0) return n/2;
	return 3 * n + 1;
}

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

	int ans = 1;
	vector<int> past;
	past.push_back(s);

	while(true){
		ans++;
		int tmp = func(past.back());
		if(find(past.begin(), past.end(), tmp) != past.end()) break;
		past.push_back(tmp);
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x;
	cin >> x;
	int sum = 0;
	for(int i=1;;i++) {
		sum += i;
		if(sum >= x) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,h,maxh=0; cin>>n;
  for(int i=0;i<n;i++){
    cin>>h;
    if(maxh>h){cout<<"No"; return 0;}
    maxh=max(maxh,h-1);
  }
  cout<<"Yes";
}

Measured memory_bytes: 3608