akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(ll A, ll B) {
  A = (A+11)%13;
  B = (B+11)%13;
  string ans = A > B ? "Alice" : A < B ? "Bob" : "Draw";
  cout << ans << endl;
}

int main() {
  ll A;
  cin >> A;
  ll B;
  cin >> B;
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int x[55];
ll dp[55][55][2550];

int main(void){
    int n, a; cin >> n >> a;
    rep(i, n){
        cin >> x[i]; 
    }

    rep(i, 55)rep(j, 55)rep(k, 2550) dp[i][j][k] = 0;
    dp[0][1][x[0]] = 1; dp[0][0][0] = 1;
    for (int i = 0; i < n - 1; ++i){
        for (int j = 0; j <= n; ++j){
            for (int k = 0; k <= 2500; ++k){
                if(dp[i][j][k] == 0) continue;
                //i + 1番目を選ぶ
                dp[i + 1][j + 1][k + x[i + 1]] += dp[i][j][k];
                //i + 1選ばない
                dp[i + 1][j][k] += dp[i][j][k];
            }
        }
    }

    ll ans = 0;
    for (int j = 1; j <= n; ++j){
        int aim = j * a;
        if(aim <= 2500 && dp[n - 1][j][aim] != 0){
            ans += dp[n - 1][j][aim];
        }
    }
    printf("%lld\n", ans);
    return 0;
}

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

using namespace std;

int main() {
    long long number;
    cin >> number;
    long long ans = 0;
    for (int i = 1; i<number+1; i++){
        if (i%3 != 0 and i%5 != 0){
            ans += i;
        }
    }
    cout << ans << endl;
}

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

int main()
{
    long n,i;
    cin>>n;
    long A[n];
    for(i=0;i<n;i++)
        cin>>A[i];

    long long dp[n+1];
    dp[0]=0;
    dp[1]=0;
  	dp[2]=abs(A[1]-A[0]);
    for(i=3;i<=n;i++)
        dp[i]=min(dp[i-1]+abs(A[i-1]-A[i-2]),dp[i-2]+abs(A[i-1]-A[i-3]));
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 1792
#include <iostream>

int main() {
  int A, B;
  std::cin >> A >> B;
  if ((A % 2) + (B % 2) == 1) {
    std::cout << "IMPOSSIBLE" << std::endl;
  } else {
    std::cout << ((A + B) / 2) << std::endl;
  }
  return 0;
}

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


struct UnionFind {
    int num;
    vector<int> par;

    explicit UnionFind(int n) : par(n, -1), num(n) {}
    void init(int n) { par.assign(n, -1); }

    int find_root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = find_root(par[x]);
    }

    bool is_same(int x, int y) {
        return find_root(x) == find_root(y);
    }

    bool unite(int x, int y) {
        int root_x = find_root(x);
        int root_y = find_root(y);
        if (root_x == root_y) return false;
        if (par[root_x] > par[root_y]) swap(root_x, root_y); // unite technique
        par[root_x] += par[root_y];
        par[root_y] = root_x;
        num--;
        return true;
    }

    int size(int x) {
        return -par[find_root(x)];
    }
    int count() const {
        return num;
    }
};

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

    int N, M;
    cin >> N >> M;
    UnionFind uf(N);
    for (int i = 0; i < M; ++i) {
        int x, y, z;
        cin >> x >> y >> z;
        uf.unite(--x, --y);
    }

    cout << uf.num << '\n';

    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>

void encode(int n,char *a,char *A,int m,char *b){
	int mm,nn;
	for(mm=0;mm<m;mm++){
		for(nn=0;nn<n;nn++){
			if(b[mm]==a[nn]){
				b[mm]=A[nn];
				break;
			}
		}
	}
}
int main(void){
	char *a,*A,*b,c,d,e;
	int m,n,o;
	while(1){
		scanf("%d\n",&n);
		if(n==0)break;
		a=(char*)malloc(sizeof(char)*(n+1));
		A=(char*)malloc(sizeof(char)*(n+1));
		for(o=0;o<n;o++){
			scanf("%c %c\n",&c,&d);
			a[o]=c,A[o]=d;
		}
		scanf("%d\n",&m);
		b=(char*)malloc(sizeof(char)*(m+1));
		for(o=0;o<m;o++){
			scanf("%c\n",&e);
			b[o]=e;
		}
		encode(n,a,A,m,b);
		printf("%s\n",b);
		free(a);
		free(A);
		free(b);
		
		
	}
	return 0;
}

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

using ll = long long;
#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using namespace std;
int main() {
    int n;
    cin >> n;

    map<int, int> cnt;
    rep(i, 0, n) {
        int val;
        cin >> val;
        cnt[val]++;
    }
    int ans = 0;
    for (auto val : cnt) {
        if (val.first > val.second) {
            ans += val.second;
        } else if (val.first < val.second) {
            ans += val.second - val.first;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<unordered_map>
#include<bitset>
#include<cctype>
#include<sstream>
#define LL long long
#define ULL  unsigned  long long
#define maxn (LL)1e6
#define INF 0x3f3f3f3f
#define inf 0x7fffffff
#define PI  acos(-1.0)
#define pb push_back
#define re register LL
const double eps = 0.0000001;
using namespace std;
typedef pair<int,int> pii;
inline int sgn(double x) {
    return (x > eps) - (x < -eps);
}
static char buf[100000],*pa=buf,*pd=buf;
#define gc pa==pd&&(pd=(pa=buf)+fread(buf,1,100000,stdin),pa==pd)?EOF:*pa++
inline int read()
{
    register LL x(0),f(1);register char c(gc);
    while(c>'9'||c<'0')f=c=='-'?-1:1,c=gc;
    while(c>='0'&&c<='9')x=x*10+c-48,c=gc;
    return f*x;
}
int T,n,m;
LL A[10000];
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
   // freopen("input.txt","r",stdin);
   // freopen("outl.txt","r",stdin);
    #endif // ONLINE_JUDE
    cin>>n;
   long double ans = 1;
    for(int i = 1;i<=n;++i) {
        cin>>A[i];
        ans *= A[i];
    }
   long double sum = 0;
    for(int i = 1;i<=n;++i)
    {
        sum += ans/A[i];
    }
    cout<<fixed<<setprecision(15)<<(long double)ans*1.0/sum<<endl;




}


Measured memory_bytes: 256
function gets(str){
  this._s = str.split("\n");
  this._y = 0;
};
gets.prototype = {
  a: function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y] = s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  },
  l: function(f){
    var s = this._s[this._y++].split(" ");
    return f?s:s.map(a=>+a);
  },
  m: function(n,f){
    var s = this._s, y = this._y, r = [], i = 0;
    if(f)for(;i < n; i++)r[i] = s[y+i].split(" ");
    else for(;i < n; i++)r[i] = s[y+i].split(" ").map(a=>+a);
    this._y += n;
    return r;
  },
};
var o=new gets(require("fs").readFileSync("/dev/stdin","utf8"));
var mod = 1e9 + 7;

console.log(main());
function main(){
  var h = o.a();
  var w = o.a();
  if(w === 1)return 1;
  var k = o.a();
  var dp = Array(h+1).fill(0).map(a=>Array(w+1).fill(0));
  dp[0][1] = 1;
  var v = [1,1,2,3,5,8,13,21,34]
  for(var i = 1; i <= h; i++){
    dp[i][1] = dp[i-1][1] * v[w-1];
    dp[i][1] += dp[i-1][2] * v[w-2];
    dp[i][1] %= mod;
    for(var j = 2; j < w; j++){
      dp[i][j] = dp[i-1][j-1] * v[j-2] * v[w-j];
      dp[i][j] += dp[i-1][j] * v[j-1] * v[w-j];
      dp[i][j] += dp[i-1][j+1] * v[j-1] * v[w-j-1];
      dp[i][j] %= mod;
    }
    dp[i][w] = dp[i-1][w-1] * v[w-2];
    dp[i][w] += dp[i-1][w] * v[w-1];
    dp[i][w] %= mod;
  }
  return dp[h][k];
}

Measured memory_bytes: 21192
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			//Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int k = vs[1];
			int[] p = Console.ReadLine().Split().Select(int.Parse).ToArray();
			double sum = 0;
			double ans = 0;
			for (int i = 0; i < k; i++) {
				sum += ((double)p[i] + 1) / 2;
			}
			ans = sum;
			for (int i = k; i < n; i++) {
				sum -= ((double)p[i-k] + 1) / 2;
				sum += ((double)p[i] + 1) / 2;
				ans = Math.Max(ans, sum);
			}
			Console.WriteLine(ans);


			//Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 33372
#include <cstdio>
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#define f first
#define s second
#define mp make_pair

using namespace std;

int main(){
  int n, m;
  while(scanf("%d%d", &n, &m), n + m){
    vector<int> coins(n);
    vector<int> memo(m, -1);
    queue<int> que;
    vector<int> amount(1 << n, 0);

    REP(i,n) scanf("%d", &coins[i]);

    REP(i,1<<n){
      REP(j,n) if(i & (1 << j)){
	amount[i] += coins[j];
      }
    }

    memo[0] = 0;
    que.push(0);

    while(que.size()){
      int sum = que.front(); que.pop();
      int cnt = memo[sum];

      REP(i,1<<n){
	int s = sum + amount[i];
	
	if(s > m) continue;
	if(s == m){
	  printf("%d\n", cnt + 1);
	  goto end;
	}
	if(memo[s] == -1){
	  memo[s] = cnt + 1;
	  que.push(s);
	}
      }
    }
  end:;
  }
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

void solve()
{
    int n;
    cin>>n;
    vi a(n),dp(n+1,0);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=2;i<=n;i++) {
        dp[i] = dp[i-1]+abs(a[i-1]-a[i-2]);
        if(i-3>=0)
            dp[i] = min(dp[i],dp[i-2]+abs(a[i-1]-a[i-3]));
    }

    cout<<dp[n];
    
}

int main()
{
    fastio;
    int t;
    t = 1;
    //cin >> t;
    //int test=t;
    
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    
    int a[n];
    forn(i, 0, n) {
        cin >> a[i];
    }
    
    bool dp[k+1] = {};
    forn(i, 1, k+1) {
        for (auto &j : a) {
            if (i-j >= 0) {
                dp[i] |= !dp[i-j];
            }
        }
    }
    if (dp[k]) cout << "First\n";
    else cout << "Second\n";
}


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

int main(void){
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    ll sa = abs(a - b), ssa = v - w;
    if(sa - t * ssa <= 0) cout << "YES" << endl;
    else cout << "NO" << endl;  
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

#define N 4
int main(){
  int M[]={31,29,31,30,31,30,31,31,30,31,30,31};
  int m,d,i;
  scanf("%d %d",&m,&d);
  while((m!=0) && (d!=0)){
    int sum_day=0;
    for (i=0;i<m-1;i++){
      sum_day+=M[i];
    }
    sum_day+=d;
    switch(sum_day%7){
    case 0:printf("Wednesday\n");break;
    case 1:printf("Thursday\n");break;
    case 2:printf("Friday\n");break;
    case 3:printf("Saturday\n");break;
    case 4:printf("Sunday\n");break;
    case 5:printf("Monday\n");break;
    case 6:printf("Tuesday\n");break;
    }
    scanf("%d %d",&m,&d);
  }

  return 0;
}

Measured memory_bytes: 584
def one_and_one():
    lis = list("abcdefghijklmnopqrstuvwxyz")
    N = int(input())
    res = ""
    n = N - 1
    while n >= 0:
        res = lis[n % 26] + res
        n = n // 26 - 1
    print(res)
    
one_and_one()
        

Measured memory_bytes: 9168
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

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

int main()
{
  INT(N);
  string S;
  cin >> S;
  vector<set<int>> nanmojime(26,set<int>());
  REP(i,sz(S)){
    nanmojime[S[i]-'a'].insert(i);
  }
  INT(Q);
  vector<int> ans;
  REP(i,Q){
    INT(type);
    if(type==1){
      INT(a);
      a--;
      char b;
      cin >> b;
      nanmojime[S[a]-'a'].erase(a);
      S[a]=b;
      nanmojime[b-'a'].insert(a);
    }else{
      INT(a);
      INT(b);
      a--;
      b--;
      int cnt = 0;
      REP2(j,'a','z'){
        auto itr=nanmojime[j-'a'].lower_bound(a);
        if(itr==nanmojime[j-'a'].end()) continue;
        if(b>=*itr){
          // cout << *itr << endl;
          cnt++;
        }
      }
      ans.push_back(cnt);
    }
  }

  REP(i,sz(ans)){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 27468
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 100000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int LOG = 40;
const ull BASE = 19260817;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
// const double PI = acos(-1);
const double PI = 3.14159;

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

namespace Comb{
inline void exgcd(ll a, ll b, ll &g, ll &x, ll &y) {
    if (!b) g = a, x = 1, y = 0;
    else exgcd(b, a % b, g, y, x), y -= x * (a / b);
}
 
inline ll inv(ll a) {
    ll g, res, tmp;
    exgcd(a, MOD, g, res, tmp);
    return ((res % MOD) + MOD) % MOD;
}
 
ll f[N], invFact[N];
 
inline void prepare() {
    f[0] = 1;
    int n = 200000;
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % MOD;
    invFact[n] = inv(f[n]);
    for (int i = n - 1; i >= 1; i--) invFact[i] = invFact[i + 1] * (i + 1) % MOD;
}
 
inline ll C(int n, int m) {
    if (!m) return 1;
    if (n == m) return 1;
    if (m > n) return 0;
    if (m < 0) return 0;
    return f[n] * invFact[m] % MOD * invFact[n - m] % MOD;
}
}

int n;
ll ans;
std::map< Pair, int > map;

inline Pair calc(int x) {
    int last = x % 10, first;
    while (x >= 10) {
        x /= 10;
    }
    first = x % 10;
    return mp(first, last);
}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        Pair tmp = calc(i);
        map[tmp]++;
    }
    for (int i = 1; i <= n; i++) {
        Pair t = calc(i);
        Pair tmp = mp(t.se, t.fi);
        ans += map[tmp];
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scan(&N)
	fmt.Scan(&K)
	prices := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&prices[i])
	}

	sort.Ints(prices)
	r := 0
	for i := 0; i < K; i++ {
		r += prices[i]
	}

	fmt.Println(r)
}

Measured memory_bytes: 1888
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
int A[100111];

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%d", A+i);
    sort(A, A+N);

    LL ans = -(1LL<<60);
    if (N % 2 == 0) {
	LL tmp = 0;
	REP (i, N/2) {
	    tmp -= A[i] * 2;
	    tmp += A[i+N/2] * 2;
	}
	tmp += A[N/2-1];
	tmp -= A[N/2];
	amax(ans, tmp);
    } else {
	REP (t, 2) {
	    int H = N/2;
	    LL tmp = 0;
	    REP (i, H) {
		tmp -= A[i]*2;
	    }
	    for (int i=H; i<N; i++) tmp += A[i]*2;
	    tmp -= A[H];
	    tmp -= A[H+1];
	    amax(ans, abs(tmp));
	    reverse(A, A+N);
	}
    }
    printf("%lld\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 640
N=int(input())
t0=0
x0=0
y0=0
for i in range(N):
  t,x,y = map(int, input().split())
  l = abs(x-x0) + abs(y-y0)
  if (l > (t-t0)) or (l%2 != (t-t0)%2):
    print("No")
    break
  else:
    x0 = x
    y0 = y
    t0 = t
else:
  print("Yes")


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

int str[21][100000];

int main(){
    int n;
    while(cin>>n,n){
        int a,r,cntlen;
        char input[101];
        cin>>input;
        for(int i=0;;i++){
            if(input[i]=='\0'){
                str[0][i]=-1;
                break;
            }
            str[0][i]=input[i]-'0';
        }
        for(int i=0;i<n;i++){
            /*for(int j=0;str[i][j]!=-1;j++){
                printf("%d",str[i][j]);
            }puts("");*/
            a=-1;
            cntlen=0;
            for(int j=0;;j++){
                if(str[i][j]==-1 || a!=str[i][j]){
                    if(~a){
                        str[i+1][cntlen]=r;str[i+1][cntlen+1]=a;
                        cntlen+=2;
                    }
                    if(str[i][j]==-1){
                        str[i+1][cntlen]=-1;
                        break;
                    }
                    a=str[i][j];
                    r=1;
                }
                else{
                    r++;
                    if(r==10){
                        str[i+1][cntlen]=1;
                        cntlen++;
                        r=0;
                    }
                }
            }
        }
        for(int i=0;str[n][i]!=-1;i++){
            printf("%d",str[n][i]);
        }puts("");
    }
    return 0;
}

Measured memory_bytes: 7328
#include <bits/stdc++.h> 
using namespace std;
int main()
{
    int t,i,a; long long ans=0;
    cin>>t;
  vector<int> ar1(t),ar;
    
    for(i=0;i<t;i++)
    {
        cin>>a; ar.push_back(a);
    }
    ar1[0]=ar[0];
  for(i=1;i<t;i++)
  {
    ar1[i]=max(ar[i],ar1[i-1]);
    ans+=(ar1[i]-ar[i]);
  }
  cout<<ans;
    return 0;
}

Measured memory_bytes: 5108
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
#define pb push_back
#define make make_pair
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}


int main(){
    string s;
    cin >> s;
    ll d=s.size();
    ll ans[d];
    rep(i,d) ans[i]=0;
    ll Lpart=0;
    ll Rpart=0;
    rep(i,d){
        if(i==0) {
            Rpart++;
            continue;
        }
        if(i==d-1){
            Lpart++;
            if(Lpart%2==0){
                ans[i-Lpart]+=Lpart/2;
                ans[i-Lpart+1]+=Lpart/2;
                }
            else{
                ans[i-Lpart+1]+=Lpart/2 +1;
                ans[i-Lpart]+=Lpart/2;
                }
        }
        if(Rpart>0){
            if(s[i]=='R') Rpart++;
            else{
                if(Rpart%2==0) {
                    ans[i-1]+=Rpart/2;
                    ans[i]+=Rpart/2;
                }
                else{
                    ans[i-1]+=Rpart/2 +1;
                    ans[i]+=Rpart/2;
                }
                Rpart=0;
                Lpart++;
            }
        }
        else if(i!=d-1){
            if(s[i]=='L') Lpart++;
            else{
                if(Lpart%2==0){
                    ans[i-Lpart-1]+=Lpart/2;
                    ans[i-Lpart]+=Lpart/2;
                }
                else{
                    ans[i-Lpart]+=Lpart/2 +1;
                    ans[i-Lpart-1]+=Lpart/2;
                }
                Rpart++;
                Lpart=0;
            }
        }
    }
    rep(i,d) cout << ans[i] << " " ;
    cout << "" << endl;
}



Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <queue>
#include <map>
#include <numeric>
using namespace std;
typedef long long int ll;

ll mod=1e9+7;

ll mod_pow(ll a,ll b){
	a%=mod;
	if(b==0)return 1;
	if(b==1)return a;
	ll res=mod_pow(a,b/2)%mod;
	res*=res; res%=mod;
	if(b%2)res*=a;
	return res%mod;
}

struct perm{
private:
	int sz;
	vector<ll> p,invp;
public:
	perm(int n){
		sz=n+1;
		p.resize(sz),invp.resize(sz);
		p[0]=1;
		for(int i=1;i<=sz-1;i++){
			p[i]=p[i-1]*i%mod;
		}
		invp[sz-1]=mod_pow(p[sz-1],mod-2);
		for(int i=sz-2;i>=0;i--){
			invp[i]=invp[i+1]*(i+1)%mod;
		}
	}
	ll comb(ll x,ll y){
		if(x<y||y<0)return 0;
		return (p[x]*invp[x-y]%mod)*invp[y]%mod;
	}
};
perm p(400040);

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,x,y; cin >> n >> x >> y;
	vector<pair<int,int>> v,vv;
	vector<int> mi(n,1e9);
	ll res=1;
	for(int i=0;i<n;i++){
		int c,w; cin >> c >> w;
		c--;
		v.push_back({c,w});
		mi[c]=min(mi[c],w);
	}
	for(int i=0;i<n;i++){
		if(mi[i]<1e9){
			vv.push_back({mi[i],i});
		}
	}
	sort(vv.begin(),vv.end());
	if(vv.size()==1){
		cout << 1 << endl;
		return 0;
	}
	// 最小値は2個みとけばおっけー
	// for文で0~2回すと実装楽そう
	vector<bool> can(n,0),colar(n,0);
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			if(v[i].first!=vv[j].second&&v[i].second+vv[j].first<=y){
				can[i]=1;
				colar[v[i].first]=1;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(colar[v[i].first]&&v[i].second+mi[v[i].first]<=x)can[i]=1;
	}
	vector<int> num(n,0);
	int sum=0;
	for(int i=0;i<n;i++){
		if(can[i]){
			sum++; num[v[i].first]++;
		}
	}
	for(int i=0;i<n;i++){
		(res*=p.comb(sum,num[i]))%=mod;
		sum-=num[i];
	}
	cout << res%mod << endl;
}

Measured memory_bytes: 11888
import sys
def input():
	return sys.stdin.buffer.readline()[:-1]

BASE, MOD = 1999849216943526259, (1<<61)-1

d = dict()
ans = 0
ss = [str(input())[2:-1][::-1] for _ in range(int(input()))]
zero = [0 for _ in range(26)]
ss.sort(key=lambda x: -len(x))
for s in ss:
	n = len(s)
	if n == 1:
		ans += zero[ord(s[n-1])-97]
	else:
		hashes = [0 for _ in range(n-1)]
		hashes[0] = ord(s[0])
		for i in range(1, n-1):
			hashes[i] = (hashes[i-1] * BASE + ord(s[i])) % MOD
		if hashes[n-2] in d:
			ans += d[hashes[n-2]][ord(s[n-1])-97]
		alph = [0 for _ in range(26)]
		alph[ord(s[n-1])-97] = 1
		for i in range(n-2, 0, -1):
			alph[ord(s[i])-97] = 1
			if hashes[i-1] not in d:
				d[hashes[i-1]] = [0 for _ in range(26)]
			for j, a in enumerate(alph):
				d[hashes[i-1]][j] += a
		alph[ord(s[0])-97] = 1
		for j, a in enumerate(alph):
			zero[j] += a
print(ans)

Measured memory_bytes: 597956
N, K = map(int, input().split())
A = list(map(int, input().split()))
# print(N, K, A)

mod = 10**9 + 7
B = [0]*N
for i in range(N):
    ai = A[i]
    for j in range(i, N):
        aj = A[j]
        if ai > aj:
            B[i] += 1

C = [0]*N
for i in range(N):
    ai = A[i]
    for j in range(i+1):
        aj = A[j]
        if ai > aj:
            C[i] += 1

# print(B)
# print(C)
ans = 0
# for i in range(N):
#     ai = A[i]
#     for j in range(i + 1, N):
#         aj = A[j]
#         # print(i, j, ai, aj)
#         if ai > aj:
#             ans += 1

for i in range(N):
    ans += B[i]*K*(K+1)//2
    ans %= mod

for i in range(N):
    ans += C[i]*(K-1)*K//2
    ans %= mod

print(ans)


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

int main() {
 int n,cnt=0,ans=0;
 cin >> n;
 vector<long long> num(n);
  for(int i=0;i<n;i++){
   cin >> num[i];
  }
  bool ok=true;
  for(int i=0;i<30;i++){//2^30>10^9,2^29<10^9
    for(int j=0;j<n;j++){
     if(num[j]%2==0){
     num[j]=num[j]/2;
       cnt++;
     }
    }
    if(cnt==n){
    ans++;
    cnt=0;
    }
    else{
    break;
    }
  }
  cout << ans << endl;
  
}

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

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

void solve(long long N, std::vector<long long> W){
    int ans = 100100100;
    REP(i, N) {
        int sum1 = accumulate(W.begin(), W.begin() + i, 0);
        int sum2 = accumulate(W.begin() + i, W.end(), 0);
        chmin(ans, abs(sum1 - sum2));
    }
    cout << ans << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> W(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&W[i]);
    }
    solve(N, std::move(W));
    return 0;
}


Measured memory_bytes: 256
import "dart:io";

void main() {
  List ab = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();
  int count = 0;
  for (int s = ab[0]; s <= ab[1]; s++) {
    int sLength = s.toString().length;
    if (sLength % 2 == 1) {
      int middle = (sLength / 2).floor() + 1;
      String first = s.toString().substring(0, middle);
      String last =
          s.toString().substring(middle - 1, sLength).split('').reversed.join();

      // print("odd");
      // print(first);
      // print(last);
      if (first == last) {
        // print(s);
        count++;
      }
    } else {
      int middle = (sLength / 2).floor();
      String first = s.toString().substring(0, middle);
      String last =
          s.toString().substring(middle, sLength).split('').reversed.join();
      // print("even");
      // print(first);
      // print(last);
      if (first == last) {
        // print(s);
        count++;
      }
    }
  }
  print(count);
}


Measured memory_bytes: 17316
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
constexpr int64_t MOD =   998'244'353;

int main(void) {
    int N;
    cin >> N;
    vector<int> D(N);
    for(int i=0; i<N; i++) {
        cin >> D[i];
    }
    if(D[0] != 0) {
        cout << 0 << endl;
        return 0;
    }
    vector<int64_t> num(N);
    for(int i=0; i<N; i++) {
        num[D[i]]++;
    }
    if(num[0] != 1) {
        cout << 0 <<endl;
        return 0;
    }
    int64_t ans = 1;
    int max = *max_element(D.begin(), D.end());
    for(int i=0; i<max; i++) {
        for(int j=0; j<num[i+1]; j++) {
            ans = (ans*num[i]) % MOD;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
main = do
    a <- getLine
    b <- getLine
    putStrLn $ ans (pushZero a b) (pushZero b a)

zeroString 0 = ""
zeroString n = "0" ++ zeroString (n - 1)

pushZero a b = if la > lb
    then a 
    else  zeroString (lb - la) ++ a
    where la = length a
          lb = length b

ans a b
    | a > b = "GREATER"
    | a < b = "LESS"
    | a == b = "EQUAL"

Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

int main(void)
{
    int n, h[100];

    cin >> n;
    rep(i,n)
    {
        cin >> h[i];
    }

    int res = 0;
    rep(i,n)
    {
        bool b = true;
        loop(j,0,i)
        {
            if(h[i]<h[j])
            {
                b = false;
                break;
            }
        }
        if(b)
            res++;
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
use proconio::*;
#[allow(unused_imports)]
use proconio::marker::*;

#[allow(unused_macros)]
macro_rules! echo {
    ($ x : expr ) => {
        println!("{}", $x);
    };
}

#[fastout]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize,
        L: [usize; N],
    }
    let mut ans = 0;
    for i in 0..N {
        for j in i + 1..N {
            for k in j + 1..N {
                if L[i] != L[j] && L[j] != L[k] && L[k] != L[i] && L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j] {
                    ans += 1;
                }
            }
        }
    }
    echo!(ans);
}


Measured memory_bytes: 2180
#define _CRT_SECURE_NO_WARNINGS

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

template <class T>
class CuSum {
private:
	vector<T> cusum;

public:
	CuSum(vector<T> const& vec) : cusum(vec.size() + 1) {
		for (int i = 0; i < (int)vec.size(); i++) cusum[i + 1] = cusum[i] + vec[i];
	}
	CuSum(const int N) : cusum(N + 1) {}
	void add(const int i, const T& x) { cusum[i + 1] += x; }
	void build() { for (int i = 0; i < (int)cusum.size() - 1; i++) cusum[i + 1] += cusum[i]; }

	// partial sum of 0-indexed [l, r)
	T operator()(int l, int r) {
		if (r < l || r < 0) {
			assert(0);
			return T(0);
		}
		else return cusum[r] - cusum[l];
	}
	// 0-indexed
	const T& operator[](int i) { return cusum[i + 1]; }
	T back() { return cusum.back(); }
};

int main() {

	int N, Q;
	scanf("%d", &N);
	scanf("%d", &Q);

	vector<lint> A(N);
	for (int i = 0; i < N; i++) scanf("%d", &A[i]);

	vector<lint> X(Q);
	for (int i = 0; i < Q; i++) scanf("%d", &X[i]);

	// xが小さいとき青木君は下から、高橋君は上から取っていく
	// 青木君が先にN/2目をとれるようになるところから順番の入れ替わりが発生する
	// 入れ替わり後は交互にとることになる

	// 境界をさがしていく
	// lは最小、rはN/2をさしておく
	// (Al + Ar) / 2 < x なら Arを先にとれる可能性がある
	// r - l 番目にArをとることになるので、高橋君より早く取れるか判定
	// 早く取れるならl++, r++、そうでないなら次の境界を試したいのでl++

	int l = 0, r = N / 2;
	vector<lint> border;
	while (r != N - 1) {
		lint c = (A[l] + A[r] + 2) / 2;
		if (r - l < N - r) {
			border.emplace_back(c);
			l++, r++;
		}
		else l++;
	}
	DMP(border);

	// 境界がわかれば取り方は簡単あとは累積和と、奇数偶数番目の累積和を計算しておけば和は求まる
	vector<lint> odd((N + 1) / 2), even((N + 1) / 2);
	for (int i = 0; i < N; i+=2) {
		odd[i / 2] = A[i];
		even[i / 2] = A[i + 1];
	}
	DMP(odd, even);
	CuSum sumA(A), sumO(odd), sumE(even);

	// N/2以降のものが何個とれるかは2分探索できる
	for (int i = 0; i < Q; i++) {
		int cnt = upper_bound(border.begin(), border.end(), X[i]) - border.begin();
		DMP(cnt);
		lint ans = sumA(N / 2 + cnt, N);
		if (N & 1) ans += sumO(0, cnt);
		else ans += sumE(0, cnt);
		printf("%lld\n", ans);
	}

	return 0;
}


Measured memory_bytes: 7732
N,K=map(int,input().split())
l=list(map(int,input().split()))
t=99999999999999999
for i in range(N-K+1):
  D=l[i+K-1]-l[i]+min(abs(l[i+K-1]),abs(l[i]))
  if D<t:t=D
print(t)

Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
  
  int main(){      
     lint n,q;
     string s;
     cin>>s;
    if(s=="ABC")cout<<"ARC";
    else cout<<"ABC";
  }
          
  

Measured memory_bytes: 3604
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	m := make(map[int]int)
	for i := 0; i < N; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		m[a] += b
	}
	var ks []int
	for k := range m {
		ks = append(ks, k)
	}
	sort.Ints(ks)
	sum := 0
	for _, v := range ks {
		if M <= m[v] {
			sum += v * M
			fmt.Println(sum)
			return
		}
		sum += v * m[v]
		M -= m[v]
	}
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i,a,b) for(int i=(a);i<=(b);++i)
#define FD(i,b,a) for(int i=(b);i>=(a);--i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;
constexpr int inv(LL x, int m) { return x > m ? inv(x % m, m) : x > 1 ? inv(m % x, m) * (m - m / x) % m : x; }
constexpr int mpow(LL a, LL k, int m) { int r(1); for (a %= m; k; k >>= 1, a = a * a % m) if (k & 1)r = r * a % m; return r; }

const int N = 1e5 + 5;
int n, k, H[N], F[N];

int main() {
    cin >> n >> k;
    FI(i, 1, n) scanf("%d", H + i);
    fill(F + 2, F + 1 + n, INT_MAX);
    FI(i, 2, n) {
        for (int j = i - 1; j + k >= i && j; j--) {
            F[i] = min(F[i], F[j] + abs(H[i] - H[j]));
        }
    }
    cout << F[n] << endl;
}

Measured memory_bytes: 1024
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#pragma GCC diagnostic error "-std=c++14"
#include "bits/stdc++.h"
//#include "ext/pb_ds/tree_policy.hpp"
//#include "ext/pb_ds/assoc_container.hpp"
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) (x&(-x))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9+7;
const ll inf = 1e9+7;
const ld eps = 1e-9;
const db PI = atan(1)*4;
template<typename T>
inline int sign(const T&a) {
    if(a<0)return -1;
    if(a>0)return 1;
    return 0;
}

template<typename T,typename S>inline bool upmin(T&a,const S&b){return a>b?a=b,1:0;}
template<typename T,typename S>inline bool upmax(T&a,const S&b){return a<b?a=b,1:0;}

template<typename T> inline void in(T &x) {
    x = 0;
    T f = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (isdigit(ch))  {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    x *= f;
}

ll twop(int x) {
    return 1LL<<x;
}

template<typename A,typename B > inline void in(A&x,B&y) {
    in(x);
    in(y);
}
template<typename A,typename B,typename C>inline void in(A&x,B&y,C&z) {
    in(x);
    in(y);
    in(z);
}
template<typename A,typename B,typename C,typename D> inline void in(A&x,B&y,C&z,D&d) {
    in(x);
    in(y);
    in(z);
    in(d);
}

namespace SOLVE {
    void main(){
    }
}
void calcNext(const string& s,int nxt[]){
    int p = nxt[0] = -1;
    REP(i,1,sz(s)){
        while(p!=-1 && s[p+1]!=s[i])p = nxt[p];
        p+=s[p+1]==s[i];
        nxt[i] = p;
    }
}


int nxt[2000000];

int main(){
    int n;
    string a,b;
    cin>>n>>a>>b;
    string c = b+"3"+a;
    calcNext(c, nxt);
    cout<<n*2-nxt[sz(c)-1]-1;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;
mat A = { {(ll)1,(ll)1},{(ll)1,(ll) 0 } };
mat mtmul(mat &A, mat &B) {
	mat C(A.size(), vec(B[0].size()));
	rep(i, (int)A.size()) {
		rep(k, (int)B.size()) {
			rep(j, (int)B[0].size()) {
				C[i][j] = (C[i][j] + (A[i][k] * B[k][j]) % MOD) % MOD;
			}
		}
	}
	return C;
}
mat mtpow(mat A, ll n) {
	mat B(A.size(), vec(A.size()));
	rep(i, (int)A.size()) {
		B[i][i] = 1;
	}
	while (n > 0) {
		if (n&(ll)1)B = mtmul(B, A);
		A = mtmul(A, A);
		n >>= 1;
	}
	return B;
}
int main() {
	ll k; cin >> k;
	ll t = (ll)sqrt(k);
	if (t*(t + (ll)1) < k){
		t++;
    }
	k -= t * (t - 1);
	ll x, y;
	if (k <= t) {
		ll sum = (ll)2 * t;
		ll l = (sum + (ll)1) / (ll)2;
		ll len = (l + (ll)1) / 2;
		if (k <= len) {
		    x = (ll)-1 + (ll)2 * k;
		    y = sum - x;
		}
		else {
			k -= len;
			x = (ll)2 * (l / (ll)2) - ((ll)2 * (k - (ll)1));
			y = sum - x;
		}
		mat X = A; mat Y = A;
		X = mtpow(X, x + (ll)1);
		Y = mtpow(Y, y + (ll)1);
		cout << X[1][0] * Y[1][0] % MOD << endl;
	}
	else {
		ll sum = (ll)2 * t + (ll)1;
		k -= t;
		ll l = (sum) / (ll)2;
		ll len = (l + (ll)1) / (ll)2;
		if (k <= len) {
			x = (ll)-1 + (ll)2 * k;
			y = sum - x;
		}
		else {
			k -= len;
			x = (ll)2 * (l / (ll)2) - ((ll)2 * (k - (ll)1));
			y = sum - x;
		}
		mat X = A; mat Y = A;
		X = mtpow(X, x + (ll)1);
		Y = mtpow(Y, y + (ll)1);
		cout << X[1][0] * Y[1][0] % MOD << endl;
	}
	return 0;
}


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

int main(){
    int N; cin >> N;
    int A[2][100];
    for(int i=0; i<N; i++){
        cin >> A[0][i];        
    }
    for(int i=0; i<N; i++){
        cin >> A[1][i];
    }

    //

    int dp_ue, dp_shita;
    dp_ue=A[0][0];
    dp_shita=A[0][0]+A[1][0];
    for(int i=0; i<N-1; i++){
        dp_ue += A[0][i+1];
        dp_shita = max(dp_shita, dp_ue)+A[1][i+1];
    }
    cout << dp_shita << endl;
}

Measured memory_bytes: 256
import itertools

N,M = map(int,input().split())
value = [0] * N

for i in range(N):
  v = list(map(int,input().split()))
  abv = [i if i > 0 else i * - 1 for i in v]
  value[i] = v

ans = 0
totals = []

for i in range(0,2 ** 3):
  totals = []
  #print(bin(i))
  for v in range(N):
    tmp = 0
    for j in range(0,3):
      if (i >> j) & 1:
        tmp += value[v][j]
      else:
        tmp -= value[v][j]
    totals.append(tmp)
  #print(totals)
  totals = sorted(totals,reverse = True)

  t = 0
  for k in range(M):
    t += totals[k]
  ans = max(ans,t)
  
print(ans)

Measured memory_bytes: 3376
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n, m;
    cin >> n >> m;

    if (n * 2 >= m)
    {
        cout << m / 2 << endl;
        exit(0);
    }
    else{
        ll ans = n;
        m -= 2 * n;
        cout << ans + m / 4 << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
    // Your code here!
    int N,i;
    char S[100];
    scanf("%d",&N);
    scanf("%s",S);
    
  i=strlen(S);
    
    if(i<=N){
          
        for(i=0;S[i]!='\0';i++){
            printf("%s\n",S);
            break;
        }
    }else{
        S[N]='\0';
        for(i=0;S[i]!='\0';i++){
            printf("%s...\n",S);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 1716
#include <iostream>
#include<sstream>
#include<string>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    if (n < m)
        swap(n, m);
    ostringstream oss;
    oss << m;
    for (int i = 0; i < n; i++) {
        cout << oss.str();
    }
}

Measured memory_bytes: 256
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> v;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        v.pb(s);
    }
    int res = 0;
    for(int i = 0; i < (1 << n); i++){
        for(int j = 0; j < (1 << m); j++){
            vector<int> rows, cols;
            for(int x = 0; x < 10; x++){
                if((i >> x) & 1){
                    rows.pb(x);
                }
            }
            for(int x = 0; x < 10; x++){
                if((j >> x) & 1){
                    cols.pb(x);
                }
            }
            vector<string> temp = v;
            for(auto r : rows){
                for(int x = 0; x < m; x++){
                    v[r][x] = '$';
                }
            }
            for(auto c : cols){
                for(int x = 0; x < n; x++){
                    v[x][c] = '$';
                }
            }
            int c = 0;
            for(int x = 0; x < n; x++){
                for(int y = 0; y < m; y++){
                    if(v[x][y] == '#')
                        c++;
                }
            }
            if(c == k){
                res++;
            }
            v = temp;
        }
    }
    cout << res << "\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3644
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;

using namespace std;

char str[10];

void solve()
{
    scanf("%s", str);
    if (str[2] == str[3] && str[4] == str[5]) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }


    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}

Measured memory_bytes: 128
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		HashSet<String> set = new HashSet<String>();

		String prev = sc.next();
		set.add(prev);
		for(int i = 1; i < n; i++){
			String tmp = sc.next();

			if(set.contains(tmp) || prev.charAt(prev.length() - 1) != tmp.charAt(0)){
				System.out.println("No");
				return;
			}

			set.add(tmp);
			prev = tmp;
		}

		System.out.println("Yes");
	}

}


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

int n, ans, result;

int main() {
  cin >> n;
  vector<vector<int>> a(2, vector<int>(n));
  rep (i, 2) {
    rep (j, n) {
      cin >> a[i][j];
    }
  }
  rep (i, n) {
    result = 0;
    rep (j, n) {
      if (j <= i) result += a[0][j];
      if (i <= j) result += a[1][j];
    }
    ans = max(ans, result);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  vector<char> s1(3);
  rep(i, 3) cin >> s1.at(i);
  int num = 0;
  rep(i, 3) {
    if (s1.at(i) == '1') num++;
  }
  cout << num << endl;
}

Measured memory_bytes: 256