akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
	var x, y int

	_, _ = fmt.Scan(&x, &y)

	if turukame(x, y){
		fmt.Println("Yes")
	}else {
		fmt.Println("No")
	}
}

func turukame(x, y int) bool {
	var s int
	for i:=0;i<x+1;i++{
		s = 2*(x-i) + 4*i
		if y==s {
			return true
		}
	}
	return false
}

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

using namespace std;

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

    map<string, int> mp;
    while (n--) {
        string s;
        cin >> s;
        mp[s]++;
    }

    int m;
    cin >> m;
    while (m--) {
        string s;
        cin >> s;
        mp[s]--;
    }

    int ans = 0;
    for (const auto &w:mp) {
        ans = max(ans, w.second);
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if(ceil(a*1.0/d)>=ceil(c*1.0/b)){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
} 

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int N; 
  cin >> N;

  pair<int, int> p(0, 0);
  REP(i, N){
    int A, B;
    cin >> A >> B;
    if(p.first < A) p = {A, B};
  }

  cout << p.first+p.second << endl;

  return 0;
}

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

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


int main(){
  while(1){
    char a;
    a = getchar();
    if(a == EOF) break;

    if('a' <= a && a <= 'z'){
      char ans = a - 'a' + 'A';
      cout << ans;
    }
    else if('A' <= a && a <= 'Z'){
      char ans = a - 'A' + 'a';
      cout << ans;
    }
    else{
      cout << a;
    }
  }
}






Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
  int N, X;
  cin >> N >> X;
  int count = 0, Y = 0;
  int temp;
  while(Y <= X && count < N){
   cin >> temp;
    Y += temp;
    count++;
    
  }
  if(Y <= X) count++;
  cout << count;
  
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define MAXN 310
using namespace std;
typedef long double ld;

int n;
ld pd[MAXN][MAXN][MAXN];
bool vi[MAXN][MAXN][MAXN];

ld solve(int q1, int q2, int q3){
	
	if(q1+q2+q3 == 0) return 0;
	if(vi[q1][q2][q3]) return pd[q1][q2][q3];
	
	
	ld ax = ((ld)n)/(q1+q2+q3);
	ld res = ax;
	ax = q1+q2+q3;
	//cout << res << endl;
	
	if(q1 != 0) res += ((ld)q1)/ax *(solve(q1-1,q2,q3));
	if(q2 != 0) res += ((ld)q2)/ax *(solve(q1+1,q2-1,q3));
	if(q3 != 0) res += ((ld)q3)/ax *(solve(q1,q2+1,q3-1));
	vi[q1][q2][q3] = 1;
	return pd[q1][q2][q3] = res;
}


int main (){
	
	cin >> n;
	int q1=0,q2=0,q3=0, ax;
	for(int i = 1; i <= n; i++){
		cin >> ax;
		if(ax == 1) q1++;
		if(ax == 2) q2++;
		if(ax == 3) q3++;
	}
	
	printf("%.12Lf\n", solve(q1,q2,q3));
}


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

using namespace std;

const int mod = (1e9) + 7;

int n, a[60];
long long x, ans;

int main()
{
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    for (int j = 0; j < 60; j++)
      if (x & (1ll << j))
        a[j]++;
  }
  for (int j = 0; j < 60; j++) {
    long long aux = 0;
    for (int p = 1; p <= a[j]; p++) {
      aux += (1ll << j);
      aux %= mod;
    }
    aux = (aux * (n - a[j])) % mod;
    ans = (ans + aux) % mod;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;long n,k,f,y,m=1;void main(){readf("%d\n",&n);auto A=readln.split.to!(long[])~1;long*u=&A.dup[0],v=&A.dup[0];while(n-m>1){k=(m+n)/2;*u=*v=0;foreach(a;A){if(*u<a)*++u=a,*++v=1;else{while(*--u>=a){y=*v;while(--*(u+1)>=*u&&y)--y/=k;*--v+=y;}if(*++u>a){while(--*u>=a&&*v)--*v/=k;*u=a,++*v;}++f,++*v;}}*v-->k+1?m:n=k;--f,--u;}writeln(f?n:1);}

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

using namespace std;

const int N = 1003;
typedef long long ll;
typedef pair<int, int> ii;
int x, y, z, k, f[N][N];
ll a[N], b[N], c[N];

class FastIO {
public:
	FastIO() {
		///nothing
	}
	int get_int() {
		bool neg = 0;
		register int c;
		c = getchar();
		int res = 0;
		if (c == '-') {
			neg = true;
			c = getchar();
		}
		for(; '0' <= c && c <= '9'; c = getchar())
			res = res * 10 + c - '0';
		if (neg) return -res;
		return res;
	}
	ll get_ll() {
		bool neg = 0;
		register int c;
		c = getchar();
		ll res = 0;
		if (c == '-') {
			neg = true;
			c = getchar();
		}
		for(; '0' <= c && c <= '9'; c = getchar())
			res = res * 10 + c - '0';
		if (neg) return -res;
		return res;
	}
private:
	
};

struct CompareII {
	bool operator()(const ii& u, const ii& v) {
		int x1 = u.first, y1 = u.second;
		int x2 = v.first, y2 = v.second;
		return b[x1] + c[y1] + a[f[x1][y1]] < b[x2] + c[y2] + a[f[x2][y2]];
	}
};

int main() {
	FastIO io;
	x = io.get_int();
	y = io.get_int();
	z = io.get_int();
	k = io.get_int();
	for (int i = 1; i <= x; ++i) a[i] = io.get_ll();
	for (int i = 1; i <= y; ++i) b[i] = io.get_ll();
	for (int i = 1; i <= z; ++i) c[i] = io.get_ll();
	priority_queue<ii, vector<ii>, CompareII > heap;
	sort(a + 1, a + 1 + x, greater<ll>());
	sort(b + 1, b + 1 + y, greater<ll>());
	sort(c + 1, c + 1 + z, greater<ll>());
	for (int i = 1; i <= y; ++i)
		for (int j = 1; j <= z; ++j) {
			f[i][j] = 1;
			heap.push(ii(i, j));
		}
	while (k--) {
		ii t = heap.top(); heap.pop();
		int x1 = t.first, y1 = t.second;
		printf("%lld\n", b[x1] + c[y1] + a[f[x1][y1]]);
		if (f[x1][y1] < x) {
			f[x1][y1]++;
			heap.push(ii(x1, y1));
		}			
	}
	cerr << 1.0 * clock() / CLOCKS_PER_SEC;
	return 0;
}


Measured memory_bytes: 12652
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

struct Dinic{
  ll INF = 1000000000000000000, MAX_V;
  struct edge{ll to, cap, rev;};
  vector<vector<edge>> G;
  vector<ll> level, iter;
  Dinic(ll n){
    MAX_V = n+1;
    G.resize(n+1);
    level.resize(n+1);
    iter.resize(n+1);
  }
  void add_edge(ll from, ll to, ll cap){
    G[from].push_back(edge{to, cap, (ll)G[to].size()});
    G[to].push_back(edge{from, 0, (ll)G[from].size() - 1});
  }
  void bfs(ll s){
    for(int i=0;i<MAX_V;i++) level[i] = -1;
    queue<ll> que;
    level[s] = 0;
    que.push(0);
    while(!que.empty()){
      ll v = que.front();que.pop();
      for(int i=0;i<G[v].size();i++){
        edge &e = G[v][i];
        if(e.cap > 0 && level[e.to] < 0){
          level[e.to] = level[v] + 1;
          que.push(e.to);
        }
      }
    }
  }
  ll dfs(ll v, ll t, ll f){
    if(v==t) return f;
    for(ll &i = iter[v];i<G[v].size();i++){
      edge &e = G[v][i];
      if(e.cap>0&&level[v] < level[e.to]){
        ll d = dfs(e.to, t, min(f, e.cap));
        if(d > 0){
          e.cap -= d;
          G[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  ll max_flow(ll s, ll t){
    ll flow = 0;
    for(;;){
      bfs(s);
      if(level[t] < 0) return flow;
      for(int i=0;i<MAX_V;i++) iter[i] = 0;
      ll f;
      while((f=dfs(s, t, INF))>0) flow += f;
    }
  }
};
int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  vvl a = vv(n, 2, 0, ll);
  vvl b = vv(n, 2, 0, ll);
  Dinic D(2*n+2);
  re(i, n) {
    std::cin >> a[i][0] >> a[i][1];
    D.add_edge(n+i+1, 2*n+1, 1);
  }
  re(i, n){
    std::cin >> b[i][0] >> b[i][1];
    D.add_edge(0, i+1, 1);
    re(j, n){
      if(b[i][0]>a[j][0] && b[i][1] > a[j][1]) D.add_edge(i+1, n+j+1, 1);
    }
  }
  ll ans = D.max_flow(0, 2*n+1);
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 888
x = int(input())

if 400 <= x <= 599:
    print('8')
elif x <= 799:
    print('7')
elif x <= 999:
    print('6')
elif x <= 1199:
    print('5')
elif x <= 1399:
    print('4')
elif x <= 1599:
    print('3')
elif x <= 1799:
    print('2')
elif x <= 1999:
    print('1')

Measured memory_bytes: 9204
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  string S; cin>>S;

  string  ans = "Yes";
  if (S[0] == S[1] && S[1] == S[2]) ans = "No";

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]


def roll(s, rolllist):
    news = list(s)
    for i in range(6):
        news[i] = s[rolllist[i]]
    return news


# 同じサイコロならTrue 異なるならFalse
def isSameDice(s1, s2):
    rl = {0: [0, 1, 2, 3, 4, 5],
          1: [1, 5, 2, 3, 0, 4],  # N
          2: [2, 1, 5, 0, 4, 3],  # W
          3: [3, 1, 0, 5, 4, 2],  # E
          4: [4, 0, 2, 3, 5, 1],  # S
          5: [5, 4, 2, 3, 1, 0]}
    roll_z = [0, 3, 1, 4, 2, 5]
    if not (s1[0] in s2):
        return False
    # t = s2.index(s1[0])
    tl = [i for i, x in enumerate(s2) if x == s1[0]]
    for t in tl:
        s2 = roll(s2, rl[t])
        ss = s2
        for i in range(6):
            if s1 == ss:
                return True
            ss = roll(ss, roll_z)
    return False


c = []
for i in range(len(s)):
    for j in range(len(s)):
        if i < j:
            c.append([i, j])
for cc in c:
    if isSameDice(s[cc[0]], s[cc[1]]):
        print("No")
        exit()
print("Yes")



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

int main() {
    int N,M, A[100000];
    cin >> N >> M;
    int sumday = 0;
    for (int i = 0; i < M; i++) {
        cin >> A[i];
        sumday += A[i];
    }
    int ans = N - sumday;
    if(ans < 0) ans = -1;
    cout << ans;
}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

    int N;
    cin >> N;
    vector<int> A(N);
    rep (i, N)
    {
        cin >> A[i];
    }

    vs32 v;
    rep (i, N)
    {
        auto it = upper_bound(v.begin(), v.end(), A[i], [](const int x, const int y) { return x > y; });
        if (it == v.end())
        {
            v.push_back(A[i]);
        }
        else
        {
            *it = A[i];
        }
    }

    cout << v.size() << "\n";
    return 0;
}



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

#define int long long
#define MAX_N (200005)
#define debug(x) cout << #x <<":"<< x << endl;
#define debugArray(x) for(auto p:(x)) cerr << p <<" "; cerr << endl;
#define debugIdx(i, x) cerr << #i <<" : "<< i <<" "<< #x <<" : "<< x << endl;
const int MOD = (int)1e9+7;

signed main() {
	int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    priority_queue<int, vector<int>, greater<int>> pq;
    for(int i=0; i<N-1; i++){
        if(S[i]=='0' && S[i+1]=='1') pq.push(i+1);
    }

    int cnt=0, i=0, j=0, ans=0, cnt0=1;
    while(1){
        bool z=false;
        //debugIdx(i, j);
        while(1){
            //debug(j);
            if(j == N) {
                j--;
                break;
            }
            if(S[j]=='0'){
                if(j+1 < N){
                    if(S[j+1]=='0'){
                        cnt0++;
                    } else {
                        cnt++;
                    }
                } else {
                    cnt++;
                }
                if(cnt>K) {
                    j -= cnt0;
                    break;
                }
                j++;
            }
            else {
                cnt0=1;
                j++;
            }
        }
        //debugIdx(i, j);
        ans = max(ans, j-i+1);

        if(j>=N-1) break;
        i = pq.top(); pq.pop();
        cnt=K-1;
        cnt0=1;
    }

    cout << ans << endl;

}

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

int main(){
int l, r, d;
cin >> l >> r >> d;
int ans = 0;
for(int i = l; i<= r; i++){
if(i%d==0)ans++;
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 3588
N=int(input())
S=input()
d1=[0]*10
d2=[0]*100
d3=[0]*1000
for s in S:
    n=int(s)
    for i in range(100):
        if d2[i]==1:
            d3[i*10+n]=1
    for i in range(10):
        if d1[i]==1:
            d2[i*10+n]=1
    d1[n]=1
print(sum(d3))

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

int main()
{
	int l,r,x;
	cin>>l>>r>>x;
	int cnt = 0;
	for(int i = x; i <=r; i += x)
	{
		if(i >= l && i <= r) cnt++;
	}
	cout<<cnt<<endl;
}


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

struct Unionfind {
  // tree number
  vector<int> par;
  // tree rank
  vector<int> treerank;
  // constructor
  Unionfind(int n = 1) { stree(n + 1); }
  // make and initialization
  void stree(int n = 1) {
    par.assign(n, -1);
    treerank.assign(n, 0);
  }
  // search root
  int root(int x) {
    if(par[x] < 0) return x;
    return par[x] = root(par[x]);
  }
  // is same?
  bool issame(int x, int y) { return root(x) == root(y); }

  // add
  // already added, return 0
  bool uni(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return 0;
    if(treerank[x] > treerank[y]) swap(x, y);
    if(treerank[x] == treerank[y]) ++treerank[y];
    par[y] -= size(x);
    par[x] = y;
    return 1;
  }
  int size(int x) { return -par[root(x)]; }
};

struct data {
  int x, y, z;
};

long long n, m;
bool ch[100005] = {0};
vector<data> v;
Unionfind uf;

long long solve();

int main() {
  cin >> n >> m;
  uf = Unionfind(n + 1);
  for(int i = 0; i < m; ++i) {
    int x, y, z;
    cin >> x >> y >> z;
    --x, --y;
    uf.uni(x, y);
  }
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = 0; i < n; ++i)
    if(!ch[uf.root(i)]) {
      ++ans;
      ch[uf.root(i)] = 1;
    }
  return ans;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <stdlib.h>

int main()
{
    long long int n;
    long long int a[5];
    long long int i, min = 1000000000000000;
    scanf("%lld", &n);
    for (i = 0; i < 5; i++)
    {
        scanf("%lld", &a[i]);
        if (a[i] < min)
        {
            min = a[i];
        }
    }
    printf("%lld\n", ((n - 1) / min) + 5);
    return 0;
}

Measured memory_bytes: 128
module Main where

import Control.Applicative
import Control.Monad
import Data.List (break)

main :: IO ()
main = do
    [n, m, x] <- fmap read . words <$> getLine
    as <- fmap read . words <$> getLine :: IO [Int]
    let (ls, rs) = break (> x) as
    print $ min (length ls) (length rs)

Measured memory_bytes: 892
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
using ll = long long;
using namespace std;
const ll INF = 10000000000000;
int main() {
	double A, B, H, M;
	cin >> A >> B >> H >> M;
	long double ans = 0;
	long double pi = 3.14159265358979323846;
	long double deg, deg1, deg2 = 0;
	deg1 = H * 30; deg2 = M * 11 / 2;
	if (deg1 < deg2) deg = deg2 - deg1;
	else deg = deg1 - deg2;
	if (deg > 180) deg = 360 - deg;
	deg = deg / 180 * pi;
	ans = pow(A, 2) + pow(B, 2) - 2 * A * B * cos(deg);
	cout << setprecision(20) << pow(ans, 0.5) << endl;
}

Measured memory_bytes: 4096
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
int W,H,N;
int X1[5000];int X2[5000];
int Y1[5000];int Y2[5000];
bool field[5001][5001];
int dx[4]={-1,0,0,1};
int dy[4]={0,-1,1,0};
queue<pair<int,int> >que;
int main()
{
	while(true){
		for(int i=0;i<5001;i++)for(int j=0;j<5001;j++)field[i][j]=false;
		scanf("%d%d",&W,&H);
		if(W==0&&H==0)return 0;
		scanf("%d",&N);
		for(int i=0;i<N;i++)scanf("%d%d%d%d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
		for(int i=0;i<N;i++){
			for(int x=X1[i];x<X2[i];x++){
				for(int y=Y1[i];y<Y2[i];y++){
					field[x][y]=true;
				}
			}
		}
		
		int ans=0;
		for(int i=0;i<W;i++){
			for(int j=0;j<H;j++){
				if(field[i][j])continue;
				ans++;
				que.push(make_pair(i,j));
				while(!que.empty()){
					pair<int,int> P=que.front();que.pop();
					int pf=P.first;int ps=P.second;
					if(field[pf][ps])continue;
					field[pf][ps]=true;
					for(int k=0;k<4;k++){
						if(pf+dx[k]<0)continue;
						if(pf+dx[k]>=W)continue;
						if(ps+dy[k]<0)continue;
						if(ps+dy[k]>=H)continue;
						if(field[pf+dx[k]][ps+dy[k]])continue;
						que.push(make_pair(pf+dx[k],ps+dy[k]));
					}
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

 double pi=3.14159265358979323846;

 
int main(){
    int t=1;
    //cin>>t;
    while(t--){
        int k;string s;
        cin>>k;
        cin>>s;
        if(s.length()<=k) cout<<s<<endl;
        else cout<<s.substr(0,k)<<"..."<<endl;
    }


    
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int f[MAX_N]={};
int b[MAX_N]={};

int r[2002][2002]={};
int l[2002][2002]={};
int u[2002][2002]={};
int d[2002][2002]={};
bool s[2002][2002]={};

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


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i,j,a;
	for(i=1; i<=9; i++){
		for(j=1; j<=9; j++){
			a=i*j;
			printf("%dx%d=%d\n",i,j,a);
		}
	}
	return 0;
}


Measured memory_bytes: 2060
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

d = defaultdict(int)
s = int(input())
d[s] = 1
index = 1
while(1):
    if s % 2 == 0:
        s = s // 2
    else:
        s = 3 * s + 1
    index += 1
    if d[s] == 1:
        break
    d[s] = 1
print(index)




Measured memory_bytes: 7880
N,K=map(int,input().split())
A=sorted([int(i) for i in input().split()])
B=[A[-i-1] for i in range(N)]
mod=10**9+7
Fact=[0 for i in range(N+1)]
Finv=[0 for i in range(N+1)]
Fact[0]=1;Finv[0]=1
def inv(x):
    return pow(x,mod-2,mod)
for i in range(N):
    Fact[i+1]=((i+1)*Fact[i])%mod
    Finv[i+1]=inv(Fact[i+1])
def C(n,k):
    return (Fact[n]*((Finv[k]*Finv[n-k])%mod))%mod
ans1=0
ans2=0
for i in range(K-1,N):
    #print(C(i,K-1))
    ans1+=A[i]*C(i,K-1)
    ans1%=mod
    ans2+=B[i]*C(i,K-1)
    ans2%=mod

print((ans1-ans2)%mod)


Measured memory_bytes: 15888
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define rrep(i,m,n) for(int i = m; i >= n; i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll a[100010];
    cin >> N;
    rep(i,0,N){
        cin >> a[i];
    }
    sort(a, a+N);
    ll num = N;
    ll v = -1;
    ll now_val = 0;
    rep(i,0,N){
        if(a[i] == now_val){
            continue;
        }else if((a[i] - now_val) % 2 == 1){
            if(v == -1){
                v = (N-i);
            }else{
                v ^= (N-i);
            }
        }else{
            continue;
        }
    }
    if(v == -1 || v == 0){
        print("second");
    }else{
        print("first");
    }

}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};

int main(){
  int a,b;scanf("%d%d",&a,&b);
  double ret=0;
  for(int i=1;i<=a;i++){
	double tmp=1.0/a;
	int now=i;
	while(now<b){
	now*=2;
    tmp/=2;
  }
  ret+=tmp;
  }
  printf("%.12f\n",ret);
  return 0;
}


Measured memory_bytes: 256
/* ****GT_18**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll long long int,ll long long int>
#define vi          vector<ll long long int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll long long int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll long long int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;
const int mod = 1e9 + 7;
#define N  100005

void solve(){
	long long int n, m; cin>>n>>m;
	char a[n][m];

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

	long long int dp[n][m];
	int k = 1;

	for(long long int i=0; i<n; i++){
		if(a[i][0] == '.' && k == 1){
			dp[i][0] = 1;
		}
		else{
			dp[i][0] = 0;
			k=0;
		}
	}
	k=1;
	for(long long int i=0; i<n; i++){
		if(a[0][i] == '.' && k==1){
			dp[0][i] = 1;
		}
		else{
			dp[0][i] = 0;
			k=0;
		}
	}
	for(long long int i=1; i<n; i++){
		for(long long int j=1; j<m; j++){
			dp[i][j]=0;
		}
	}
	dp[0][0]=0;

	for(long long int i = 1; i<n; i++){
		for(long long int j=1; j<m; j++){
			if(a[i-1][j] == '.' && a[i][j-1]=='.'){
				dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;continue;


			}
			if(a[i-1][j] == '#' && a[i][j-1]=='#'){
				dp[i][j] = 0;
				continue;

			}

			if(a[i-1][j] == '#' && a[i][j-1]=='.'){
				dp[i][j] = dp[i][j-1]%mod;
				continue;
			}
			if(a[i-1][j] == '.' && a[i][j-1]=='#'){
				dp[i][j] = dp[i-1][j]%mod;
				continue;
			}

		}
	}

	// for(long long int i = 0; i<n; i++){
	// 	for(long long int j=0; j<m; j++){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }

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

	return;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define ll long long
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mt make_tuple
#define eb emplace_back
using namespace std;
const int N=2e5+5;
const ll inf=1e9;
void solve(){
    int s,w;
    cin>>s>>w;
    if(w>=s){cout<<"unsafe"<<endl;}
    else cout<<"safe"<<endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,p;
    t=1;
    //cin>>t;
    for(p=1;p<=t;p++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3664
A, B, C = map(int,input().split())
cnt = 0
if C >= A:
  m = C-A
  cnt += A
  if m > B:
    cnt += B*2+1
  elif m==B:
    cnt += B*2
  else:
    cnt += m+B
else:
  cnt += B+C
print(cnt)

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;

int dp[31];

int main() {
	dp[1] = 1;
	dp[2] = 2;
	dp[3] = 4;
	FOR(i, 4, 31) dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
	int N;
	while(scanf("%d", &N), N) printf("%d\n", dp[N] / 3650 + 1);
	return 0;
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const double pi=3.14159265358979323846;
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<ll> input(int n) {
    vector<ll> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b){
    if (a % b == 0){
        return(b);
    }else{
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
bool isprime(int n){
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;

    for (int i = 3; i <= sqrt(n); i += 2){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}
void sayYes(bool f) {
    if (f) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
void sayYES(bool f) {
    if (f) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

int main() {
  ll n,k;
  cin >> n >> k;
  vector<ll> h=input(n);
  sort(h.begin(),h.end());
  rep(i,k){
    h.pop_back();
  }
  ll ans=0;
  rep(i,n-k){
    ans+=h[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            int ans = 1;
            for (int i = 0; i < S.length() - 1; i++) {
                if (S.charAt(i) != S.charAt(i + 1)) ans++;
            }

            // 出力
            out.println(ans - 1);

        }

    }
}



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

int x, y, d;
int dir[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
char map[24][24];

void chDir(char op){
  if(op == 'U') d = 0;
  else if(op == 'R') d = 1;
  else if(op == 'D') d = 2;
  else d = 3;
}

void goStraight(void){
  int nx, ny;

  nx = x + dir[d][1];
  ny = y + dir[d][0];
  if(map[ny][nx] == '.'){
    x = nx;
    y = ny;
  }
}

void shoot(void){
  int tx = x, ty = y;

  for(; map[ty][tx] != '#' && map[ty][tx] != '*'; tx += dir[d][1], ty += dir[d][0]);

  if(map[ty][tx] == '*'){
    map[ty][tx] = '.';
  }
}

int main(void){
  int i, j;
  int n, h, w, len;
  int flg;
  char op[104];

  scanf("%d",&n);
  while(n--){
    scanf("%d%d",&h,&w);

    memset(map,'#',sizeof(map));
    flg = 0;
    for(i = 1; i <= h; i++){
      scanf("%s",&map[i][1]);
      map[i][w+1] = '#';
      for(j = 1; !flg && j <= w; j++){
	if(map[i][j] == '^'){
	  flg = 1;
	  d = 0;
	}
	else if(map[i][j] == '>'){
	  flg = 1;
	  d = 1;
	}
	else if(map[i][j] == 'v'){
	  flg = 1;
	  d = 2;
	}
	else if(map[i][j] == '<'){
	  flg = 1;
	  d = 3;
	}
	if(flg){
	  map[i][j] = '.';
	  x = j;
	  y = i;
	}
      }
    }
    scanf("%d%s",&len,op);

    for(i = 0; i < len; i++){
      if(op[i] == 'S'){
	shoot();
      }
      else{
	chDir(op[i]);
	goStraight();
      }
    }

    if(d == 0){
      map[y][x] = '^';
    }
    else if(d == 1){
      map[y][x] = '>';
    }
    else if(d == 2){
      map[y][x] = 'v';
    }
    else{
      map[y][x] = '<';
    }

    for(i = 1; i <= h; i++){
      for(j = 1; j <= w; j++){
	putchar(map[i][j]);
      }
      putchar('\n');
    }

    if(n != 0){
      putchar('\n');
    }
  }

  return 0;
}

Measured memory_bytes: 0
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main 
{
    public static void main( String[] args )
    {
    	Map<String,String> resultMap = new HashMap<String, String>();
    	resultMap.put("A", "T");
    	resultMap.put("C", "G");
    	resultMap.put("G", "C");
    	resultMap.put("T", "A");
    	Scanner scanner = new Scanner(System.in);
    	String line = scanner.next();
    	scanner.close();
    	System.out.println(resultMap.get(line));
    }}



Measured memory_bytes: 21844
n = int(input())
r = [int(input()) for i in range(n)]

minv = r[0]
maxv = -2000000000

for j in range(1, n):
    maxv = max(maxv, r[j]-minv)
    minv = min(minv, r[j])

print(maxv)


#ans = r[1] - r[0]
#
#for i in range(n):
#    ri =r[i]
#    for j in range(i+1, n):
#        rj = r[j]
#        ans = max(ans, rj - ri)
#
#print(ans)



Measured memory_bytes: 13592
#include<iostream>
#include<string>
using namespace std;
int main(){
int i;
int price_base=700;
int price_add=0;

string S;

cin>>S;

for(i=0;i<3;i++){
if(S[i]=='o')
  price_add+=100;
}
cout<<price_base+price_add;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}
 
int main() {
    string s,r;
    cin >> s;
    rep(i, s.size()) {
        r += 'x';
    }
    cout << r << "\n";
}

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

int main() {
  int N,k,x,y,n=1;
  cin>>N>>k;
  for(int i=0;i<N;i++){
    x=2*n;
    y=n+k;
    if(x>y)n=y;
    else n=x;
  }
  cout<<n<<endl;
}

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

int main(){
	int a, b, ab, x, y;
	scanf("%d %d %d %d %d", &a, &b, &ab, &x, &y);
	ab *= 2;
	int ans = x*a+y*b;
	if(x>y) ans = std::min({ans, x*ab, (x-y)*a+y*ab});
	else ans = std::min({ans, y*ab, (y-x)*b+x*ab});
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <set>

using namespace std;

int main(int argc, char const* argv[])
{
	string str;
	int k;
	cin >> str;
	cin >> k;
	int total = 0;
	set<string> st;
	for(char i = 'a'; i <= 'z'; i++){
			for(int j = 0; j < str.size(); j++){
					if(str[j] == i){
							for(int l = 1; l <= k; l++){
									st.insert(str.substr(j, l));
							}
					}
			}
			if(st.size() < k - total){
					total += st.size();
					st.clear();
			}else{
					int j = 0;
					for(auto itr = st.begin(); itr != st.end(); ++itr){
							j++;
							if(j == k - total){
									cout << *itr << endl;
									return 0;
							}
					}
			}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  vector<int> v = {a, b,c,d};
  sort(begin(v), end(v));
  vector<int> vv = {1,4,7,9};
  if(v == vv)  {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return max(divisors)


n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(x)
a.sort()
b = [a[i]-a[i-1] for i in range(1, n+1)]

#print(b)
#print(a)
if len(b) >= 2:
  print(make_codivisors(b))
else:
  print(b[0])

Measured memory_bytes: 14480
N, A, B = map(int,input().split())
ans = 0
arr = []
for y in range(N+1):
	i = y
	while i >= 1:
		arr.append(int(i % 10))
		i /= 10
	if sum(arr) <= B and sum(arr) >= A:
		ans += y
		arr = []
	else:
		arr = []

print(ans)


Measured memory_bytes: 3060
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc = new Scanner (System.in);
		
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int [] d = new int [n];
		int i, j;
		int temp;
		int max = 0;
		
		for (i = 0; i < n; i++) {
			d[i] = sc.nextInt();
		}
		
		for (i = 0; i < n - 1; i++) {
			for (j = i + 1; j < n; j++) {
				if (d[i] < d[j]) {
					temp = d[i];
					d[i] = d[j];
					d[j] = temp;
				}
			}
		}
		
		int sum, calorie;
		
		for (i = 0; i < n; i++) {
			sum = 0;
			for (j = 0; j < i; j++) {
				sum += d[j];
				calorie = (c + sum) / (a + i * b);
				
				if (max < calorie) {
					max = calorie;
				}
			}
		}
		
		System.out.println(max);
		
	}

}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

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

const ll INF = 1ll<<30;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int n;
int a[312345];

int main() {
	cin >> n;
	REP(i, 3 * n) scanf("%d", a + i);
	
	sort(a, a + 3 * n, greater<int>());
	
	ll ans = 0;
	for (int i = 1; i < 2 * n; i += 2) ans += a[i];
	cout << ans << endl;
	
	return 0;
}

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

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] v = new int[n];
        for (int i = 0; i < n; i++) {
            v[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        Arrays.sort(v);
        double result = (double) v[0];
        for (int i = 1; i < n; i++) {
            result = (result + v[i]) / 2;
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 22996
using System;

class GFG
{
    public static void Main()
    {
        var input = Console.ReadLine().Split(' ');

        var x = int.Parse(input[0]);
        var a = int.Parse(input[1]);
        var b = int.Parse(input[2]);

        var min = int.MaxValue;

        if (Math.Abs(x - a) < Math.Abs(x - b))
            Console.Write("A");
        else
        {
            Console.Write("B");
        }
    }
}




Measured memory_bytes: 11220
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define ll long long
#define P pair<int, int>
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(true){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            break;
        }
    }
    solve();
    return 0;
}



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

#define INF (1<<28)

class Node
{
public:
	vector<int> to,ct;
};

class State
{
public:
	int p,c,e;
	State(int p, int c, int e)
		:p(p),c(c),e(e)
	{
	}

	bool operator<(const State& s) const
	{
		return c>s.c;
	}
};

int main()
{
	int N,M,C;
	while(cin >> N >> M >> C, (N||M||C))
	{
		Node node[105];
		for(int i=0; i<M; i++)
		{
			int u,v,w;
			cin >> u >> v >> w;
			u--; v--;
			node[u].to.push_back(v);
			node[u].ct.push_back(w);
		}

		bool tmp[105][1005]={0};

		priority_queue<State> q;
		q.push(State(0,0,0));

		int ans=INF;
		while(!q.empty())
		{
			State s=q.top(); q.pop();
			if(s.c > C) continue;
			if(s.e > M) continue;
			if(tmp[s.p][s.e]) continue;
			tmp[s.p][s.e]=1;

			if(s.p==N-1)
			{
				ans = min(ans, s.e);
				continue;
			}

			for(int i=0; i<node[s.p].to.size(); i++)
			{
				int next=node[s.p].to[i];
				int nc=node[s.p].ct[i];

				if(!tmp[next][s.e])
				{
					q.push(State(next,s.c+nc, s.e));
				}
				if(!tmp[next][s.e+1])
				{
					q.push(State(next,s.c,s.e+1));
				}
			}
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 8056
#include<bits/stdc++.h>
#define print(x,n) for(int i=0;i<n;i++)cout<<x[i]<<" "
using namespace std;

// dp[state]
int dp[100001];

//Top-down
int minCost(vector<int> ht, int n) {
	if (dp[n] != -1)
		return dp[n];
	if (n == 0)
		return dp[0] = 0;
	if (n == 1)
		return dp[1] = abs(ht[1] - ht[0]);
	return dp[n] = min((minCost(ht, n - 1) + abs(ht[n] - ht[n - 1])), (minCost(ht, n - 2) + abs(ht[n] - ht[n - 2])));
}

int main() {
	int n;
	cin >> n;
	vector<int> ht(n, 0);
	//Input
	for (int i = 0; i < n; i++) {
		cin >> ht[i];
	}
	// Bottom Up
	// Base Case
	//dp[0] = 0;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	if (n == 2) {
		cout << abs(ht[1] - ht[0]) << endl;
		return 0;
	}
	int a = 0, b = abs(ht[1] - ht[0]), c;
	// Build dp array
	for (int i = 2; i < n; i++) {
		c = min((b + abs(ht[i] - ht[i - 1])), (a + abs(ht[i] - ht[i - 2])));
		a = b;
		b = c;
	}
	cout << c << endl;
	//print(dp, n) << endl;
	//cout << dp[n - 1] << endl;

	/*
	//set dp array to -1 for top down
	memset(dp, -1, sizeof(dp));
	cout << minCost(ht, n - 1) << endl;
	*/
	return 0;
}

Measured memory_bytes: 3780
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]

h.sort()
min = 10**9
for i in range(n-k+1):
    if h[i+k-1] - h[i] < min:
        min = h[i+k-1] - h[i]
print(min)

Measured memory_bytes: 7384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) int(a.size())
const int N=110;

int gi() {
	int x=0,o=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,m,f[N][N];
char s[N][N];

int main() {
	cin>>n>>m;
	for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
	memset(f,0x3f,sizeof(f));
	f[1][1]=(s[1][1]=='#');
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++) {
			if(i==n&&j==m) continue;
			if(i<n) f[i+1][j]=min(f[i+1][j],f[i][j]+(s[i+1][j]=='#'&&s[i][j]=='.'));
			if(j<m) f[i][j+1]=min(f[i][j+1],f[i][j]+(s[i][j+1]=='#'&&s[i][j]=='.'));
		}
	cout<<f[n][m];
	return 0;
}


Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn run() {
    input! {
        x: i32,
        a: i32,
        b: i32,
        n: usize,
        s: [chars; n],
    }
    let mut x = x;
    for s in s {
        match s[0] {
            'n' => x += a,
            't' => x += b,
            _ => x = 0,
        }
        if x < 0 {
            x = 0;
        }
    }
    println!("{}", x);
}

fn main() {
    run();
}



Measured memory_bytes: 5044
#include <stdio.h>

int main(){
        int i, j, N, minj, tmp, count=0;
        int A[100];

        scanf("%d", &N);
        for(i=0; i<N; i++){
                scanf("%d", &A[i]);
        }
        for(i=0; i<N; i++){
                minj=i;
                for(j=i; j<N; j++){
                        if(A[j] < A[minj]){
                                minj=j;
                        }
                }
                if(i != minj){
                        tmp=A[i];
                        A[i]=A[minj];
                        A[minj]=tmp;
                        count++;
                }
        }
        for(i=0; i<N-1; i++){
                printf("%d ", A[i]);
        }
        printf("%d\n", A[i]);
        printf("%d\n", count);

        return 0;
}

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

	long long int a,b,x;
	scanf("%lld%lld%lld", &a, &b, &x);
	long long int ans = ((b + x) / x) - ((a - 1 + x) / x);
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  int sum = 0;
   
  for(int i=0; i<N; i++){
    int l,r;
    cin >> l >> r;
    if(r-l == 0){sum += 1;}
    else{sum += (r-l+1);}
  }
  cout << sum << endl;
}

Measured memory_bytes: 3596