akhauriyash/Code-Regression huggingface dataset:
num = int(input())

count = 0
dict1 = {}
for i in range(num):
    command, word = map(str,input().split())
    
    if command == "insert":
        dict1[word] = i
    
    else:
        if (word in dict1.keys()) == True:
            print("yes")
        else:
            print("no")



Measured memory_bytes: 41824
c = []
for _ in range(3):
	c.append(list(map(int, input().split())))
b1b0_0 = c[0][1] - c[0][0]
b1b0_1 = c[1][1] - c[1][0]
b1b0_2 = c[2][1] - c[2][0]

b2b0_0 = c[0][2] - c[0][0]
b2b0_1 = c[1][2] - c[1][0]
b2b0_2 = c[2][2] - c[2][0]

a1a0_0 = c[1][0] - c[0][0]
a1a0_1 = c[1][1] - c[0][1]
a1a0_2 = c[1][2] - c[0][2]

a2a0_0 = c[2][0] - c[0][0]
a2a0_1 = c[2][1] - c[0][1]
a2a0_2 = c[2][2] - c[0][2]

b = (b1b0_0 == b1b0_1) and (b1b0_0 == b1b0_2) and (b2b0_0 == b2b0_1) and (b2b0_0 == b2b0_2)
a = (a1a0_0 == a1a0_1) and (a1a0_0 == a1a0_2) and (a2a0_0 == a2a0_1) and (a2a0_0 == a2a0_2)

if a and b:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3064
#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;

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"
#define pi              acos(-1);
#define ordered_set     tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

typedef long long ll;


int main()
{
    FastRead

    ll n,m,sum=0,cnt=0;

    ll mark;

    cin>>n>>m;

    vector<ll>v(n);

    for(ll i=0;i<n;i++)
    {
        cin>>v[i];
        sum+=v[i];
    }

    mark = (4*m);

    for(ll i=0;i<n;i++)
    {
        if((v[i]*mark)>=sum)
            cnt++;
    }

    if(cnt>=m)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int[] cntS = new int['z' - 'a' + 1];
		int[] cntT = new int['z' - 'a' + 1];
		String S = sc.next(), T = sc.next();

		for(int i = 0; i < S.length(); i++) cntS[S.charAt(i) - 'a']++;
		for(int i = 0; i < T.length(); i++) cntT[T.charAt(i) - 'a']++;
		Arrays.sort(cntS); Arrays.sort(cntT);
		boolean flg = true;

		for(int i = 0; i < cntS.length; i++) {
			if(cntS[i] != cntT[i]) flg = false;
		}
		System.out.println(flg ? "Yes" : "No");
	}
}

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

struct node{
	node*l,*r;
	int cnt,val,Min;
};
node pool[400000];
int p;

inline int cnt(node*t){return t?t->cnt:0;}
inline int Min(node*t){return t?t->Min:INF;}

inline node*update(node*t){
	t->cnt=cnt(t->l)+cnt(t->r)+1;
	t->Min=min({t->val,Min(t->l),Min(t->r)});
	return t;
}
inline node*merge(node*l,node*r){
	if(!l)return r;
	if(!r)return l;
	if(rand()%(cnt(l)+cnt(r))<cnt(l)){
		l->r=merge(l->r,r);
		return update(l);
	}
	else{
		r->l=merge(l,r->l);
		return update(r);
	}
}
inline pair<node*,node*>split(node*t,int k){
	if(!t)return make_pair((node*)NULL,(node*)NULL);
	if(k<=cnt(t->l)){
		auto p=split(t->l,k);
		t->l=p.second;
		return make_pair(p.first,update(t));
	}
	else{
		auto p=split(t->r,k-cnt(t->l)-1);
		t->r=p.first;
		return make_pair(update(t),p.second);
	}
}

int main(){
	int n,q;scanf("%d%d",&n,&q);
	node*root=NULL;
	rep(i,n){
		int a;scanf("%d",&a);
		node*t=&pool[p++];
		*t={NULL,NULL,1,a,a};
		root=merge(root,t);
	}
	rep(i,q){
		int x,y,z;scanf("%d%d%d",&x,&y,&z);
		if(x==0){
			z++;
			auto a=split(root,y);
			auto b=split(a.second,z-y-1);
			auto c=split(b.second,1);
			root=merge(merge(merge(a.first,c.first),b.first),c.second);
		}
		else if(x==1){
			z++;
			auto a=split(root,y);
			auto b=split(a.second,z-y);
			printf("%d\n",Min(b.first));
			root=merge(merge(a.first,b.first),b.second);
		}
		else{
			auto a=split(root,y);
			auto b=split(a.second,1);
			b.first->val=z;
			update(b.first);
			root=merge(merge(a.first,b.first),b.second);
		}
	}
}


Measured memory_bytes: 9492
loop do
  e = gets.to_i
  if e == 0
    exit
  else
    min = 1E9
    maxZ = (e ** (1 / 3.0)).to_i + 1
    for z in 0 .. maxZ
      left = e - z ** 3
      if left >= 0
        maxY = (left ** (1 / 2.0)).to_i + 1
        for y in 0 .. maxY
          x = left - y ** 2
            if x >= 0
            tmp = x + y + z
            if min > tmp
              min = tmp
            end
          end
        end
      end
    end
    puts min
  end
end



Measured memory_bytes: 6964
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N (200010)
#define rootN (400)

bool a[N];
int l[rootN];
int r[rootN];
int p[rootN];
int pr[N];

void pre(int n){
	int x = n;
	f(i, rootN){
		l[i] = (n*i) / rootN;
		r[i] = (n*(i + 1)) / rootN;
		for (int j = l[i]; j < r[i]; j++)pr[j] = i;
		p[i] = r[i] - l[i];
	}
}

void change(int k){
	a[k] = false;
	p[pr[k]]--;
}

int search(int x,int k,int z){
	if (k % 2 == 0){
		k = k % z;
		k++;
		if (k == 1)change(x);
		for (int i = x+1; i < r[pr[x]]; i++){
			if (a[i]){
				k--;
				if (k == 1){
					change(i);
				}
				if (k == 0)return i;
			}
		}
		int y = pr[x];
		while (k > 0){
			y = (y + 1) % rootN;
			k -= p[y];
			if (p[y]>0&&k <= 1){
				k += p[y];
				for (int i = l[y]; i < r[y]; i++){
					if (a[i]){
						k--;
						if (k == 1){
							change(i);
						}
						if (k == 0)return i;
					}
				}
			}
		}

	}
	else{
		k = k % z;
		if (k == 0)k += z;
		int re;
		if (k == 1)re = x;
			for (int i = x-1; i >= l[pr[x]]; i--){
				if (a[i]){
					k--;
					if (k == 1)re = i;
					if (k == 0){
						change(i);
						break;
					}
				}
			}
			int y = pr[x];
			while (k > 0){
				y = (y + rootN - 1) % rootN;
				k -= p[y];
				if (p[y]>0 && k <= 1){
					k += p[y];
					for (int i = r[y]-1; i >= l[y]; i--){
						if (a[i]){
							k--;
							if (k == 1)re = i;
							if (k == 0){
								change(i);
								break;
							}
						}
					}
				}
			}
			return re;
		}
	}

int main(void){
	int n, m, q, c;
	int x, ans;
	int k, l, r;
	scanf("%d %d %d", &n, &m, &q);
	f(i, n)a[i] = true;
	pre(n);
	x = 0;
	f(i, m){
		scanf("%d", &k);
		x = search(x, k, n - i);
	}
	f(qq, q){
		scanf("%d", &x);
		if (a[x])printf("1\n");
		else printf("0\n");
	}

	return 0;
}


Measured memory_bytes: 3608
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		List<Character> ls = new ArrayList<>();
		List<Character> lt = new ArrayList<>();
		String s = readLine();
		String t = readLine();
		for (int i = 0; i < s.length(); i++) {
			ls.add(s.charAt(i));
		}
		for (int i = 0; i < t.length(); i++) {
			lt.add(t.charAt(i));
		}
		Collections.sort(ls);
		Collections.sort(lt);
		Collections.reverse(lt);
		StringBuilder sbs = new StringBuilder();
		for (char ch : ls) {
			sbs.append(ch);
		}
		StringBuilder sbt = new StringBuilder();
		for (char ch : lt) {
			sbt.append(ch);
		}
		if (sbs.toString().compareTo(sbt.toString()) < 0) {
			pln("Yes");
		} else {
			pln("No");
		}
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef pair<ll, ll> pll;

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

int main() {
    // input, ready
    int A,B,C;
    cin >> A >> B >> C;

    cout << C << " " << A << " " << B << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat

int main(int argc, char const *argv[])
{
	sync;
	int x, y;
	cin >> x >> y;
	if(y >= 2*x && y <= 4*x){
		if((4*x - y)%2 == 0){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define FOR(i, c) \
  \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp

int main() {
  ll x=0,y=0,z=0,k,n,m,h,w,sum=0,ans=0,Max=-1e9,Min=1e9+1;
  string s,t,u;
  bool ok = true;
  cin >>n;
  VI a(n);
  rep(i,n) cin>>a[i];
  rep(i,n){
    if(a[i]%2==0){
    if(!(a[i]%3 ==0 || a[i]%5==0)){
      cout << "DENIED" << endl;
      return 0;
    }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val (even, odd) = sc.next().zipWithIndex.partition { case (_, i) => i % 2 == 0 }
  val ((evenSteps, _), (oddSteps, _)) = (even.unzip, odd.unzip)
  println(if (evenSteps.forall(Seq('R', 'U', 'D').contains) &&
    oddSteps.forall(Seq('L', 'U', 'D').contains)) "Yes" else "No")
}


Measured memory_bytes: 55472
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

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

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

int N, A[105];

int main(){
  scanf("%d", &N);
  for (int i = N - 1; i >= 0; i--) scanf("%d", A + i);

  printf("%d", A[0]);
  for (int i = 1; i < N; i++) printf(" %d", A[i]);
  printf("\n");

  return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> 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_popcountll

#define INF 1e16
#define mod 998244353

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

ll fac[100010],finv[100010];
ll comb(ll n,ll r){
  if(n<0||r<0||n<r)return 0;
  else return (fac[n]*finv[r]%mod)*finv[n-r]%mod;
}

ll calc(ll l,ll s){
  return comb(l,s-l);
}

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

  fac[0]=1;
  rep(i,100000)fac[i+1]=fac[i]*(i+1)%mod;
  rep(i,100001)finv[i]=mod_pow(fac[i],mod-2);

  ll N,X;
  cin>>N>>X;

  ll res=1;
  repl(len,1,N+1){
    ll add=0;

    rep(s,X){
      add+=calc(len,s);
      add%=mod;
    }

    repl(i,1,(len/2)+1){
      if(i*2<X-1){
        add+=calc(len-2*i,X-1-2*i);
        add%=mod;
        if((X-1-2*i)==2*(len-2*i)){
          add=(add-1+mod)%mod;
          add%=mod;
        }
      }
    }

    if(len*2>=X&&X%2==1){
      add++;
      add%=mod;
    }

    res+=add*comb(N,len)%mod;
    res%=mod;
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <deque>
#include <queue>

#define pb push_back
#define mp make_pair
#define x first
#define y second
#define FOR(i, a, b) for(int i=a, loop=b; i<=loop; ++i)
#define REV(i, a, b) for(int i=a, loop=b; i>=loop; --i)
#define mize(a, b) a = min(a, b)
#define maxi(a, b) a = max(a, b)
#define shl(k) ((k) << 1)
using namespace std;

const int N = 2e5+5;
int n, m, A, B, x[N], idx[N];
int64_t le[N*4], ri[N*4], INF = 1e17;

void build(int k=1, int l=1, int r=n)
{
    if (l == r) {
        idx[r] = k;
        if (r == B) {
            le[k] = -r; ri[k] = r;
        } else le[k] = ri[k] = INF;
    } else {
        int m = (l+r) >> 1;
        build(shl(k), l, m);
        build(shl(k)+1, m+1, r);
        le[k] = min(le[shl(k)], le[shl(k)+1]);
        ri[k] = min(ri[shl(k)], ri[shl(k)+1]);
    }
}
void update(int u, int64_t x, int k=1, int l=1, int r=n)
{
    if (l == r) {
        le[k] = x - r;
        ri[k] = x + r;
    } else {
        int m = (l+r) >> 1;
        if (u<=m) update(u, x, shl(k), l, m);
        else update(u, x, shl(k)+1, m+1, r);

        le[k] = min(le[shl(k)], le[shl(k)+1]);
        ri[k] = min(ri[shl(k)], ri[shl(k)+1]);
    }
}
int64_t get_le(int u, int k=1, int l=1, int r=n)
{
    if (l == r) return le[k];
    int m = (l+r) >> 1;
    if (u <= m) return get_le(u, shl(k), l, m);
    return min(le[shl(k)], get_le(u, shl(k)+1, m+1, r));
}
int64_t get_ri(int u, int k=1, int l=1, int r=n)
{
    if (l == r) return ri[k];
    int m = (l+r) >> 1;
    if (m < u) return get_ri(u, shl(k)+1, m+1, r);
    return min(ri[shl(k)+1], get_ri(u, shl(k), l, m));
}
int main()
{
    ios::sync_with_stdio(); cin.tie(0);

    cin >> n >> m >> A >> B;
    FOR(i, 1, m) cin >> x[i];
    x[0] = A;

    int64_t ans = INF, add = 0, tmp;
    build();
    FOR(i, 0, m-1) {
        tmp = min(x[i+1]+get_le(x[i+1]), get_ri(x[i+1])-x[i+1]) + add;
        add += abs(x[i+1] - x[i]);
        update(x[i], tmp-add);

        ///if (i == 1) cout << tmp <<  endl;
    }

    FOR(i, 1, n) {
        ans = min(ans, le[idx[i]] + i);
    }
    cout << ans + add;
}


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

int main(){
    long long Q, H, S, D, N;
    cin >> Q >> H >> S >> D;
    cin >> N;

    long long p_D, p_S, p_H, p_Q;

    p_S = S*N;
    p_H = H*N*2;
    p_Q = Q*N*4;
    if(N % 2 == 0){
        p_D = (N/2)*D;
    }else{
        p_D = (N/2)*D + min({Q*4, H*2, S});
    }

    cout << min({p_D, p_S, p_Q, p_H}) << endl;
    return 0;
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

int main() {
  ll n;
  cin >> n;
  ll res = 0;

  for(ll i = 1; i*i < n; i++) {
    if (n % i == 0 && n / i - 1 != i) {
      ll a = n / i;
      if (a > 2) {
        res += (a - 1);
      }
    }
  }

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

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
s = min(A)
def solve():
    ans = 0
    V = [False] * n
    B = sorted(A)
    T = {B[i]: i for i in range(n)}
    for i in range(n):
        if V[i]:
            continue
        cur = i
        S = an = 0
        m = 10000
        while not V[cur]:
            V[cur] = True
            an += 1
            v = A[cur]
            m = min(m, v)
            S += v
            cur = T[v]
        ans += min(S + (an - 2) * m, m + S + (an + 1) * s)
    return ans
print(solve())



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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> cm(0);
  vector<int> cp(0);
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    if(a < 0) cm.push_back(-a);
    else cp.push_back(a);
  }
  
  int ans = pow(10, 9);
  int ml = cm.size(), pl = cp.size();
  if(ml) reverse(cm.begin(), cm.end());
  if(ml >= k) ans = min(ans, cm.at(k-1));
  if(pl >= k) ans = min(ans, cp.at(k-1));
  for(int i = 1; i < k-1; i++){
    if(i > ml || k-i > pl) continue;
    int a = cm.at(i-1), b = cp.at(k-i-1);
    int sum = a + b + min(a, b);
    ans = min(ans, sum);
  }
  
  cout << ans << endl;
}

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

int main(){
    int X, ans = 0;
    cin >> X;
    for(int i = 0; i < 8; i++){
        if(i * 200 + 400 <= X && X <= i * 200 + 599){
          ans = 8 - i;
          break;
        }
    }
    
    cout << ans << endl;
}


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

#define int long long
// logic: Print, Help, For, Equal, eXclusive, Decrease
#define P(x) cout << x << endl
#define H(x) P(#x << ": " << x)
#define F(i,n) for (int i=0; i<(n); i++)      // [0,n)
#define FE(i,n) for (int i=0; i<=(n); i++)    // [0,n]
#define FX(i,a,b) for (int i=(a); i<(b); i++) // [a,b)
#define D(i,n) for (int i=(n); --i>=0;)       // (n,0]
#define DX(i,a,b) for (int i=(b); --i>=(a);)  // (b,a]
#define S(s) (int)((s).size())
#define ALL(v) v.begin(), v.end()
#define V vector
#define pb push_back
#define mt make_tuple

using namespace std;

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

	int a, b;
	string s;
	bool ok = true;
	cin >> a >> b>> s;

	F(i,a) if(s[i] < '0' || s[i] > '9') ok = false;
	if(s[a] != '-') ok = false;
	FX(i,a+1,a+b+1) if(s[i] < '0' || s[i] > '9') ok = false;
	cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
use std::io::stdin;

fn input_ints() -> Vec<i32> {
    let mut st = String::new();
    match stdin().read_line(&mut st) {
        Ok(_) => st.split_whitespace().map(|s| s.parse().unwrap()).collect(),
        Err(_) => "".split_whitespace().map(|s| s.parse().unwrap()).collect(),
    }
}

fn main() {
    let line = input_ints();
    // let line = input_ints().to_array();
    let k: i32 = line[0];
    let s: i32 = line[1];

    let mut cnt = 0;

    for x in 0..k+1 {
        for y in 0..k+1 {
            let z = s - x - y;
            if 0 <= z && z <= k {
                cnt += 1;
            }
        }
    }

    println!("{}",cnt);
}


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

using namespace std;

int main()
{
  int sum = 0;
  string T;
  cin >> T;
  for (int i = 0; i < T.size();i++){
    if(T[i] == '?'){
      T[i] = 'D';
    }
  }
  cout << T << endl;

  return 0;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,ans=0;
	cin>>k>>n;
	for(int x=0;x<=k;x++)
	{
		for(int y=0;y<=k;y++)
		{
			 if(n-x-y>=0&&n-x-y<=k) ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main()
{
    int A[4];
    for(int i = 0; i < 3; ++i) cin >> A[i];

    sort(A, A + 3);
    int sub1 = A[2] - A[0];
    int sub2 = A[2] - A[1];
    if(sub1%2 != 0 && sub2%2 != 0) {
        cout << 1 + (sub1 - 1)/2 + (sub2 - 1)/2 << endl;
        return 0;
    }
    else if(sub1%2 != 0) {
        cout << 1 + (sub1 + 1)/2 + sub2/2 << endl;
    }
    else if(sub2%2 != 0) {
        cout << 1 + sub1/2 + (sub2 + 1)/2 << endl;
    }
    else {
        cout << sub1/2 + sub2/2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int kMaxS = 2001;
const int kM = 1000000007;

int s;

int f[kMaxS];

int main() {
  cin >> s;
  fill_n(f, s + 1, 1);
  for (int i = 1; i <= s; i++) {
    for (int j = 3; j <= i - 3; j++) {
      f[i] = (f[i] + f[j]) % kM;
    }
  }
  cout << (s < 3 ? 0 : f[s]);
  return 0;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<cstring>
using namespace std;
int min(int a,int b){return a<b?a:b;}
char s[100005];
int main(){
	scanf("%s",s);
	int n=strlen(s),ans=0,num=0,ss=1;
	for(int i=n-1;i>=0;i--){
		ans+=s[i]-48;
		num+=(s[i]-48)*ss,ss*=10;
	}
	if(num%ans==0) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
const int N=300+10;
int t,n,m,a[N][N],last,now,tot;
char s[N];
int main()
{
	scanf("%d%d%d",&n,&m,&t);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s);
		for(int j=0;j<m;j++)
			if(s[j]=='#')a[i][j+1]=1;
	}
	for(int i=1;i<=n;i++)
	{
		last=1;
		for(int j=1;j<=m;j++)
			if(a[i][j])
			{
				tot++;
				for(int k=last;k<=j;k++)a[i][k]=tot;
				last=j+1;
			}
		now=m+1;
		for(int j=m;j;j--)
			if(a[i][j])
			{
				now=j+1;
				break;
			}
		for(int j=now;j<=m;j++)a[i][j]=tot;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(!a[i][j])a[i][j]=a[i-1][j];
	for(int i=n;i;i--)
		for(int j=1;j<=m;j++)
			if(!a[i][j])a[i][j]=a[i+1][j];
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			printf("%d ",a[i][j]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

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

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

int main(void) {
    int N, M;
    cin >> N >> M;
    vector<ll> A(100010);
    for (int i=0;i<N;i++) cin >> A[i];

    ll X = 0;
    for (int i=0;i<N;i++) {
        A[i] /= 2LL;
        // X = max(X,A[i]);
    }
    ll L = A[0], res = 0;
    for (int i=1;i<N;i++) {
        L = lcm(L,A[i]);
        if (L>M) {
            cout << 0 << endl;
            return 0;
        }
    }
    // cout << L << endl;
    ll s = L;
    // if (L == X) s *= 3;
    ll e = M/L*L;
    res = (e-s)/(2*L)+1;
    // res = M/L/2;
    // if (M/L % 2 == 1) res++;
    // if (L == X) res--;
    // for (int j=1;j<=M/L;j+=2) res++;
    for (int i=0;i<N;i++) {
        if (L % (2*A[i]) == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1024
import numpy as np
from numba import jit
N,K=map(int,input().split())
A=list(map(int,input().split()))

@jit
def imos(A):
    B=np.zeros_like(A)
    for i,x in enumerate(A):
        a=max(0,i-x)
        b=min(i+x,N-1)
        B[a]+=1
        if b+1<=N-1:
            B[b+1]-=1
    B=np.cumsum(B)
    return B

for i in range(K):
    if i>=50:
        break
    A=imos(A)
print(*A)

Measured memory_bytes: 128012
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int x = i + a[i];
            if(!map.containsKey(x)) map.put(x, 0);
            map.put(x, map.get(x) + 1);
        }
        long ans = 0L;
        for (int i = 1; i < n; i++) {
            int x = i - a[i];
            if(map.containsKey(x)) ans += map.get(x);
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 69092
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string s;
    cin >> s;
    
    int k;
    cin >> k;
    
    string copy = s;
    sort(copy.begin(), copy.end());
    if(copy[0] == copy[s.size() - 1]) {
        cout << s.size() * k / 2 << endl;
        return 0;
    }
    
    int end_index = s.size() - 1;
    int front_index = 0;
    
    if(s[0] == s[s.size() - 1]) {
        int tmp = 0;
        while(tmp <= s.size() - 1 && s[s.size() - 1] == s[s.size() - 1 - tmp]) {
            tmp++;
        }
        end_index -= tmp;
        
        tmp = 0;
        while(tmp <= s.size() - 1 && s[0] == s[tmp]) {
            tmp++;
        }
        front_index = tmp;
    }
    
    long long cnt = 0;
    for(int i = front_index; i < end_index; i++) {
        int tmp = 0;
        while(i + tmp < s.size() && s[i] == s[i + tmp]) {
            tmp++;
        }
        cnt += tmp / 2;
        
        i += tmp - 1;
    }
    
    long long ans = cnt * k;
    ans += (k - 1) * ((s.size() - 1 - end_index + front_index) / 2);
    ans += (s.size() - 1 - end_index) / 2;
    ans += front_index / 2;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
// rep(i, 1, 5) --> {1,2,3,4}
// rep(i, 5, 1) --> {4,3,2,1}
// rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 0;
    rep(i, 0, n)
    {
        int x;
        cin >> x;
        ans += 2 * min(x, abs(k-x));
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  ll roku[8], kyu[8];
  roku[0] = kyu[0] = 0;
  roku[1] = 6;
  kyu[1] = 9;
  FOR(i,2,8) roku[i] = roku[i-1] * 6;
  FOR(i,2,8) kyu[i] = kyu[i-1] * 9;
  int dp[N+1];
  FOR(i,0,N+1)dp[i]=2e9;
  dp[0] = 0;
  FOR(i,1,N+1){
    dp[i] = min(dp[i], dp[i-1]+1);
    FOR(j,0,8){
      if(i-roku[j]>=0)
      dp[i] = min(dp[i], dp[i-roku[j]] + 1);
    }
    FOR(j,0,8){
      if(i-kyu[j]>=0)
      dp[i] = min(dp[i], dp[i-kyu[j]] + 1);
    }
  }
  cout << dp[N] << endl;
}

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

using namespace std;
typedef long long ll;
const ll  MAX_N = 100000;
int N;
ll A[MAX_N],B[MAX_N],X[MAX_N];

int main(){
  cin>>N;
  for(int n=0;n<N;n++){
    cin>>B[n];
    A[n]=B[n];
  }

  for(int k=0;k<(N-1)/2;k++){
    ll m=(A[k]+A[N-2-k])-A[N-1-k];
    A[N-2-k]=m;

  }
  X[(N-1)/2]=A[(N-1)/2];
  for(int k=1;k<=(N-1)/2;k++){
    X[(N-1)/2+k]=2*B[(N-1)/2+k-1]- X[(N-1)/2+k-1];
    X[(N-1)/2-k]=2*B[(N-1)/2-k]- X[(N-1)/2-k+1];
  }
   for(int k=0;k<N;k++){
     cout<<X[k]<<endl;
  }
}


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

typedef long long int ll;
typedef vector<int> vi;			
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> 	pii;
typedef vector<bool> vb;
#define endl '\n'
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define in insert
#define mp make_pair
#ifdef LOCAL
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll div_floor(const ll &a,const ll &b) { return a / b - (((a ^ b) < 0) and a % b);}
ll div_ceil(const ll &a,const ll &b) { return a / b + (((a ^ b) >= 0) and a % b);}

void solve(){
	ll n; cin>>n;
	ll sum = 1000;
	vl a(n); for(int i = 0; i<n; i++) cin>>a[i];
	int i = 0;
	while(i<n){
		int st = i;
		while(i<n-1&&a[i+1]>=a[i])
			i++;
		sum = sum%a[st] + (sum/a[st])*a[i];
		i++;
	}
	cout<<sum<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef LOCAL
		freopen(".inp.txt", "r", stdin);
    	freopen(".out.txt", "w", stdout);
    	freopen(".err.txt", "w", stderr);
	#endif
	int t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 3660
package main

import (
	"io"
	"os"
	"strconv"
)

const mod = 1e9 + 7

func main() {
	b := [26]int{}
	buf := make([]byte, 1)
	var err error
	for err != io.EOF {
		_, err = os.Stdin.Read(buf)
		if buf[0] < 'a' || buf[0] > 'z' {
			continue
		}
		b[buf[0]-'a']++
	}

	r := 1
	for i := 0; i < 26; i++ {
		r = r * (b[i] + 1) % mod
	}
	os.Stdout.Write([]byte(strconv.Itoa(r-1) + "\n"))
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define MOD 1000000007
int main()
{
  int N;
  cin>>N;
  int A[N];
  long long cnt=1;
  int r=0,g=0,b=0;
  for(int i=0;i<N;i++)
  {
      cin>>A[i];
      if(A[i]==b)
      {
          if(A[i]==g)
          {
              if(A[i]==r)
              {
                  cnt=(cnt*3)%MOD;
              }
              else
              {
                  cnt=(cnt*2)%MOD;
              }
          }
          else
          {
              if(A[i]==r)
              {
                  cnt=(cnt*2)%MOD;
              }
          }
          b++;
      }
      else if(A[i]==g)
      {
          if(A[i]==r)
          {
              cnt=(cnt*2)%MOD;
          }
          g++;
      }
      else if(A[i]==r)
      {
          r++;
      }
      else
      {
          cout<<0;
          return 0;
      }
  }
  cout<<cnt;
  return 0;
}

Measured memory_bytes: 640
import java.util.*;
public class Main{
    public static void main(String [] args){
        Scanner sc=new Scanner(System.in);
        int N,ai;
        N=sc.nextInt();
        int[] A=new int[N+1];
        for(int i=1;i<N;i++){
            ai=sc.nextInt();
            A[ai]++;
        }
        for(int j=1;j<N+1;j++)
            System.out.println(A[j]);
    }
}


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

using namespace std;

#define PB push_back  
#define MP(A, B) make_pair(A, B)  
#define fi first  
#define se second  

#define gcd(a,b) __gcd(a,b)
#define pi acos(-1.0)
#define pii pair<int,int>
#define ll long long  
#define MAX 1000005  
#define MOD 998244353  
#define M 998244353  
#define INF 0x3f3f3f3f  
#define EXP 1e-8  
#define lowbit(x) (x&-x)  

long long qpow(long long a, long long n) {
    long long ret = 1;
    a = (a % M + M) % M;
    for (; n; n >>= 1) {
        if (n & 1) ret = (ret * a) % M;
        a = (a * a) % M;
    }
    return ret;
}

int n;
vector<string> vs, l, r;
int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        string s; cin >> s;
        vs.push_back(s);
    }
    auto cmp = [](const pii &a, const pii &b) {return a.se < b.se;};
    priority_queue<pii> va, vb;
    // vector<pii> va;
    for (auto &s : vs) {
        pii a(0,0);
        for (int i = 0; i < s.size(); ++i) {
            a.fi += s[i] == '(' ? 1:-1;
            a.se = min(a.se, a.fi);
        }
        if (a.fi >= 0) va.push((pii){a.se, a.fi});
        else vb.push((pii){a.fi-a.se, -a.se});
    }
    ll nsum = 0;
    auto cmp2 = [](const pii &a, const pii &b) {return a.fi < b.fi;};
    priority_queue<pii, vector<pii>, decltype(cmp2)> q(cmp2);
    while (!q.empty() || !va.empty()) {
        while (!va.empty() && nsum + va.top().fi >= 0) {
            q.push((pii){va.top().se, va.top().fi}); va.pop();
        }
        if (q.empty()) {
            cout << "No" << endl; return 0;
        }
        pii p = q.top(); q.pop();
        nsum += p.fi;
    }
    while (!vb.empty()) {
        pii p = vb.top(); vb.pop();
        if (nsum - p.se < 0) {cout << "No" << endl; return 0;}
        nsum += p.fi - p.se;
    }
    if (nsum == 0)
        cout << "Yes"  << endl;
    else 
        cout << "No"  << endl;
    return 0;
}


Measured memory_bytes: 51776
#include <stdio.h>

int main(void){

    int a,b;

    scanf("%d %d", &a,&b);

    if(a<b){
    printf("a < b\n");

}else if(a>b){
    printf("a > b\n");
}else{
    printf("a == b\n");
}    

    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000000 + 7;

int main()
{
    int n, k;
    cin >> n >> k;

    long long **C;
    C = (long long **)malloc(sizeof(long long *) * 2001);
    for (auto i = 0; i < 2001; i++)
    {
        C[i] = (long long *)malloc(sizeof(long long) * 2001);
    }
    

    for (auto i = 0; i < 2001; i++)
    {
        C[i][0] = 1;
        C[i][i] = 1;
    }


    for (auto i = 1; i < 2001; i++)
    {
        for (auto j = 1; j < i; j++)
        {
            C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD;
        }
    }


    for (auto i = 1; i <= k; i++)
    {
        long long pre = C[n - k + 1][i] % MOD;
        long long aft = C[k - 1][i - 1] % MOD;
        cout << (pre * aft) % MOD << endl;
    }
}

Measured memory_bytes: 22912
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			long K = inputArray[1];

			var sunukeDic = new Dictionary<long, long>();//すぬけさんがおかしを持っている個数

			for (int i = 0; i < K; i++) {
				var d = retreiveLongArray()[0];
				var okashi = retreiveLongArray();

				foreach (var k in okashi) {
					if (sunukeDic.ContainsKey(k)) {
						sunukeDic[k]++;
					}
					else {
						sunukeDic.Add(k, 1);
					}
				}
			}

			var count = 0;
			for (int i = 1; i <= N; i++) {
				if (!sunukeDic.ContainsKey(i)) {
					count++;
				}
			}

			//答えの出力
			var ans = count;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 28616
#include <iostream>

void Loop(int n, int a, int& answer)
{
  int num=n-a;
  answer++;
  
  if(num>0)
  {
    Loop(num, a, answer);
  }
  
  return;
}

int main()
{
  int N,A=0;
  std::cin>>N>>A;
  
  int answer=0;
  Loop(N, A, answer);
  
  std::cout<<answer<<std::endl;
  
  return 0;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n;
  cin >> n;
  for(ll i=1;i<=n;i++){
    ll tmp = i*1.08;
    if(tmp==n){
      cout <<i<<endl;
      return 0;
    }
  }
  cout <<":(\n";
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int digit(ll x) {
	int c = 0;
	while (x >= 1) {
		x /= 10;
		c++;
	}
	return c;
}

int main() {
	ll n, j = 1;
	int ans;
	cin >> n;
	for (ll i = 1; i*i <= n; i++) {
		if (n%i == 0)ans = digit(max(n/i,(ll)i));
	}

	cout << ans << endl;
}

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

int main(int argc, const char * argv[]) {
    int N, M;
    
    cin >> N >> M;
    vector<int> L(M);
    vector<int> R(M);
    for (int i = 0; i < M; i++) {
        cin >> L[i] >> R[i];
    }
    
    int ans = 0;
    int minv = *min_element(R.begin(), R.end());
    int maxv = *max_element(L.begin(), L.end());
    
    for (int i = 1; i <= N; i++) {
        if (maxv <= i && i <= minv) {
            ans++;
        }
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=4e5+7;
int a[maxn],b[maxn];
int s[maxn],t[maxn];
int len;
int fail[maxn];
void getfail()
{
    memset(fail, 0, sizeof(fail));
    int j = 0, k = fail[0] = -1;
    while (j < len)
    {
        while (k != -1 && t[j] != t[k])
            k = fail[k];
        fail[++j] = ++k;
    }
}
vi ans;
int kmp()
{
    int n = len*2, m = len;
    int i = 0, j = 0;
    int ret = 0;
    while (i < n)
    {
        while (j != -1 && s[i] != t[j])
            j = fail[j];
        i++, j++;
        if (j == m)
        {
            ans.push_back(i-len);
            ret++, j = fail[j];
        }
    }
    return ret;
}
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int j=0;j<n;j++) cin>>b[j];
    if(n==1)
    {
        cout<<0<<" "<<(a[0]^b[0])<<'\n';
        return 0;
    }
    for(int i=1;i<n+n;i++) s[i-1]=a[i%n]^a[(i-1)%n];
    for(int i=1;i<n;i++) t[i-1]=b[i]^b[i-1];
    len=n-1;
    getfail();
    kmp();
    for(auto u:ans) cout<<u<<" "<<(b[0]^a[u])<<'\n';
}

Measured memory_bytes: 11252
/*
 * X 段重ねの鏡餅 (X≥1) とは、X 枚の円形の餅を縦に積み重ねたものであって、どの餅もその真下の餅より直径が小さい（一番下の餅を除く）もののことです。
 * 例えば、直径 10、8、6 センチメートルの餅をこの順に下から積み重ねると 3 段重ねの鏡餅になり、餅を一枚だけ置くと 1 段重ねの鏡餅になります。
 * 
 * ダックスフンドのルンルンは N 枚の円形の餅を持っていて、そのうち i 枚目の餅の直径は di センチメートルです。
 * これらの餅のうち一部または全部を使って鏡餅を作るとき、最大で何段重ねの鏡餅を作ることができるでしょうか。
 */

import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            int n = Integer.parseInt(sc.next());
            
            int[] list = new int[n];
            
            for(int i=0; i<n; i++){
            	list[i] = Integer.parseInt(sc.next());
            }
            //ソートする
            Arrays.sort(list);
            // 同じ数であるため鏡餅から省かなくてはならない餅の数count
            int count = 0;

            for(int i=0; i<n-1; i++){
            	if(list[i] == list[i+1]){
            		count++;
            	}
            }
            //差を出力
            System.out.println(n-count);
            sc.close();
        }
    }
	

Measured memory_bytes: 21844
#include <stdio.h>
#include <limits.h>
#include <math.h>

long long factors(long long num,long long fact[])
{
    long long rec = 0,r = 0;
    long long s = (long long)sqrt((long double)num);
    for (long long i = 2; i < s; i++)
    {
        if((num % i) == 0){
            do {
                num /= i;
                fact[rec] = i;
                rec ++;
            }while ((num % i) == 0);
        }
    }
    if(num > s){
        fact[rec] = num;
        rec++;
    }
    return rec;
}

long long llpow(long long x, long long y)
{
    long long i,ans = 1;
    for (i = 0; i < y; i++)
    {
        ans *= x;
    }
    
    return ans;
}

int main()
{
    long long n,p,f[64] = {0},rec,ans = 1;
    int bound[64] = {0},j = 1;

    scanf("%lld %lld",&n,&p);
    rec = factors(p,f);

    //for (int i = 0; i < rec; i++){printf("%lld ",f[i]);}

    for (int i = 0; i <= rec + 1; i++)
    {
        if(f[i] != f[i + 1])
        {
            bound[j] = i + 1;
            j++;
        }
    }
    
    //printf("\n");for (int i = 0; i < j; i++){printf("%d ",bound[i]);}printf("\n");

    long long x,y;
    for (int i = 0; i < j - 1; i++)
    {
        y = (bound[i + 1] - bound[i]) / n;
        x = f[bound[i]];
        ans *= llpow(x,y); 
    }
    
    
    printf("%lld",ans);

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

string s;
int sz;

bool ok(){
	bool flag = true;
	for( int i = 0; i < sz/2; ++i ){
		if( s[i] != s[i+sz/2] ) flag = false;
	}
	return flag;
}

int main(){
	cin >> s; sz = s.l_ength();
	sz -= 2;
	while( sz > 0 ){
		if( ok() ){
			cout << sz << endl;
			break;
		}
		sz -= 2;
	}
	return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 4e5 + 5;
int n, v;
int x[maxn];

bool read() {
  if (scanf("%d%d", &n, &v) < 2) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  return true;
}

const int maxk = 20;
int go[maxn][maxk];
int k;

void getDp(int dp[maxn]) {
  for (int i = 0; i < k; i++) {
    go[n][k] = n;
    go[n - 1][k] = n;
  }
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < k; j++) {
      int curv = (v >> (j + 1));
      go[i][j] = (x[i + 1] - x[i] <= curv ? go[i + 1][j] : i + 1);
    }
  }
  for (int i = 0; i < (1 << k); i++) {
    dp[i] = 0;
  }
  for (int i = 0; i < (1 << k); i++) {
    auto cur = dp[i];
    for (int j = 0; j < k; j++) {
      if (!(i & (1 << j))) {
        dp[i | (1 << j)] = max(dp[i | (1 << j)], go[cur][j]);
      }
    }
  }
}

int dpl[maxn], dpr[maxn];
int ans[maxn];

void solve() {
  k = 32 - __builtin_clz(v);
  getDp(dpl);
  reverse(x, x + n);
  for (int i = 0; i < n; i++) {
    x[i] *= -1;
  }
  getDp(dpr);
  reverse(x, x + n);
  for (int i = 0; i < n; i++) {
    x[i] *= -1;
  }
  for (int i = 0; i < (1 << k); i++) {
    dpr[i] = n - dpr[i];
  }
  for (int i = 0; i < n; i++) {
    ans[i] = false;
  }
  int cnt = 0;
  for (int j = 0; j < n;) {
    int i = j;
    while (j + 1 < n && x[j + 1] - x[j] <= v) {
      j++;
    }
    j++;
    cnt++;
    if (cnt > k + 2) {
      break;
    }
    bool ok = false;
    for (int msk = 0; msk < (1 << k); msk++) {
      if (dpl[msk] >= i && dpr[(1 << k) - 1 - msk] <= j) {
        ok = true;
        break;
      }
    }
    if (ok) {
      for (int k = i; k < j; k++) {
        ans[k] = true;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf(ans[i] ? "Possible\n" : "Impossible\n");
  }
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 24192
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>

int main() {
    ll n,ans=0; cin>>n;
    vl x(n);
    rep(i,n)cin>>x[i];
    rep(i,n){
        if(i+1==x[i]){
            ans++;
            i++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024