akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
//#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define str string
#define mask vector<bool>
#define vs vector<str>
#define pq priority_queue
#define ordered_set_of(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define nub(x) x.resize(unique(all(x)) - x.begin())
#define TWO class T1, class T2
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define MOD (int)(1E9 + 7)
#define GAME_OVER return 0
using namespace std;
using namespace __gnu_pbds;
char _$ = ' ';
struct sep {sep(char c) {_$ = c;}};
ostream& operator<<(ostream& o, sep s) {return o;}
template<TWO> ostream& operator<<(ostream& o, pair<T1, T2> x) {return o << x.fi << ' ' << x.se;}
template<TWO> istream& operator>>(istream& i, pair<T1, T2>& x) {return i >> x.fi >> x.se;}
template<class T> ostream& operator<<(ostream& o, vector<T> x) {for (auto it : x) o << it << _$; return o;}
template<class T> istream& operator>>(istream& i, vector<T>& x) {for (auto& it : x) i >> it; return i;}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int x;
    cin >> x;
    int res = 0, cur = 100;
    for (; ;)
    {
        if (cur < x)
            cur = 1.01 * cur, res++;
        else
            break;
    }
    cout << res << endl;
    GAME_OVER;
}

Measured memory_bytes: 3548
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayDeque;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
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);
        ADarkerAndDarker solver = new ADarkerAndDarker();
        solver.solve(1, in, out);
        out.close();
    }

    static class ADarkerAndDarker {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            final int INF = (int) 1e9;
            int[] dx = {-1, 0, 0, 1};
            int[] dy = {0, -1, 1, 0};

            int h = in.nextInt();
            int w = in.nextInt();

            char[][] c = new char[h][w];
            for (int i = 0; i < h; i++) {
                c[i] = in.next().toCharArray();
            }
            int[][] man = new int[h + 1][w + 1];
            boolean[][] used = new boolean[h + 1][w + 1];

            for (int i = 0; i <= h; i++) {
                Arrays.fill(man[i], INF);
                Arrays.fill(used[i], false);
            }
            ArrayDeque<Integer> q = new ArrayDeque<>();


            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    // 多点bfs
                    if (c[i][j] == '#') {
                        q.addLast(i * w + j);
                        used[i][j] = true;
                        man[i][j] = 0;
                    }
                }
            }

            while (!q.isEmpty()) {
                //out.println("q:" + q.peek());
                int now = q.pollFirst();
                for (int i = 0; i < 4; i++) {
                    int x = now / w;
                    int y = now % w;
                    int nx = x + dx[i];
                    int ny = y + dy[i];
                    if (!(0 <= nx && nx < h && 0 <= ny && ny < w)) continue;
                    if (!used[nx][ny]) {
                        used[nx][ny] = true;
                        man[nx][ny] = man[x][y] + 1;
                        q.addLast(nx * w + ny);
                    }
                }
            }

            int max = -1;
            for (int i = 0; i < h; i++) {
                // out.println(Arrays.toString(man[i]));
                for (int j = 0; j < w; j++) {
                    max = Math.max(max, man[i][j]);
                }
            }

            out.println(max);

        }

    }
}



Measured memory_bytes: 62796
fun main(arg: Array<String>) {
    val N = nextInt()
    val X = listOfInt()
    val sum = X.sum()
    val av = sum / N
    val ans = X.sumBy { (av - it) * (av - it) }
    if (sum % N == 0) {
        println(ans)
    } else {
        val av2 = av + 1
        val ans2 = X.sumBy { (av2 - it) * (av2 - it) }
        println(Math.min(ans, ans2))
    }
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }



Measured memory_bytes: 36016
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
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;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}




int N;
map<int, int> mp;

int main () {
  cin >> N;
  Rep(i, N) {
    int tmp;
    cin >> tmp;
    mp[tmp]++;
  }

  int ans = 0;

  for (int k=2;k<100000;++k) {
    int tmp = 0;
    tmp += mp[k-2];
    tmp += mp[k-1];
    tmp += mp[k];
    chmax(ans, tmp);
  }

  cout << ans << "\n";

}

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

// Type alias
using ll=long long;
using ld=double;

using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;

using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;

// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

// Macro
#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 REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

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

int bfs(int i, int j, char S[21][21], int H, int W){
  if(S[i][j] == '#')
    return 0;
  int dist[21][21];
  memset(dist, -1, 21*21*sizeof(int));
  dist[i][j] = 0;
  std::queue<pi> que;
  que.push(make_pair(i, j));

  int ret = 0;
  while(!que.empty()){
    auto p = que.front();
    que.pop();
    int i = p.first;
    int j = p.second;
    rep(k, 4){
      int x = i + dx[k];
      int y = j + dy[k];

      if(0 <= x && x < H && 0 <= y && y < W && S[x][y] != '#' && dist[x][y] == -1){
        int t = dist[i][j] + 1;
        dist[x][y] = t;
        if(t > ret)
          ret = t;
        que.push(make_pair(x, y));
      }
    }
  }

  return ret;
}

void solve(){
  int H, W;
  cin >> H >> W;
  char S[21][21];
  rep(i, H) rep(j, W) cin >> S[i][j];

  int max = 0;
  rep(i, H){
    rep(j, W){
      int d = bfs(i, j, S, H, W);
      if(d > max)
        max = d;
    }
  }

  cout << max << endl;
}

int main(){
// FastIO
//ios_base::sync_with_stdio(false);
cin.tie(NULL);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef pair<long long,long long> P;
//typedef pair<long long,P> P1;
//typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define se second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define rrep(i,x) for(long long i=x-1;i>=0;i--)
#define rrepn(i,x) for(long long i=x;i>1;i--)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())


#define ALL(v)  (v).begin(),(v).end()
//#define MAX(a,b) if(a>b)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))


const string MINUSINF = "-";


long long A,B,C,D,E,F,H,I,J,L,N,M,K,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long sum,sum1,sum2,sum3,sum4;
long long flg,flg1,flg2,flg3,cnt,cnt1,cnt2,cnt3,cnt4;
long long wk,wk1,wk2,wk3,wk4;
long long ans;

bool f;

long long n,h[100005];
vector<long long> p, c;
int vis[200001];

vector<string> fi;
int Left[2100][2100], Right[2100][2100], Up[2100][2100], Down[2100][2100];

long long match[10] = {2,5,5,4,5,6,3,7,6};

ll dp[10000010];


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

	long long max,max1;
	long long min,min1;

	sum=sum1=sum2=sum3=sum4=0;
	flg=flg1=flg2=flg3=cnt=cnt1=cnt2=cnt3=cnt4=0;
	max=max1=0;
	wk=wk1=wk2=wk3=wk4=0;
	ans=0;
	min=min1=INF;

	
	//**************************ここからスタート******************************************
	std::cin >> N;
	//std::cin >> N >> M;
	//std::cin >> N >> M >> K;
	//std::cin >> N >> K;
	//std::cin >> A >> B;
	//std::cin >> A >> B >> C;
    
	std::vector<long long> v(N);
	//std::vector<long long> w(N);
	//std::vector<long long> x(N);
	//std::vector<int> v(100, 0);
	//int a[26]={0};
	//vector<long long> flagment(N, 0);
	
	//vec.push_back(i);
	//accumulate(vec.begin(), vec.end(), 0)
    //v.resize
    
	// 配列入力1
	
	for(long long i=0; i<N; i++){
		std::cin >> v[i];
	}
	for(long long i=0; i<N; i++){
		dp[i]=0;;
	}
	
	
	//std::sort(v.begin(),v.end());//昇順ソート
	//std::sort(v.begin(),v.end(),std::greater<long long>());//降順ソート
	
	//通常
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	for(long long i=2; i<N; i++){

		dp[i]=MIN(dp[i-2]+abs(v[i]-v[i-2]),dp[i-1]+abs(v[i]-v[i-1]));
		
	}
	printf("%lld",dp[N-1]);
	return 0;

}


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

#define boost ios::sync_with_stdio(); cin.tie(); cout.tie();
#define ll long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define vt vector 
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

template<class T> bool umin(T& a, const T& b) {
	return b<a?a=b, 1:0;
}
template<class T> bool umax(T& a, const T& b) { 
	return a<b?a=b, 1:0;
} 

const int INF = 1e9 + 10;
const int mod = 1e9 + 7;
const ll LLINF = 1e18 + 10;

void solve() 
{
	int x,y;
	cin >> x >> y;
	cout << (y >= x*2 && y <= x*4 && y%2 == 0 ? "Yes" : "No");
}
int main()
{
    boost
    //int t; read(t); while(t--)
    solve();
}


Measured memory_bytes: 3632
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ll  long long
#define ull unsigned long long 
#define ff first 
#define ss second
#define eb(x) emplace_back(x)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define testcase(t) int t;cin>>t;while(t--)
#define mp(x,y) make_pair(x,y)
#define in(x) insert(x)
#define rep(i,a,b)  for (__typeof((b)) i=(a);i<=(b);i++)
#define nrep(i,a,b)  for (__typeof((b)) i=(b);i>=(a);i--)
#define PI 3.14159265358979323846
#define SP(x) setprecision(x)
#define reflex ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define M 998244353
#define sz(a) (int)a.size()
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(x) x.resize(distance(x.begin(), unique(all(x))))
#define mem(arr,val) memset(arr,val,sizeof(arr)) //For "0" and "-1"                  
#define inp0(a,n) rep(i,0,n-1) cin>>a[i];
#define inp1(a,n) rep(i,1,n) cin>>a[i]; 
#define prll(x) printf("%lld",x)
#define nth_ele(v,n) nth_element(v.begin(), v.begin()+n ,v.end())//O(N)
#define DEBUG(x) cerr << (#x) << ": " << (x) << endl
#define DEBUGV(x) for(auto IT:x) cout<<IT.ff<<" "<<IT.ss<<endl; cout<<endl;
#define minheap priority_queue <int, vector<int>, greater<int>>
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll gcd(ll n1, ll n2){if(n2!=0) return gcd(n2, n1%n2);else return n1;}
ll powerM(ll a,ll b){if(b==0) return 1LL;  if(b==1) return a%M; ll x=powerM(a,b/2)%M; if(b&1){return ((((a%M)*(x%M))%M)*(x%M))%M;}return ((x%M)*(x%M))%M;}
ll power(ll a,ll b){if(b==0) return 1;  if(b==1) return a; ll x=power(a,b/2); if(b&1){return ((((a)*(x)))*(x));}return ((x)*(x));}
 
const ll INF = (ll)2e18+77; 
const int SIZE = 100005;

signed main(){
    long double a,b,h,m;
    cin>>a>>b>>h>>m;
    h = h*30 + 0.5*(m);
    m = m*6;
    long double an = abs(m-h);
    // cout<<cos(PI*an/180.0)<<endl;
    long double c = (a*a + b*b) - (2*a*b*cos(PI*an/180.0));
    // cout<<c<<endl;
    c = sqrtl(c);
    cout<<fixed<<SP(25)<<c<<endl;
} 

Measured memory_bytes: 4172
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  if(S=="Rainy"){
  cout<<"Sunny"<<endl;
  }
if(S=="Sunny"){
cout<<"Cloudy"<<endl;

}
  if(S=="Cloudy"){
  cout<<"Rainy"<<endl;
  }
  
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d", $N, $A, $B);

$sum = $A + $B;
$amari = $N % $sum;
$syou = intval($N / $sum);

$ans = $syou * $A;

if($amari > 0) {
	$ans += (min($amari, $A));
}

echo "{$ans}\n";


Measured memory_bytes: 4604
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define mod 1000000007

int main (){
	int n ;
	cin >> n ;
	vector<int> l (n) ;
	rep(i, n) cin >> l[i] ;
	sort(l.begin(), l.end()) ;
	int ans = 0 ;
	rep(i, n){
		rep(j, n){
			if(i >= j) continue ;
			int k = lower_bound(l.begin(), l.end(), l[i] + l[j]) - l.begin() ;
			k -= j + 1 ;
			ans += k ;
		}
	}
	cout << ans << endl ;
}

Measured memory_bytes: 3600
N = int(input())
A = [0]*N
for i in range(N):
    A[i] = int(input())

answer = 0
for i in range(N-1):
    answer += A[i] // 2
    A[i] = A[i] % 2
    if A[i] == 1 and A[i+1] > 0:
        answer += 1
        A[i] = 0
        A[i+1] -= 1
answer += A[-1] // 2
print(answer)



Measured memory_bytes: 6900
K=10**9+7
N,M=map(int,raw_input().split())
A=[[[0]*(N+2) for j in range(N+2)] for i in range(M+1)]
A[0][1][1]=1
for i in range(M):
	for j in range(N+1):
		for k in range(N+1):
			A[i+1][j+1][k]=(A[i+1][j+1][k]+A[i][j][k]*(N-j))%K
			A[i+1][j][k]=(A[i+1][j][k]+A[i][j][k]*(j-k))%K
			A[i+1][j][j]=(A[i+1][j][j]+A[i][j][k]*k)%K
print A[M][N][N]

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    string S;
    cin >> N >> S;
    ll red = 0, blue = 0;
    REP(i, N){
    	if(S[i] == 'R')red++;
    	else blue++;
    }
    cout << (red > blue ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
q = int(input())
m = list(map(int,input().split()))
"""def dfs(i,m):
    global a
    if i == 0:
        if m == 0:
            return True
        else:
            return False
    if dfs(i-1, m):
        return True
    if dfs(i-1,m - a[i-1]): 
        return True
    return False
for i in range(q):
    if dfs(n,m[i]):
        print("yes")
    else:
        print("no")"""
b = []
def dfs(i,m):
    global b
    if i == 0:
        b.append(m)
    else:
        dfs(i-1,m)
        dfs(i-1,m+a[i-1])
    return b
b = dfs(n,0)
for i in range(q):
    if m[i] in b:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 43088
#include<iostream>
#include<math.h>
#include<algorithm>
#include<map>

#define LS(x) x&-x
#define int long long

using namespace std;

map<int, int> f_1, f_2;

void update(map<int, int> &fenwick, int index, int value)
{
	while(index <= 1000000000)
	{
		fenwick[index] += value;
		index += LS(index);
	}
}

int find_sum(map<int, int> &fenwick, int index_1, int index_2)
{
	int sum_1 = 0, sum_2 = 0;
	
	index_1 --;
	while(index_1 > 0)
	{
		sum_1 += fenwick[index_1];
		index_1 -= LS(index_1);
	}
	
	while(index_2 > 0)
	{
		sum_2 += fenwick[index_2];
		index_2 -= LS(index_2);
	}
	
	return sum_2-sum_1;
}

main()
{
	int n, A[100010], B[100010], C[100010];
	cin >> n;
	for(int i = 0; i < n; i ++)
		cin >> A[i];
	for(int i = 0; i < n; i ++)
		cin >> B[i];
	for(int i = 0; i < n; i ++)
		cin >> C[i];
	
	sort(A, A+n);sort(B, B+n);sort(C, C+n);
	
	for(int i = 0; i < n; i ++)
	{
		update(f_1, A[i], 1);
	}
	for(int i = 0; i < n; i ++)
	{
		update(f_2, B[i], find_sum(f_1, 1, B[i]-1));
	}
	int count = 0;
	for(int i = 0; i < n; i ++)
	{
		count += find_sum(f_2, 1, C[i]-1);
	}
	cout << count;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N;
    ll count = 0;
    ll maxi = 0;
    string S;
    cin >> N >> S;
    for(auto &c: S) {
        if(c == 'I') count++;
        else count--;
        maxi = max(maxi, count);
    } 
    cout << maxi << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int nck(int n,int k){
  int dp[n+1][n+1];
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  for(int i=1;i<=n;i++){
    for(int j=0;j<=i;j++){
      if(j-1>=0){
	dp[i][j]=dp[i-1][j-1]+dp[i-1][j];
      }else{
	dp[i][j]=dp[i-1][j];
      }
    }
  }
  //cout<<n<<" "<<k<<":"<<dp[n][k]<<endl;
  return dp[n][k];
}
signed main(){
  int n,a,b;
  cin>>n>>a>>b;
  int v[n];
  for(int i=0;i<n;i++) cin>>v[i];
  sort(v,v+n);
  reverse(v,v+n);
  int s[n];
  s[0]=0;
  for(int i=0;i<n;i++) s[i+1]=s[i]+v[i];
  printf("%.12f\n",(double)s[a]/a);
  int cnt=0;
  for(int i=a;i<=b;i++){
    if(s[a]*i==s[i]*a){
      if(i==n){
	cnt++;
	continue;
      }
      int tmp=0,idx=-1;
      for(int j=0;j<n;j++){
	if(v[i]<v[j]) idx=j;
	if(v[i]==v[j]) tmp++;
      }
      if(tmp==1){
	cnt+=1;
	break;
      }
      //cout<<i<<endl;
      //cout<<tmp<<" "<<i-idx-1<<endl;
      cnt+=nck(tmp,i-idx-1);
    }else{
      break;
    }
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int r = sc.nextInt();
			if (r == 0) {
				sc.close();
				break;
			}

			int n = sc.nextInt();

			int[] xl = new int[n];
			int[] xr = new int[n];
			int[] h = new int[n];
			for (int i = 0; i < n; i++) {
				xl[i] = sc.nextInt();
				xr[i] = sc.nextInt();
				h[i] = sc.nextInt();
			}

			int[] cover = new int[2 * r];
			for (int i = 0; i < n; i++) {
				int ll = Math.max(0, xl[i] + r);
				int rr = Math.min(r * 2, Math.max(0, xr[i] + r));

				for (int j = ll; j < rr; j++) {
					cover[j] = Math.max(cover[j], h[i]);
				}
			}

			double res = 100000.0;
			for (int i = 0; i < cover.length; i++) {
				int xx = i - r > 0 ? i - r + 1 : r - i - 1;
				double t1 = cover[i]
						+ r
						* (1 - Math
								.sin(Math.acos((double) Math.abs(r - i) / r)));
				double t2 = cover[i] + r
						* (1 - Math.sin(Math.acos((double) xx / r)));
				res = Math.min(res, Math.min(t1, t2));
			}

			System.out.println(String.format("%.4f", res));
		}
	}
}

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

vector<vector<int>> g(0,vector<int>(0));
vector<int> h;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	vector<pii> a(n);
	rep(i,n){
		cin >> a.at(i).first;
		a.at(i).second=i+1;
	}
	sort(a.rbegin(),a.rend());
	int x=n-1,y=a.at(x).second;
	vector<int> ans;
	bool flg1=false;
	while(true){
		bool flg=false;
		rep(i,n){
			if(i==x) continue;
			if(a.at(i).first==0){
				cout << -1 << endl;
				return 0;
			}
			ans.pb(a.at(i).second);
			a.at(i).first--;
		}
		if(flg1){
			k--;
			if(k<0) flg=true;
			sort(a.rbegin(),a.rend());
			if(y==a.at(n-1).second){
				x=n-2;
				y=a.at(x).second;
			}
			else{
				x=n-1;
				y=a.at(x).second;
			}
		}
		else{
			if(a.at(x).first==0){
				cout << -1 << endl;
				return 0;
			}
			a.at(x).first--;
			ans.pb(a.at(x).second);
			k--;
			flg1=true;
			if(k<0) flg=true;
		}
		if(flg) break;
	}
	cout << ans.size() << endl;
	rep(i,ans.size()){
		if(i==ans.size()-1) cout << ans.at(i) << endl;
		else cout << ans.at(i) << " ";
	}
}


Measured memory_bytes: 256
function isPrime(num) {
	if (num == 2 || num == 3) return true;
	if (num < 2 || num % 2 == 0 || num % 3 == 0) return false;
	var max = Math.floor(Math.sqrt(num));

	for (var n = 1; n * 6 - 1 <= max; n++) {
		if (num % (n * 6 - 1) == 0 || num % (n * 6 + 1) == 0) return false;
	}
	return true;
}

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
lines.shift();
console.log(lines.filter(isPrime).length);

Measured memory_bytes: 9940
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main()
{
    int x, y;
    cin >> x >> y;

    if (x < 0)
    {
        if (y > -x)
        {
            cout << 1 + y - (-x) << endl;
        }
        else if (y < x)
        {
            cout << 2 + x - y << endl;
        }
        else if (y <= 0)
        {
            cout << y - x << endl;
        }
        else
        {
            cout << 1 + (-y - x) << endl;
        }
    }
    else
    {
        if (y > x)
        {
            cout << y - x << endl;
        }
        else if (y < -x)
        {
            cout << 1 - y - x << endl;
        }
        else if (y <= 0)
        {
            cout << 1 + y - (-x) << endl;
        }
        else
        {
            cout << 2 + x - y << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

typedef tuple< ll, ll > edge;

bool dfs(ll idx, vector< vector< edge > > & path, vector< ll > & s,
          vector< ll > & lower, vector< ll > & upper,
          vector< bool > & l_v, vector< bool > & u_v,
          vector< bool > & used, bool is_low, ll score) {
            if (is_low) {
              if (l_v[idx]) {
                if (lower[idx] != score) return false;
                //lower[idx] = max(lower[idx], score);
              }
              else lower[idx] = score;
              l_v[idx] = true;
            } else {
              if (u_v[idx]) {
                if (upper[idx] != score) return false;
                //upper[idx] = min(upper[idx], score);
              }
              else upper[idx] = score;
              u_v[idx] = true;
            }
            for (auto c : path[idx]) {
              ll next = get<0>(c);
              ll e_idx = get<1>(c);
              if (used[e_idx]) continue;
              used[e_idx] = true;
              ll n_score = s[e_idx] - score;
              if (!dfs(next, path, s, lower, upper, l_v, u_v, used, !is_low, n_score)) {
                return false;
              }
            }
            return true;
}

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  ll n, m;
  cin >> n >> m;
  vector< vector< edge > > path(n);
  vector< ll > s(m);
  for (ll i=0; i<m; ++i) {
    ll u, v;
    cin >> u >> v >> s[i];
    u--; v--;
    path[u].push_back(make_tuple(v, i));
    path[v].push_back(make_tuple(u, i));
  }
  vector< bool > used(m, false);
  vector< ll > lower(n), upper(n);
  vector< bool > l_v(n, false), u_v(n, false);
  if (!dfs(0, path, s, lower, upper, l_v, u_v, used, true, 0)) {
    cout << 0 << endl;
    return 0;
  }
  ll l = 0, u = 0;
  bool flg = false;
  bool oneflg = false;
  for (ll i=0; i<n; ++i) {
    if (l_v[i] && u_v[i]) {
      if (lower[i] > upper[i]) {
        cout << 0 << endl;
        return 0;
      }
      if ((upper[i]-lower[i])%2!=0) {
        cout << 0 << endl;
        return 0;
      }
      oneflg = true;
    }
//    cout << l_v[i] << u_v[i] << " " << lower[i] << " " << upper[i] << endl;
    if (l_v[i]) {
      if (lower[i]+l<=0) {
        l += 1-(lower[i]+l);
      }
    }
    if (u_v[i]) {
      if (flg) {
        u = min(u, upper[i]-1);
      } else {
        u = upper[i]-1;
        flg = true;
      }
    }
  }
  if (oneflg) {
    if (l <= u) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
    return 0;
  }
  cout << max((ll)0, u-l+1) << endl;
  return 0;
}


Measured memory_bytes: 22784
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if(a>12){
        cout << b<<endl;
    }
    else if(a<6){
        cout << 0<<endl;
    }
    else{
        cout << b/2<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int r1 = 0, r2 = 0, r3 = 0;
		for (int i = 0; i < 10; i++) {
			int n = scan.nextInt();
			if (r3 < n) {
				r3 = n;
				if (r2 < r3) {
					int t = r2;
					r2 = r3;
					r3 = t;
					if (r1 < r2) {
						t = r1;
						r1 = r2;
						r2 = t;
					}
				}
			}

		}
		System.out.println(r1);
		System.out.println(r2);
		System.out.println(r3);
		System.exit(0);
	}
}

Measured memory_bytes: 26292
#include<stdio.h>
int main()
{
    long long int a,b,r,d,v,u,l,c=0,t,k,n,i,j;
    scanf("%lld%lld",&a,&b);
    if((a+b)%2==0){printf("%lld\n",(a+b)/2);}
    else{printf("IMPOSSIBLE\n");}
return 0;
}


Measured memory_bytes: 128
#import<iostream>
using namespace std;
long n,v,a,b,c,d,e;
main(){cin>>n;while(n--)cin>>v,a+=v,b=min(b+(v?v%2:2),a),c= 
min(c+!(v%2),b),d=min(d+(v?v%2:2),c),e=min(e+v,d);cout<<e;}

Measured memory_bytes: 256
/**
*    created: 01.07.2020 21:44:24
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const int MOD = 1000000007;
// const int MOD = 998244353;
const long double pi = acos(-1.0);
const int INF = 1LL << 60;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, a;
    cin >> n >> a;
    if (n % 500 <= a) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main() {
    int n;
    long long m, v, p;
    cin >> n >> m >> v >> p;
    vector<long long> a(n);
    for (auto& e : a) cin >> e;
    sort(a.rbegin(), a.rend());
    
    auto f = [&] (int id) -> bool {
        if (a[id] + m < a[p-1]) return false;
        long long s = a[id]+m, ps = v*m;
        for (int i = 0; i < n; i++) {
            if (i < p-1 || i >= id) ps -= m;
            else ps -= max(0LL, s-a[i]);
        }
        return ps <= 0;
    };
    
    int ok = 0, ng = n;
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (f(mid)) ok = mid;
        else ng = mid;
    }
    
    cout << ++ok << endl;
    return 0;
}

Measured memory_bytes: 1024
n = io.read("*n")
local rep = 1
while true do
  local mul = 1
  for i = 1, rep do
    mul = mul * 26
  end
  if n <= mul then
    local z = n - 1
    local s = {}
    for i = 1, rep do
      s[i] = string.char(z % 26 + 97)
      z = z // 26
    end
    print(table.concat(s):reverse())
    break
  else
    n = n - mul
    rep = rep + 1
  end
end


Measured memory_bytes: 2636
using System;
using System.Linq;

namespace ABC128A
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').ToArray();
            int A = int.Parse(line[0]);
            int P = int.Parse(line[1]);

            Console.WriteLine((A * 3 + P) / 2);
        }
    }
}


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

using namespace std;

int N, V;

const int maxn = 200010;
int f[1<<20], g[1<<20];
int x[maxn], l[maxn][20], r[maxn][20];

int val[20];
int m, mask;

int main() {
	scanf("%d%d", &N, &V);
	for(int i = 0; i < N; ++i) scanf("%d", &x[i]);
	for(int v = V; v; v /= 2) val[m++] = v;
	val[m++] = 0;
	mask = (1 << m) - 2;

	for(int i = 0; i < N; ++i) {
		for(int j = 0; j < m; ++j) {
			l[i][j] = i;
			if(i && x[i] - x[i-1] <= val[j]) l[i][j] = l[i-1][j];
		}
	}

	for(int i = N - 1; i >= 0; --i) {
		for(int j = 0; j < m; ++j) {
			r[i][j] = i;
			if(i + 1 < N && x[i+1] - x[i] <= val[j]) r[i][j] = r[i+1][j];
		}
	}

	f[0] = 0;
	for(int i = 0; i < 1<<m; ++i)
		for(int j = 0; j < m; ++j) if((~i) >> j & 1) 
			f[i | (1<<j)] = max(f[i | (1<<j)], f[i]==N?N:r[f[i]][j] + 1);

	memset(g, 0x3f, sizeof(g));
	g[0] = N - 1;
	for(int i = 0; i < 1<<m; ++i)
		for(int j = 0; j < m; ++j) if((~i) >> j & 1) 
			g[i | (1<<j)] = min(g[i | (1<<j)], g[i]==-1?-1:l[g[i]][j] - 1);

	for(int i = 0; i < N; i = r[i][0] + 1) {
		bool flag = false;
		for(int k = 0; k < 1<<m; k += 2) {
			if(f[k] >= i && g[k ^ mask] <= r[i][0]) {
				flag = true; break;
			}
		}
		if(flag) for(int j = i; j <= r[i][0]; ++j) puts("Possible");
		else for(int j = i; j <= r[i][0]; ++j) puts("Impossible");
	}
	return 0;
}


Measured memory_bytes: 41344
num = input()
list = map(int, raw_input().split())
count1 = 0
count4 = 0
for x in list:
    if x % 2 == 1:
        count1 = count1 + 1
    if x % 4 == 0:
        count4 = count4 + 1
if count1 > count4 and num > 3 and count1 + count4 < num:
    print("No")
elif count1 > count4 + 1 and num > 3 and count1 + count4 == num:
    print("No")
elif num == 2 and count4 - count1 < 0:
    print("No")
elif num == 3 and count4 == 0 and count1 > 0:
    print("No") 
else:
    print("Yes")

Measured memory_bytes: 11320
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    string S;
    cin>>S;
    if(S=="AAA"||S=="BBB")cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

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

int main()
{
    string o, e;
    cin >> o;
    cin >> e;
    rep(i, o.size())
    {
        if (i != e.size())
        {
            cout << o.at(i) << e.at(i);
        }
        else
        {
            cout << o.at(i) << endl;
        }
    }
}

Measured memory_bytes: 256
using System;
class MainClass
{
    public static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int x1 = int.Parse(input[0]);
        int y1 = int.Parse(input[1]);
        int x2 = int.Parse(input[2]);
        int y2 = int.Parse(input[3]);

        int xDis = x2 - x1;
        int yDis = y2 - y1;

        Console.WriteLine((x2 - yDis) + " " + (y2 + xDis) + " " + (x1 - yDis) + " " + (y1 + xDis));
        
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
 int N;
 int A[2][100];
 scanf("%d",&N);
 int a,n;
 for(a=0;a<2;a++){
 	for(n=0;n<N;n++){
 		scanf("%d",&A[a][n]);
 	}
 }
 int max=0;
 for(n=0;n<N;n++){
 int b=0,sum=0;
 while(b<=n){
 	sum+=A[0][b];
 	b++;
 }
 b=n;
 while(b<N){
 	sum+=A[1][b];
 	b++;
 }
 
 if(sum>max){
 	max=sum;
 }
 
 
 }
 
 printf("%d\n",max);
 
	return 0;
}

Measured memory_bytes: 128
n, a, b = map(int, input().split())
s = input()
 
for i in s:
    if (i == "a" and a + b > 0):
        print("Yes")
        a -= 1
    elif (i == "b" and a + b > 0 and b > 0):
        print("Yes")
        b -= 1
    else:
        print("No")

Measured memory_bytes: 4016
#include<bits/stdc++.h>
using namespace std;
int p[150010],q[150010],fa[150010],len[150010];
vector<pair<long long,long long> >vec[150010],ls;
void dfs(int s,long long lim)
{
	if (!p[s]) {vec[s].push_back(make_pair(len[s],len[s]));return;}
	dfs(p[s],lim);dfs(q[s],lim);
	if (vec[p[s]].size()>vec[q[s]].size()) swap(p[s],q[s]);
	ls.clear();
	for (int k=0;k<vec[p[s]].size();k++)
	{
		int w=lower_bound(vec[q[s]].begin(),vec[q[s]].end(),make_pair(lim-vec[p[s]][k].second+1,0ll))-vec[q[s]].begin();
		if (w>0)
		{
			w--;
			ls.push_back(make_pair(vec[p[s]][k].first+len[s],vec[q[s]][w].second+len[s]));
			ls.push_back(make_pair(vec[q[s]][w].second+len[s],vec[p[s]][k].first+len[s]));
		}
	}
	sort(ls.begin(),ls.end());
	long long mx=1e18;
	for (int i=0;i<ls.size();i++) if (ls[i].second<mx)
	{
		mx=ls[i].second;
		vec[s].push_back(ls[i]);
	}
}	
int n;
bool check(long long x)
{
	for (int i=1;i<=n;i++) vec[i].clear();
	dfs(1,x);
	return vec[1].size();
}
int main()
{
	long long l=-1,r=0;scanf("%d",&n);
	for (int i=2;i<=n;i++)
	{
		scanf("%d%d",&fa[i],&len[i]);
		if (!p[fa[i]]) p[fa[i]]=i;else q[fa[i]]=i;
		r+=len[i];
	}
	//cerr<<check(4)<<endl;
	while (l+1!=r)
	{
		long long mid=(l+r)>>1;
		if (check(mid)) r=mid;else l=mid;
	}
	printf("%lld",r);
}
		

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

int main(void) {
    double xa, ya, ra, xb, yb, rb;
    double distance;
    int answer;
    int n;
    
    cin >> n;
    for(int i = 0; i < n; ++i) {
        scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
        distance = (xa - xb)*(xa - xb) + (ya - yb)*(ya - yb);
        
        if(distance > (ra + rb)*(ra + rb)) {
            answer = 0;
        } else if((ra - rb)*(ra - rb) <= distance && distance <= (ra + rb)*(ra + rb)) {
            answer = 1;
        } else if(ra > rb) {
            answer = 2;
        } else if(ra < rb) {
            answer = -2;
        }
        cout << answer << endl;
    }
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define pll pair<long long,long long>
using namespace std;
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int h1,m1,h2,m2;
    cin>>h1>>m1>>h2>>m2;
    int f=h1*60+m1;
    int l=h2*60+m2;
    int k;
    cin>>k;
    cout<<(l-f)-k;
    return 0;
}

Measured memory_bytes: 3640
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

    public class Program
    {
        public static void Main(string[] args)
        {
            new A().test();
        }
    }

	public class A
	{
		public void test()
		{
			// 普通の文字列
			var str = CommonRead.ReadStr();

			// 小文字か判定
			if (str.ToLower() == str)
			{
				Console.WriteLine("a");
			}
			else
			{
				Console.WriteLine("A");
			}



		}
	}



static class CommonRead
{
    public static string ReadStr()
    {
        return Console.ReadLine();
    }
    public static string[] ReadStrA()
    {
        return ReadStr().Split(' ');
    }
    public static List<string> ReadStrL()
    {
        return ReadStrA().ToList();
    }
    public static int ReadInt()
    {
        return Convert.ToInt32(ReadStr());
    }
    public static int[] ReadIntA()
    {
        return ReadStrA().Select(s => Convert.ToInt32(s)).ToArray();
    }
    public static List<int> ReadIntL()
    {
        return ReadStrA().Select(s => Convert.ToInt32(s)).ToList();
    }
    public static long ReadLong()
    {
        return Convert.ToInt64(ReadStr());
    }
    public static long[] ReadLongA()
    {
        return ReadStrA().Select(s => Convert.ToInt64(s)).ToArray();
    }
    public static List<long> ReadLongL()
    {
        return ReadStrA().Select(s => Convert.ToInt64(s)).ToList();
    }

    public static decimal ReadDecimal()
    {
        return Convert.ToDecimal(ReadStr());
    }
    public static decimal[] ReadDecimalA()
    {
        return ReadStrA().Select(s => Convert.ToDecimal(s)).ToArray();
    }
    public static List<decimal> ReadDecimalL()
    {
        return ReadStrA().Select(s => Convert.ToDecimal(s)).ToList();
    }

    public static double ReadDouble()
    {
        return Convert.ToDouble(ReadStr());
    }
    public static double[] ReadDoubleA()
    {
        return ReadStrA().Select(s => Convert.ToDouble(s)).ToArray();
    }
    public static List<double> ReadDoubleL()
    {
        return ReadStrA().Select(s => Convert.ToDouble(s)).ToList();
    }

}


Measured memory_bytes: 17436
#include<iostream>
#include<cstring>
#include<stdbool.h>
using namespace std;
bool length(string str,int K) 
{ 
    if(str.size()<=K) return true;
    return false;
} 
int main()
{   
    int K;
    cin >> K;
    string str;
    cin >> str;
    if(length(str,K)){
        cout << str;
    }
    else{
        cout << str.erase(K) <<"...";
    }
    return 0;
} 

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 2147483647//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n;
    cin >> n;
    vector<int> p(n,0);
    rep(i,n)cin >> p.at(i);
    sort(p.begin(),p.end(),greater<int>());
    p[0] /= 2;
    int sum = 0;
    rep(i,n){
        sum += p[i];
    }
    cout << sum << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9+7, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}



signed main(){
	int L,R;
	cin>>L>>R;
	while (L+6054<R)
	{
		R-=2018;
	}
	//cout<<L<<" "<<R<<endl;
	/* 
	L%=2019;
	R%=2019;
	if(L>=R)R+=2019;
	int mi = INF;
	cout<<L<<" "<<R<<endl;
	*/
	int mi = INF;
	FOR(i,L,R+1){
		FOR(j,i+1,R+1){
			CHMIN(mi,i*j%2019);
		}
	}
	cout<<mi<<endl;
}

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

using namespace std;

constexpr long long INF64 = 1e16;

using Weight=long long;

struct Edge{
    int src,dst,time,company;
    Weight weight;
    Edge(int src,int dst,Weight weight,int time,int company):
    src(src),dst(dst),weight(weight),time(time),company(company){}
};

auto operator < (const Edge &e,const Edge &f){
    return e.weight>f.weight;
}

using Edges=vector<Edge>;
using Graph=vector<Edges>;

Weight dijkstra(const Graph &g,int s,int t,int H,int pass){
    const int V=g.size();
    vector<vector<Weight>>dist(V,vector<Weight>(H+1,INF64));
    vector<vector<Weight>>memo(V,vector<Weight>(H+1,-1));
    priority_queue<Edge>q;
    dist[s][0]=0;
    for(q.emplace(-2,s,0,0,-1);!q.empty();){
        Edge e=q.top();q.pop();
        if(e.dst==t)return e.weight;
        if(memo[e.dst][e.time]!=-1)continue;
        memo[e.dst][e.time]=e.src;
        for(auto ge:g[e.dst]){
            if(e.time+ge.time>H)continue;
            int buf=e.weight+((((1 << ge.company) & pass))?0:ge.weight);
            if(dist[ge.dst][e.time+ge.time] > buf){
                dist[ge.dst][e.time+ge.time]=buf;
                q.emplace(ge.src,ge.dst,buf,e.time+ge.time,-1);
            }
        }
    }
    return INF64;
}

int main(){
    int N,M,H,K;
    while(cin>>N>>M>>H>>K,N){
        Graph g(N);
        for(int i=0;i<M;++i){
            int a,b,c,h,r;
            cin>>a>>b>>c>>h>>r;
            g[a-1].emplace_back(a-1,b-1,c,h,r-1);
            g[b-1].emplace_back(b-1,a-1,c,h,r-1);
        }
        int S,T;
        cin>>S>>T;
        vector<Weight>fr(1 << K);
        for(int i=0;i<(1 << K);++i){
            fr[i]=dijkstra(g,S-1,T-1,H,i);
        }
        vector<Weight>ps(1 << K,INF64);
        ps[0]=0;
        int P;
        cin>>P;
        for(int i=0;i<P;++i){
            int l,d;
            cin>>l>>d;
            int pass=0;
            for(int j=0;j<l;++j){
                int k;
                cin>>k;
                pass+=(1 << (k-1));
            }
            for(int j=0;j<(1 << K);++j){
                ps[j | pass]=min(ps[j | pass],ps[j]+d);
            }
        }
        Weight ans=INF64;
        for(int i=0;i<(1 << K);++i){
            ans=min(ans,ps[i]+fr[i]);
        }
        if(ans>=INF64)ans=-1;
        cout<<ans<<endl;
    }
}

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

 int main()
 {
   ios::sync_with_stdio(!cin.tie(0));
   int k;
   string s; cin>>k>>s;
   
     int len=s.size();
   if(len<=k) cout<<s;
   else 
   {   for(int i=0;i<=k-1;i++)
       cout<<s.at(i);
       cout<<"...";
 }
   return 0;
 }

Measured memory_bytes: 3660
x, y = map(int, input().split())
mod = 10 ** 9 + 7


def comb(n, r, mod):
    numerator = denominator = 1
    for i in range(r):
        numerator = numerator * (n - i) % mod
        denominator = denominator * (i + 1) % mod
    return numerator * inv(denominator, mod) % mod


# 逆元を返す関数(非再帰拡張Euclidの互除法))
# pow(a, mod-2, mod)と等価
def inv(a, mod):
    b = mod
    p, q = 1, 0
    while b > 0:
        c = a // b
        a, b = b, a-c*b
        p, q = q, p-c*q
    return p + mod if p < 0 else p


i = (2*y - x) // 3
j = (2*x - y) // 3
if (x + y) % 3 == 0 and i >= 0 and j >= 0:
    ans = comb(i+j, i, mod)
else:
    ans = 0
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
vector<int>b[26];
int n;
char c[200005];
int s[200005];
bool ok[26];
int main(void){
    scanf("%s",c);
    n=strlen(c);
    int k=0,l=1;
    for(int i=n-1;i>=0;i--){
        s[i]=l;
        int x=c[i]-'a';
        b[x].push_back(i);
        if(!ok[x]){
            ok[x]=true;
            if(++k==26){
                k=0;
                l++;
                for(int j=0;j<26;j++)ok[j]=false;
            }
        }
    }
    for(int i=0;i<26;i++){
        b[i].push_back(n);
        sort(b[i].begin(),b[i].end());
    }
    k=l;
    l=-1;
    for(int i=0;i<k;i++){
        for(int j=0;j<26;j++){
            if(s[*upper_bound(b[j].begin(),b[j].end(),l)]<k-i){
                l=*upper_bound(b[j].begin(),b[j].end(),l);
                printf("%c",char(j+'a'));
                break;
            }
        }
    }
    printf("\n");
}


Measured memory_bytes: 2176
#include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
int main()
{
	int a[15],x=0;
	for(int i=1;i<=10;i++)
	{
		scanf("%d",&a[i]);

	}
	for(int i=1;i<=9;i++)
	{
		for(int q=i+1;q<=10;q++)
		{
			if(a[i]<a[q])
			{
				x=a[i];
				a[i]=a[q];
				a[q]=x;
			}
			
		}
	}
	printf("%d\n%d\n%d\n",a[1],a[2],a[3]);
	return 0;
}


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

using namespace std;

int dp[100000],v[100000];

int calcdp(int k,int id){
	if(dp[id]==INT_MAX){
		int aux;
		for(int i=0;i<k;i++){
			if(id-k+i>=0){
				aux=calcdp(k,id-k+i);
				if(abs(v[id]-v[id-k+i])+aux<dp[id]){
					dp[id]=abs(v[id]-v[id-k+i])+aux;
				}
			}
		}
	}
	return dp[id];
}

int main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>v[i];
		dp[i]=INT_MAX;
	}
	dp[0]=0;
	dp[n-1]=calcdp(k,n-1);
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 5760
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {

	bool flag1 ;
	vector<vector<int>> c(3,vector<int>(3));
	vector<int> a(3);
	vector<int> b(3);
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100 - i; j++) {
			a[0] = i;
			b[0] = j;
			b[1] = c[0][1] - a[0];
			b[2] = c[0][2] - a[0];
			a[1] = c[1][0] - b[0];
			a[2] = c[2][0] - b[0];
			for (int k = 0; k < 3;k++) {
				for (int l = 0; l < 3; l++) {
					if (c[k][l]==a[k]+b[l]) {
						flag1 = true;
					}
					else {
						flag1 = false;
						break;
					}
				}
				if (!flag1) break;
			}
			if (flag1)break;
		}
		if (flag1)break;
	}
	if (flag1)cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

vll ply_memo(51, 0);
ll ply(ll n) {
  if (ply_memo[n] > 0) return ply_memo[n];
  if (n == 0) return 1;
  else return ply_memo[n] = 2 * ply(n - 1) + 3;
}

vll bs_memo(51, 0);
ll bs(ll n) {
  if (bs_memo[n] > 0) return bs_memo[n];
  if (n == 0) return 1;
  else return bs_memo[n] = 2 * bs(n - 1) + 1;
}

void solve(ll n, ll x, ll &ans) {
  if (x == 1) {
    if (n == 0) ans++;
    return;
  }
  if (x == ply(n)) ans += bs(n);
  else if (x > ply(n) / 2 + 1) {
    ans += bs(n - 1) + 1;
    solve(n - 1, x - ply(n) / 2 - 1, ans);
  }
  else if (x > ply(n) / 2) ans += bs(n - 1) + 1;
  else solve(n - 1, x - 1, ans);
}

int main() {
  ll n, x;
  cin >> n >> x;
  ll ans = 0;
  solve(n, x, ans);
  cout << ans << endl;
}

Measured memory_bytes: 256