akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#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 FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}

class Combination{
public:
    int N;
    ll mod;
    vector<ll> fact;

    Combination(int n, ll m) : N(n), mod(m), fact(n+1){
        fact[0] = 1;
        for(ll i=1; i<=N; i++){
            fact[i] = i * fact[i-1] % mod;
        }
    }

    ll POW(ll a, ll b){
        ll res = 1;
        while(b > 0){
            if(b & 1){
                res = res * a % mod;
            }
            a = a * a % mod;
            b >>= 1;
        }
        return res;
    }

    ll combin(int n, int k){
        if(n < 0 || k < 0 || n < k){
            return 1;
        }
        return fact[n] * POW(fact[k] * fact[n-k] % mod, mod - 2) % mod;
    }

    ll moddiv(ll a, ll b){
        return a % MOD * POW(b, mod - 2) % MOD;
    }
};

signed main(){
    ll n, k;
    cin >> n >> k;

    Combination C(2*n, MOD);
    ll ans = 0;

    REP(i, n){
        if(i > k) break;
        ll cnt = C.combin(n, i);
        cnt *= C.combin(n-1, i);
        cnt %= MOD;
        ans += cnt;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void){

    int N; cin>>N;
    vector<int> B(N);
    for (int i = 0; i < N-1; ++i) {
        cin>>B[i];
    }
    ll ans = B[0];
    for (int i = 1; i < N-1; ++i) {
        ans += min(B[i-1],B[i]);
    }
    ans += B[N-1-1];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

#define N 200010

int n,a[N],mx,kmx,sx,ksx;

int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",a+i);
	for(int i=1;i<=n;++i)
		if(a[i]>mx) mx=a[i],kmx=i;
	for(int i=1;i<=n;++i)
		if(a[i]>sx&&i!=kmx)
			sx=a[i],ksx=i;
	for(int i=1;i<kmx;++i)
		printf("%d\n",mx);
	printf("%d\n",sx);
	for(int i=kmx+1;i<=n;++i)
		printf("%d\n",mx);
	return 0;
}

Measured memory_bytes: 2304
class BinarySearchTree:
    root = None
    def insert(self, k):
        y = None
        x = self.root
        z = Node(k)
        while x:
            y = x
            if z.k < x.k:
                x = x.l
            else:
                x = x.r
        z.p = y
        
        if y == None:
            self.root = z
        else:
            if z.k < y.k:
                y.l = z
            else:
                y.r = z
        
    def preParse(self, u):
        if u == None:
            return 
        print("", str(u.k), end = "")
        self.preParse(u.l)
        self.preParse(u.r)

    def inParse(self, u):
        if u == None:
            return 
        self.inParse(u.l)
        print("", str(u.k), end = "")
        self.inParse(u.r)

class Node: 
    def __init__(self, k):
        self.k = k
        self.p = None
        self.l = None
        self.r = None

if __name__ == '__main__':
    n = int(input().rstrip())
    x = BinarySearchTree()
    for i in range(n):
        com = input().rstrip()
        if com.startswith("insert"):
            k = int(com.split(" ")[1])
            x.insert(k)
        else:
            x.inParse(x.root)
            print()
            x.preParse(x.root)
            print()

Measured memory_bytes: 154084
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

A,B=get_i
if (A*B).odd?
    puts "Yes"
else
    puts "No"
end

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main(void){
	int a;
	int b;

	int total=0;
 
	cin >> a  >> b;
 
 
	for(int i=1; i < a; i++)
		total++;

	if (a <= b)
		total++;
	
	cout << total;



 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 200001
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return ans.x;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
char c;
cin>>c;
cout<<(char)(c+1)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<queue>
using namespace std;
 
#define what_is(x) cerr << #x << " is " << x << endl; 
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define bug(n) {outl(n);return;}
#define pii pair<int,int>
#define lim 9223372036854775805
#define ninf -9223372036854775802
#define M 1000000007
#define eps 1e-9
#define MAX 100
#define N 100
#define db(a) for(auto it:a) {cout<<it<<" ";}cout<<endl;
ll prime[MAX]; 
ll fact[MAX];
const long long INF64 = 1e18;
ll vpow(ll a,ll b,ll p){
    if(b==0)
        return 1;
    if(b==1)
            return a;
    ll temp=vpow(a,b/2,p);
    temp*=temp;
    temp%=p;
    if(b%2==0)
        return temp;
    temp=temp*a;
    temp%=p;
    return temp;
}

ll gcd(ll a,ll b){
     if(a==0)
         return b;
     return gcd(b%a,a);
 }

 
ll inverseMod(ll a,ll b,ll p){
    if(b==0)
        return 1;
    ll temp=vpow(b,p-2,p);
    ll ans=temp*a;
    ans%=p;
    return ans;
}
void sieve() 
{ 
    prime[0] = prime[1] = 1; 
    for (ll i = 2; i < MAX; i++) { 
        if (prime[i] == 0) {
            for (int j = i * 2; j < MAX; j += i) { 
                if (prime[j] == 0) { 
                    prime[j] = i; 
                } 
            } 
            prime[i] = i; 
        } 
    } 
}

void factorial(){
    fact[0]=1;
    fact[1]=1;
    rep(i,2,MAX){
        fact[i]=(fact[i-1]*i);
        // fact[i]%=M;
    }
}
ll rand(ll a,ll b){
    return a+rand()%(b-a+1);
}
struct Per{
    ll val,ind,req;
    bool operator < (Per &A)const
    {
        return val<A.val;
    }
};
bool cmp (Per &A,Per &B){
    return A.val<B.val;
}
void solve(ll ttt){
    ll n,k;
    cin>>n>>k;
    vll a(n);
    rep(i,0,n)
        cin>>a[i];
    vll dp(n+1,INT_MAX);
    dp[0]=dp[1]=0;
    rep(i,2,n+1){
        ll ans=INT_MAX;
        ren(j,i-1,max(i-k,1ll)){
            ans=min(ans,abs(a[i-1]-a[j-1])+dp[j]);
        }
        dp[i]=ans;
    }
    cout<<dp[n]<<endl;
}
int main(){
    io;
    sieve();
    // factorial();
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    //freopen("output1.txt","w",stdout);
#endif
    ll t=1;
    //cin>>t;
    fix(12);
    rep(q,1,t+1){
        // cout<<"Case #"<<q<<": ";
         solve(q);
        //solve2();
    }
    return 0;
    
}        




Measured memory_bytes: 4764
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int K; cin >> K;
    long long res = 0;
    repp(i,1,K+1) {
        repp(j,1,K+1) {
            repp(k,1,K+1) {
                res+=GCD(GCD(i,j),k);
            }
        }
    }
    cout << res << endl;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll Pow(ll A, ll N){
  if (N == 0) return 1;
  if (N % 2 == 0) return Pow(A * A % MOD, N / 2);
  return Pow(A * A % MOD, N / 2) * A % MOD;
}

ll N, M, ans = 1;
ll fac[int(2e5+5)], rev[int(2e5+5)];

int main(){
  fac[0] = 1; rev[0] = 1;
  for (ll i = 1; i <= 2e5; i++){
    fac[i] = fac[i-1] * i % MOD;
    rev[i] = Pow(fac[i], MOD - 2);
  }

  cin >> N >> M;
  ll now = M;
  for (ll i = 2; i * i <= M; i++){
    ll cnt = 0;
    while (now % i == 0){
      now /= i; cnt++;
    }
    ans *= fac[N - 1 + cnt]; ans %= MOD;
    ans *= rev[cnt]; ans %= MOD;
    ans *= rev[N-1]; ans %= MOD;
  }

  if (now > 1){
    ans *= N; ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6808
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz");
char s[100][100];
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> h >> w;
  rep(i, h) {
    rep(j, w) { cin >> s[i][j]; }
  }

  rep(sy, h) {
    rep(sx, w) {
      rep(gy, h) {
        rep(gx, w) {
          if (s[sy][sx] == '#' || s[gy][gx] == '#') continue;
          ll min_cost[h + 10][w + 10];
          rep(i, h) rep(j, w) min_cost[i][j] = LINF;
          queue<P> qu;
          qu.push({sy, sx});
          min_cost[sy][sx] = 0;

          while (!qu.empty()) {
            auto p = qu.front();
            qu.pop();
            rep(i, 4) {
              int nx = p.se + dx[i], ny = p.fi + dy[i];
              if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
              if (s[ny][nx] == '#') continue;
              if (min_cost[p.fi][p.se] + 1 >= min_cost[ny][nx]) continue;
              min_cost[ny][nx] = min_cost[p.fi][p.se] + 1;
              qu.push({ny, nx});
            }
          }
          ans = max(min_cost[gy][gx], ans);
        }
      }
    }
  }
  Cout(ans);
  return 0;
}

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

using namespace std;

int main() {
	int n,l,ans,aji=0,i=0;
	cin >> n >> l;
	while(i<n){
		aji += l+i;
		i++;
	}
	if(l < 0){
		if(n <= abs(l)){
			ans = aji - (l+n-1);
		}
	}else{
		ans = aji - l;
	}	
	cout << ans;
}



Measured memory_bytes: 888
n = int(input())
a_list = list(map(int,input().split()))
a_list = sorted(a_list)
flag  = [0]*n


ans = 0
m = max(a_list)
b_list = [0]*(m+1)
for i in a_list:
    b_list[i] += 1
for i in a_list:
    if b_list[i] == 1:
        ans += 1

    for j in range(i , m+1 ,i):
        b_list[j]+= 1
print(ans)

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

int main(){
 int n;
 cin >> n;
 int x[n], y[n];
 for(int i = 0; i < n; i++){
   cin >> x[i];
  }
 for(int i = 0; i < n; i++){
   cin >> y[i];
  }

 double D_1 = 0.0;
 for(int i = 0; i < n; i++){
   D_1 += 1.0 * abs(x[i] - y[i]);
 }
 printf("%f\n", D_1);

 double D_2 = 0.0;
 for(int i = 0; i < n; i++){
   D_2 += 1.0 * pow(x[i] - y[i], 2);
 }
 printf("%f\n", sqrt(D_2));

 double D_3 = 0.0;
 for(int i = 0; i < n; i++){
   D_3 += 1.0 * abs( pow(x[i] - y[i], 3.0) );
 }
 printf("%f\n", pow(D_3, 1.0 / 3.0));

 double D_4 = 0.0;
 for(int i = 0; i < n; i++){
   if(abs(x[i] - y[i]) > D_4) D_4 = abs(x[i] - y[i]);
 }
 printf("%f\n", D_4);
}
 


Measured memory_bytes: 3308
input()
g = input()
a = list(map(str, g.split()))
b = list(map(int, g.split()))
if sorted(b) == b:
    print("YES")
else:
    m = 0
    for i in range(len(b)):
        if b[i] == sorted(b)[i]:
            m+=1
    if m==len(b)-2:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 38512
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

int N, M, X, Y;
int x[110], y[110];

int main()
{
    cin >> N >> M >> X >> Y;
    rep(i, 0, N)
    {
        cin >> x[i];
    }
    rep(i, 0, M)
    {
        cin >> y[i];
    }
    sort(x, x + N, greater<int>());
    sort(y, y + M);
    for (int Z = X + 1; Z <= Y; Z++)
    {
        if (x[0] < Z && y[0] >= Z)
        {
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int n = sc.nextInt();
        int k = sc.nextInt();

        String s = sc.next();

        char[] c = s.toCharArray();

        c[k - 1] += 0X20;

        for (int i = 0; i < n; i++) {
            System.out.print(c[i]);
        }

        System.out.println();

        sc.close();

    }
}

Measured memory_bytes: 23124
use std::str::FromStr;
use std::fmt::Debug;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn calc_fib(n: usize) -> Vec<usize>{
    let mut v: Vec<usize> = vec![0;n];
    v[0] = 1;
    v[1] = 1;
    for i in 2..n{
        v[i]  += v[i-1] + v[i-2];
    }
    v
}


fn main(){
    let line : Vec<usize> = read_as_vec();
    let (h, w, k) = (line[0], line[1], line[2]);

    let mut dp: Vec<Vec<usize>> = vec![vec![0;w];h+1];
    let fib: Vec<usize> = calc_fib(w+1);
    let m = 1000000007;
    dp[0][0] = 1;

    for i in 1..h+1{
        for j in 0..w{
            if j > 0{
                dp[i][j-1] = (dp[i][j-1] + dp[i-1][j] * (fib[j-1] * fib[w-1-j])) % m;
            }

            dp[i][j] = (dp[i][j] + dp[i-1][j] * (fib[j] * fib[w-1-j])) % m;

            if j < w-1{
                dp[i][j+1] = (dp[i][j+1] + dp[i-1][j] * (fib[j] * fib[w-2-j])) % m;
            }
        }
    }

    println!("{}", dp[h][k-1]);
}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

string s;

int main() {
	cin >> s;
	string tmp = s;
	rep(i, s.size() / 2) {
		tmp.erase(tmp.size() - 2);
		string com = tmp.substr(0, tmp.size() / 2);
		int n = (int)tmp.size() / 2;
		string com2 = tmp.substr(n, (int)tmp.size());
		if(com == com2) {
			cout << (int)tmp.size() << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A.append(0)
A.insert(0, 0)

sum = 0

for i in range(len(A) - 1):
    sum += abs(A[i+1] - A[i])

for i in range(N):
    temp = sum
    temp -= (abs(A[i+1] - A[i]) + abs(A[i+2] - A[i+1]))
    temp += abs(A[i+2] - A[i])
    print(temp)


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

using namespace std;

int main(){
  int n , p;
  cin >> n >> p;
  string s;
  cin >> s;
  
  if(p % 2 == 0 || p % 5 == 0){
   long long int res = 0;
    for(int i=n-1;i>=0;i--){
      
      if((s[i]-'0') % p == 0){
        res += i+1;
      }
      
    }
    cout << res << endl;
    return 0;
  }
  
  else{
   long long int ten = 1;
    long long int res = 0;
    
    vector<long long int> u(p,0);
    long long int cnt = 0; 
    u[cnt]++;
    for(int i=n-1;i>=0;i--){
     cnt = (cnt + ((s[i]-'0')*ten) ) % p;
      ten = (ten*10) % p;
      u[cnt]++;
    }
    
    for(int i=0;i<p;i++){
      res += u[i]*(u[i]-1)/2;
    }
    
    cout << res << endl;
    return 0;
  }
  
}
      
      
    
    


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
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;}

int main() {
    ll n;
    cin >> n;
    map<ll, ll> mp;
    rep(i, n) {
        ll d;
        cin >> d;
        mp[d]++; 
    }
  	ll m;
    cin >> m;
    bool ok = true;
    rep(i, m) {
        ll t;
        cin >> t;
        if (mp[t] <= 0) {
            ok = false;
            break;
        } else {
            mp[t]--;
        }
    }
    if (ok) cout << "YES\n";
    else cout <<"NO\n";
}

Measured memory_bytes: 12800
#include<stdio.h>
int main(){
  int n,i,j,m,tmp;
  int a[3];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a[0],&a[1],&a[2]);
    if(a[0] < a[1]){
      tmp = a[0];
      a[0] = a[1];
      a[1] = tmp;
    }
    if(a[0] < a[2]){
      tmp = a[0];
      a[0] = a[2];
      a[2] = tmp;
    }
    if(a[0]*a[0] == a[1]*a[1] + a[2]*a[2]){
      printf("YES\n");
    }
    else{
      printf("NO\n");
    }
  }
  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long n)
{

    ll num = n; // 素因数分解する変数num
    ll ans = abs(n - 1);

    ll tmp = 1;
    for (ll i = 1; i * i <= n; i++)
    {
        if (num % i == 0)
        {
            ans = min(ans, abs(i - 1 + (num / i) - 1));
        }
    }

    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define _USE_MATH_DEFINES
using namespace std;

int main() {
	
	ios::sync_with_stdio(false);
    cin.tie(0);
    
    int i,n;
	int total = 0;
    cin>>n;
    int store[n];
    for(i = 0;i<n;i++)
    {
    	cin>>store[i];
	}
	total = store[0];
	for(i = 1;i<n;i++)
    {
    	total = total^store[i];
	}
	for(i = 0;i<n;i++)
    {
    	int tmp = total^store[i];
    	cout<<tmp<<" ";
	}
	return 0;
}

Measured memory_bytes: 4440
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  int n,a,b;
  cin>>n>>a>>b;
  cout<<min(n*a,b)<<endl;
}

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


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

int len1,len2;
string seq1,seq2;
int dp[1000+10][1000+10];

int main() {
	for (int i=0; i<=1000; i++){
		dp[i][0] = i;
		dp[0][i] = i;
	}
	
	cin >> seq1 >> seq2;
	len1 = seq1.length();
	len2 = seq2.length();
	
	for (int i=1; i<=len1; i++){
		for (int j=1; j<=len2; j++){
			if (seq1[i-1] == seq2[j-1]){
				dp[i][j] = dp[i-1][j-1];
			}else{
				dp[i][j] = min((dp[i-1][j-1]+1), min((dp[i][j-1]+1), (dp[i-1][j]+1)));
			}
		}
	}
	cout << dp[len1][len2] << endl;
	return 0;
}


Measured memory_bytes: 7148
/* インクルードなど */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll a,b,c,d,e,f,g,h;
  cin >> a >> b >> c >> d;
  e = a*c;
  f = a*d;
  g = b*c;
  h = b*d;
  cout << max({e,f,g,h}) << endl;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();

            Console.WriteLine(input[0] + input[1] / 2);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<list>
#include<vector>
using namespace std;
int main() {
	int a, b, c;
	while (cin >> a >> b >> c, a) {
		int r[314];
		for (int i = 1; i <= a + b + c; i++) r[i] = 2;
		int n; cin >> n;
		list<int>la, lb, lc;
		for (int i = 0; i < n; i++) {
			int d, e, f, g; cin >> d >> e >> f >> g;
			if (g) {
				r[d] = 1;
				r[e] = 1;
				r[f] = 1;
			}
			else {
				la.push_back(d);
				lb.push_back(e);
				lc.push_back(f);
			}
		}
		while (true) {
			auto ia = la.begin(), ib = lb.begin(), ic = lc.begin();
			vector<int>v;
			for (int i = 0; i < la.size(); i++) {
				if (r[*ia] == 1 && r[*ib] == 1) {
					r[*ic] = 0;
					v.push_back(i);
				}
				else if (r[*ic] == 1 && r[*ib] == 1) {
					r[*ia] = 0;
					v.push_back(i);
				}
				else if (r[*ia] == 1 && r[*ic] == 1) {
					r[*ib] = 0;
					v.push_back(i);
				}
				ia++; ib++; ic++;
			}
			if (v.size() == 0)break;
			else for (int i = v.size() - 1; i >= 0; i--) {
				auto ia = la.begin(), ib = lb.begin(), ic = lc.begin();
				for (int j = 0; j < v[i]; j++) { ia++; ib++; ic++; }
				la.erase(ia);
				lb.erase(ib);
				lc.erase(ic);
			}
		}
		for (int i = 1; i <= a+b+c; i++) {
			cout << r[i] << endl;
		}
	}
}

Measured memory_bytes: 3132
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

signed main() {
	int K, T;
	cin >> K >> T;

	vector<int> a;
	inputVector(a, T);

	int sum = 0;
	rep(i, T) {
		sum += a[i];
	}

	int ret = 0;
	rep(i, T) {
		ret = max(ret, a[i] - (sum - a[i]) - 1);
	}

	cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
 	public static void main(String args[])throws IOException {
     	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	StringTokenizer st = new StringTokenizer(br.readLine());
      	int N = Integer.parseInt(st.nextToken());
      	long A = Long.parseLong(st.nextToken());
      	long B = Long.parseLong(st.nextToken());
      
      	st = new StringTokenizer(br.readLine());
      	int[] arr = new int[N];
      	int i = 1;
      	long ans = 0;
      	arr[0] = Integer.parseInt(st.nextToken());
      	while(st.hasMoreTokens()) {
         	arr[i] =  Integer.parseInt(st.nextToken());
          	long dif = arr[i] - arr[i-1];
          	if(dif*A > B) {
             	 ans += B;
            } else {
             	ans += (dif*A); 
            }
          	i++;
        }
      	System.out.println(ans);
    }
}

Measured memory_bytes: 44672
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

#define LET(name, value) __typeof(value) name = value
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for (LET(i, (c).begin()); i != (c).end(); ++i)

int main() {
  int n;
  while (scanf("%d", &n), n) {
    map<int, int> id2time, id2power;
    REP(i, n) {
      int M, D, h, m, id; char e;
      scanf("%d/%d %d:%d %c %d", &M, &D, &h, &m, &e, &id);
      int time = m + 60 * h;
      if (e == 'I') {
        id2time.insert(make_pair(id, time));
      } else if (e == 'O') {
        int i_time = id2time[id], o_time = time;
        if (id == 0) {
          FOREACH(it, id2time) {
            if (it->first != 0) {
              id2power[it->first] += o_time - max(i_time, it->second);
            }
          }
        } else {
          LET(goddess, id2time.find(0));
          if (goddess != id2time.end()) {
            id2power[id] += o_time - max(i_time, goddess->second);
          }
        }
        id2time.erase(id);
      } else {
        assert(false);
      }
    }
    int ans = 0;
    FOREACH(it, id2power) { ans = max(ans, it->second); }
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 0
#include<stdio.h>

int main(){
    int S;
    scanf("%d", &S);
    int h, m, s;
    h = S / 3600;
    m = (S - h * 3600) / 60;
    s = (S - h * 3600 - m * 60);
    printf("%d:%d:%d\n", h, m, s);
    return 0;
    
    
    
}


Measured memory_bytes: 2108
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b = f()
    if a%2 ==0 or b%2 == 0:
        print('Even')
    else:
        print('Odd')

solve()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	string s;
  	cin >> s;
  	if (s.size() >= 4 && s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I') 
      	cout << "Yes" << endl;
    else
      	cout << "No" << endl;
}




Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main(){
	char a,b;
	cin>>a>>b;
	if(a=='H')
	cout<<b;
	if(a=='D'){
		if(b=='H')
		cout<<'D';
	   else	if(b=='D')
		cout<<'H';
	}
	
	
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define dl double
template <class T>
void rd(T &x){
  x=0;T f=1;char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch<='9' && ch>='0')x=x*10+ch-'0',ch=getchar();x*=f;
}
const int mod=1e9+7;
const int N=2e5+10;
using namespace std;
int n,k,n_a,n_b;
int a[N],b[N];
bool cmp(int x,int y){return abs(x)<abs(y);}
int main(){
 // freopen("in.txt","r",stdin);
 // freopen("o.txt","w",stdout);
 rd(n);rd(k);
 for(int i=1;i<=n;i++){
  int x;rd(x);
  if(x<0)a[++n_a]=x;
  else b[++n_b]=x;
 }
 sort(a+1,a+n_a+1,cmp);
 sort(b+1,b+n_b+1);
 int ans=1;
 if(!n_b){
  if(k&1)for(int i=1;i<=k;i++)ans=(1ll*ans*a[i]%mod+mod)%mod;
  else for(int i=n_a;i>=n_a-k+1;i--)ans=(1ll*ans*a[i]%mod+mod)%mod;
 }
 else {
  if(k&1)k--,ans=b[n_b--];
  k/=2;
  for(int i=n_b,j=n_a;k;k--){
   if(i>=2 && j>=2){
    if(1ll*b[i]*b[i-1] > 1ll*a[j]*a[j-1]){
     ans=1ll*ans*b[i]%mod*b[i-1]%mod;i-=2;
    }
    else {
     ans=1ll*ans*a[j]%mod*a[j-1]%mod;j-=2;
    }
   }
   else if(i>=2)ans=1ll*ans*b[i]%mod*b[i-1]%mod,i-=2;
   else if(j>=2)ans=1ll*ans*a[j]%mod*a[j-1]%mod,j-=2;
   else if(i==1 && j==1)ans=(1ll*ans*b[i]%mod*a[j]%mod+mod)%mod;
  }
 }
 printf("%d\n",ans);
 return 0;
}
/**/

Measured memory_bytes: 4548
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

#include <iomanip>

using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

/*********** Constants ***********/
const auto INF = static_cast<ll>(1e15);
const auto MOD = static_cast<ll>(1e9 + 7);

/*********** Variables ***********/
ll N;
double ANS;
vector<double> P;
vector<vector<double>> DP;

/*********** Functions ***********/
void initialize() {
    cin >> N;
    P.resize(N);
    for (auto& item : P) cin >> item;
    DP.resize(N + 1, vector<double>(N + 1, 0.0));
    ANS = 0.0;
}

void solve() {
    DP[0][0] = 1.0;
    for (ll i = 1; i <= N; i++) {
        DP[i][0] = DP[i - 1][0] * (1 - P[i - 1]);
    }
    for (ll i = 1; i <= N; i++) {
        for (ll j = 1; j <= N; j++) {
            DP[i][j] = DP[i - 1][j - 1] * P[i - 1] + DP[i - 1][j] * (1.0 - P[i - 1]);
        }
    }
    for (ll i = (N + 1) / 2; i <= N; i++) {
        ANS += DP[N][i];
    }
}

void output() {
    cout << setprecision(10) << ANS << endl;
}

int main() {
    initialize();
    solve();
    output();
    return 0;
}


Measured memory_bytes: 70784
n = int(input())
alst = list(map(int, input().split()))

total = alst[0]
xor = alst[0]
ans = 0
l = 0
r = 0
while 1:
    if xor == total:
        ans += r - l + 1
        r += 1
        if r == n:
            break
        total += alst[r]
        xor ^= alst[r]
    else:
        total -= alst[l]
        xor ^= alst[l]
        l += 1
print(ans)

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

int main(){
  int N;
  cin >> N;
  
  string S,T;
  cin >> S >> T;
  
  rep(i,N){
    cout << S.at(i) << T.at(i);
  }
  cout <<  endl;
}

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

long long gcm(long long a, long long b){
    if(a % b == 0){
        return b;
    }else{
        return gcm(b, a%b);
    }
}
long long lcm(long long a, long long b){
    return (a*b/gcm(a, b));
}

int main() {
    long long N, M, cmul;
    cin>>N>>M;
    vector<long long> a(N);
    cin >> a[0];
    cmul = a[0];
    REP(i, 1, N){
        cin >> a[i];
        cmul = lcm(cmul, a[i]);
    }
    
    if(cmul % 2 == 1 || cmul / 2 > M ){
        cout << 0 << endl;
        return 0;
    }
    REP(i, 0, N){
        if(cmul % a[i] == 0 && (cmul / a[i]) % 2 == 1 ){
            if(i == N-1){
                break;
            }
        }else{           
            cout << 0 << endl;
            return 0;
        }
    }
    long long h_mul = cmul /2;
    long long ans = (M - h_mul)/cmul + 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var capital = new[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
            var small = new[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };

            string alpha = Console.ReadLine();

            if (capital.Contains(alpha))
                Console.WriteLine("A");
            if (small.Contains(alpha))
                Console.WriteLine("a");

        }
    }
}


Measured memory_bytes: 26076
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
  string s,t; cin>>s>>t;
  int ns=s.length(),nt=t.length(); 
  char ss[ns],tt[nt];
  for(int i=0;i<ns;i++) ss[i]=s[i];
  for(int i=0;i<nt;i++) tt[i]=t[i];
  sort(ss,ss+ns);
  sort(tt,tt+nt,greater<int>());
  for(int i=0;i<ns;i++) s[i]=ss[i];
  for(int i=0;i<nt;i++) t[i]=tt[i];
  string ans="No";
  if(s<t) ans="Yes";
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

void topological_sort(const vector<vector<int>>& G, vector<int>& ord)
{
   vector<int> num(G.size(),0);
   for (int i = 0; i < G.size(); i++) {
      for (int j = 0; j < G[i].size(); j++) {
         num[G[i][j]]++;
      }
   }
   stack<int> st;
   for(int i = 0; i < num.size(); i++) {
      if (num[i] == 0) {
         st.push(i);
      }
   }
   for (int k = 0; !st.empty(); k++) {
      int i = st.top(); st.pop();
      ord[k] = i;
      for(int j = 0; j < G[i].size(); j++) {
         num[G[i][j]]--;
         if (num[G[i][j]] == 0) {
            st.push(G[i][j]);
         }
      }
   }
}

signed main()
{
   int n; cin >> n;
   V<V<int>> G(n);
   for (int i = 1; i < n; i++) {
      int v; cin >> v; v--;
      G[v].push_back(i);
   }
   DUMP(G)

   V<int> ord(n);
   topological_sort(G, ord);
   DUMP(ord)

   V<int> dp(n);
   for (int k = n-1; k >= 0; k--) {
      int v = ord[k];
      if (G[v].size() == 0) continue;

      int m = G[v].size();
      V<int> tmp(m);
      for (int i = 0; i < m; i++) {
         tmp[i] = dp[G[v][i]];
      }
      sort(tmp.begin(), tmp.end());
      for (int i = 0; i < m; i++) {
         tmp[i] += m - i;
      }
      sort(tmp.begin(), tmp.end());

      dp[v] = tmp[m-1];
   }
   DUMP(dp)

   cout << dp[0] << endl;

   return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>

using namespace std;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* typedef */

typedef long long ll;

/* global variables */

/* function */

/* main */
int main() {

    int n; cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    reverse(v.begin(), v.end());
    for (int i = 0; i < n-1; i++)
        cout << v[i] << ' ';
    
    cout << v[n-1] << '\n';

}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
int main() {

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

 if (a < b) {
 cout << "a < b" << endl;
 }

 else if ( a > b) {
 cout << "a > b" << endl;
 }

 else {
 cout << "a == b" << endl;
 }
}
 
 
 



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair < int,int > PII;
typedef pair < ll,ll > PLL;
#define pb push_back
//#all(x) (x).begin(),(x).end()

//int const N = 1;
int const MOD = 1e9 + 7;

ll bigmod(ll a, ll b)
{
    if(b==0)
        return 1 % MOD;
    ll x = bigmod(a,b/2);
    x = (x * x) % MOD;
    if(b%2)
        x = (x * a) % MOD;
    return x;
}

int const N = 16;
ll pre[(1<<N) + 10];
ll dp[(1<<N) + 10];
ll mat[N][N];

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

    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            cin >> mat[i][j];

    for(int mask = 0; mask < (1<<n); mask++)
    {
        //dp[mask]
        for(int x =0 ; x < n; x++){
            for(int y = x + 1; y < n; y++)
            {
                if((mask &(1<<x)) and (mask &(1<<y)))
                {
                    pre[mask] += mat[x][y];
                }
            }
        }

    }

    dp[0] = 0;

    for(int mask = 0; mask < (1 << n) ; mask++)
    {
        for(int sub = mask; sub ; sub = (mask) & (sub-1))
        {
            dp[mask] = max(dp[mask], pre[sub] + dp[sub ^ mask]);
        }
    }
    cout << dp[(1<<n)-1] << endl;
    return 0;
}




Measured memory_bytes: 1280
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) { if(b==0) return a; else return GCD(b, a%b); }
ll LCM(ll a, ll b) { return a/GCD(a,b)*b; }

class CGoodSequence {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n;in>>n;
        map<ll,ll> a;
        rep(i,n) {
            ll tmp;in>>tmp;
            ++a[tmp];
        }
        ll cnt=0;
        for(const auto i: a){
            if(i.first>i.second) cnt+=i.second;
            else cnt+=i.second-i.first;
        }
        out<<cnt<<endl;
	}
};


int main() {
	CGoodSequence solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 6272
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		
		String line = scan.nextLine();
		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < line.length(); i++){
			char ch = line.charAt(i);
			if(Character.isLowerCase(ch)){
				ch = Character.toUpperCase(ch);
			}
			sb.append(ch);
		}
		String out = sb.toString();
		System.out.printf("%s\n", out);
	}
}

Measured memory_bytes: 26168
#include <iostream>

using namespace std;

int main()
{
    int a,b,c=0,n;
    cin>>a>>b;
    int outlet=1;
    n=0;
 
    while(outlet<b)
    {
       --outlet;
       outlet+=a;
       ++c;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
for i in range(len(s)):
    if s[i]=="B":
        break
new_s = s[i:]

ans=0
c_cnt=0
for i in range(len(new_s)):
    if new_s[i]=="W":
        ans+=i
        ans-=c_cnt
        c_cnt+=1
print(ans)

Measured memory_bytes: 40816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string N;
    int K;
    cin >> N >> K;
    int keta = N.size();
    vector<vector<vector<ll>>> dp(keta + 1, vector<vector<ll>>(2, vector<ll>(K + 1, 0)));//<左からN桁まで>、<境界は1、それ以外0>、<0以外の数>
    dp.at(1).at(1).at(1) = 1;
    dp.at(1).at(0).at(1) = N.at(0) - '0' - 1;
    for(int i = 2; i <= keta; i++)
    {
        dp.at(i - 1).at(0).at(0) = 1;
        int num = N.at(i - 1) - '0';
        for(int j = 1; j <= K; j++)
        {
            if(num > 0)
            {
                dp.at(i).at(1).at(j) = dp.at(i - 1).at(1).at(j - 1);
            } else {
                dp.at(i).at(1).at(j) = dp.at(i - 1).at(1).at(j);
            }
        }
        for(int j = 1; j <= K; j++)
        {
            //今回の桁が0の分
            dp.at(i).at(0).at(j) += dp.at(i - 1).at(0).at(j);
            //今回の桁が0以外の分
            dp.at(i).at(0).at(j) += dp.at(i - 1).at(0).at(j - 1) * 9;
            if(num > 0)
            {
                //境界から0の分もこちらに追加(numが0の時は境界の方に追加されているので追加しない)
                dp.at(i).at(0).at(j) += dp.at(i - 1).at(1).at(j);
                dp.at(i).at(0).at(j) += dp.at(i - 1).at(1).at(j - 1) * (num - 1);
            }
            
        }
    }
    ll answer = dp.at(keta).at(1).at(K) + dp.at(keta).at(0).at(K);
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;



int main(){
    string s, t;
    cin >> s >> t;
    
    rep(i, s.size()){
        if(s[i] != t[i]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}



Measured memory_bytes: 3036
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
cnt = 0

for i in range (N):
    A.append(list(map(int,input().split())))
    
for j in range (N):
  tl = 0
  for k in range (M):
    tl += A[j][k]*B[k]
  if tl + C > 0:
    cnt += 1
    
print(cnt)

Measured memory_bytes: 3064