akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	string S; cin >> S;

	string YYMM = "YYMM";
	string MMYY = "MMYY";

	string amb = "AMBIGUOUS";

	int a = stoi(S.substr(0, 2)), b = stoi(S.substr(2, 2));
	dump(a, b);

	bool yymm = (0 <= a and a < 100) and (1 <= b and b < 13);
	bool mmyy = (0 <= b and b < 100) and (1 <= a and a < 13);

	string ans;
	if (yymm and mmyy) {
		ans = amb;
	}
	else if (yymm) {
		ans = YYMM;
	}
	else if (mmyy) {
		ans = MMYY;
	}
	else {
		ans = "NA";
	}
	cout << ans << endl;

	return 0;
}


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

const int mod=1000000007;

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

int main() {
  long long N;
  cin>>N;
  if(N==1LL)
    cout<<"0"<<endl;
  else{
    long long ans=(modpow(10LL,N,mod)+modpow(8LL,N,mod)-modpow(9LL,N,mod)*2LL)%mod;
    if(ans<0) ans+=mod;
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 3612
#include <stdio.h>
#include <string.h>
int main(void){
  char S[4];
  scanf("%s",S);
  if((S[0]==S[1]&&S[2]==S[3]&&S[0]!=S[2])||(S[0]==S[2]&&S[1]==S[3]&&S[0]!=S[1])||(S[0]==S[3]&&S[2]==S[1]&&S[0]!=S[2])){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int abc[] = new int[3];
        int total = 0;
        for(int i = 0; i < 3; i++){
            abc[i] = sc.nextInt();
            total += abc[i];
        }
        Arrays.sort(abc);
        int ans = abc[2] * 3 - total;
        System.out.println(ans % 2 == 0 ? ans/2 : ans/2+2);
    }
}


Measured memory_bytes: 23252
package main

import (
	"fmt"
	"math"
)

func main() {
	var n float64
	var a, b, c, d, e int64
	fmt.Scan(&n, &a, &b, &c, &d, &e)

	var caps = []int64{a, b, c, d, e}
	var bn int64 = math.MaxInt64

	for _, c := range caps {
		if c < bn {
			bn = c
		}
	}

	fmt.Println(int(math.Ceil(n/float64(bn))) + 4)
}


Measured memory_bytes: 512
#include<stdio.h>
int main()
{
    int n,s;
    scanf("%d",&n);
   if (n%1000==0)
   printf("0\n");
   else if(n<1000){
     s= 1000-n;
    printf("%d\n",s);}

    else if(n>1000 && n<2000)
    {
        s= 2000-n;
        printf("%d\n",s);
    }
    else if(n>2000 && n<3000)
    {
        s= 3000-n;
        printf("%d\n",s);
    }
    else if(n>3000 && n<4000)
    {
        s= 4000-n;
        printf("%d\n",s);
    }
    else if(n>4000 && n<5000)
    {
        s= 5000-n;
        printf("%d\n",s);
    }
    else if(n>5000 && n<6000)
    {
        s= 6000-n;
        printf("%d\n",s);
    }
    else if(n>6000 && n<7000)
    {
        s= 7000-n;
        printf("%d\n",s);
    }
    else if(n>7000 && n<8000)
    {
        s= 8000-n;
        printf("%d\n",s);
    }
    else if(n>8000 && n<9000)
    {
        s= 9000-n;
        printf("%d\n",s);
    }
    else if (n>9000 && n<10000)
    {
        s= 10000-n;
        printf("%d\n",s);
    }

    return 0;
}



Measured memory_bytes: 1636
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	ll a;
	ld b;
	cin>>a>>b;
	cout<<(ll)(a*b)<<endl;
	return 0;
}



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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
#define mini(x,y) x=min(x,y)
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}


int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}




const int N = 2e5+5;


void solve() {

   int n, s = 0, x = 0;
   cin>>n;
   rep(i,0,n){
     int y;
     cin>>y;
     (x+=y)%=mod;
     ((s-=y*y%mod)+=mod)%=mod;
   }
   (s+=x*x%mod)%=mod;
   cout<<divide(s,2);
  
}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
   // cin >> t;
    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}






int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
int n,m;
long long a[1000000],ans=1e18;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]),a[i]=a[i-1]+a[i];
	for(int i=1;i<=n;i++)
	{
		ll ret=a[n]-a[i];
		ans=min(ans,abs(ret-a[i]));
	}cout<<ans;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const ll Mod = 1000000007;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct S {//辺の情報を入れる変数
	int from, to, cost;
};
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
	return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int pa[300000], n, k, l, ch[300000], pa2[300000];
int root(int x) {
	if (pa[x] == x)
		return x;
	return pa[x] = root(pa[x]);
}
void unite(int x, int y) {
	x = root(x); y = root(y);
	pa[x] = y;
}
int root2(int x) {
	if (pa2[x] == x)
		return x;
	return pa2[x] = root2(pa2[x]);
}
void unite2(int x, int y) {
	x = root2(x); y = root2(y);
	pa2[x] = y;
}
H a[300000];
signed main() {
	cin >> n >> k >> l;
	for (int i = 1; i <= n; i++)
		pa[i] = i, ch[i] = 1, pa2[i] = i;
	for (int i = 0; i < k; i++) {
		int p, q;
		cin >> p >> q;
		unite(p, q);
	}
	for (int i = 0; i < l; i++) {
		int s, r;
		cin >> s >> r;
		unite2(s, r);
	}
	for (int i = 1; i <= n; i++)
		a[i] = H{ root(i),root2(i) };
	sort(a + 1, a + n + 1);
	cout << upper_bound(a + 1, a + n + 1, H{ root(1),root2(1) }) - lower_bound(a + 1, a + n + 1, H{ root(1),root2(1) });
	for (int i = 2; i <= n; i++)
		cout << " " << upper_bound(a + 1, a + n + 1, H{ root(i),root2(i) }) - lower_bound(a + 1, a + n + 1, H{ root(i),root2(i) });
	cout << endl;
	getchar(); getchar();
}

Measured memory_bytes: 11648
import java.util.*;

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

        String s = sc.next();
        if(s.length() % 2 != 0){
            s = s.substring(0, s.length() - 1);
        }else{
            s = s.substring(0, s.length() - 2);
        }

        while(true){
            if(s.substring(0, s.length() / 2).equals(s.substring(s.length() / 2))){
                System.out.println(s.length());
                return;
            }
            s = s.substring(0, s.length() - 2);
        }

    }
}


Measured memory_bytes: 21844
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll
void solve(){
	while (true) {
		int n;
		cin >> n;
		if (n == 0) return;
		vector<vector<string>> inputs;
		REP(i, n) {
			inputs.push_back(vector<string>());
			string a;
			cin >> a;
			string b;
			REP(i, a.length()) {
				if (a[i] == ':' || a[i] == ',' || a[i] == '.') {
					inputs.back().push_back(b);
					b.clear();
				}
				else {
					b.push_back(a[i]);
				}
			}
		}
		map<string, int> cnter;
		REP(i, n) {
			cnter[inputs[i][0]] = i;
		}
		queue<int> next;
		next.push(0);
		set<string> going;
		int visited[100] = {};
		visited[0] = 1;
		while (next.empty() == false) {
			int now = next.front();
			next.pop();
			for (int q = 1; q < inputs[now].size(); ++q) {
				if (cnter[inputs[now][q]]) {
					if (!visited[cnter[inputs[now][q]]]) {
						visited[cnter[inputs[now][q]]] = 1;
						next.push(cnter[inputs[now][q]]);
					}
				}
				else {
					going.insert(inputs[now][q]);
				}
			}
		}
		cout << going.size() << endl;
	}
}

#undef int
int main() {
	init();
	solve();
}


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

using namespace std;
 
#define IOS		    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ld 		    long double
#define ll 		    long long int
#define ull 	   	    unsigned long long int
#define pb		    push_back
#define mp		    make_pair
#define F		    first
#define S		    second
#define lb		    lower_bound
#define ub		    upper_bound
#define deb(x)      	    cout<<"#x "<<x<<"\n";
#define trace(x,y)  	    cout<<"#x "<<x<<" #y "<<y<<"\n";
#define cn          	    cout<<"\n";


bool SBF(const pair <int,int>& a, const pair<int,int>& b){return a.F<b.F;}
bool SBS(const pair <int,int>& a, const pair<int,int>& b){return a.S<b.S;}


const long double PI  = 3.1415926535;
const long long   mod = 1e9+ 7; 
const int 	  mxN = 1000;
const long long   inf = 1e18;


int n, m;
ll a[1000], b[1000], c[1000], dist[100][100];


int main(){
	cin >>n >> m;
	for(int i=0;i<m;i++){
		cin >> a[i]>>b[i]>>c[i];
	        a[i]--, b[i]--;
	}

	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i == j)dist[i][j] = 0;
			else dist[i][j] = inf;
		}
	}
	for(int i=0;i<m;i++){
		dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
		dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
	}
	for(int k =0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}

	int ans = m;
	for(int i=0;i<m;i++){
            bool shortest = false;
	    for(int j =0;j<n;j++){
		    if(dist[j][a[i]] + c[i] == dist[j][b[i]])shortest = true;
	    }
	    if(shortest)ans--;
	}


	cout<<ans<<"\n";




}







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

int main() {
    std::string S, T;
    std::cin >> S >> T;

    if (S.size() + 1 != T.size()) {
        std::cout << "No" << std::endl;
        return 0;
    }

    for (int i = 0; i < S.size(); i++) {
        if (S[i] != T[i]) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    std::cout << "Yes" << std::endl;
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
vector<int> E[100010];
int h[100010];
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		cin >> h[i];
	}
	for (int i = 1; i <= m; ++i) {
		int u, v;
		cin >> u >> v;
		E[u].push_back(v);
		E[v].push_back(u);
	}
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		bool ok = true;
		for (int v : E[i]) {
			if (h[v] >= h[i]) {
				ok = false;
				break;
			}
		}
		if (ok == true) {
			++cnt;
		}
	} 
	cout << cnt;
}

Measured memory_bytes: 9104
#include <iostream>
// #include <vector>
// #include <map>
// #include <string>
// #include <algorithm>
// #include <set>
// #include <cmath>

using namespace std;
// typedef unsigned long long ull;


int main(int argc, char const *argv[]) {
    int A, B;
    cin >> A >> B;
    if (B != 1 && (A == 1 || A > B)) {
        cout << "Alice" << endl;
    } else if (A != 1 && (B == 1 || B > A)) {
        cout << "Bob" << endl;
    } else {
        cout << "Draw" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, k, i;
		String s;
		char kk;
		n = sc.nextInt();
		s = sc.next();
		k = sc.nextInt();
		char[] sArray = s.toCharArray();
		kk = sArray[k - 1];
		for( i = 0; i < n; i++) {
			if(sArray[i] != kk) {
				sArray[i] = '*';
			}
			System.out.print(sArray[i]);
		}
		System.out.println();
		sc.close();
	}
}

Measured memory_bytes: 22612
#include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <ratio>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

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

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

const ull MOD = 1000'000'007;

int main(){
    ll H, N;
    cin >> H >> N;
    auto A = read<ll>(N);
    auto sum = accumulate(A.begin(), A.end(), 0LL);
    if(sum >= H){ cout << "Yes"; }
    else{ cout << "No"; }
    cout << endl;

    
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
#define INFINITE 1e18
using namespace std;

int32_t main()
{
	
	ios::sync_with_stdio(0);

	int M,D;
	cin>>M>>D;

	int cnt=0;

	for(int mnth=4;mnth<=M;mnth++)
	{
		for(int dy=22;dy<=D;dy++)
		{
			int d10=dy/10;
			int d1=dy%10;
			if(d10>=2 && d1>=2 && d10*d1==mnth) cnt++;
		}
	}

	cout<<cnt<<endl;
	
	return 0;
}

Measured memory_bytes: 256
N = int(input())

q = [(1, [0])]
for i in range(N - 1):
    old_q = q
    q = []
    for m, l in old_q:
        for apd in range(m):
            q.append((m, l + [apd]))
        q.append((m + 1, l + [m]))

ans = ["".join([chr(x + 97) for x in xx[1]]) for xx in q]
print(
    *ans,
    sep="""
"""
)


Measured memory_bytes: 45496
A, B, C = map(int, input().split())
T = [A, B, C]
T.sort()
count = 0

def trade(T, count):
    Ts = [0]*3
    if T[0] == T[1] == T[2] and T[0]%2==0:
        return -1
    elif T[0]%2 != 0 or T[1]%2 != 0 or T[2]%2 != 0:
        return count
    else:
        count += 1
        Ts[0] = (T[1]+T[2])/2
        Ts[1] = (T[0]+T[2])/2
        Ts[2] = (T[0]+T[1])/2
        return trade(Ts, count)

print(trade(T, count))



Measured memory_bytes: 3064
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define _for(i,a,b) for(int i = (a);i<(b);i++)
#define endl  '\n'
#define inf 0x3f3f3f3f
using namespace std;
const int mod=1e9+7;
const int MAX=1e6+7;
//ll a[MAX];
int main()
{
 	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	ll a,b,n;
 	cin>>a>>b>>n;
 	  long long temp=(n/b)*b-1;
      cout << max(((a*n)/b-a*(n/b)), ((a*temp)/b-a*(temp/b))) << endl;
 	
}

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

typedef long long ll; 
#define sz(a) ((int)(a.size()))

const int mod=1e9+7; 
int mul(int a, int b){
  return (ll)a*b%mod; 
}
void add_self(int &a, int b){
  a+=b; 
  if(a>= mod) a-=mod; 
}
void mul_self(int &a, int b){
  a=(ll)a*b%mod; 
}
void sub_self(int &a, int b){
  a-=b; 
  if(a<0) a+=mod;
}
int exp(int a, int b){
  int ret=1; 
  while(b){
    if(b%2){
      mul_self(ret,a); 
    }
    mul_self(a,a); 
    b/=2; 
  }
  return ret; 
}
//--------------------------------------------------
void solve2(){
  int n; cin>>n; 
  vector<ll> v(n); 
  for(int i=0;i<n;i++) cin>>v[i]; 
  sort(v.begin(),v.end()); 
  ll acc=v[0]+v[1];
  ll p=2; 
  for(int i=2;i<n;i++){
    acc+=p*v[i]; 
    p*=2;
  }
  long double d=p; 
  long double ans=acc/d; 
  printf("%.10Lf\n",ans); 
}

void solve(){ 
  solve2(); return; 
  int n; cin>>n; 
  set<double> a; 
  for(int i=0;i<n;i++) {
    int num; cin>>num; a.insert(num); 
  }
  while(sz(a)>1){
    auto it=a.begin(); 
    double x=*it; it++; 
    double y=*it; 
    a.erase(a.begin()); a.erase(a.begin()); 
    a.insert((x+y)/2); 
  }
  printf("%.10lf\n",*(a.begin())); 
}


int main(){
  clock_t beg=clock(); 
  solve(); 
  clock_t end=clock(); 
  fprintf(stderr,"%.2lf sec\n",(double)(end-beg)/CLOCKS_PER_SEC); 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){//priority_queue?
	int n, m;
	cin >> n >> m;
	vector<vector<int>> elist(n), rlist(n);
	vector<int> indeg(n);
	for(int i=0; i<n-1+m; ++i){
		int s, t;
		cin >> s >> t;
        --s; --t;
		elist[s].push_back(t);
		rlist[t].push_back(s);
		++indeg[t];
	}
	queue<int> zeroq;
	for(int i=0; i<n; ++i){
		if(indeg[i]==0) zeroq.push(i);
	}
	vector<int> result, par(n,0);
    while(!zeroq.empty()){
		int u=zeroq.front();
		zeroq.pop();

		result.push_back(u);
        for(int i : elist[u]){
			--indeg[i];
			if(indeg[i]==0){
				zeroq.push(i);
				par[i]=u+1;
			}
		}
	}

	for(int i : par) cout << i << endl;
}

Measured memory_bytes: 13052
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CDaydream {
        static final String[] blocks = {"maerd",
                                        "remaerd",
                                        "esare",
                                        "resare"};

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String input = in.next();
            final int n = input.length();
            char[] rev = new char[n];
            for (int i = 0; i < n; i++) {
                rev[i] = input.charAt(n - 1 - i);
            }
            String s = String.valueOf(rev);

            int index = 0;
            outer:
            while (index < s.length()) {
                for (String b : blocks) {
                    if (s.startsWith(b, index)) {
                        index += b.length();
                        continue outer;
                    }
                }
                out.println("NO");
                return;
            }

            out.println("YES");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 23124
N, K = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)
D = []
i = 1
while i * i <= S:
    if S % i == 0:
        D.append(i)
        if S // i != i:
            D.append(S // i)
    i += 1

D = sorted(D, reverse=True)

for d in D:
    mod = [a % d for a in A]
    mod = sorted(mod)
    s = sum(mod)
    if sum(mod[:-s//d]) <= K:
        print(d)
        exit()



Measured memory_bytes: 43228
str = input()
q = int(input())

for i in range(q):
    s = input().strip().split()
    
    start = int(s[1])
    end = int(s[2])+1    

    if s[0] == 'print':
        print(str[start:end])
        
    if s[0] == 'reverse':
        str = list(str)
        str[start:end] = reversed(str[start:end])
        str = ''.join(str)
        
    if s[0] == 'replace':
        str = list(str)
        str[start:end] = list(s[3])
        str = ''.join(str)


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

int main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		if ((a & 1) && (b & 1))cout << "no" << endl;
		else cout << "yes" << endl;
	}
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k;scanf("%d",&k);
    int y[k],x[k];
    for(int i=0;i<k;i++)scanf("%d%d",&y[i],&x[i]);
    vector<int> a(8);
    for(int i=0;i<8;i++)a[i]=i;
    do{
        vector<vector<int>> ans(8,vector<int>(8));
        bool check=1;
        for(int i=0;i<8;i++)ans[i][a[i]]=1;
        for(int i=0;i<k;i++)if(ans[y[i]][x[i]]==0)check=0;
        for(int i=0;i<8;i++)for(int j=i+1;j<8;j++){
            if(a[i]-i==a[j]-j or a[i]+i==a[j]+j)check=0;
        }
        if(check){
            for(int i=0;i<8;i++){
                for(int j=0;j<8;j++){
                    if(ans[i][j])printf("%s","Q");
                    else printf("%s",".");
                }
                puts("");
            }
        }
    }while(next_permutation(a.begin(),a.end()));
    return 0;
}


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

int main(){
    long long n,k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    long long ans = 0;
    for (int i = 0; i < k; i++){
        ans += v[i];
    }
    cout << ans << "\n";
}


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

using namespace std;

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

    vector<double>a(n);
    vector<double>b(n);

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

    for(int h=0;h<n-1;h++){
        b[h] = a[h+1] -a[h];
      
    }

    b[n-1] = a[0] + k - a[n-1];


    sort(b.begin(),b.end());


    cout << accumulate(b.begin(),b.end(),0) - b[n-1] <<endl;



}

Measured memory_bytes: 3328
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}


int main(void){
	int n,m,i,d=INF;
	cin >> n >> m;
	i=1;
	while(i*i<=m){
		if(m%i==0){
			if(i>=n){
				d = min(d,i);
			}
			if((m/i)>=n){
				d = min(d,m/i);
			}
		}
		++i;
	}
	cout << (m/d) << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
six = [1]
nine = [1]
p =1 
while True:
    if 6**p<=n:
        six.append(6**p)
    else:
        break
    if 9**p <=n:
        nine.append(9**p)
    p +=1
six.sort(reverse=True)
nine.sort(reverse=True)
ans = float('inf')
for i in range(n+1):
    count =0
    r = i
    for a in six:
        quot = r//a
        r -= quot*a
        count += quot
        if r ==0:
            break
    r = n - i
    for a in nine:
        quot = r//a
        r -= quot*a
        count += quot
        if r ==0:
            break
    ans = min(ans,count)
print(ans)
        

Measured memory_bytes: 3064
/******************************************
/@Author: LeafBelief
/@Date: 2020-04-07
/@Remark:    
/@FileName: minumdistance
******************************************/
#include <bits/stdc++.h>
#define CSE(x,y) memset(x,y,sizeof(x))
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
#define FAST ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

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

const int maxn = 211111;
ll dis[maxn];

int main()
{
    FAST;
    int k, n;
    cin >> k >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> dis[i];
    }
    ll all = 0, mxdis = 0;
    for(int i = 1; i < n; i++)
    {
        all += dis[i] - dis[i - 1];
        mxdis = max(mxdis, dis[i] - dis[i - 1]);
    }
    all += k - dis[n - 1] + dis[0] - 0;
    mxdis = max(mxdis, k - dis[n - 1] + dis[0] - 0);
    cout << all - mxdis << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
	int a[256],b[256],i=0,d;
	int m[256],c;
	while(scanf("%d %d",&a[i],&b[i])!=EOF){
		m[i]=a[i]+b[i];
		i++;
		d=i;
	}
	for(i=0;i<d;i++){
		c=0;
		for(;;){
			c++;
			if((m[i]/=10)==0)break;
		}
		printf("%d\n",c);
	}
	return 0;
}

Measured memory_bytes: 2684
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define limit 1000000000000000000 //1e18
#define mod 1000000007 //1e9+7
#define llu long long unsigned
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,n)    for(ll i=0; i<n; i++)
#define rep1(i,a,b)    for(ll i=a; i<b; i++)
#define repV(i,n)    for(ll i=0; i<v.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,n,k;
    cin>>n>>k;
    ll a[n];
    for(i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+n);
    ll happy=0;
    for(i=0; i<n; i++)
    {
        if(a[i]<=k){
            k-=a[i];happy++;
        }
        else break;
    }
    if(i==n&&k>0) happy--;
    cout<<happy<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;

    string L = "CODEFESTIVAL2016";
    int N = S.length();
    int count = 0;

    for (int i = 0; i < N; i++){
        if (S[i] != L[i]){
            count++;
        }
    }
    cout << count << endl;
}

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

bool isCardBingo (vector<vector<int>> &a) {
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
       if (a[i][j] != -1)
         a[i][j] = 0;
    }
  }
  
  for (int i = 0; i < 3; i++) {
    if ((a[i][0] == -1) && (a[i][1] == -1) && (a[i][2] == -1))
      return true;
  }
  
  for (int i = 0; i < 3; i++) {
    vector<int> row(3);
    for (int j = 0; j < 3; j++)
      row[j] = a[j][i];
    
    if ((row[0] == -1) && (row[1] == -1) && (row[2] == -1))
      return true;
  }
  
  if ((a[0][0] == -1) && (a[1][1] == -1) && (a[2][2] == -1))
    return true;
  else if ((a[2][0] == -1) && (a[1][1] == -1) && (a[0][2] == -1))
    return true;
  
  else
    return false;
    
}


int main () {
  vector<vector<int>> card (3, vector<int> (3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++)
      cin >> card[i][j];
  }
  
  int n; cin >> n;
  for (int k = 0; k < n; k++) {
    int b; cin >> b;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (card[i][j] == b)
          card[i][j] = -1;
      }
    }
  }
  
  if (isCardBingo(card))
    cout << "Yes" << endl;
  
  else
    cout << "No" << endl;
}

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

using namespace std;
#define rep(i, n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

#ifndef INPUTS_DIR
#define INPUTS_DIR "./"
#endif


void solve(string S, ll K) {
    vector<string> s;
    for (int i = 0; i < S.size(); i++) {
        string sub = "";
        for (int j = 0; j < 5; j++) {
            if (i + j >= S.size()) break;
            sub += S[i + j];
            s.push_back(sub);
        }
    }
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    cout << s[K - 1] << endl;
}


void main_(istream &cin) {
    ll K;
    string s;
    cin >> s;
    cin >> K;
    solve(s, K);
}

int main() {
#ifdef INTELLIJ
    ifstream ifs(string(INPUTS_DIR) + "in_1.txt");
    if (ifs.is_open()) {
        main_(ifs);
        ifs.close();
    } else {
        cerr << "Error: no input." << endl;
    }
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    main_(cin);
#endif
}





Measured memory_bytes: 1788
#include <stdio.h>

int main(void){
	int i,n,sum,dice[6],d;
	char inst[6];
	scanf("%d",&n);
	while(n!=0){
		sum=1;
		dice[0]=1;
		dice[1]=2;
		dice[2]=3;
		dice[3]=4;
		dice[4]=5;
		dice[5]=6;
		for(i=0; i<n; i++){
			scanf("%s",inst);
			switch(inst[0]){
			case 'S':
				d=dice[0];
				dice[0]=dice[4];
				dice[4]=dice[5];
				dice[5]=dice[1];
				dice[1]=d;
				break;
			case 'W':
				d=dice[0];
				dice[0]=dice[2];
				dice[2]=dice[5];
				dice[5]=dice[3];
				dice[3]=d;
				break;
			case 'E':
				d=dice[0];
				dice[0]=dice[3];
				dice[3]=dice[5];
				dice[5]=dice[2];
				dice[2]=d;
				break;
			case 'N':
				d=dice[0];
				dice[0]=dice[1];
				dice[1]=dice[5];
				dice[5]=dice[4];
				dice[4]=d;
				break;
			case 'L':
				d=dice[1];
				dice[1]=dice[3];
				dice[3]=dice[4];
				dice[4]=dice[2];
				dice[2]=d;
				break;
			case 'R':
				d=dice[1];
				dice[1]=dice[2];
				dice[2]=dice[4];
				dice[4]=dice[3];
				dice[3]=d;
				break;
			}
			sum+=dice[0];
		}
		printf("%d\n",sum);
		scanf("%d",&n);
	}
	return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;


const int maxn = 1e3 + 27;


const int inf = 1e9;


int n, m;
vector<int> g[maxn];
int color[maxn];
int par[maxn];
int dep[maxn];

void reset() {
    for (int i=0; i<=n; i++) {
	color[i] = 0;
	par[i] = 0;
	dep[i] = 0;
    }
}


bool check(vector<int> nodes) {
    set<int> have(nodes.begin(), nodes.end());
    vector<vector<int>> G(n+1);
    for (int i=1; i<=n; i++) {
	if (have.count(i)) {
	    for (int to: g[i]) {
		if (have.count(to)) {
		    G[i].push_back(to);
		}
	    }
	}
    }

    for (int i=1; i<=n; i++) {
	if (have.count(i)) {
	    int nei = G[i].size();
	    if (nei != 1) return false;
	}
    }

    return true;
}

int best = inf;

void dfs(int at) {
    color[at] = 1;
    for (int to: g[at]) {
	if (color[to] == 0) {
	    dep[to]=1+dep[at];
	    dfs(to);
	} else if (color[to] == 1) {
	    //cout<<at<<"->"<<to<<": "<<(dep[at]-dep[to])<<endl;
	    best = min(best, dep[at]-dep[to]);
	}
    }
    color[at] = 2;
}

void get(int at) {
    color[at] = 1;
    for (int to: g[at]) {
	if (color[to] == 0) {
	    par[to] = at;
	    dep[to] = 1+dep[at];
	    get(to);
	} else if (color[to] == 1 && best == (dep[at]-dep[to])) {
	    par[to] = -1;
	    vector<int> path;
	    int x=at;
	    while (x != -1) {
		path.push_back(x);
		x = par[x];
	    }
	    reverse(path.begin(), path.end());
	    cout<<path.size()<<"\n";
	    for (int nd: path) {
		cout<<nd<<"\n";
	    }
	    assert(check(path));
	    exit(0);
	}
    }
    color[at] = 2;
}



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

    cin>>n>>m;
    for (int i=0; i<m; i++) {
	int u,v; cin>>u>>v;
	g[u].push_back(v);
    }

    for (int i=1; i<=n; i++) {
	reset();
	dfs(i);
    }
    if (best == inf) out(-1);


    for (int i=1; i<=n; i++) {
	reset();
	get(i);
    }

    assert(false);

    
    return 0;
}



Measured memory_bytes: 3872
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

using namespace std;
using ll = long long;

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 dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};


//////////////////////////////////////////////////



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

    if (k == 0) {
        cout << n*n << endl;
        return 0;
    }

    ll ans = 0;
    for (ll i = k+1; i <= n; i++)
    {
        // cout << "-------------" << endl;
        ans += (n/i)*(i-k);
        // cout << ans << endl;
        if (n%i != 0) ans += max(0ll, n-(n/i)*i-(k-1));
        // cout << ans << endl;
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
int main(){
	int n,a,b;
	while(~scanf("%d",&n)){
		if(n==1) printf("Hello World\n");
		else{
			scanf("%d%d",&a,&b);
			printf("%d\n",a+b);
		}
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

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

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

int main(){
    int n; cin>>n;
    set<char> s;
    for(int i=0; i<n; i++){
        char t; cin>>t;
        s.insert(t);
    }

    if(s.size()==3) cout << "Three" << endl;
    else cout << "Four" << endl;
}

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

using namespace std;

#define MAXN 200010
#define INF 0x3f3f3f3f
#define mo 1000000007
typedef long long LL;

char s[MAXN];

int main()
{
//#ifdef MYCP
//    freopen("data.in", "r", stdin);
//#endif // MYCP

    int ans = 0, cnt = 0;
    scanf("%s", s);
    for(int i = 0; s[i]; ++i){
        if(s[i] == 'S') ++cnt;
        else if(cnt) --cnt;
        else ++ans;
    }
    printf("%d\n", ans + cnt);

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define f(n) for(int i=0;i<n;++i)
#define f2(n) for(int j=0;j<n;++j)
#define f3(n) for(int k=0;k<n;++k)
#define F(i,x,n,y) for(int i=x;i<n;i+=y)
#define fa(x,y) for(auto x:y)
 
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
 
//Warsaw debug template
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1,debug&>::type operator<<(c i){
sim > struct rge {c b,e;};
sim > rge<c> range(c i, c j) {return rge<c>{i,j};}
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug{
#ifdef LOCAL
~debug() {cerr<<endl; }
eni(!=) cerr<< boolalpha << i; ris;}
eni(==) ris <<range(begin(i),end(i)); }
sim, class b dor(pair<b,c> d){
ris<<"("<<d.first<<","<<d.second<<")";
}
sim dor(rge<c> d){
    *this << "[";
    for(auto it=d.b;it!=d.e;++it)
        *this <<"," +(it==d.b)<< *it;
    ris<<"]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) "["<<#__VA_ARGS__":"<<(__VA_ARGS__)<<"]"
//End of debug template
#define isOn(S, j) (S & (1<<j))
#define setBit(S, j) (S | (1<<j))
#define clearBit(S, j) (S & ~(1<<j))
#define toggleBit(S, j) (S ^ (1<<j))
#define lowBit(S) (S & (-S))
typedef vector<ll> vll;

int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    --k;
    s[k]+=32;
    cout<<s<<endl;
    return 0;
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il print(T x){
	if(x/10) print(x/10);
	putchar(x%10+'0');
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x%mod;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res%mod;
}
const int MAXN = 105;
int n,val[MAXN],ans;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<n;++i) read(val[i]);
	ans=val[1]+val[n-1];
	for(ri i=1;i<n-1;++i) ans+=min(val[i],val[i+1]);
	print(ans);
	return 0;
}

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    string s;
    cin >> s;
    int f = 0;
    int f2 = 0;
    int a = 0;
    int b = 0;
    rep(i, s.size()) {
        if(s[i]=='A'&&f==0) {
            f = 1;
            a = i;
        }
        if(s[s.size()-i]=='Z'&&f2==0) {
            f2 =1;
            b = s.size() - i;
        }
    }
    P(b-a+1);
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009

void solve()
{
	ll n;
	rl(n);
	map<string,vector<PLL>> mp;
	fr(i,0,n)
	{
		string str;
		cin>>str;
		ll sc;
		rl(sc);
		mp[str].PB(MP(sc,i+1));
	}
	for(auto i:mp)
	{
		vector<PLL> tmp=i.S;
		sort(ALL(tmp));
		reverse(ALL(tmp));
		fr(j,0,SZ(tmp))
			cout<<tmp[j].S<<endl;
	}
	//cout<<"hello"<<endl;
	return;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <bitset>

using lint = long long;

void solve() {
    int n;
    std::cin >> n;

    std::vector<lint> xs(n);
    for (auto& x : xs) std::cin >> x;
    auto s = std::accumulate(xs.begin(), xs.end(), 0LL,
                             [](auto a, auto b) { return a ^ b; });

    lint buf = 0;
    for (int i = 0; i < 60; ++i) {
        if (((s >> i) & 1) == 0) continue;
        buf += (1LL << i);
        for (auto& x : xs) x &= ~(1LL << i);
    }
    s = std::accumulate(xs.begin(), xs.end(), 0LL,
                        [](auto a, auto b) { return a ^ b; });

    lint ans = 0;
    while (!xs.empty()) {
        int i = std::max_element(xs.begin(), xs.end()) - xs.begin();
        std::swap(xs[i], xs.back());

        auto y = xs.back();
        if (y == 0) break;

        for (auto& x : xs) x = std::min(x, x ^ y);
        ans = std::max(ans, ans ^ y);
        xs.pop_back();
    }

    std::cout << ans + (s ^ ans) + buf << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 1024
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <vector>


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

  std::vector<int> abc;
  for (int n; std::cin >> n;) {
    abc.emplace_back(n);
  }
  std::sort(abc.begin(), abc.end());
  abc.erase(std::unique(abc.begin(), abc.end()), abc.end());
  std::cout << abc.size() << std::endl;

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256