akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
 int main(void){
	 int n,k,t,u,v,l;
	 cin>>n>>k>>t>>u>>v>>l;
	 vector<int> d(n);
	 vector<bool> x(l,false);
	 vector<bool> a(l,false);
	 for(int i=0;i<n;i++){
		 cin>>d[i];
		 x[d[i]]= true;
	 } 
	 int rest=0;
	 int a1=t*v;
	 int amax=a1*(k+1);
	// cout<<amax<<endl;
	 for(int i=0;i<l;i++){
		 if(x[i])rest+=a1;
		 if(rest>amax)rest=amax;
		 if(rest!=0) {
	//		 cout<<rest<<" ";
			 rest--;
			 a[i]=true;
	//		 cout<<i<<" ";
		 }
	 }
		int nl=0,al=0;
		for(int i=0;i<l;i++){
			if(a[i])al++;
			else nl++;
		}
	//	cout<<al<<" "<<nl<<endl;
	printf("%f\n",(double)al/v+(double)nl/u);

	 return 0;
 }

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

int main(void) {
    int a;
    int b;
    cin >> a >> b;
    int total = a + b;
    if (a % 3 == 0 || b % 3 == 0 || total % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = 1e8;

int dfs(int idx, int t, VVI& dp){
}

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

  int T;
  while(cin >> T, T){
	VI ts(T);
	REP(i,T) cin >> ts[i];
	int N; cin >> N;
	VI ms(100, 24);
	REP(i,N){
	  int d, m; cin >> d >> m;
	  ms[d-1] = min(ms[d-1], m);
	}

	VVI dp(100, VI(T, INF));
	dp[0][0] = 0;
	for(int i=0;i<100-1;++i){
	  for(int t=0;t<T;++t){
		int nt = (t + 1) % T;
		if(ts[nt] <= ms[i+1])
		  dp[i+1][nt] = min(dp[i+1][nt], dp[i][t]);
		dp[i+1][0] = min(dp[i+1][0], 1+dp[i][t]);
	  }
	}
	int ans = INF;
	REP(t,T)
	  ans = min(ans, dp[100-1][t]);
	cout << ans << endl;
  }
  
  return 0;
}

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

using namespace std;

void solve(void){
	string S;
	cin >> S;
	int l = (int)S.size();
	for (int i = 0; i < l; i++) {
		if (S[i] != S[l-1-i]) {
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long X,A;
    cin >> X >> A;
    if(X < A) cout << 0 << endl;
    else cout << 10 << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
void nckinit(ll n,ll md){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=md;
  }
  gya[n]=gyaku(kai[n],md);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=md;
  }
  gya[0]=1;
}
ll nck(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  ret*=gya[k];
  ret%=md;
  return ret;
}
ll npk(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,s;cin>>n>>s;
    int a[n];
    int sum[n+1];
    sum[0]=0;
    rep(i,0,n){
        cin>>a[i];
        sum[i+1]=sum[i]+a[i];
    }
    ll dp[n+1][s+1];
    rep(i,0,n+1){
        rep(j,0,s+1)dp[i][j]=0;
    }
    dp[0][0]=1;
    rep(i,0,n){
        rep(j,0,s){
            (dp[i+1][j]+=dp[i][j])%=mod2;
            if(j+a[i]<=s){
                ll u=1;
                if(j==0)u=i+1;
                (dp[i+1][j+a[i]]+=dp[i][j]*u)%=mod2;
            }
        }
    }
    ll ans=0;
    rep(i,0,n+1){
        //rep(j,0,s+1)cout<<dp[i][j]<<" ";
        //cout<<endl;
    }
    rep(i,0,n+1){
        (ans+=dp[i][s]*(n-i+1))%=mod2;
    }
    cout<<ans<<endl;
}







Measured memory_bytes: 70656
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <bitset>
#include <queue>
using namespace std;

int main()
{
    string s;
    cin >> s;
    const string key = "keyence";
    int len = s.length();
    int s_itr;
    string ans = "NO";
    if(s == key){
        ans = "YES";
    }
    for (int i=0; i<len; ++i){
        if(ans == "YES"){break;}
        for (int j=i; j<len; ++j){
            if(ans == "YES"){break;}
            if(len - (j - i + 1) != 7){
                continue;
            }
            else {
                for (int k=0; k<7; ++k){
                    if(k < i){s_itr = k;}
                    else {s_itr = len - (7 - k);}
                    if(key[k] != s[s_itr]){
                        break;
                    }
                    else if(k == 6 && key[k] == s[s_itr]){
                        ans = "YES";
                        //cout << "(i, j) -> (" << i << ", " << j << ")" << endl;
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int modd = 1e9 + 9;
const int X = 1000003;
const int XX = 1000007;
typedef long long ll;
#define mp make_pair


struct hash{
    int x,y;
};

char c;
string s;
ll n,i,t,tt,a,b,aa,bb,x,xx,bol=1,boll=1,ans;
map < pair < int , int > , int > M;

int main(){
    cin >> n >> s;
    for(t=X,i=mod-2; i ; i>>=1){
        if(i & 1) bol = bol*t % mod;
        t = t*t % mod;
    }
    for(t=XX,i=modd-2; i ; i>>=1){
        if(i & 1) boll = boll*t % modd;
        t = t*t % modd;
    }

    for(i=n-1; i>=0 ;i--){
        c = s[i];
        if(c == '+') xx++;
        if(c == '-') xx--;
        if(c == '>') xx *= XX;
        if(c == '<') xx *= boll;
        xx = (xx % modd + modd) % modd;
        if(c == '-') x--;
        if(c == '+') x++;
        if(c == '>') x *= X;
        if(c == '<') x *= bol;
        x = (x % mod + mod) % mod;
    }

    a = 1; b = 0;
    aa = 1;
    M[mp(x,xx)] = 1;
    for(i=0; i<n; i++){
        c = s[i];
        if(c == '-') b -= a, bb -= aa;
        if(c == '+') b += a, bb += aa;
        if(c == '<') a *= bol, aa *= boll;
        if(c == '>') a *= X, aa *= XX;
        a = (a % mod + mod) % mod;
        b = (b % mod + mod) % mod;
        aa = (aa % modd + modd) % modd;
        bb = (bb % modd + modd) % modd;


        t = (a*x + b) % mod;
        tt = (aa*xx + bb) % modd;

        ans += M[mp(b,bb)];
        M[mp(t,tt)]++;
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 31748
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
//use proconio::marker::*;
//use std::collections::HashSet;
// use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
    input! {
       A:i32,B:i32
    }

    println!(
        "{}",
        if A <= 5 {
            0
        } else if A <= 12 {
            B / 2
        } else {
            B
        }
    );
}


Measured memory_bytes: 2060
#include<stdio.h>
#include<string.h>
int main() {
	char s[101];
	scanf("%s",s);
	char t[102];
	scanf("%s",t);
	int len=strlen(s);
	int c=0;
	for (int i=0;i<len;i++)
	{
		if (s[i]==t[i])
			c++;
	}
	if (c==len)
		printf("Yes\n");
	else
		printf("No\n");
}


Measured memory_bytes: 1624
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(ll i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

vector<pair<int, int>>v;
vector<string>ans;
vector<int>range;

int main() {
	int n;
	cin >> n;
	ans.assign(n, "");
	int a, b, c;
	cin >> a >> b;
	c = abs(a + b) % 2;
	v.push_back(mp(a, b));
	REP(i, 1, n) {
		cin >> a >> b;
		v.push_back(mp(a, b));
		if (c != abs(a + b) % 2) {
			printf("-1\n");
			return 0;
		}
	}
	if (c == 0) {
		range.push_back(1);
		REP(i, 0, n) {
			v[i].first--;
			ans[i].push_back('R');
		}
	}
	int r = 1;
	REP(i, 0, 30) {
		range.push_back(r);
		REP(j, 0, n) {
			if (abs(v[j].first) % 4 == 1) {
				if ((abs(v[j].second) / 2) % 2 == 0) {
					if (v[j].first > 0) {
						v[j].first++;
						ans[j].push_back('L');
					}
					else {
						v[j].first--;
						ans[j].push_back('R');
					}
				}
				else {
					if (v[j].first > 0) {
						v[j].first--;
						ans[j].push_back('R');
					}
					else {
						v[j].first++;
						ans[j].push_back('L');
					}
				}
			}
			else if (abs(v[j].first) % 4 == 3) {
				if ((abs(v[j].second) / 2) % 2 == 0) {
					if (v[j].first > 0) {
						v[j].first--;
						ans[j].push_back('R');
					}
					else {
						v[j].first++;
						ans[j].push_back('L');
					}
				}
				else {
					if (v[j].first > 0) {
						v[j].first++;
						ans[j].push_back('L');
					}
					else {
						v[j].first--;
						ans[j].push_back('R');
					}
				}
			}
			else if (abs(v[j].second) % 4 == 1) {
				if ((abs(v[j].first) / 2) % 2 == 0) {
					if (v[j].second > 0) {
						v[j].second++;
						ans[j].push_back('D');
					}
					else {
						v[j].second--;
						ans[j].push_back('U');
					}
				}
				else {
					if (v[j].second > 0) {
						v[j].second--;
						ans[j].push_back('U');
					}
					else {
						v[j].second++;
						ans[j].push_back('D');
					}
				}
			}
			else {
				if ((abs(v[j].first) / 2) % 2 == 0) {
					if (v[j].second > 0) {
						v[j].second--;
						ans[j].push_back('U');
					}
					else {
						v[j].second++;
						ans[j].push_back('D');
					}
				}
				else {
					if (v[j].second > 0) {
						v[j].second++;
						ans[j].push_back('D');
					}
					else {
						v[j].second--;
						ans[j].push_back('U');
					}
				}
			}
			v[j].first /= 2;
			v[j].second /= 2;
		}
		r <<= 1;
	}
	range.push_back(r);
	REP(i, 0, n) {
		if (abs(v[i].first) == 1) {
			if (v[i].first > 0) {
				ans[i].push_back('R');
			}
			else {
				ans[i].push_back('L');
			}
		}
		else {
			if (v[i].second > 0) {
				ans[i].push_back('U');
			}
			else {
				ans[i].push_back('D');
			}
		}
	}
	cout << range.size() << endl;
	REP(i, 0, range.size()) {
		printf("%d ", range[i]);
	}
	printf("\n");
	REP(i, 0, n) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 384
import qualified Data.ByteString.Char8 as B
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  (n, m) <- getInt2
  lrs <- getInt2s
  print $ solve n m lrs

solve :: Int -> Int -> [(Int, Int)] -> Int
solve _ _ lrs = max (r - l + 1) 0 where
  (l, r) = foldr1 f lrs
  f (l1, r1) (l2, r2) = (max l1 l2, min r1 r2)

readInt2 :: B.ByteString -> (Int, Int)
readInt2 = (\[a, b] -> (a, b)) . map (fst . fromJust . B.readInt) . B.words

getInt2 :: IO (Int, Int)
getInt2 = readInt2 <$> B.getLine

getInt2s :: IO [(Int, Int)]
getInt2s = map readInt2 . B.lines <$> B.getContents


Measured memory_bytes: 37244
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(150) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<lli,lli>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
lli gcd(lli num1, lli num2){
    return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
int main(){
  lli A,B,C,D,E,L,R,X,Y,W,H,N,M,K,sum=0,num=0,flag=0;string S,T;
  cin >> N >> X;
  Vec(P,lli,N,0);
  rep(i,0,N)cin >> P[i];
  Vec(Q,lli,N,0);
  rep(i,0,N)Q[i]=abs(P[i]-X);
  rep(i,1,N)Q[i]=gcd(Q[i],Q[i-1]);
  Out(Q[N-1]);
}

Measured memory_bytes: 1792
def main():
    s = input()
    k = int(input())

    li = []
    num = 1
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            li.append(num)
            num = 1
        else:
            num += 1
    li.append(num)

    temp = 0
    ans = 0
    if len(li) == 1:
        ans += len(s) * k // 2
    else:
        for i in li:
            temp += i//2
        if s[0] != s[-1]:
            ans = temp * k
        else:
            li[0] += li[-1]
            for i in li[:-1]:
                ans += i//2
            ans = ans * (k-1) + temp
    print(ans)

main()


Measured memory_bytes: 3064
def main():
    import bisect
    n,m,k = map(int,input().split())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    A,B = [0],[0]
    for i in range(n):
        A.append(A[i]+a[i])
    for i in range(m):
        B.append(B[i]+b[i])
    ans = 0
    for i in range(n+1):
        cost = A[i]
        c = i
        if cost > k:
            continue
        cost = k-cost
        c += bisect.bisect_right(B,cost)-1
        if c>ans:
            ans = c
    print(ans)

if __name__ == "__main__":
    main()


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int h,w;

int to(int x,int y){
	return x+y*w;

}

P get(int num){
	return P(num%w,num/w);
}

int main(){
	cin >> h >> w;
	char s[h][w];
	rep(i,h) rep(j,w) cin >> s[i][j];

	int d[h*w][h*w];
	rep(i,h*w){
		rep(j,h*w){
			d[i][j] = INF;
		}
		d[i][i] = 0;
	}
	for(int i = 0; i < h*w; i++){
		for(int j = 0; j < h*w; j++){
			if(i==j) continue;
			P p1 = get(i),p2 = get(j);
			if(s[p1.second][p1.first] != '.' || s[p2.second][p2.first] != '.') continue;
			if(i-w==j || i+w==j || (i%w!=0&&i-1==j) || ((i+1)%w!=0&&i+1==j)){
				d[i][j] = 1;
			}
		}
	}

	for(int k = 0; k < w*h; k++){
		for(int i = 0; i < w*h; i++){
			for(int j = 0; j < w*h; j++){
				d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}

	int ans = 0;
	for(int i = 0; i < h*w; i++){
		for(int j = 0; j < h*w; j++){
			if(d[i][j] < INF) ans = max(ans,d[i][j]);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
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() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N,Q,R;
    cin >> N >> Q >> R;

    
    cout << N+Q+R-max({N,Q,R}) << endl;
}

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

static const int N=1000;

int lcs(char X[],char Y[])
{
  int i,j;
  int c[N+1][N+1];
  int m=strlen(X)+1;
  int n=strlen(Y)+1;
  int maxl=0;
    
  for(i=1;i<m;i++)
    {
      for(j=1;j<n;j++)
	{
	  if(X[i-1]==Y[j-1])
	    {
	      c[i][j]=c[i-1][j-1]+1;
	    }
	  else
	    {
	      if(c[i-1][j]>c[i][j-1])
		{
		  c[i][j] = c[i-1][j];
		}
	      else
		{
		  c[i][j]=c[i][j-1];
		}
            }
	    
	  if(c[i][j]>maxl)
	    {
	      maxl=c[i][j];
	    }
        }
    }
  return maxl;
}
  
int main(void)
{
  int i;
  int n;
  char s1[N],s2[N];
  
  scanf("%d",&n);

  for(i=0;i<n;i++)
    {
      scanf("%s %s",s1,s2);
   
      printf("%d\n",lcs(s1,s2));
    }

  return 0;
}



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

using namespace std;

typedef long long int ll;

const int mod = 1e9 + 7;

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

  int n;
  cin >> n;
  vector < int > a (n);
  vector < ll > suf (n);
  for (auto &i : a) cin >> i;
  suf[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) suf[i] = (a[i] + suf[i + 1]) % mod;

  ll ans = 0;
  for (int i = 0; i < n - 1; i++) {
    ans += a[i] * suf[i + 1];
    ans %= mod;
  }

  cout << ans << '\n';
}


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

using namespace std;

#define DPRINTF(...) printf(__VA_ARGS__)
#define FOR0(i, n) for(int i=0;i<n;i++)
#define ALL(c) (begin(c)), (end(c))
#define fst(t) get<0>(t)
#define snd(t) get<1>(t)
#define thd(t) get<2>(t)

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

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

  int N, K;
  cin >> N >> K;

  int dislike[10];
  FOR0(i, K){
      cin >> dislike[i];
  }

  int i = N;
  while(true){
      string si = to_string(i);

      bool f = true;
      FOR0(j, si.size()){
          FOR0(k, K){
              if(si[j] == dislike[k] + '0'){f = false;}
          }
      }

      if(f){cout << i << endl; return 0;}
      ++i;
  }
}


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

#define inf 1000000007

using namespace std;

vector<vector<int> > connect;
vector<int> visited;
int n;

void dfs(int start,int c){
	stack<int> st;
	st.push(start);
	while(!st.empty()){
		int k = st.top();
		visited[k] = c;
		st.pop();
		for(int i=0;i<connect[k].size();++i){
			int tmp = connect[k][i];
			if(visited[tmp]==-1){
				st.push(tmp);
			}
		}
	}
}

int main(){
	int m,k;
	cin >> n >> m >> k;
	connect.resize(n);
	visited.resize(n);
	vector<int> friends(n,0);
	vector<int> block(n,0);
	vector<int> cs;
	for(int i=0;i<m;++i){
		int s,t;
		cin >> s >> t;
		connect[s-1].push_back(t-1);
		connect[t-1].push_back(s-1);
		friends[s-1]++;
		friends[t-1]++;
	}
	int c = 0;
	for(int i=0;i<n;++i)visited[i] = -1;
	for(int i=0;i<n;++i){
		if(visited[i] == -1){
			dfs(i,c);
			c++;
		}
	}
	cs.resize(c,0);
	for(int i=0;i<n;++i){
		cs[visited[i]]++;
	}
	for(int i=0;i<k;++i){
		int s,t;
		cin >> s >> t;
		if(visited[s-1]==visited[t-1]){
			block[s-1]++;
			block[t-1]++;
		}
	}
	for(int i=0;i<n;++i){
		cout << cs[visited[i]] - 1 - friends[i] - block[i];
		if(i!=n-1)cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 8312
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using ll = long long;
using namespace std;

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

int main() {
	solve();
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
// use itertools::Itertools;
use std::cmp::{max, min};
use std::collections::*;
use std::i64;
use std::io::{stdin, Read};
use std::usize;

trait ChMinMax {
    fn chmin(&mut self, other: Self);
    fn chmax(&mut self, other: Self);
}
impl<T> ChMinMax for T
where
    T: PartialOrd,
{
    fn chmin(&mut self, other: Self) {
        if *self > other {
            *self = other
        }
    }
    fn chmax(&mut self, other: Self) {
        if *self < other {
            *self = other
        }
    }
}

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

use std::iter;
use std::mem;

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize, a: [usize; n], b: [usize; n]);
    let a: Vec<usize> = a;
    let mut b: Vec<usize> = b.into_iter().rev().collect();
    let mut l = n;
    let mut r = n;
    for i in 0..n {
        if a[i] == b[i] && l == n {
            l = i
        } else if a[i] != b[i] && l != n && r == n {
            r = i;
            break;
        }
    }
    if l != r {
        let v = b[l];
        let mut ml = n;
        let mut mr = n;
        for i in 0..n {
            if (a[i] == v || b[i] == v) && ml == n {
                ml = i;
            } else if a[i] > v && b[i] < v && mr == n {
                mr = i;
            }
        }
        for i in 0..ml {
            if l == r {
                break;
            }
            b.swap(i, l);
            l += 1;
        }
        for i in mr..n {
            if l == r {
                break;
            }
            b.swap(i, l);
            l += 1;
        }
    }
    if a.iter().zip(b.iter()).all(|(x, y)| x != y) {
        println!("Yes");
        // println!("{}", b.into_iter().map(|x| x.to_string()).join(" "));
        println!(
            "{}",
            b.into_iter()
                .map(|x| x.to_string())
                .collect::<Vec<_>>()
                .join(" ")
        );
    } else {
        println!("No");
    }
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 18816
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let k: usize = sc.read();
    let mut a: Vec<i64> = sc.vec(n);
    a.sort();

    let mut ng = -1 * 1e18 as i64 - 10;
    let mut ok = 1 * 1e18 as i64 + 10;
    while ok - ng > 1 {
        let v = (ok + ng) / 2;
        let count = count_lower_equals(&a, v);
        if count >= k {
            ok = v;
        } else {
            ng = v;
        }
    }
    println!("{}", ok);
}

fn count_lower_equals(a: &Vec<i64>, v: i64) -> usize {
    let n: usize = a.len();
    let mut sum = 0;
    let mut b = a.clone();
    b.reverse();
    for i in 0..n {
        let one = a[i];
        if one >= 0 {
            let j = a
                .binary_search_by_key(&(v * 2 + 1), |&a| a * one * 2)
                .err()
                .unwrap();
            if j > i {
                sum += j - 1;
            } else {
                sum += j;
            }
        } else {
            let j = b
                .binary_search_by_key(&(v * 2 + 1), |&a| a * one * 2)
                .err()
                .unwrap();
            let i = n - 1 - i;
            if j > i {
                sum += j - 1;
            } else {
                sum += j;
            }
        }
    }
    assert_eq!(sum % 2, 0, "v={} sum={}", v, sum);
    sum / 2
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 10492
n,m=map(int,input().split())
l_max=0
r_min=n
for i in range(m):
    l,r=map(int,input().split())
    l_max=max(l,l_max)
    r_min=min(r,r_min)
    if l_max>r_min:
        break
ans=max(0,r_min-l_max+1)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(){
    int a, p;
    cin >> a >> p;
    p += a * 3;
    cout << p / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main(){
    int N;
    cin >> N;
    std::map<string, int> mymap;
    int current_max = 0;

    for(int i=0; i<N; i++){
        string S;
        cin >> S;

        auto it = mymap.find(S);
        if (it != mymap.end()){
            it->second ++;
            if(it->second > current_max) current_max = it->second;

        }else{
            mymap.insert(make_pair( S, 1));
            if(current_max == 0) current_max =1;
        }
    };

    for(auto it = mymap.begin(); it != mymap.end(); ++it ){
        if (it ->second == current_max) {
            cout << it->first << endl;
        }
    }
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
#define DEBUG 0
/*
*/

using namespace std;


int main() {
	long long int N;
	cin >> N;
	vector<long long int>A(N);
	for (size_t i = 0; i < N; i++)
	{
		cin >> A[i];

	}
	sort(A.begin(), A.end());
	long long int ansmin = -1, ansmax = N;
	while (ansmin + 1 < ansmax)
	{
		long long int ansmid = (ansmax + ansmin) / 2;
		//cout << ansmin << " " << ansmid << " " << ansmax << endl;
		long long int nowsize = A[ansmid];
		bool f = true;
		for (size_t i = 0; i < N; i++)
		{
			if (i != ansmid)
			{
				if (nowsize * 2 >= A[i])
				{
					nowsize += A[i];
				}
				else {
					f = false;
					break;
				}
			}
		}
		if (f)
		{
			ansmax = ansmid;
		}
		else {
			ansmin = ansmid;
		}
	}
	cout << N - ansmin - 1 << endl;

	if (DEBUG)
	{
		int ewataeoprgjpsrteog;
		cin >> ewataeoprgjpsrteog;
	}
}

Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
s=input().strip()
t=input().strip()
last=-1
lastsp=-1
for i in range(len(s)-len(t)+1):
    flg=True
    flgsp=True
    for j in range(len(t)):
        #print(s[i+j],t[j])
        #print(flg,flgsp)
        if s[i+j]==t[j]:
            continue
        else:
            flgsp=False

        if s[i+j]=="?":
            continue
        else:
            flg=False
    #print(flgsp,flg)
    if flgsp:
        lastsp=i
    if flg:
        last=i
    #print(lastsp,last,i)
ans=""
if lastsp>=0:
    #print("A")
    for i in range(len(s)):
        if s[i]!="?":
            ans+=s[i]
        else:
            ans+="a"
elif last>=0:
    #print("B")
    for i in range(last):
        if s[i]!="?":
            ans+=s[i]
        else:
            ans+="a"
    ans+=t
    for i in range(last+len(t),len(s)):
        if s[i]!="?":
            ans+=s[i]
        else:
            ans+="a"
else:
    ans="UNRESTORABLE"
print(ans)


Measured memory_bytes: 38256
H, W, d = [int(x) for x in input().split(" ")]

res = ''

d2 = 2 * d
for h in range(H):
    for w in range(W):
        x = h - w
        y = h + w
        if x % d2 < d:
            c = 'R' if  y % d2 < d else 'B'
        else:
            c = 'G' if  y % d2 < d else 'Y'
        res+= c
    res += '\n'

print(res)


Measured memory_bytes: 3912
N = [int(i) for i in list(input())]
for i in range(8):
    ans = [str(N[0])]
    s = N[0]
    for b, n in enumerate(N[1:]):
        if i & (1 << b):
            s += n
            ans.append("+")
        else:
            s -= n
            ans.append("-")
        ans.append(str(n))
    if s == 7:
        ans.append("=7")
        print(''.join(ans))
        exit()


Measured memory_bytes: 38384
use proconio::input;
use std::cmp::min;

fn main() {
    input! {
        n: usize,
        k: usize,
        h: [i32; n],
    }

    println!("{}", dp(n, k, &h));
}

fn dp(n: usize, k: usize, h: &[i32]) -> usize {
    let mut dp = vec![0; n];

    for i in 1..n {
        // dpを求めるスタート地点を設定
        let start = if i <= k { 0 } else { i - k };

        let mut minimal = std::i32::MAX;
        for j in start..i {
            // カエルが飛べるなかでdpが最も低くなるところを探す
            minimal = min(minimal, dp[j] + (h[i] - h[j]).abs());
        }
        dp[i] = minimal;
    }
    dp[n - 1] as usize
}


Measured memory_bytes: 3144
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }
#define deb(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) {
    cerr << *it << " = " << a <<"  ,  ";
    err(++it, args...);
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        ll l,r,d;
        cin>>l>>r>>d;
        ll ans=0;
        for(ll x=l;x<=r;x++){
            if(x%d==0)ans++;
        }
        cout<<ans<<endl;
    }
    return 0;

}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;

const int NIL = -1;
const int MAX = 2000001;

int main(void)
{
	int n;
	int F[45];
	F[0] = F[1] = 1;
	cin >> n;
	for (int i = 2; i <= n; i++)
		F[i] = F[i - 1] + F[i - 2];
	cout << F[n] << endl;
	return 0;
}


Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define ok puts("OK");

using namespace std;

const int N = 3e3 + 5;

const double eps = 1e-12;

int a, b, c, d, e, f, u[N][N], res, cur;

double ans = -1;

void dfs (int v, int x)
{
    u[v][x] = 1;

    if ( v + a * 100 + x <= f && !u[v + a * 100][x])
        dfs(v + a * 100, x);

    if ( v + b * 100 + x <= f && !u[v + b * 100][x])
        dfs(v + b * 100, x);

    if ( v + x + c <= f && e * (v / 100) >= x + c && !u[v][x + c])
        dfs(v, x + c);

    if ( v + x + d <= f && e * (v / 100) >= x + d && !u[v][x + d])
        dfs(v, x + d);
}

main ()
{
    cin >> a >> b >> c >> d >> e >> f;

    dfs(0, 0);

    for (int i = 0; i <= f; i++)
    {
        for (int j = 0; j <= f; j++)
        {
            double x = i, y = j;

            if (u[i][j] && (x + y) / x - ans > eps )
            {
                ans = (x + y) / x;
                cur = i + j;
                res = j;
            }
        }
    }
    cout << cur << " " << res << endl;
}


Measured memory_bytes: 28928
#include<iostream>
using namespace std;
int main(){
    int H,W,a,d;
    while(1){
        cin>>H>>W;
        d=0;
        if (H==0&&W==0) break;
        else{
            for(int c=0;c<H;c++){
                if (d%2==0){
                    for(int b=0;b<W;b++){
                        if (a%2==0){
                            cout<<"#";
                            a+=1;
                        }
                        else{
                            cout<<".";
                            a+=1;
                        }
                    }
                    cout<<endl;
                    d+=1;
                    a=0;
                }else{
                    for(int b=0;b<W;b++){
                        if (a%2==0){
                            cout<<".";
                            a+=1;
                        }
                        else{
                            cout<<"#";
                            a+=1;
                        }
                    }
                    cout<<endl;
                    d+=1;
                    a=0;
                }
            }
        }cout<<endl;
    }    
}


Measured memory_bytes: 3084
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=2e5+10;
const int inf=1e9;
int T,n,k[N],l[N],r[N];
int c[N];
bool cmp(int x,int y){
    return abs(l[x]-r[x])>abs(l[y]-r[y]);
}
int main(){
    //ios::sync_with_stdio(false);
    //freopen("in","r",stdin);
    scanf("%d",&T);
    while(T--){
        scanf("%d",&n);
        set<int>q;
        int cnt=0;
        rep(i,1,n){
            scanf("%d%d%d",&k[i],&l[i],&r[i]);
            c[i]=i;q.insert(i);
            if(l[i]>=r[i]) cnt++;
        }
        sort(c+1,c+n+1,cmp);
        ll ans=0;
        for(int i=1;i<=n;i++){
            if(l[c[i]]>=r[c[i]]){
                auto it=q.upper_bound(min(k[c[i]],cnt));
                if(it!=q.begin()) --it;
                if(*it<=min(k[c[i]],cnt)){
                    ans+=l[c[i]];
                    q.erase(it);
                }else{
                    ans+=r[c[i]];
                }
            }else if(l[c[i]]<r[c[i]]){
                auto it=q.upper_bound(max(k[c[i]],cnt));
                if(it!=q.end()&&*it>max(k[c[i]],cnt)){
                    ans+=r[c[i]];
                    q.erase(it);
                }else{
                    ans+=l[c[i]];
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 16128
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    string s; cin >> s;
    cout << ((s[0] == s[1] && s[1] == s[2]) ? "No" : "Yes") << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main() {
 
  // input number
  int n;
  cin>>n;
 
  // input card
  vector<vector<vector<int>>> data(4, vector<vector<int>>(3, vector<int>(10,0)));
  for(int i=0;i<n;i++){
    int b,f,r,v;
    cin>>b>>f>>r>>v;
    data.at(b-1).at(f-1).at(r-1)+=v;
  }
  
  for(int i=0;i<4;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<10;k++){
        cout<<' '<<data.at(i).at(j).at(k);
      }
      cout<<endl;
    }
    if(i<3)
      cout<<"####################"<<endl;
  }    
  return 0;
}


Measured memory_bytes: 3160
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

const pair<int, int> NIL(-1, -1);
 
signed main() {
    int Q1, B, C1, C2, Q2;
    while(cin >> Q1, Q1) {
        cin >> B >> C1 >> C2 >> Q2;

        pair<int, int> ans = NIL;
        for(int i=Q2; i>=1; i--) {
            if(i * C1 > B) continue;
            int normal = (B - i * C1) / C2;
            if(i + normal < Q1) continue;

            ans = make_pair(i, normal);
            break;
        }

        if(ans != NIL) {
            cout << ans.first << " " << ans.second << endl;
        }
        else {
            cout << "NA" << endl;
        }
    }
    return 0;
}


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

const char* kAnswer[] = {"", "", "", "Three", "Four"};

int main() {
  int n;
  cin >> n;
  set<char> colors;
  for (int i = 0; i < n; ++i) {
    char s;
    cin >> s;
    colors.insert(s);
  }
  cout << kAnswer[colors.size()] << "\n";

  return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 宿泊日数と制限
        int n = sc.nextInt();
        int k = sc.nextInt();
        // 値段
        int x = sc.nextInt();
        int y = sc.nextInt();
        // 値段保持
        int z = 0;
        // 回数保持
        int ii = 1;

        for ( int i = 1; k >= i; i++ ) {
            if (i > n) {
                break;
            }
            z = z + x;
            ii++;
        }

        for ( int i = ii; n >= i; i++) {
            z = z + y;
        }
        // 出力
        System.out.println(z);
    }
}

Measured memory_bytes: 9552
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
vector<ll> w, v;
vector<vector<ll> > a;
ll f(int n, int W){
    if(n == 0 || W == 0) return 0;
    else if(w[n] > W) f(n-1, W);
    else{
        if(a[n][W] != -1) return a[n][W];
        else {
            ll ans = max(f(n-1, W), v[n] + f(n-1, W-w[n]));
            a[n][W] = ans;
            return ans;
        }
    }
}
int main(){
    int n, W;
    scanf("%d%d", &n, &W);
    forn(i, n+1) {
        vector<ll> q;
        forn(j, W+1) q.pb(-1);
        a.pb(q); 
    }
    w.pb(0);
    v.pb(0);
    forn(i, n) {
        ll x, y;
        scanf("%lld%lld", &x, &y);
        w.pb(x);
        v.pb(y);
    }
    printf("%lld", f(n, W));
}

Measured memory_bytes: 80228
//by Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<s32>
#define p32 pair<int,int>
#define p64 pair<ll,ll>
#define fi first
#define se second
#define ln '\n'
#define debug(x) cout << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream& operator<<(ostream& out, const pair<T,U>& p){
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename ...Args>
void print_container(const ContainerType<ValueType, Args...>& c){
	cout << "{ ";
	for(const auto& v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

int main()
{
	FASTIO;
	ll k,x;
	cin >> k >> x;
	int ctr = 2 * (k - 1) + 1;
	ll curr = x - k + 1;
	while(ctr--) cout << curr << " ",curr++;
	return 0;
}


Measured memory_bytes: 256
import sys
 
N = int(input())
W = list(map(int, input().split()))
S1=S2=0
abstack=65535
count=0
 
while count!=(N-1):
    for x in range(0, count+1):
        S1+=W[x]
 
    for y in range(count+1, N):
        S2+=W[y]
 
    if(abstack>abs(S1-S2)):
        abstack=abs(S1-S2)
 
    S1=S2=0
    count+=1
 
print(abstack)

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;

void solve() {
  char C;
  cin >> C;
  printf("%c\n", C + 1);
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // ここにプログラムを追記
  
  char a[3];
  cin >> a;
  int cnt = 0;
  for(int i=0;i<3;i++){
    if (a[i]=='1'){
      cnt += 1;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		for(int x=k+1;x<=n;x++){
			if(a[x-1]>a[x-k-1]){System.out.println("Yes");}
			else{System.out.println("No");}
		}
	}
}

Measured memory_bytes: 60156