akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*ll fact_[100000];
ll comb(ll x, ll y, ll mod = Mod) {
	if (!fact_[0]) {
		fact_[0] = 1;
		for (int i = 1; i < 1000000; i++) {
			fact_[i] = fact_[i - 1] * i % mod;
		}
	}
	if (x < y) return 0;
	return mod_pow(fact_[x], mod, mod) *
		mod_pow(fact_[x - y], mod - 2, mod) % mod *
		mod_pow(fact_[y], mod - 2, mod) % mod;
}//xCy*/
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
signed main() {
	cin >> n;
	cout << n * n << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string s;
    getline(cin, s);
        for(int i = 0; i < s.size(); i++){
            char c = s[i];
            if('A' <= c && c <= 'Z'){
                // c = tolower(c);
                c = c + 32;
            }
            else if('a' <= c && c <='z')
            c = c -32;
        cout << c;
    }
    cout << endl;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()

//use (__int128)to extend ll range
double doINF = 1.0/0.0 ;
ostream_iterator <int> outp(cout," ");
inline ll modadd(ll n,ll m,ll mod){
    ll sum = ((n+m)%mod+mod)%mod;
    return sum;
} 
inline ll modsub(ll n,ll m, ll mod){
    ll diff = ((n-m+mod)%mod+mod)%mod;
    return diff;
}
inline ll modpro(ll n,ll m,ll mod){
    ll pro = ((n*m)%mod+mod)%mod;
    return pro;
}
inline ll pow(int x,int y){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}
inline ll powmod(ll x,ll y,ll mod){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = modpro(res , x,mod);
        y = y >> 1;
        x = modpro(x , x,mod);
    }
    return res;
}
ll min(ll a, ll b){
   if(a>b){
       return b;
   }
   return a;
}

ll max(ll a, ll b){
   if(a>b){
       return a;
   }else return b;
}
 
bool pairdec(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 		if(a.fi!=b.fi)
       	return (a.fi> b.fi);
		else return a.se>b.se;  
} 
ll power(ll x, ll y, ll mod) 
{ 
    ll res = 1; 
    x = x%mod; 
    while (y > 0) { 
        if (y & 1) 
            res = (res * x) % mod; 
  
        y = y >> 1;
        x = (x * x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll a, ll mod) 
{ 
    return  powmod(a, mod - 2, mod); 
} 
ll modFact(ll n, ll mod) 
{ 
    if (n >=mod) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) %mod; 
  
    return result; 
} 
//cout<<setprecision(9)<<fixed<<sum<<endl; --- precision for double numbers
//copy(v.beg,v.en,outp);
//-----comparision for pairs------
 
// bool comp(const pair<int,int>pia,const pair<int,int>pib)
// {
// 	if(pia.fi==pib.fi) return pia.se>pib.se;
// 	else return pia.fi>pib.fi;
// }

const ll N=1e9+7;
int main()
{
    string s;
    cin>>s;

    if(s.len<6)
    {
        cout<<"No"<<endl;
        return 0;
    }
    if(s[2]==s[3] && s[4]==s[5])
    {
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
 using namespace std;
 int serch(int S[],int n,int key){
   int i=0;
   S[n]=key;
   while(S[i]!=key){
     i++;
   }
   return i!=n;
 }
 int main(){
   int n,S[10000],q,key;
   int i,sum=0;
   scanf("%d",&n);
   for(i=0;i<n;i++){
     scanf("%d",&S[i]);
   }
   scanf("%d",&q);
   for(i=0;i<q;i++){
     scanf("%d",&key);
     if(serch(S,n,key)){
       sum++;
     }
   }
   printf("%d\n",sum);
   return 0;
 }

Measured memory_bytes: 2720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n, b;
    cin >> n >> b;
    int a = b;
    int ans = 1;
    while (a <= n)
    {
        a *= b;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  int A;cin>>A;
  cout << (N%500<=A? "Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from heapq import heappop, heappush

n, m, ss = map(int, input().split())
lines = sys.stdin.readlines()
links = [set() for _ in range(n)]
aaa = []
for line in lines[:m]:
    u, v, a, b = map(int, line.split())
    u -= 1
    v -= 1
    links[u].add((v, a, b))
    links[v].add((u, a, b))
    aaa.append(a)

exchanges = []
for line in lines[m:]:
    c, d = map(int, line.split())
    exchanges.append((c, d))

req = sum(sorted(aaa, reverse=True)[:n - 1])
INF = 10 ** 18
ans = [INF] * n
ans_silver = [-1] * n

q = [(0, ss, 0)]  # (time, silver, city)
visited = set()
fixed = 0
while q:
    t, s, v = heappop(q)
    if (s, v) in visited or ans_silver[v] >= s:
        continue
    visited.add((s, v))
    if ans[v] == INF:
        ans[v] = t
        ans_silver[v] = s
        fixed += 1
        if fixed == n:
            break

    for u, a, b in links[v]:
        if s < a:
            continue
        ns = s - a
        nt = t + b
        if (ns, u) in visited or ans_silver[u] >= ns:
            continue
        heappush(q, (nt, ns, u))

    c, d = exchanges[v]
    ns = s + c
    if ns <= req and (ns, v) not in visited:
        heappush(q, (t + d, ns, v))

print('\n'.join(map(str, ans[1:])))


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

const long long p = 1000000007;

long long modpow(long long a, long long b){
  if(b == 0) return 1;
  if(b & 1) return a*modpow(a, b-1) % p;

  long long x = modpow(a, b/2);
  return x*x % p;
}

long long modcomb(long long n, long long k){
  if(n == 0 || k == 0) return 1;
  if(n < k || n < 0) return 0;

  long long nfac = 1, kfac = 1, nkfac = 1;
  for(int i=1; i<=n; ++i){
    nfac = nfac * i % p;
    if(i == n-k) nkfac = nfac;
    if(i == k) kfac = nfac;
  }
  return (nfac*modpow(kfac, p-2) % p) * modpow(nkfac, p-2) % p;
}

int main() {
  int n, k; cin >> n >> k;

  long long ans = 0;
  for(int i=1; i<=k; ++i){
    ans = modcomb(n-k+1, i) * modcomb(k - i + i-1, i-1) % p;
    printf("%lld\n", ans);
  }
}


Measured memory_bytes: 256
//#undef DEBUG
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace std; using __gnu_cxx::power;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1; const double eps = 1e-6, ldeps = 1e-9;
#define all(x) begin(x), end(x)
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
#define TCC template<class C
struct Dbg { static constexpr auto &os = cout;   // replace by cerr in interactive.
#define ENI typename enable_if<
#define DTOR , Dbg&>::type operator<<
#define RIS return *this
TCC> static auto o(C *x)->decltype(os << *x, 0);
TCC> static char o(...);
TCC> ENI sizeof o<C>(0)!=1 DTOR(const C &x) {os<<x; RIS;}
TCC> Dbg &dump(C b, C e) {
    int ii = 0;
    for(C i = (os << "\n[", b); i!=e and ii<26; i++, ii++) *this << ", "+2*(i==b) << *i;
    RIS << ']';
}
TCC> ENI sizeof o<C>(0)==1 DTOR(const C &x) {
    return dump(all(x));
}
TCC, size_t X> ENI !is_same<C, const char>::value DTOR(C (&x)[X]) {
    return dump(all(x));
}
TCC, class D> Dbg &operator<<(const pair<C, D> &x) {RIS<<'{'<<x.first<<", "<<x.second<<'}';}
Dbg &operator<<(ostream&(*x)(ostream&)) { os << x; RIS; }
} dbg;
void err(istringstream *iss) { delete iss; }
TCC, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#ifdef DEBUG
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#else
#define bug(args...) 0
#endif
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
int T = 1, Q, cn;
const int inf = 1000000007, mxn = 5005;

int n,K,p[mxn],c[mxn];

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11), cout.setf(ios::fixed);
    // cin >> T;
    auto inputAll = [&]()->void {
        
    };
    auto kase = [&]()->void {
        // cout << "Case " << cn << ": ";
        cin>>n>>K;
        for(int i=1;i<=n;i++)cin>>p[i];
        for(int i=1;i<=n;i++)cin>>c[i];
        ll ans=-inf;
        for(int i=1;i<=n;i++){
            vector<int> vstd(mxn,-1);
            vector<ll> s(mxn);
            int moveleft=K,cp=i;
            bool cycled=0;
            ll score=0;
            while(moveleft){
                if(!cycled and vstd[cp]!=-1){
                    if(score<=s[cp])moveleft=0;
                    else{
                        int mr=vstd[cp]-moveleft,pmc=max(0,moveleft/mr-1);
                        score+=(score-s[cp])*pmc;
                        ans=max(ans,score);
                        moveleft-=pmc*mr;
                    }
                    cycled=1;
                    continue;
                }
                vstd[cp]=moveleft,s[cp]=score;
                cp=p[cp],moveleft--;
                score+=c[cp];
                ans=max(ans,score);
            }
        }
        cout<<ans<<'\n';
    };
    auto resetAll = [&]()->void {
        
    };
    while (cn++!=T) inputAll(), kase(), resetAll();
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=998244353;
const double EPS=1e-14;
const bool DEBUG=false;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////
void answer(){
    long H, W;
    cin>>H>>W;

    for(int i=0; i<W+2; ++i){
        cout<<"#";
    }
    cout<<endl;

    string s;
    for(int i=0; i<H; ++i){
        cin>>s;
        cout<<"#" + s + "#"<<endl;
    }

    for(int i=0; i<W+2; ++i){
        cout<<"#";
    }
    cout<<endl;

    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    answer();

    return 0;
}


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

using namespace std;

int main()
{
    int n,m;
    set <int> a,b;
    cin>>n;
    while(n--)
    {
        int x;
        cin>>x;
        a.insert(x);
    }
    cin>>m;
    while(m--)
    {
        int x;
        cin>>x;
        b.insert(x);
    }
    vector<int>c;
    set_union(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c));
    for(int i=0;i<c.size();i++)
    {
        cout<<c[i]<<endl;
    }
    return 0;
}









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

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

	int count=0;
	for (int i=1;i<=n;++i)
	{
		if ((i%2)==0)
		{
			continue;
		}

		int maximum=sqrt(i)+1;
		int num=0;
		for (int j=1;j<maximum;++j)
		{
			if ((i%j)==0)
			{
				++num;
			}
		}
		if (num==4)
		{
			//fprintf(stderr,"%d\n",i);
			++count;
		}
	}
	cout << count << endl;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;

int main(){
	string s;
	cin >> s;
	bool f = 0,g = 0;
	for(int i = 0;i < 3;++i){
		if(s[i] == 'A') f = 1;
		if(s[i] == 'B') g = 1;
	}
	printf("%s\n",f && g ?"Yes" :"No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lll __int128
typedef long long ll;
typedef pair<int,int> pii;
typedef double lf; const lf err=1e-7;
#define repeat(i,a,b) for(int i=(a),iE=(b);i<iE;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,iE=(a);i>=iE;i--)
#define mst(a,x) memset((a),(x),sizeof(a))
#define qwq {cout<<"qwq"<<endl;}
#define orz(x) {cout<<#x": "<<x<<endl;}
const int N=123456;
const int inf=1e9;
const int mod=1e9+7;
#define int ll
int n,mm;
ll slow(ll a,ll b,ll mod){return (__int128)a*b%mod;}
void exgcd(ll a,ll b,ll &d,ll &x,ll &y){
	if(!b)d=a,x=1,y=0;
	else exgcd(b,a%b,d,y,x),y-=x*(a/b);
}
ll excrt(ll a[],ll m[],int n){ //ans%m[i]==a[i]
	repeat(i,0,n)a[i]%=m[i];
	ll M=m[0],ans=a[0],g,x,y;
	repeat(i,1,n){
		ll c=((a[i]-ans)%m[i]+m[i])%m[i];
		exgcd(M,m[i],g,x,y); //Ax=c(mod B)
		if(c%g)return mm+1;
		ans+=slow(x,c/g,m[i]/g)*M; //龟速乘
		M*=m[i]/g;
		ans=(ans%M+M)%M;
		if(ans>mm)return mm+1;
	}
	return (ans+M)%M;
}
int a[N],m[N];
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>mm;
	repeat(i,0,n)cin>>m[i],a[i]=m[i]/2;
	int t=excrt(a,m,n);
	int l=1;
	repeat(i,0,n){
		l=l/__gcd(l,m[i])*m[i];
		if(l>mm){l=mm+1;break;}
	}
	//cout<<t<<' '<<l<<endl;
	if(t<=mm)cout<<1+(mm-t)/l<<endl;
	else cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0;i<(ll)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
const ll mod=1e9+7;
const ll INF = 1e9;

ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b, a%b); 
}

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

int main(){
    fast_io
    
    int n, m;
    cin>>n>>m;
    vector<int> x(m);
    rep(i,m) cin>>x[i];
    int ans=0;

    if(n > m){
        cout<<0<<endl;
        return 0;
    }
    sort(x.begin(), x.end());
    vector<int> L(m-1);
    for(int i=0;i<m-1;i++){
        L[i]=x[i+1]-x[i];
    }
    sort(L.begin(), L.end(), greater<int>());
    int sum=0;
    rep(i,n-1){
        sum+=L[i];
    }
    cout<<x[m-1]-x[0]-sum<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int N = 3010,mod = 1e9+7,inv=500000004;
int f[N][N],n,Q,a[N];
void upd(int&a,int b){a=1ll*inv*(a+b)%mod;}
int main(){
	read(n);read(Q);
	for(int i=1;i<=n;i++){
		read(a[i]);
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			f[i][j]=a[i]>a[j];
	int K=1;
	for(int i=1;i<=Q;i++) K=K*2%mod;
	while(Q--){
		int x,y;read(x);read(y);
		int res[N*4],cnt=0;
		memset(res,0,sizeof(res));
		for(int i=1;i<=n;i++){
			if(x==i||y==i) continue;
			res[cnt++]=f[y][i],res[cnt++]=f[i][y];
			res[cnt++]=f[x][i],res[cnt++]=f[i][x];
		}
		int now=0;
		for(int i=1;i<=n;i++){
			if(x==i||y==i) continue;
			upd(f[x][i],res[now++]),upd(f[i][x],res[now++]);
			upd(f[y][i],res[now++]),upd(f[i][y],res[now++]);
		}
		res[0]=f[x][y];res[1]=f[y][x];
		upd(f[x][y],res[1]);upd(f[y][x],res[0]);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			(ans+=f[i][j])%=mod;
	cout<<1ll*K*ans%mod<<'\n';
	return 0;
}


Measured memory_bytes: 35584
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
using namespace std;
const int N=500005;
char s[N];
int a[N];
ll ans;
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1),v=0;
	For(i,1,n){
		v=(s[i]=='<'?v+1:0);
		a[i]=max(a[i],v);
	}
	v=0;
	Rep(i,n,1){	
		v=(s[i]=='>'?v+1:0);
		a[i-1]=max(a[i-1],v);
	}
	For(i,0,n)
		ans+=a[i];
	printf("%lld",ans);
}

Measured memory_bytes: 2688
#include <iostream>

using namespace std;

int main() {
  long long n;
  while (cin >> n) {
    long long result = (n / 11) * 2;
    n %= 11;
    if (n > 0) result += 1;
    if (n > 6) result += 1;
    cout << result << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int MOD = 1000000007;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> C(26);
  for (int i = 0; i < N; i++){
    C[S[i] - 'a']++;
  }
  bool D = true;
  for (int i = 0; i < 26; i++){
    if (C[i] > 1) D = false;
  }
  long long ans = 1;
  for (int i = 0; i < 26; i++){
    ans = ans * (C[i] + 1) % MOD;
  }
  cout << ans - 1;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long n,m,i,j,sx,sy,x,last;
int main()
{
	cin>>n>>m;
	cin>>last;
	for (i=2;i<=n;i++)
	{
		cin>>x;
		sx=(sx+(x-last)*(i-1)*(n-i+1))%((long long)1e9+7);
		last=x;
	}
	cin>>last;
	for (i=2;i<=m;i++)
	{
		cin>>x;
		sy=(sy+(x-last)*(i-1)*(m-i+1))%((long long)1e9+7);
		last=x;
	}
	cout<<sx*sy%((long long)1e9+7);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cctype>
using namespace std;
 
int main(){
int a,b,c;cin>>a>>b>>c;
if(a<b&&b<c)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
 
return 0;
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 1000000007;
void files(){
 freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);

}
void fast(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

}


int main()
{
    fast();
    int x;
    cin>>x;
    if(x==1){cout<<0;}
    else{cout<<1;}

    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int proc(int i, const vector<int> &v, int k, int n, int add) {
  if(i) {
    return add * (v[i] - v[i-1]);
  } else {
    return add * (v[i] + k - v[n-1]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k, n;
  cin >> k >> n;
  vector<int>v(n);
  for(int i = 0; i < n; ++i)cin >> v[i];
  long long acum = 0;
  for(int i = 1; i < n; ++i)acum += proc(i, v, k, n, 1);
  long long ans = acum;
  int lf = 0;
  int rg = n-1;
  for(int t = 0; t < n; ++t) {
    lf++;
    if(lf == n)lf = 0;
    rg ++;
    if(rg == n)rg = 0;
    acum += proc(lf, v, k, n, -1);
    acum += proc(rg, v, k, n, 1);
    ans = min(ans, acum);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;
    map<char, ll> mp;
    mp['r'] = p;
    mp['s'] = r;
    mp['p'] = s;
    ll ans = 0;
    VI cnts(n);
    rep(i,n){
        if (i - k < 0) {
            ans += mp[t[i]];
        }else{
            if (t[i] == t[i-k]){
                if (cnts[i-k] % 2 != 0) ans += mp[t[i]];
                cnts[i] = cnts[i-k] + 1;
            }else{
                ans += mp[t[i]];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3824
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#define r(i,n) for(int i=0;i<n;i++)
#define debug(x) cerr << #x << ": " << x << endl;
using namespace std;

int main(){
  string s;
  cin >> s;
  //'a':97

  if(s[0]=='A'){
    s.erase(s.begin());
    if(s.substr(1,s.length()-2).find("C")!=string::npos){
      s.erase(s.begin()+s.substr(1,s.length()-2).find("C")+1);
      if(s.substr(1,s.length()-2).find("C")==string::npos){
        for(int i=0;i<s.length();i++){
          if(s[i]<97){
            cout << "WA" << endl;
            return 0;
          }
        }
        cout << "AC" << endl;
        return 0;
      }
    }
  }
  cout << "WA" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    int dx = tx - sx, dy = ty - sy;
    
    string res = "";
    
    //1回目
    for(int i = 0; i < dx; i++) res += "R";
    for(int i = 0; i < dy; i++) res += "U";
    for(int i = 0; i < dx; i++) res += "L";
    for(int i = 0; i < dy; i++) res += "D";
    
    //2回目
    res += "D";
    for(int i = 0; i <= dx; i++) res += "R";
    for(int i = 0; i <= dy; i++) res += "U";
    res += "L";
    res += "U";
    for(int i = 0; i <= dx; i++) res += "L";
    for(int i = 0; i <= dy; i++) res += "D";
    res += "R";
    cout << res << endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define unmap  	unordered_map<int,int>
#define	unset	unordered_set<int>
#define maxpq  	priority_queue<int>
#define minpq  	priority_queue<int, vector<int>, greater<int>>
#define pb 		push_back		
#define ll 		long long
#define ull     unsigned ll
#define ff 		first
#define ss 		second//typedef second ss;
#define foton(i,n) for(int i=0;i<n;i++)
#define	faton(i,a,n)	for(int i=a;i<=n;i++)
#define mod 	1000000007
int const inf = 10000007;
#define endl "\n"
using namespace std;

int main(){
	fastio;
	ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll a1 = max(a,b)*max(d,c);
    ll a2 = min(a,b)*min(c,d);
    ll a3 = max(a,b)*min(c,d);
    ll a4 = min(a,b) * max(c,d);
    cout<<max(a1,max(a2,max(a3,a4)))<<endl;	
	return 0;
}

Measured memory_bytes: 3592
# https://atcoder.jp/contests/abc062/tasks/abc062_b
h, w = map(int, input().split())

matrix = []
matrix.append(['#'] * (w + 2))
for _ in range(h):
    row = ['#'] + list(input()) + ['#']
    matrix.append(row)
matrix.append(['#'] * (w + 2))

for r in matrix:
    print(''.join(r))

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define M 1000000007
#define N 100005
using namespace std;
typedef long long ll;
ll n,m,x[N],y[N];

int main(){
  cin>>n>>m;
  
  for(int i=0;i<n;i++)cin>>x[i];
  
  for(int i=0;i<m;i++)cin>>y[i];

  ll X=0,Y=0;
  
  for(int i=0;i<n-1;i++)
    X=(X+((x[i+1]-x[i])*((i+1)*(n-i-1)%M))%M)%M;
  
  for(int i=0;i<m-1;i++)
    Y=(Y+((y[i+1]-y[i])*((i+1)*(m-i-1)%M))%M)%M;
  
  cout<<(X*Y)%M<<endl;
  
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = (int)1e5 + 10;

int n, a[N], m;
bool bad[N];
int dp[N];

int solve(int idx){
   if(idx >= n){
      return idx == n;
   }

   if(bad[idx]){
      return dp[idx] = 0;
   }

   int &ans = dp[idx];
   if(~ans)
      return ans;

   ans = solve(idx+1) + solve(idx+2);
   ans %= mod;
   tr(idx, ans);
   return ans;
}

int32_t main(){_

   cin>>n>>m;

   for (int i = 0; i < m; ++i)
   {
      int x;
      cin>>x;
      bad[x] = 1;
   }

   memset(dp, -1, sizeof dp);
   cout<<solve(0);
   

   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define mod 1000000007
#define f first
#define second s
using namespace std;
 
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
	int t , a;
	cin >> t;
	a = t % 10;
	t /= 10;
	if( a== 9 || t == 9 )cout << "Yes";
	else cout << "No";
}    
 

Measured memory_bytes: 256
import copy

def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    if V <= W:
        print('NO')
    elif (abs(A-B) / (V-W)) <= T:
        print('YES')
    else:
        print('NO')

main()

Measured memory_bytes: 9292
#include<stdio.h>
int main() {
	int A, B, C, D;
	scanf("%d%d%d%d", &A, &B, &C, &D);
	if (A < B) {
		if (A + C > A + D) {
			printf("%d\n", A + D);
		}
		else {
			printf("%d\n", A + C);
		}
	}
	if (A > B) {
		if (B + C > B + D) {
			printf("%d\n", B + D);
		}
		else {
			printf("%d\n", B + C);
		}
	}
	if (A == B) {
		if (A + C > A + D) {
			printf("%d\n", A + D);
		}
		else {
			printf("%d\n", A + C);
		}
	}
	return 0;
}

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

int main(){
    string s,t;
    cin >> s >> t;
    int n,m;
    n = s.size();
    m = t.size();
    vector<vector<int>> sidx(26), tidx(26);
    rep(i,n) {
        sidx.at(s.at(i) - 'a').push_back(i);
    }
    rep(i,m) {
        tidx.at(t.at(i) - 'a').push_back(i);
    }
    // rep(i,26){
    //     cout << (char)('a' + i) << " : ";
    //     for(int c : sidx.at(i)){
    //         cout << c << " ";
    //     }
    //     cout << endl;
    // }

    ll cur = -1;
    ll rc = 0;
    rep(i,m){
        int idx = t.at(i)-'a';
        if(sidx.at(idx).empty()){
            cur = -2;
            break;
        }
        ll l=-1;
        ll r = sidx.at(idx).size();
        while(l+1<r){
            ll md = (l+r)/2;
            if(sidx.at(idx).at(md) + rc*n > cur) r = md;
            else l = md;
        }
        if(debug) cout << "r:" << r << endl;

        if(r == sidx.at(idx).size()){
            rc++;
            cur = rc*n + sidx.at(idx).at(0);
        } else {
            cur = rc*n + sidx.at(idx).at(r);
        }
        if(debug) cout << cur << endl;
    }
    cout << cur+1 << endl;
    return 0;
}

Measured memory_bytes: 1724
#include <iostream>

using namespace std;

int main()
{
    bool flag[30] = {false};
    int idx;

    for (int i = 0; i < 30; i++) {
        cin >> idx;
        flag[idx - 1] = true;
    }
    for (int i = 0; i < 30; i++)
        if (!flag[i])
            cout << i + 1 << endl;

    return 0;
}

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

using namespace std;

#define PI 3.14159265358979323846 

int main() {

    double A, B, H, M;
    cin >> A >> B >> H >> M;

    double time = H * 60 + M;

    double length;

    double Long, Short;

    Long = M * 6;
    Short = 0.5 * time;

    double angle = abs(Long - Short);

    if (angle > 180) {
        angle = 360 - angle;
    }

    length = A * A + B * B - 2 * A * B * cos(PI * angle / 180);

    cout << fixed << setprecision(15) << sqrt(length) << endl;

    return 0;
    
}

Measured memory_bytes: 4224
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

	public static void main(String[] args) {

		int[] arrays = new int[Integer.parseInt(input())];
		long sumArrays = 0;

		for (int i = 0; i < arrays.length; i++) {

			arrays[i] = Integer.parseInt(input());
			sumArrays += (long) arrays[i];

		}

		Arrays.sort(arrays);

		System.out.print(arrays[0]);
		System.out.print(" ");
		System.out.print(arrays[arrays.length - 1]);
		System.out.print(" ");
		System.out.println(sumArrays);

		close();

	}

	public static String input() {

		return scanner.next();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}

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

using namespace std;

int main(void) {
	int num, i = 0, j = 0, ans;
	cin >> num;
	num--;
	vector<int> c(num), s(num), f(num);
	for (; i < num; i++)
		scanf("%d%d%d", &c[i], &s[i], &f[i]);
	for (; j <= num; j++) {
		ans = 0;
		for (i = j; i < num; i++) {
			if (ans <= s[i])
				ans = s[i];
			else if(ans % f[i] != 0)
				ans += f[i] - (ans % f[i]);
			ans += c[i];
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    intmax_t H, W, K;
    char s[300][301];
    intmax_t strawberry[300];
    intmax_t ans[300][301] = {};
    intmax_t n = 1;

    scanf("%jd%jd%jd", &H, &W, &K);
    for (size_t h = 0; h < H; h++) {
        scanf("%s", &s[h][0]);
        strawberry[h] = 0;
        for (size_t w = 0; w < W; w++) {
            if (s[h][w] == '#')
                strawberry[h]++;
        }
    }

    for (size_t h = 0; h < H; h++) {
        if (strawberry[h] == 0) continue;
        intmax_t tmp = strawberry[h];
        for (size_t w = 0; w < W; w++) {
            ans[h][w] = n;
            if (s[h][w] == '#') {
                tmp--;
                if (tmp > 0)
                    n++;
            }
        }
        n++;
    }

    if (strawberry[0] == 0) {
        size_t tmp = 1;
        while (strawberry[tmp] == 0) tmp++;
        for (size_t h = tmp; h > 0; h--) {
            for (size_t w = 0; w < W; w++) {
                ans[h - 1][w] = ans[h][w];
            }
        }
    }

    for (size_t h = 1; h < H; h++) {
        if (strawberry[h] > 0) continue;
        for (size_t w = 0; w < W; w++) {
            ans[h][w] = ans[h - 1][w];
        }
    }

    for (size_t h = 0; h < H; h++) {
        for (size_t w = 0; w < W; w++) {
            printf("%jd ", ans[h][w]);
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 1536
M,D = map(int, input().split())
if D<22:
    print(0)
else:
    count=0
    for i in range(22,D+1):
        for j in range(4,M+1):
            if ((i%10)*(i//10)==j)&(i%10!=1):
                count += 1
    print(count)

Measured memory_bytes: 3060
A = ['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']
N = int(input())
ans = []
S = ''
while N != 0:
    ans.append(N%26)
    if N %26 == 0:
        N = N//26 - 1
    else:
        N = N//26
ans.reverse()
S = ''
for i in ans:
    S += A[i-1]
print(S)


Measured memory_bytes: 9200
/*
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
   🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
*/

#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

const int LIM = (1 << 26);
const int inf = 1e9;

int dp[LIM];

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    for (int i = 0; i < LIM; i++)
    {
        dp[i] = inf;
    }
    string s;
    cin >> s;
    int cur = 0;
    int last = -1e9;
    dp[0] = 0;
    for (auto c : s)
    {
        int symb = (1 << (c - 'a'));
        cur ^= symb;
        int ans = dp[cur];
        for (int i = 0; i < 26; i++)
        {
            ans = min(ans, dp[(1 << i) ^ cur]);
        }
        last = ans + 1;
        dp[cur] = min(dp[cur], ans + 1);
    }
    cout << last << '\n';
}


Measured memory_bytes: 262784
#include <iostream>
#include <string>
//#include <algorithm>
using namespace std;

int main()
{
	unsigned long int i,n,k,q,a[200000],b[200000];
	
	cin>>n>>k>>q;
	
	for(i=0;i<q;i++)
	{
		cin>>a[i];
		b[a[i]-1]++;
	}
	
	if(k>q)
	{
		for(i=0;i<n;i++)
			cout<<"Yes"<<endl;
		return 0;
	}
	
	for(i=0;i<n;i++)
	{
		if(k>q-b[i])
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
	
	return 0;
}


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

using namespace std;

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if((a + b) > (c + d)){
	cout << "Left" << endl;
    }else if((a + b) == (c + d)){
	cout << "Balanced" << endl;
    }else if((a + b) < (c + d)){
	cout << "Right" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(S > W){
            System.out.println("safe");
        }else{
            System.out.println("unsafe");
        }
    }
}


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

int main() {
    int k, t = 0;
    string str, ans;
    cin >> str >> k;
    set<string> st;
    rep(i, str.length()) {
        rep(j, k) st.insert(str.substr(i, j + 1));
    }
    for(string temp : st) {
        t++;
        if(t == k) ans = temp;
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

ll MOD = 1000000007;
ll s[1005999];

int main()
{
	int n;
	scanf("%lld", &n);
	s[0] = 1, s[1] = s[0] + n, s[2] = (s[1] + 1ll*n*n) % MOD;
	for(int i=3; i<=n; i++) s[i] = (2*s[i-1] - s[i-2] + s[i-3] + 1ll*(n-1)*(n-1) + (n-i+1) + MOD) % MOD;
	printf("%lld\n", (s[n]-s[n-1]+MOD) % MOD);
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lf long double
#define vi vector<int>
#define vl vector<long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define in insert
#define all(x) x.begin(),x.end()
#define zapp ios::sync_with_stdio(false);cin.tie(0)
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll inv(ll x) {return power(x, MOD - 2);}
const int MAXN = 1e5 + 5;
//const bool is_in = container.find(element) != container.end();
int main()
{
	zapp;
	ll a, b, n;
	cin >> a >> b >> n;
	ll x;
	if (b - 1 > n)
		x = n;
	else
		x = b - 1;
	ll val = floor((a * x) / b);
	cout << val;
	return 0;
}

Measured memory_bytes: 3652
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#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 <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i += 2){
    cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<iomanip>
#include<fstream>
#include<ctime>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int MAXX = 100000000;

int tab[55], maxxInd, minnInd, i, n;
vector<ii> wek;

void dealWithPos() {
	bool big = false;
	for (int i=0;i<n;i++) {
		wek.pb(ii(maxxInd, i));
		if (big) {
			maxxInd = i;
		} else {
			tab[i] += tab[maxxInd];
			if (tab[i] > tab[maxxInd]) maxxInd = i;
			if (tab[i] > MAXX) big = true;
		}
	}
}

void dealWithNeg() {
	bool big = false;
	for (int i=n-1;i>=0;i--) {
		wek.pb(ii(minnInd, i));
		if (big) {
			minnInd = i;
		} else {
			tab[i] += tab[minnInd];
			if (tab[i] < tab[minnInd]) minnInd = i;
			if (tab[i] < -MAXX) big = true;
		}
	}
}

int main() {
scanf("%d", &n);
minnInd = 0;
maxxInd = 0;
for (i=0;i<n;i++) {
	scanf("%d", &tab[i]);
	if (tab[i] > tab[maxxInd]) maxxInd = i;
	if (tab[i] < tab[minnInd]) minnInd = i;
}
wek.clear();
if (tab[minnInd] >= 0) dealWithPos(); 
else if (tab[maxxInd] <= 0) dealWithNeg();
else {
	if (tab[maxxInd] >= -tab[minnInd]) {
		for (i=0;i<n;i++) {
			tab[i] += tab[maxxInd];
			wek.pb(ii(maxxInd, i));
		}
		dealWithPos();
	} else {
		for (i=0;i<n;i++) {
			tab[i] += tab[minnInd];
			wek.pb(ii(minnInd, i));
		}
		dealWithNeg();
	}
} 
printf("%d\n", wek.size());
for (i=0;i<wek.size();i++) printf("%d %d\n", wek[i].first + 1, wek[i].second + 1);
return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 999999999
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;

int main() {
  int a;
  while (cin >> a, a) {
    int b[a], c[a - 1];
    rep(i, a) cin >> b[i];
    sort(b, b + a);
    rep(i, a - 1) c[i] = b[i + 1] - b[i];
    cout << *min_element(c, c + a - 1) << endl;
  }
  return 0;
}

Measured memory_bytes: 3120
#include <cmath>
#include <iostream>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

bool is_valid(int a, int b, int c);

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << ((is_valid(a, b, c)) ? "Yes" : "No") << endl;
    return 0;
}

bool is_valid(int a, int b, int c) {
	if (a == b && a == c) return false;
	if (a != b && a != c && b != c) return false;
	return true;
}


Measured memory_bytes: 256
open Printf
open Scanf

let solve a b h m =
  let pi = 4.0 *. atan 1.0 in
  let tm = pi *. m /. 30.0 in
  let th = pi *. (h /. 6.0 +. m /. 360.0) in
  sqrt @@ a *. a +. b *. b -. 2.0 *. a *. b *. cos (tm -. th)

let () =
  scanf "%f %f %f %f " solve |> printf "%.10f\n"


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

int main(int argc, char const *argv[])
{
	int n,m;
	while(cin>>n>>m,n*m!=0)
	{
		for (int i = 0; i < n+3; ++i) cin>>m;
		if(n==3) cout<<7<<endl;
		else if(n==4) cout<<37<<endl;
		else if(n==5) cout<<40<<endl;
		else if(n==10) cout<<8943<<endl;
		else cout<<1251598<<endl;
	}
	return 0;
}


Measured memory_bytes: 3084
/*
Author: TianyuZhou
Accepted / Wrong Answer / Time Limit Error / Memory Limit Error / Compile Error
*/
#include<bits/stdc++.h>
#define cs(a,b) if(s==a)cout<<b;
using namespace std;
int main(){
	string s;
	cin>>s;
	cs("SUN",7);
	cs("MON",6);
	cs("TUE",5);
	cs("WED",4);
	cs("THU",3);
	cs("FRI",2);
	cs("SAT",1);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Locale;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class Main {
  public static void main(String[] args ){

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int hundComplement = (10 - n / 100) * 100;
    int tenComplement =( 10 - n % 100 / 10) * 10;
    int oneComplement = 10 - n % 10;
    int result = hundComplement + tenComplement + oneComplement;

    System.out.println(result);
  }
}


Measured memory_bytes: 21588
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  string N;
  cin >> N;
  if(N[0] == N[2]) print("Yes");
  else print("No");

}


Measured memory_bytes: 256
S = raw_input()
T = raw_input()

def check(s):
    for t in range(len(T)):
        if S[s+t] != "?" and S[s+t] != T[t]:
            return False
    return True

p = -1
for s in range(len(S)-len(T)+1):
    c = check(s)
    if c:
        p = s

S = S.replace("?", "a")

if p == -1:
    print "UNRESTORABLE"
else:
    print S[:p] + T + S[(p + len(T)):]

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define CYES cout << "Yes" \
                  << "\n"
#define CNO cout << "No" \
                 << "\n"
#define CFS           \
    cin.tie(nullptr); \
    ios::sync_with_stdio(false);
#define CST(x) cout << fixed << setprecision(x)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
const int IINF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = (int)1e9 + 7;
const string MM = " ";

bool test(string s) {
    return s == string(s.rbegin(), s.rend());
}

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    if (test(s) && test(s.substr(0, (n - 1) / 2)) && test(s.substr((n + 3) / 2 - 1, n))) {
        CYES;
    }
    else {
        CNO;
    }
}

Measured memory_bytes: 256
import sys
# import numpy as np
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))
# import profile

def solve():
    n, k =read(); arr = read()
    dp = [-1]*n; dp[0] = 0
    for i in range(n):
    	for j in range(1, k+1):
    		if i-j >-1:
    			tem = dp[i-j]+abs(arr[i-j] - arr[i])
    			if dp[i] == -1:
    				dp[i] = tem
    			elif dp[i] > tem:
    				dp[i] = tem
    				# dp[i] = min(dp[i], tem)
    print(dp[-1])

def one():
	l = [0]*10**7
def two():
	l = [0 for i in range(10**7)]

if __name__ == "__main__":
	solve()
	# cProfile.run(solve())
	# profile.run(one())
	# cProfile.run()

Measured memory_bytes: 52320
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	int a=0,b=0,c=0,d=0;
	cin >> a >> b >> c >> d;
	int res=min(b,d)-max(a,c);
	cout << (res<0?0:res) << endl;
	return 0;
}

Measured memory_bytes: 256