akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#define llint long long
#define inf 1e18
#define mod 998244353
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)

using namespace std;
typedef pair<llint, llint> P;

int n;
string s;
int p[1<<18];
int dp[1<<19];
vector<int> vec;

void calc(int n, vector<int> &vec)
{
	if(n == 0){
		dp[1] = vec.front();
		return;
	}
	
	int N = 1<<n;
	vector<int> tmp(N/2);
	for(int i = 0; i < N; i+=2){
		int d = abs(vec[i] - vec[i+1]);
		if(s[d] == '0') tmp[i/2] = min(vec[i], vec[i+1]);
		else tmp[i/2] = max(vec[i], vec[i+1]);
	}
	calc(n-1, tmp);
	for(int i = 0; i < N/2; i++){
		int b = N/2+i;
		dp[(b<<1)+0] = dp[b];
	}
	
	for(int i = 1; i+1 < N; i+=2){
		int d = abs(vec[i] - vec[i+1]);
		if(s[d] == '0') tmp[i/2] = min(vec[i], vec[i+1]);
		else tmp[i/2] = max(vec[i], vec[i+1]);
	}
	int d = abs(vec.back() - vec.front());
	if(s[d] == '0') tmp.back() = min(vec.back(), vec.front());
	else tmp.back() = max(vec.back(), vec.front());
	
	calc(n-1, tmp);
	for(int i = 0; i < N/2; i++){
		int b = N/2+i;
		dp[(b<<1)+1] = dp[b];
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> s;
	s = "#" + s;
	
	llint N = 1<<n;
	for(int i = 0; i < N; i++) cin >> p[i];
	for(int i = 0; i < N; i++) vec.push_back(p[i]);
	
	calc(n, vec);
	
	for(int i = 0; i < N; i++){
		int b = N + i;
		cout << dp[b] << "\n";
	}
	flush(cout);
	
	return 0;
}


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

bool has[26];

int main() {
	string str;
	cin>>str;
	for (int i = 0; i < (int)str.size(); i++) has[str[i]-'a']=1;
	for (int i = (int)str.size()-1; i >= -1; i--) {
		int j;
		for (j = i == (int)str.size()-1 ? 0 : str[i+1]-'a'+1; j < 26 && has[j]; j++);
		if (i>=0) has[str[i]-'a']=0;
		if (j == 26) continue;
//		cout<<i<<" "<<j<<"\n";
		str = str.substr(0,i+1) + char(j+'a');
		cout<<str;
		return 0;
	}
	cout<<-1;
	return 0;
}

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







const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}

struct L : public vector<P> {
	L() {}
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};

typedef vector<P> G;

struct C {
	P p; double r;
	C(const P &p, double r) : p(p), r(r) { }
};









int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if (cross(b, c) > 0)   return +1;       // counter clockwise
	if (cross(b, c) < 0)   return -1;       // clockwise
	if (dot(b, c) < 0)     return +2;       // c--a--b on line
	if (norm(b) < norm(c)) return -2;       // a--b--c on line
	return 0;
}

P crosspoint(const L &l, const L &m) {
	double A = cross(l[1] - l[0], m[1] - m[0]);
	double B = cross(l[1] - l[0], l[1] - m[0]);
	if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
	if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
	return m[0] + B / A * (m[1] - m[0]);
}



#define curr(PP, i) PP[i]
#define next(PP, i) PP[(i+1)%PP.size()]
G convex_cut(const G& g, const L& l) {
	G Q;
	for (int i = 0; i < g.size(); ++i) {
		P A = curr(g, i), B = next(g, i);
		if (ccw(l[0], l[1], A) != -1) Q.push_back(A);
		if (ccw(l[0], l[1], A)*ccw(l[0], l[1], B) < 0)
			Q.push_back(crosspoint(L(A, B), l));
	}
	return Q;
}

double area2(const G& p) {
	double A = 0;
	for (int i = 0; i < p.size(); ++i)
		A += cross(curr(p, i), next(p, i));
	return A / 2.0;
}

P normal(const P& p)
{
	return P(-imag(p), real(p));
}




int N, M;
G poly;
P C[10];

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

	while (cin >> N >> M)
	{
		if (N == 0) return 0;

		poly.clear();
		rep(i, 0, N)
		{
			double x, y;
			cin >> x >> y;
			poly.push_back(P(x, y));
		}

		rep(i, 0, M)
		{
			double x, y;
			cin >> x >> y;
			C[i] = P(x, y);
		}

		rep(i, 0, M)
		{
			G pp = poly;
			rep(j, 0, M) if (i != j)
			{
				P from = (C[i] + C[j]) / 2.0;
				P norm = normal(C[j] - C[i]);
				P to = from + norm;

				pp = convex_cut(pp, L(from, to));
			}
			printf("%.10f\n", area2(pp));
		}
	}
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 1000003;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define HelloFile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define ll long long
int main()
{
    Hello
    ll n, sum = 0;
    vector<pair<ll, ll>>v;
    cin >> n;
    for(int i = 0, a, b; i < n; i++)
    {
        cin >> a >> b;
        v.push_back({b, a});
    }
    sort(v.begin(), v.end());
    for(int i = 0; i < v.size(); i++)
    {
        sum += v[i].second;
        if( sum > v[i].first )
            return cout << "No", 0;
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 6384
N,M=map(int,input().strip().split(" "))

a=[]
b=[]

for i in range(N):
    a.append(input())

N=0

for i in range(M):
    b.append(input())
    if(b[i] in a[i]):
        N+=1

if(N==M):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#pragma GCC optimize(2) 
#include<bits/stdc++.h>
#define rg register
#define il inline
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
il int gi(){
	rg int o=0,fl=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')fl=-1,ch=getchar();
	while(isdigit(ch))o=o*10+ch-'0',ch=getchar();
	return fl*o;
}
int n,x,y,z,ok,all;
ll ans=1,dp[45][1<<18];
int main(){
	scanf("%d%d%d%d",&n,&x,&y,&z);
	for(int i=1;i<=n;++i)ans=10*ans%mod;
	all=(1<<x+y+z)-1;
	ok=(1<<x+y+z-1)|(1<<y+z-1)|(1<<z-1);
	dp[0][0]=1;
	for(int i=1;i<=n;++i)
		for(int j=0;j<=all;++j)
			if(dp[i-1][j])
				for(int k=1;k<11;++k){
					int s=((j<<k)|(1<<k-1))&all;
					if((s&ok)==ok)continue;
					(dp[i][s]+=dp[i-1][j])%=mod;
				}
	for(int i=0;i<=all;++i)(ans+=mod-dp[n][i])%=mod;
	printf("%d\n",ans);
	return 0;
}


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

int main() {
	char s[5];
	scanf("%s",s);
	if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3])){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  vector<P> xs;
  cin >> N;
  rep(i, N) {
    int a;
    cin >> a;
    xs.pb(P(a, 0));
  }
  rep(i, N) {
    int a;
    cin >> a;
    xs.pb(P(a, 1));
  }
  sort(all(xs));
  int d = 0, s = 1;
  rep(i, 2*N) {
    if (xs[i]._2 == 0) {
      if (d < 0) s = (1LL*s*(-d)) % MOD;
      d++;
    }
    else {
      if (d > 0) s = (1LL*s*d) % MOD;
      d--;
    }
  }
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 2420
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b;
  cin >> a >> b;
  cout << (a - 1) * (b - 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n;
	scanf("%d",&n);
	if(65<=n&&n<=90){
		printf("1\n");
	}
	else if(97<=n&&n<=122){
		printf("2\n");
	}
	else{
		printf("0\n");
	}
	return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
  string str;
  cin >> str;
  int count = 0;
  for (int i = 0; i < str.size() / 2; i++) {
    if (str[i] != str[str.size() - i - 1]) count++;
  }
  cout << count << 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;

typedef long long ll;

int main() {
    ll N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    ll G = abs(A - B);
    int x = (G + D - 1) / D;
    if (x > N - 1) {
        cout << "NO\n";
        return 0;
    }
    if ((x + N) % 2 == 0) x++;
    //cout << "x=" << x << "\n";
    if (x * C <= G) {
        cout << "YES\n";
        return 0;
    }
    if ((x - 1) * C - D <= G && G <= (x - 1) * D - C) {
        cout << "YES\n";
        return 0;
    }
    ll d = min({abs(G - x * C), abs((x - 1) * D - C - G), abs((x - 1) * C - D - G)});
    if ((D - C) * (N - 1 - x) / 2 >= d) {
        cout << "YES\n";
        return 0;
    }
    cout << "NO\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define N 100004

int isPrime[N] = {};
double m = N;


int sieveOfEratosthenes(void) {
    int i, j;
    int num = sqrt(m);
    for (i = 2; i < num; i++) {
        if (isPrime[i]) continue;
        for (j = 2; i*j < N; j++) {
            isPrime[i*j] = 1;
        }
    }
    return 0;
}

int main(void) {
    int x;
    scanf("%d", &x);

    sieveOfEratosthenes();

    while (isPrime[x]) x++;
    
    printf("%d\n", x);
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main()
{
    int n,b[100],i,ans = 0;
    scanf("%d",&n);
    for (i = 0; i < n - 1; i++)
    {
        scanf("%d",&b[i]);
    }
    ans += b[n - 2];
    ans += b[0];
    for (i = n - 2; i > 0; i--)
    {
        if (b[i] < b[i - 1])
        {
            ans += b[i];
        }
        else
        {
            ans += b[i - 1];
        }        
    }
    printf("%d",ans);
}


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

// ll FizzBuzz(int n){
//     if(n%3!=0 && n%5!=0)
//         return n;
//     else
//         return 0;
// }

int main() {
    int n;
    cin >> n;
    ll sum=0;
    for(int i=1;i<=n;i++){
        if(i%3!=0 && i%5!=0)
          sum += i;
    }
    cout << sum << endl;
    return 0;
}



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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	for (int i = 1; i <= 9; i++) {
		if (N % i == 0 && N / i <= 9) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


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

int H, W;
vector<vector<char>> S;
int ans;

void bfs(int h, int w) {
  vector<vector<int>> dist(H, vector<int>(W, -1));
  dist.at(h).at(w) = 0;
  vector<int> mh(4), mw(4);
  mh = {-1, 0, 1, 0};
  mw = {0, 1, 0, -1};
  queue<pair<int,int>> Q;
  Q.push({h, w});
  while (Q.size()) {
    int h = Q.front().first;
    int w = Q.front().second;
    Q.pop();
    for (int i = 0; i < 4; i++) {
      int nh = h + mh.at(i);
      int nw = w + mw.at(i);
      if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
      if (S.at(nh).at(nw) == '#') continue;
      if (dist.at(nh).at(nw) == -1) {
        dist.at(nh).at(nw) = dist.at(h).at(w) + 1;
        Q.push({nh, nw});
        ans = max(ans, dist.at(nh).at(nw));
      }
    }
  }
}

int main() {
  cin >> H >> W;
  S.resize(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> S.at(i).at(j);
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S.at(i).at(j) == '.') bfs(i, j);
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
struct edge{
    int v,next;
}a[200003];
int n,k,x,ans,tot,num[100003],head[100003],dis[100003];
inline void add(int u,int v){
    a[++tot].v=v,a[tot].next=head[u],head[u]=tot;
}
void dfs(int u){
    dis[u]=1;
    for(int tmp=head[u];tmp;tmp=a[tmp].next){
        int v=a[tmp].v;
        dfs(v);
        dis[u]=max(dis[u],dis[v]+1);
    }
    if(dis[u]>=k&&num[u]!=1){
        ans++;
        dis[u]=0;
    }
}
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>num[i];
        if(i==1){
            if(num[i]!=1)ans++;
            num[1]=1;
        }else{
            add(num[i],i);
        }
    }
    dfs(1);
    cout<<ans<<endl;
    return 0;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll a, b, n;
    cin >> a >> b >> n;
    ll ans;
    if (n < b - 1) {
        ans = (a * n) / b;
    } else {
        ans = (a * (b - 1)) / b;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        //いつもの
        readonly static long mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());

            int[] CumulativeSums = Enumerable.Repeat(0, (int)Math.Pow(10, 5) + 1).ToArray();
            int[] CumulativeSums2 = Enumerable.Repeat(0, (int)Math.Pow(10, 5) + 1).ToArray();
            int hoge = 0;int tmp = 0;
            for (int i = 0; i <= (int)Math.Pow(10, 5); i++)
            {
                if (Is_Prime(i))
                {
                    if (Is_Prime( (i+1)/2 ))
                    {
                        hoge++;
                    }
                }
                CumulativeSums[i] = hoge;
            }

            for (int i = 0; i < n; i++)
            {
                int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
                int l = s[0];
                int r = s[1];
                WriteLine(
                    (CumulativeSums[r] - CumulativeSums[l-1])
                    );

            }
        }

        /// <summary>
        /// 素数判定を行う関数
        /// 計算量はO(n)
        /// </summary>
        /// <param name="n">対象変数</param>
        /// <returns></returns>
        static bool Is_Prime(long n)
        {
            if (n == 2)
            {
                return true;
            }
            if (n < 2 || n % 2 == 0)
            {
                return false;
            }
            int i = 3;
            while (i <= Math.Sqrt(n))
            {
                if (n % i == 0)
                {
                    return false;
                }
                i += 2;
            }
            return true;
        }
    }
}

Measured memory_bytes: 18488
#define DEBUG 0
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 6/22/2019, 8:54:27 PM
 * Powered by Visual Studio Code
 */
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
typedef long long ll;
void Yes()
{
  cout << "Good" << endl;
  exit(0);
}
void No()
{
  cout << "Bad" << endl;
  exit(0);
}
const int MAX_SIZE = 1000010;
class mint
{
public:
  static ll MOD;
  ll x;
  mint() : x(0) {}
  mint(ll x) : x(x % MOD) {}
  mint operator-() const { return x ? MOD - x : 0; }
  mint &operator+=(const mint &a)
  {
    if ((x += a.x) >= MOD)
    {
      x -= MOD;
    }
    return *this;
  }
  mint &operator-=(const mint &a) { return *this += -a; }
  mint &operator*=(const mint &a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint &operator/=(const mint &a) { return (*this *= power(MOD - 2)); }
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  mint operator/(const mint &a) const { return mint(*this) /= a; }
  bool operator<(const mint &a) const { return x < a.x; }
  bool operator==(const mint &a) const { return x == a.x; }
  const mint power(ll N)
  {
    if (N == 0)
    {
      return 1;
    }
    else if (N % 2 == 1)
    {
      return *this * power(N - 1);
    }
    else
    {
      mint half = power(N / 2);
      return half * half;
    }
  }
};
ll mint::MOD = 1e9 + 7;
istream &operator>>(istream &stream, mint &a) { return stream >> a.x; }
ostream &operator<<(ostream &stream, const mint &a) { return stream << a.x; }
mint inv[MAX_SIZE];
mint fact[MAX_SIZE];
mint factinv[MAX_SIZE];
void init()
{
  inv[1] = 1;
  for (int i = 2; i < MAX_SIZE; i++)
  {
    inv[i] = (-inv[mint::MOD % i]) * (mint::MOD / i);
  }
  fact[0] = factinv[0] = 1;
  for (int i = 1; i < MAX_SIZE; i++)
  {
    fact[i] = mint(i) * fact[i - 1];
    factinv[i] = inv[i] * factinv[i - 1];
  }
}
mint choose(int n, int k)
{
  if (n >= 0 && k >= 0 && n - k >= 0)
  {
    return fact[n] * factinv[k] * factinv[n - k];
  }
  return 0;
}
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
// const double epsilon = 1e-10;
// const ll infty = 1000000000000000LL;
// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

int main()
{
  // init();
  string S;
  cin >> S;
  for (auto i = 0; i < 3; i++)
  {
    if (S[i] == S[i + 1])
    {
      No();
    }
  }
  Yes();
}

Measured memory_bytes: 23680
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class B
{
	public static void Main()	
	{
		int W = GetInt();
		int a = GetInt();
		int b = GetInt();

		if(b + W < a)
		{
			Console.WriteLine(a - b - W);
		}
		else if(b > a + W)
		{
			Console.WriteLine(b - a - W);
		}
		else
		{
			Console.WriteLine(0);
		}
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


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

int main(){
    int N;
    long long M, Q;
    cin >> N >> M >> Q;
    long long cnt[N+1][N+1];
    rep(i, N+1){
        rep(j,N+1) cnt[i][j] = 0;
    }
    int L, R;
    rep(i, M){
        cin >> L >> R;
        cnt[L][R]++;
    }
    long long dp[N+1][N+1];
    dp[1][N] = M;
    rep2(i, 1, N){
        long long sum = 0;
        rep2(j, i, N+1){
            sum += cnt[i][j];
        }
        dp[i+1][N] = dp[i][N] - sum;
    }
    rep2(i, 1, N+1){
        for(int j = N; j > i; j--){
            long long sum = 0;
            rep2(k, i, j+1){
                sum += cnt[k][j];
            }
            dp[i][j-1] = dp[i][j] - sum;
        }
    }
    int p, q;
    rep(i, Q){
        cin >> p >> q;
        cout << dp[p][q] << endl;
    }
}

Measured memory_bytes: 4864
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
	ll n, k, d, answer = 0, ChildrensSweets[101] = {};
	cin >> n >> k;
	for (int i = 0; i < k; i++)
	{
		cin >> d;
		for (int j = 0; j < d; j++)
		{
			ll a;
			cin >> a;
			ChildrensSweets[a]++;
		}
	}
	for (int i = 1; i <= n; i++)
	{
		if (ChildrensSweets[i] == 0)
		{
			answer++;
		}
	}
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long 
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
 
vector<int> a[500005] ;
ll v[500005]={0};
ll dp[500005]={0};
int n,ans=0;
int cou[500005]={0};
void dfs(int x)
{
	v[x]=ans;
	cou[ans]++;
	for(int i=0;i<a[x].size();i++)
	{
		if(v[a[x][i]]==0)
		{
			dfs(a[x][i]);
			
		}
		//cou[a[x][i]]=cou[ans];
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  int n,k;
  cin>>n>>k;
  int h[n];
  for(int i=0;i<n;i++)
  {
    cin>>h[i];
  }
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  for(int i=2;i<n;i++)
  {
    int j=i-1;
    int mini=dp[j]+abs(h[i]-h[j]);
    j--;
    while(i-j<=k && j>=0)
 	 {
 	   mini=min(dp[j]+abs(h[j]-h[i]),mini);
                j--;
                }
   dp[i]=mini;
                }
  
/* for(int i=0;i<n;i++)
   cout<<dp[i]<<" ";*/
cout<<dp[n-1];
  return 0;
}

Measured memory_bytes: 18304
from itertools import accumulate
from bisect import bisect_right
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = list(filter(lambda x: x <= k, accumulate(A)))
B = list(filter(lambda x: x <= k, accumulate(B)))
ans = 0
for i, a in enumerate(A):
    j = bisect_right(B, k-a)
    ans = max(ans, i+j+1)
ans = max(ans, len(B))
print(ans)

Measured memory_bytes: 41752
#include <stdio.h>

int N;
	
int A[100];
void print() {
    for (int i = 0; i < N; i++) {
        printf("%d",A[i]) ;
        if (i != N - 1) printf(" ");
    }
    printf("\n");
}
int main(){
	scanf("%d",&N);
	int i,k;
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	print();
	for (int i = 1; i < N; i++) {
        
        int v = A[i], j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        print();
    }

	return 0;
} 


Measured memory_bytes: 2672
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	b := make([]int, n - 1)
	for i := 0; i < n-1; i++ {
		fmt.Scan(&b[i])
	}
	s := 0

	a := make ([]int, n)
	for i := 0; i < n; i++ {
		a[i] = 100001
	}

	for i, _ := range b {
		if a[i] > b[i] {
			a[i] = b[i]
		}
		if a[i + 1] > b[i] {
			a[i + 1] = b[i]
		}
	}
	for _, v := range a {
		s += v
	}
	fmt.Println(s)
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;

int main() {
  int n; cin >> n;
  vector<pair<int, int>> tasks;
  rep(i, n) {
    int a, b; cin >> a >> b;
    tasks.emplace_back(b, a);
  }
  sort(tasks.begin(), tasks.end());
  int sum = 0;
  bool ok = true;
  for(auto v : tasks) {
    sum += v.second;
    if(sum > v.first) {
      ok = false;
      break;
    }
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 2420
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int INF = 2e6;
ll MOD = 1e9 + 7;

int main(){
    int n,ans = 1; cin >> n;

    for(int i = 2; i < 32;i++){
        int I = i * i;
        while(I <= n){
            ans = max(ans,I);
            I *= i;
        }

    }
    cout << ans << endl;
}


Measured memory_bytes: 256
// Vicfred
// https://atcoder.jp/contests/abc156/tasks/abc156_b
use std::io;

fn main() {
    let mut line = String::new();

    io::stdin()
        .read_line(&mut line)
        .unwrap();

    let words: Vec<i64> =
        line
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    let mut n = words[0];
    let k = words[1];

    let mut digits = 0;

    while n > 0 {
        n /= k;
        digits += 1;
    }

    println!("{}", digits);
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007


signed main(){

	lli s;
	cin>>s;
	lli n = 1000000000;

	if(s==n*n){
		cout<<0<<" "<<0<<" "<<n<<" "<<0<<" "<<0<<" "<<n<<endl;
		return 0;
	}
	cout<<0<<" "<<0<<" "<<1<<" "<<n<<" ";

	lli x = (s+n)/n;
	lli y = n*x-s;

	cout<<x<<" "<<y<<endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
ans = 0
for i in range(60):
  keta=1<<i
  cnt=0
  for j in a:
    if keta & j:
      cnt+=1
  ans+=((keta%mod)*cnt*(n-cnt))%mod


print(ans%mod)


Measured memory_bytes: 50972
#include <stdio.h>
#include <string.h>
#define M 1000007
#define L 14
char H[M][L];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M + 1));}

int find(char str[]){
  int i, h=0;
  long long k;
  k = getKey(str);
  for(i = 0; i < M; i++){
    h = (h1(k) + i*h2(k))%M;
    if(H[h][0] == '\0') return 0;
    if(strcmp(str,H[h]) == 0) return 1;
  }
  return 0;
}
void insert(char str[]){
  int i=0, h;
  long long k;
  k = getKey(str);
  for(i = 0; i< M; i++){
    h = (h1(k) + i*h2(k))%M;
    if(H[h][0] == '\0'){
      strcpy(H[h], str);
      break;
    }
  }
}


int main(){
  int i, j, n;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';    

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%s %s",com, str);
    
    if(com[0] == 'i') insert(str);
    else{
      if(find(str)) printf("yes\n");
      else printf("no\n");
    } 
  }
  return 0;
}

Measured memory_bytes: 14280
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int N, H;
    cin >> N >> H;
    
    vector<int> a(N), b(N);
    priority_queue<int> bb;
    for (int i = 0; i < N; i++) {
        cin >> a[i] >> b[i];
        bb.push(b[i]);
    }

    sort(ALL(a), greater<int>());
    sort(ALL(b), greater<int>());

    int cnt = 0;
    for(int i = 0; i < N; i++) {
        if (b[i] < a[0]) break;
        H -= b[i];
        cnt++;
        if (H <= 0) {
            cout << cnt <<endl;
            return 0;
        }
    }
    // cout << H << " " << cnt << endl;

    cout << cnt + (H+a[0]-1) / a[0] << endl;

    return 0;
}

Measured memory_bytes: 1660
open Core

let a, b, c, x = Scanf.scanf "%d %d %d %d" (fun a b c x -> (a, b, c, x))

let ar = List.range ~stop:`inclusive 0 a

let br = List.range ~stop:`inclusive 0 b

let cr = List.range ~stop:`inclusive 0 c

let space = List.cartesian_product (List.cartesian_product ar br) cr

let n =
  List.map space ~f:(fun abc ->
      match abc with
      | (a, b), c when (500 * a) + (100 * b) + (50 * c) = x ->
          true
      | _ ->
          false)
  |> List.count ~f:Fn.id

let () = Printf.printf "%d\n" n


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

int main(void)
{
    char word[33], longest[33] = {0}, history[100][33] = {0};
    int frequency[100] = {0}, i, last;
    int max, maxloc;

    last = 0;
    while(scanf("%s", word) != EOF){
        if (strlen(word) > strlen(longest)){
            strncpy(longest, word, strlen(word));
        }

        if(last == 0){
            strncpy(history[last], word, strlen(word));
            frequency[last]++;
            last++;
        }else {
            for(i = 0; i < last; i++){
                if (strlen(word) == strlen(history[i])){
                    if(strcmp(history[i], word) == 0){
                        frequency[i]++;
                        break;
                    }
                }
            }
            if (i >= last){
                strncpy(history[last], word, strlen(word));
                frequency[last]++;
                last++;
            }
        }
        // for(i = 0; i <= last; i++){
        //     if(frequency[i] > max) max = frequency[i];
        //     printf("%d:%s ", i, history[i]);
        // }
        // putchar('\n');
        // for(i = 0; i < 100; i++) printf ("%d  ", frequency[i]);
        // putchar('\n');
    }
    
    max = 0;
    maxloc = 0;
    for(i = 0; i <= last; i++){
        if(frequency[i] > max){
            max = frequency[i];
            maxloc = i;
        }
        //printf("%d:%s ", i, history[i]);
    }
    printf("%s %s\n", history[maxloc], longest);
    return (0);
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> l(n);
  for(int i=0;i<n;i++) {
    cin >> l[i];
  }
  sort(l.rbegin(), l.rend());
  int total = 0;
  for(int i=0;i<k;i++) {
    total += l[i];
  }

  cout << total << endl;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var n int
  fmt.Scan(&n)
  xs := make([]float64, n)
  us := make([]string, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&xs[i], &us[i])
  }
  result := 0.0
  for i := 0; i < n; i++ {
    x := xs[i]
    u := us[i]
    if u == "JPY" {
      result += x
    } else {
      result += x*380000.0
    }
  }
  fmt.Printf("%f\n", result)
}

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

using ll = long long;

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

int main(void){
  int n; cin >> n;
  string s; cin >> s;
  string t="";

  if(n%2!=0){
    cout << "No" << endl;
    return 0;    
  }

  rep(i,n/2){
    t+=s[i];
  }
  rep(i,t.size()){
    if(t[i] != s[i+n/2]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
  return 0;
}


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

#define MAX_N 100

int main() {
    int N;
    cin >> N;
    set<int> dset;
    for (int i = 0; i < N; i++) {
        int d;
        cin >> d;
        dset.insert(d);
    }
    cout << dset.size() << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>

using namespace std;

double calcExpectation(int p){
	double tempP = p;
	return tempP*(tempP+1.0)/(2.0*tempP);
}

int main()
{
	int N,K;
	cin>>N>>K;
	int *p = new int[N];
	double *expectation = new double[N];
	for(int i = 0; i < N; i++){
		cin>>p[i];
		expectation[i] = calcExpectation(p[i]);
	}
	double sumEx = 0;
	double ans;
	for(int i = 0; i < K; i++){
		sumEx += expectation[i];
	}
	ans = sumEx;
	//cout<<sumEx<<endl;
	for(int i = 0; i < (N-K);i++){
		sumEx = sumEx - expectation[i] + expectation[i+K];
		if(sumEx > ans){
			ans = sumEx;
		}
		//cout<<sumEx<<endl;
	}
	printf("%.12lf\n",ans);
	return 0;
}



Measured memory_bytes: 2560
/*I wanna be the very best, like no one ever was...*/

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);
 


int main() {
    io;

    char s;
    cin>>s;
    cout<<static_cast<char>(s + 1);
  

 
 
 
    
 
    return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class UnionFind{
	vector<ll> rank;
	vector<ll> diff_weight;
	vector<ll> num;
public:
	vector<ll> par;

	UnionFind(ll N):par(N),num(N),rank(N),diff_weight(N){
		for(ll i=0;i<N;i++){
			par[i]=i;
			num[i]=1;
			rank[i]=0;
			diff_weight[i]=0;
		}
	}

	ll root(ll x){
		if(par[x]==x){
			return x;
		}
		ll r = root(par[x]);
		diff_weight[x]+=diff_weight[par[x]];
		return par[x]=r;
	}

	void unite(ll x,ll y){
		ll rx = root(x);
		ll ry = root(y);
		if (rx == ry) return;
		if(rank[rx]<rank[ry]) swap(rx,ry);
		if(rank[rx]==rank[ry]) ++rank[rx];
		par[ry] = rx;
		num[rx] += num[ry];
	}

	void relate(ll x,ll y,ll w){
		w+=weight(x),w-=weight(y);
		ll rx = root(x);
		ll ry = root(y);
		if (rx == ry) return;
		if(rank[rx]<rank[ry]){
			swap(rx,ry);
			w = -w;
		}
		if(rank[rx]==rank[ry]) ++rank[rx];
		par[ry] = rx;
		diff_weight[ry] = w;
		num[rx] += num[ry];
	}

	bool same(ll x,ll y){
		ll rx = root(x);
		ll ry = root(y);
		return rx == ry;
	}

	ll getsize(ll x){
		return num[root(x)];
	}

	ll weight(ll x){
		root(x);
		return diff_weight[x];
	}

	ll diff(ll x,ll y){
		return weight(y)-weight(x);
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int H=in(),W=in();
	UnionFind uf(H*W);
	vector<string> M(H);
	REP(i,H){
		M[i]=in<string>();
	}

	REP(i,H){
		REP(j,W){
			int p=j+i*W;
			if(j>0 && M[i][j]!=M[i][j-1]){
				uf.unite(p,p-1);
			}
			if(j<W-1 && M[i][j]!=M[i][j+1]){
				uf.unite(p,p+1);
			}
			if(i>0 && M[i][j]!=M[i-1][j]){
				uf.unite(p,p-W);
			}
			if(i<H-1 && M[i][j]!=M[i+1][j]){
				uf.unite(p,p+W);
			}
		}
	}
	map<int,ll> black,white;
	REP(i,H){
		REP(j,W){
			int p=j+i*W;
			if(M[i][j]=='#'){
				black[uf.root(p)]++;
			}
			else{
				white[uf.root(p)]++;
			}
		}
	}

	unordered_set<int> S;
	ll sum = 0;
	REP(i,H*W){
		int r = uf.root(i);
		auto res = S.insert(r);
		if(!res.second) continue;
		sum += black[r]*white[r];
	}

	out(sum);
	return 0;
}


Measured memory_bytes: 28616
/*
  NAME : RISHABH SINGH
  INSTITUTION : DELHI TECHNOLOGICAL UNIVERSITY
*/
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define pii pair<int, int>
#define bi __builtin_inf()
#define ll long long
#define mp make_pair
#define ss second
#define pb push_back
#define ff first
#define speed_cubing ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define um unordered_map
#define us unordered_set
#define bp __builtin_popcount
#define ld long double
#define rep(n) for (int i = 0; i < n; i++)
#define pll pair<ll, ll>
#define mx = 1e18;
#define lb(v, val) (lower_bound(v.begin(), v.end(), val) - v.begin())
#define ub(v, val) (upper_bound(v.begin(), v.end(), val) - v.begin())
#define PI 3.1415926535
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
#define sz(v) (int)v.size()
#define endl '\n'
const int mod = 998244353;
ll mul_inv(ll a,ll b = mod) {ll t1=a,t2=b,t3,v1=1,v2=0,v3;while(t2!=1){ll x=t1/t2;t3=t1-x*t2;v3=v1-x*v2;t1=t2,t2=t3;v1=v2,v2=v3;}return(v2+b)%b;}
const int N = 1e2+5;

int32_t main(){
   
   speed_cubing
   
   string s,t;
   cin>>s>>t;

   int cnt = 0;

   for(int i=0;i<s.size();i++)
      if(s[i]!=t[i])
        cnt++;

   cout<<cnt;     
    
   return 0;
}

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

int main(){
  string S;
  cin>>S;
  int Q;
  cin>>Q;
  vector<string> vec(S.size());
  rep(i,S.size()){
      vec.at(i)=S.at(i);
  }
  int T, F;
  string c[Q], d[Q];
  string a;
  int countT1=0;

  rep(i, Q){
      cin>>T;
      if (T==1){
          countT1++;
      }
      else{
          cin>>F>>a;
          if (countT1%2==0&&F==1){
              c[i]=a;
          }
          if (countT1%2==1&&F==1){
              d[i]=a;
          }
          if (countT1%2==0&&F==2){
              d[i]=a;
          }
          if (countT1%2==1&&F==2){
              c[i]=a;
          }
      }
  }
  if (countT1%2==0){
  rep(i,Q){
      cout<<c[Q-i-1];
  }
 
      cout<<S;

  
  rep(i,Q){
      cout<<d[i];
  }
  }
  if (countT1%2==1){
  rep(i,Q){
      cout<<d[Q-i-1];
  }
  
      reverse(vec.begin(),vec.end());
      rep(i,S.size()){
          cout<<vec.at(i);
      }
  
  rep(i,Q){
      cout<<c[i];
  }
  }

}

Measured memory_bytes: 18560
#include <iostream>
using namespace std;
int mi(int Y, int M, int D){
    int ans = ((Y%3==0)?20:((M%2==0)?19:20)) - D + 1;
    if(M<10){
        for(int m = M+1 ; m <= 10 ; m++){
          ans += ((Y%3==0)?20:((m%2==0)?19:20));
        }
      }
    for(int y = Y+1 ; y < 1000 ; y++){
      for(int m = 1 ; m <= 10 ; m++ ){
        ans += ((y%3==0)?20:((m%2==0)?19:20));
      }
    }
    return ans;
}
int main(void){
    int n;
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        int Y, M, D;
        cin >> Y >> M >> D;
        cout << mi(Y,M,D) << endl;
    }
}



Measured memory_bytes: 3088
#include<iostream>
#include<math.h>
using namespace std;

int main(){
    int N;
    bool flag = true;
    cin >> N;
    int t[N+1],x[N+1],y[N+1];
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    for (int i = 1; i <= N; i++){
        cin >> t[i] >> x[i] >> y[i];
        if (i != 0){
            if((t[i] - t[i - 1]) - (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) < 0 || (t[i] - t[i - 1]) % 2 != (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) % 2){
                flag = false;
            }
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
typedef vector<int> vi;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];
int gcd(int a,int b)
{
    if(b==0){
      return a;
     }
    return gcd(b,a%b);
}
int lcm(int a,int b)
{
    int res=(a*b)/gcd(a,b);
    return res;
}
int po(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b%2!=0)
        {
            res*=a;
            b--;
        }
        else
        {
            a*=a;
            b/=2;
        }
    }
    return res;
}

lln modMul(lln  a, lln b,lln mod){
    lln ans = 0;
    a = a % mod;
    while (b > 0){
        if ( b % 2 )ans = (ans%mod+ a%mod) % mod;
        a = (a%mod * 2%mod) % mod;
        b /= 2;
    }
    return ans % mod;
}
lln powerMod(lln a,lln b,lln mod){
	if(b==0)return 1LL%mod;
	lln x=powerMod( a,b/2,mod );
	x = ( x%mod * x%mod ) % mod;
	if( b%2==1 )x = ( x%mod * a%mod ) % mod;
	return x%mod;
}

int main()
{
   lln n,ans=1;
   cin>>n;
   for(lln i=1;i<=n;i++)
   {
       ans=((ans%1000000007)*((i%1000000007))%1000000007);
   }
   cout<<ans;

}






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


int main(void){
    int N,M;
    cin >> N >> M;
    int A[N];
    rep(i,N) cin>>A[i];
    int sum = 0;
    rep(i,N) sum += A[i];
    int count = 0;
    rep(i,N){
        if(A[i]*4*M>=sum) count++;
    }
    if(count>=M) cout<<"Yes"<<endl;
    else cout << "No"<< endl;

    return 0;
}

Measured memory_bytes: 256
/*
ЗАПУСКАЕМ 
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░ 
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>


using namespace std;
template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;}
template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;}
#define files(FILENAME) read(FILENAME); write(FILENAME)
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define left left228
#define right right228
#define y1 y1228
#define mp make_pair
#define pb push_back
#define y2 y2228
#define rank rank228
using ll = long long;
using ld = long double;
const string FILENAME = "input";
const int MAXN = 200228;



int sum[MAXN];
bool del[MAXN];
int cnt[2];


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 //	read(FILENAME);
	string s;
	cin >> s;
	for (int i = sz(s) - 1; i >= 0; i--) {
		if (s[i] == '1') {
			sum[i]++;
		}
		sum[i] += sum[i + 2];
	}
	ll ans = sum[0];
	int last = 0;
	int cnts = 0;
	for (int i = 0; i < sz(s) - 1; i++) {
		if (s[i] == '1' && last == 0) {
			cnts++;
		}
		if (last == 0 && s[i] == '0' && s[i + 1] == '1') {
			del[i] = true;
			ans += cnts + sum[i + 1];
		} else {
			last = 1 - last;
		}
	}
	string t;
	for (int i = 0; i < sz(s); i++) {
		if (!del[i]) {
			t += s[i];
		}
	}
	s = t;
	vector<int> pr(sz(s));
	for (int i = 0; i < sz(s); i++) {
		pr[i] = (i % 2 == 0 ? s[i] - '0': 0);
		if (i > 0) {
			pr[i] += pr[i - 1];
		}
	}
	for (int i = sz(s) - 1; i >= 0; i--) { 
		cnt[i % 2] += s[i] - '0';
		if (s[i] == '0') {
			swap(cnt[0], cnt[1]);
			ans += cnt[0] + pr[i];
		}
	}
	int cnt1 = 0;
	for (int i = 0; i < sz(s); i++) {
		cnt1 += (s[i] == '1');
	}
	for (int i = 0; i < cnt1; i++) {
		ans += (cnt1 - i) / 2;
	}
	cout << ans << endl;
	return 0; 	
}


Measured memory_bytes: 5520
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

void solve() {
    cini(n);
    while(n>0)
        n-=1000;
    cout<<abs(n)<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


Measured memory_bytes: 3656
use proconio::input;

fn main() {
  input! {
    x: usize,
    n: usize,
  }

  let mut p = vec![0;0];

  for _n in 0..n {
    input!{in_p: usize}
    p.push(in_p);
  }

  let mut i = x;
  let mut j = x;

  loop {
    if !p.contains(&i) {
      println!("{}", i);
      break;
    }
    if !p.contains(&j) {
      println!("{}", j);
      break;
    }

    i -= 1;
    j += 1;
  }

  //println!("Hello, AtCoder!");
}


Measured memory_bytes: 2176
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
wsv = [list(map(int,readline().split())) for _ in range(n)]
wsv.sort(key=lambda x:x[0]+x[1])

dp = [[0] * (2*10**4+1) for _ in range(n+1)]
for i in range(n):
    wi,si,vi = wsv[i]
    for j in range(1,2*10**4+1):
        if(j < wi):
            dp[i+1][j] = max(dp[i+1][j-1],dp[i][j])
        elif(j <= wi+si):
            dp[i+1][j] = max(dp[i+1][j-1],dp[i][j],dp[i][j-wi]+vi)
        else:
            dp[i+1][j] = max(dp[i+1][j-1],dp[i][j])

print(dp[-1][-1])

Measured memory_bytes: 226596