akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  long long n,a[200005],sum=100000000000000000,s;
  a[0]=0;
  cin>>n;
  for(long long i=1;i<=n;i++){
    cin>>s;
    a[i]=a[i-1]+s;
  }
  long long nasu;
  for(long long i=1;i<n;i++){
    nasu=a[n]-a[i]*2;
    if(nasu<0) nasu*=-1;
    sum=min(sum,nasu);
  }
  cout<<sum<<'\n';
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0; i<n;i++)
const ll mod =(1e9)+7;
int x=0;
ll fpow(ll a,ll b){//逆元を求める？
	ll c=1;
	while(b){//bが0以外ならやる
		if(b&1) c=c*a%mod; // 　条件両方のbit 1（つまりｂが1）ならする
		a*=a;  //2乗　4,8,16　1種類減るごとに選択の有無で2選択　で2乗
		a%=mod; // 割ったあまり
		b>>=1; // 半分 2,1,0 1種類ずつ減らす
      if(x==1)cout << c<<" "<<b << " " <<a <<endl;     
	}
	return c;//全体の数（すべての通り
}
ll C(ll a,ll b){//aは全体の数　ｂは選ぶ数 aCb
	ll x=1,y=1;
	for(int i=1;i<=b;i++){
		x=x*(a-i+1)%mod;//a*(a-1)*(a-2)... 分子
		y =y*i%mod;//!b 1*2*3*4*...b 分母
  }
  //cout << x <<" " <<y<<" "<<mod-2 <<endl;
  return x*fpow(y,mod-2)%mod;
  //return x/y;
}
int main(){
  ll  n,a,b;
  cin>>n>>a>>b;
  ll ans=fpow(2,n)%mod;
	//ll ans=1;//全通りの個数
  //rep(i,n) ans *=i+1;//これではだめだから
  //x=1;
	ll x1=C(n,a);//aの個数 4 1
    //cout << x1 <<endl;
	ll x2=C(n,b);//bの個数
  //cout << ans <<" "<<x1 <<" " <<x2 <<endl;
  //cout << (ans -x1-x2-1)%mod<<endl;
  //cout << x2 <<endl;
	ans=(ans-x1+mod)%mod;//aを引く
	cout<<(ans-x2-1+mod)%mod<<endl;//bを引くそしてすべてを取らないって選択肢の1通りを引く
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int K,A,B;
  cin >> K;
  cin >> A >> B;
  int wallA;
  wallA = A/K;
  if((wallA+1)*K <= B  ||  A == wallA*K){
    cout << "OK" << endl;
  }
  else{
    cout << "NG" <<endl;
  }
}



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

int main() {
	int N;
	int res = 0;
	cin >> N;
	for (int a = 0; a <= 25; ++a) {
		for (int b = 0; b <= 20; ++b) {
			int total = 7 * a + 4 * b;
			if (total == N) ++res;
		}
	}

	if (res) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;


int main(){
  int r,c; cin >> r >> c;
  vector<vector<int>> rc(r+1, vector<int>(c+1));
  rep(i, r){
    rep(j, c) {
      cin >> rc[i][j];
    }
  }
  rep(i, rc.size()-1) {
    int rt=0;
    rep(k, rc[i].size()) {
      rt += rc[i][k];
    }
    rc[i][rc[i].size()-1] = rt;
    
    rep(k, rc[i].size()) {
      rc[rc.size()-1][k] += rc[i][k];
    }
  }
  
  rep(i, rc.size()) {
    rep(k, rc[i].size()) {
      cout << rc[i][k];
      if (k !=rc[i].size()-1) cout << " ";
    }
    cout << endl;
  }
  
}



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

int main() {
  long long n,m,x;
  cin>>n>>m>>x;
  vector<long long>c(n);
  vector<vector<long long>>a(n,vector<long long>(m));
  for(long long i=0;i<n;i++){
    cin>>c.at(i);
    for(long long j=0;j<m;j++){
      cin>>a.at(i).at(j);
    }
  }
  long long ans=45454545;
  for(long long i=0;i<(1<<n);i++){
    bool wa=true;
    long long sum=0;
    vector<long long>test(m,0);
    for(long long j=0;j<n;j++){
      if(i>>j&1){
        sum+=c.at(j);
        for(long long k=0;k<m;k++){
          test.at(k)+=a.at(j).at(k);
        }
      }
    }
    for(long long l=0;l<m;l++){
      if(test.at(l)<x){
        wa=false;
      }
    }
    if(wa){
      ans=min(ans,sum);
    }
  }
  if(ans==45454545){
    cout<<"-1"<< endl;
  }
  else{
    cout<<ans<< endl;
  }
}
    

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
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; }
  
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  int n;
  cin >> n;
  vector<ll>a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  
  ll sum = 0;
  ll ans = 0;
  rep(i,n-1){
    sum += a[i];
    if(sum*2>=a[i+1])continue;
    else{
      ans = i+1;
    }
  }
  ans = n-ans;
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3936
#include <bits/stdc++.h>
#define N 100010
#define int long long
using namespace std;

signed main(){
  set<int> S;
  int n;
  cin>>n;
  int A[N];
  for(int i=0;i<n;i++) cin>>A[i],S.insert(A[i]);
  sort(A,A+n);

  int ans = 0;
  for(int i=0;i<n;i++){
    if(ans+1 < A[i]) break;
    //    if(!S.count(ans+1)) break;
    ans += A[i];
  }
  cout<<ans+1<<endl;

  return 0;
}

Measured memory_bytes: 3696
#include"string.h"
#include"stdio.h"
#include"queue"
#include"stack"
#include"vector"
#include"algorithm"
#include"iostream"
#include"math.h"
#include"stdlib.h"
#define M 522
#define inf 100000000
#define eps 1e-8
#define PI acos(-1.0)
using namespace std;
double X,Y;
struct Point
{
    double x,y;
}p[M];
struct Triangle
{
    Point v[3];
};
struct Circle
{
    Point center;
    double r;
};
double pow(double x)
{
    return x*x;
}
double Len(Point a,Point b)
{
    return sqrt(pow(a.x-b.x)+pow(a.y-b.y));
}
double TriangleArea(Triangle a)//求三角形的面积
{
    double px1=a.v[1].x-a.v[0].x;
    double py1=a.v[1].y-a.v[0].y;
    double px2=a.v[2].x-a.v[0].x;
    double py2=a.v[2].y-a.v[0].y;
    return fabs(px1*py2-px2*py1)/2;
}
Circle CircleOfTriangle(Triangle t)//就三角形外接圆
{
    Circle tmp;
    double a=Len(t.v[0],t.v[1]);
    double b=Len(t.v[0],t.v[2]);
    double c=Len(t.v[1],t.v[2]);
    tmp.r=a*b*c/4/TriangleArea(t);
    double a1=t.v[1].x-t.v[0].x;
    double b1=t.v[1].y-t.v[0].y;
    double c1=(a1*a1+b1*b1)/2;
    double a2=t.v[2].x-t.v[0].x;
    double b2=t.v[2].y-t.v[0].y;
    double c2=(a2*a2+b2*b2)/2;
    double d=a1*b2-a2*b1;
    tmp.center.x=t.v[0].x+(c1*b2-c2*b1)/d;
    tmp.center.y=t.v[0].y+(a1*c2-a2*c1)/d;
    return tmp;
}
void Run(int n)
{
    random_shuffle(p+1,p+n+1);//随机排序取点
    int i,j,k;
    Circle tep;
    tep.center=p[1];
    tep.r=0;
    for(i=2;i<=n;i++)
    {
        if(Len(p[i],tep.center)>tep.r+eps)
        {
            tep.center=p[i];
            tep.r=0;
            for(j=1;j<i;j++)
            {
                if(Len(p[j],tep.center)>tep.r+eps)
                {
                    tep.center.x=(p[i].x+p[j].x)/2;
                    tep.center.y=(p[i].y+p[j].y)/2;
                    tep.r=Len(p[i],p[j])/2;
                    for(k=1;k<j;k++)
                    {
                        if(Len(p[k],tep.center)>tep.r+eps)
                        {
                            Triangle t;
                            t.v[0]=p[i];
                            t.v[1]=p[j];
                            t.v[2]=p[k];
                            tep=CircleOfTriangle(t);
                        }
                    }
                }
            }
        }
    }
    printf("%.8lf\n",tep.r);
}
int main()
{
    int n,i;
    scanf("%d",&n);
        for(i=1;i<=n;i++)
            scanf("%lf%lf",&p[i].x,&p[i].y);
        Run(n);
    
}

Measured memory_bytes: 256
n,m,c = map(int,input().split())
blist = list(map(int,input().split()))
alist = [list(map(int,input().split()))for i in range(n)]
ans = 0
for i in range(n):
    power = c
    for j in range(m):
        power += blist[j]*alist[i][j]
    if power>0:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<cstring>
#include<string>
using namespace std;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int x,a,b;
	scanf("%d %d %d",&x,&a,&b);
	printf("%d\n",(x-a)%b);
	return 0;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }

LL n, a[10000], b[10000], sa, sb, sp, sm, p, m;

int main() {
	cin >> n;
	inc(i, n) { cin >> a[i]; }
	inc(i, n) { cin >> b[i]; }
	
	inc(i, n) { sa += a[i]; }
	inc(i, n) { sb += b[i]; }
	LL s = sb - sa;
	/*
	inc(i, n) { sp += max(0LL, b[i] - a[i]); }
	inc(i, n) { sm -= min(0LL, b[i] - a[i]); }
	assert(sp >= 0);
	assert(sm >= 0);
	*/
	
	inc(i, n) {
		if(a[i] < b[i]) {
			p += ce(b[i] - a[i], 2);
			m += (b[i] - a[i]) % 2;
		}
		if(a[i] > b[i]) {
			m += a[i] - b[i];
		}
	}
	/*
	cout << s << endl;
	cout << p << endl;
	cout << m << endl;
	*/
	cout << (p <= s && m <= s ? "Yes" : "No") << endl;
	
	return 0;
}


Measured memory_bytes: 384
def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

acgt = ["A", "C", "G", "T"]
ans = 0
cnt = 0
for c in input():
    if c in acgt:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
ans = max(ans, cnt)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N, M; cin >> N >> M;
  int pena = 0;
  set<int> AC;
  map<int, int> WA;
  rep(i, M) {
    int p;
    string s; cin >> p >> s;
    if (!AC.count(p)) {
      if (s == "WA") {
        WA[p]++;
      } else {
        AC.insert(p);
        pena += WA[p];
      }
    }
  }
  cout << AC.size() << ' ' << pena << endl;
}

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

#define FastRead  ios_base::sync_with_stdio(0);cin.tie(0);
#define endl      "\n"
#define pi        acos(-1.0)

typedef long long ll;
typedef long long unsigned llu;

int main()
{
    FastRead

    long double L,l,v;

    cin>>L;

    l = L/3.0;

    v = l*l*l;

    cout<<fixed<<setprecision(20)<<v;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<queue>
#include<cmath>
#include <string>
#include<map> 
#include<deque>  
#include<vector>
#include<bitset>
#include<string>  
#include<cstring> 
#include<stack>  
#include<set>
#include<functional>
#define mst(x,y) memset(x,y,sizeof x)
#define mp(x,y) make_pair((x),(y))
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<long long,long long> pll;
typedef pair<int,int> pii;
int x,a,b,c,dis[203],hed[202],K,v[202],ans=1234567890;
priority_queue<pii,vector<pii>,greater<pii> > q;
struct edge{
	int v,next,w;
}e[200005];
void adde(int u,int v,int w){
	e[K].w=w;
	e[K].v=v;
	e[K].next=hed[u];
	hed[u]=K++;
}
void g(int vl){
	q.push(mp(0,0));int u;
	dis[0]=0;
	while(!q.empty()){
		u=q.top().second;q.pop();
		for(int i=hed[u];~i;i=e[i].next){
		/*	if(vl<=v[e[i].v]&&vl+m>=v[e[i].v]&&dis[e[i].v]>dis[u]+e[i].w)
			{dis[e[i].v]=dis[u]+e[i].w;
			q.push(mp(dis[e[i].v],e[i].v));}//printf("%d:%d\n",e[i].v,dis[e[i].v])*/;
		}
	}
	return;
}
int main()
{
	int ans=0;
	scanf("%d%d%d%d",&a,&b,&c,&x);
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			for(int k=0;k<=c;k++){
				if(i*500+j*100+k*50==x) ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}                    

Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define vi vector<ll>
#define vs vector<string>
#define vp vector<pair<ll, ll>>
#define vt vector<tuple<ll, ll, ll>>
using namespace std;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
map<ll, ll> mp;

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

int main()
{
	ll n;
	cin >> n;
	Graph g(n);
	REP(i, n)
	{
		ll t;
		cin >> t;
		add_edge(g, i, t - 1, 1);
	}
	vi isdone(n, 0);
	ll pos = 0, dep = 0, prev = -1;
	while (pos != 1 && !isdone[pos])
	{
		isdone[pos] = 1;
		prev = pos;
		pos = g[pos].front().to;
		dep++;
	}
	cout << (pos == 1 ? dep : -1) << endl;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
using namespace std;
int INF = 10000000;
int main(){
	int N, M;
	cin >> N >> M;
	vector<int> a(M), S(M, 0);
	for (int i = 0; i < M; i++){
		cin >> a[i];
		int b;
		cin >> b;
		for (int j = 0; j < b; j++){
			int c;
			cin >> c;
			S[i] += 1 << (c - 1);
		}
	}
	int K = 1 << N;
	vector<int> dp(K, INF);
	dp[0] = 0;
	for (int i = 1; i < K; i++){
		for (int j = 0; j < M; j++){
			dp[i] = min(dp[i], dp[i & ~S[j]] + a[j]);
		}
	}
	if (dp[K - 1] == INF){
		cout << -1 << endl;
	} else {
		cout << dp[K - 1] << endl;
	}
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

class Program

{
    public Program() { }
    public static int Main()
    {
        cin = new Scanner();
        new Program().calc();
        return 0;
    }
    static Scanner cin;

    void calc()
    {
        long N, A, B;
        N = cin.nextLong();
        A = cin.nextLong()-1;
        B = cin.nextLong();




        Console.WriteLine(A/N<B/N?"OK":"NG");


    }



}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


class XRand
{
    uint x, y, z, w;


    public XRand()
    {
        init();
    }

    public XRand(uint s)
    {
        init();
        init_xor128(s);
    }

    void init()
    {
        x = 314159265; y = 358979323; z = 846264338; w = 327950288;

    }

    public void init_xor128(uint s)
    {
        z ^= s;
        z ^= z >> 21; z ^= z << 35; z ^= z >> 4;
        z *= 736338717;
    }

    uint next()
    {
        uint t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8;
    }

    public long nextLong(long m)
    {
        return (long)((((ulong)next() << 32) + next()) % (ulong)m);
    }

    public int nextInt(int m)
    {
        return (int)(next() % m);
    }

    public int nextIntP(int a)
    {
        return (int)Math.Pow(a, nextDouble());
    }

    public int nextInt(int min, int max)
    {
        return min + nextInt(max - min + 1);
    }


    public double nextDouble()
    {
        return (double)next() / uint.MaxValue;
    }

    public double nextDoubleP(double a)
    {
        return Math.Pow(a, nextDouble());
    }
}

Measured memory_bytes: 27484
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
#define ll long long
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int main(){
	fastio();
	int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin>>k;
	cout<<a[k-1];
}

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

int main(void)
{
    int x,a,b;
    scanf("%d%d%d",&x,&a,&b);
    while((1>x||x>1000)||(1>a||a>1000)||(1>b||b>1000))
    {
        scanf("%d%d%d",&x,&a,&b);
    }
    if(abs(x-a)<=abs(x-b))
    {
        printf("A\n");
    }
    else
    {
    printf("B\n");
    }
    return 0;
}

Measured memory_bytes: 128
<?php

fscanf(STDIN, "%s", $s);
$n = strlen($s);

$r = 0;
$b = 0;
for ($i = 0; $i < $n; ++$i) {
    if ($s[$i] == 0) {
        ++$r;
    } else {
        ++$b;
    }
}

echo 2 * min($r, $b);


Measured memory_bytes: 4728
import scala.io.StdIn._

object Main {
  def main(args: Array[String]): Unit = {
    while (true) {
      val n = readInt
      if (n == 0) return

      var list: Array[Long] = Array.empty
      for (i <- 0 until n) {
        list :+= readInt.toLong
      }
      println(execute(list))
    }

    //println(execute(Array(-5, -1, 6, 4, 9, -6)))
  }

  def execute(list: Array[Long]): Long = {

    var max = list(0)
    var tmp = max
    for (i <- 0 until list.length) {
      //val result = new Array[Long](list.length)
      //result(i) = list(i)
      tmp = list(i)
      max = Math.max(list(i), max)
      for (j <- i + 1 until list.length) {
        val x = list(j) + tmp
        max = Math.max(x, max)
        tmp = x
      }
      //      result.foreach(x => print(x + " "))
      //      println()
    }

    max
  }
}

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

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

    vector<double> v(n);
    for(int i = 0; i < n; i++)  cin >> v[i];
    
    vector<double> s = v;
    sort(s.begin(), s.end());
    
    for(double i : v){
        auto l = lower_bound(s.begin(), s.end(), i);
        auto r = upper_bound(s.begin(), s.end(), i);
        cout << 3*(l-s.begin()) + (r-l-1) << endl;
    }

    return 0;
}


Measured memory_bytes: 4328
n,m = map(int, input().split())
link = [[] for _ in range(n)]
ab=[]
for i in range(m):
    a,b = list(map(int,input().split()))
    ab.append([a,b])
    link[a-1].append(b-1)

from collections import deque
def best_cycle(a,b):
    a,b=itm
    a-=1
    b-=1
    Q = deque()
    Q.append([b,[b]])
    visited=[-1]*n
    visited[b]=1

    while Q:
        now,path = Q.popleft()
        for nxt in link[now]:
            if nxt==a: # goal
                return True,path + [nxt]
            if visited[nxt]!=-1:
                continue
            visited[nxt]=1
            Q.append([nxt,path + [nxt]])
    return False,[]

mn = 10**10
ans=[]
found=False

for itm in ab:
    a,b = itm
    ret,path = best_cycle(a,b)
    if ret and len(path) < mn:
        ans=path
        mn = len(path)
        found=True

if found:
    print(len(ans))
    for a in ans:
        print(a+1)
else:
    print(-1)

Measured memory_bytes: 76508
n,a,b = map(int, input().split())
mod = 10**9+7

def cmb(n,r):
    a,b = 1,1
    for i in range(r):
        a = a * (n-i) % mod
        b = b * (i+1) % mod
    return a * pow(b, mod-2, mod) %mod

print((pow(2, n, mod) - cmb(n,a) - cmb(n,b) - 1)%mod)

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

#define int             long long int
#define ff              first
#define ss              second
#define pb              push_back

#define vi              vector <int>
#define pii             pair <int, int>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))

#define endl            "\n"
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl



template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;

void solve()
{
	int n;
	cin >> n;
	n--;

	string ans = "";

	while (n >= 0)
	{

		int x = n % 26;
		ans += (char)('a' + x );
		n /= 26;
		n--;
	}
	reverse(all(ans));

	cout << ans << endl;
	return;

}

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

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

	int t = 1;
	//cin >> t;
	while (t--) solve();

	return 0;
}

Measured memory_bytes: 3620
use std::io;


/// https://beta.atcoder.jp/contests/abc065/tasks/abc065_b
fn main() {
    let n = read_one::<usize>();
    let mut an = Vec::new();

    for _ in 0..n {
        let i = read_one::<usize>() - 1;
        an.push(i);
    }
    let mut btn = 0;
    for i in 0..n {
        if btn == 1 { println!("{}", i); return; }
        btn = an[btn];
    }
    println!("-1");
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a;i<=b;i++)
#define endl '\n'
#define mod 1000000007
#define pi 3.14159265358979323
 
bool sorttt(const pair<int, pair<char, int> > &a, 
              const pair<int, pair<char, int> > &b) 
{ 
    return (a.first > b.first); 
}
 
int power(int x,int n){
    int res=1;
    while(n>0){
        if(n&1)
            res=res*x;
        x*=x;
        n>>=1;
    }
    return res;
}

int bin(int x,int n){
    int res=1;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}
bool prime(int n){
    if(n==3)return 1;
    repp(i,2,sqrt(n)){
        if(n%i==0)return 0;
    }
    return 1;
}
int chk(int n){
    int mi=100, ma=-1;
    while(n){
        mi=min(mi,n%10);
        ma=max(ma,n%10);
        n/=10;
    }
    return ma*mi;
}
 
signed main()
{
    fast
    int n; cin>>n;
    string s; cin>>s;
    if(s.size()<=n)cout<<s;
    else {rep(i,0,n)cout<<s[i];
    cout<<"...";}
}


Measured memory_bytes: 3636
def solve(m,na,nb):
	p = [int(input()) for i in range(m)]
	ans,gap = -1,0
	for i in range(na,nb + 1):
		if p[i - 1] - p[i] >= gap:
			gap = p[i - 1] - p[i]
			ans = i
	print(ans)
	

while True:
	m,na,nb = map(int,input().split())
	if m == 0: break
	solve(m,na,nb)


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

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
  string s = to_string(N);
  bool flag = false;
  for (char c : s) if (c == '7') flag = true;
  string ans = (flag) ? "Yes" : "No";
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3744
N,K = map(int,input().split())
p = list(map(int,input().split()))
P = [0]*N
E = [0]*N
ev = [0]*(N+1)
EV = [0]*(N-K+1)

for i in range(N):
    P[i] = (p[i]+1)*p[i]/2
    E[i] = P[i]/p[i]
if N==K:
    print(sum(E))
elif K==1:
    print(max(E))
else:
    for i in range(N):
        ev[i+1] = ev[i]+E[i]
    for i in range(N-K+1):
        EV[i]=ev[i+K]-ev[i]
    print(max(EV))

Measured memory_bytes: 34816
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef deque<int> DI;
typedef deque<LL> DLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(n); sll(k);
	string str; cin >> str;
	str[k-1] += ('a' - 'A');
	cout << str << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
// #define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vpiipi vector<piipi>
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
#define mod 1000000007
// #define mod 1000000009
// #define mod 163577857 
// #define mod 998244353
#define rep(i,n) for (int i = 0; i < n; i++)
#define repp(i,a,b) for(int i = a ; i<b ; i++)
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }

//Binomial Coefficients
    int fact[500010], factinv[500010] , coefficientflag = 0;
    void Util_nCr()
    {
        fact[0] = 1 , factinv[0] = 1;
        repp(i,1,500010)
        {
            fact[i] = (fact[i-1] * i)%mod;
            factinv[i] = (factinv[i-1] * inverse(i))%mod;
        }
    }
    int nCr(int n , int r)
    {
        if(!coefficientflag) coefficientflag = 1 , Util_nCr();             
        return ((fact[n] * inverse(fact[n-r]) % mod * inverse(fact[r]))%mod) ;
    }

void solve();
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    // cin >> t; 
    rep(i,t)
    {
        // cout << "Case #" << i+1 << ": ";
        solve();
    }
}

void solve() 
{
    int n , l;
    cin >> n >> l;
    int a[n] , sum = 0 ;
    rep(i,n)
        cin >> a[i];
    int hah = -1;
    rep(i,n-1)
        if(a[i]+a[i+1]>=l)
            hah = i+1;
    if(hah==-1)
        cout << "Impossible\n";
    else
    {
        cout << "Possible\n";
        repp(i,1,hah)
            cout << i << endl;
        reppr(i,n,hah+1)
            cout << i << endl;
        cout << hah << endl;
    }
}  

Measured memory_bytes: 4368
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
int main()
{
    int n,k ;
    scanf("%d%d",&n,&k);
    int tot=0;
    for(int i=1;i<=n;i++)
    {
        int h;
        scanf("%d",&h);
        if(h>=k)
            tot++;
    }
    printf("%d",tot);
    return 0;
}


Measured memory_bytes: 256
<?php
$i = 0;
$cell = [];
$H = 0;
$W = 0;
while (true) {
    if ($i === 0) {
		$stdin = fgets(STDIN);
		$stdin = explode(" ", $stdin);
		$H = (int)$stdin[0];
		$W = (int)$stdin[1];
    } else {
    	$cellLine = fgets(STDIN);
        $cellLine = str_split($cellLine);
        array_push($cell, $cellLine);
    }
  	$i++;
    if ($i > $H) { break; }
}
$HWhiteIndex = [];
$WWhiteIndex = [];
foreach ($cell as $lineNum => $line) {
    $WWhiteCount = 0;
    foreach ($line as $i => $elem) {
		if ($elem === ".") {
            array_push($HWhiteIndex, $i);
        	$WWhiteCount++;
        }
    }
    array_push($WWhiteIndex, $WWhiteCount);
}
$arrCount = array_count_values($HWhiteIndex);
$exIdx = [];
foreach ($arrCount as $i => $val) {
	if ($val === $H) {
    	array_push($exIdx, $i);
    }
}
$exLine = [];
foreach ($WWhiteIndex as $i => $val) {
	if ($val === $W) {
    	array_push($exLine, $i);
    }
}

//output
foreach ($cell as $lineNum => $line) {
    if (!in_array($lineNum, $exLine, true)) {
    	foreach ($line as $i => $elem) {
            if (!in_array($i, $exIdx, true)) {
				printf($elem);
            }
    	}
    }
}

Measured memory_bytes: 6648
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define int int64_t
#define double long double
#define rep(i, N) for(int i=0; i<N; i++)
#define repr(i, N) for(int i=N-1; i>=0; --i)
#define all(v) v.begin(),v.end() 
using namespace std;
//using pr = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言

//グローバル変数
//const int INF = ;
//const int MAX_N = ;
//const int MAX_M = ;
//vvec dp(MAX_N, vec(MAX_M));

//関数：
/* メイン・プログラム */
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n; cin >> n;
	vec p(n);
	rep(i, n) cin >> p[i];
	
	int mn = n+5; int ct = 0;
	rep(i, n) {
		if(p[i] <= mn) {
			ct++;
			mn = p[i];
		}
	}
	
	cout << ct << endl;
	return 0;
}

/*	(n * m) % dvs = ((n%dvs) * (m%dvs)) % dvs
*/

//std::string str;
//str = std::to_string(int i);
//bitset<3> s(N);
//int ans = (char)grid - '0';
//int id = lower_bound(all(arr), x) - arr.begin();
//cout << fixed << setprecision(10) << tld << endl;
//vector<int> sub(itr,itr+d); //イテレーターで部分数列(i=0...d)を指定

/*	struct data {
	char *name;
	int age;
	int height;
	double weight;
};*/

/*	string ans(lgd, '0');
	string &refer = ans;
	for(int i=0; i<lgd; i++) refer[i] = (char)vd[i] + '0';*/

/*	map<int,int> mp;
for(auto p : mp) {
	ct += p.second*(p.second-1); }

map<int,int>::iterator itr;
for(itr = mp.begin(); itr != mp.end(); itr++) {
	ans += itr->second * (itr->second-1);
}*/


Measured memory_bytes: 1792
h,w = map(int,input().split())
S=[]
for i in range(h):
    S.append(str(input()))

    #まわりに１つずつ空きますを広げる関数
def akimasu(s,h,w):
    F=[]
    F.append("."*(w+2))
    for i in s:
        F.append("."+i+".") 
    F.append("."*(w+2))
    return F

F=akimasu(S,h,w)

def hantei(f,y,x): # (y,x)の座標は1,1からh,wまでとする
    #判定用のfでは(y+1,x+1)が開始の点
    C=0
    for i in range(3):
        if f[y-1][x+i-1]=="#":
            C+=1
    for j in range(3):
        if f[y+1][x+j-1]=="#":
            C+=1
    if f[y][x-1]=="#":
        C+=1
    if f[y][x+1]=="#":
        C+=1
    if f[y][x]=="#":
        return "#"
    return str(C)

L=[] #爆弾数のリストh,wで
for H in range(1,h+1):
    X=[]
    for W in range(1,w+1):
        X.append(hantei(F,H,W))
    L.append(X)
for l in L:
    print("".join(l))

Measured memory_bytes: 3188
#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--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
long double PI = acos(-1);



int main(){
    double r;
    cin >> r;
    cout << fixed << setprecision(10) << 2 * r * PI << endl;
    return 0;
}


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

using namespace std;

const int N = 1e5 + 5;

int n, f[N], g[N], mod;
vector <int> gr[N];

void dfs (int u, int p) {
    auto it = find(gr[u].begin(), gr[u].end(), p);
    if (it != gr[u].end()) gr[u].erase(it);
    f[u] = 1;
    for (auto v: gr[u]) {
        dfs(v, u);
        f[u] = 1LL * f[u] * (f[v] + 1) % mod;
    }
}

void redfs (int u, int coef) {
    g[u] = coef + 1;
    vector <int> pre((int)gr[u].size()), suf((int)gr[u].size());
    int cur = 1;
    for (int i = 0; i < gr[u].size(); i++) {
        int v = gr[u][i];
        cur = 1LL * cur * (f[v] + 1) % mod;
        pre[i] = cur;
    }

    cur = 1;
    for (int i = (int)gr[u].size() - 1; i >= 0; i--) {
        int v = gr[u][i];
        cur = 1LL * cur * (f[v] + 1) % mod;
        suf[i] = cur;
    }

    for (int i = 0; i < gr[u].size(); i++) {
        int v = gr[u][i], ncoef = coef + 1;
        if (i) ncoef = 1LL * ncoef * pre[i - 1] % mod;
        if (i + 1 < gr[u].size()) ncoef = 1LL * ncoef * suf[i + 1] % mod;
        redfs(v, ncoef);
    }
}

int main(){
    scanf("%d %d", &n, &mod);
    for (int i = 1; i <= n - 1; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        gr[u].push_back(v); gr[v].push_back(u);
    }

    dfs(1, 1);
    redfs(1, 0);
    for (int i = 1; i <= n; i++) printf("%d\n", 1LL * f[i] * g[i] % mod);
    return 0;
}


Measured memory_bytes: 16512
#include<bits/stdc++.h>
using namespace std;
long long a[200009],n,sum,sum2;
int main() {
	scanf("%lld",&n);
	for(int i=0;i<n;i++) {
		scanf("%lld",a+i);
		sum+=a[i];
	}
	for(int i=0;i<n;i++) {
		sum2+=a[i];
		if(sum2*2>=sum) {
			printf("%lld\n",min(sum2*2-sum,sum-(sum2-a[i])*2));
			return 0;
		}
	}
}

Measured memory_bytes: 1920
s = input()

if len(s) == 2:
    if len(set(s)) == 1:
        print(1, 2)
        exit()
    else:
        print(-1, -1)
        exit()

for i in range(len(s)-2):
    if len(set(s[i:i+3])) < 3:
        print(i+1, i+3)
        exit()
else:
    print(-1, -1)

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

int main(){

	int N;
	cin>>N;
	for(int i=0;i<10000;i++){
		if(N<1000){
			N=1000-N;
			break;
		}
		if(N==1000){
			N=0;
			break;
		}
		N-=1000;
	}
	cout<<N;

}


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

typedef long double ld;

int n;
int a;
ld res;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a);
        res += 1.0l / ld(a);
    }
    res = 1.0l / res;
    cout << fixed << setprecision(10) << res << endl;
    return 0;
}


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

int main()
{
    ll n,w;
    cin>>n>>w;
    ll wt[n],v[n];
    ll dp[2][100001];
    for(int i=0;i<=100000;i++)
    {
        dp[0][i]=0,dp[1][i]=0;
    }
    for(int i=0;i<n;i++){
        cin>>wt[i]>>v[i];
    }
    int i,j;
    for(i=0;i<n;i++)
    {
        dp[1][wt[i]]=max(dp[0][wt[i]],v[i]);
        for(j=1;j<=100000;j++)
        {
            if(j+wt[i]<=w && dp[0][j]>0)
            {
                dp[1][j+wt[i]]=max(dp[0][j+wt[i]],dp[0][j]+v[i]);
            }
        }
        for(j=1;j<=100000;j++)
            dp[0][j]=dp[1][j];
        
    }
    ll ans=0;
    for(i=0;i<=100000;i++)
        ans=max(ans,dp[1][i]);
    cout<<ans;
}



Measured memory_bytes: 1792
// 153 A

#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    long long int h, count=0, sum=0;
    cin >> h;
    while(h){
        h /= 2;
        sum += pow(2, count);
        count++;
    }
    cout << sum << endl;
    return 0;
}


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

int main(){
  int A,B,C,X,Y,e=0;
  cin >> A >> B >> C >> X >> Y;
  if(2*C<A+B) e = min(X,Y);
  cout << min(A*X+B*Y+e*(2*C-A-B),max(X,Y)*2*C)<< endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std ;
int main ( ){
  int H,R;
  cin>>H>>R;
  if(H+R==0) {cout<<"0"<<endl;
  }else if(H+R>0) {cout<<"1"<<endl;
  }else if(H+R<0) {cout<<"-1"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define ll long long

using namespace std;


int main() {
    //fstream cin("A.in");
    //ofstream cout("A.out");
    int n;
    ios::sync_with_stdio(false);
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        int l, r;
        cin >> l >> r;
        ans += r - l + 1;
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


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

int main(){
  int n;
  cin>>n;
  string s;
  cin >> s;
  int L = s.length();
  for(int i=0;i<L;++i){
    for(int j=0;j<n;++j){
      s[i]++;
      if(s[i]=='['){
        s[i]='A';
      }
    }
  }
  cout << s<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll a[n][n];
    for(ll i=0;i<n;i++)
        for(ll j=0;j<n;j++)
            cin>>a[i][j];
    ll mx=1<<n;
    ll dp[mx];
    for(ll i=0;i<mx;i++)
    {
        vector<int> v;
        for(ll j=0;j<n;j++)
            if(i&(1<<j))
                v.push_back(j);
        ll ans=0;
        for(ll j=0;j<v.size();j++)
            for(ll k=j+1;k<v.size();k++)
                ans+=a[v[j]][v[k]];
        dp[i]=ans;
    }
    for(ll i=1;i<mx;i++)
        for(ll j=i;j>0;j=(j-1)&i)
            dp[i]=max(dp[i],dp[j]+dp[i^j]);
    cout<<dp[mx-1]<<endl;
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll n, a, b; cin >> n >> a >> b;
    ll d = 0;
    for(ll i = a; i <= b; i++)
    {
        if(i % n == 0)
        {
            d = 1;
            break;
        }
            
    }
    cout << ( d ? "OK" : "NG" );
    
}



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

int N;
int A[300010];
vector<int> V;
int ans[300010];

int main() {

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

    for(int i = 1; i <= N; i++) {
        V.push_back(A[i]);
    }
    sort(V.begin(), V.end());

    int tmp = N;
    int sum = 0;
    int idx = 0;
    for(int i = 0; i < N; i++) {
        while(V.size() != idx && V[idx] == i) {
            idx++;
            tmp--;
        }

        sum += tmp;

        ans[sum / (i + 1)] = i + 1;
    }

    int MAX = 0;
    for(int i = N; i > 0; i--) {
        MAX = max(MAX, ans[i]);
        ans[i] = MAX;
    }

    for(int i = 1; i <= N; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 4464
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define p pair<ll,ll>
#define pb push_back
#define mp make_pair
#define PI 3.14159265359

using namespace std;

ll gcd(ll a, ll b) {
	if(a*b == 0)return max(a, b);
	if (a < b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}
	if (a%b == 0)return b;
	return gcd(b, a%b);
}

int main(){

    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];

    sort(a.rbegin(),a.rend());

    if(a[0] < k){
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    ll g = a[0];

    rep(i,n){
        g = gcd(g,a[i]);
    }

    if(k%g == 0){
        cout << "POSSIBLE" << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
typedef long long ll;
const int maxn = 2e3 + 10;
const int INF = 2e9 + 10;
using namespace std;

typedef pair<int, int> pa;
pa res[maxn];
int n, m, T, kase = 1;
int a[maxn], b[maxn];
int pre[maxn], size[maxn];

int build(int x) {
	int tot = 0;
	memset(size, 0, sizeof size);
	for(int i = 1; i <= n; i++) {
		if(a[i] < x) {
			while(i <= n && a[i] < x) i++;
			i--; tot++; continue;
		} 
		pre[i] = tot; size[tot]++;
	}
	return tot;
}

int solve(int x, int q) {
	int t = 0, flag = 0;
	for(int i = 0; i < n; i++) {
		if(res[i].first < x) continue;
		int id = res[i].second, p = pre[id]; 
		if(size[p] < m) continue;
		if(res[i].first == x) flag = 1;
		size[p]--; q--;
		if(!q) { t = res[i].first - x; break; }
	}
	if(!flag || q) return INF;
	return t;
}

int main() {
	ios::sync_with_stdio(0);
	cin >> n >> m >> T;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		b[i - 1] = a[i];
		res[i - 1] = pa(a[i], i);
	}
	sort(b, b + n);
	sort(res, res + n);
	int cnt = unique(b, b + n) - b;
	int ans = INF;
	for(int i = 0; i < cnt; i++) {
		int x = b[i];
		build(x); ans = min(ans, solve(x, T));
	}
	cout << ans << endl;
	return 0;
}

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


namespace _20180502_pra
{
    class Program
    {
        static void Main(string[] args)
        {

            string s = Console.ReadLine();
            var slist = new List<string>();

            for (int i = 0; i < s.Length; i++)
            {
                if(s[i].ToString()== "B")
                {
                    if(slist.Count()-1>=0)
                    slist.RemoveAt(slist.Count()-1);
                }
                else
                {
                    slist.Add(s[i].ToString());
                }
            }

            foreach (var item in slist)
            {
                Console.Write(item);
            }


        }
    }
}

Measured memory_bytes: 13268
import  math
N,M = map(int,input().split())

def f(M):
    l = []
    for i in range(1,int(math.sqrt(M))+1):
        if M%i==0:
            l.append(i)
    n = len(l)
    for i in range(n):
        j = l[n-1-i]
        if M/j!=j:
            l.append(M//j)
    return l

l = f(M)

for i in range(len(l)):
    n = l[-1-i]
    if M/n >= N:
        ans = n
        break
print(ans)

Measured memory_bytes: 3064
import copy

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

t = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
L = {}
for i in A:
  if t[i] in L:
    if L[t[i]] < i:
      L[t[i]] = i
  else:
    L[t[i]] = i

dp = [[0 for j in range(10)] for i in range(N)]
for i in L.items():
  if i[0] - 1 < N:
    dp[i[0] - 1][i[1]] = 1
for i in range(N):
  if max(dp[i]) == 0:
    continue
  for j in L.items():
    k = i + j[0]
    if k < N:
      t = copy.deepcopy(dp[i])
      t[j[1]] += 1
      if sum(t) > sum(dp[k]):
        dp[k] = t
      else:
        for ii in range(9, 0, -1):
          if t[ii] > dp[k][ii]:
            dp[k] = t
            break
          elif t[ii] < dp[k][ii]:
            break
          
t = dp[-1]
Ans = ""
for i in range(9, 0, -1):
  for j in range(t[i]):
    Ans += str(i)
    
print(Ans)

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

int main()
{

	int k;
	cin >> k;
	int a, b,c=0;
	cin >> a >> b;

	for (int i = 1; i <= 1000; i++) {
		if (k*i >= a &&  b>= k*i) {
			c++;
		}
	}

	if (c > 0) {
		cout << "OK" << endl;
	}
	else {
		cout << "NG" << endl;
	}

	cin.get();
    cin.get();
    return 0;
}

Measured memory_bytes: 3636