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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3
#define mod 1000000007

int N,M,K,L;
vector<P> g[2010];
bool vis[2010];
bool iscycle[2010];
vector<int> vs[2010];
int mat[2010][2010];
vector<int> w[2010];

void dfs(int v,int pre){
  vis[v]=true;
  vs[K].push_back(v);
  for(P e : g[v]){
    if(e.fi==pre)continue;
    if(!vis[e.fi])dfs(e.fi,v);
  }
}

int main(){
  cin>>N>>M>>L;
  rep(i,M){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    g[a].push_back(P(b,c));
    g[b].push_back(P(a,c));
    mat[a][b]=mat[b][a]=c;
  }
  rep(i,N){ // path
    if(g[i].size()==2||vis[i])continue;
    dfs(i,-1);
    iscycle[K]=false;
    K++;
  }
  rep(i,N){ // cycle
    if(vis[i])continue;
    dfs(i,g[i][0].fi);
    iscycle[K]=true;
    K++;
  }

  rep(i,K){
    int sz=vs[i].size();
    vector<vector<vector<vector<int> > > > dp(2,vector<vector<vector<int> > >(sz+1,vector<vector<int> >(2,vector<int>(2,-INF))));
    int crt=0,nxt=1;
    dp[crt][0][0][0]=0; dp[crt][1][1][1]=0;
    repl(j,1,sz){
      rep(k,sz+1)rep(f1,2)rep(f2,2)dp[nxt][k][f1][f2]=-INF;
      rep(k,sz+1){
        rep(f1,2){ // pre
          rep(f2,2){ // start
            if(dp[crt][k][f1][f2]==-INF)continue;
            int con=(j==sz-1&&f2&&iscycle[i]?1:0);
            if(f1){
              if(k+1<=sz&&mat[vs[i][j-1]][vs[i][j]]!=0&&(con==0||(mat[vs[i][j]][vs[i][0]]!=0)))maxch(dp[nxt][k+1][1][f2],dp[crt][k][f1][f2]+mat[vs[i][j-1]][vs[i][j]]+(con?mat[vs[i][j]][vs[i][0]]:0));
              maxch(dp[nxt][k][0][f2],dp[crt][k][f1][f2]);
            }else{
              if(k+1<=sz&&(con==0||(mat[vs[i][j]][vs[i][0]]!=0)))maxch(dp[nxt][k+1][1][f2],dp[crt][k][f1][f2]+(con?mat[vs[i][j]][vs[i][0]]:0));
              maxch(dp[nxt][k][0][f2],dp[crt][k][f1][f2]);
            }
          }
        }
      }
      swap(crt,nxt);
    }
    rep(k,sz+1)w[i].push_back(max({dp[crt][k][0][0],dp[crt][k][0][1],dp[crt][k][1][0],dp[crt][k][1][1]}));
  }

  vector<vector<int> > dp(2,vector<int>(L+1,-INF));
  int crt=0,nxt=1;
  dp[crt][0]=0;
  rep(i,K){
    rep(j,L+1)dp[nxt][j]=-INF;
    rep(j,L+1){
      if(dp[crt][j]==-INF)continue;
      rep(k,w[i].size()){
        if(j+k<=L)maxch(dp[nxt][j+k],dp[crt][j]+w[i][k]);
      }
    }
    swap(crt,nxt);
  }

  if(dp[crt][L]==-INF)cout<<"Impossible"<<endl;
  else cout<<dp[crt][L]<<endl;

  return 0;
}



Measured memory_bytes: 15740
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;

class Program
{


    static void Main(string[] args)
	{
        int N = int.Parse(Console.ReadLine());

        bool isOK = false;

        int count = 0;

        for(int i = 0;i< N; i++)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);


            if (a == b)
            {
                count++;
            }
            else
            {
                count = 0;
            }

            if(count == 3)
            {
                isOK = true;
                Console.WriteLine("Yes");
                break;
            }

        }



        if (!isOK) Console.WriteLine("No");

    }
}

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


int main(){
    int h,w,k;
    cin >> h >> w >> k;
    vector<string> s;
    rep(i,h)rep(j,w){
        string t;
        cin >> t;
        s.push_back(t);
    }
    int ans = 0;
    for(int i=0; i<(1<<h); i++){
        for(int j=0; j<(1<<w); j++){
            vector<string> ss = s;
            for(int ii=0; ii<h; ii++){
                if(i>>ii & 1){
                    rep(k,w) ss[ii][k]='r';
                }
            }
            for(int ii=0; ii<w; ii++){
                if(j>>ii & 1){
                    rep(k,h) ss[k][ii]='r';
                }
            }

            int now = 0;
            rep(ii,h)rep(jj,w){
                if(ss[ii][jj]=='#') now++;
            }
            if(now == k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#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()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
     
    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     
const int MOD = 1e9 + 7;



int main(){
   string s, t;
   cin >> s >> t;
   vector<int> a(s.size()), b(t.size());
   rep(i, (int)s.size()){
      if(s[i] == 'A')a[i] = 1;
      else a[i] = 2;
   }
   rep(i, (int)t.size()){
      if(t[i] == 'A')b[i] = 1;
      else b[i] = 2;
   }

   rep(i, (int)s.size()){
      if(i == 0)continue;
      a[i] += a[i - 1];
      a[i] %= 3;
   }
   rep(i, (int)t.size()){
      if(i == 0)continue;
      b[i] += b[i - 1];
      b[i] %= 3;
   }

   int Q;
   cin >> Q;
   rep(i, Q){
      int al, ar, bl, br;
      cin >> al >> ar >> bl >> br;
      al--;ar--;bl--;br--;
      int sn, tn;
      if(al == 0)sn = a[ar];
      else sn = a[ar] - a[al - 1];

      if(bl == 0)tn = b[br];
      else tn = b[br] - b[bl - 1];

      if(sn < 0)sn += 3;
      if(tn < 0)tn += 3;

      if(sn == tn)cout << "YES" << endl;
      else cout << "NO" << endl;
   }
}


Measured memory_bytes: 4284
n = int(input())
for _ in range(n):
    x, y, b, p = map(int, input().split())
    pr = x * b + y * p
    s = int((max(b, 5) * x + max(p, 2) * y) * 0.8)
    if s < pr:
        print(s)
    else:
        print(pr)


Measured memory_bytes: 5616
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
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; }

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    bool operator==(const mint a){
        return (x == a.x);
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// 2項係数を求める
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

//nが非常に大きく、aが小さい場合
mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    mint ans = 1;
    rep(i,N){
        ans *= (i+1);
    }

    cout << ans << endl;    
}

Measured memory_bytes: 3560
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] r = new int[n];
    for(int i = 0; i < n; i++){
      r[i] = stdIn.nextInt();
    }

    int min = r[0];
    int maxp = r[1] - r[0];
    for(int i = 1; i < n; i++){
      int prof = r[i] - min;
      if(prof > maxp)
        maxp = prof;
      if(r[i] < min)
        min = r[i];
    }

    System.out.println(maxp);
  }
}

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


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define pil pair<int,long long>
#define ll long long
#define el '\n'

using namespace std;

const int M = 1e3 + 10, N = 12;

int n, m, k;

int ar[N][M];

int hitung(int r1, int c1, int r2, int c2){
    r1--;
    c1--;
    return ar[r2][c2] - ar[r1][c2] - ar[r2][c1] + ar[r1][c1];
}

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

    cin >> n >> m >> k;
    for (int i=1;i<=n;i++){
        string s;
        cin >> s;
        for (int j=0;j<m;j++){
            int dig = (s[j] == '1');
            ar[i][j + 1] = dig; 
        }
    }

    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++){
            ar[i][j] = ar[i - 1][j] + ar[i][j - 1] - ar[i - 1][j - 1] + ar[i][j];
            // cout << ar[i][j] << " ";
        }
        // cout << el;
    }

    if (ar[n][m] <= k){
        cout << 0 << el;
        return 0;
    }

    int ans = MOD;
    for (int mask=0;mask<(1 << (n - 1));mask++){
        vector <int> bates;
        int cur = 0;
        bates.pb(0);
        for (int i=0;i<n-1;i++){
            if (mask & (1 << i)){
                cur++;
                bates.pb(i + 1);
            }
        }
        bates.pb(n);

        int last = 0;
        int len = bates.size();
        bool bisa = 1;

        // cout << mask << "=>" << el;
        for (int i=1;i<=m;i++){
            bool buat = 0;
            for (int j=0;j<len - 1;j++){
                int a = bates[j], b = bates[j + 1];
                
                // cout << a + 1 << " " << last + 1 << " " << b << " " << i << " => " << hitung(a + 1, last + 1, b, i) << el; 

                if (hitung(a + 1, last + 1, b, i) <= k) continue;
                else if (hitung(a + 1, i, b, i) > k){
                    bisa = 0;
                }
                else{
                    buat = 1;
                }
            }
            if (!bisa) break;

            if (buat && last == i - 1){
                bisa = 0;
                break;
            } else if (buat){
                // cout << i << " ";
                last = i - 1;
                cur++;
            }
        }
        // cout << el;

        if (bisa){
            if (cur < ans){
                // cout << cur << " " << mask << el;
                ans = cur;
            }
        } 
    }

    cout << ans << el;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<string>
#define mod 1000000007
using ll = long long;
using namespace std; 

int main(){
    ll n; cin >> n;
    ll ans=0;
    ll s=n/3;
    ll a=n/5;
    ll d=n/15;
    ans=(1+n)*n/2;
    ans=ans-(3+s*3)*s/2-(5+a*5)*a/2+(15+d*15)*d/2; 
    cout << ans << "\n";
}



Measured memory_bytes: 3584
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

n, m, d = mapint()
l = (min(n, d*2)+max(0, n-2*d)*2)*(m-1) if d!=0 else n*(m-1)
print(l/(n**2))

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N;
    cin >> N;
    vector<LL> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    int l = 1, m = 2, r = 3;
    LL P, Q, R, S;
    P = Q = R = S = 0;
    REP(i, l) {
        P += A[i];
    }
    FOR(i, l, m) {
        Q += A[i];
    }
    FOR(i, m, r) {
        R += A[i];
    }
    FOR(i, r, N) {
        S += A[i];
    }
    FOR(i, l, m - 1) {
        if(abs(P - Q) > abs(P - Q + 2*A[i])) {
            P += A[i];
            Q -= A[i];
            l++;
        }else{
            break;
        }
    }
    FOR(i, r, N - 1) {
        if(abs(R - S) > abs(R - S + 2*A[i])) {
            R += A[i];
            S -= A[i];
            r++;
        }else{
            break;
        }
    }
    LL res = max({P, Q, R, S}) - min({P, Q, R, S});

    FOR(i, 3, N) {
        Q += A[m];
        R -= A[m];
        m++;
        if(R == 0) {
            R += A[r];
            S -= A[r];
            r++;
        }

        FOR(i, l, m - 1) {
            if(abs(P - Q) > abs(P - Q + 2*A[i])) {
                P += A[i];
                Q -= A[i];
                l++;
            }else{
                break;
            }
        }
        FOR(i, r, N - 1) {
            if(abs(R - S) > abs(R - S + 2*A[i])) {
                R += A[i];
                S -= A[i];
                r++;
            }else{
                break;
            }
        }
        LL x = max({P, Q, R, S}) - min({P, Q, R, S});
        res = min(res, x);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    map<int, int> cnt;
    rep(i, n) cnt[a[i]]++;
    ll ans = 0;
    for (auto p : cnt) {
        ans += (ll)p.se * (p.se - 1) / 2;
    }
    rep(i, n) {
        int m = cnt[a[i]];
        cout << ans - (ll)m * (m - 1) / 2 + (ll)(m - 1) * (m - 2) / 2 << endl;
    }
}

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

int main()
{
  long long int x;
  cin >> x;
  long long int ans = 0;
  long long int eleven = x / 11;
  ans += eleven * 2;
  if (x % 11 == 0)
    cout << ans << endl;
  else
  {
    long long int rem = x % 11;
    if (rem > 6)
      ans += 2;
    else
      ans += 1;
    cout << ans << endl;
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

	typedef tree<
			int,
			null_type,
			less<int>,
			rb_tree_tag,
			tree_order_statistics_node_update>
	ordered_set;
	
#define ll long long 


int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	ll n;cin>>n;
	vector <ll> ans(n);
	for(int i=0;i<n;i++){
		cin>>ans[i];
	}
	for(int i=0;i<n;i++){
		ll temp;cin>>temp;
		ans[i]-=temp;
	}
	sort(ans.begin(),ans.end());
	ll val=0;
	for(int x:ans){
		if(x>0){
			val+=x;
		}
	}
	cout<<val<<endl;
	return 0;
	
}


Measured memory_bytes: 3620
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0); }
inline int safe_mul(const int x, const int y) __attribute__ ((warn_unused_result));

string get(int s, int r, int a = -1) {
    cout << "? ";
    for (int i = s; i <= r; ++i)
        if (i != a)
            cout << i << ' ';
    if (a != -1 && (a < s || a > r))
        cout << a;
    cout << endl;
    string res;
    cin >> res;
    if (res == "-1")
        exit(0);
    return res;
}


int main() {
//    freopen("in.txt","r", stdin);
//    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int n;
    cin >> n;

    const string R = "Red";
    const string B = "Blue";

    map<string, string> opp = {{R,B},{B,R}};

    vector<string> ans(2 * n + 1);

    string fst = get(1, n);
    int l = 1;
    int r = n + 1;
    while (r-l > 1) {
        int mid = (l+r) / 2;
        if (get(mid, mid + n - 1) != fst)
            r = mid;
        else
            l = mid;
    }

    ans[l] = fst;
    ans[l + n] = opp[fst];

    for (int i = 1; i <= 2 * n; ++i) {
        if (ans[i] == "") {
            if (i < l || i > l + n) {
                if (get(l + 1, l + n - 1, i) == fst)
                    ans[i] = fst;
                else
                    ans[i] = opp[fst];
            } else {
                if (get(l, l + n, i) != fst)
                    ans[i] = fst;
                else
                    ans[i] = opp[fst];
            }
        }
    }
    cout << "! ";
    for (int i = 1; i <= 2 * n; ++i)
        cout << ans[i][0];
    cout << endl;
}


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

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(4*i + 7*j == N){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    ls = [[int(x) for x in input().split()] for _ in range(N)]
    ans = 0
    for i in range(N):
        ls[i].append(ls[i][0]+ls[i][1])
    ls = sorted(ls,key=lambda x:-x[2])
    if N==1:
        print(ls[0][1])
        exit()
    for i in range(N):
        ans -= ls[i][1]

    for i in range(N//2):
        ans += ls[2*i][2]

    if N%2==1:
        ans += ls[2*i+2][2]
    
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 65624
N = int(input())
S = input()
R = S.count('R')
G = S.count('G')
B = S.count('B')
ans = R*G*B
for i in range(N):
    for d in range(N):
        j = i + d
        k = i + 2*d
        if k >= N:
            break
        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            ans -= 1
print(ans)

Measured memory_bytes: 67956
#include<stdio.h>
int main(){
  int i,j,k,n,flag=1,temp,c=0;
  int a[100];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  while(flag){
    flag=0;
    for(j=n-1;j>=1;j--){
      if(a[j]<a[j-1]){
	temp=a[j];
	a[j]=a[j-1];
	a[j-1]=temp;
	flag=1;
	c++;
      }
    }
  }
  for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[n-1]);
  printf("%d\n",c);
  return 0;
}
      
  



Measured memory_bytes: 2140
//2018.9.3 ABC108 A
//Accepted
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cstdlib> //abs() これは整数のみ

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)

const int max_v = 300;
const int INF = 1000000;



int main() {
	int n, ans=0;
	cin >> n;
	//vector <int> A(n);
	//string str;

	if(n % 2 == 0){ n /= 2; ans = n*n; }
	else {n /= 2; ans = n*(n+1);}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

// 問題
// https://atcoder.jp/contests/abc143/tasks/abc143_b

class Animals {

    // 個体数
    public static int num;
    // 足の数
    public static int leg_num;

    static String isOK(){
        if ( leg_num >= 2 * num & leg_num <= 4 * num &
                leg_num % 2 == 0){ return "Yes";}
        return "No";
    }

}

public class Main {
    public static void main(String... args){

        // 入力の受け取り
        Scanner scanner = new Scanner(System.in);

        Animals.num = scanner.nextInt();
        Animals.leg_num = scanner.nextInt();


        System.out.println(Animals.isOK());

    }
}


Measured memory_bytes: 35572
// -*- coding:utf-8-unix -*-

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i32,
        b: i32,
    }

    if (a * b) % 2 == 0 {
        println!("Even");
    } else {
        println!("Odd");
    }
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    if(n>=30)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3632
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	vector<int> v(3);
	cin >> v[0] >> v[1] >> v[2];
	sort(v.begin(), v.end());
	cout << v[0] << " " << v[1] << " " << v[2] << endl;

	return 0;
}


Measured memory_bytes: 3160
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a == 1) a = 14;
        if (b == 1) b = 14;

        if (a < b) {
            System.out.println("Bob");
        } else if (a == b) {
            System.out.println("Draw");
        } else {
            System.out.println("Alice");
        }
    }
}


Measured memory_bytes: 21972
n, k = map(int, input().split())
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, 3000):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

for i in range(1,k+1):
    print((cmb(n-k+1,i,p)%p * cmb(k-1,i-1,p)%p))


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

using namespace std;
char s1[400][400],s2[400][400];
int n;
void changes2(int a){
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            s2[i][j] = s1[(i+a)%n][j];
        }
    }
}

bool isD(){
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(s2[i][j]!=s2[j][i])
                return false;
        }
    }
    return true;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    int ans = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>s1[i][j];
        }
    }
    for(int i=0;i<n;i++){
        changes2(i);
        if(isD()){
            ans += n;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long

int main() {
  string s,t;cin>>s>>t;
  int ans=0;
  for(int i=0;i<3;i++)
  {
    if(s.at(i)==t.at(i))
    {
      ans++;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
S = input()
T = input()
ans = len(T)
for i in range(len(S)):
    tmp = len(T)
    if len(S)-i >= len(T):
        for s,t in zip(S[i:i+len(T)],T):
            if t == s:
                tmp -= 1
        ans = min(ans,tmp)
else:
    print(ans)

Measured memory_bytes: 9060
#include <stdio.h>
#include <stdlib.h>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)

#define MMM -2000000000

int main(int argc, char *argv[]){
        int L;
        int n;
        int i;
        unsigned long *r;
        int MAX_r = MMM;
        int MIN_r;
        scanf("%d", &n);
        r = malloc(sizeof(unsigned long)*n);
        
        scanf("%d", &r[0]);
        MIN_r = r[0];
        for(i=1;i<n;i++){
                scanf("%d", &r[i]);
                //printf("max:%d min:%d\n", MAX_r, MIN_r);
                //printf("r[i]-MIN_r=%d-%d=%d\n", r[i], MIN_r, r[i]-MIN_r);
                L = r[i]-MIN_r;
                MAX_r = max(MAX_r,L);
                MIN_r = min(MIN_r, r[i]);
                //printf("max:%d min:%d\n", MAX_r, MIN_r);
                //printf("r[i]-MIN_r=%d-%d=%d\n", r[i], MIN_r, r[i]-MIN_r);
        }

        printf("%d\n", MAX_r);
        return 0;
}


Measured memory_bytes: 3356
#include<bits/stdc++.h>
#define LL long long
#define db double
#define il inline
#define re register
#define mkpr make_pair

using namespace std;
const int N=3000+10,mod=1e9+7;
il LL rd()
{
    LL x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*w;
}
int n,m,f[2][N][2];

int main()
{
	n=rd(),m=rd();
	int nw=1,la=0;
	for(int i=1;i<=n;++i) f[0][i][0]=1;
	f[0][0][1]=1;
	for(int i=1;i<=m;++i)
	{
		for(int j=0;j<=n;++j)
			for(int k=0;k<=1;++k)
			{
				if(!f[la][j][k]) continue;
				if(j>=1)
				{
					f[nw][j-1][k|(j==1)]=(f[nw][j-1][k|(j==1)]+f[la][j][k])%mod;
					f[nw][j][k|(j==1)]=(f[nw][j][k|(j==1)]+f[la][j][k])%mod;
				}
				if(j<n)
				{
					f[nw][j+1][k]=(f[nw][j+1][k]+f[la][j][k])%mod;
					f[nw][j][k]=(f[nw][j][k]+f[la][j][k])%mod;
				}
				f[la][j][k]=0;
			}
		nw^=1,la^=1;
	}
	int ans=0;
	for(int j=0;j<=n;++j) ans=(ans+f[la][j][1])%mod;
	printf("%d\n",ans);
    return 0;
}


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

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

#define fill(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define sz(x) (int)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const int N = 3e3+10;

string s,t;
int dp[N][N];
ii lastAdd[N][N];

int main(){
fast;
cin>>s>>t;
int n=s.size();
int m=t.size();

lastAdd[0][0]=make_pair(-1,-1);
dp[0][0]=(s[0]==t[0]);
if(dp[0][0]==1) {
    lastAdd[0][0]=make_pair(0,0);
}

for(int j=1;j<m;j++) {
    if(s[0]==t[j]) {
        dp[0][j]=1;
        lastAdd[0][j]=make_pair(0,j);
    } else {
        dp[0][j]=dp[0][j-1];
        lastAdd[0][j]=lastAdd[0][j-1];
    }
}

for(int j=1;j<n;j++) {
    if(t[0]==s[j]) {
        dp[j][0]=1;
        lastAdd[j][0]=make_pair(j,0);
    } else {
        dp[j][0]=dp[j-1][0];
        lastAdd[j][0]=lastAdd[j-1][0];
    }
}

for(int i=1;i<n;i++) {
    for(int j=1;j<m;j++) {
        dp[i][j]=0;
        if(s[i]==t[j]) {
            dp[i][j]=1+dp[i-1][j-1];
            lastAdd[i][j]=make_pair(i,j);
        } else {
            if(dp[i-1][j] > dp[i][j-1]) {
                dp[i][j]=dp[i-1][j];
                lastAdd[i][j]=lastAdd[i-1][j];
            } else {
                dp[i][j]=dp[i][j-1];
                lastAdd[i][j]=lastAdd[i][j-1];
            }
        }

        //cout<<"for "<<i<<" "<<j<<" : "<<lastAdd[i][j].first<<" "<<lastAdd[i][j].second<<endl;
    }
}

int idx = 0;
string ans = "";
int curX=n-1;
int curY=m-1;
while(idx < dp[n-1][m-1]) {
    //cout<<curX<<" "<<curY<<endl;
    //cout<<"val: "<<lastAdd[curX][curY].first<<" "<<lastAdd[curX][curY].second<<endl;
    int ff = lastAdd[curX][curY].first;
    int ss = lastAdd[curX][curY].second;
    ans+=s[ff];
    curX=ff-1;
    curY=ss-1;
    idx++;
}
reverse(ans.begin(),ans.end());
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 109436
#include <stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
	char suit;
	int value;
};

struct Card L[MAX/2+2], R[MAX/2+2];

void merge(struct Card A[], int n, int left, int mid, int right){
	int i, j, k;
	int n1 = mid - left;
	int n2 = right - mid;
	for(i = 0; i < n1; i++) L[i] = A[left+i];
	for(i = 0; i < n2; i++) R[i] = A[mid+i];
	L[n1].value = R[n2].value = SENTINEL;
	i = j = 0;
	for(k = left; k < right; k++){
		if(L[i].value <= R[j].value) A[k] = L[i++];
		else A[k] = R[j++];
	}
}

void mergesort(struct Card A[], int n, int left, int right){
	int mid;
	
	if(left+1 < right){
		mid = (left+right)/2;
		mergesort(A, n, left, mid);
		mergesort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}

int partition(struct Card A[], int n, int p, int r){
	int i, j;
	struct Card t, x;
	x = A[r];
	i = p-1;
	for(j = p; j < r; j++){
		if(A[j].value <= x.value){
			i++;
			t = A[i];
			A[i] = A[j];
			A[j] = t;
		}
	}
	t = A[i+1];
	A[i+1] = A[r];
	A[r] = t;
	
	return i+1;
}

void quicksort(struct Card A[], int n, int p, int r){
	int q;
	if(p < r){
		q = partition(A, n, p, r);
		quicksort(A, n, p, q-1);
		quicksort(A, n, q+1, r);
	}
}

int main(void)
{
	int n, i, v;
	struct Card A[MAX], B[MAX];
	char S[10];
	int stable = 1;
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++){
		scanf("%s %d", S, &v);
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}
	
	mergesort(A, n, 0, n);
	quicksort(B, n, 0, n-1);
	
	for(i = 0; i < n; i++){
		if(A[i].suit != B[i].suit)stable = 0;
	}
	
	if(stable==1) printf("Stable\n");
	else printf("Not stable\n");
	for(i = 0; i < n; i++){
		printf("%c %d\n", B[i].suit, B[i].value);
	}
	
	return 0;
}



Measured memory_bytes: 4072
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<string>

using namespace std;

#define ll long long

int main(){
    int N,tmp,a;
    int s,g;
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    s = max(A,C);
    g = min(B,D);
    if(s < g){
        cout << g - s << endl;
    }else{
        cout<< 0 << endl;
    }
    
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int N, K;
int dots[2010][2010];
int sum[2010][2010];

void prepare() {
    rep(i, K * 2 + 3) {
        rep(j, K * 2 + 3) {
            sum[i+1][j+1] = dots[i+1][j+1] + sum[i][j+1] + sum[i+1][j] - sum[i][j];
        }
    }
}

int query(int x1, int y1, int x2, int y2) {
    if (x1 > x2 || y1 > y2) return 0;
    else return sum[x2][y2] - sum[x1-1][y2] - sum[x2][y1-1] + sum[x1-1][y1-1];
}

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

    cin >> N >> K;
    int x, y;
    char c;
    rep(i, N) {
        cin >> x >> y >> c;
        if (c == 'W') x += K;
        x %= K * 2;
        y %= K * 2;

        dots[x+1][y+1]++;
    }
    prepare();
    /*
    for( int i = 6; i >= 1; i--) {
        for(int j = 1; j <= 6; j++) {
            cout << dots[j][i];
        }
        cout << endl;
    }
    cout << endl;
    for( int i = 6; i >= 1; i--) {
        for(int j = 1; j <= 6; j++) {
            cout << sum[j][i];
        }
        cout << endl;
    }
    */

    int ans = 0;
    int tmp;
    REP(x, 1, K) {
        REP(y, 1, K) {
            tmp =   query(x    , y    , x+K-1, y+K-1)
                  + query(x + K, y + K, K * 2, K * 2)
                  + query(1    , 1    , x - 1, y - 1)
                  + query(x + K, 1    , K * 2, y - 1)
                  + query(1    , y + K, x - 1, K * 2);
            //dump(tmp);
            ans = max(ans, max(tmp, N-tmp));
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 31744
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>

using namespace std;
 
vector<int> dijkstra(int s, vector<vector<pair<int, int> > >& G) {
	const int INF = 1e9;
	const int N = G.size();
	vector<int> cost(N, INF);
	priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > pq;
	cost[s] = 0;
	pq.push(make_pair(0, s));
	while (!pq.empty()) {
		pair<int, int> p = pq.top(); pq.pop();
		int now = p.second;
		if (cost[now] < p.first) continue;
		for (auto next : G[now]) {
			int nv = next.first, nw = next.second;
			if (cost[nv] > cost[now] + nw) {
				cost[nv] = cost[now] + nw;
				pq.push(make_pair(cost[nv], nv));
			}
		}
	}
	return cost;
}

int main() {
	int n; cin >> n;
	vector<vector<pair<int, int> > > G(n);
	for (int i = 0; i < n; ++i) {
		int u, k; cin >> u >> k;
		while (k--) {
			int v, c; cin >> v >> c;
			G[u].push_back(make_pair(v, c));
		}
	}
	vector<int> ans(dijkstra(0, G));
	for (int i = 0; i < n; ++i)
		cout << i << " " << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main(){
    ll n; cin >> n;
    int ans = 100;
    for(int i = 1; i <= sqrt(n); i++){
        if(n % i == 0){
            int f = max(GetDigit(i), GetDigit(n/i));
            // int f = max(log10(i)+1, log10(n/i)+1);
            ans = min(f, ans);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll  = long long;
template <typename T> T In() {
    T t;
    cin >> t;
    return t;
}
template <typename T> vector<T> ReadVec1(int N) {
    vector<T> vec(N);
    for(int i = 0; i < N; i++)
        vec[i] = In<T>();
    return move(vec);
}
template <typename T> vector<vector<T>> Vec2(int i, int j, T ini = 0) {
    vector<vector<T>> vec(i, vector<T>(j, ini));
    return move(vec);
}
template <typename T> vector<vector<vector<T>>> Vec3(int i, int j, int k, T ini = 0) {
    vector<vector<vector<T>>> vec(i, vector<vector<T>>(j, vector<T>(k, ini)));
    return move(vec);
}


int main() {
    string S = In<string>();
    sort(S.begin(), S.end());
    if(S[0]==S[1] && S[2]==S[3] && S[1]!=S[2]){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

int main(){
        int n,ans=0;
        string st[3];
        cin >> n;
        cin >> st[0];
        cin >> st[1];
        cin >> st[2];
        for(int i=0;i<n;i++){
                int flag=0;
                if(st[0][i]!=st[1][i]) flag++;
                if(st[1][i]!=st[2][i]) flag++;
                if(st[2][i]!=st[0][i]) flag++;
                if(flag==2) ans++;
                if(flag==3) ans+=2;
        }
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 256
abc = list(map(int, input().split()))

abc = sorted(abc)
ans = 0
while abc[0] != abc[2]:
    if abc[2] - abc[0] >= 2:
        abc[0] += 2
    else:
        abc[0] += 1
        abc[1] += 1
    abc = sorted(abc)
    ans += 1
print(ans)

Measured memory_bytes: 3060
/*input

*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main()
{
	IOS;
	string s;
	cin>>s;
	int ans=0;
	REP(i,SZ(s)) if(s[i]=='2') ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
t2s h m s = ( ( h * 60 ) + m ) * 60 + s
s2t t =
  let s = t `mod` 60
      m = (t `div` 60) `mod` 60
      h = (t `div` 60) `div` 60
  in
    [h,m,s]

ans (h0:m0:s0:h1:m1:s1:_) =
  let t0 = t2s h0 m0 s0
      t1 = t2s h1 m1 s1
  in
    s2t (t1-t0)

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = map ans i
  mapM_ putStrLn $ map unwords $ map (map show) o

Measured memory_bytes: 3696
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );



int main(void){

  int r;
  cin>>r;
  
  cout << 3*r*r << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

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

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

Measured memory_bytes: 764
import heapq as hq
N,M=list(map(int, input().split()))
A=list(map(int, input().split()))
B=[(-1)*A[i] for i in range(N)]
B.sort()
for _ in range(M):
  a=hq.heappop(B)
  a=((a*(-1))//2)*(-1)
  hq.heappush(B,a)
C=[-B[i] for i in range(N)]
print(sum(C))

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

using namespace std;

typedef long long ll;
typedef long double ld;
#define gap ''
#define L(i) ((i) - (&i))

const int MAXN = 2 * 1e5 + 10;
	
int main(){	
	string s,t; cin >> s >> t;
	if(s == t){
		cout << 0 << endl; return 0;
	}
	ll ans = 0;
	for(int i = 0; i < s.length(); ++i){
		if(s[i] != t[i]){
			++ans;
		}
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 3884
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); i++)
#define RFOR(i, a, b)  for(int i = (a); i > (b); i--)
#define rep(i, n)	   for(int i = 0; i < (n); i++)
#define all(c)		   begin(c), end(c)
#define rall(c)		   rbegin(c), rend(c)
#define foritr(itr, c) for(auto itr = begin(c); itr != end(c); itr++)
#define SZ(a)		   ((ll) a.size())

typedef long long int		   ll;
typedef long long unsigned int llu;

void solve(string A, string B) {
	int ans = 0;
	if(SZ(A) > SZ(B)) ans = 1;
	else if(SZ(A) < SZ(B)) ans = 2;
	else {
		rep(i, SZ(A)) {
			if(A[i] > B[i]) {
				ans = 1;
				break;
			}
			else if(A[i] < B[i]) {
				ans = 2;
				break;
			}
		}
	}
	if(ans == 0) printf("EQUAL");
	if(ans == 1) printf("GREATER");
	if(ans == 2) printf("LESS");
}

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


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

const int MAXN = 100005;

int n, L, flag = 0;
int a[MAXN];

int main()
{
	scanf("%d%d", &n, &L);
	for (int i = 1; i <= n; i++) 
		scanf("%d", &a[i]);
	for (int i = 1; i < n; i++)
		if (a[i]+a[i+1] >= L) {
			flag = i;
			break;
		}
	if (flag) {
		puts("Possible");
		for (int i = 1; i < flag; i++) printf("%d\n", i);
		for (int i = n-1; i >= flag; i--) printf("%d\n", i);
	} else puts("Impossible");
	return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.12f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// mod.m での a の逆元 a^ { -1 } を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x /gcd(x, y) * y );
}

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}


ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
char c[2010][2010];
ll a[20][20];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	ll ans = 0;
	rep(l, k+1) {
		rep(r, k - l+1) {
			if (l + r > n)continue;
			ll d = k - l - r;
			ll now = 0;
			vector<ll>s;
			rep(i, l) {
				now += a[i];
				s.push_back(a[i]);
			}
			for (ll i = n - r;i < n;++i) {
				now += a[i];
				s.push_back(a[i]);
			}
			sort(s.begin(), s.end());
			rep(i, d) {
				if (i >= s.size())break;
				if (s[i] > 0)break;
				now -= s[i];
			}
			ans = max(ans, now);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			int lim = Integer.parseInt(in.readLine());

			String[] nums = in.readLine().split(" ");
			int[] a = new int[lim];
			
			for (int i = 0; i < a.length; i++) {
				a[i] = Integer.parseInt(nums[i]);
			}
			
			int cnt = 0;
			for (int i = 0; i < a.length; i++) {
				int mini = i;
				for (int j = i; j < a.length; j++) {
					if (a[j] < a[mini]) {
						mini = j;
					}
				}

				if (i != mini) {
					int tmp = a[i];
					a[i] = a[mini];
					a[mini] = tmp;
					cnt++;
				}
			}
			
			System.out.print(a[0]);
			for (int i = 1; i < a.length; i++) {
				System.out.print(" " + a[i]);
			}
			System.out.println();
			
			System.out.println(cnt);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24220
N = int(input())
A = list(map(int,input().split()))

ans = 0
flag = True

while flag == True:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i]//2
        else:
            flag = False
            break
    if flag == True:
        ans += 1
        
print(ans)

Measured memory_bytes: 3060