akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin>>N;
  vector<long long> a(N);
  for(int i=0;i<N;i++)
    cin>>a.at(i);
  int max=0,index=-1;
  for(int i=0;i<N;i++){
    if(a.at(i)>max){
      max=a.at(i);
      index=i;
    }
  }
  vector<long long> b(N,max);
    sort(a.begin(),a.end());


  if(a.at(N-2)!=a.at(N-1))
    b.at(index)=a.at(N-2);
  for(int i=0;i<N;i++)
    cout<<b.at(i)<<endl;
  
}

Measured memory_bytes: 6392
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	var n, q int
	n = nextInt()
	//Sの要素は、昇順にソート済み
	S := make([]int, n)

	for i := 0; i < n; i++ {
		S[i] = nextInt()
	}

	q = nextInt()
	T := make([]int, q)
	for j := 0; j < q; j++ {
		T[j] = nextInt()
	}

	ans := 0
	for _, t := range T {
		if binarySearch(t, n, S) {
			ans++
		}
	}
	fmt.Println(ans)
}

func binarySearch(t int, n int, S []int) bool {
	rt := false
	left := 0
	right := n
	for left < right {
		mid := (right + left) / 2
		if S[mid] == t {
			rt = true
			break
		} else if S[mid] < t {
			left = mid + 1
		} else {
			right = mid
		}
	}
	return rt
}



Measured memory_bytes: 3132
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>
#include <unordered_map>
#include <stack>
#include <cstring>
#include <cctype>
#include <random>

using namespace std;
typedef long long  ll;
const ll INF = 1000000007;
const ll mod = 998244353;

int main()
{
	ll N;
	cin >> N;
	vector<ll> a(N);
	for (ll i = 0; i < N; i++)
	{
		cin >> a[i];
	}
	ll ans = 0;
	for (ll i = 0; i < N; i++)
	{
		if (i % 2 == 0 && a[i] % 2 == 1) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define rep(i, n) for(int i=0; i < (n); ++i)
#define ll long long

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b; cin >> a >> b;
    cout << max(0, a - b * 2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
    int i,j,n,m,x;
    int a[100][100],b[100];
     
    scanf("%d %d",&n,&m);
     
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
     
    for(j=0;j<m;j++){
        scanf("%d",&b[j]);
    }
     
    for(i=0;i<n;i++){
        x = 0;
        for(j=0;j<m;j++){
            x += a[i][j] * b[j];
        }
        printf("%d\n",x);
    }
    return 0;
}

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

int main() {
  int N, A;
  cin >> N >> A;

  int ans = 0, count = 0;
  for (int i = 1; i < N; i++) {
    int B;
    cin >> B;
    if(A>=B) {
        count++;
    }
    else {
        count = 0;
    }
    A=B;
    ans = max(ans, count);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	ll n,k;
	cin>>n>>k;
	vector<ll> a(n);
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a.begin(),a.end());
	vector<bool> dp(k+1,0);
	for(int i=1;i<=k;i++){
		for(int j=0;j<n;j++){
			if(a[j]>i)
			break;
			else 
			dp[i]=dp[i]||(!dp[i-a[j]]);
		}
	}
	if(dp[k])
	cout<<"First"<<endl;
	else 
	cout<<"Second"<<endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define vec vector<ll>
#define ms multiset<ll>
#define f(i,x,n) for(int i=x;i<n;i++)
#define int long long
#define mod 998244353
#define endl "\n"
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int32_t main()
{
    fastio();
    int n,d;
    cin>>n>>d;
    int kk=2*d+1;
    int ans=0;
    ans=n/kk;
    if(n%kk!=0)
    	ans++;
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
ll ketawa(ll a){ll r=0;while(a){r+=a%10;a/=10;}return r;}


template <typename T>
class Lazy_Seg_Tree{
public: // 0-index

	T make_dat_from_buket(T da, T bu, T s){
		return da + bu;
	}
	T buket_to_child(T ch, T pa){
		return ch + pa / 2;
	}
	T buket_update(T bu , T x , T s){
		return bu + x*s;
	}
	T dat_update(T dc1, T dc2){
		return dc1 + dc2;
	}

  vector<T> dat,buket;
  T initial,M;
  int n;
  Lazy_Seg_Tree(int n0_=1,T initial_=1,T M_=1){
    initsize(n0_,initial_,M_);
  }
  void initsize(int n0,T initial_,T M_){
    M = M_;
    initial = initial_;
    int k=1;
    while(k<n0)k*=2;
    n=k;
    dat.resize(2*n-1);
    buket.resize(2*n-1);
    for(int i=0;i<2*n-1;i++)dat[i]=initial;
    for(int i=0;i<2*n-1;i++)buket[i]=initial;
  }
	
	void eval(int k,int l,int r){
		if(buket[k] != initial){
			dat[k] = make_dat_from_buket(dat[k],buket[k],r-l);
			if(r-l>1){
				buket[2*k+1] = buket_to_child(buket[2*k+1],buket[k]);
				buket[2*k+2] = buket_to_child(buket[2*k+2],buket[k]);
			}
			buket[k] = initial;
		}
	}

	void add(int a,int b, T x, int k=0,int l=0, int r=-1){
		if(r<0)r=n;
		eval(k,l,r);
		if(b<=l || r<=a)return;
		if(a<=l && r<=b){
			buket[k] = buket_update(buket[k],x,r-l);
			eval(k,l,r);
		}else{
			add(a,b,x,2*k+1,l,(l+r)/2);
			add(a,b,x,2*k+2,(l+r)/2,r);
			dat[k] = dat_update(dat[2*k+1],dat[2*k+2]);
		}
	}
	T get(int a,int b,int k=0,int l=0,int r=-1){
		if(r<0)r=n;
		if(b<=l || r<=a) return initial;
		eval(k,l,r);
		if(a<=l && r<=b) return dat[k];
		T vl = get(a,b,2*k+1,l,(l+r)/2);
		T vr = get(a,b,2*k+2,(l+r)/2,r);
		return dat_update(vl,vr);
	}
};



int main(){

	ll n,q;
	cin >> n >> q;
	Lazy_Seg_Tree<ll> sg(n,0,MOD);
	FOR(i,0,q){
		ll q_,s,t,x;
		cin >> q_;
		if(q_){
			cin >> s >> t;
			cout << sg.get(s-1,t,0,0,-1) << "\n";
		}else{
			cin >> s >> t >> x;
			sg.add(s-1,t,x,0,0,-1);
		}
	}


}



Measured memory_bytes: 7004
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (register ll i = (a); i <= (b); ++i)
#define per(i, a, b) for (register ll i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (register int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter putchar('\n')
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 2e6 + 100 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 998244353 ;
const double eps = 1e-7 ;
template <class T = int> T read()
{
	T f = 1, a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	return a * f ;
}

ll n, m, ans;

ll fac[maxn] = {1}, inv[maxn];

ll power(ll a, ll b)
{
	if(b < 0) return 0;
	ll ret = 1;
	for(; b; b >>= 1, (a *= a) %= mod) if(b & 1) (ret *= a) %= mod;
	return ret;
}

void init()
{
	ll N = 2e6;
	rep(i, 1, N) fac[i] = fac[i - 1] * i % mod;
	inv[N] = power(fac[N], mod - 2);
	per(i, N, 1) inv[i - 1] = inv[i] * i % mod;
}

ll binom(ll n, ll m)
{
	return n < m ? 0 : fac[n] * inv[m] % mod * inv[n - m] % mod;
}

signed main()
{
	init();
	scanf("%lld %lld", &n, &m);
	rep(i, 0, n) (ans += binom(n, i) * binom(m, i) % mod * fac[i] % mod * power(m + 1, n - i) % mod * power(n + 1, m - i) % mod * power(mod - 1, i) % mod) %= mod;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 31488
#include <stdio.h>

char str[10001];
unsigned long long A, B;

void receive_input() {
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%llu %llu", &A, &B);
}

void initialize() {
	// nop
}

int main(void) {
	receive_input();
	initialize();

	printf("%llu\n", (B%A==0) ? (A+B) : (B-A));

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#define PI 3.141592653589793

/*double rad(double x)
{
	x* PI / 180.0;
};*/

int main()
{
	int a, b;
	scanf("%d%d", &a, &b);
	printf("%d\n", a * b);
	return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define I64 "%I64d"
#define RAN(v)v.begin(),v.end()
#define pb push_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
template<class T>
inline void upd1(T&a,T b){a>b?a=b:0;}
template<class T>
inline void upd2(T&a,T b){a<b?a=b:0;}
struct ano{
	operator ll(){
		ll x=0,y=0,c=getchar();
		while(c<48)
			y=c==45,c=getchar();
		while(c>47)
			x=x*10+c-48,c=getchar();
		return y?-x:x;
	}
}buf;
const int N=2e5+5;
char a[N];
int b[N];
bitset<1<<26>g;
map<int,int>f;
int main(){
	scanf("%s",a+1);
	int n=strlen(a+1);
	g[0]=1;
	for(int i=1;i<=n;++i){
		b[i]=b[i-1]^1<<a[i]-97;
		if(!g[b[i]]){
			g[b[i]]=1;
			f[b[i]]=n;
		}
		for(int j=0;j<26;++j)
			if(g[b[i]^1<<j])
				upd1(f[b[i]],f[b[i]^1<<j]+1);
	}
	printf("%d\n",b[n]?f[b[n]]:1);
}

Measured memory_bytes: 18304
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){

  string S, T;
  cin >> S >> T;

  int ans = 0;
  for(int i=0;i<3;i++){
    if(S[i]==T[i]) ans++;
  }
  cout << ans <<endl;
  
  return 0;
}



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

typedef long long ll;

const int MAXN = 410;
const ll INF = 1e14;

ll dp[MAXN][MAXN],V[MAXN],pref[MAXN];
int N;

ll calc(ll a,ll b){
	if(a > b) return INF;
	return pref[b] - pref[a-1];
}

ll solve(int ini,int fim){
	if(dp[ini][fim] != -1) return dp[ini][fim];
	if(ini == fim) return dp[ini][fim] = 0;
	if(ini + 1 == fim) return dp[ini][fim] = V[ini] + V[fim];

	ll best = INF;

	for(int i = ini;i<fim;i++){
		ll cand = solve(ini,i) + solve(i+1,fim) + calc(ini,fim);
		best = min(best,cand);
	}

	return dp[ini][fim] = best;

}

int main(){

	memset(dp,-1,sizeof(dp));

	cin >> N;
	for(int i = 1;i<=N;i++) cin >> V[i];

	for(int i = 1;i<=N;i++) pref[i] = pref[i-1] + V[i];

	cout << solve(1,N) << endl;

	return 0;

}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    vl a(n);
    ll mn = 10e9+1;
    REP(i,n){
        cin>>a[i];
        if(mn>a[i]) mn=a[i];
    }

    while(a.size()!=0){
        vl temp;
        REP(i,a.size()){
            if(a[i]%mn != 0){
                temp.emplace_back(a[i]%mn);
            }
        }

        sort(ALL(temp));
        temp.erase(unique(ALL(temp)), temp.end());

        if(temp.size()==0) break;

        temp.emplace_back(mn);
        mn = temp[0];
        a = temp;
    }

    cout << mn << endl;
    return 0;
}

Measured memory_bytes: 2168
# coding: utf-8

n = int(input())
h = list(map(int, input().split()))

counter = 0

while bool(h):
    for i in range(n):
        if not bool(h[0]): h = h[1:]; break
        h[i] -= 1
        try:
            if h[i + 1] == 0:
                counter += 1
                break
        except: counter += 1; break

print(counter)

Measured memory_bytes: 3060
n=int(input())
arr=list(map(int,input().strip().split()))
k=int(input())
d=dict()
for i in range(10**5+1):
    d[i]=0
for i in range(n):
    d[arr[i]]=d[arr[i]]+1
sumi=0
for i in range(n):
    sumi=sumi+arr[i]
for i in range(k):
    a,b=[int(a) for a in input().split()]
    e1=d[a]
    d[b]=d[b]+e1
    sumi=sumi+(e1)*(b-a)
    print(sumi)
    d[a]=0
    
    
    

    

Measured memory_bytes: 24416
import numpy as np
N, M = [int(x) for x in input().split()]
ok = np.zeros(N+2, np.int64)

for _ in range(M):
  l, r = [int(x) for x in input().split()]
  ok[l] += 1
  ok[r+1] -= 1

cum = np.cumsum(ok)
print(np.sum(cum==M))


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

int main()
{
	int t = 1;
	//cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		ll a[n], b[n], c[n];
		for(int i = 0; i < n; i++)
			cin >> a[i] >> b[i] >> c[i];
		ll dp0[n + 1], dp2[n + 1], dp1[n + 1];
		dp0[0] = 0; dp1[0] = 0; dp2[0] = 0;
		for(int i = 0;i < n; i++){
			dp0[i + 1] = max(dp1[i],dp2[i]) + a[i];
			dp1[i + 1] = max(dp0[i],dp2[i]) + b[i];
			dp2[i + 1] = max(dp0[i],dp1[i]) + c[i];
		}
		cout << max(dp0[n],max(dp1[n], dp2[n])) << endl;
	}
}	

Measured memory_bytes: 8320
n = int(input())
a = list(map(int, input().split()))
ans = 1
if (0 in a):
    ans = 0
else:
    for i in a:
        if i <= 1e18:
            t = ans * i
            if t <= 1e18:
                ans = t
            else:
                ans = -1
                break
        else:
            ans = -1
            break
print(ans)

Measured memory_bytes: 87784
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

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

using namespace std;
using ll = long long int;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//幅優先探索のテンプレ.デフォルトではstartからの距離を返す.
//graphは隣接リスト.startは探索開始地点
vector<int> bfs(vector<vector<int>> &graph, int start){
	queue<int> todo;
	vector<int> dist(graph.size(),-1);
	dist[start] = 0;
	todo.push(start);
	while(!todo.empty()){
		int now = todo.front();
		todo.pop();
		for (int i=0;i<graph[now].size();i++){
			int nxt = graph[now][i];
			if (dist[nxt] != -1) continue;
			dist[nxt] = dist[now] + 1;
			todo.push(nxt);
		}
	}
	return dist;
}

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	int ans = 0;
	rep(i, n / 2)
	{
		if (s[i] != s[n - i - 1])
			ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a; i<=b; ++i)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using vl=vector<ll>;
using vp=vector<pll>;
const ll INF=1e18;
const ll MOD=1e9+7;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    vp dot;
    cin>>n;
    FOR(i,1,n){
        ll x,y;
        cin>>x>>y;
        dot.eb(x,y);
    }
    sort(ALL(dot),[](pll& a,pll& b){
        return a.fi+a.se<b.fi+b.se;
    });
    ll a,b,c,d;
    tie(a,b)=dot.front();
    tie(c,d)=dot.back();
    ll ans=abs(a-c)+abs(b-d);
    sort(ALL(dot),[](pll& a,pll& b){
        return a.fi-a.se<b.fi-b.se;
    });
    tie(a,b)=dot.front();
    tie(c,d)=dot.back();
    cout<<max(ans,abs(a-c)+abs(b-d));
    return 0;
}

Measured memory_bytes: 7416
n = int(input())
a = list(map(lambda x: int(x) - 1, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum(b[a[i]] for i in range(n))
for i in range(n - 1):
    if a[i + 1] - a[i] == 1:
        ans += c[a[i]]
print(ans)


Measured memory_bytes: 9084
/*
ID:yaoxinw1
TASK:xxxx
LANG:C++
*/
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
int k,dist[100000];
deque<int>q;
int main()
{
	cin>>k;
	for(int i=0;i<k;i++)
	dist[i]=1000000005;
	dist[1]=1;
	q.push_back(1);
	while(q.size())
	{
		int x=q.front();q.pop_front();
		if(dist[(x*10)%k]>dist[x])
		dist[(x*10)%k]=dist[x],q.push_front((10*x)%k);
		if(dist[(x+1)%k]>dist[x]+1)
		dist[(x+1)%k]=dist[x]+1,q.push_back((x+1)%k);
	}
	cout<<dist[0];
	return 0;
}

Measured memory_bytes: 896
h,w = map(int,input().split())
s = [[j for j in input()] for i in range(h)]
for i in range(h):
  for p in range(w):
    if s[i][p] =='#':
      if (p-1) >= 0:
        if s[i][p-1] == '#':
          continue
      if (i-1) >= 0:
        if s[i-1][p] == '#':
          continue
      if (p+1) < w:
        if s[i][p+1] == '#':
          continue
      if (p-1) < h:
        if s[i+1][p] == '#':
          continue
      print("No")
      exit()
print("Yes")


Measured memory_bytes: 3064
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int A,B,K,S,res=0,tmp=0;


int main(){
    cout << fixed << setprecision(18);
    cin>>K>>S;
    for(long long int i = 0; i <= K; i++){
        for(long long int j = 0; j <= K; j++){
            if(S-i-j<=K&&S-i-j>=0){res++;}
        }
    }
    cout<<res<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int N;
    cin >> N;
    int res = 0;
    rep(i, 1, N+1) {
        int digit = 0;
        int n = i;
        while (n != 0) {
            digit++;
            n /= 10;
        }
        if (digit % 2 == 1) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  ll n;
  cin >> n;
  if(n%2==1){
    cout << "0" << endl;
  } else{
    ll ans=0;
    ll five=10;
    while(n>=five){
      ans+=n/five;
      five*=5;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3544
#include <iostream>

using namespace std;

int main(void){

        int n;

        cin >> n;

        do{
                int count = 0;
                int sum = 0;
                for(int i = 1; i <= n/2; i++){
                        sum = i;
                        for(int j = i+1; sum <= n; j++){
                                sum += j;
                                if(sum == n){
                                        count++;
                                        break;
                                }
                        }
                }
                cout << count << endl;
                cin >> n;
        }while(n != 0);

        return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>
#include <iostream>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <algorithm>
#include <math.h>
#include <queue>
#include <vector>
#include <string.h>
#define mem(x,b) memset(x,b,sizeof(x))
#define mp(a,b) make_pair(a,b)
#define debug(a) cout<<a<<endl
#define maxn 100005
#define def 2000000000
using namespace std;
typedef long long ll;
typedef double db;
const int mod=1e9+7;
std::vector<int> G[maxn];
int vis[maxn];
int dis[maxn];
void bfs(){
	queue<int>q;
	q.push(1);
	int t=2;
	while(!q.empty()){
		int fa=q.front();
		q.pop();
		for(int i=0;i<G[fa].size();i++){
			if(!vis[G[fa][i]]){
				dis[G[fa][i]]=fa;
				vis[G[fa][i]]=1;
				q.push(G[fa][i]);
			}
		}
	}
}
int main()
{
    int n,m,a,b;scanf("%d%d",&n,&m);
    for(int i=2;i<=n;i++){
    	dis[i]=def;
    }
    for(int i=0;i<m;i++){
    	scanf("%d%d",&a,&b);
    	G[a].push_back(b);
    	G[b].push_back(a);
    }
    bfs();
    int flag=1;
    for(int i=2;i<=n;i++){
    	if(dis[i]==2e9){
    		flag=0;
    	}
    }
    if(flag){
    	puts("Yes");
    	for(int i=2;i<=n;i++){
    		printf("%d\n",dis[i]);
    	}
    }else{
    	puts("No");
    }
    return 0;
}


Measured memory_bytes: 10960
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include <cstdlib>
#include <cstdio>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
const int maxV = 1e5;
const int NIL = -1;


struct Node{
    int parent, leftc, rightb;
};

void printChild(Node u, Node T[], int n){
    cout << "[";
    if (u.leftc == NIL);
    else{
        int c = u.leftc;
        cout << c;
        c = T[c].rightb;
        while (c != NIL){
            cout << ", " << c;
            c = T[c].rightb;
        }
    }
    cout << "]";
}

int getDepth(int id, Node T[], int n){
    int now = T[id].parent;
    int depth = 0;
    while (now != NIL){
        ++depth;
        now = T[now].parent;
    }
    return depth;
}
void printType(int id, Node T[], int n){
    if (T[id].parent == NIL) cout << "root, ";
    else if (T[id].leftc == NIL) cout << "leaf, ";
    else cout << "internal node, ";
}


int main(){
    int n;
    cin >> n;
    Node T[n];
    rep(i,n) T[i].parent = T[i].leftc = T[i].rightb = NIL;
    int id,k;
    rep(i,n){
        cin >> id >> k;
        int child[k];
        rep(j,k){
            cin >> child[j];
            T[child[j]].parent = id;
        }
        rep(j,k-1){
            T[child[j]].rightb = child[j+1];
        }
        if (k > 0) T[id].leftc = child[0];
    }
    rep(i,n){
        cout << "node " << i << ": ";
        cout << "parent = " << T[i].parent << ", ";
        cout << "depth = " << getDepth(i,T,n) << ", ";
        printType(i,T,n);
        printChild(T[i],T,n); cout << endl;
    }

    return 0;
}



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

template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int a, b;

int main(){
    cin >> a >> b;
    if(a < b){
        rep(i, b){
            cout << a;
        }
        cout << endl;
    }
    else{
        rep(i, a){
            cout << b;
        }
        cout << endl;
    }
}

Measured memory_bytes: 3624
#include <stdio.h>

main(){
  int i,A[251],h,n,p;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i/2 >= 1) printf("parent key = %d, ",A[i/2]);
    if(2*i <= n) printf("left key = %d, ",A[2*i]);
    if(2*i+1 <= n) printf("right key = %d, ",A[2*i+1]);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
import numpy as np
import itertools

n, m = map(int, input().split())
G = np.zeros((n, n), dtype = np.int64)
for i in range(m):
    u, v = map(int, input().split())
    G[u - 1][v - 1] = 1
    G[v - 1][u - 1] = 1

ans = 0
nums = [i for i in range(1, n)]
for perm in itertools.permutations(nums):
    path = [0] + list(perm)
    ok = True
    for i in range(n - 1):
        if G[path[i]][path[i + 1]] != 1:
            ok = False
            break
    ans += ok
print(ans)

Measured memory_bytes: 12496
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define for(i,a,b) for(int i=a;i<b;i++)
#define sort(a,b) sort(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
 
int main() {
  ll a;
  ci(a);
  vec b(a);
  for(i,0,a)
    ci(b[i]);
  ll c=0;
  for(i,0,a)
    for(j,0,a)
      c=max(c,abs(b[i]-b[j]));
  co(c);
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int n;
	cin >> n;
	map<int, int> hoge;
	REP(i, n) {
		int a;
		cin >> a;
		hoge[a]++;
	}
	int ans = 0;
	for(int i = 0;i <= 100000;++i){
		ans = max(hoge[i] + hoge[i + 1] + hoge[i + 2],ans);

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

Measured memory_bytes: 4992
#include <bits/stdc++.h>
typedef unsigned ui;
constexpr ui N(3e5+1);
ui tree[N];
ui q(ui i)
{
	ui ans(0);
	for(;i;i&=i-1)
		ans+=tree[i];
	return ans;
}
void add(ui i)
{
	for(;i<N;i+=i&-i)
		++tree[i];
	return;
}
signed main(void)
{
	ui n;
	scanf("%u",&n);
	static ui a[N];
	for(ui i(1);i<=n;++i)
		scanf("%u",a+i);
	long long unsigned ans1(0),ans2(0);
	for(ui i(n);i;--i)
		ans1+=q(a[i]),add(a[i]);
	memset(tree,0,sizeof(tree));
	for(ui i(n);i&&~i;i-=2)
		ans2+=q(a[i]),add(a[i]);
	memset(tree,0,sizeof(tree));
	for(ui i(n-1);i&&~i;i-=2)
		ans2+=q(a[i]),add(a[i]);
	puts(ans1==3*ans2?"Yes":"No");
	return 0;
}

Measured memory_bytes: 2560
n,*t=map(int,open(0).read().split())
e=[[]for _ in range(n)]
d=[]
for a,b in zip(*[iter(t)]*2):
    e[a-1]+=b-1,
    e[b-1]+=a-1,
    d+=(a-1,b-1),
s=[(0,0)]
f=[1]+[0]*n
dic=dict()
while s:
    v,color=s.pop()
    i=0
    for w in e[v]:
        if f[w]:continue
        f[w]=1
        i+=1
        if i==color:i+=1
        s+=(w,i),
        dic[v,w]=i
ans=[]
for a,b in d:
    if (a,b)in dic:
        ans+=dic[a,b],
    else:
        ans+=dic[b,a],
print(max(ans))
for t in ans:print(t)

Measured memory_bytes: 106512
sx, sy, tx, ty = [int(_) for _ in input().split(' ')]
dx = tx - sx
dy = ty - sy
answer = 'R' * dx + 'U' * dy + 'L' * dx + 'D' * dy
answer += 'D' + 'R' * (dx + 1) + 'U' * (dy + 1) + 'L'
answer += 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R'
print(answer)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
static const int MAX = 200000;

int main(int argc, char *argv[])
{
  int R[MAX], n;

  cin >> n;

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

  int maxv = -2000000000;
  int minv = R[0];

  for (int i = 1; i < n; i++)
  {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  std::cout << maxv << std::endl;

  return 0;
}

Measured memory_bytes: 1940
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

A,B=LI()
print(A*B//gcd(A,B))


Measured memory_bytes: 3064
n, m = gets.split.map(&:to_i)
edges = []
m.times { edges << gets.chomp.split.map(&:to_i) }
graph = Array.new(n + 1) { Array.new }
edges.each do |from, to|
  graph[from] << to
  graph[to] << from
end
belongs_to = Array.new(n)
n.times do |from|
  next if belongs_to[from]
  belongs_to[from] = from
  queue = [from]
  until queue.empty?
    current = queue.shift
    graph[current].each do |to|
      next if belongs_to[to]
      belongs_to[to] = from
      queue << to
    end
  end
end
puts belongs_to.tally.values.max


Measured memory_bytes: 41264
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    ll N, X, ans = 0;
    cin >> N >> X;
    vll A(N), S(N);
    rep(i, N)
    {
        cin >> A[i];
        if (i == 0 and A[i]>X)
        {
            ans+=A[i]-X;
            A[i]=X;
                }
        if (i > 0 and A[i] + A[i - 1] > X)
        {
            ans += A[i] + A[i - 1] - X;
            A[i] = X - A[i - 1];
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<(n);i++)
int inf = 1000000000;
ll INF = 1000000000000000000;
int main() {
	string s;
	cin >> s;
	if (s[0] == s[s.size() - 1]) {
		if (s.size() % 2)cout << "Second" << endl;
		else cout << "First" << endl;
	}
	else {
		if (s.size() % 2)cout << "First" << endl;
		else cout << "Second" << endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <map>

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

        map<string, int> result;
        for (int i = 0; i < n; i++) {
                string s;
                cin >> s;
                result[s] += 1;
        }

        cin >> m;
        for (int i = 0; i < m; i++) {
                string s;
                cin >> s;
                result[s] -= 1;
        }

        //for (auto itr = nmap.begin(); itr != nmap.end(); itr++) {
        //      cout << "key = " << itr->first << ",val = " << itr->second << endl;
        //}

        int max = 0;
        for (auto itr = result.begin(); itr != result.end(); itr++) {
                if (max < itr->second) {
                        max = itr->second;
                }
        }

        cout << max;

        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
 
int main() {
  int n;
  cin>>n;
  int a[n];
  rep(i,n){
    int j;
    cin>>j;
    a[j-1]=i+1;
  }
  rep(i,n){
    cout<<a[i]<<" ";
  }


}
 
    
 

Measured memory_bytes: 1152
import java.util.Scanner;

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

        while (true) {
            H = sc.nextInt();
            W = sc.nextInt();
            if (H == 0 && W == 0) break;
            for (int i = 0; i < H; i++) {
                if (i == 0 || i == H - 1) {
                    for (int j = 0; j < W; j++) {
                        System.out.print("#");
                    }
                    System.out.println();
                } else {
                    for (int j = 0; j < W; j++) {
                        if (j == 0 || j == W - 1) {
                            System.out.print("#");
                        } else {
                            System.out.print(".");
                        }
                    }
                    System.out.println();
                }
            }
            System.out.println();
        }
    }
}


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

using namespace std;

class DisjointSet {
public:
	vector<int> rank, p;

	DisjointSet(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++)makeSet(i);
	}

	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}

	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}

	void unnite(int x, int y) {
		link(findSet(x), findSet(y));
	}

	void link(int x, int y) {
		if (rank[x] > rank[y]) {
			p[y] = x;
		}
		else {
			p[x] = y;
			if (rank[x] == rank[y]) {
				rank[y]++;
			}
		}
	}

	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}
		return p[x];
	}
};

int main() {
	int n, a, b, q;
	int t;

	cin >> n >> q;
	DisjointSet ds = DisjointSet(n);

	for (int i = 0; i < q; i++) {
		cin >> t >> a >> b;
		if (t == 0)ds.unnite(a, b);
		else if (t == 1) {
			if (ds.same(a, b))cout << 1 << endl;
			else cout << 0 << endl;
		}
	}

	return 0;
}


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

int main( void )
{
    int n;

    while ( cin >> n && n != 0 )
    {
        vector <int> I( n, 0 );
        vector <int> L( n, 0 );

        for ( int i = 0; i < n; i++ )
        {
            int p, d1, d2;
            cin >> p >> d1 >> d2;
            I[i] = p;
            L[i] = d1 + d2;
        }

        int maxNo = -1;
        int maxL = 0;
        for ( int i = 0; i < n; i++ )
        {
            if ( i == 0 )
            {
                maxNo   = I[i];
                maxL    = L[i];
            }
            else if ( L[i] > maxL )
            {
                maxNo   = I[i];
                maxL    = L[i];
            }
        }

        cout << maxNo << " " << maxL << endl;
    }

    return 0;
}

Measured memory_bytes: 980
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a = 0, b = 0, c = 0;

		for(int i = 0 ; i < 10; i++){
			String str = br.readLine();
			int input = Integer.parseInt(str);
			if(input > a){
				c = b;
				b = a;
				a = input;
				continue;
			}
			if(input > b){
				c = b;
				b = input;
				continue;
			}
			if(input > c){
				c = input;
				continue;
			}
		}

		System.out.println(a);
		System.out.println(b);
		System.out.println(c);
	}
}

Measured memory_bytes: 16864
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define INF 0x3f3f3f3f
#define INFll 0x3f3f3f3f3f3f3f3f
#define y0 _lxybz_
#define y1 _ljmnzyzhhhoscartxdy_
typedef long double ld;
typedef long long ll;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
#define lo(x) ((x)&(-(x)))
#define trav(a, x) for (auto &a : x)
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
const ld Pi = 4*atan((ld)1);
template<class T> void chmin(T &a,const T&b) { a = min(a, b); }
template<class T> void chmax(T &a,const T&b) { a = max(a, b); }
namespace IO{
template<class T> inline void read(T&ret)
{
	ret=0; int f=1; char c=getchar();
	while(c<48||c>57){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	ret*=f;
}
template<class T> inline void prin(const T&ret)
{
	if(!ret){putchar(48);return;} static T o; o=ret;
	if(o<0){putchar('-');o=-o;}
	static int op[25],tt; tt=0;
	while(o){
		op[++tt]=o%10;
		o/=10;
	}
	for(int i=tt;i;--i)putchar(op[i]+48);
}
template<class T> inline void pri_(const T&ret)
{
	prin(ret);putchar(' ');
}
template<class T> inline void priE(const T&ret)
{
	prin(ret);putchar('\n');
}
}
using namespace IO;

#define N 
#define MO 

inline void _Sol_()
{
	int h,a;
	read(h);read(a);
	prin((h+a-1)/a);
}

int main()
{
	int T=1; //read(T);
	while(T--)_Sol_();
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!{
        k: chars,
        d: usize
    }
    let m = 1000000007;
    let n = k.len();
    let mut tab: Vec<Vec<usize>> = vec![vec![0; d]; n];
    tab[0][0] = 1;
    for i in 1..n {
        let mut t: usize = 0;
        for j in 0..10 {
            t += tab[i - 1][(11 * d - 1 - j) % d];
        }
        for j in 0..d {
            t = t + tab[i - 1][j] - tab[i - 1][(j + 10 * d - 10) % d];
            tab[i][j] = t % m;
        }
    }
    let mut s = 0;
    let mut ans: usize = 0;
    for i in 0..n {
        let c = k[i].to_digit(10u32).unwrap() as usize;
        let mut t = 0;
        for j in 0..c {
            t += tab[n - 1 - i][(11 * d - s - j) % d];
        }
        ans = (ans + t) % m;
        s = (s + c) % d;
    }
    if s == 0 {
        ans += 1;
    }
    println!("{}", (ans + m - 1) % m);
}


Measured memory_bytes: 12540