akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACalc solver = new ACalc();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACalc {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            long a = s.nextLong();
            out.println((int) (Math.pow(a, 2) + Math.pow(a, 3) + a));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 25556
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, const char *argv[]) {
  int A, B, C;
  cin >> A >> B >> C;

  if(A == B){
    if (A != C) {
      cout << "Yes" << endl;
      return 0;
    }
  }else if(A == C){
    if (A != B) {
    cout << "Yes" << endl;
    return 0;
    }
  }else if(B == C){
    if (B != A) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
m = n//15
l = n%15
x = 60*(m**2)
y = [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
for i in range(1,l+1):
    if(y[i] != 0):
        x += y[i]+m*15
print(x)

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

#define all(a) a.begin(), a.end()
#define ff first
#define ss second
#define pb push_back

using ll = long long;
using pii = pair<int, int>;

template<typename T> using V = vector<T>;

int main() {
	ios::sync_with_stdio(false);cin.tie(nullptr);
	int n; cin >> n;
	vector<ll> a(n);
	long double ans = 0, val = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		val += (1.0 / a[i]);
	}
	ans = (1.0 / val);
	cout << fixed << setprecision(10) << ans << '\n';
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,r;
	cin>>n>>r;
	if(n>=10){
		cout<<r<<endl;
	}else{
		cout<<r+100*(10-n)<<endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <deque>
#include <functional>
#include <initializer_list>
#include <math.h>
#include <map>
#include <random>
#include <set>
#include <stack>
#include <tuple>
#include <type_traits>
#include <queue>
#include <vector>


#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

// グリッド上の縦横移動
constexpr std::array<std::pair<int, int>, 4> dxdy = {
    std::pair<int, int>( 1,  0),
    std::pair<int, int>(-1,  0),
    std::pair<int, int>( 0,  1),
    std::pair<int, int>( 0, -1)
};

void VintOut(std::vector<int>& A){
    const int n = A.size();
    if(n == 0){putchar('\n'); return;}
    printf("%d", A[0]);
    for(int i = 1; i < n; ++i) printf(" %d", A[i]);
    putchar('\n');
}
void VintOut(std::vector<long long int>& A){
    const int n = A.size();
    if(n == 0){ putchar('\n'); return;}
    printf("%lld", A[0]);
    for(int i = 1; i < n; ++i) printf(" %lld", A[i]);
    putchar('\n');
}

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

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

inline bool isIn(int x, int y, int H, int W){
    return 0 <= x and x < H and 0 <= y and y < W;
}
inline bool bitUP(int state, int k){ return (state >> k) & 1; }
inline bool bitUP(long long int state, int k){ return (state >> k) & 1;}

// z-algorithm
template <class T> std::vector<int> z_algorithm(const T &str) {
    const int n = str.size();
    std::vector<int> resOfCP(n); resOfCP[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i + j < n and str[j] == str[i + j]) ++j;
        resOfCP[i] = j;
        if (j == 0) { ++i; continue;}
        int k = 1;
        while (i + k < n and k + resOfCP[k] < j) resOfCP[i + k] = resOfCP[k], ++k;
        i += k; j -= k;
    }
    return resOfCP;
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



int main(void){
    lli a; scanf("%lld", &a);
    lli res = 0; lli n = 1;
    while(a){
        a /= 2;
        res += n;
        n *= 2;
    }
    printf("%lld\n", res);
    
    
    return 0;
}

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

#define range 100005
#define mod 1000000007
#define eps 1e18
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<
#define int long long
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

int dp[200000];

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		dp[i]=eps;
	}
	dp[0]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i-1;j>=max((int)0,(i-k));j--)
		   dp[i] = min(dp[i],(int)(dp[j] + fabs(a[i] - a[j])));
	}
	cout<<dp[n-1];
	return 0;
}

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

public class Main
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in));
		long X = Long.parseLong(BR.readLine()); long Start = 100l;
		int Years = 0;
		while (Start < X)
		{
			Start *= 1.01;
			Years++;
		}
		System.out.println(Years);
	}
}


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

using namespace std;

int main() {
    int n, m, x;
    cin >> n >> m >> x;

    vector<int> vt(m);
    for (int i = 0; i < m; ++i) {
        cin >> vt[i];
    }

    int tmp = lower_bound(vt.begin(), vt.end(), x) - vt.begin();
    cout << min(tmp, m - tmp) << endl;
    return 0;
}


Measured memory_bytes: 256
from functools import reduce
import math

MIN = -10 ** 9
MAX = 10 ** 9


def main():
    N, D = [int(a) for a in input().split()]
    X = [
        [int(a) for a in input().split()]
        for _ in range(N)
    ]

    c = 0

    for i in range(N):
        for j in range(i+1,N):
            t = 0
            for k in range(D):
                aaa = X[i][k] - X[j][k]
                t += aaa * aaa
            t = math.sqrt(t)
            if t - int(t) == 0:
                c += 1
    print(c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[300000],s[300000];
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],s[i]=s[i-1]+a[i];
	map<int,int> m;
	m[0]++;
	for(int i=1;i<=n;i++)m[s[i]]++;
	int ans=0;
	for(auto i:m)ans+=i.second*(i.second-1)/2;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 16384
n, m = (int(x) for x in input().split())

# 0 = まだACなし, 1 = AC済み
ans_list = [0] * (n + 1)
# 誤った回数が記録され、ACのタイミングで加算
WA_list = [0] * (n + 1)

ans = 0
penalty = 0

for id in range(m):
    # listを紐付けて要素を抜き出すことができる
    query = list(map(str, input().split()))
    # ACだった場合
    if query[1] == 'AC':
        if ans_list[int(query[0])] == 0 :
            ans_list[int(query[0])] = 1
            ans += 1
            penalty = penalty + WA_list[int(query[0])]
    # WAだった場合 
    else:
        if ans_list[int(query[0])] == 0 :
            WA_list[int(query[0])] += 1

print("{0} {1}".format(ans, penalty))

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

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var xy = Range(0, N).Select(i => ReadLine().Split(' ').Select(int.Parse).ToArray()).ToArray();

        var ab = xy.Select(xy => (a: xy[0] - xy[1], b: xy[0] + xy[1])).ToArray();
        
        var ans = Max(ab.Max(ab => ab.a) - ab.Min(ab => ab.a), ab.Max(ab => ab.b) - ab.Min(ab => ab.b));

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 55064
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#define M 13

void check(bool list[], char c) {
    for (int i = 0; i < M; i++)
    {
        if (!list[i])
        {
            printf("%c %d\n", c, i + 1);
        }
    }
}

int main(void)
{
    int n, j, k;
    char c;

    bool slist[M] = {false};
    bool hlist[M] = {false};
    bool clist[M] = {false};
    bool dlist[M] = {false};

    scanf("%d", &n);
    for (k = 0; k < n; k++)
    {
        getchar();
        scanf("%c %d", &c, &j);
        switch (c) {
            case 'S':
                slist[j - 1] = true;
                break;
            case 'H':
                hlist[j - 1] = true;
                break;
            case 'C':
                clist[j - 1] = true;
                break;
            case 'D':
                dlist[j - 1] = true;
                break;
        }
    }

    check(slist, 'S');
    check(hlist, 'H');
    check(clist, 'C');
    check(dlist, 'D');

    return 0;
}

Measured memory_bytes: 2672
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  string t="";
  vector<int> v;
  rep(i,s.size()) {
    if(s[i]!='x') {
      t+=s[i];
      v.pb(i);
    }
  }
  rep(i,t.size()/2) {
    if(t[i]!=t[t.size()-i-1]) {
      pr(-1);
      return;
    }
  }
  ll d[v.size()+1],k=0;
  mem(d);
  rep(i,s.size()) {
    if(s[i]!='x') k++;
    else d[k]++;
  }
  ll ans=0;
  rep(i,v.size()/2+1) ans+=abs(d[i]-d[v.size()-i]);
  pr(ans);
}

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


Measured memory_bytes: 1740
from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
from scipy.sparse import csr_matrix

N, M = map(int, input().split())  # 頂点数、辺数
A, B, C = [0] *  M, [0] * M, [1] * (M-1)
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i]-=1
    B[i]-=1

cnt = 0
for i in range(M):
    csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
    n, labels = connected_components(csr)
    if n == 2:
       cnt += 1
print(cnt)


Measured memory_bytes: 27888
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef priority_queue<ll, vl> decendingQueue;              //降順
typedef priority_queue<ll, vl, greater<ll>> ascendingQueue; //昇順
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 9 * 1e18;
const ll MOD = 1e9 + 7;

void solve(long long P, long long Q, long long R) {
  print(min(P + Q, min(Q + R, R + P)));
}

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


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()

def f(b,n):
    if(n<b): return n
    return f(b,n//b)+n%b

def resolve():
    n=int(input())
    s=int(input())

    if(s>n):
        print(-1)
        return
    if(s==n):
        print(n+1)
        return

    # 2 <= b <= sqrt(n) を全探索
    k=0
    while((k+1)**2<=n): k+=1
    for b in range(2,k+1):
        if(f(b,n)==s):
            print(b)
            return

    # sqrt(n) < b <= n を考える
    B=[]
    for p in range(1,k+1):
        if((n-s)%p): continue
        b=(n-s)//p+1
        if(b<2): continue
        if(f(b,n)==s):
            B.append(b)

    print(min(B) if(B) else -1)
resolve()

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

using namespace std;

int main() 
{
  int  a , b , c;
  cin >> a >> b >> c;
  if (a==b&&b==c)
  {
    cout<<"No"; 
  }
  else if (a!= b && b!=c&&a!=c)
  {
    cout << "No"; 
  } 
  else 
  {
    cout << "Yes";
  }
     
  
   
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();
    int code= 0,  n, m, c;

    cin>> n>> m>> c;

    int b[m], t, sum= 0;
    for(int i=0; i<m; i++)
        cin>> b[i];

    for(int i=0; i<n; i++)
    {
        sum =0;
        for(int i=0; i<m; i++)
        {
            cin>> t;
            sum+= (b[i]*t);
        }

        if( sum +c >0)
            code++;
    }

    cout << code ;
    nl;

    return 0;
}




Measured memory_bytes: 3584
#トランプカード出力テスト
n = int(input())
my_card = [input() for i in range(n)]
card_list = ['S','H', 'C', 'D']
for suit in card_list:
    for num in range(1,14):
        card_check = suit+" "+str(num)
        if not(card_check in my_card):
            print(card_check)


Measured memory_bytes: 5600
#include "stdio.h"

bool isSolve(int matrix[], int N, int i, int target){
  if(target == 0){
    return true;
  }else if(i >= N){
    return false;
  }
  
  bool res = (isSolve(matrix, N, i+1, target) || \
      isSolve(matrix, N, i+1, target-matrix[i]));
 
  return res; 

}


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

  int* sample = new int [N_sample];
  for(int i=0;i<N_sample;i++){
    scanf("%d", &sample[i]);
  }

  int N_target;
  scanf("%d", &N_target);

  int target;
  for(int a=0;a<N_target;a++){
    scanf("%d", &target);
    if(isSolve(sample, N_sample, 0, target)){
      printf("yes\n");
    }else{
      printf("no\n");
    }
  }

  return 0;

}


Measured memory_bytes: 2700
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  cin >> s;
  set<char> se;
  rep(i,s.size()) {
    if(se.count(s[i])) {
      pr("no");
      return;
    }
    se.in(s[i]);
  }
  pr("yes");
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    vector<long long>H(100000);
    cin >>N;
    for(int i=0;i<N;i++){
        cin >>H.at(i);
    }
    int ans[100000]={0};
    int j=0;
    for(int i=0;i<N-1;i++){
        if(H.at(i)>=H.at(i+1)){
            ans[j]++;
        }
        else{
            j++;
        }
    }
    sort(ans,ans+j+1);
    cout << ans[j]<<endl;

}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int INF = 100000000;
int i,j,k;
int main(){
    int n;cin>>n;
    vector<int> v(n);for(i=0;i<n;i++){cin>>v[i];}
    vector<int> v1,v2;
 
    for(i=0;i<n;i++){
        if(i%2==0){v1.push_back(v[i]);}
        else{v2.push_back(v[i]);}
    }
 
    vector<int> v1num(1000000,0),v2num(1000000,0);//v1[i]は奇数番に含まれるiの個数
    for(i=0;i<n/2;i++){
        v1num[v1[i]]++;
        v2num[v2[i]]++;
    }
 
    int v1max=0,v2max=0,maxnumber1,maxnumber2;//一番数が多いものについて調べる(個数とその数)
    for(i=0;i<n/2;i++){
        if(v1max<v1num[v1[i]]){v1max=v1num[v1[i]];maxnumber1=v1[i];}
        if(v2max<v2num[v2[i]]){v2max=v2num[v2[i]];maxnumber2=v2[i];}
    }
 
    int v1max_second=0,v2max_second=0;
    for(i=0;i<n/2;i++){
        if(v1max_second<v1num[v1[i]] && !(v1[i]==maxnumber1 && v1num[v1[i]]==v1max)){//maxが同数になる場合も考慮してmax_secandを定める
            v1max_second=v1num[v1[i]];
        }
        if(v2max_second<v2num[v2[i]] && !(v2[i]==maxnumber2 && v2num[v2[i]]==v2max)){
            v2max_second=v2num[v2[i]];
        }
    }
 
    if(maxnumber1!=maxnumber2){cout<<(n-v1max-v2max)<<endl;}//個数maxのものが互いに相異なる場合
    else{//個数maxのものの数が一致してしまった場合
        if(v1max>v2max){cout<<min(n-v1max-v1max_second,n-v1max-v2max_second)<<endl;}
        else{cout<<min(n-v2max-v1max_second,n-v2max-v2max_second)<<endl;}
    }
 
    return 0;
}

Measured memory_bytes: 9084
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

a = na()

cnt = 0
if a[0] == a[1]:
    cnt += 1
if a[1] == a[2]:
    cnt += 1
if a[2] == a[0]:
    cnt += 1

if cnt == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
# coding: utf-8
# Your code here!
while True:
    x=str(input())
    if x=="0":
        break
    xx=len(x)
    a=0
    b=0
    for i in range(1,xx):
        if x[i]=='A':
            a+=1
        else:
            b+=1
    if a>b:
        a+= 1
    else:
        b+= 1    
    print(a,b)
        
        



Measured memory_bytes: 5560
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

#include<unistd.h>
struct Buffer{
    int idx;
    char buf[1025];
    Buffer(){ init(); }
    void init(){ idx = 0; read(0, buf, 1024); }
    void check(){ if(idx == 1024){ init(); } }
    int next(){
        static char notDigits[256] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1, 0,0,0,0,0,0,0,0,0,0,};
        int ret = 0, sign = 1;
        while(check(), notDigits[(int)buf[idx]]){ idx++; }
        if(check(), buf[idx] == '-'){ sign = -1; idx++; }
        while(check(), !notDigits[(int)buf[idx]]){ ret = ret * 10 + buf[idx++] - '0'; }
        return sign * ret;
    }
};

int main(){
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    Buffer buf;
    int lim = 1e5;
    vector<char> prime(lim + 1, true);
    prime[0] = prime[1] = false;
    for(int i = 2; i <= lim; i++){
        if(prime[i]){
            for(int j = i + i; j <= lim; j += i){
                prime[j] = false;
            }
        }
    }
    vector<int> accs(lim + 1);
    for(int i = 1; i <= lim; i++){
        accs[i] = accs[i - 1] + (i & 1 && prime[i] && prime[(i + 1) / 2]);
    }
    // int q; cin >> q;
    int q = buf.next();
    for(int i = 0; i < q; i++){
        // int l, r;
        // cin >> l >> r;
        int l = buf.next(), r = buf.next();
        cout << accs[r] - accs[l - 1] << '\n';
    }
}


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


int main(){
    int n;
    cin >> n;
    vector<int>d(n);
    //cout << d.size();
    //rep(i,n) cin >>d.at(i);
    for(int i=0 ;i < n;i++){
        cin >> d.at(i);
    }
    sort(d.begin(),d.end());
    int pt=n/2;
    int pt1 = pt -1;
    int pt2 = pt;
    if(d.at(pt1) == d.at(pt2)){
        cout << 0 << endl;
        return 0;
    }else{
        cout << d.at(pt2) - d.at(pt1) << endl;
        return 0;
    }
    return 0;

}

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

void solve(){
    ll n, k;
    cin >> n >> k;
    double ans = 0;
    Rep(i, 1, n){
        double t = 1.0/n;
        int now = i;
        while(now < k){
            now *= 2;
            t /= 2;
        }
        ans += t;
    }
    cout << fixed << setprecision(11) << ans << "\n";
}

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

Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int L = sc.nextInt();
        int total = 0;
        int min = Integer.MAX_VALUE;

        for(int i = 1; i<=n; i++) {
//            System.out.println(L+i-1);
            total += L+i-1;
            //System.out.println(Math.abs(L+i-1));
            if(Math.abs(L+i-1) < Math.abs(min)) {
                min = L + i - 1;
            }
        }
//        System.out.println(total + " "+ min);
        System.out.println(total-min);

    }
}

Measured memory_bytes: 22228
n,a,b,c,d=map(int,input().split())
s=input()
a-=1
b-=1
c-=1
d-=1
x=[]
for i in range(a,max(c,d)):
    if s[i]==s[i+1]=="#":
        print("No")
        exit()
if a<b and c<d:
    print("Yes")
    exit()
ans=0
for i in range(b-1,d+2):
    if s[i]==".":
        ans+=1
    else:
        if ans>=3:
            print("Yes")
            exit()
        ans=0
if ans>=3:
    print("Yes")
    exit()
print("No")


Measured memory_bytes: 3572
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
 
using namespace std;
 
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ff first
#define ss second
 
using ll = long long;
using ld = long double;
#define int ll
 
constexpr ll INFL = 1'000'000'000'000'000'228;
constexpr int INFI = 1'000'000'228;
 
#ifdef LOCAL
#else
#endif
 
 
void run() {
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    vector<vector<int>> g(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        bool f = true;
        for (auto u : g[i]) {
            if (h[u] >= h[i]) {
                f = false;
                break;
            }
        }
        ans += f;
    }
    cout << ans << "\n";
}
 
signed main() {
#ifdef LOCAL
    std::freopen("input.txt", "r", stdin);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    int t = 1;
//    cin >> t;
    while (t--) {
        run();
    }
    return 0;
}

Measured memory_bytes: 9728
from collections import deque

s = deque(input().split())
n = int(input())
query_li = (input().split() for i in range(n))

flag = 1

for query in query_li:
    if int(query[0]) == 1:
        flag = flag * -1
    else:
        if int(query[1]) == 1:
            if flag == 1:
                s.appendleft(query[2])
            else:
                s.append(query[2])
        else:
            if flag == 1:
                s.append(query[2])
            else:
                s.appendleft(query[2])

s = ''.join(s)
if flag == -1:
    s = s[::-1]

print(s)

Measured memory_bytes: 6900
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define rep(i, n) for (i = 0; i < n; i++)
#define int long long
using namespace std;

int n, h;
int a[100000], b[100000];

signed main() {
	int i;
	
	cin >> n >> h;
	for (i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	sort(a, a + n, greater<int>());
	sort(b, b + n, greater<int>());
	
	int remH = h;
	int ans = 1145141919;
	for (i = 0; i <= n; i++) {
		ans = min(ans, (remH + a[0] - 1) / a[0] + i);
		if (i < n) remH -= b[i];
		if (remH < 0) remH = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <algorithm>

#define lli long long int

using namespace std;

int main() {
	lli n, l[2005], left, right, mid, ans, sum = 0;
	scanf("%lld", &n);
	for (lli i = 0; i < n; i++)
		scanf("%lld", &l[i]);
	sort(l, l + n);
	for (lli i = 0; i < n; i++)
		for (lli j = i + 1; j < n; j++) {
			left = 0;
			right = n - 1;
			while (left <= right) {
				mid = (left + right) / 2;
				if (l[mid] < (l[i] + l[j])) {
					ans = mid;
					left = mid + 1;
				}
				else
					right = mid - 1;
			}
			sum += (ans - j);
		}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;


int main(){
  int n;
  cin>>n;
  switch (n%10) {
    case 3:
    cout<<"bon";
    break;
    case 0:
    case 1:
    case 6:
    case 8:
    cout<<"pon";
    break;
    default:
    cout<<"hon";
  }
}








/* きょむ〜 */


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int n;
  if (m2 >= m1) {
    n = (h2 - h1) * 60 + m2 - m1 - k;
  } else {
    n = (h2 - h1 - 1) * 60 + m2 + 60 - m1 - k;
  }
  cout << n << endl;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String s = sc.next();
            int l = s.length();
            for (int i = 0;i < l;i++) {
                char c = s.charAt(i);
                if ('a' <= c && c <= 'z') {
                    c -= 32;
                } else if ('A' <= c && c <= 'Z') {
                    c += 32;
                }
                sb.append(c);
            }
            sb.append(' ');
        }
        System.out.println(sb.substring(0, sb.length()-1));
    }
}



Measured memory_bytes: 26112
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <ctime>

using namespace std;
#define RN cout << "\r\n";
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef long long int ll;
typedef pair<ll, ll> P;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans = max(max(a, b), c) - min(min(a, b), c);
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
const long double PI = 3.141592653589793238462643383279502884197;

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

	int tc; cin >> tc;

	map<string, int> mp;
	mp.insert({ "AC", 0 });
	mp.insert({ "WA", 0 });
	mp.insert({ "TLE", 0 });
	mp.insert({ "RE", 0 });

	while (tc--) {
		string s; cin >> s;
		mp[s]++;
	}

	cout << "AC x " << mp["AC"] << '\n';
	cout << "WA x " << mp["WA"] << '\n';
	cout << "TLE x " << mp["TLE"] << '\n';
	cout << "RE x " << mp["RE"] << '\n';

	return 0;
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,i,c,d;
    scanf("%d%d",&a,&b);
    for(i=0;i<=1000000000;i++)
    {
        c=abs(a-i);
        d=abs(b-i);
        if(c==d)
        {
            printf("%d\n",i);
            break;
        }

    }
    if(c!=d)
        {
            printf("IMPOSSIBLE\n");
        }
}


Measured memory_bytes: 128
X,K,D = map(int,input().split())

X = abs(X) 

if X >= K*D:
    ans = X-K*D
else:
    x = X//D 
    if (K - x)%2 == 0:
        ans = X - x*D
    else:
        ans = abs(X - x*D -D)

print(ans)

Measured memory_bytes: 8932
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  long long int A;
  long long int B;
  long long int sum = 0;
  cin>>A;
  cin>>B;
  for(int i = 1;i <= B;i++){
    if((A * i) % B == 0){
      sum = A * i;
      break;
    }
  }
  cout<<sum<<'\n';
}

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

S = 0
r = 0
ans = 0
for l, a in enumerate(A):
    while r < N and S + A[r] == S ^ A[r]:
        S += A[r]
        r += 1
    ans += r - l
    S -= a
print(ans)


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

int main(){
	int s;
	cin>>s;
	int b=s%100,a=(s-b)/100;
	if(a<=12&&a>0&&b<=12&&b>0) cout<<"AMBIGUOUS";
	if(a<=12&&a>0&&(b>12||b==0)) cout<<"MMYY";
	if((a>12||a==0)&&(b<=12&&b>0)) cout<<"YYMM";
	if((a>12||a==0)&&(b>12||b==0)) cout<<"NA"; 
	return 0;
}

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

#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};


typedef struct node * Node;


Node root = NIL;


Node treeSearch(Node, int);
void insert(int);
void inorder(Node);
void preorder(Node);


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}


Node treeSearch(Node x, int k){
  if(x == NIL || k == x->key) return x;
  if(k < x->key) return treeSearch(x->left, k);
  else return treeSearch(x->right, k);
}


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;


  while(x != NIL){
    y = x;

    if(z->key < x->key) x = x->left;
    else x = x->right;
  }

  z->parent = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}


void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
  }
}


void preorder(Node u){
  if(u != NIL){
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
  }
}



Measured memory_bytes: 25212
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Vec[] arr = new Vec[n];
		for (int i = 0; i < n; i++) {
			String[] sa = br.readLine().split(" ");
			Vec v = new Vec();
			v.x = Integer.parseInt(sa[0]);
			v.y = Integer.parseInt(sa[1]);
			v.i = i;
			if (v.x != 0 || v.y != 0) {
				v.atan = Math.atan2(v.y, v.x);
			}
			arr[i] = v;
		}
		br.close();

		Arrays.sort(arr, (a, b) -> a.atan < b.atan ? -1 : a.atan == b.atan ? 0 : 1);

		long max = 0;
		for (int i = 0; i < n; i++) {
			for (int j = i; j < i + n; j++) {
				long x = 0;
				long y = 0;
				for (int k = i; k <= j; k++) {
					x += arr[k % n].x;
					y += arr[k % n].y;
				}
				max = Math.max(max, x * x + y * y);
			}
		}
		System.out.println(Math.sqrt(max));
	}

	static class Vec {
		int i, x, y;
		double atan = 0;
	}
}


Measured memory_bytes: 28116
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int K;
inline void solve(){
  IN(K);
  OUT(((K+1)/2)*(K/2));
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
s = str(input())


if len(s) > 2:
    for i in range(len(s)-2):
        if s[i] == s[i+1] or s[i] == s[i+2]:
            res1 = str(i+1)
            res2 = str(i+3)
            print(res1 + " " + res2)
            quit()
        else:
            continue
else:
    if s[0] == s[1]:
        print("1 2")
        quit()

print("-1 -1")

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

int main() {
    string s;
    cin>>s;
    string ns;
    for(ll i=0;i<s.size();i++){
        if(s[i]=='B'){
            if(i+1<s.size()&&s[i+1]=='C'){
                ns.push_back('D');
                i++;
            }else{
                ns.push_back('B');
            }
        }else{
            ns.push_back(s[i]);
        }
    }
    ll cnt=0;
    ll sum=0;
    rep(i,ns.size()){
        if(ns[i]=='A'){
            cnt++;
        }else if(ns[i]=='D'){
            sum+=cnt;
        }else{
            cnt=0;
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 900
#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <tuple>
#include <functional>
#include <limits>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>

using namespace std;

// Node class
template <typename T>
struct Node
{
	Node(const T& value) : mValue(value), mNext(nullptr), mPrev(nullptr) {}

	T mValue;

	Node<T>* mNext;
	Node<T>* mPrev;
};

// Doubly Linked List class
template <typename T>
class List
{
private:

	Node<T>* mFront;
	Node<T>* mBack;

public:

	List() : mFront(nullptr), mBack(nullptr) {}
	~List() { while (mFront) popFront(); }

	void pushFront(const T& val)
	{
		auto node(new Node<T>(val));

		if (mFront)
		{
			node->mNext = mFront;
			mFront->mPrev = node;

			mFront = node;
		}
		else
		{
			mFront = node;
			mBack = node;
		}
	}

	void pushBack(const T& val)
	{
		auto node(new Node<T>(val));

		if (mBack)
		{
			node->mPrev = mBack;
			mBack->mNext = node;

			mBack = node;
		}
		else
		{
			mFront = node;
			mBack = node;
		}
	}

	void popFront()
	{
		if (mFront)
		{
			auto next(mFront->mNext);
			delete mFront;

			if (next)
			{
				next->mPrev = nullptr;
				mFront = next;
			}
			else
			{
				mFront = mBack = nullptr;
			}
		}
	}

	void popBack()
	{
		if (mBack)
		{
			auto prev(mBack->mPrev);
			delete mBack;

			if (prev)
			{
				prev->mNext = nullptr;
				mBack = prev;
			}
			else
			{
				mFront = mBack = nullptr;
			}
		}
	}

	void erase(const T& val)
	{
		auto node(mFront);

		while (node)
		{
			if (node->mValue == val)
			{
				if (node->mPrev) node->mPrev->mNext = node->mNext;
				else mFront = node->mNext;

				if (node->mNext) node->mNext->mPrev = node->mPrev;
				else mBack = node->mPrev;

				delete node;

				break;
			}

			node = node->mNext;
		}
	}

	void print()
	{
		auto node(mFront);

		size_t index(0);
		while (node)
		{
            cout << (index++ ? " " : "") << node->mValue;

			node = node->mNext;
		}

		cout << endl;
	}
};

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

	List<int> list;

	int n;
	cin >> n;

	for (size_t i(0); i < n; ++i)
	{
		string command;
		cin >> command;

		if (command == "insert")
		{
			int x;
			cin >> x;

			list.pushFront(x);
		}
		else if (command == "delete")
		{
			int x;
			cin >> x;

			list.erase(x);
		}
		else if (command == "deleteFirst")
		{
			list.popFront();
		}
		else if (command == "deleteLast")
		{
			list.popBack();
		}
	}

	list.print();

	return 0;
}

Measured memory_bytes: 34460
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iso646.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
    ll i, j, k;
    ll X;
    cin >> X;
    ll ans = 1;
    ll now = 100;
    while(1) {
        now += now / 100;
        if(now >= X) {
            cout << ans << endl;
            return 0;
        }
        ans++;
    }

    return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a;
  string s;
  cin >> a >> s;
  long long b = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
  cout << a * b / 100;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define x first
#define y second


int main() {
    fast;
    int n, k;
    cin >> n >> k;
    cout << (n+k-3)/(k-1);
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}

	inline int tc()
	{
		int c=fetch();
		while(c<=32 && c!=EOF)c=fetch();
		return c;
	}
}
using ae86::ty;
using ae86::tc;

const int _ = 9;

int H,W,val[_][_]={0};

int main()
{
	H=ty(),W=ty();
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
			val[i][j]=tc()=='#';

	for(int x=1,y=1;x!=H || y!=W;)
	{
		if(val[x][y]!=1){puts("Impossible");return 0;}
		val[x][y]=2;
		if(val[x+1][y])x++;
		else if(val[x][y+1])y++;
		else{puts("Impossible");return 0;}
	}
	if(val[H][W]!=1){puts("Impossible");return 0;}
	val[H][W]=2;

	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
			if(val[i][j]==1){puts("Impossible");return 0;}
	puts("Possible");

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long x = sc.nextLong();
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextLong();
		}
		Arrays.sort(arr);
		long sum = 0;
		int count = 0;
		for (int i = 0; i < n; i++) {
			sum += arr[i];
			if (sum <= x) {
				count++;
			}
			if (sum >= x) {
				break;
			}
		}
		if (sum < x) {
			count--;
		}
		System.out.println(count);
	}
}


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

int main(){
  string s;
  cin >> s;
  if(s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2]){
    cout<<"Yes"<< endl;
    return 0;
  }
  else if(s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[1]){
    cout<<"Yes"<< endl;
    return 0;
  }
  else if(s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[1]){
    cout<<"Yes"<< endl;
    return 0;
  }
  else cout << "No" << endl;
  // cout << s[0] << s[1] << endl;
  return 0;
}


Measured memory_bytes: 256
n,x=gets.split.map(&:to_i)
$a=Array.new(50,0).map.with_index{|n,i| 2**(i+2)-3}
$p=Array.new(50,0).map.with_index{|n,i| 2**(i+1)-1}

def f(n,x)
    if n==0
        x<=0 ? 0:1
    elsif x<=1+$a[n-1]
        f(n-1,x-1)
    else
        $p[n-1]+1+f(n-1,x-2-$a[n-1])
    end
end
p f(n,x)



Measured memory_bytes: 1788
#include <iostream>

using namespace std;

int n, d, x;
int a[105];

int main(void)
{
	cin >> n >> d >> x;
	for(int i = 0; i < n; i++) cin >> a[i];
	
	int ans = x;
	for(int i = 0; i < n; i++){
		ans += (d + a[i]-1) / a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define scan(n)      scanf("%I64d",&n);
#define scan2(a,b)   scanf("%I64d%I64d",&a,&b);
#define scan3(a,b,c) scanf("%I64d%I64d%I64d",&a,&b,&c);
#define sc(n)        scanf("%c",&n);
#define sf(n)        scanf("%lf",&n);
#define ss(n)        scanf("%s",n);
#define forall(i,a,b)for(long long int i=a;i<b;i++)
#define all(a)       a.begin(), a.end()
#define pb           push_back
#define mp           make_pair
#define FAST_IO      ios_base::sync_with_stdio(false); cin.tie(NULL);
#define minimum(a)   *min_element(a.begin(),a.end())
#define maximum(a)   *max_element(a.begin(), a.end())
#define display(a)   for(auto i : a) cout<<i<<" ";
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
using namespace std;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
vector<ll> scanVector(ll n, vector<ll> &v)
{
  ll temp;
  for(ll i = 0; i < n ; i++)
  {
     cin>>temp;
     v.pb(temp);
  }
  return v;
}

int main() {
    FAST_IO
    ll t;
    //cin>>t;
    t = 1;
    while(t--)
    {
        ll n;
        cin>>n;
        vector<ll> v;
        v=scanVector(n,v);
        ll dp[n];
        dp[0] = 0;
        dp[1] = abs(v[1]-v[0]);
        for(ll i = 2; i < n ; i++)
        {
            dp[i] = min((dp[i-1] + abs(v[i]-v[i-1])),(dp[i-2]+abs(v[i]-v[i-2])));
        }
        cout<<dp[n-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 2020
def main():
    N = int(input())
    A = [list(map(int, input().split())) for _ in range(N)]
    tmp_zoro = 0
    ans = 0
    for i in range(len(A)):
        if A[i][0] == A[i][1]:
            tmp_zoro += 1
        else:
            tmp_zoro = 0 
        ans = max(ans, tmp_zoro)

    if ans >= 3:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 62420