akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


// ワーシャルフロイド法(全点間距離)
VVL d;//対角0,辺がないところはINF
void warshall_floyd(int n) {
  REP(k,n){       // 経由する頂点
    REP(i,n){    // 始点
      REP(j,n){  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}


void Main()
{
    int h,w;cin>>h>>w;
    int n=10;
    d.resize(n);
    REP(i,n){
        d[i].resize(n);
        REP(j,n){
            cin>>d[i][j];
        }
    }

    warshall_floyd(n);

    LL result = 0;
    REP(i,h){
        REP(j,w){
            int a;cin>>a;
            if(a==-1){
                continue;
            }
            result += d[a][1];
        }
    }

    cout<<result<<endl;


    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
A, B = gets.chomp.split

list = %w(2 3 4 5 6 7 8 9 10 11 12 13 1)

a = list.index(A)
b = list.index(B)

if a < b
  puts 'Bob'
elsif a > b
  puts 'Alice'
else
  puts 'Draw'
end


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans;
	if (a > b){
		ans = 0ll;
	} else if (n == 1){
		if (a == b){
			ans = 1ll;
		} else {
			ans = 0ll;
		}
	} else {
		ans = (b - a) * (n - 2ll) + 1;
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(int &f){
    f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
int n;
int q[35]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
    read(n);
    cout<<q[n-1]<<endl;
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
typedef pair<int,int> P;

//-----------------------------------------------------------------------

int A[100];

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

    int n,m,t;
    cin>>n>>m>>t;
    REP(i,n) cin>>A[i];
    int ans=A[0]-m;
    REP(i,n-1){
        ans+=max(0LL,A[i+1]-A[i]-2*m);
    }
    ans+=max(0LL,t-A[n-1]-m);
    cout<<ans<<endl;
}


Measured memory_bytes: 3176
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
#define WAIT system ("pause")
#define rt0 return 0
using namespace std;
int main()
{
 //   WAIT;

 long long n,m;
 int count=0;
 cin>>n>>m;

if(n==1){
	if(m==1) cout<<1;
	else cout<<m-2;
	rt0;
}

if(m==1){
	cout<<n-2;
	rt0;
}


 cout<<(m-2)*(n-2);
    rt0;
}


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

using namespace std;

int main()
{
    int N;
    
    cin >> N;
    
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int l, r;
        cin >> l >> r;
        
        ans += r - l + 1;
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String S = sc.next();
            String T = sc.next();

            int cnt = 0, min = T.length();
            for (int i = 0; i <= S.length() - T.length(); i++) {
                cnt = 0;
                for (int j = 0; j < T.length(); j++) {
                    if (S.charAt(i + j) != T.charAt(j)) {
                        cnt++;
                    }
                }
                min = Math.min(cnt, min);
            }
            System.out.println(min);
        }
    }
}


Measured memory_bytes: 36020
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d){
        cout<<"Left"<<endl;
    }
    if(a+b<c+d){
        cout<<"Right"<<endl;
    }
    if(a+b==c+d){
        cout<<"Balanced"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define MAX 1000003
#define pii pair<ll,ll>
#define VP vector< pii >
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define all(v) (v).begin(),(v).end()
#define S(x) scanf("%d",&(x))
#define S2(x,y) scanf("%d%d",&(x),&(y))
#define SL(x) scanf("%lld",&(x))
#define SL2(x) scanf("%lld%lld",&(x),&(y))
#define P(x) printf("%d\n",(x))
#define FF first
#define SS second
using namespace std;

int main(){
	ll n;
	cin>>n;
	vector<ll>v(n),dp(n);
	rep(i,0,n)
		{
			cin>>v[i];

		}
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	rep(i,2,n)
		{
			dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
		}
	cout<<dp[n-1];
 
return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define RI register int
const int mod=1000000007,N=2005,M=4000005;
int n,K,f[N][N],fac[M],ni[M];
int qm(int x) {return x>=mod?x-mod:x;}
int ksm(int x,int y) {
	int re=1;
	for(;y;y>>=1,x=1LL*x*x%mod) if(y&1) re=1LL*re*x%mod;
	return re;
}
void prework() {
	fac[0]=1;for(RI i=1;i<=n*K;++i) fac[i]=1LL*fac[i-1]*i%mod;
	ni[n*K]=ksm(fac[n*K],mod-2);
	for(RI i=n*K-1;i>=0;--i) ni[i]=1LL*ni[i+1]*(i+1)%mod;
}
int C(int d,int u) {return 1LL*fac[d]*ni[u]%mod*ni[d-u]%mod;}
int main()
{
	scanf("%d%d",&n,&K);
	if(K==1) {puts("1");return 0;}
	prework();--K;
	f[0][0]=1;
	for(RI i=1;i<=n;++i) {
		for(RI j=0;j<=i;++j) {
			if(j) f[i][j]=f[i][j-1];
			f[i][j]=qm(f[i][j]+1LL*f[i-1][j]*C(i*K+j-1,K-1)%mod);
		}
	}
	printf("%lld\n",1LL*f[n][n]*fac[n]%mod);
    return 0;
}

Measured memory_bytes: 47104
N,C,K = map(int,input().split())

T = sorted([int(input()) for _ in range(N)])
ans = 1
count = 0
time = 0
start = -1
for i in range(N):
  if start == -1:
    start = i
  if i != N-1:
    if T[i+1] > T[start] + K or i+1 -start == C:
      ans += 1
      start = -1
  
print(ans)

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

int main(){
    int N;
    cin >> N;
    multiset<int> st;
    for(int i=0; i<(1<<N); i++){
        int a;
        cin >> a;
        st.insert(-a);
    }
    vector<int> slimes = {*st.begin()};
    st.erase(st.begin());
    for(int i=0; i<N; i++){
        vector<int> slimes2;
        for(int a : slimes){
            auto it = st.upper_bound(a);
            if(it == st.end()){
                cout << "No" << endl;
                return 0;
            }
            slimes2.push_back(*it);
            st.erase(it);
        }
        for(int a : slimes2) slimes.push_back(a);
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 13984
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 0

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

#define MAXN 20
int N;
int A[MAXN+5];
int B[MAXN+5];
int C[MAXN+5];

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> N;
	FOR(n,N) {
		cin >> A[n];
		A[n]--;
	}
	FOR(n,N) {
		cin >> B[n];
	}
	FOR(n,N-1) {
		cin >> C[n];
	}

	int ans = 0;
	FOR(n,N) {
		// DOUT << "=== A["<<n<<"]=="<<A[n]<<"# ===" << endl;
		ans+=B[A[n]];
		// DOUT << "=== B["<<A[n]<<"]=="<<B[A[n]]<<"# ===" << endl;
		if(n==0) {
			continue;
		}
		if((A[n-1]==A[n]-1)) {
			ans+=C[A[n-1]];
		}
	}

	cout << ans << endl;

	return 0;
}




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

int main() {
  int N;
  string s, t;
  cin >> N >> s >> t;

  int removeCnt = 0;
  rep(i, N) {
    string ss, tt;
    ss = s.substr(i, N);
    tt = t.substr(0, N-i);
    if (ss == tt) {
      removeCnt = N-i;
      break;
    }
  }

  string ans = s + t.substr(removeCnt, t.size());
  cout << ans.size() << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int q[1000000],C[100010];
int ta[100010],nt[200010],to[200010],co[200010];
int f[100010];
int dfs(int v,int e,int s){
  int i,max=0;
  for(i=ta[s];i+1;i=nt[i]){
    if(f[to[i]])continue;
    f[to[i]]=1;
    C[to[i]]=C[s]+co[i];
    max=MAX(max,C[to[i]]);
    max=MAX(max,dfs(v,e,to[i]));
  }//printf("s%d m%d\n",s,max);
  return max;
}
/*int bfs(int v,int e,int s,int *g){
  int t,r,i,max=0;
  for(i=0;i<v;i++)C[i]=1000000000;
  C[q[0]=s]=t=0;//printf("a\n");
  for(r=1;r-t;t++){
    for(i=ta[q[t]];i+1;i=nt[i]){//printf("%d %d\n",fr[i],to[i]);
      if(C[to[i]]>C[s]+co[i]){
	C[to[i]]=C[s]+co[i];
        if(max<C[to[i]]){
	  max=C[to[i]];
	  *g=to[i];
	}
	q[r++]=to[i];
      }
    }//printf("\n");
  }//printf("%d\n",r);
  return max;
  }//*/
int tyokkei(int v,int e,int *a,int *b,int *c){
  int i,max=0,g;
  for(i=0;i<v;i++){
    ta[i]=-1;
    C[i]=1000000000;
    f[i]=0;
  }
  C[0]=0;
  f[0]=1;
  for(i=0;i<e;i++){
    nt[i]=ta[a[i]];
    to[i]=b[i];
    co[i]=c[i];
    ta[a[i]]=i;
    nt[i+e]=ta[b[i]];
    to[i+e]=a[i];
    co[i+e]=c[i];
    ta[b[i]]=i+e;    
  }//printf("a\n");
  //for(i=0;i<2*e;i++)printf("%d %d\n",fr[i],to[i]);printf("\n");
  max=dfs(v,e*2,0);//printf("m%d\n",max);
  for(i=0;i<v;i++){
    if(max==C[i])g=i;
    C[i]=1000000000;
    f[i]=0;
  }
  C[g]=0;
  f[g]=1;//printf("%d\n",g);
  return dfs(v,e*2,g);
}
int main(){
  int n,a[100010],b[100010],c[100010],i;
  scanf("%d",&n);
  for(i=0;i<n-1;i++)scanf("%d %d %d",&a[i],&b[i],&c[i]);
  printf("%d\n",tyokkei(n,n-1,a,b,c));
  return 0;
}

Measured memory_bytes: 11328
#include<iostream>
using namespace std;
int main()
{
    long long a,b,x,temp;
    cin>>x;
    a=-64,b=-64;
    temp=a*a*a*a*a-b*b*b*b*b;
    while(temp!=x)
    {
        if(temp>x) b++;
        else a++;
        temp=a*a*a*a*a-b*b*b*b*b;
    }
    cout<<a<<" "<<b;
    return 0;
}

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

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

int n, m;

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

	cin >> n >> m;

	for (int i = m, x = 1; i > 0; i -= 2, x++)
		cout << x << " " << x + i << endl;

	for (int i = m - 1, x = m + 2; i > 0; i -= 2, x++)
		cout << x << " " << x + i << endl;

	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifdef APURBA
#define HERE cout<<"here - "<<__LINE__<<"\n";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout<<endl;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cout << *it << " = " << a << " ";
    err(++it, args...);
}
#else
#define HERE
#define debug(args...)
#endif
const int N = 1e6+5;
const ll mod = 1e9+7 ;
typedef pair<int,int> pii;
ll n;
ll dp[2005];

ll solve(ll now)
{
    if(now>n)
    {
        return 0;
    }
    if(now==n)
    {
        return 1;
    }
    ll &ret = dp[now];
    if(ret!=-1)
        return ret;
    ll ans =0;
    for(ll i=3;i<=n-now;i++)
    {
        ans+= solve(now+i);
        if(ans>=mod)
            ans-=mod;
    }
    return ret= ans;
}


void TEST_CASES(int cas)
{
    memset(dp,-1,sizeof dp);
    cin>>n;
    if(n<3)
    {
        cout<<0<<endl;
        return;
    }
    cout<<solve(0)<<endl;


}



/*

*/

int main()
{
#ifndef APURBA
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int t=1,cas=0;
    //cin>>t;
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}


Measured memory_bytes: 3660
N, Q = [int(i) for i in input().split()]
S = input()
tdList = reversed([input().split() for _ in range(Q)])

l, r = 0, N - 1
for td in tdList:
    if td[0] == S[l] and td[1] == "L":
        l += 1
    elif td[0] == S[r] and td[1] == "R":
        r -= 1
    if l != 0 and S[l - 1] == td[0] and td[1] == "R":
        l -= 1
    if r != N - 1 and S[r + 1] == td[0] and td[1] == "L":
        r += 1
    if l > N - 1 or r < 0:
        break

ans = 0
if r >= l:
    ans = r - l + 1

print(ans)

Measured memory_bytes: 39348
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int T;
  scanf("%d", &T);
  REP(t, T){
    int N, K, sum = 0;
    scanf("%d %d", &N, &K);
    vector<int> v(N - 1);
    int a, b;
    scanf("%d", &a);
    REP(i, N - 1){
      scanf("%d", &b);
      v[i] = b - a;
      sum += v[i];
      a = b;
    }
    SORT(v);
    REVERSE(v);
    --K;
    for(int i = 0; sum > 0 && i < K; ++i) sum -= v[i];
    cout <<sum <<endl;
  }
  return 0;
}

Measured memory_bytes: 1616
#include <iostream>
#include <typeinfo>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;

int N;
vector<int> P;
vector<int> Q;

int lexicalOrderNum(vector<int> v)
{
  vector<int> order(N);
  for (int i = 0; i < N; i++)
  {
    order[i] = i;
  }

  int num = 1;

  do
  {
    if (order == v)
    {
      return num;
    }
    num++;
  } while (next_permutation(order.begin(), order.end()));

  cout << "Something went wrong" << endl;
  return 0;
}

int absOfSubt(int a, int b)
{
  if (a > b)
  {
    return a - b;
  }
  else
  {
    return b - a;
  }
}

int main()
{
  cin >> N;
  P.resize(N);
  Q.resize(N);
  for (int i = 0; i < N; i++)
  {
    cin >> P[i];
    P[i]--;
  }
  for (int i = 0; i < N; i++)
  {
    cin >> Q[i];
    Q[i]--;
  }

  int a = lexicalOrderNum(P);
  int b = lexicalOrderNum(Q);

  cout << absOfSubt(a, b) << endl;
}

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

const int MOD = 1000000007;
const int INF = 1000000000;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

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


int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    REP(i, n) cin >> a[i];
    ll ans = INF;
    for(int i = - 100; i <= 100; i++){
        ll tmp = 0;
        REP(j, n){
            tmp += pow(abs(a[j] - i) , 2);
        }
        ans = min(ans, tmp);
    }
    print(ans);
}




Measured memory_bytes: 256
def main():
    n,d = map(int,input().split())
    p = []
    for i in range(n):
        p.append(list(map(int,input().split())))
    ans = 0
    for i in range(n):
        D = (p[i][0]**2 + p[i][1]**2)**0.5
        if D<=d:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 45824
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
lint mod = 998244353;
// lint mod = 1000000007;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

int app() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;

  vector<vector<lint>> dp1x(c+1,vector<lint>(d+1));
  vector<vector<lint>> dp1y(c+1,vector<lint>(d+1));
  vector<vector<lint>> dp0x(c+1,vector<lint>(d+1));
  vector<vector<lint>> dp0y(c+1,vector<lint>(d+1));
  vector<vector<lint>> dp0b(c+1,vector<lint>(d+1));
  vector<vector<lint>> dpsum(c+1,vector<lint>(d+1));

  dpsum[a][b]=1;
  rep_range(i,a+1,c+1){
    dpsum[i][b]=dpsum[i-1][b]*b%mod;
    dp0y[i][b]=0;
    dp1y[i][b]=0;
  }
  rep_range(j,b+1,d+1){
    dpsum[a][j]=dpsum[a][j-1]*a%mod;
    dp0x[a][j]=0;
    dp1x[a][j]=0;
  }
  rep_range(i,a+1,c+1) rep_range(j,b+1,d+1){
    lint sum=0;
    sum+=dp1x[i][j]=dpsum[i-1][j];
    sum+=dp1y[i][j]=dpsum[i][j-1];
    sum+=dp0x[i][j]=(dp0x[i-1][j]+dp1x[i-1][j])*(j-1)%mod;
    sum+=dp0y[i][j]=(dp0y[i][j-1]+dp1y[i][j-1])*(i-1)%mod;
    sum+=dp0b[i][j]=dpsum[i-1][j-1]*(i-1)*(j-1)%mod;
    dpsum[i][j]=sum%mod;
  }

  return dpsum[c][d];
}

int main(){cout<<app()<<endl;return 0;}


Measured memory_bytes: 425868
#include <iostream>
#include <set>

using namespace std;

int main() {
	int N, A_i;
	set<int> A;
	A.clear();
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A_i;
		A.insert(A_i);
	}
	int sz = A.size();
	if (sz % 2 == 1) cout << sz << endl;
	else cout << sz-1 << endl;
	return 0;
}


Measured memory_bytes: 4992
#include"bits/stdc++.h"
using namespace std;

int main() {
	int r, g, b;
	cin >> r >> g >> b;
	if ((10 * g + b) % 4 == 0) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#define f(a,b,c,d) for(a=b; a<=c; a+=d)
#define fd(a,b,c,d) for(a=b; a>=c; a-=d)
#define readD(n) scanf("%d", &n)
#define readC(n) scanf("%c", &c)
#define readLLD(n) scanf("I64t", &n)
#define NMAX 100050

using namespace std;

int n, i, minVal[NMAX], val[NMAX];

int main(){
   readD(n);
   f(i,1,n,1){
        readD(val[i]);
        }
   minVal[1] = 0;
   minVal[2] = abs(val[1]-val[2]);
   f(i,3,n,1)
        minVal[i] = min(minVal[i-1]+abs(val[i]-val[i-1]), minVal[i-2]+abs(val[i]-val[i-2]));
   printf("%d", minVal[n]);
   return 0;
   }


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int X; cin >> X;
    int x = sqrt(X);
    int ans = 1;
    for(int i=2; i<=x; i++){
        int count = 1;
        while(true){
            if(pow(i, count) > X) break;
            if(pow(i, count) >= ans) ans = pow(i,count);
            count++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 512
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){
	var a = chunk.trim(),
	x = parseInt(a),
	d = new Date(x*1000),
	h = d.getUTCHours(),
	m = d.getUTCMinutes(),
	s = d.getUTCSeconds();
	console.log([h, m, s].join(':'));
});

Measured memory_bytes: 15600
N, M = map(int, input().split())
num_lis = sorted(list(map(int, input().split())))
num_dif = []
ans = 0

if N > M:
  print(0)
elif M == 1:
  print(0)
else:
  for n in range(M):
    if n == M-1:
      break
    n_dif = num_lis[n+1] - num_lis[n]
    n_dif = abs(n_dif)
    num_dif.append(n_dif)
  sorted_num_dif = sorted(num_dif)
  if N == 1:
    ans = sum(sorted_num_dif)
  else:
    for i in sorted_num_dif[:-(N-1)]:
      ans += i

  print(ans)


Measured memory_bytes: 13968
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

const int MAX = 11000000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();

    lli x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;

    lli sum = 0;
    for(lli r = y1;r<=y2;r++){
    	lli tmp = COM(x2+r+1,r+1)-COM(x1+r,r+1);
    	while(tmp<0)tmp += MOD;
    	tmp %= MOD;
    	sum += tmp;
    	sum %= MOD;
    }
    cout<<sum<<endl;
	
	return 0;
}

Measured memory_bytes: 258048
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  vector<int> x(5);
  int index;
  for(int i=0;i<5;i++){
    cin >> x.at(i);
    if(x.at(i)==0) index=i;
  }

  cout << index+1 << endl;
  
  return 0;
  
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  cin >> N;
  cin >> A;
  B=N%500;
  if (B <= A) {
    cout << "Yes" << endl;
  }
  else  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
bool winny(char c,string grid[]){
  REP(y,3){
    bool win = true;
    REP(x,3){
      if(grid[y][x]!=c) win = false;
    }
    if(win) return true;
  }
  REP(x,3){
    bool win = true;
    REP(y,3){
      if(grid[y][x]!=c) win = false;
    }
    if(win) return true;
  }
  bool win = true;
  REP(k,3){
    if(grid[k][k]!=c) win=false;
  }
  if(win) return true;
  win = true;
  REP(k,3){
    if(grid[k][2-k]!=c) win=false;
  }
  if(win) return true;

  return false;
}

int main(void){
  string line;
  while(cin>>line){
    if(line=="0") break;
    string grid[3];
    grid[0] = line;
    REP(i,2)cin>>grid[1+i];
    if(winny('b',grid)) cout<<"b"<<endl;
    else if (winny('w',grid)) cout<<"w"<<endl;
    else cout<<"NA"<<endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
 int n,m,x;
 cin>>n>>m>>x;
 vector<int> a(m);
 for(int i=0; i<m; i++){
   cin>>a.at(i);
 }
 vector<int> road(n+1,0);

for(int i=0; i<m; i++){
  road.at(a.at(i))=1;
}

int cnt1=0,cnt2=0;
for(int i=x; i<=n; i++){
  if(road.at(i)==1) cnt1++;
}
for(int i=x; i>=0; i--){
  if(road.at(i)==1) cnt2++;
}
int ans=min(cnt1,cnt2);
cout<<ans<<endl;
}

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

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

    /*s.size() aaaaa は　５、 bbbb は４
    　奇数のとき　0-4, 1-3　で 5/2 - 1
    　偶数のとき　0-3, 1-2  で 4/2 
    */
    int m = s.size();
    int cnt = 0;

    if(m % 2 == 0) {
        for(int i=0; i< m/2; i++){
            if(s[i] != s[m-i-1]) cnt++;
        }
    }
    else {
        for(int i=0; i< m/2 ; i++) {
            if(s[i] != s[m-i-1]) cnt++;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 3636
//https://atcoder.jp/contests/agc024/tasks/agc024_c
//C - Sequence Growing Easy
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    ll N; cin>>N;
    vector<ll> an(N);
    for(auto&&a:an){
        cin>>a;
    }
    bool ans_flag=(an.at(0)==0);
    ll count=0;
    //貪欲,x(i)=x(i+1)+1 だと +1
    //x(i)<=x(i+1) だと +x(i+1)
    for(ll i=1;i<an.size();++i){
        if(an.at(i)>an.at(i-1)+1){
            ans_flag=false;
        }else if(an.at(i)==an.at(i-1)+1){
            count += 1;
        }else{
            count += an.at(i);
        }
    }
    if(not ans_flag) count=-1;
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1792
S = input()
K = int(input())
N = len(S)
alp = "abcdefghijklmnopqrstuvwxyz"
ans = ""
for i in range(N):
    s = S[i]
    index = alp.find(s)
    if i == N-1:
        ans += alp[(index+K)%26]
    else:
        if s=="a":
            ans += "a"
        elif 26-index <= K:
            ans += "a"
            K -= (26-index)
        else:
            ans += s
print(ans)

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

int main()
{
    int N, W, w[110], v[110];
    cin >> N >> W;
    for (int i = 0; i < N; i++) cin >> w[i] >> v[i];

    vector<vector<int>> vv(4);
    for (int i = 0; i < N; i++) {
        vv[w[i] - w[0]].push_back(v[i]);
    }

    for (int i = 0; i < 4; i++) {
        sort(vv[i].begin(), vv[i].end());
        vv[i].push_back(0);
        reverse(vv[i].begin(), vv[i].end());
        for (int j = 1; j < vv[i].size(); j++) {
            vv[i][j] += vv[i][j - 1];
        }
    }

    int ans = 0;
    for (int i = 0; i <= vv[0].size(); i++) {
        for (int j = 0; j < vv[1].size(); j++) {
            for (int k = 0; k < vv[2].size(); k++) {
                for (int l = 0; l < vv[3].size(); l++) {
                    long long wei = 1LL * w[0] * i + 1LL * (w[0] + 1) * j + 1LL * (w[0] + 2) * k + 1LL * (w[0] + 3) * l;
                    int val = vv[0][i] + vv[1][j] + vv[2][k] + vv[3][l];
                    if (wei <= 1LL * W) ans = max(ans, val);
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;

    vector<int> x(n);
    REP(i, n) cin >> x[i];
    sort(x.begin(), x.end());

    long long mini = LLONG_MAX;
    for (int i = x[0]; i <= x[n - 1]; i++) {
        long long sum = 0;
        REP(j, n) sum += pow(x[j] - i, 2);
        mini = min(mini, sum);
    }

    cout << mini << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

double PI = acos(-1);

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

	double S = (double)a * b * sin(C * PI / 180.0) / 2.0;
	double c = sqrt((double)a * a + (double)b * b - 2.0 * a * b * cos(C * PI / 180.0));
	double h = b * sin(C * PI / 180.0);

	printf("%.8lf\n", S);
	printf("%.8lf\n", (double)a + b + c);
	printf("%.8lf\n", h);

	return 0;
}


Measured memory_bytes: 3404
#include<bits/stdc++.h>
using namespace std;
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
int n,ct[555][555],ans;
bool vis[555][555];
void gx(int x,int y)
{
	int nw=ct[x][y]+vis[x][y];
	for(int d=0;d<4;d++)
	{
		int nx=x+dx[d],ny=y+dy[d];
		if(nx<=0 || nx>n || ny<=0 || ny>n)
		{
			continue;
		}
		if(ct[nx][ny]>nw)
		{
			ct[nx][ny]=nw;
			gx(nx,ny);
		}
	}
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			ct[i][j]=min(min(i,n-i+1),min(j,n-j+1))-1;
			vis[i][j]=true;
		}
	}
	for(int i=1;i<=n*n;i++)
	{
		int xx;
		cin>>xx;
		int x=xx/n+1,y=xx%n;
		if(y==0)
		{
			y=n;
			x--;
		}
		ans+=ct[x][y];
		vis[x][y]=false;
		gx(x,y);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 20372
#!/usr/bin/env python3
import sys
import math


def solve(A: int, B: int):
    
    kmina = math.ceil((A)/0.08)
    kmaxa = (A + 1)/0.08
    
    kminb = math.ceil((B)/0.10)
    kmaxb = (B + 1)/0.10
    
    if (kmina <= kminb) and (kminb < kmaxa):
        print(kminb)    
    elif (kminb <= kmina) and (kmina < kmaxb):
        print(kmina)
    else:
        print(-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> va(n);
  for (int i = 0; i < n; i++) {
    cin >> va[i];
  }
  int m;
  cin >> m;
  vector<int> vb(m);
  for (int i = 0; i < m; i++) {
    cin >> vb[i];
  }
  cout << (vb > va) << endl;
}


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

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

    int n;
    cin >> n;
    int ans = (n + 999) / 1000 * 1000 - n;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
int N;
cin >> N;
  
bool diff = true;

vector<int> A(N);
for (int i = 0; i < N; i++) {
  cin >> A.at(i);
}
  
sort(A.begin(), A.end()); //小さい順にソートする

  int A0 = 0;
for (int i = 0; i < N; i++ ){
	if (A.at(i) == A0) {
	diff = false;
	break;
	} 
	else {
	A0 = A.at(i);
	//cout << A0 << endl;
    }
}

  
    // 出力
if (diff) {
  cout << "YES" << endl;
}
else {
  cout << "NO" << endl;
}
  
}

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

#define lson rt << 1
#define rson rt << 1 | 1
#define mid ((l + r) >> 1)
#define Lson l, mid, lson
#define Rson mid + 1, r, rson
const int MAXN = 1e5 + 20;
using pa = pair<int, int>;
using ll = long long;


int dp[MAXN][9][9];
const int MOD = 1e9 + 7;
int main() {
    ll l1, r1, l2, r2;
    cin >> l1 >> r1 >> l2 >> r2;
    cout << max(l1 * l2, max(l1 * r2, max(r1 * l2, r1 * r2))) << endl; 
}



Measured memory_bytes: 3628
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int ans = 0;
    for(int i = 0; i < N; i++){
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      ans += b-a+1;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 22612
import math
 
D = input().split(' ')
A = int(D[0])
B = int(D[1])

result = []
result.append(1)

a_result = []
b_result = []

for i in range(2, int(A**0.5) + 2):
    flg = 0
    while A % i == 0:
        if flg == 0:
            a_result.append(i)
            flg = 1
            
        A = A / i
if A != 1:
  a_result.append(A)
        
for i in range(2, int(B**0.5) + 2):
    flg = 0
    while B % i == 0:
        if flg == 0:
            b_result.append(i)
            flg = 1
            
        B = B / i
if B != 1:
  a_result.append(B)
  
print(len(a_result) + len(b_result) - len(set(a_result + b_result)) + 1)

    

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

typedef long long ll;

int main() {
  int A,B,C; cin >> A >> B >> C;
  ll numA[100000];
  ll tmp = A;
  for ( int i = 0; i < 100000; i++ ) {
    numA[i] = tmp;
    tmp += A;
  }

  for ( int i = 0; i < 100000; i++ ) {
    if ( numA[i] % B == C ) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 1024
let n = stdin.ReadLine() |> int
stdin.ReadLine().ToCharArray() |> Array.mapi (fun i x->(x,i) ) 
|>fun x ->
    (
        x |> Array.filter(fun (x,i) -> i < (n+1) / 2) |> Array.map fst 
        , x |> Array.filter (fun (x,i) -> i >= (n+1) / 2) |> Array.map fst
    )
||> (=)
|> function
| true -> "Yes"
| false -> "No" 
|> stdout.WriteLine

Measured memory_bytes: 18240
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
	string str;
	getline(cin ,str);
	bool flag = false;
	for (int i=0;i< str.length()-1 ;i++) {
		if (str.at(i) == str.at(i+1)) {
			flag = true;
		}
	}
	if (flag) {
		cout << "Bad";
	} else {
		cout << "Good";
	}




	return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>


#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;


using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    Bint A,V,B,W,T;

    cin>>A>>V;
    cin>>B>>W;
    cin>>T;

    if(A==B){
        cout<<"YES"<<endl;
    }
    else if(A<B){
        A+=T*V;
        B+=T*W;
        if(A>=B){
           cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
    else{
        A-=T*V;
        B-=T*W;
        if(A<=B){
           cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }

}

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

using namespace std;
using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin>>s;
    if(s=="AAA"||s=="BBB"){
        cout<<"No";

    }else{
        cout<<"Yes";
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
r = 0
c = As[0]
for i in range(N):
  B = Bs[i]
  if B >= c+As[i+1]:
    r += c+As[i+1]
    c = 0
  elif B >= c:
    r += B
    c = As[i+1]-(B-c)
  else:
    r += B
    c = As[i+1]
print(r)


Measured memory_bytes: 18624
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		char[] S = sc.next().toCharArray();
		int ans = 0;
		for (int i = 0; i < S.length; i++) {
			if (S[i] == '+') {
				ans++;
			} else {
				ans--;
			}
		}
		System.out.println(ans);
	}



	public static long gcd(long a, long b) {
		long remainder = a % b;
		if (remainder == 0) {
			return b;
		} else {
			return gcd(b, remainder);
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22484
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

int main()
{
  int n; cin >> n;
  vector<vector<int>> data(n,vector<int> (3));
  REP(i,n){REP(j,3){
    cin >> data[i][j];
  }}
  vector<vector<ll>> dp(100010,vector<ll> (3));
  
  REP(i,n){
    REP(j,3){
      REP(k,3){
        if(j != k)
          chmax(dp[i+1][k],dp[i][j]+data[i][k]);
      }
    }
  }
  ll ans = 0;
  REP(i,3) ans = max(ans,dp[n][i]);
  cout << ans << endl;
}

Measured memory_bytes: 14020
#include <stdio.h>
using namespace std;
int main(void){
    int S;
    int h;
    int m;
    int s;
    scanf("%d",&S);
   
    h=S/3600;
    S=S%3600;
    m=S/60;
    s=S%60;
    printf("%d:%d:%d\n",h,m,s); 
    
}






Measured memory_bytes: 2740
/***
  *  بسم الله الرحمن الرحيم
  *
  * author : Ahmed al mohammed
  *
***/

#include<bits/stdc++.h>
#define P push
#define F first
#define S second
#define pb push_back
typedef long long ll;
#define pf push_front
#define PQ priority_queue
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define  lp(a,x) (lower_bound(a.begin(),a.end(),x)-a.begin())
#define  up(a,x) (upper_bound(a.begin(),a.end(),x)-a.begin())
#define hurry ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

ll pw(ll x ,ll os)
{
    if(os==0)return 1;
    ll z=pw(x,os/2);
    if(os%2)return z*z*x;
    else return z*z;
}

void sieve(){
   ll n=1e5+1;
   int a[n+5]={};
   for(ll i=2;i*i<=n;i++){
    if(!a[i])
    for(ll j=i*i;j<=n;j+=i){
        a[j]=1;
    }
   }
   for(ll i=2;i<=n;i++)
    if(!a[i])cout<<i;
}


long long Cnr(long long n,long long r){
    r=min(r,n-r);
    long long ans=1;
    for(long long i=1 ; i<=r ; i++){
        ans*=(n--);
        ans/=i;
    }
    return ans;
}

bool isprime(ll x){
for(ll i=2;i*i<=x;i++){
    if((x%i)==0)return false;
}
return true;
}
void run_case(){
 string s,t;cin>>s>>t;
 int c=0,mx=-1e8;
 for(int i=0;i<t.size();i++){
    for(int j=i;j<s.size();){
        int h=0;c=0;
        while(j<s.size()&&h<t.size()){
            int di=t.size()-h,dij=s.size()-j;
            if(t[h]==s[j]&&dij>=di)c++;
            h++,j++;
        }
        mx=max(mx,c);
    }
 }
 cout<<t.size()-mx;
}

int main(){
    hurry
    int tests=1;
  // cin>>tests;
    while(tests--)
        run_case();

    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n,m,par[N],a[N],ans;
int get(int u){return par[u] == u ? u : par[u] = get(par[u]);}
int main(){
	//freopen("readin.txt","r",stdin);
	scanf("%d%d",&n,&m);
	for(int i = 0;i < n;i++)scanf("%d",a + i),par[i] = i;
	for(int i = 0,a,b;i < m;i++){
		scanf("%d%d",&a,&b);
		par[get(a - 1)] = get(b - 1);
	}
	for(int i = 0;i < n;i++)if(get(i) == get(a[i] - 1))ans++;
	printf("%d\n",ans);
}

Measured memory_bytes: 1024
#include <stdio.h>



int main() {
    int n, x, digits;
    digits = 0;
    scanf("%d", &n);
    x = n;

    while (x > 0) {
        digits++;
        x /= 10;
    }
    if (digits == 1) {
        printf("%d\n", n);
    } else if (digits == 2) {
        printf("%d\n", 9);
    } else if (digits == 3) {
        printf("%d\n", 9 + n - 100 + 1);
    } else if (digits == 4) {
        printf("%d\n", 9 + (999 - 100 + 1));
    } else if (digits == 5) {
        printf("%d\n", 9 + (999 - 100 + 1) + (n - 10000 + 1));
    } else if (digits == 6) {
        printf("%d\n", 9 + (999 - 100 + 1) + (99999 - 10000 + 1));
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using Graph = vector<vector<ll>>;
using V = vector<ll>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n, m;
  cin >> n >> m;
  vector<pair<ll,ll>> a(m);
  rep(i,m) {
    cin >> a[i].first >> a[i].second;
  }
  sort(All(a));
  V b(n);
  rep(i,m) {
    if (a[i].first == 1) {
      b[a[i].second-1] = 1;
    }
    if (a[i].second == n) {
      if (b[a[i].first-1] == 1) {
        cout << "POSSIBLE\n";
        return 0;  
      }
    }
  }
  cout << "IMPOSSIBLE\n";

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 7920
#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i < n; i++)
#define fi first
#define se second
#define pb push_back
#define pf push_front
using namespace std;
string s;
deque<char> d;
bool volt;
int q;
char ad;
int t, f;
int main(){
	cin >> s;
	forn(i,s.size()){
		d.pb(s[i]);
	}
	cin >> q;
	while(q--){
		cin >> t;
		if(t == 1) volt ^= 1;
		else{
			cin >> f >> ad;;
			if(volt){
				if(f == 1) d.pb(ad);
				else d.pf(ad);
			}
			else{
				if(f == 1) d.pf(ad);
				else d.pb(ad);
			}
		}
	}
	if(volt){
		while(!d.empty()){
			cout << d.back();
			d.pop_back();
		}
	}
	else
	{
		while(!d.empty()){
			cout << d.front();
			d.pop_front();
		}
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 896