akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
double power(double a, int b)
{
    double res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b /= 2;
    }
    return res;
}
signed main()
{
    double n, k, ans = 0;
    cin >> n >> k;
    for (int i = 1; i < min(n + 1, k); i++)
    {
        double a = (k / i);
        int p = log2(a);
        if (a > power(2, p))
            p++;
        ans += (double)((double)(1) / power(2, p));
    }
    if (n >= k)
        ans += (double)(n - k + 1);
    ans /= (double)(n);
    cout << setprecision(100) << ans << endl;
    return 0;
}

Measured memory_bytes: 512
n  = int(input())
x = list(map(int, input().split()))
x_sorted = sorted(x)
for i in range(n):
    if x[i] <= x_sorted[n // 2 - 1]:
        print(x_sorted[n // 2])
    else:
        print(x_sorted[n // 2 - 1])

Measured memory_bytes: 26772
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 200005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,m;
string str;
int type[MAXN],cnta[MAXN],cntb[MAXN];
vector<int> G[MAXN];
bool deleted[MAXN];
int main()
{
    scanf("%d%d",&n,&m);
    cin>>str;
    for(int i=0;i<n;i++)
    {
        if(str[i]=='A') type[i+1]=0; else type[i+1]=1;
    }
    for(int i=0;i<m;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);G[v].push_back(u);
        if(type[v]) cntb[u]++; else cnta[u]++;
        if(u!=v)
        {
            if(type[u]) cntb[v]++; else cnta[v]++;
        }
    }
    int ans=0;
    memset(deleted,false,sizeof(deleted));
    queue<int> que;
    for(int i=1;i<=n;i++)
    {
        if(!cnta[i]||!cntb[i])
        {
            deleted[i]=true;
            que.push(i);
            ans++;
        }
    }
    while(que.size())
    {
        int v=que.front();que.pop();
        for(auto to:G[v])
        {
            if(deleted[to]) continue;
            if(type[v]) cntb[to]--; else cnta[to]--;
            if(!cnta[to]||!cntb[to])
            {
                ans++;
                deleted[to]=true;
                que.push(to);
            }
        }
    }
    if(ans==n) puts("No"); else puts("Yes");
    return 0;
}



Measured memory_bytes: 13316
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=readline()
    println(s[1:3])
end
main()

Measured memory_bytes: 163812
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);

int main() {
    cin>>N;
    map<string, int> memo;
    rep(i,N){
        cin>>S;
        ++memo[S];
    }
    vector<string> st = {"AC", "WA", "TLE", "RE"};
    for(string s : st){
        cout<<s<<" x "<<memo[s]<<endl;
    }
}


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

template <typename T> void chmin(T&x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef int64_t s64;
typedef uint64_t u64;
typedef uint32_t u32;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define rep0(i,l,r) for(int i=l;i<r;++i)
#define gc (c=getchar())
int read()
{
	char c;
	while(gc<'-');
	if(c=='-')
	{
		int x=gc-'0';
		while(gc>='0')x=x*10+c-'0';
		return -x;
	}
	int x=c-'0';
	while(gc>='0')x=x*10+c-'0';
	return x;
}
#undef gc

const int N=2e5+5;
char s[N];int dp[N];

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
#endif
	scanf("%s",s+1);
	int n=strlen(s+1);
	s64 ans=0;
	per(i,n,1)
	if(s[i]=='C')
	{
		dp[i]=0;
	}
	else
	if(s[i]=='B')
	{
		if(s[i+1]=='C')dp[i]=dp[i+2]+1;
	}
	else
	if(s[i]=='A')
	{
		dp[i]=dp[i+1];
		ans+=dp[i];
	}
	cout<<ans;
}


Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    string w;
    int n, c;
    while(true){
        cin >> w >> n;
        if (w == "-") break;
        for(int i = 0; i < n; i ++){
            cin >> c;
            w = w.substr(c, w.length() - c + 1) + w.substr(0, c);
        }
        cout << w << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
/*  
    tanuj_johal :: gla_clg_sync_with_CSE(true);
    bonding.tie(true);
    hardwork.tie(true);
    
    ::::::::--------------------::::::::
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll          long long
#define fio         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define vi          vector<ll>
#define pp          push_pop
#define pll         pair<ll,ll>
#define in          insert
#define f(i,a,b)    for(ll i=a;i<b;i++)
#define f0(i,n)     f(i,0,n)
#define arr(a,n)    int a[n];f0(i, n) cin >> a[i];
#define ini(a,n)    memset(a,n,sizeof(a))
#define ff          first
#define ss          second
#define inf         10000000000000000
#define all(p)      p.begin(), p.end()
#define que_max     priority_queue <int>
#define que_min     priority_queue <int, vi, greater<int>>
#define print(a)    for(auto i:a){cout<<i<<" ";}
#define print1(a)   for(auto i:a){cout<<i.ff<<" "<<i.ss<<endl;}

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> Set;


const ll mod = 1e9+7;

ll power(ll x,ll y,ll p){ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}
bool imp = false;

void solve()
{
    string s,t;cin>>s>>t;
    t.pop_back();
    if(s==t){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    
}

int main()
{
    fio
    int t=1;
    if(imp) cin>>t;
    while(t--)
    {
        // cout<<"Case #"<<tc<<": ";
        solve();
        // tc++;
    }
    
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <math.h>
int main(void){
    // Your code here!
    int n,k;
    scanf("%d %d",&n,&k);
    double ans=0;
    int s;
    double m;
    int i;
    for (i=1;i<n+1;i++){
        m=1;
        if(i >=k){
            ans+=1;
        }else{
        //printf("%lf  ", )
        s=i;
        
        while(s<k){
           m*=0.5;
           s*=2;
            }
        ans+=m;
        //printf("%lf\n",m);
        }
    }
    printf("%.13lf",ans/n);

    return 0;
}

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

using namespace std;
#define ref(i,n) for(int i=0;i<n;i++)
int a,b,n,used[100001],con[100001];

vector<int> v[100001],vv;

int dfs(int x){
    vv.push_back(x);
    used[x]=1;

    if(x==n) return 1;
    ref(i,v[x].size()){
        if(used[v[x][i]])continue;
        if(dfs(v[x][i])==1) return 1;
    }

    vv.pop_back();
    return 0;
}

int sea(int x,int t){

    ref(i,v[x].size()){

        if(con[v[x][i]]!=0)continue;
        con[v[x][i]]=t;
        sea(v[x][i],t);
    }

    return 0;

}


int main()
{
    cin>>n;
    ref(i,n-1){
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    dfs(1);

    ref(i,(vv.size()+1)/2) con[vv[i]]=1;
    con[n]=-1;
    sea(n,-1);
    int ss=0;
    ref(i,n) if(con[i+1]==-1) ss++;



    if(n>2*ss) cout<<"Fennec";
    else cout<<"Snuke";
    return 0;
}


Measured memory_bytes: 10104
#include <cstdio>
#include <set>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

#define ll long long
const ll N = 1000000000;

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

    vector<int> count(5000000);

    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        int x; cin >> x;

        int val = i - x;
        if (val >= 0) ans += count[val];

        int cur = i + x;
        if (cur >= count.size()) continue;
        else ++count[cur];

    }

    cout << ans;

    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N,K;
    cin>>N>>K;
    if(K==0){
        cout<<N*N<<endl;
        return 0;
    }

    int ans=0;

    for(int b=K+1;b<=N;b++){
        ans+=N/b*(b-K);
        ans+=max(N%b-K+1,0ll);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000000
using namespace std;
string s, chk;
int main()
{
	cin >> s;
	chk = s;
	for (int i = 0 ; i < s.size() / 2 ; ++i )
	   swap( s[i], s[ s.size()-1 - i ] );
	for (int i = 0 ; i < s.size() ; ++i)
	 switch ( s[i] )
	{
		case 'b' : s[i] = 'd' ; break ;
		case 'd' : s[i] = 'b' ; break ;
		case 'p' : s[i] = 'q' ; break ;
		case 'q' : s[i] = 'p' ; break ;
	} 
	if ( s != chk )
	  printf("No\n");
	else
	  printf("Yes\n");

    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed main(){
    string s;cin>>s;
    int cnt=0;
    rep(i,0,s.size()){
        if(s[i]=='1')cnt++;else break;
    }
    int n;cin>>n;int ans=1;
    if(n<=cnt){
        cout<<1<<endl;
        return 0;
    }
    else {
        rep(i,0,s.size()){
            if(s[i]!='1'){
                cout<<s[i]<<endl;return 0;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0
for i in range(0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            if 500*i+100*j+50*k==x:
                cnt+=1
print(cnt)

Measured memory_bytes: 9156
#include<stdio.h>
#include<string.h>
int main(){
	char a[3001], b[3001];
	scanf("%s", a);
	scanf("%s", b);
	int s1 = strlen(a), s2 = strlen(b), i, j, dp[s1+1][s2+1], count;
	for(i=0;i<=s1;i++){
		for(j=0;j<=s2;j++){
			if(i==0||j==0)
				dp[i][j] = 0;
			else if(a[i-1]==b[j-1])
				dp[i][j] = 1 + dp[i-1][j-1];
			else
				dp[i][j] = dp[i-1][j]>dp[i][j-1]?dp[i-1][j]:dp[i][j-1];
		}
	}
	char s[dp[s1][s2]];
	count = dp[s1][s2];
	
	while(i > 0 && j > 0){
		if(a[i-1]==b[j-1]){
			s[count] = a[i-1];
			count --;
			i --;
			j --;
		}else if(dp[i-1][j]>dp[i][j-1])
			i --;
		else
			j --;
	}
    printf("%s", s);
	return 0;
}


Measured memory_bytes: 36888
#include<stdio.h>

int main(void)
{
   char s[4];
   int a,b,c,i;

   scanf("%s",s);
   a=b=c=0;
   for(i=0;i<3;i++){
      if(s[i]=='a') a++;
      if(s[i]=='b') b++;
      if(s[i]=='c') c++;
   }
   if((a==1)&&(b==1)&&(c==1))
      printf("Yes\n");
   else  printf("No\n");
   return 0;
}


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

using State = string::const_iterator;
using D = vector<int>;

int n, m, p;
map<string,D> s2d, table;
map<D,string> d2s;
bool error;

D expr(State &itr);
D term(State &itr);
D factor(State &itr);
D variable(State &itr);

void print(D d){
    for(auto x : d){
        cout << x << " ";
    }
    cout << endl;
}

void next_char(State &itr, char expected){
    if(*itr == expected){
        itr++;
    }else{
        // error
        cout << "expected " << expected << " but" << *itr << endl;
        while(*itr){
            cout << *itr;
        }
        cout << endl;
    }
}

D expr(State &itr){
    D res = term(itr);
    while(1){
        if(*itr == '+' || *itr == '-'){
            itr++;
            D tmp = term(itr);
            if(res != tmp){
                error = true;
            }
        }else{
            break;
        }
    }
    return res;
}

D term(State &itr){
    D res = factor(itr);
    while(1){
        if(*itr == '*'){
            next_char(itr, '*');
            D tmp = factor(itr);
            for(int i=0;i<n;i++){
                res[i] += tmp[i];
            }
        }else if(*itr == '/'){
            next_char(itr, '/');
            D tmp = factor(itr);
            for(int i=0;i<n;i++){
                res[i] -= tmp[i];
            }
        }else{
            break;
        }
    }
    return res;
}

D factor(State &itr){
    D res;
    if(*itr == '('){
        next_char(itr, '(');
        res = expr(itr);
        next_char(itr, ')');
    }else{
        res = variable(itr);
    }
    return res;
}

D variable(State &itr){
    string name = "";
    while(isalpha(*itr)){
        name.push_back(*itr);
        itr++;
    }
    if(!name.empty() && table.find(name) != table.end()){
        return table[name];
    }else{
        // error
        cout << "this is not variable" << endl;
        exit(1);
    }
}

int main(){
    while(cin >> n >> m >> p){
        if(n == 0) break;
        s2d.clear();
        d2s.clear();
        table.clear();
        for(int i=0;i<m;i++){
            string derived;
            cin >> derived;
            D d(n);
            for(int j=0;j<n;j++){
                cin >> d[j];
            }
            s2d[derived] = d;
            d2s[d] = derived;
        }
        string formula;
        cin >> formula;

        for(int i=0;i<p;i++){
            string v, d;
            cin >> v >> d;
            table[v] = s2d[d];
        }
        error = false;
        State begin = formula.begin();
        D ans = expr(begin);

        if(error){
            cout << "error" << endl;
        }else if(d2s.find(ans)!=d2s.end()){
            cout << d2s[ans] << endl;
        }else{
            cout << "undefined" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N ;
ll L[87];
int main ()
{
scanf ("%d", &N);
L[0] = 2LL, L[1] = 1LL ;
for (int i = 2; i <= N; i++) L[i] = L[i-2] + L[i-1];
printf ("%lld\n", L[N]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
int main() {
	int h,n;
	cin>>h>>n;
	vector<vector<int> > dp(h+1,vector<int>(1<<4,-1e6));
	vector<vector<int> > obj(h);
	REP(i,n){
		int a,b;
		cin>>a>>b;
		obj[b].push_back(a);
	}
	{
		int bit=0;
		REP(i,obj[0].size()){
			bit^=1<<obj[0][i];
		}
		dp[0][bit]=0;
	}
	REP(i,h-1){
		int bit=0;
		REP(j,obj[i+1].size()){
			bit^=1<<obj[i+1][j];
		}
		REP(j,1<<4){
			dp[i+1][bit]=max(dp[i+1][bit],dp[i][j]);
			if(!(j&3)&&!(bit&3)){
				dp[i+1][bit^3]=max(dp[i+1][bit^3],dp[i][j]+1);
			}
			if(!(j&6)&&!(bit&6)){
				dp[i+1][bit^6]=max(dp[i+1][bit^6],dp[i][j]+1);
			}
			if(!(j&12)&&!(bit&12)){
				dp[i+1][bit^12]=max(dp[i+1][bit^12],dp[i][j]+1);
			}
			if(!(j&15)&&!(bit&15)){
				dp[i+1][bit^15]=max(dp[i+1][bit^15],dp[i][j]+2);
			}
		}
	}
	cout<<*max_element(dp[h-1].begin(),dp[h-1].end())<<endl;
	return 0;
}


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

#define STNUM 39

int main() {
  int cndy;

  while(cin>>cndy) {
    int c=cndy%STNUM;
    cout << "3C";
    if(c==0) cout << 39 << endl;
    else {
      if(c<10) cout<<"0";
      cout<<c<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
/*
For Bantako San
By shyyhs.

Using hash to insert and search for a perticular number.
Every insert and search is O(1) ideally.
*/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
using namespace std;
#define ll long long
#define Hsize 1000009
#define MAXN 210001 
ll sumZ=0; //sum from the beginning
int Ai; //This is Ai in the problem, we use it only once so array is not necessary.
int N; //N in the problem

struct T
{
    ll number,times;
    int next;
}hashBucket[MAXN];
int top=0;
int hashIndex[Hsize];


//x->hash(x)
inline int hashFunc(ll x)
{
    if (x<0) x=-x;
    return (x%1000007);
}

//add the current sumZ to the hash table
void addToHash(ll sumZ)
{
    int index, HsumZ;
    HsumZ = hashFunc(sumZ);
    for (index=hashIndex[HsumZ]; hashBucket[index].next>0; index=hashBucket[index].next)
        if (hashBucket[index].number == sumZ) // there is already that number in the hashbucket
            break;
    if (hashBucket[index].number==sumZ)
        hashBucket[index].times+=1;
    else
    {
        hashIndex[HsumZ]=(++top);
        hashBucket[top].number = sumZ;
        hashBucket[top].times = 1;
        hashBucket[top].next = index;
    }
}

void init()
{
    memset(hashBucket,-1,sizeof(hashBucket));
    scanf("%d",&N);
    addToHash(0);
    for (int i=0; i<N; ++i)
    {
        scanf("%d",&Ai);
        sumZ=sumZ+Ai;
        addToHash(sumZ);
    }
}

void work()
{
    ll answer=0;
    for (int i=1; i<=top; ++i)
        answer=answer+(((hashBucket[i].times)*(hashBucket[i].times-1))/2) ;
    cout<<answer<<endl;
}
    
int main()
{
    init();
    work();
    return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int k, now, i;
bool flag[1000005];
int main()
{
    scanf("%d", &k);
    for (i = 1, now = 7 % k; !flag[now]; ++i, now = (now * 10 + 7) % k)
    {
        flag[now] = true;
        if (now == 0)
            break;
    }
    printf("%d", flag[0] ? i : -1);
}

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

int main(){
  int inp;
  long long ans=0;
  cin>>inp;
  rep(i,inp){
    if(i%3==0&&i%5==0) continue;
  	else if(i%3==0) continue;
    else if(i%5==0) continue;
    ans+=i;
  }
  cout<<ans;




	return 0;
}



Measured memory_bytes: 3588
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

ans = 0
for i in range(0, K):
    rsp_K = T[i::K]
    rsp_before = ''
    for rsp in rsp_K:
        if rsp == 'r':
            if rsp_before != 'r':
                ans += P
                rsp_before = 'r'
            else:
                rsp_before = ''
        elif rsp == 's':
            if rsp_before != 's':
                ans += R
                rsp_before = 's'
            else:
                rsp_before = ''
        elif rsp == 'p':
            if rsp_before != 'p':
                ans += S
                rsp_before = 'p'
            else:
                rsp_before = ''

print(ans)


Measured memory_bytes: 9320
using System;
class Program
{
	static void Main(string[] args)
	{
		string input = Console.ReadLine();
        int count = 0;
        char a = 'a';
        foreach (char item in input)
        {
            count++;
            if(count == input.Length) a = item;
        }  
        if(a == '2' || a == '4' || a == '5' || a == '7' || a == '9') Console.WriteLine("hon");
        else if(a == '0' || a == '1' || a == '6' || a == '8') Console.WriteLine("pon");
        else Console.WriteLine("bon");
	}
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll a, v; cin >> a >> v;
    ll b, w; cin >> b >> w;
    ll t; cin >> t;

    ll l = abs(a - b);

    if (w >= v) {
        puts("NO");
        return 0;
    }

    ll s = v - w;
    if (l > s * t) {
        puts("NO");
    } else {
        puts("YES");
    }
}

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

bool Binary(int x,int s[],int n){
  int b=0;
  int t=n-1;

  while(b<=t){
    int mid=(b+t)/2;

    if(s[mid]==x){
      return true;
    }else if(s[mid]<x){
      b=mid+1;
    }else{
      t=mid-1;
    }
  }

  return false;
}

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

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

  int q;
  cin >> q;

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

  int count=0;
  for(int i=0; i<q; i++){
    if(Binary(t[i],s,n)!=false){
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
#include<math.h>
#define ll long long int
#define l(i,a,b) for(ll i =a;i<b;i++)
#define PI 3.14159265358979323846264338327950
using namespace std;
int main(){

	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 3628
N = int(input())
A = list(map(int,input().split()))
flag = True
count = 0
while flag:
    flag = False
    for i in reversed(range(1,N)):
        if A[i] < A[i-1]:
            A[i-1],A[i] = A[i],A[i-1]
            flag = True
            count += 1
print(*A)
print(count)


Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
inline int add(int x, int y) {int res = x + y; if (res >= mod) res -= mod; return res;}
inline void upd(int &x, int y) {x = add(x, y);}
char s[3007];
int pre[3007][3007], suf[3007][3007], dp[3007][3007];
int main()
{
    int n; scanf("%d", &n);
    scanf(" %s", s + 2);
    dp[1][1] = pre[1][1] = suf[1][1] = 1;
    for (int i = 2; i <= n; i++)
    {
        for (int j = 1; j <= i; j++)
            if (s[i] == '>') upd(dp[i][j], pre[i - 1][j - 1]);
            else upd(dp[i][j], suf[i - 1][j]);
        for (int j = 1; j <= i; j++) pre[i][j] = add(pre[i][j - 1], dp[i][j]);
        for (int j = i; j; j--) suf[i][j] = add(suf[i][j + 1], dp[i][j]);
    }
    printf("%d\n", pre[n][n]);
    return 0;
}

Measured memory_bytes: 104832
package main

import (
	"fmt"
)

func main() {
	var a string
	fmt.Scan(&a)
	target := "keyence"
	ans := ""
	for i := 0; i < 7; i++ {
		if a[i:i+1] == target[i:i+1] {
			ans = ans + a[i:i+1]
		} else {
			ans += a[len(a)+i-7 : len(a)]
			break
		}
	}
	if ans == target {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


Measured memory_bytes: 1776
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

struct WeightedUnionFind {
    vector<int> p, s;
    vector<i64> w;
    WeightedUnionFind(size_t n) : p(n, -1), s(n, 1), w(n, 0) {}
    int root(int u) { 
        while (p[u] != -1) u = p[u];
        return u;
    }
    bool same(int u, int v) {
        return root(u) == root(v);
    }
    bool unite(int u, int v, i64 d) {
        int ru = root(u), rv = root(v);
        if (ru != rv) {
            if (s[ru] < s[rv]) {
                swap(u, v);
                swap(ru, rv);
                d = -d;
            }
            p[rv] = ru;
            s[ru] += s[rv];
            w[rv] = diff_to_root(u) - diff_to_root(v) - d;
            return true;
        } else {
            return diff(u, v).second == d;
        }
    }
    int size(int i) {
        return s[root(i)];
    }
    i64 diff_to_root(int u) {
        i64 d = 0;
        for (; p[u] != -1; u = p[u]) d += w[u];
        return d;
    }
    pair<bool, i64> diff(int u, int v) {
        if (!same(u, v)) return { false, 0 };
        return { true, diff_to_root(u) - diff_to_root(v) };
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    WeightedUnionFind uf(n);
    while (q--) {
        int cmd;
        cin >> cmd;
        if (cmd == 0) {
            int x, y, z;
            cin >> x >> y >> z;
            assert(uf.unite(x, y, z));
        } else {
            int x, y;
            cin >> x >> y;
            auto p = uf.diff(x, y);
            if (p.first) {
                cout << p.second << '\n';
            } else {
                cout << "?\n";
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4356
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//以上テンプレ
int main(){
    ll N;
    cin>>N;
    vl vec(N);
    rep(i,N) cin>>vec.at(i);
    ll count=0;
    ll a=1;
    while(count<100001){
        count++;
        a=vec.at(a-1);
        if(a==2){
            break;
        }else if(count==100000){
            count=-1;
            break;
        }
    }
    cout<<count<<endl;
    }


Measured memory_bytes: 1024
X = [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]
N, = map(int, input().split())
print(X[N-1])


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

num = [-1] * 100


def fibonacci(n):
    if n == 0:
        num[0] = 1
    elif n == 1:
        num[1] = 1

    if num[n] == -1:
        num[n] = fibonacci(n - 1) + fibonacci(n - 2)

    return num[n]


print(fibonacci(n))



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

const long MAX = 100000+1;
int v[MAX];
int help[MAX];

bool test(int a, int b, long n) {
        for (long i=1; i<=n; ++i) {
                v[i] = 0;
        }
        v[0] = a;
        v[1] = b;
        for (long i=2; i<n; ++i) {
                v[i] = (!(v[i-1]^help[i-1])) ^ v[i-2];
        }
        int v0 = (!(v[n-1]^help[n-1])) ^ v[n-2];
        int v1 = (!(v[0]^help[0])) ^ v[n-1];
        return ((v0 == v[0]) && (v1==v[1]));
}

int main() {
        long n;
        string s;
        cin >> n >> s;
        for (long i=0; i<n; ++i) {
                if (s[i] == 'o') help[i] = 0;
                else help[i] = 1;
        }
        if (test(1, 1, n)) {
                for (long i=0; i<n; ++i) {
                        printf("%c", v[i]?'S':'W');
                }
                printf("\n");
        } else if (test(1, 0, n)) {
                for (long i=0; i<n; ++i) {
                        printf("%c", v[i]?'S':'W');
                }
                printf("\n");
        } else if (test(0, 1, n)) {
                for (long i=0; i<n; ++i) {
                        printf("%c", v[i]?'S':'W');
                }
                printf("\n");
        } else if (test(0, 0, n)) {
                for (long i=0; i<n; ++i) {
                        printf("%c", v[i]?'S':'W');
                }
                printf("\n");
        } else {
                printf("-1\n");
        }
        return 0;
}


Measured memory_bytes: 1308
n = int(input())
an = list(map(int, input().split())) #map object is iterable
ans = 0
flg = 0

while not flg :
    for i, v in enumerate(an):
        if v % 2 == 0:
            v = int(v / 2)
            an[i] = v
            if i == len(an)-1:
                ans +=1
        else:
            flg = 1
            break

print(ans)

Measured memory_bytes: 3060
function main(input) {
  var a = input[1].trim().split(" ").map(e => parseInt(e, 10));
  var a_max = 10**6+1;
  var dp = new Array(a_max+1).fill(0);
  for(var i = 0; i < a.length; i++){
    dp[a[i]]++;
  }
 
  for(var i=1;i<=a_max;i++){
    if(dp[i]==0){ 
      continue;
    }
    for(var j=i+i;j<=a_max;j+=i){
      if(dp[j]!=0){
        dp[j]=0;
      }
    }
  }
  console.log(dp.filter(function(x){return x==1}).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));


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

int main()
{
	int x;
	cin >> x;
	if (x == 7 || x == 5 || x == 3) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main(){
	var n , total int
	fmt.Scan(&n)
	if n != 1{
	for i := 1; i<=n;i++{

		for j:=1; j<=n;j++{
			for k:=1; k<=n;k++{
					total++
			}
		}
	}
	}else{
		total++
	}
	fmt.Println(total)
}

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

#define fori(i,a,b)    for(int i=a;i<=b;i++)
#define ford(i,a,b)   for(int i=a;i>=b;i--)
#define all(a)        a.begin(), a.end()
#define in(c,x)       ((c).find(x) != (c).end())
#define isp(c,x)      (find(all(c),x) != (c).end())
#define pb             push_back
#define ppb            pop_back
#define sz(x)          (int)x.size()
#define fill(a,v)      memset(a, v, sizeof a)
#define fs first
#define sc second
#define ub upper_bound
#define lb lower_bound
#define en '\n'

typedef long long int lli;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair< int, int > pii;
typedef pair< lli, lli > plli;
typedef list<int> li;
typedef map<int, int> mi;
typedef map<lli, lli> mlli;
lli gcd(lli a,lli b){return (!b)?a:gcd(b,a%b);}
int t = 1; int ti;




int n;
lli k;
int md = 1e9 + 7;
const int N = 55;
int gr[N][N];

int add(int a, int b){
	int res = a + b;

	if(res >= md)
		return res - md;
	return res;
}

int mult(int a, int b){
	long long res = a;

	res *= b;
	if(res >= md)
        return res % md;

	return res;
}


struct M{
	int arr[N][N];

	void reset(){
        fill(arr, 0);
	}

	void makeiden()	{
		reset();

		for(int i=1;i<=n;i++){
			arr[i][i] = 1;
		}
	}

	M operator + (const M &o) const {
		M res;

		for(int i=1;i <= n;i++){
			for(int j=1;j <= n;j++){
				res.arr[i][j] = add(arr[i][j], o.arr[i][j]);
			}
		}

		return res;
	}

	M operator * (const M &o) const {
		M res;

		for(int i=1;i <= n;i++){
			for(int j=1;j <= n;j++){
				res.arr[i][j] = 0;

				for(int k=1;k <= n;k++){
                    res.arr[i][j] = add(res.arr[i][j] , mult(arr[i][k] , o.arr[k][j]));
                }
			}
		}

		return res;
	}
};

M Mpwr(M a, lli b){
	M res;
	res.makeiden();

	while(b){
		if(b & 1){
			res = res * a;
		}

		a = a * a;
		b >>= 1;
	}

	return res;
}

void solve(){
    cin>>n>>k;

    fori(i, 1, n){
        fori(j, 1, n)
        cin>>gr[i][j];
    }

    M ngr;
    ngr.makeiden();

    fori(i, 1, n){
        fori(j, 1, n){
            ngr.arr[i][j] = gr[i][j];
        }
    }

    M res = Mpwr(ngr, k);

    int ans = 0;

    fori(i, 1, n){
        fori(j, 1, n){
            ans += res.arr[i][j];
            ans %= md;            
        }
    }

    cout<<ans;
}
//THINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    solve();
}

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

typedef long long ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define debug(x) cerr << #x << ": " << x << '\n'

int main()
{
    string S;
    int w;
    cin >> S >> w;
    for (int i = 0; i < S.size(); ++i)
    {
        if (i % w == 0)
        {
            cout << S[i];
        }
    }
    cout << endl;
}


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

using namespace std;

void solve()
{
	double d;
	cin >> d;
	double ans = d * sqrt(2.0);
	for (int x = 1; x <= 10; ++x)
	{
		if (d * d - x * x >= 0)
		{
			double y = sqrt(max(0.0, d * d - x * x));
			if (y < 1.0)
			{
				y = 1.0;
			}
			ans = max(ans, x + y);
		}
	}
	printf("%.12lf\n", ans);
}

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

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int a,b,c;
int main() {
    ios::sync_with_stdio(false);
    cin>>a>>b>>c;
    if(a==b&&a!=c||a==c&&c!=b||c==b&&a!=c)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>

#define NUM 11000

int main(){
	int table[NUM],limit;

	for(int i=0; i < NUM;i++)table[i] = 1;
	table[0] = 0;
	table[1] = 0;

	limit = sqrt(NUM);

	for(int i=2;i<=limit;i++){
		if(table[i] == 1){
			for(int k=2*i;k < NUM; k += i){
				table[k] = 0;
			}
		}
	}

	int n,count;

	while(scanf("%d",&n)!=EOF){
		count = 0;
		for(int i=1; i<= n; i++){
			if(table[i] == 1 && table[n+1-i] == 1)count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 2652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=20003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;cin>>S;
    stack<char> ST;
    
    bool ok=true;
    
    for(int i=0;i<S.size();i++){
        if(S[i]=='m'||S[i]=='e') ST.push(S[i]);
        else{
            if(ST.size()>=2){
                char a,b;
                b=ST.top();ST.pop();
                a=ST.top();ST.pop();
                
                if(!(a=='m'&&b=='e')){
                    ST.push(a);
                    ST.push(b);
                    ST.push(S[i]);
                }
            }else ST.push(S[i]);
        }
        
        if(i!=S.size()-1&&ST.size()==0) ok=false;
    }
    
    if(ok&&ST.empty()) cout<<"Cat"<<endl;
    else cout<<"Rabbit"<<endl;
    
}







Measured memory_bytes: 3232
n, m = map(int, input().split())
ps = [input().split() for _ in range(m)]
ac = [0]*n
pe = [0]*n
for p, s in ps:
  k = int(p) - 1
  if s == "AC":
    ac[k] = 1
  else:
    if ac[k]:
      continue
    else:
      pe[k] += 1
v, w = 0, 0
for i in range(n):
  if ac[i]:
    v += 1
    w += pe[i]
print(v, w)

Measured memory_bytes: 33700
n,m,x = map(int,input().split())
c = [list(map(int,input().split())) for _ in range(n)]
ans = []
#n冊の本において買うか買わないかの2通りなので2**n
for i in range(2**n):
    #リストの中身は値段1と理解度m個
    a = [0]*(m+1)
    com = i
    for j in range(n):
        if com >= (2**(n-j-1)):
            com -= 2**(n-j-1)
            for k in range(m+1):
                a[k] += c[j][k]
    price = a[0]
    del a[0]
    if all(a[j]>=x for j in range(m)):
        #print(price)
        ans.append(price)
if len(ans) == 0:
    print(-1)
else:
    print(min(ans))

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
long long sum,ans;
const int N=100005;
int a[N],n,pos;
void read(int &x)
{
    x=0;
    int y=1;
    char c=getchar();
    while (c>'9'||c<'0')
    {
        if (c=='-')
            y=-1;
        c=getchar();
    }
    while (c>='0'&&c<='9')
    {
        x=x*10+c-'0';
        c=getchar();
    }
    x*=y;
}
int main()
{
	read(n);
	for (int i=1;i<=n;++i)
		read(a[i]);
	for (int i=1;i<=n;++i)
		a[i]+=a[i-1];
	pos=0;
	for (int i=1;i<=n;++i)
	{
		if (i&1&&a[i]+pos<=0)
		{
			sum+=1-a[i]-pos;
			pos=1-a[i];
		}
		if (!(i&1)&&a[i]+pos>=0)
		{
			sum+=a[i]+pos+1;
			pos=-a[i]-1;
		}
	}
	pos=0;
	for (int i=1;i<=n;++i)
	{
		if (i&1&&a[i]+pos>=0)
		{
			ans+=a[i]+pos+1;
			pos=-a[i]-1;
		}
		if (!(i&1)&&a[i]+pos<=0)
		{
			ans+=1-a[i]-pos;
			pos=1-a[i];
		}
	}
	cout<<min(ans,sum);
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 61
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};

ll C[10][10];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin>>N;

    for(int i=1;i<=N;i++){
        string s=to_string(i);
        C[s[0]-'0'][i%10]++;
    }
    ll ans=0;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            //cout<<i<<" "<<j<<" "<<C[i][j]<<endl;
            ans+=C[i][j]*C[j][i];
        }
    }
    cout<<ans<<endl;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

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

  int div = k;
  int ans = 0;
  int x;
  do{
    x = n/div;
    div *= k;    
    ans++;    
  }while(x !=0);

  cout << ans << endl;
  
  return 0;
}


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

int main(void) {
  char b;
  cin >> b;
  
  if(b=='A') cout << 'T' << endl;
  else if(b=='C') cout << 'G' << endl;
  else if(b=='G') cout << 'C' << endl;
  else cout << 'A' << endl;
  
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var s string
	var ans float64 = 753
	fmt.Scan(&s)
	for i := 0; i < (len(s) - 2); i++ {
		si, _ := strconv.Atoi(s[i : i+3])
		ans = math.Min(ans, math.Abs(float64(753-si)))
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
        
def sgn(x):
    if x==0:
        return x
    return x//abs(x)

N,A = ilint()
tmp = A[0]
ans = 1
s = 0
for a in A[1:]:
    if s==0:
        s = sgn(a-tmp)
        tmp = a
    elif s*(a-tmp)>=0:
        tmp = a
    else:
        ans += 1
        tmp = a
        s = 0
print(ans)

Measured memory_bytes: 88452
from bisect import bisect_left
N = int(input())
L = list(map(int,input().split()))
ans = 0
L.sort()
for i in range(N):
  for j in range(i+1,N):
    sumn = L[i]+L[j]
    num = bisect_left(L,sumn)
    ans += max(0,num-j-1)
print(ans)
      

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second > secondElof.second;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, modinv, bitSearch, bitList, dfs, bfs, dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l, m, n; ll N, M, K, H, W, L;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color; vll path; vl D;
//***********//
int main() {
	cin >> K >> N;
	vl A(N);
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	ll ans = K + A[0] - A[N - 1];
	for (i = 0; i < N-1; i++) {
		ans = max(ans, A[i + 1] - A[i]);
	}
	cout << K - ans;
}

Measured memory_bytes: 1920
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 3e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m;
	cin >> n >> m;
	while (n--)
	{
		string str;
		cin >> str;
		puts(str.c_str());
		puts(str.c_str());
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {
	
	int X,Y; cin >> X >> Y;

	bool f = false;
	for (int i = 0; i <= X; i++) {
		int turu = i;
		int kame = X - i;
		if ((turu * 2) + (kame * 4) == Y) {
			f = true;	
		}
	}
	
	if (f) {
		cout << "Yes" << endl;	
	}else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

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

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

    string s;
    set<char> st{'y', 'u', 'i', 'o', 'p', 'h', 'j', 'k', 'l', 'n', 'm'};
    while (cin >> s, s[0] != '#') {
        int ans = 0;
        rep(i, s.size() - 1) {
            ans += (st.count(s[i]) != st.count(s[i + 1]));
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 3156
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int (i) = (N)-1; (i) >= 0; (i)--)
#define REP(i, N) for(int (i) = 0; (i) < (int)(N); (i)++)
 #include <iomanip>
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

int n,k;

void solve(istream& cin, ostream& cout) {
	cin>>n>>k;
	set<int> have;
	REP(i, k) {
		int d;
		cin>>d;
		REP(j, d) {
			int s;
			cin >> s;
			s--;
			have.insert(s);
		}
	}
	int ans = 0;
	REP(i, n) if(!have.count(i)) ans++;
	cout <<ans<<endl;
}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


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

int main() {

    int a, b, c;

    std::cin >> a >> b >> c;

    int sum = 0;

    for ( int i = a; i <= b; i++ ) {

        if ( c % i == 0 ) sum++;
    }

    std::cout << sum << std::endl;

    return 0;
}



Measured memory_bytes: 3100
S = input()
S_original = S
S = S + "@" * 7
S_temp = []
i = 0
while (len(S_original) != len(S_temp) or len(S) > i):
    if S[i] == "d":
        if (S[i+5] == "e" and S[i+7] == "a") or S[i+5] == "d":
            S_temp.append("dream")
            i += 5
        elif S[i+5] == "e" and S[i+7] != "@":
            S_temp.append("dreamer")
            i += 7
        elif S[i+5] == "@":
            S_temp.append("dream")
            break
        elif S[i+5] == "e" and S[i+7] == "@":
            S_temp.append("dreamer")
            break
        else:
            break
    elif S[i] == "e":
        if S[i+5] == "r" and S[i+6] != "@":
            S_temp.append("eraser")
            i += 6
        elif S[i+5] == "d" or S[i+5] == "e":
            S_temp.append("erase")
            i += 5
        elif S[i+5] == "@":
            S_temp.append("erase")
            break
        elif S[i+5] == "r" and S[i+6] == "@":
            S_temp.append("eraser")
            break
        else:
            break
    else:
        break

if S_original == "".join(S_temp):
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3444
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int ans1 = 0, ans2 = 0, ans3 = 0;
		int ans = 0;
		ans1 = A + B;
		ans2 = A - B;
		ans3 = A * B;
		if(ans1 >= ans2){
			if(ans1 >= ans3){
				ans = ans1;
			}
		}
		if(ans2 >= ans1){
			if(ans2 >= ans3){
				ans = ans2;
			}
		}
		if(ans3 >= ans1){
			if(ans3 >= ans2){
				ans = ans3;
			}
		}
		System.out.println(ans);
		stdIn.close();
	}
}

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


int main (){
    int a, b, c;
    string s, t;
    cin>>s;
    a=1;
    for(int i=0; i<s.size(); i ++){
        if(i%2==0){
            if(s.at(i)=='L'){
                a=0;
                break;
            }
        }
        else{
            if(s.at(i)=='R'){
                a=0;
                break;
            }
        }
    }

    if(a==1){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256