akhauriyash/Code-Regression huggingface dataset:
# B - Shift only
N = int(input())
A = list(map(int,input().split()))

def div2(x):
    ans = 0
    while x%2==0:
        x //= 2
        ans += 1
    return ans

ans = 10000
for a in A:
    ans = min(ans, div2(a))
print(ans)

Measured memory_bytes: 62780
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
As = []
for _ in range(N):
    A = map(int, input().split())
    As.append(A)

count = 0
for A in As:
    A = list(A)
    mapped = list(map(lambda x: x[0]*x[1], zip(A, B)))
    result = sum(mapped) + C
    cond = result > 0
    count = count+1 if cond else count
print(count)


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

const int N = 60;

pair <int, int> a[N], b[N];
 
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
  	scanf("%d %d", &a[i].first, &a[i].second);
  }
  for (int i = 0; i < m; i++) {
  	scanf("%d %d", &b[i].first, &b[i].second);
  }
  for (int i = 0; i < n; i++) {
  	int res = 1e9;
  	int idx = 0;
  	for (int j = 0; j < m; j++) {
			int dist = abs(a[i].first - b[j].first) + abs(a[i].second - b[j].second);
			if (dist < res) {
				res = dist;
				idx = j;
			}  		
  	}
  	printf("%d\n", idx + 1);
  }
	return 0;
}

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

typedef long long ll;
using namespace std;

int main(){
  ll x,a;
  cin >> x;
  a=(x-(x%11))/11;
  if(x%11>6){
  	cout << 2+a*2 << endl;
  }
  else if(x%11==0){
  	cout << a*2 << endl;
  }
  else{
  	cout << a*2+1 << endl;
  }
  return 0;
}



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

int main() {
    int H, W;
    char s[60][60];
    int dx[4] = {1, -1, 0, 0};
    int dy[4] = {0, 0, 1 ,-1};
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        scanf("%s", &s[i]);
    }

    bool can = true;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (s[i][j] == '#'){
                bool found = false;
                for (int k = 0; k < 4; k++) {
                    int i2 = i + dx[k];
                    int j2 = j + dy[k];
                    if (i2 >= 0 && i2 < H && j2 >= 0 && j2 < W && s[i2][j2] ==  '#') {
                        found = true;
                    }
                }
                if (!found) can = false;
            }
        }
    }
    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

int n, k;
ll dp[110][100005];

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

    cin >> n >> k;
    vector<int> a(n+1, 0);
    vector<ll> cum(k+5, 0);
    repr(i, 1, n+1) cin >> a[i];
    dp[0][0] = 1;
    
    repr(i, 1, n+1){
        rep(j, k+1) { cum[j] = dp[i-1][j] + (j==0? 0:cum[j-1]); chmod(cum[j]); }
        rep(j, k+1) { dp[i][j] = cum[j] - (j-a[i]-1<0? 0:cum[j-a[i]-1]); chmod(dp[i][j]); }
    }
    cout << dp[n][k] << endl;

    return 0;
}

Measured memory_bytes: 80128
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	string S;
	cin>>N>>S;

	int ans=0;
	rep(i,0,1000)
	{
		char ts[3];
		ts[0]='0'+i/100,ts[1]='0'+(i/10)%10,ts[2]='0'+i%10;
		int p=0;
		rep(j,0,SZ(S))
		{
			if(p==3)continue;
			if(S[j]==ts[p])p++;
		}
		if(p==3)
		{
			ans++;
		}
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, combinations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from operator import itemgetter
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7
DEBUG = 'ONLINE_JUDGE' not in sys.argv

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'

def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)

def main():
    N=ii()
    A=lmis()
    ans = 0
    for i in range(1, N):
        if A[i-1] > A[i]:
            ans += A[i-1] - A[i]
            A[i] = A[i-1]
    print(ans)









main()



Measured memory_bytes: 33868
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll a,b;cin>>a>>b;
    ll c=gcd(a,b);
    ll ans=1;
    for(;;){
        if(c==1)break;
        ll y=0;
        for(ll i=2;i*i<=c;i++){
            if(c%i==0){
                ans++;
                y=1;
                while(c%i==0)c/=i;
                
            }
        }
        if(y==0){
            ans++;
            break;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
const int maxn=2e5+5;
const ll inf=1e18;
int n,q,O;
int x[maxn];
ll mini[4][maxn<<2],tag[maxn<<2];
void A(int x,ll num){
	rep(i,1,3)mini[i][x]+=num;
	tag[x]+=num;
}
void PD(int x){
	if(!tag[x])return;
	A(ls,tag[x]);
	A(rs,tag[x]);
	tag[x]=0;
}
void U(int x){
	rep(i,1,3)mini[i][x]=min(mini[i][ls],mini[i][rs]);
}
void B(int x,int l,int r){
	rep(i,1,3)mini[i][x]=inf;
	if(l==r)return;
	B(ls,l,mid);
	B(rs,mid+1,r);
}
void upd(ll &x,ll y){
	x=min(x,y);
}
void M(int x,int pos,ll num){
	upd(mini[1][x],num-pos);
	upd(mini[2][x],num);
	upd(mini[3][x],num+pos);
}
void M(int x,int l,int r,int pos,ll num){
	if(l==r){
		M(x,l,num);
		return;
	}
	PD(x);
	if(pos<=mid)M(ls,l,mid,pos,num);
	else M(rs,mid+1,r,pos,num);
	U(x);
}
ll Q(int x,int l,int r,int ll,int rr,int id){
	if(l==ll&&r==rr)return mini[id][x];
	PD(x);
	if(rr<=mid)return Q(ls,l,mid,ll,rr,id);
	if(ll>mid)return Q(rs,mid+1,r,ll,rr,id);
	return min(Q(ls,l,mid,ll,mid,id),Q(rs,mid+1,r,mid+1,rr,id));
}
int main(){
	read(n);read(q);read(O);
	rep(i,0,q)read(x[i]);
	B(1,1,n);
	M(1,1,n,O,0);
	rep(i,1,q){
		ll lastmin=min(Q(1,1,n,1,x[i],1)+x[i],Q(1,1,n,x[i],n,3)-x[i]);
		A(1,abs(x[i]-x[i-1]));
		M(1,1,n,x[i-1],lastmin);
	}
	printf("%lld\n",Q(1,1,n,1,n,2));
	return 0;
}

Measured memory_bytes: 25600
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  string s,t;
  cin>>s>>t;
  vi vs[26],vt[26];
  rep(i,s.length()){
    int a=s[i]-'a';
    vs[a].pb(i);
  }
  rep(i,t.length()){
    int a=t[i]-'a';
    vt[a].pb(i);
  }  
  rep(i,26){
    if(vs[i].empty()) continue;
    bool ok=false;
    rep(j,26){
      if(vs[i]==vt[j]) ok=true; 
    }
    if(!ok){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;

  return 0;
}


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

int main()
{
    string S, T;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    string U;
    cin >> U;

    if (S == U) A--;
    else B--;

    cout << A << " " << B << endl;
    return 0;
}

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

int main(void) {
	string str[3];
	int pos[3];
	int len[3];
	const string swin[] = { "A", "B", "C" };

	for (int i = 0; i < 3; ++i) {
		cin >> str[i];
		len[i] = str[i].length() - 1;
		pos[i] = 0;
	}

	int turn = 0;
	while (true) {
		if (pos[turn] > len[turn])
			break;
		int nxt = (int)(str[turn][pos[turn]] - 'a');
		++pos[turn];
		turn = nxt;
	}

	cout << swin[turn] << '\n';
	return 0;
}


Measured memory_bytes: 256
A= [[ [] for i in range(31)] for j in range (31)]
A[1][1]=["1"]
for i in range(2,31):
    A[i][i]=[str(i)]
    for j in range(1,i+1):
        for k in range(1,j+1):
            for a in A[i-j][k]:
                A[i][j].append( " ".join( [str(j), a] ))
while(1):
    n=int(raw_input())
    if n==0: break
    for p in reversed(A[n][1:n+1]):
        for q in reversed(p):
            print q

Measured memory_bytes: 8116
#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e9 + 7;

int fact[202020];
int factinv[202020];

int modpow(int a, int n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        int t = modpow(a, n / 2);
        return 1ll * t * t % MOD;
    }
    return 1ll * a * modpow(a, n - 1) % MOD;
}

void init() {
    fact[0] = 1;
    for (int i = 1; i < 202020; i++) {
        fact[i] = 1ll * fact[i - 1] * i % MOD;
    }
    factinv[202020 - 1] = modpow(fact[202020 - 1], MOD - 2);
    for (int i = 202020 - 2; i >= 0; i--) {
        factinv[i] = 1ll * factinv[i + 1] * (i + 1) % MOD;
    }
    assert(factinv[0] == 1);
}

int ncr(int n, int r) {
    return 1ll * fact[n] * factinv[r] % MOD * factinv[n - r] % MOD;
}

inline void add(int& a, int b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

inline void sub(int& a, int b) {
    a -= b;
    if (a < 0) a += MOD;
}

int main() {
    init();
    int h, w, n;
    cin >> h >> w >> n;
    vector<pair<int, int>> bs;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        bs.emplace_back(a, b);
    }
    bs.emplace_back(0, 0);
    n++;
    sort(bs.begin(), bs.end());
    // dp[i][j]: i番目までj(偶奇)個通るときの場合の数
    int dp[3030][2] = {};
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int k = 0; k < 2; k++) {
            for (int j = i + 1; j < n; j++) {
                if (bs[j].first >= bs[i].first && bs[j].second >= bs[i].second) {
                    add(dp[j][!k], 1ll * dp[i][k] * ncr(bs[j].first + bs[j].second - bs[i].first - bs[i].second, bs[j].first - bs[i].first) % MOD);
                }
            }   
        }
    }
    int ans = ncr(h + w - 2, h - 1);
    for (int i = 1; i < n; i++) {
        for (int k = 0; k < 2; k++) {
            if (k) {
                sub(ans, 1ll * dp[i][k] * ncr(h - 1 - bs[i].first + w - 1 - bs[i].second, h - 1 - bs[i].first) % MOD);
            } else {
                add(ans, 1ll * dp[i][k] * ncr(h - 1 - bs[i].first + w - 1 - bs[i].second, h - 1 - bs[i].first) % MOD);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1920
import bisect

N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))

data = []
i = 0

while i < len(A):
    x = A[i]
    a = bisect.bisect_left(A, x)
    b = bisect.bisect_right(A, x)
    data.append([x, b - a])
    i = b
    
data = sorted(data, key = lambda x: x[1])
m = len(data) - K
ans = 0

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

Measured memory_bytes: 35488
#include<bits/stdc++.h>
#define lint long long
#define st first
#define nd second
#define INF 0x3f3f3f3f

using namespace std;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	string s;
	cin>>s;
	lint sum = 0;
	for(char &c:s){
		sum += c-'0';
	}
	cout<<(sum%9 ? "No" : "Yes")<<"\n";

	return 0;	
}


Measured memory_bytes: 3756
str = list(input())

a = []
all = 0
areas = []
for i in range(len(str)):
    if str[i] == "\\":
        a.append(i)
    elif str[i] == "/" and len(a) > 0:
        j = a.pop()
        b = i - j
        all += b
        while(len(areas) > 0 and areas[-1][0] > j):
            b += areas.pop()[1]
        areas.append([j, b])

print(int(all))
if len(areas) > 0:
    print(len(areas), *[areas[i][1] for i in range(len(areas))])
else:
    print(0)




Measured memory_bytes: 6480
//In the name of ALLAH the most merciful the most beneficial

#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back

using namespace std;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = 1e8;
static const int INF = 0x3f3f3f3f;
static const int MOD = 998244353;



int main(){
    string s;
    cin >> s;
    cout << count(s.begin(),s.end(),'2');
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 100010;

int n;

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif

  scanf("%d", &n);
  vector<int> dp(3);
  for (int i = 1; i <= n; ++i) {
    vector<int> x(3);
    for (int j = 0; j < 3; ++j)
      scanf("%d", &x[j]);
    vector<int> new_dp(3);
    for (int j = 0; j < 3; ++j)
      for (int k = 0; k < 3; ++k)
        if (j != k)
          new_dp[k] = max(new_dp[k], dp[j] + x[k]);
    dp = new_dp;
  }
  printf("%d\n", *max_element(dp.begin(), dp.end()));

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  sort(a.begin(),a.end(),greater<int>());
  ll ans=a[0];
  rep(i,n-2){
    ans+=a[(i+2)/2];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4044
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#define nmax_def 110000
#define Cmax_def 2200
#define mod 1000000007
using namespace std;
typedef long long ll;

int main() {
	ll i, j;
	ll N, p[nmax_def];
	cin >> N;
	for (i = 0; i < N; i++)
		cin >> p[i];
	bool can = 1;
	bool ans = 1;
	for (i = 0; i < N; i++)
	{
		if (p[i] != i+1)
		{
			if (can)
			{
				can = 0;
				if (p[p[i] - 1] == i + 1)
					swap(p[i], p[p[i] - 1]);
				else
					ans = 0;
			}
			else
				ans = 0;
		}
	}
	string ansans = (ans) ? "YES" : "NO";
	cout << ansans << endl;
	return 0;
}

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

int main(void)
{
	long long n, q;
	cin >> n >> q;
	vector<priority_queue<long long> >res(n);
	while (q--)
	{
		int op;
		cin >> op;
		if (op == 0)
		{
			long long t, x;
			cin >> t >> x;
			res[t].push(x);
		}
		else if (op == 1)
		{
			long long t;
			cin >> t;
			if (!res[t].empty())
				cout << res[t].top() << endl;
		}
		else if (op == 2)
		{
			long long t;
			cin >> t;
			if (!res[t].empty())
				res[t].pop();
		}
	}
	return 0;
}


Measured memory_bytes: 5048
#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
using namespace std;
using ll = long long;

const long double PI = acos(-1.0);
const int MOD = 1e9 + 7;

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

    vector<int> f(n + 1);

    for(ll i = 1; i <= n; i++) {
        ll num = i;
        while(num <= n) {
            f[num]++;
            num += i;
        }
    }

    ll ans = 0;
    for(ll i = 1; i <= n; i++) ans += f[i] * i;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 42324
n, m, q = map(int, input().split())
x = [tuple(map(int, input().split())) for _ in range(m)]
y = [tuple(map(int, input().split())) for _ in range(q)]

table = [[0]*n for _ in range(n)]

for i, j in x:
    table[i-1][j-1] += 1

for i in range(n):
    for j in range(1, n):
        table[i][j] += table[i][j-1]

for i in range(n-1, 0, -1):
    for j in range(n):
        table[i-1][j] += table[i][j]

for i, j in y:
    print(table[i-1][j-1])



Measured memory_bytes: 40352
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+50,inf=1e9;
inline int gi() {
  char ch=getchar(); int q=0,x=0;
  while(ch<'0'||ch>'9') q=(ch=='-'?1:q),ch=getchar();
  while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
  return q?(-x):x;
}
int a[N],b[N];
int check(int l,int r){
  if (l>r) return 0;
  if (l==r) return a[l]!=l;
  int mn=inf,mx=0;
  for (int i=l; i<=r; ++i)
    mn=min(mn,a[i]),mx=max(mx,a[i]);
  if (mn!=l||mx!=r) return 1;
  for (int i=l+1; i<=r; i+=2)
    if (a[i]!=i) return 1;
  for (int i=l; i<=r; i+=2)
    if (a[i]==i) return 1;
  mn=0,mx=0;
  for (int i=l; i<=r; ++i){
    if (a[i]<i){
      if (a[i]<mn) return 1;
      mn=a[i];
    }
    if (a[i]>i){
      if (a[i]<mx) return 1;
      mx=a[i];
    }
  }
  return 0;
}
int main(){
  int n=gi();
  for (int i=1; i<=n; ++i)
    a[i]=gi(),b[i]=(a[i]==i);
  int las=1;
  b[0]=1;
  for (int i=1; i<=n; ++i)
    if (b[i]){
      if (b[i-1]){
	if (check(las,i-2))
	  return puts("No"),0;
	las=i+1;
      }
      else if (b[i-2]) continue;
      else if (b[i-3]){
	if (check(las,i-2))
	  return puts("No"),0;
	las=i-1;
      }
      else return puts("No"),0;
    }
  if (check(las,n))
    return puts("No"),0;
  else
    return puts("Yes"),0;
  return 0;
}

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


int year(int a,int b,int c)
{
	int day=0;
	int i;
	for(i=1;i<a;i++){
		if(i%3==0){day+=+200;}
		else{day+=195;}
	}
	for(i=1;i<b;i++){
		if(a%3!=0){
			if(i%2==0){day+=19;}
			else{day+=20;}
		}else{day+=20;}
	}
	for(i=1;i<=c;i++){day++;}
	return day;
}

int main()
{
	int n;
	int a,b,c;
	int i;

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%d %d %d",&a,&b,&c);
		printf("%d\n",year(1000,1,1)-year(a,b,c));
	}

	return 0;
}

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

int main(){
    ll n,m;
    cin >> n >> m;
    ll a[n];
    ll b[n+1];
    b[0]=0;
    map<ll,ll> mp;
    for(ll i=0;i<n;i++){
        cin >> a[i];
        b[i+1]=b[i]+a[i];
        b[i+1]%=m;
    }
    for(ll i=0;i<=n;i++){
        mp[b[i]]++;
    }
    ll res=0;
    for(auto p:mp){
        res+=p.second*(p.second-1)/2;
    }
    cout << res << endl;
}


Measured memory_bytes: 9100
#include<iostream>

namespace Arrenged
{
class vector{
public:
	void push_back(int x);
	int  size();
	int& operator[](int n);
	vector();
	~vector();
//	vector(const vector& X);
private:
	int  Size;
	int* A;
};
	int& vector::operator[](int n)
	{
		return A[n];
	}
	
	vector::vector()
	{
		A = NULL;
		Size = 0;
	}
	
	vector::~vector()
	{
		if(A) delete[] A;
	}
	
// 	vector::vector(const vector& X)
// 	{
// 		Size = X.Size;
// 		A = new int[X.Size];
// 		for(int i = 0; i < X.Size; i++){
// 			A[i] = X.A[i];
// 		}
// 	}
	
	void vector::push_back(int x)
	{
		int* B = A;
		A = new int[Size+1];
		for(int i = 0; i < Size; i++){
			A[i] = B[i];
		}
		A[Size] = x;
		Size++;
		delete[] B;
	}
	
	int  vector::size()
	{
		return Size;
	}
	
}//Arrenged????????????

using namespace Arrenged;
void Sort(vector &A, int i){
    int j = i - 1;
    while(j >= 0 && A[j] > A[j+1]){
        int v = A[j+1];
        A[j+1] = A[j];
        A[j] = v;
        j--;
    }
}
 
int main(){
    int N;
    std::cin >> N;
    vector A;
    for(int i = 0; i < N; i++){
        int a;
        std::cin >> a;
        A.push_back(a);
//        std::cout << i;
    }
    for(int i = 0; i < N; i++){
        Sort(A, i);
        for(int j = 0; j < N-1; j++) std::cout << A[j] << ' ';
        std::cout << A[N-1] << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <random>
#include <string.h>      //文字列の代入に使う
#include <bits/stdc++.h> //piの利用で必要(M_PI)
#include <algorithm>

int main()
{

    double L;
    std::cin >> L;
    std::cout << std::fixed;
    std::cout << std::setprecision(6) << std::pow(L / 3, 3) << std::endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
if n%2==1:
  print(0)
  exit()

i=0
while 1:
  if (5**(i+1))*2<=n:
    i+=1
  else:
    break
ans=0

for j in range(i):
  ans+=n//(2*(5**(j+1)))

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
using namespace std;

int main(int argc, char const* argv[])
{
    int length;
    int a[10000];
    int divisor = 0;
    cin >> length;
    for(int i = 0; i < length; i++){
        cin >> a[i];
    }
    for(int i = 0; i < length; i++){
        if (a[i]%2 == 0) {
            int target = a[i];
            while (target % 2 == 0) {
                divisor++;
                target = target / 2;
            }
        }
    }
    cout << divisor << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
   int N, M;
   int A[M];
   int count = 0;

   scanf("%d %d", &N, &M);

   for(int i = 0; i < M; i++) {
      scanf("%d", &A[i]);
      count += A[i];
   }

   if(count > N) {
      printf("-1\n");

   }else {
      printf("%d\n", N - count);

   }
   return 0;
}


Measured memory_bytes: 1756
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list> 
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<fstream>
#include<set>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define B begin()
#define E end()
#define S size()
#define m9 1000000007
#define endl "\n"
using namespace std;
 
 

 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powmod(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = powmod(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 

 
ll mul_inv(ll a, ll b) {
    ll b0 = b, t, q;
    ll x0 = 0ll, x1 = 1ll;
    if (b == 1ll) return 1ll;
    while (a > 1ll) {
        q = a / b;
        t = b, b = a % b, a = t;
        t = x0, x0 = x1 - q * x0, x1 = t;
    }
    if (x1 < 0ll) x1 += b0;
    return x1;
}
 
 
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pin(a) for(auto x:a)cout<<x<<" ";cout<<endl
#define fck(a) cout<<a;exit(0)
#define vvll vector<vector<ll> >
#define A(b) b.begin(),b.end()
#define vpi std::vector<pll>
#include <array>
#include <stack>
#define arr2 array<ll,2>
#define arr3 array<ll,3>
#define varr2 vector<array<ll,2> >
#define varr3 vector<array<ll,3> >
//include<bits/stdc++.h>
 
 
bool fa(vll &x,vll &y){return x[0]<y[0];}
bool fa1(vll &x,vll &y){return x[1]<y[1];}
bool f1(pll &x,pll &y){return x.second>y.second;}
bool f2(pll &x,pll &y){
    return x.first>y.first;
}
 
 
bool f3(ll &x,ll &y){
    return x>y; 
    }


const ll maxn=2e5+2;





int main()
{ fastio;
//freopen("input.txt, "r", stdin); 
//freopen("output.txt", "w", stdout);

ll n;cin>>n;
ll b[n];
ll ans=0;
forl(i,0,n)cin>>b[i];
ll c[n+1];
c[n]=0;
for(ll i=n-1;i>=0;i--){
    c[i]=c[i+1]+b[i];
    c[i]%=m9;
}
// pin(c);
forl(i,0,n){
    ll x=b[i]*c[i+1];
    x%=m9;
    ans+=x;
    ans%=m9;
}
    ans%=m9;
p1(ans);





return 0;
}





  







Measured memory_bytes: 6780
#include <iostream>

using namespace std;


int main(void){
	unsigned long n,a=0,s=0;

	cin >> n;

	if(n < 10)a = n;
	else {
		while(n>=10){
			s=s+n%10;
			n=n/10;
			a=a+9;
		}
	a = a + n - 1;
	s = s+n%10;
	a = max(a,s);
	}

	cout << a << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
 
ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
	}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	ll a,b;
	cin >> a >> b;
	if(a>0 && b>0) cout << "Positive\n";
	else if(a>0 && b<0 || a<0 && b>0) cout << "Zero\n" << endl;
	else if((a-b)%2 == 0) cout << "Negative\n";
	else cout << "Positive\n";
	return 0;
}


Measured memory_bytes: 256
ss = input()
dic = {'A': 1, 'C': 1, 'G': 1, 'T': 1}
max_s = 0
tmp = 0
for s in ss:
    if s in dic.keys():
        tmp += 1
    else:
        max_s = max(max_s, tmp)
        tmp = 0
max_s = max(max_s, tmp)
print(max_s)


Measured memory_bytes: 2940
#include <stdio.h>
int main(){

  int x,y,z,f;
  
  scanf("%d",&z);
    x = z/3600;
    y = (z%3600)/60;
    f = (z%3600)%60;
    printf("%d:%d:%d\n",x,y,f);

  return 0;
}

Measured memory_bytes: 592
function Main(input) {
    var input = input.split('\n');
    var iti = input[0].split('');
    var ni = input[1].split('');
    var san = input[2].split('');
    console.log(iti[0] + ni[1] + san[2]);

    }
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 15820
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 9 && b <= 9) {
    cout << a * b << '\n';
  }
  else {
    cout << -1 << '\n';
  }
  
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int K;
  cin>>K;
  string S;
  cin>>S;

  if(S.size()<=K) cout<<S<<endl;
  else{
    cout<<S.substr(0,K)<<"..."<<endl;
  }

  return 0;
}


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

int main(){
  int H, W;
  cin >> H >> W;
  string S[H];
  
  bool can = true;

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

  for(int i=0; i<H; i++){
     cin >> S[i];
    }

  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if (S[i][j]=='#'){
        	bool can_1 = true ;
        		for(int d=0; d<4; d++){
         		 const int ni = i + dy[d]; //列
         		 const int nj = j + dx[d]; //行
        		  if(ni < 0 || ni >= H) continue;
        		  if(nj < 0 || nj >= W) continue;
        		  if(S[ni][nj]=='#'){can_1 = false;}
      			  }
        if(can_1){can = false;}
       }
  }}
  if(can) cout << "Yes" << endl;
  else 	  cout << "No" << endl;
 return 0;
}

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

#define p(i,n,vect) for(ll i=0;i<(ll)n;++i) {cout<<vect[i]<<" ";} cout<<"\n";
string S,T;
void solve()
{
    cin>>S>>T;
    ll N=0,M=0;
    N=S.length();
    M=T.length();
    ll cnt=0;
    ll maxcnt=0;
    for(ll i=0;i<(ll)N-M+1;i++)
    {
        cnt=0;
        for(ll j=0;j<(ll)M;j++)
        {
            if(T[j]==S[j+i])
            cnt++;
        }
        if(maxcnt<=cnt)
        maxcnt=cnt;
    }
   //cout<<M<<" "<<maxcnt<<"\n";
    cout<<M-maxcnt<<"\n";
}
signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
  
    solve();
}

Measured memory_bytes: 3640
import Data.List
import qualified Data.Vector as V

main = do
  n <- readLn :: IO Int
  zs <- map (map read . words) <$> lines <$> getContents :: IO [[Int]]
  let ps = permutations [0..(n-1)]
  putStrLn $ show $ (\x -> x / fromIntegral (length ps)) $ distSum ps $ V.fromList zs

foldlState :: (c -> a -> b -> (c, a)) -> c -> a -> [b] -> a
foldlState f s a l = snd $ foldl (\(s, a) -> f s a) (s, a) l

distSum :: [[Int]] -> V.Vector [Int] -> Double
distSum ps zs = foldl (+) 0 $ map (\path -> foldlState step [] 0 path) ps
    where step [] a k = (zs V.! k, a)
          step z a k = let y = zs V.! k in (y, a + dist z y)

dist :: [Int] -> [Int] -> Double
dist [x1, y1] [x2, y2] = sqrt $ fromIntegral $ (x1-x2)^2+(y1-y2)^2


Measured memory_bytes: 10620
use std::collections::VecDeque;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let _n = read::<usize>();
    let mut vs = read_vec::<usize>();
    vs.sort();
    let vs = vs.iter().map(|&x| x as f64).collect::<Vec<_>>();

    let mut deque = VecDeque::from(vs);


    while deque.len() > 1 {
        if let (Some(a), Some(b)) = (deque.pop_front(), deque.pop_front()) {
            deque.push_front((a + b) / 2.0);
        }
    }

    let ans = deque.pop_front().unwrap();
    println!("{}", ans);
}

Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.Scanner;
//Binary Search
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int[] a1;
		int[] a2;
		a1 = new int[input.nextInt()];
		for(int i = 0; i < a1.length; i++) {
			a1[i] = input.nextInt();
		}
		a2 = new int[input.nextInt()];
		for(int i = 0; i < a2.length; i++) {
			a2[i] = input.nextInt();
		}
		input.close();
		if(a1.length > 10000 || a2.length > 500) {
			System.out.println("Enter a length less than of equal to 10000 for the first array,/n"
					+ "Enter a length less than or equal to 500 for the second array.");
		}
		else {
			int count = 0;
			Arrays.sort(a1);
			Arrays.sort(a2);

			
			for(int i = 0; i < a2.length; i++) {
				int first = 0;
				int last = a1.length - 1;
				int mid = (first + last)/2;
				while(first <= last) {
					if(a1[mid] < a2[i]) {
						first = mid + 1;
					}
					else if(a1[mid] == a2[i]) {
						count++;
						break;
					}
					else {
						last = mid - 1;
					}
					mid = (first + last)/2;
					
				}
			}
			System.out.println(count);
		}

	}

}



Measured memory_bytes: 39948
#include<bits/stdc++.h>
using namespace std;
void password(char o[],char e[])
{
    char p[100];
    int l=0,m=0;
    l=strlen(o);
    m=strlen(e);
    for(int i=0,j=0,k=0;i<l+m;i++)
    {
        if(i%2==0)
        {
            p[i]=o[j];
            j++;
        }
        else
        {
            p[i]=e[k];
            k++;
        }
    }
    p[l+m]='\0';
    cout<<p;
}
int main()
{
    char o[50],e[50];
    cin>>o;
    cin>>e;
    password(o,e);
    return 0;
}

Measured memory_bytes: 384
use std::io::*;
use std::str::FromStr;

fn main() {
	let n: i32 = read();
	let mut a: i32;
	for _ in 0..n {
		a = read();
		if a % 2 != 0 {
			continue;
		} else if (a % 3)*(a % 5) == 0 {
			continue;
		}
		println!("DENIED");
		return ();
	}
	println!("APPROVED");
}

fn read<T: FromStr>() -> T {
	let stdin = stdin();
	let stdin = stdin.lock();
	let token: String = stdin
		.bytes()
		.map(|c| c.expect("failed to read char") as char)
		.skip_while(|c| c.is_whitespace())
		.take_while(|c| !c.is_whitespace())
		.collect();
	token.parse().ok().expect("failed to parse token")
}



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

#define fo1(i, n) for (int i = 0; i < n; i++)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int((x).size())
using ll = long long; using vi = vector<int>; using ii = pair<int,int>;
const int oo = 0x3f3f3f3f; const ll OO = ll(oo)*oo; const int N = 205;
#ifndef DEBUG
#define endl '\n'
#define debugf(...)
#define debug(...)
#else
#define debugf(...) printf(__VA_ARGS__)
#define debug(...) __VA_ARGS__
#endif

int g[N][N];
int V[N];
bool seen[N];

int bfs(int v, int n) {
    memset(V, 0, sizeof(V));
    memset(seen, 0, sizeof(seen));

    queue<int> q;
    q.emplace(v);
    V[v] = 1;
    seen[v] = true;
    int ans = 1;
    while (!q.empty()) {
        int u = q.front(); q.pop();

        for (int i = 1; i <= n; i++) {
            if (g[u][i] && !seen[i]) {
                q.emplace(i);
                V[i] = V[u]+1;
                ans = max(ans, V[i]);
                seen[i] = true;
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (g[i][j] && abs(V[i] - V[j]) != 1) {
                return -1;
            }
        }
    }

    return ans;
}

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

    int n; cin >> n;
    fo1(i, n) fo1(j, n) {
            char c; cin >> c;
            g[i+1][j+1] = c-'0';
    }

    int mx = -1;
    for (int i = 1; i <= n; i++) {
        mx = max(mx, bfs(i, n));
    }

    cout << mx << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
using namespace std;

const double pi=4*atan(1.0);
using cMatrixRepEdges=std::vector<std::vector<int>>;
using cShortestPathMatrix=std::vector<std::vector<int>>;
using cPredecessorMatrix=std::vector<std::vector<int>>;

pair<cShortestPathMatrix,cPredecessorMatrix> solve_by_FloydWarshall(const cMatrixRepEdges& Edges){
	if(Edges.empty())return make_pair(cShortestPathMatrix(),cPredecessorMatrix());

	const int VertexNum=Edges.size();
	cShortestPathMatrix AnsDist=Edges;
	cPredecessorMatrix AnsPath=Edges;
	//?????????
	for(int i=0;i<VertexNum;++i){
		for(int j=0;j<VertexNum;++j){
			if(i==j){
				AnsPath[i][j]=-1;
				AnsDist[i][j]=0;
			}
			else if(AnsPath[i][j]==INT_MAX){
				AnsPath[i][j]=-1;
			}
			else{
				AnsPath[i][j]=i;
			}
		}
	}

	//?????????????????????
	for(int i=0;i<VertexNum;++i){
		for(int j=0;j<VertexNum;++j){
			for(int k=0;k<VertexNum;++k){
				if(AnsDist[j][i]!=INT_MAX && AnsDist[i][k]!=INT_MAX){
					if(AnsDist[j][k]>AnsDist[j][i]+AnsDist[i][k]){
						AnsDist[j][k]=AnsDist[j][i]+AnsDist[i][k];
						AnsPath[j][k]=AnsPath[i][k];
					}
				}
			}
		}
	}

	for(int i=0;i<VertexNum;++i){

		for(int j=0;j<VertexNum;++j){
			for(int k=0;k<VertexNum;++k){
				if(Edges[j][k]!=INT_MAX && AnsDist[i][j]!=INT_MAX){
					if(AnsDist[i][k]>AnsDist[i][j]+Edges[j][k]){
						return make_pair(cShortestPathMatrix(),cPredecessorMatrix());
					}
				}
			}
		}

	}

	return make_pair(AnsDist,AnsPath);
}

int main() {
	int N,M;
	cin>>N>>M;
	cMatrixRepEdges Edges(N,vector<int>(N,INT_MAX));
	for(int i=0;i<M;++i){
		int u,v,w;
		cin>>u>>v>>w;

		Edges[u][v]=w;
		//Edges[u].push_back(v);
	}

	auto ans=solve_by_FloydWarshall(Edges);

	if(ans.first.size()!=Edges.size()){
		cout<<"NEGATIVE CYCLE"<<endl;
	}
	else{
		for(const auto& dists:ans.first){
			string str;
			for(const auto& val:dists){
				if(val!=INT_MAX){
					str+=to_string(val);
				}
				else{
					str+="INF";
				}
				str+=" ";
			}
			str.pop_back();
			cout<<str<<"\n";
		}
	}

	//system("pause");
	return 0;
}

Measured memory_bytes: 3420
N = int(input())
S = input()

X = []
for i in range(10):
    X.append(str(i))

ans = 0
for i in X:
    if i in S:
        T = S[S.index(i) + 1:]
        for j in X:
            if j in T:
                U = T[T.index(j) + 1:]
                for k in X:
                    if k in U:
                        ans += 1

print(ans)

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

typedef long long int ll;
string s, t;
ll dp[3007][3007];

int main() {
    cin >> s >> t;
    s += ';';
    t += '.';

    for(ll i = 0; i < s.length(); ++i) {
        for(ll j = 0; j < t.length(); ++j) {
            if(s[i] == t[j]) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            dp[i][j+1] = max(dp[i][j], dp[i][j+1]);
        }
    }

    ll i = s.length() - 1, j = t.length() - 1;

    string ans = "";
    while(i && j) {
        ll cur = dp[i][j];
        if(dp[i - 1][j] == cur) i--;
        else if(dp[i][j - 1] == cur) j--;
        else {
            i--;
            j--;
            ans += s[i];
        }
    }

    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

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

int main() {
	string s; getline(cin, s);
	transform(s.begin(), s.end(), s.begin(), ::toupper);
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3104
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

p.sort(key=lambda x: x[1])
q = list(map(str,[x[0] for x in p]))
r = ' '.join(q)


print (r)

Measured memory_bytes: 28644
#include<set>  
#include<map>  
#include<stack>  
#include<cstdio>  
#include<queue>  
#include<cmath>  
#include<vector>  
#include<climits>  
#include<cstring> 
#include<iostream> 
#include<algorithm> 
using namespace std;
#define INF 0x3f3f3f3f
#define LL long long
int read(){ 
    int f=1,x=0; 
    char c=getchar(); 
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();} 
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();} 
    return f*x; 
}
#define MAXN 2200000
struct edge{
    int v,w;
    edge(){}
    edge(int V,int W){v=V,w=W;}
};
int n,m;
struct node{
    int u,k;
    node(){}    
    node(int U,int K){u=U,k=K;}
    friend bool operator < (node a,node b){return a.u==b.u?a.k<b.k:a.u<b.u;}
};
struct node1{
    int u,v,k;
    node1(){}   
    node1(int U,int V,int K){u=U,v=V,k=K;}
};
vector<node> Make_zx;
vector<node1> Make_xx;
vector<edge> G[MAXN+5];
int dis[MAXN+5];
bool vis[MAXN+5];
queue<int>Q;
int SPFA(int S,int T){
    memset(vis,0,sizeof(vis));
    memset(dis,0x3f,sizeof(dis));
    dis[S]=0,vis[S]=1,Q.push(S);
    while(!Q.empty()){
        int u=Q.front(),v,w,siz=G[u].size();
        Q.pop();
        vis[u]=0;
        for(int i=0;i<siz;i++){
            v=G[u][i].v,w=G[u][i].w;
            if(dis[v]>dis[u]+w){
                dis[v]=dis[u]+w;
                if(!vis[v]){
                    vis[v]=1;
                    Q.push(v);
                }
            }
        }
    }
    return dis[T]==INF?-1:dis[T]/2;
}
int main(){
    n=read(),m=read();
    for(int i=1;i<=m;i++){
        int p=read()-1,q=read()-1,c=read()-1;
        Make_zx.push_back(node(p,c));
        Make_zx.push_back(node(q,c));
        Make_xx.push_back(node1(p,q,c));
        Make_xx.push_back(node1(q,p,c));
    }
    sort(Make_zx.begin(),Make_zx.end());
    for(int i=0;i<int(Make_zx.size());i++){
        G[n+i].push_back(edge(Make_zx[i].u,1));
        G[Make_zx[i].u].push_back(edge(n+i,1));
    }
    for(int i=0;i<int(Make_xx.size());i++){
        int l1=lower_bound(Make_zx.begin(),Make_zx.end(),node(Make_xx[i].u,Make_xx[i].k))-Make_zx.begin(),
        l2=lower_bound(Make_zx.begin(),Make_zx.end(),node(Make_xx[i].v,Make_xx[i].k))-Make_zx.begin();
        G[l1+n].push_back(edge(l2+n,0));
    }
    printf("%d\n",SPFA(0,n-1));
    return 0;
}

Measured memory_bytes: 95612
#include<iostream>
#include<map>
using namespace std;

int ans;

int main(){
  map<int,int> mp;
  int n; cin >> n;
  for(int i=0;i<n;++i){
    int num; cin >> num;
    mp[num]++;
  }
  
  for(auto c:mp) ans += c.second % 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
    string s;
    cin >> s;
    long long sum,n;
    sum = 0;
    n = s.size();
    rep(i,n){
        int m;
        m = s.at(i) - 48;
        sum += m;
    }
    if(sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3748
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    u64 a, b, c;
    std::cin >> a >> b >> c;
    a += c;
    b += c;
    a--;
    std::cout << b/c - a/c << '\n';
}


Measured memory_bytes: 256