akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int x[n],y[n],h[n],memo;
	for (int i = 0; i < n; ++i)
	{
		cin>>x[i]>>y[i]>>h[i];
		if(h[i]>0) memo=i;
	}
	for (int i = 0; i <= 100; ++i)
	{
		for (int j = 0; j <= 100; ++j)
		{
			int tmp;

			tmp=h[memo]+abs(x[memo]-i)+abs(y[memo]-j);
			int l;
			for (l = 0; l < n; ++l)
			{
				if(h[l]==0)
				{
					if(tmp-abs(x[l]-i)-abs(y[l]-j)>0) break;
				}
				else if(tmp-h[l]!=abs(x[l]-i)+abs(y[l]-j)) break;
			}
			if(l==n)
			{
				cout<<i<<" "<<j<<" "<<tmp<<endl;
				return 0;
			}
		}
	}
	cout<<"e"<<endl;
	return 0;
}

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

#define int long long int
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define lb lower_bound
#define ub upper_bound
#define srt(a) sort(a.begin(),a.end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
#define mxe(a) *max_element(a.begin(),a.end())
#define mne(a) *min_element(a.begin(),a.end())
#define endl '\n'
#define mod 1000000007
#define INF64 1e18

const int N=307;
double dp[N+5][N+5][N+5];
void solve(){
  int n ;cin>>n;
  vi cnt(4);
  for(int i=0;i<n;i++){
    int x;cin>>x;
    cnt[x]++;
  }
  for(int c=0;c<N;c++){
    for(int b=0;b<N;b++){
      for(int a=0;a<N;a++){
        if(a+b+c==0)continue;
        if(a+b+c>N)continue;
        double p=1.0*n/(a+b+c);
        double p1=1.0*a/(a+b+c);
        double p2=1.0*b/(a+b+c);
        double p3=1.0*c/(a+b+c);
        if(a)dp[a][b][c]+=p1*dp[a-1][b][c];
        if(b)dp[a][b][c]+=p2*dp[a+1][b-1][c];
        if(c)dp[a][b][c]+=p3*dp[a][b+1][c-1];
        dp[a][b][c]+=p;
        //cout<<p1<<" "<<p2<<" "<<p3<<endl;
      }
    }
  }
  
  cout<<fixed<<setprecision(10)<<dp[cnt[1]][cnt[2]][cnt[3]];

}

int32_t main(){
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
  #endif
  
  ios_base::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);

  int T=1;
  //cin>>T;
  for(int TT=1;TT<=T;TT++){
    solve();
  }
}

Measured memory_bytes: 120208
import java.util.Stack

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val a = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
  val t = Array<MutableList<Int>>(n+1) { mutableListOf<Int>() }
  repeat(n-1) {
    val (u, v) = readLine()!!.split(" ").map { it.toInt() }
    t[u].add(v)
    t[v].add(u)
  }
  val stack = Stack<Int>().apply { push(1) }
  var size = 0
  val pop = BooleanArray(n+1)
  val las = IntArray(n+1)
  val pos = IntArray(n+1)
  val par = IntArray(n+1)
  val lis = IntArray(n+1)
  val ans = IntArray(n+1)
  while (stack.isNotEmpty()) {
    val u = stack.pop()
    if (u < 0) {
      if (pop[-u]) size-- else lis[pos[-u]] = las[-u]
      continue
    }
    pos[u] = lis.lowerBound(a[u-1], 0, size)
    if (pos[u] == size) {
      pop[u] = true
      size++
    }
    las[u] = lis[pos[u]]
    lis[pos[u]] = a[u-1]
    stack.push(-u)
    ans[u] = size
    for (v in t[u]) {
      if (v == par[u]) continue
      par[v] = u
      stack.push(v)
    }
  }
  println(ans.drop(1).joinToString("\n"))
}
fun IntArray.lowerBound(element: Int, fromIndex: Int, toIndex: Int): Int {
  val index = this.binarySearch(element, fromIndex, toIndex)
  return if (index < 0) -index-1 else index
}

Measured memory_bytes: 103584
#include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF  2000000000
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d); BR;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
#define SUM(a, n) accumulate(a, a+n, 0)
#define VSUM(v) accumulate(ALL(v), 0);
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

int sum(int n){
    int s = 0;
    while(n > 0) s+=n%10,n/=10;
    return s;
}
signed main(){ INIT;
    VAR(int, n, a, b);
    int ans = 0;
    REP(i, n+1){
        if(IN(sum(i), a, b+1)) ans += i;
    }
    OUTL(ans);
RET;}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n,m,x;cin>>n>>m>>x;
    vector<bool> a(n+1,false);
    rep(i,m){int tmp; cin>>tmp; a[tmp] = true;}
    int rc = 0, lc = 0;
    for(int i = x; i>0; --i){
        if(a[i])lc++;
    }
    for(int i = x; i<n; ++i){
        if(a[i])rc++;
    }
    cout<<min(rc,lc)<<endl; return 0;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, m, a[2000], b[2000], c[2000];
LL d[1000];
LL const INF = 8000000000000001LL;

int main() {
	cin >> n >> m;
	inc(i, m) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--; b[i]--;
	}
	
	inc(i, n) { d[i] = -INF; }
	d[0] = 0;
	
	bool inf = false;
	inc(q, n * 2) {
		bool cont = false;
		inf = false;
		inc(i, m) {
			bool flag = setmax(d[ b[i] ], d[ a[i] ] + c[i]);
			cont |= flag;
			if(flag && q >= n && b[i] == n - 1) { inf = true; cont = false; break; }
		}
		if(! cont) { break; }
	}
	
	if(inf) { cout << "inf" << endl; }
	else { cout << d[n - 1] << endl; }
	
	return 0;
}


Measured memory_bytes: 256
"use strict";
function I(t,i){this._s=t.split("\n"),this._c=0,this._l=0,this._f=i||Number}I.prototype.a=function(t){var i=this._s[this._l];if(i){var s=i.trim().split(" "),h=s[this._c];return this._c++,s.length===this._c&&(this._c=0,this._l++),t?t(h):this._f(h)}},I.prototype.l=function(t){var i=this._s[this._l];if(i)return this._c=0,this._l++,i.split(" ").map(t||this._f)},module.exports=I;

function main(input) {
  var o = new I(input);

  var s = o.a();
  var former = Math.floor(s/100);
  var later = s % 100;
  if (former <= 12 && former >= 1) {
    if (later <= 12 && later >= 1) {
      console.log("AMBIGUOUS");
    } else {
      console.log("MMYY");
    }
  } else if (later <= 12 && later >= 1) {
    console.log("YYMM");
  } else {
    console.log("NA");
  }
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
#define inf 2147483647
#define rep(i,a,b) for(int i=a;i<b;i++)
#define  rr read()
#define ll long long
#define repb(i,a,b) for(int i=a;i<=b;i++)
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
ll read()
{
    char ch = getchar();
	int x = 0, f = 1;
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while('0' <= ch && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    return x * f;
}
const int N=1e5+5;
ll a[N]={0};
int main()
{ 
 ll n=rr,l=rr,ans=0;
  ll aa=inf;
  
  for(int i=1;i<=n;i++)
  { 
   ans+=(l+i-1);
   if(abs(l+i-1)<abs(aa))
   aa=l+i-1;
  }
  
  cout<<ans-aa;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

ll pw5(ll x){
    return x*x*x*x*x;
}

int main(){
    ll X=ii();
    for(ll b=-6000;b<=6000;b++){
        for(ll a=-6000; a<=6000; a++){
            if(pw5(a)==X+pw5(b)){
                oi(a);os(" ");oie(b);
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3632
# ABC 157 C
n,m=map(int,input().split())
C=[list(map(int,input().split())) for i in range(m)]

for i in range(1000):
    S=str(i)

    if len(S)==n:
        for s,c in C:
            s-=1
            if S[s]==str(c):
                True
            else:
                break
        else:
            print(i)
            exit()

print(-1)
                


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fastio (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastio;
    int n;
    cin >> n;
    if ((n / 100) == (n % 10))
        cout << "Yes\n";
    else
        cout << "No\n";
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>

int main() {
    using namespace std;
    double n, m, d;
    cin >> n >> m >> d;

    double ans;
    if(d == 0) {
        ans = (m - 1) / n;
    } else {
        ans = 2 * (n - d) * (m - 1) / (n * n);
    }
    cout << fixed;
    cout << setprecision(7) <<ans << endl;
    return 0;
}


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

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

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

string s;

signed main() {
   cin >> s;

   rep (i, s.size()-1) {
      if (s[i] == 'A' && s[i+1] == 'C') {
         puts("Yes");
         return 0;
      }
   }
   puts("No");

   exit(0);

   int ans = count(all(s), 'x');

   string x;
   rep (i, s.size()) {
      if (s[i] != 'x') {
         x.push_back(s[i]);
      }
   }

   string xt = x;reverse(all(xt));
   if (xt != x) {
      puts("-1");
      return 0;
   }

   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    vi x(n),y(n),h(n);
    REP(i,n){
        cin>>x[i]>>y[i]>>h[i];
    }
    REP(i,101){
        REP(j,101){
            REP(l,n){
                int ans=abs(x[l]-i)+abs(y[l]-j)+h[l];
                REP(k,n){
                    if(h[k]==0){
                        if(abs(x[k]-i)+abs(y[k]-j)>=ans){
                            continue;
                        }else{
                            ans=-1;
                            break;
                        }
                    }
                    if(abs(x[k]-i)+abs(y[k]-j)+h[k]!=ans){
                        ans=-1;
                        break;
                    }
                }
                if(ans!=-1){
                    cout<<i<<" "<<j<<" "<<ans<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}


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

int n, m, p, to, from, in[100001], ans[100001];
vector<int> G[100001];
queue<int> q;
int main() {
	cin >> n >> m;
	rep(i, n + m - 1) {
		cin >> from >> to;
		G[from].push_back(to);
		in[to]++;
	}
	rep(i, n) if (in[i] == 0) p = i;
	q.push(p);
	while (!q.empty()) {
		p = q.front();
		q.pop();
		rep(i, G[p].size()) {
			in[G[p][i]]--;
			if (in[G[p][i]] == 0) {
				ans[G[p][i]] = p;
				q.push(G[p][i]);
			}
		}
	}
	for (int i = 1; i < n + 1; i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 7040
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define so(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pa pair
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<ll,ll>> vpl;
typedef vector<vector<pair<int,int>>> vvp;




int main()
{
    
    int N,K;
    cin >> N >> K;
    ve<bool> A(10,true);
    rep(i,K){
        int a;cin>>a;
        A[a] = false;
    }
    reps(i,N,100000){
        string s = to_string(i);
        int aa = 0;
        rep(j,int(s.length())){
            if(!A[s[j]-'0']) break;
            else aa++;
        }
        if(aa == int(s.length())){ cout << i << endl;return 0;}
    }
    
    
    
    return 0;
}



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

namespace aizu
{
    public class OnlineJudge
    {
        static void Main()
        {
            var pattern = new Regex(@"[^_][^A-Z_]*");
            var split = new Func<string, string[]>(arg => {
                return (from Match p in pattern.Matches(arg) select p.Value).ToArray();
            });
            var convert = new Dictionary<string, Func<string, string>> {
                { "U", arg => string.Join("", Upper(split(arg), 0))},
                { "L", arg => string.Join("", Upper(split(arg), 1))},
                { "D", arg => string.Join("_", split(arg)).ToLower()},
            };
            string[] input;
            while((input = Console.ReadLine().Split())[1] != "X") {
                Console.WriteLine(convert[input[1]](input[0]));
            }
        }
        static string[] Upper(string[] str, int lower)
        {
            var conv = new Func<char,char>[] { char.ToUpper, char.ToLower };
            var result = new string[str.Length];
            for(int i=0;i < str.Length;++i){
                result[i] = conv[i < lower ? 1 : 0](str[i][0]) + str[i].Substring(1);
            }
            return result;
        }
    }
}

Measured memory_bytes: 7572
#include<stdio.h>
#include<string.h>
#include<set>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    set<int>st;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        if(st.count(x))
        {
            st.erase(x);
        }
        else
            st.insert(x);
    }
    cout<<st.size()<<endl;
    return 0;
}


Measured memory_bytes: 4864
/**
 *    author:  Atrues
 *    created: 26.01.2019 18:13
**/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int a[2000 + 10];
bitset<4000000 + 10> bs;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	bs[0] = 1;
	int sum = 0;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		bs |= (bs << a[i]);
		sum += a[i];
	}
	for (int i = (sum + 1) / 2; i <= sum; i++)
		if (bs[i] == 1)
			return cout << i << endl, 0;
}


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

//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

	int len = (int)s.size();
	bool flag = false;
	if (len % 2){
		len--;
		flag = true;
	}

	while (1){
		if (flag == false){
			flag = true;
			len -= 2;
			continue;
		}
		int a = len / 2;

		if (s.substr(0, a) == s.substr(a, a)){
			cout << len << endl;
			return (0);
		}
		len -= 2;
		if (len == 0){
			cout << len << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 using namespace std;
 const int maxx=1e5+2;
 struct node
 {
     int x,y,id;
 };
 vector<node> res;
 struct S
 {
     int nex,id;
 };
 vector<S> b[maxx];
 int in[maxx],odd[maxx];
 int vis[maxx]; int sign[maxx];
 int f=0;
 void dfs(int x,int fa){
     vis[x]=1;
     if(odd[x]) f=1-f;
     for(auto t: b[x]){
         if(vis[t.nex]) continue;
         if(f){
            sign[t.id]=1-sign[t.id];
         }
         dfs(t.nex,x);
         if(f){
             sign[t.id]=1-sign[t.id];
         }
     }
 }
 int main(){
    int n,m; cin>>n>>m;
    for(int i=1;i<=m;i++){
        int x,y; scanf("%d%d",&x,&y);
        res.push_back(node{x,y,i});
        in[x]++;
        b[x].push_back(S{y,i});
        b[y].push_back(S{x,i});
    }
    if(m&1) return 0*puts("-1");
    for(int i=1;i<=n;i++){
        if(in[i]&1) odd[i]=1;
    }
    dfs(1,0);
    for(auto x:res){
        if(sign[x.id]){
            printf("%d %d\n",x.y,x.x);
        }else{
            printf("%d %d\n",x.x,x.y);
        }
    }
 }

Measured memory_bytes: 14260
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

const int mod = 1e9 + 7;

void udd(int &a, int b) {
    a += b;
    if (a >= mod)
        a -= mod;
}

int mul(ll a, ll b) {
    return (a * b) % mod;
}

const int maxn = 305;
int d[maxn][maxn][maxn];

void calc(int n, int m) {
    d[0][1][0] = 1;
    forn (i, m) {
        forn (j, n + 1)
            forn (k, n + 1) {
                if (d[i][j][k] == 0)
                    continue;
                udd(d[i + 1][j][k], mul(k, d[i][j][k]));
                udd(d[i + 1][j][k + 1], mul(n - j - k, d[i][j][k]));
                udd(d[i + 1][j + k][0], mul(j, d[i][j][k]));
            }
    }
}

int main() {
    #ifdef LOCAL
    assert(freopen("f.in", "r", stdin));
    #else
    #endif
    int n, m;
    cin >> n >> m;
    calc(n, m);
    cout << d[m][n][0] << '\n';
}


Measured memory_bytes: 54912
N = int(input())
P = "".join(input().split())
Q = "".join(input().split())
l_p = []

def f_perm(bit, s_p):
  if len(s_p) == N:
    l_p.append(s_p)
    return
  for i in range(N):
    if 1 << i & bit != 0:
      continue
    f_perm(bit | 1 << i, s_p + str(i + 1))

f_perm(0, "")    
    
print(abs(l_p.index(P) - l_p.index(Q)))

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

int main(){
        int n;
        //      std::vector<std::vector<int> > a;
        cin >> n;
        int a[2][n];
        for(int i = 0; i < n; i++) cin >> a[0][i];
        for(int i = 0; i < n; i++) cin >> a[1][i];

        int ans = 0, tmp =0;
        for(int i = 0; i < n; i++){
                ans = 0;
                for(int j = 0; j < n; j++){
                        if(i > j){
                                ans += a[0][j];
                        } else if (i == j){
                                ans += a[0][j];
                                ans += a[1][j];
                        } else {
                                ans += a[1][j];
                        }
                }
                tmp = max(tmp, ans);
        }
        ans = tmp;
        cout << ans << endl;
}

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

int main(void){
    string K;
    int S;
    cin >> S >> K;
    if (K.size() <= S)
        cout << K;
    else {
        for (int i = 0; i < S; i++)
            cout << K[i];
        cout << "...";
    }
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int maxN = 200000 + 5;
const double PI = acos(-1);
const int MOD = (int)1e9 + 7;
#define ll long long

class TaskC {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int n;
		cin >> n;
		ll sum = 0;
		ll ans = 0;
		for(int i = 0; i < n; i++) {
			ll x;
			cin >> x;
			ans += x * sum % MOD;
			ans %= MOD;
			sum += x;
			sum %= MOD;
		}
		cout << ans << endl;
	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskC solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>         
                            
int main() {                
    int n, max, min = 0;
    long int sum = 0;
                            
    std::cin >> n;          
                            
    for(int i = 0; i < n; i++) {
        int num = 0;        
        std::cin >> num;    
        if(i == 0) {        
            max = min = sum = num;
        }else {             
            sum += num;     
            max = (num > max) ? num : max;
            min = (num < min) ? num : min;
        }                   
                            
    }                       
    std::cout << min << " " << max << " " << sum << std::endl;
    return 0;               
}

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

using namespace std;

const int max_n = 100111, mod = 998244353;

int mul(int x, int y) {
    return (1LL * x * y) % mod;
}

int power(int a, int b) {
    if (b == 0) {
        return 1 % mod;
    }
    if (b % 2 == 0) {
        return power(mul(a, a), b / 2);
    }
    return mul(a, power(a, b - 1));
}

int n, a[max_n], cnt[max_n];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        ++cnt[a[i]];
    }
    int ans = 1;
    if (cnt[0] != 1 || a[0] != 0) {
        ans = 0;
    }
    for (int i = 1; i < n; ++i) {
        if (cnt[i] && !cnt[i - 1]) {
            ans = 0;
        } else {
            ans = mul(ans, power(cnt[i - 1], cnt[i]));
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1024
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

void main() {
    long a, b, k;
    scan(a, b, k);

    foreach (i ; 0 .. k) {
        if (i % 2 == 0) {
            a = a / 2 * 2;
            b += a / 2;
            a -= a / 2;
        }
        else {
            b = b / 2 * 2;
            a += b / 2;
            b -= b / 2;
        }
    }

    writefln("%d %d", a, b);
}















void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	long a, b, x;
	cin >> a >> b >> x;

	long ans;
	ans = 0;

	ans = (b/x) - (a/x);
	if ((a%x) == 0) ans++;
	cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head


struct Mod{
  unsigned n;
  Mod() : n(0){}
  Mod( ll x ){
    if( x < 0 ) n = x%MOD+MOD;
    else n = x%MOD;
  }
};
Mod operator + ( Mod a  , Mod b ){ return Mod( a.n + b.n ); }
Mod operator +=( Mod &a , Mod b ){ return a = a + b; }
Mod operator - ( Mod a ){ return Mod( MOD - a.n ); }
Mod operator - ( Mod a  , Mod b ){ return Mod( a.n + MOD - b.n ); }
Mod operator -=( Mod &a , Mod b ){ return a = a - b; }
Mod operator * ( Mod a  , Mod b ){ return Mod( (ll)a.n * b.n ); }
Mod operator *=( Mod &a , Mod b ){ return a = a * b; }
Mod modpow( Mod x , ll k ){
  Mod res = 1;
  while( k ){
    if( k & 1 ) res *= x;
    k /= 2;
    x *= x;
  }
  return res;
}
ll extgcd( ll a , ll b , ll &x , ll &y ){
  ll d = a;
  if( b != 0 ){
    d = extgcd( b , a % b , y , x );
    y -= a / b * x;
  } else {
    x = 1, y = 0;
  }
  return d;
}
Mod inv( Mod a ){ ll x, y; assert( extgcd( a.n , MOD , x , y ) == 1 ); return Mod( x ); }
Mod operator / ( Mod a  , Mod b ){ return Mod( (ll)a.n * inv(b).n ); }
Mod operator /=( Mod &a , Mod b ){ return a = a / b; }

int n, m;

Mod dp[2010][2010];
Mod sum[2010][2010];

int main(){

  n = in();
  m = in();
  
  dp[0][0] = 1;
  REP( i , n+1 ){
    sum[0][i] = 1;
  }
  
  FOR( i , 1 , m ){
    FOR( j , i , n+1 ){
      dp[i][j] = dp[i-1][j] + sum[i-1][j];
    }
    FOR( j , i , n+1 ){
      sum[i][j+1] = sum[i][j] + dp[i][j];
    }
  }

  Mod ans = sum[m-1][n] * modpow( 2 , max( 0 , n - m - 1 ) );
  cout << ans.n << endl;

  return 0;
}


Measured memory_bytes: 31744
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		int q = stdIn.nextInt();
		
		String t = ""; //反転する文字列
		
		StringBuffer sbs = new StringBuffer(s); //文字列sを最初に格納
		StringBuffer sbt = new StringBuffer(); //文字列tを最初に格納
		
		StringBuffer tmp;
		
		for(int i = 0; i < q; i++) {
			if(stdIn.nextInt() == 1) { //反転作業
				tmp = sbs;
				sbs = sbt;
				sbt = tmp;
			}else {
				if(stdIn.nextInt() == 1) {
					sbt.append(stdIn.next());
				}else {
					sbs.append(stdIn.next());
				}
				
			}
			
			
			
			
			
		}
		
		System.out.println(sbt.reverse().append(sbs).toString());
		
		
		
		
	}

}


Measured memory_bytes: 150780
#include<bits/stdc++.h>
#define MAXN 101
using namespace std;
int n,m,head[MAXN],tot,pre[MAXN],bel[MAXN],deep[MAXN];
long long ans;
vector<int> P[MAXN];
bool mark[52];
struct node{
	int ed,num,last;
}G[MAXN<<2];
void Add(int st,int ed,int num){
	tot++;
	G[tot]=node{ed,num,head[st]};
	head[st]=tot;
}
void DFS(int x,int fa){
	deep[x]=deep[fa]+1;
	pre[x]=fa;
	for(int i=head[x];i;i=G[i].last){
		int t=G[i].ed;
		if(t==fa)continue;
		bel[t]=G[i].num;
		DFS(t,x);
	}
}
void jump(int x,int y,int i){
	if(deep[x]<deep[y])swap(x,y);
	while(deep[x]>deep[y])P[i].push_back(bel[x]),x=pre[x];
	while(x!=y)P[i].push_back(bel[x]),P[i].push_back(bel[y]),x=pre[x],y=pre[y];
}
int main(){
	scanf("%d",&n);
	for(int x,y,i=1;i<=n-1;i++){
		scanf("%d %d",&x,&y);
		Add(x,y,i);
		Add(y,x,i);
	}
	DFS(1,0);
	scanf("%d",&m);
	for(int a,b,i=1;i<=m;i++){
		scanf("%d %d",&a,&b);
		jump(a,b,i);
	}
	for(int i=0;i<(1<<m);i++){
		memset(mark,false,sizeof(mark));
		int flag=0;
		for(int j=1;j<=m;j++){
			if((1<<(j-1))&i){
				flag++;
				const int sz=P[j].size();
				for(int k=0;k<sz;k++)mark[P[j][k]]=true;
			}
		}
		int sum=0;
		for(int j=1;j<=n-1;j++)sum+=(!mark[j]);
		if(flag&1)ans-=1LL<<sum;
		else ans+=1LL<<sum;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
 
int main() {
	// your code goes here
	long long t;
	cin>>t;
	long long  x=100;
	long long flag=0;
	long long interest=0;
	while(x<t)
	{
		interest=x/100;
		x+=interest;
		flag++;
	}
	cout<<flag;
	return 0;
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K, r int
	fmt.Scan(&N, &K)
	h := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&h[i])
	}
	sort.Ints(h)
	for i := 0; i < N-K; i++ {
		r += h[i]
	}
	fmt.Println(r)

}

Measured memory_bytes: 5504
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
a = [0] + inpl()
acc = itertools.accumulate(a)
res = 0
for i in acc:
    if i <= m:
        res += 1
print(res)

Measured memory_bytes: 5504
#include<iostream>
#include<algorithm>
#include<climits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
const int NMAX=1<<17;
int n,m,c;
int b[25];
int a[25][25];
int main(){
  scan(n);scan(m);scan(c);
  rep(i,m)scan(b[i]);
  rep(i,n){
    rep(j,m){
      scan(a[i][j]);
    }
  }
  int ans=0;
  rep(i,n){
    int res=0;
    rep(j,m){
      res+=a[i][j]*b[j];
    }
    if(res+c>0)ans++;
  }
  prin(ans);

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    string s;
    cin >> s;
    rep(i, s.size()-8)cout << s[i];
}


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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            // 入力
            var input = cin.ReadIntArray(3);
            int n = input[0];
            int a = input[1];
            int b = input[2];
            var result = Min(a * n, b);
            WriteLine(result);
        }  
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define testcase int t;cin>>t;while(t--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
typedef long long int ll;
typedef unsigned long long int ull;
#define M 1000000007
using namespace std;
int main()
{
    fast
    int x; bool flag=0;
testcase
{
cin>>x;
if(x%2==0&&x%6!=0&&x%10!=0)
flag=1;
}
if(flag==1)
cout<<"DENIED";
else
cout<<"APPROVED";
return 0;
}






Measured memory_bytes: 256
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))

heapq.heapify(A)

for _ in range(M):
    tmp=heapq.heappop(A)
    tmp=-tmp//2
    heapq.heappush(A,-tmp)

print(-sum(A))


Measured memory_bytes: 20328
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int x, y, z;
    cin >> x >> y >> z;
    swap(x,y);
    swap(x,z);
    cout << x << " " << y << " " << z << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> as(n),bs(n);
  for(Int i=0;i<n;i++) cin>>as[i]>>bs[i];

  vector< vector<Int> > G(m+1);
  for(Int i=0;i<n;i++)
    if(as[i]<=m) G[m-as[i]].emplace_back(bs[i]);

  Int ans=0;
  priority_queue<Int> pq;
  for(Int i=m;i>=0;i--){
    for(Int x:G[i]) pq.emplace(x);
    if(!pq.empty()){
      ans+=pq.top();
      pq.pop();
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
    int A, B, X;
    cin >> A >> B >> X;
    
    for(int i = 0; i <= B; ++i){
        if (A + i == X){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

#define D 7368792
vector <bool> a(D);

int main(){
  int i,t=0,m,n,x;
  do{
    cin >> m >> n;
    if(m==0 && n==0){
      break;
    }else{
      for(x=m;n>0;x++){
        if(a[x]==0){
          for(i=x;i<D;i+=x){
            a[i]=1;
          }
          n--;
        }
      }
      for(i=0;i<D;i++){
        if(t==1 && a[i]==0){
          break;
        }else if(a[i]==1){
          t=1;
        }
      }
      cout << i << endl;
      t=0;
      for(i=0;i<D;i++){
        a[i]=0;
      }
    }
  }while(1);
  return 0;
}

Measured memory_bytes: 3408
s = list(input().rstrip())
r=0
bm=0
while r<len(s)-1:
    if s[r]=="B" and s[r+1]=="W":
        bm+=1
        break
    elif s[r]=="B":
        bm+=1
    r+=1
ans=0
for i in range(r+1, len(s)):
    if s[i]=="W":
        ans+=bm
    if s[i]=="B":
        bm+=1

print(ans)


Measured memory_bytes: 4840
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
using namespace std;
#define inf 0x3f3f3f
typedef long long ll;
const int maxn = 2e4+5;
ll n,a,b;
int main(){
	scanf("%lld%lld%lld",&n,&a,&b);
	ll cnt = b-a,ans;
	if(cnt %2 == 0)
		ans = cnt /2;
	else
		ans = min(n-b+1,a)+(b-a)/2;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
long long s[300000],n,a[300000];
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",a+i),s[i]=s[i-1]+a[i];
	long long ans=1ll<<62;
	for(int i=1;i<n;i++)ans=min(ans,abs(s[n]-s[i]-s[i]));
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

int main()
{
    ll l, r;
    cin >> l >> r;

    if (r - l > 2019)
    {
        cout << 0 << endl;
    }
    else
    {
        ll ans = LINF;
        rep(i, l, r + 1)
        {
            rep(j, i + 1, r + 1)
            {
                if (ans > ((i * j) % 2019))
                    ans = (i * j) % 2019;
            }
        }
        cout << ans << endl;
    }
}


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

using namespace std;

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

int n;
int seq[202];
int out[202];

int main()
{
	read(n);
	for(int i=1; i<=n; i++) read(seq[i]);
	for(int i=n; i>=1; i--)
	{
		int cnt = 0;
		for(int j=1; j<=n; j++)
		{
			if(!out[j]) cnt++;
			if(cnt == seq[i])
			{
				out[j] = seq[i];
				break;
			}
		}
	}
	for(int i=1; i<=n; i++) if(!out[i]) printf("-1\n"), exit(0);
	for(int i=1; i<=n; i++) printf("%d\n", out[i]);
	return 0;
}

Measured memory_bytes: 256
import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

/// 数列の読み込み
auto readNums(T = int)() {
	return readln().chomp.split.map!(to!T).array;
}

/// 数の読み込み
auto readNum(T = int)() {
	return readNums!T.front;
}

/// 指定行数読み込み
auto readRows(size_t rows) {
	return generate(() => readln().chomp).take(rows).array;
}

struct Switch {
    size_t next;
    bool touch = false;
}

void main() {
    auto switches = readNum.readRows.map!(n => Switch(to!size_t(n))).array;
    for(size_t i = 0, count = 0; !switches[i].touch;) {
        Switch* s = &switches[i];
        s.touch = true;
        i = s.next - 1;
        ++count;
        
        if(i == 1) {
	writefln("%d", count);
        	return;
        }
    }
    
    writefln("-1");
}

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

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c, n, sum, A[500010], B[500000], rui[500000], dp[5000];
str S, T, U; bool check = true;	vector<ll> v;



int main() {
	//Code Line
cin >> S;
if(S[0] == '7')check = false;
if(S[1] == '7')check = false;
if(S[2] == '7')check = false;
if(check)cout << "No" << endl;
else cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

bool dp[100001];

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

	string s;
	string p[4] = { "dream","dreamer","erase","eraser" };
	cin >> s;
	dp[0] = true;
	rep(i,s.size()) if(dp[i]){
		rep(j,4) {
			if (s.compare(i, p[j].size(), p[j]) == 0)
				dp[i + p[j].size()] = true;
		}
	}
	cout << (dp[s.size()] ? "YES" : "NO") << endl;

	return 0;
}

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

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

int main() {

    int a, b; cin >> a >> b;

    cout << max(0, a - 2 * b) << endl;
}

Measured memory_bytes: 256