akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

struct stopwatch {
  clock_t t = clock();
  void restart() { t = clock(); }
  int elapsed() const { return (clock() - t) * 1000 / CLOCKS_PER_SEC; }
  void operator()(string s = "Time") const {
    cerr << s + ": " << elapsed() << " ms\n";
  }
};

mt19937 mt_engine(chrono::steady_clock::now().time_since_epoch().count());
template <class T> enable_if_t<is_integral_v<T>, T> rng(T l, T r) {
  return uniform_int_distribution<T>(l, r - 1)(mt_engine);
}
template <class T> enable_if_t<is_floating_point_v<T>, T> rng(T l, T r) {
  return uniform_real_distribution<T>(l, r)(mt_engine);
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  stopwatch sw;
  vector<int> v(n + 1), w(n + 1);
  generate(begin(v), end(v), bind(rng<int>, 1, 1e5));
  generate(begin(w), end(w), bind(rng<int>, 1, 1e5));
  for (int i = 1; i <= n; ++i) {
    cin >> v[i] >> w[i];
  }
  auto f = [&](const auto& idx, int l) {
    int m = size(idx), res = 0;
    for (int bt = 0; bt < 1 << m; ++bt) {
      int sv = 0, sw = 0;
      for (int t = 0; t < m; ++t) {
        if (bt >> t & 1) {
          sv += v[idx[t]];
          sw += w[idx[t]];
        }
      }
      if (sw <= l) {
        res = max(res, sv);
      }
    }
    return res;
  };
  auto g = [&](const auto& idx) {
    int m = size(idx);
    vector<pair<int, int>> res;
    for (int bt = 0; bt < 1 << m; ++bt) {
      int sv = 0, sw = 0;
      for (int t = 0; t < m; ++t) {
        if (bt >> t & 1) {
          sv += v[idx[t]];
          sw += w[idx[t]];
        }
      }
      res.emplace_back(sw, sv);
    }
    sort(begin(res), end(res));
    res.erase(unique(begin(res), end(res)), end(res));
    for (int i = 0; i < (int)size(res) - 1; ++i) {
      res[i + 1].second = max(res[i + 1].second, res[i].second);
    }
    return res;
  };
  constexpr int th = 4096;
  vector<vector<pair<int, int>>> pre(th);
  for (int i = th / 2; i <= min(th - 1, n); ++i) {
    vector<int> idx;
    for (int j = i; j; j >>= 1) {
      idx.push_back(j);
    }
    pre[i] = g(idx);
  }
  sw();
  int q;
  cin >> q;
  while (q--) {
    int i, l;
    cin >> i >> l;
    if (i < th) {
      vector<int> idx;
      while (i) {
        idx.push_back(i);
        i >>= 1;
      }
      cout << f(idx, l) << '\n';
    } else {
      vector<int> idx;
      while (i >= th) {
        idx.push_back(i);
        i >>= 1;
      }
      assert(th / 2 <= i and i < th);
      auto&& a = pre[i];
      auto b = g(idx);
      assert(not empty(a));
      auto ita = begin(a), itb = end(b);
      if (i == 2 and l == 3) {
        DEBUG(q);
        DEBUG(a);
        DEBUG(b);
      }
      int res = 0;
      while (ita != end(a) and ita->first <= l) {
        while (itb == end(b) or ita->first + itb->first > l) {
          --itb;
        }
        res = max(res, ita->second + itb->second);
        ++ita;
      }
      cout << res << '\n';
    }
  }
}


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fill(a,v) memset(a,v,sizeof(a))
#define d1(a) cout << a << "\n"
#define d2(a,b) cout << a << " " << b << "\n"
#define d3(a,b,c) cout << a << " " << b << " " << c << "\n"
#define d4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << "\n"
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
	fast;
	string s;
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5]) cout << "Yes";
	else  cout << "No";
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>
#include <chrono>

using namespace std;

class amida
{
	int w;
	vector<int> va;
public:
	amida(int _w) : w(_w){
		for(int i = 0; i < w; i++){
			va.push_back(i);
		}
	}
	void swap(int, int);
	void output();
};

void amida::swap(int a1, int b1)
{
	int temp = va[a1-1];
	va[a1-1] = va[b1-1];
	va[b1-1] = temp;
}

void amida::output()
{
	for(int i = 0; i < w; i++)
		cout << va[i]+1 << '\n';
}

int main()
{
	int w, n;
	int a1, b1;
	cin >> w;
	amida am(w);
	cin >> n;
	for(int i = 0; i < n; i++){
		string str;
		cin >> str;
		const char* chtemp = str.c_str();
		a1 = atoi(strtok((char*)chtemp, ","));
		b1 = atoi(strtok(NULL, ","));
		am.swap(a1, b1);
	}
	am.output();

	return 0;
}

Measured memory_bytes: 3148
#!/usr/bin/env python3
# import string
import sys


def solve(C: str):
    L = [chr(ord('a') + i) for i in range(26)]
    # L = string.ascii_lowercase
    print(L[L.index(C)+1])


    #return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    C = next(tokens)  # type: str
    solve(C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1000005;
const ll INF=1LL<<50;
ll dp[2][MAX],dp2[2][MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N;cin>>N;
        if(N==0) break;
        vector<int> A(N);
        for(int i=0;i<N;i++) cin>>A[i];
        for(int i=0;i<MAX;i++){
            dp[0][i]=dp[1][i]=INF;
            dp2[0][i]=dp2[1][i]=INF;
        }
        dp[0][0]=0;
        dp2[0][0]=0;
        
        int M;cin>>M;
        vector<pair<int,int>> B,C;
        for(int i=0;i<M;i++){
            string S,T;
            int a,b;cin>>S>>a>>T>>b;
            if(T[0]=='S'){
                B.push_back({a,b});
            }else{
                C.push_back({a,b});
            }
        }
        
        for(int i=1;i<=B.size();i++){
            for(int j=0;j<MAX;j++){
                dp[i&1][j]=min(dp[!(i&1)][j],dp[i&1][j]);
                if(j-B[i-1].second>=0) dp[i&1][j]=min(dp[i&1][j],dp[i&1][j-B[i-1].second]+B[i-1].first);
            }
            
            for(int j=1;j<MAX;j++){
                dp[!(i&1)][j]=INF;
            }
        }
        
        for(int i=1;i<=C.size();i++){
            for(int j=0;j<MAX;j++){
                dp2[i&1][j]=min(dp2[!(i&1)][j],dp2[i&1][j]);
                if(j-C[i-1].second>=0) dp2[i&1][j]=min(dp2[i&1][j],dp2[i&1][j-C[i-1].second]+C[i-1].first);
            }
            
            for(int j=1;j<MAX;j++){
                dp2[!(i&1)][j]=INF;
            }
        }
        
        for(int j=MAX-2;j>=0;j--){
            dp[int(B.size())&1][j]=min(dp[int(B.size())&1][j],dp[int(B.size())&1][j+1]);
            dp2[int(C.size())&1][j]=min(dp2[int(C.size())&1][j],dp2[int(C.size())&1][j+1]);
        }
        
        ll ans=INF;
        
        for(int j=0;j<MAX;j++){
            ll sum=dp2[int(C.size())&1][j];
            for(int i=0;i<N;i++){
                if(A[i]>j){
                    sum+=dp[int(B.size())&1][A[i]-j];
                }
            }
            ans=min(ans,sum);
            
            //if(j<=1000) cout<<j<<" "<<sum<<endl;
        }
        cout<<ans<<endl;
    }
}





Measured memory_bytes: 34484
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[110];
int R[110];
int bl[110];
int used[110];
int lim[110];
int sz;
long long C[210][210];
long long fact[110];
long long inv[110];
long long finv[110];
int now[110];
 
long long dp[110][110][110];
long long calc(int x,int y,int a){
	for(int i=0;i<80;i++)for(int j=0;j<80;j++)for(int k=0;k<80;k++)dp[i][j][k]=0;
	dp[0][0][0]=1;
	int n=a-y-(x+y-1);
	for(int i=0;i<n;i++){
		for(int j=0;j<=x;j++){
			for(int k=0;k<=n;k++){
				if(!dp[i][j][k])continue;
				for(int l=0;j+l<=x&&k+l*(2*i+1)<=n;l++){
					if(l&&lim[x-l-j]<(k-j)/2+l*i)break;
					dp[i+1][j+l][k+l*(2*i+1)]=(dp[i][j][k]*C[j+l+y][l]+dp[i+1][j+l][k+l*(2*i+1)])%mod;
				}
			}
		}
	}
	long long ret=0;
	for(int i=0;i<=n;i++){
		ret=(ret+C[n+3*x+2*y][n-i]*dp[n][x][i])%mod;
	}
	//printf("%d %d %d: %lld\n",x,y,a,ret);
	return ret;
}
int main(){
	C[0][0]=1;
	for(int i=0;i<205;i++){
		for(int j=0;j<=i;j++){
			C[i+1][j]=(C[i+1][j]+C[i][j])%mod;
			C[i+1][j+1]=(C[i+1][j+1]+C[i][j])%mod;
		}
	}
	int a,b;scanf("%d%d",&a,&b);
	//n=a;
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<110;i++)inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	for(int i=1;i<110;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
	scanf("%s",in);
	long long ret=0;
	for(int i=0;i<b;i++){
		if(in[i]=='r'){
			R[sz++]=i;
		}
	}
	for(int i=0;i<=sz;i++){
		for(int j=0;i+j<=sz;j++){
			for(int k=0;k<b;k++)used[k]=lim[k]=0;
			for(int k=0;k<i+j;k++)used[R[k]]=1;
			bool dame=false;
			for(int k=0;k<i;k++){
				bool ok=false;
				for(int l=R[k];l<b;l++){
					if(!used[l]&&in[l]=='b'){
						ok=true;used[l]=1;bl[k]=l;break;
					}
				}
				if(!ok){dame=true;break;}
			}
			if(dame)continue;
		//	printf("%d %d\n",i,j);
			for(int k=0;k<i;k++){
				for(int l=bl[k]+1;l<b;l++){
					if(!used[l])lim[k]++;
				}
			}
 
			ret=(ret+calc(i,j,a))%mod;
		}
	}
	printf("%lld\n",ret);
}

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

// --------------------------------------------------------------------------------
#define FASTIO	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define fset(arr,n,val) for(int i=0;i<n;++i) arr[i] = val
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b) for(int i=a;i<=b;i++)
#define frepj(a,b) for(int j=a;j<=b;j++)
// --------------------------------------------------------------------------------

void solve_main()
{
    int n,m,k;cin>>n>>m>>k;
    long long arr[n+1],brr[m+1];
    arr[0] = 0;
    brr[0] = 0;
    for(int i=1;i<=n;++i)
    {
    	int x;cin>>x;
    	arr[i]=arr[i-1]+x;
    }
    for(int i=1;i<=m;++i)
    {
    	int x;cin>>x;
    	brr[i]=brr[i-1]+x;
    }
    long long ans = 0;
    long long best = m;
    for(int i=0;arr[i]<=k && i<=n;++i)
    {
    	for(int j=best;j>=0;--j)
    	{
    		best = j;
    		if(arr[i] + brr[j]<=k)
    		{
    			break;
    		}
    	}
    	ans = max(ans,i+best);
    }
    cout<<ans;
}

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("/home/suryakant/input.txt","r",stdin);
		freopen("/home/suryakant/output.txt","w",stdout);
	#endif

    int t=1;
    // cin>>t;
    while(t--)
    {
    	solve_main();
    }
    //for(int caset=1;caset<=t;++caset)
    //{
    //    solve_main();
    //}
    
}

Measured memory_bytes: 6700
#include <stdio.h>
#include <string.h>

int main(){
    char s[1020],t[1020];
    int contador=0,tams,tamt,minimo;

    scanf("%s ",s);
    scanf(" %s",t);

    tams = strlen(s);
    tamt = strlen(t);
    minimo = tamt;

    for(int i =0;i<tams - tamt +1;i++){
        contador =0;
        //printf("s[%d]: %c - t[%d]: %c\n", i+j, s[i+j], j, t[j]);
        for(int j=0;j<tamt;j++){

        //    printf("s[%d]: %c - t[%d]: %c\n", i+j, s[i+j], j, t[j]);
          if(s[i+j]!=t[j]){
           contador++;
            }
        }
        if(minimo>contador){
            minimo = contador;
        }
    //    puts("----");
    //    printf("%d\n",contador);
        //if(s[i]!=t[j])
        //    contador++;

    }
    printf("%d\n",minimo);

    return 0;
}


Measured memory_bytes: 1636
import numpy as np

N = int(input())
P = tuple(map(float, input().split()))

dp = np.zeros((N + 1, N + 1), dtype=float)
dp[0][0] = 1
for i in range(N):
    dp[i + 1][1:] += dp[i][:-1] * P[i]
    dp[i + 1][:-1] += dp[i][:-1] * (1 - P[i])
print(sum(dp[N][(N + 1) // 2:]))


Measured memory_bytes: 82740
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Queue, PriorityQueue}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N, K = in.next().toInt
  val a = new Array[Int](N+1)
  for (i <- 1 to N)
    a(i) = in.next().toInt


  //
  val MOD = 1e9.toInt + 7
  val dp = Array.ofDim[Long](N+2, K+2)
  dp(0)(0) = 1

  for (i <- 1 to N) {
    for (j <- 1 to K) {
      dp(i-1)(j) += dp(i-1)(j-1)
      dp(i-1)(j) %= MOD
    }

    val now = a(i)
    for (k <- 0 to now) {
      dp(i)(k) = dp(i-1)(k)
      dp(i)(k) %= MOD
    }
    for (k <- now+1 to K) {
      dp(i)(k) = dp(i-1)(k) - dp(i-1)(k-(now+1))
      dp(i)(k) += MOD
      dp(i)(k) %= MOD
    }
  }

  println(dp(N)(K))
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 146028
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
using namespace std;
#define LL long long
#define INF 4000000000000000001
LL L,R,ans;
int main()
{
	scanf("%lld%lld",&L,&R);
	ans=INF;
	if(L/2019<R/2019){printf("0\n");return 0;}
	L%=2019,R%=2019;
	for(int i=L;i<=R;i++)
		for(int j=L;j<=R;j++)
		if(i!=j)ans=min(ans,(1LL*i*j)%2019);
	printf("%lld",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define ss second
#define ff first 
#define ub upper_bound
#define lb lower_bound
// #define mp make_pair
const ll M=1000000007;
ll power(ll x,ll n){if(n==0)return 1;else if(n%2==0)return (power((x*x)%M,n/2))%M;else return ((x%M)*power(x,n-1)%M);}
ll ncr(int n,int r){if(r>n)return 0;if(r > n - r) r = n - r;ll ans = 1;
int i;for(i = 1; i <= r; i++){ans *= n - r + i;ans /= i;}return ans;}
ll nCrModpDP(ll n, ll r, ll p){ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
    for (ll i = 1; i <= n; i++){ 
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll ncrmod(ll n, ll r, ll p){ 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
   return (ncrmod(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p;  
} 
ll modInverse(ll a,ll m) 
{ 
   ll m0 = m; 
   ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
       ll q = a / m; 
       ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 
ll fun(ll num[],ll sum,ll n){
map<ll,ll>mp;
for(int i=0; i<n; i++){
mp[num[i]]++;
}
ll ans=0;
for(int i=0; i<n; i++){
if(mp[sum-num[i]]>0&&(sum-num[i]!=num[i])&&(mp[num[i]]>0)){
ans+=1,mp[sum-num[i]]--,mp[num[i]]--;
}
else if(mp[sum-num[i]]>=2&&(sum-num[i]==num[i])){
ans+=1,mp[sum-num[i]]-=2;
}
}
return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll a,b;
cin>>a>>b;
if((a<=8)&&(b<=8))
cout<<"Yay!";
else
cout<<":(";
return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
unsigned long long a[101];
inline long long read(){
    long long x=0;
    bool f=0;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-') f=!f;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=x*10+c-'0',c=getchar();
    }
    return f?-x:x;
}
unsigned long long gcd(unsigned long long x,unsigned long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
int main(){
    int n;
    n=read();
    for(int i=1;i<=n;++i)
        a[i]=read();
    for(int i=2;i<=n;++i)
        a[i]=a[i]/gcd(a[i],a[i-1])*a[i-1];
    cout<<a[n];
    puts("");
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <queue>
#include <stack>
#include <iomanip>
#include <ctype.h>
#include <map>
#include <set>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <sstream>
#include <math.h>
#include <time.h>
#include <iostream>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <tuple>
#include <cmath>
#include <stdio.h>      /* printf, fgets */
#include <stdlib.h>
#include <fstream>

using namespace std;

typedef long long LL;

#define FOR(i,n) for(int i = 0;i < n;i++)
#define MP make_pair
#define PB push_back
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define CLEAR(a) memset(a, 0, sizeof(a))
#define ERASE(a) memset(a, -1, sizeof(a))
#define INF 2000000007LL
#define y1 uu1
#define y2 uu2
const double EPS = 1E-12;
const double PI = acos(-1.0);
const LL mod = 1000000007;

using namespace std;

int n;
string s;
set<int> pos[10];

void solve() {
  cin >> n;
  cin >> s;
  FOR(i, s.length()) {
    pos[s[i] - '0'].insert(i);
  }

  int ans = 0;
  FOR(i1,10) {
    int idx = 0;
    auto it = pos[i1].lower_bound(idx);

    if (it == pos[i1].end()) continue;
    int idx2 = 1+(*it);

    //cerr << "FD " << i1 << ' ' << idx2 << endl;

    FOR(i2,10) {

      auto it2 = pos[i2].lower_bound(idx2);
      if (it2 == pos[i2].end()) continue;
      int idx3 = 1+(*it2);

      //cerr << "SD " << i2 << ' ' << idx3 << endl;

      FOR(i3,10) {
        auto it3 = pos[i3].lower_bound(idx3);
        if (it3 == pos[i3].end()) continue;
        //cerr << "LD " << i3 << ' ' << *it3 << endl;
        ans++;
      }
    }
  }
  cout << ans << endl;
}

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}


Measured memory_bytes: 1664
n=int(input())
a=[int(i) for i in input().split()]

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

left=[0]*n
right=[0]*n

for i in range(1,n):
    left[i]=gcd(left[i-1],a[i-1])
    right[n-1-i]=gcd(a[n-i],right[n-i])

ans=0
for i,j in zip(left,right):
    ans=max(ans,gcd(i,j))
print(ans)


Measured memory_bytes: 14060
# デバッグ用
GBN_DEBUG = False
def dprn(s, i):
    if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
    if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
    if GBN_DEBUG: print(i, end=" ")
def endl(): 
    if GBN_DEBUG: print('')
def puts(s): print(s)

#本体ここから

#S = input()
#N = int(input())
#S, T = input().split()
#a, b, h = map(int, input().split())
#W = [input() for _ in range(N)]
#A = list(map(int, input().split()))

#GBN_DEBUG = True

a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

template <typename T>
class SparseTable {
	using func_t = function<T(T, T)>;
	int n;
	func_t merge;
	vector<vector<T>> t;
	int clz(unsigned int w) {
		return (w & 0xffff0000) ? (w & 0xff000000) ? (w & 0xf0000000) ? (w & 0xc0000000) ? (w & 0x80000000) ? 0 : 1 : (w & 0xe0000000) ? 2 : 3 : (w & 0xfc000000) ? (w & 0xf8000000) ? 4 : 5 : (w & 0xfe000000) ? 6 : 7 : (w & 0xfff00000) ? (w & 0xffc00000) ? (w & 0xff800000) ? 8 : 9 : (w & 0xffe00000) ? 10 : 11 : (w & 0xfffc0000) ? (w & 0xfff80000) ? 12 : 13 : (w & 0xfffe0000) ? 14 : 15 : (w & 0xffffff00) ? (w & 0xfffff000) ? (w & 0xffffc000) ? (w & 0xffff8000) ? 16 : 17 : (w & 0xffffe000) ? 18 : 19 : (w & 0xfffffc00) ? (w & 0xfffff800) ? 20 : 21 : (w & 0xfffffe00) ? 22 : 23 : (w & 0xfffffff0) ? (w & 0xffffffc0) ? (w & 0xffffff80) ? 24 : 25 : (w & 0xffffffe0) ? 26 : 27 : (w & 0xfffffffc) ? (w & 0xfffffff8) ? 28 : 29 : (w & 0xfffffffe) ? 30 : 31;
	}
public:
	SparseTable(const vector<T>& b, func_t mq = [](T l, T r) { return min(l, r); }) : merge(mq) {
		n = b.size();
		t.push_back(b);
		for (int i = 2, j = 1; i <= n; i <<= 1, j++) {
			t.push_back(vector<T>());
			for (int k = 0; k + i <= n; k++) {
				t[j].push_back(merge(t[j - 1][k], t[j - 1][k + i / 2]));
			}
		}
	}
	T find(int l, int r) {
		r++;
		assert(l < r);
		unsigned int w = r - l;
		int i = 31 - clz(w);
		return merge(t[i][l], t[i][r - (1 << i)]);
	}
	T operator[](int id) {
		return t[0][id];
	}
};

class LCA {
	int V, rt;
	vector<vector<int>> G;
	vector<int> depth, used, id;
	vector<int> vs, de;
	SparseTable<pii> st;
	void dfs(int s, int d) {
		used[s] = 1;
		vs.push_back(s);
		de.push_back(d);
		for (int v : G[s]) {
			if (!used[v]) {
				dfs(v, d + 1);
				vs.push_back(s);
				de.push_back(d);
			}
		}
	}
	vector<pii> init() {
		dfs(rt, 0);
		for (int i = 0; i < (int)vs.size(); i++) {
			if (id[vs[i]] == -1) id[vs[i]] = i;
		}
		vector<pii> r((int)vs.size());
		for (int i = 0; i < (int)vs.size(); i++) {
			r[i] = pii(de[i], vs[i]);
		}
		return r;
	}
public:
	LCA(vector<vector<int>> G_, int rt_ = 0)
		: V(G_.size()), rt(rt_), G(G_), depth(V), used(V), id(V, -1), st(init()) {
		for (int i = 0; i < V; i++) depth[i] = st[id[i]].first;
	}
	int calc(int a, int b) {
		return st.find(min(id[a], id[b]), max(id[a], id[b])).second;
	}
	int dist(int a, int b) {
		return depth[a] + depth[b] - depth[calc(a, b)] * 2;
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n;
	vector<vector<int>> G(n);
	for (int i = 0, k; i < n; i++) {
		cin >> k;
		for (int j = 0, c; j < k; j++) {
			cin >> c;
			if (c > i) {
				G[i].push_back(c);
				G[c].push_back(i);
			}
		}
	}
	LCA lca(G);
	cin >> q;
	for (int i = 0, u, v; i < q; i++) {
		cin >> u >> v;
		printf("%d\n", lca.calc(u, v));
	}
	return 0;
}

Measured memory_bytes: 54216
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b, int m) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res % m;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n;
    cin>>n;
    int coef = binpow(10,n,mod);
    coef -= (2*(binpow(9,n,mod)));
    coef %= mod;
    coef += binpow(8,n,mod);
    coef += mod;
    cout<<coef%mod<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int da=0,he=0;
    int a;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a);
        he += a;
        if(a>da)da=a;
    }
    printf("%d",he-da/2);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define mod 998244353
#define mad(a,b) a=(a+b)%mod;
#define N 310
#define M 100010
ll f[N][M];
ll n,a[N];
ll g[N][M];
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<M;i++)for(int j=0;j<n;j++)f[j][i]=0,g[j][i]=0;
    f[0][0]=g[0][0]=1;
    for(int i=0;i<n;i++){
	for(int j=0;j<M;j++){
	    mad(f[i+1][j],f[i][j]*2);
	    mad(g[i+1][j],g[i][j]);
	    if(j+a[i]<M){
		mad(f[i+1][j+a[i]],f[i][j]);
		mad(g[i+1][j+a[i]],g[i][j]);
	    }
	}
    }
    ll sum=0; for(int i=0;i<n;i++)sum+=a[i];
    ll ans=1;
    for(int i=0;i<n;i++)ans=ans*3%mod;
    for(int i=0;i<M;i++){
	if(i*2>=sum)mad(ans,-3*f[n][i]);
    }
    if(sum%2==0){
	mad(ans,3*g[n][sum/2]);
    }
    if(ans<0)ans+=mod;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 473344
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 100000
using namespace std;
typedef long long int ll;

int main(){
    int n;
    cin >>n;
    ll ans=100000;
    for
    (int i=0; i<n; i++) {
        ans *= 1.05;
        ll hoge= ans - (ans%1000);
        if (ans%1000>0) {
            hoge+=1000;
        }
        ans = hoge;
    }
    cout << ans <<endl;
}

Measured memory_bytes: 1156
import java.util.*;

public class Main{
        public static void main(String[] args){
                try(Scanner sc = new Scanner(System.in)){
                        while(true){
                                int N = sc.nextInt();
                                if(N == 0) {
                                        break;
                                }
                                int[] a = new int[N];
                                for(int i = 0; i < N; i++){
                                        a[i] = sc.nextInt();
                                }
                                Arrays.sort(a);
                                int ans = 1000001;
                                for(int i = 0; i < N - 1; i++){
                                        ans = Math.min(ans, a[i+1] - a[i]);
                                }
                                System.out.println(ans);
                        }
                }
        }
}

Measured memory_bytes: 47156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n)
    {
        cin >> h[i];
    }

    vector<int> dp(n, 0);
    dp[1] = abs(h[0] - h[1]);
    for (int i = 2; i < n; i++)
    {
        int cost1 = dp[i - 1] + abs(h[i] - h[i - 1]);
        int cost2 = dp[i - 2] + abs(h[i] - h[i - 2]);
        dp[i] = min(cost1, cost2);
    }

    cout << dp[n - 1] << endl;

    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int c = int.Parse(input[2]);
            int d = int.Parse(input[3]);

            if (Math.Abs(a - b) <= d && Math.Abs(b - c) <= d) Console.WriteLine("Yes");
            else if (Math.Abs(a - c) <= d) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int l=s.length(),i;
    for(i=0;i<l;i++)
    {
        if(s[i]!=t[i])
        {
            cout<<"No";
            exit(0);
        }
    }
    cout<<"Yes";
}


Measured memory_bytes: 3548
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int n;
    ll k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }
    
    vi now(n);
    vi seen(n, -1);
    now[0] = 0;
    seen[0] = 0;
    
    int S, T;
    
    rep(i, n+1){
        now[i+1] = a[now[i]];
        if(seen[now[i+1]] != -1){
            S = seen[now[i+1]];
            T = (i+1) - S;
            break;
        }
        seen[now[i+1]] = i+1;
    }
    
    // cout << S << " " << T << endl;
    if(k <= S) {
        cout << now[k]+1 << endl;
        return;
    }
    k = k - S;
    int K = k % T;
    cout << now[S+K]+1 << endl;
    return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


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

typedef long long ll;

int main(){
  ll N,M,ans=0;
  cin>>N>>M;
  ll k=min(N,M/2);
  N-=k;
  M-=k*2;
  ans+=k;
  ans+=(M/4);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    while True:
        N,M,P=map(int, raw_input().split(" "))
        if N|M|P == 0: break
        solve(N,M,P)

def solve(N,M,P):
    x=[]
    s=0
    N2=N
    while N2>0:
        x.append( int( raw_input() ) )
        s+=x[-1]*100
        N2-=1
    s-=(s/100)*P
    M-=1
    print s/x[M] if x[M]>0 else 0

if __name__=="__main__": main()

Measured memory_bytes: 4240
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())

k, a, b = mi()
ans1 = k + 1
ans2 = 0
if b > a and k > a - 1:
    k -= a - 1
    ans2 = a + (k // 2) * (b - a) + k % 2
print(max(ans1, ans2))

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

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using ull = unsigned long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vs = vector<string>;
using vvs = vector<vs>;
using vc = vector<char>;
using vvc = vector<vc>;
using ii = pair<int,int>;
using vii = vector<ii>;
using vvii = vector<vii>;
using dd = pair<double, double>;
using vdd = vector<dd>;
using vvdd = vector<vdd>;
using Mii = map<int,int>;
using vMii = vector<Mii>;
using Si = set<int>;
using vSi = vector<Si>;
using vvSi = vector<vSi>;

#define fi first
#define se second
#define INF 1e9 + 5
#define mod(a,m) (a%m+m)%m
#define PB push_back
#define MP make_pair

int main(){
//	cout.setf(ios::fixed);
//	cout.precision(4);
	ll n;
	while (cin >> n) {
		ll ans = n * (n-1) / 2;
		cout << ans << '\n';
	}
}



Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"


def main():
    a = input()
    b = input()
    c = input()
    print(a[0] + b[1] + c[2])


if __name__ == '__main__':
    main()


Measured memory_bytes: 4172
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, m;
  cin >> n >> m;
  vector<int> item;
  int all = 0;
  for(int i = 0, temp; i < n; ++i){
    cin >> temp;
    all += temp;
    item.push_back(temp);
  }
  sort(item.begin(), item.end(), greater<>());
  double minimum = all / 4.0 / m;
  string ans;
  ans = minimum <= item[m - 1] ? "Yes" : "No";
  cout << ans << endl;
}



Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	//Arrays.sort(array, (a, b) -> Integer.compare(a[0], b[0]));
	
	public static void main(String[] args) {
		int a=scan.nextInt();
		int b[]=setArray(a);
		Arrays.sort(b);
		System.out.println(b[a/2]-b[a/2-1]);
	}
}

Measured memory_bytes: 50520
nx = list(map(int,input().split()))
n=nx[0]
x=nx[1]
a=list(map(int,input().split()))
b=sorted(a)
ans = 0
g = 0
i=0
for i in range(n):
    if g + b[i] <= x:
        ans = i + 1
        g = g + b[i]
        if i == n-1 and g != x:
            ans = ans-1
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int main(void){
  long int n, k;
  long double ex=0.0, tmp=0.0;
  cin >> n >> k;
  int i, count=0, sum=0;
  for(i=1; i<=n; i++){
    sum = i;
    while(sum <= k-1 && sum != 0){
      sum *= 2;
      count++;
      // cout << sum << "+";
    }

    // cout << count << endl;
    tmp = 1.0/n;
    for(int j=0; j<count; j++){
      tmp /= 2.0;
    }

    ex += tmp;
    tmp = 0.0;
    count = 0;
    sum = 0;
  }
  cout << setprecision(11) << ex << endl;
  return 0;
}

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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

const int maxn = 3001;

double dp[maxn][maxn];
double a[maxn];
int n;

double solve(int idx, int head) {
	if(idx == n+1){
		if(head == 0){return 1;}
		else
			return 0;
	}
	
	if(fabs(dp[idx][head] + 1) > eps){return dp[idx][head];}
	return dp[idx][head] = a[idx] * solve(idx+1, head-1) + (1.0 - a[idx]) * solve(idx+1, head);
}

int main(){
	int i,j;
	for(i=0;i<maxn;i++){
		for(j=0;j<maxn;j++){
			dp[i][j] = 0;
		}
	}
	
	scanf("%d",&n);
	for(i=1;i<=n;i++){scanf("%lf",&a[i]);}
	// top down approach

	// int minim = n/2 + 1;
	// double ans = 0;
	// for(i=minim;i<=n;i++){
	// 	ans += solve(1, i);
	// }


	// bottom up approach
	int minim = n/2 + 1;
	double ans = 0;
	dp[1][1] = a[1];
	dp[1][0] = 1-a[1];
	for(i=2;i<=n;i++){
		dp[i][0] = dp[i-1][0]*(1-a[i]);
		for(j=1;j<=i;j++){
			dp[i][j] = dp[i-1][j-1]*a[i] + dp[i-1][j]*(1-a[i]);
		}
	}
	for(i=minim;i<=n;i++){
		ans += dp[n][i];
	}
	printf("%.10lf\n",ans);
	return 0;
};

Measured memory_bytes: 70784
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reg(i,a,b) for(int i=(a);i<=(b);i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=(b);i>=(a);i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX


struct data{
	char c;
	lli p;
	data(){
		c=0; p = 0;
	}
};

map<lli,lli> ars[256];
lli sizn[256];

typedef string::iterator state;

bool isdig(char c){
	return ('0'<=c && c<='9');
}

bool isout(data d){
	if(d.c==-1)return false;
	return (sizn[d.c]<=d.p || d.p<0);
}

lli getnum(data d){
	if(d.c==-1)return d.p;
	lli res=-1;
	map<lli,lli>::iterator np = ars[d.c].find(d.p);
	if(np!=ars[d.c].end())res = ars[d.c][d.p];
	return res;
}

lli num(state& s){
	lli res = 0;
	while(isdig(*s)){
		res *=10;
		res += *s-'0';
		s++;
	}
	return res;
}

data dfs(state& s){
	data res;
	if(isdig(*s)){
		res.c= -1;
		res.p = num(s);
	}
	else{
		res.c = *s;
		s++;
		if(*s!='[')printf("err kakko\n");
		s++;
		data nd = dfs(s);
		if(*s!=']')printf("err kokka\n");
		s++;
		
		if(isout(nd))res.p = -1;
		else res.p = getnum(nd);
	}
	return res;
}

data expr(string s){
	state ns = s.begin();
	return dfs(ns);
}

bool eval(string s){
	bool res = true;
	int isas = -1;
	rep(i,s.size()){
		if(s[i]=='=')isas=i;
	}
	if(isas==-1){
		data nd = expr(s);
		sizn[nd.c]=nd.p;
	}
	else{
		string s1,s2;
		rep(i,isas){
			s1 += s[i];
		}
		reg(i,isas+1,((int)s.size())-1){
			s2 += s[i];
		}
		data d1 = expr(s1);
		data d2 = expr(s2);
		
		if(isout(d1) || isout(d2) || getnum(d2)==-1)res = false;
		else ars[d1.c][d1.p] = getnum(d2);
	}
	return res;
}

int main(void){
	while(1){
		vector<string> ss;
		while(1){
			char s[100];
			scanf("%s",s);
			if(s[0]=='.')break;
			ss.push_back(string(s));
		}
		if(ss.size()==0)break;
		
		rep(i,256)ars[i].clear();
		memset(sizn,0,sizeof(sizn));
		rep(i,ss.size()){
			if(eval(ss[i]) == false){
				printf("%d\n",i+1);
				goto nextss;
			}
		}
		printf("0\n");
nextss:;
	}
	return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>


int Seksort(int *p,int len){

  int i,j,tmp,low;
    int c=0;

  for(i=0;i<len;i++){
    low=i;
    for(j=i;j<len;j++){

      if(p[j]<p[low]) low = j;

    }
    if( i != low){

      tmp=p[i];
      p[i]=p[low];
      p[low]=tmp;
      c++;
    }
  }
  return c;


}


main(){
  int i,a,A[100],c=0;

  scanf("%d",&a);



  for(i=0; i <a; i++){
    scanf("%d",&A[i]);

  }

  c=Seksort(A,a);

  printf("%d",A[0]);

  for(i=1; i < a; i++){
    printf(" %d",A[i]);
  }

  printf("\n%d\n",c);

return 0;
}

Measured memory_bytes: 600
N = int(input())
A = list(map(int, input().split()))
s = sum(A)
K = s // (N * (N + 1) // 2)
if N == 1:
    print("YES")
    exit()
if s % (N * (N + 1) // 2) != 0:
    print("NO")
    exit()
d = [0] * (N - 1)
for i in range(N - 1):
    d[i] = A[i + 1] - A[i] - K

for i in range(N - 1):
    if d[i] > 0 or abs(d[i]) % N != 0:
        print("NO")
        exit()
print("YES")

Measured memory_bytes: 14488
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=1
x=t-0.006*h[0]
m=abs(x-a)
for i in range(n):
    if abs(t-0.006*h[i]-a)<m:
        ans=i+1
        m=abs(t-0.006*h[i]-a)
print(ans)


Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
#define ar array
#define pb push_back


int main()
{
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("outputc.txt","w",stdout);
	// #endif
	
	//int t;
	//cin>>t;
	//while(t--)
	{
		int n;
		cin>>n;
		string s;
		cin>>s;
		int ans=0;
		int i,j;
		for(i=0,j=n-1;i<n&&j>=0;i++)
		{
			if(i>=j)break;
			if(s[i]=='W')
			{
				while(1)
				{
					if(s[j]=='R'||i>=j||j==0)break;
					j--;
				}
				if(i!=j)
				{
					swap(s[i],s[j]);
					ans++;
				}
			}
			//cout<<s<<'\n';
		}
		//cout<<s;
		cout<<ans<<'\n';
		
	}
		
}



Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t N;
  cin >> N;
  int ans = 0;
  int64_t M = N;
  for (int i = 2; i <= sqrt(M); i++) {
    if (N % i == 0) {
      int64_t k = i; 
      for (int j = 0; j < 45; j++) {
        if (N % k == 0) {
          N /= k;
          ans++;
          k *= i;
        }
        else {
          while (N % i == 0) {
            N /= i;
          }
          break;
        }
      }
    }
  }
  if (N != 1) {
    ans++;
  }
  if (M == N) {
    ans = 1;
  }
  if (M == 1) {
    ans = 0;
  }
  cout << ans << endl;
}

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

int main(){

    stack<int> a;
    string str;

    while(cin >> str){
        if(str == "+"){
            int s;
            s = a.top();
            a.pop();
            s += a.top();
            a.pop();
            a.push(s);
        }else if(str == "-"){
            int s;
            s = a.top();
            a.pop();
            s = a.top() - s;
            a.pop();
            a.push(s);
        }else if(str == "*"){
            int s;
            s = a.top();
            a.pop();
            s *= a.top();
            a.pop();
            a.push(s);
        }else
        {
            a.push(atoi(str.c_str()));
        }    
    }

    cout << a.top() << endl;;
}
    


Measured memory_bytes: 3232
N = map(int, input().split())
V = [int(i) for i in input().split()] 
C = [int(i) for i in input().split()] 

sum = 0
for i in range(len(V)):
  if V[i] - C[i] > 0:
    sum = sum + V[i] - C[i]

print(sum)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>
#include <queue>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = false;

int main(){

    int n, m;
    cin >> n >> m;

    if(n == m){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
//  Created by conan1024hao on 2019/11/19.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int a,b,k;
    cin>>a>>b>>k;
    int cnt=0;
    for(int i=mmax(a,b);i>=1;i--){
        if(a%i==0&&b%i==0){
            cnt++;
            if(cnt==k){
                cout<<i<<endl;
                return 0;
            }
        }
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 256
//Zory-2019
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) {puts("error");exit(666);}
    #define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
    #define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;GG(e<0)while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e5+10;

	struct DSU
	{
		int fa[N];DSU(){fo(i,0,N-1)fa[i]=i;}
		int findfa(int x){return fa[x]==x?x:fa[x]=findfa(fa[x]);}
		void merg(int x,int y){fa[findfa(x)]=findfa(y);}
	}dsu;
	pr a[N],b[N];int c[N];int fm[N];
	bool check(int n)
	{
		fo(i,2,n) if(c[i-1]>=a[i].FR) return 1;
		return 0;
	}
    void main()
	{
		int n=qread();fo(i,1,n) a[i].FR=qread();fo(i,1,n) a[i].SE=qread(),c[i]=a[i].SE;
		sort(a+1,a+n+1);fo(i,1,n) b[i]=MP(a[i].SE,i);sort(b+1,b+n+1);sort(c+1,c+n+1);
		fo(i,1,n) if(c[i]<a[i].FR) {puts("No");return;}
		if(check(n)) {puts("Yes");return;}
		fo(i,1,n) dsu.merg(i,b[i].SE);
		int cnt=0;fo(i,1,n) cnt+=dsu.findfa(i)==i;
		if(cnt>1) {puts("Yes");return;}
		puts("No");
	}
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


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

using namespace std;

int main()
{
    int k,a,b;
    bool tr=false;
    cin>>k>>a>>b;

    int div;

    div = a/k;
    if(div*k == a)
        tr = true;
    if(div*k + k <=b)
        tr=true;
    if(tr == true)
        cout<<"OK";
    else
        cout<<"NG";
}


Measured memory_bytes: 3636
def merge(A, left, mid, right):
    INF = 10**9
    global cnt
    L = A[left: mid] + [INF]
    R = A[mid: right] + [INF]
    i = 0
    j = 0
    
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
            cnt += (mid - left) - i

def mergeSort(A, left, right):
    if left+1 < right:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)
        
n = int(input())
A = list(map(int, input().split()))
cnt = 0
mergeSort(A, 0, n)

print(cnt)


Measured memory_bytes: 27468
console.log(require('fs').readFileSync('/dev/stdin','utf8').trim().split(/[ |\n]/).slice(1).map((k,i,a)=>`node ${++i}: key = ${k}, `+((i-1)?`parent key = ${a[Math.floor(i/2)-1]}, `:'')+(2*i-1<a.length?`left key = ${a[2*i-1]}, `:'')+(2*i<a.length?`right key = ${a[2*i]}, `:'')).join('\n'));


Measured memory_bytes: 16488