akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<sstream>

using namespace std;

int main() {
	int f=0;
	int n;
	cin >> n;
	int a;
	a = n - 700;
	if (a >= 0) {
		if (a < 100) {
			f = 1;
			
		}
	}

	a = n % 100;
	a = a - 70;
	if (a >= 0) {
		if (a < 10) {
			f = 1;
		}
	}

	a = n % 10;
	a = a - 7;
	if (a == 0) {
		f = 1;
	}

	if (f == 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<queue>
#include<tuple>

using namespace std;

typedef tuple<double, int, int, int> Td3i;

double EPS = 0.001;

struct edge {
	int to, dis, limit;
	edge(int a, int b, int c) { to = a, dis = b, limit = c; }
};

int n, m, s, g;
vector<vector<edge>> E;
double ans[30][31][30 + 1];
double INF = 114514;

void djk(int start) {
	priority_queue<Td3i, vector<Td3i>, greater<Td3i>> pq;

	for (int i = 0; i < E[s].size(); i++) {
		int nextp = E[s][i].to, dis = E[s][i].dis;

		//最初はそのままの速度でいく
		if (ans[nextp][1][s] > (double)dis / 1.0) {
			ans[nextp][1][s] = (double)dis / 1.0;
			pq.push(make_tuple(ans[nextp][1][s], nextp, 1, s));
		}

	}

	while (pq.size()) {
		auto tmp = pq.top(); pq.pop();
		int npos = get<1>(tmp);
		int speed = get<2>(tmp);
		int before = get<3>(tmp);

		if (ans[npos][speed][before] != get<0>(tmp))continue;

		for (int i = 0; i < E[npos].size(); i++) {
			int nextp = E[npos][i].to, dis = E[npos][i].dis, limit = E[npos][i].limit;

			if (nextp == before)continue;

			//そのままの速度でいく
			if (speed <= limit && speed >= 1) {
				if (ans[nextp][speed][npos] > ans[npos][speed][before] + (double)dis / (double)speed) {
					ans[nextp][speed][npos] = ans[npos][speed][before] + (double)dis / (double)speed;
					pq.push(make_tuple(ans[nextp][speed][npos], nextp, speed, npos));
				}
			}
			
			//加速する
			if (speed + 1 <= limit && speed >= 1) {
				if (ans[nextp][speed + 1][npos] > ans[npos][speed][before] + (double)dis / (double)(speed + 1)) {
					ans[nextp][speed + 1][npos] = ans[npos][speed][before] + (double)dis / (double)(speed + 1);
					pq.push(make_tuple(ans[nextp][speed + 1][npos], nextp, speed + 1, npos));
				}
			}
			//減速する
			if (speed >= 2 && speed - 1 <= limit) {
				if (ans[nextp][speed - 1][npos] > ans[npos][speed][before] + (double)dis / (double)(speed - 1)) {
					ans[nextp][speed - 1][npos] = ans[npos][speed][before] + (double)dis / (double)(speed - 1);
					pq.push(make_tuple(ans[nextp][speed - 1][npos], nextp, speed - 1, npos));
				}
			}
		}
	}

}

int main() {

	while (1) {

		for (int i = 0; i < 30; i++) {
			for (int j = 0; j <= 30; j++)
				for (int k = 0; k < 30 + 1; k++)ans[i][j][k] = INF;
		}

		cin >> n >> m;
		if (n + m == 0)break;
		cin >> s >> g;
		s--, g--;
		E.resize(n);
		for (int i = 0; i < m; i++) {
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			a--, b--;
			E[a].push_back(edge(b, c, d));
			E[b].push_back(edge(a, c, d));
		}

		djk(s);

		double ANS = INF;
		for (int i = 0; i < n; i++)ANS = min(ANS, ans[g][1][i]);
		if (ANS == INF) {
			cout << "unreachable" << endl;
		}
		else {
			cout << ANS << endl;
		}
		E.clear();
	}

	return 0;
}


Measured memory_bytes: 3884
#include <bits/stdc++.h>
using namespace std;
int n, a[100005];
pair <int, int> p[100005];
int main () {
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> p[i].first;
		p[i].second = i;
	}
	sort(p + 1, p + n + 1);
	for(int i = 1; i <= n; i++) {
		cout << p[i].second << " ";
	}
}

Measured memory_bytes: 1536
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse= True)
ans = 0
for i in range(k):
    ans += l[i]
print(ans)


Measured memory_bytes: 3316
#include <iostream>

using namespace std;

int main(){
    int n, fx = 0, aux;
    scanf("%d", &n);
    aux = n;
    while(aux){
        fx += aux%10;
        aux /= 10;
    }
    if(n%fx)
        printf("No\n");
    else
        printf("Yes\n");
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	string A,B,C; cin>>A>>B>>C;
	if(A[A.sz-1]==B[0] && B[B.sz-1] ==C[0]) cout<<"YES";
	else cout<<"NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define VI vector<int>
#define VII vector<vector<int>>
#define VIII vector<vector<vector<int>>>
#define all(v) (v.begin(),v.end())


int main(){
    int N;
    cin>>N;
    VII F(N,VI(10));
    VII P(N,VI(11));
    rep(i,N){rep(j,10)cin>>F[i][j];}
    rep(i,N){rep(j,11)cin>>P[i][j];}

    ll ans = -INF;
    FOR(bit,1,(1<<10)){
        ll pro=0;
        rep(i,N){
            int cnt=0;
            rep(j,10)if(bit&(1<<j)&&F[i][j])++cnt;
            pro += P[i][cnt];
        }
        ans = max(pro,ans);
    }
    put(ans);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define EPS 1e-10
#define equal(a,b) (fabs(a-b) < EPS)

struct Point{
  double x,y;

  Point(){}
  Point(double x,double y) : x(x),y(y) {}

  Point operator + (const Point &p)const{ return Point(x+p.x,y+p.y); }
  Point operator - (const Point &p)const{ return Point(x-p.x,y-p.y); }
  Point operator * (const double &k)const{ return Point(x*k,y*k); }
  Point operator / (const double &k)const{ return Point(x/k,y/k); }
};

double cross(const Point &a,const Point &b){ return a.x*b.y - b.x*a.y; }
double dot(const Point &a,const Point &b){ return a.x*b.x+a.y*b.y; }
double norm(const Point &p){ return dot(p,p); }

istream &operator >> (istream &is,Point &p){ 
  return is >> p.x >> p.y;
}

typedef Point Vector;

struct Segment{
  Point s,t;
  Segment(){}
  Segment(Point s,Point t) : s(s),t(t) {}
};

#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1
#define ONLINE_BACK 2
#define ONLINE_FRONT -2
#define ON_SEGMENT 0
typedef Point Vector;

int ccw(Point p0,Point p1,Point p2){
  Vector a = p1 - p0;
  Vector b = p2 - p0;
  if(cross(a,b) > EPS){ return COUNTER_CLOCKWISE; }
  if(cross(a,b) < -EPS){ return CLOCKWISE; }
  if(dot(a,b) < -EPS){ return ONLINE_BACK; }
  if(norm(a) < norm(b)){ return ONLINE_FRONT; }
  return ON_SEGMENT;
}

bool isIntersectSS(const Segment &a,const Segment &b){
  Point s[2] = {a.s,a.t}, t[2] = {b.s,b.t};
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0
    && ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

int main(){
  int Q;
  Segment s1,s2;
  cin >> Q;
  while(Q--){
    cin >> s1.s >> s1.t >> s2.s >> s2.t;
    cout << isIntersectSS(s1,s2) << endl;
  }
  return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+10;
ll a[N];
int main()
{
    //freopen("i.txt","r",stdin);
    ll n,t,ans;
    scanf("%lld %lld",&n,&t);
     for(ll i=0;i<n;i++)
        scanf("%lld",&a[i]);
    ll ma=a[0],sum=a[0];
    printf("%lld\n",t/ma+1);
    for(ll i=1;i<n;i++)
    {
        if(ma>=a[i])
        {
            ans=(t-sum)/ma+1;
            if((t-sum)/ma*ma+sum+a[i]<=t)ans++;
            //cout<<ans<<'*'<<endl;
        }
        else
        {
            ans=(t-sum)/a[i]+1;
        }
        printf("%lld\n",t-sum>0?ans:1);
        ma=max(ma,a[i]);
        sum+=a[i];
    }
}



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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 998244353;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;

ll fastPow(ll x, ll b) {
    if (b == 0)
        return 1;
    else if (!(b & 1)) {
        return fastPow(x * x, b / 2);
    } else
        return x * fastPow(x * x, (b - 1) / 2);
}

bool isPal(string h) {
    string rev = h;
    reverse(rev.begin(), rev.end());
    return rev == h;
}

//__builtin_popcount ();
map<ll,ll> dp;
map<ll,ll> m;
int main() {
    FAST
 ll n;
    cin>>n;
    ll arr[n];
    ll ans=0;
for(int i=0;i<n;i++)
{
    cin>>arr[i];
    dp[arr[i]]++;

}
    for(auto i=dp.begin();i!=dp.end();i++)
    {
        ans+=(i->second*(i->second-1)/2);
        m[i->first]=(i->second*(i->second-1)/2);
    }
for(int i=0;i<n;i++)
{
    cout<<ans-m[arr[i]]+(((dp[arr[i]]-1)*(dp[arr[i]]-2))/2)<<endl;
}
    return 0;
}

Measured memory_bytes: 18944
#include <iostream>
#define MAX 10001

using namespace std;

int main()
{
	int A[MAX] = {};
	int size, num;
	cin >> size;
	for (int i = 0; i<size; i++) {
		cin >> num;
		A[num]++;
	}
	for (int i = 0; i<size; i++) {
		if (0<A[i]) {
			cout << i;
			A[i]--;
			break;
		}
	}
	for (int i = 0; i<MAX; i++) {
		if (0<A[i]) {
			cout << " " << i;
			A[i]--;
			i--;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1208
#include<iostream>
using namespace std;
int main(){
 int h, m, s, num;
 cin >> num;

 if( 0 <= num && num <= 86400 ){
   s = num%60;
   m = (num/60)%60;
   h = (num/60)/60;
  cout << h << ":" << m << ":" << s << endl;
 }

 return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll e = a * b;
  ll f = c * d;
  if (e > f) {
    cout << e << endl;
  } else {
    cout << f << endl;
  }
}

Measured memory_bytes: 256
#define rep(i,n) for (int i=0;i<(n);i++)
#define repr(i,n) for (int i=(n)-1;i>=0;i--)
#define rep2(i,s,n) for (int i=(s);i<(n);i++)
#define rep2r(i,s,n) for (int i=(n)-1;i>=(s);i--)

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define vs vector<string>
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vd vector<double>
#define vc vector<char>
#define cd complex<double>
#define vcd vector<cd>

#define all(a) (a).begin(),(a).end()
#define range(a,i) (a).begin(),(a).begin()+i
#define repv(itr,v) for(auto itr=(v).begin();itr!=(v).end();itr++)

#define sint(a) int a; scanf("%d",&a);
#define sint2(a,b) int a,b; scanf("%d %d",&a,&b);
#define sint3(a,b,c) int a,b,c; scanf("%d %d %d",&a,&b,&c);
#define sint4(a,b,c,d) int a,b,c,d; scanf("%d %d %d %d",&a,&b,&c,&d);
#define sint5(a,b,c,d,e) int a,b,c,d,e; scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
#define sll(a) ll a; scanf("%lld",&a);
#define sll2(a,b) ll a,b; scanf("%lld %lld",&a,&b);
#define sll3(a,b,c) ll a,b,c; scanf("%lld %lld %lld",&a,&b,&c);
#define sll4(a,b,c,d) ll a,b,c,d; scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
#define sll5(a,b,c,d,e) ll a,b,c,d,e; scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e);
#define svi(v,n) vector<int> v(n); rep(i,n) scanf("%d", &v[i]);
#define svll(v,n) vector<ll> v(n); rep(i,n) scanf("%lld", &v[i]);
#define sdouble(x) double x; scanf("%lf",&x);
#define svd(v,n) vector<double> v(n); rep(i,n) scanf("%lf", &v[i]);
#define schar(x) char x; scanf(" %c", &x);
#define sstring(x) string x; cin >> x;

#define printvi(v) printf("[ ");repv(ptr,v) printf("%d ",*ptr);printf("]\n");
#define printvll(v) printf("[ ");repv(ptr,v) printf("%lld ",*ptr);printf("]\n");

#define ceili(x,y) (x)%(y)?(x)/(y)+1:(x)/(y)

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#else
#pragma GCC diagnostic ignored "-Wunused-result"
#endif

#ifdef _MSC_VER
#define DEBUG
#endif

#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <complex>

using namespace std;



bool calc(vll h, ll A, ll B, ll n) {
	ll c = 0;
	repv(itr, h) {
		if (*(itr) <= B * n) continue;
		c += ceili(*(itr)-B * n, A - B);
		if (c > n) {
			return false;
		}
	}
	return true;
}

int main(int argc, char** argv) {
	sll3(N, A, B);
	svll(h, N);
#ifdef DEBUG
	printvll(h);
#endif

	ll l = 0;
	ll u = 1000000000;
	while (l != u) {
#ifdef DEBUG
		printf("%lld %lld\n", l, u);
#endif
		ll half = l + (u - l) / 2;
		if (calc(h, A, B, half)) {
			u = half;
		}
		else {
			l = half + 1;
		}
#ifdef DEBUG
		printf("%lld %lld\n\n", l, u);
#endif
	}
	printf("%lld\n", l);
}


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

int main() {
  int n;
  long long int k;
  cin >> n >> k;
  vector< pair<int, int> > arrays;
  int a, b;
  for (int i=0; i<n; i++) {
    cin >> a >> b;
    arrays.push_back(make_pair(a, b));
  }
  sort(arrays.begin(), arrays.end());
  int ans = arrays.end()->first;
  long long int sum = 0;
  for (int i=0; i<n; i++) {
    sum += arrays[i].second;
    if (sum >= k) {
      ans = arrays[i].first;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1400
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	
	for i := 0; i < len(s); i++ {
		for j := i; j < len(s)+1; j++ {
			remainSlice := s[0:i] + s[j:len(s)]
			if remainSlice == "keyence"{
              fmt.Println("YES")
              return
			}
		}
	}
	fmt.Println("NO")
}

Measured memory_bytes: 768
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int a,b,c;
	cin>>a>>b>>c;
	if(b-a==c-b)cout<<"YES";
	else cout<<"NO";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n, k, ans = 0;
	cin >> n >> k;
	for (int i = 0; i + k <= n; i++) {
		ans++;
	}
	cout << ans << "\n";
}


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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

double dp[4000][4000];
// i枚投げた時、表が出た回数がj

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<double> p(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> p[i];
    }
    dp[0][0] = 1;
    for (int i = 1; i < n + 1; i++)
    {
        for (int j = 0; j < i + 1; j++)
        {
            if (j > 0)
            {
                dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
            }
            else
            {
                dp[i][j] = dp[i - 1][j] * (1 - p[i]);
            }
        }
    }
    double ans = 0;
    for (int i = n / 2 + 1; i < n + 1; i++)
    {
        ans += dp[n][i];
    }
    cout << fixed;
    cout << setprecision(15) << ans << endl;
}

Measured memory_bytes: 92672
//https://atcoder.jp/contests/dp/tasks/dp_i
#include <bits/stdc++.h>
#include <sstream> 
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define pi 2*acos(0.0)
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repe(i,a,b) for(ll i=a;i<=b;++i)
#define CPrint(c)  for(auto i:(c)) { cout<<i<<" "; } nl 
#define eb   emplace_back
#define ef   emplace_front
#define pb   push_back
#define pf   push_front
#define popb pop_back
#define popf pop_front
#define mp   make_pair
#define sz(a) int((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
//Allows to traverse any type of macro
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
//debuggers
#define trace2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define trace3(x,y,z) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define trace4(w,x,y,z) cout<<#w<<"="<<w<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
typedef long long ll;
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair<ll,ll> pll;
const int lim = 1e5+5;
int main()
{
	int n;
	FAST_IO;
	//odd
	cin >> n;
	double p;
	/* to find more probability of having more heads than tails on tossing all coins*/
	double ans = 0;
	/*number of heads and tails are needed*/
	//if we had i tosses tails = i-heads
	vector<double>dp(n+1);//probability of i heads so far
	dp[0] = 1;//0 heads so far
	rep(coin,0,n)
	{
		cin >> p;//probability of heads
		for(int i=n+1;i>=0;i--) //to avoid repititions
		{
			if(i==0)
			{
				dp[i] = dp[i]*(1-p);
			}
			else 
				dp[i] = (dp[i-1]*p+dp[i]*(1-p));
		}//compute i using other values
		/*go from 0 to up use some value to calculate other values[New state results dependent of prev states*/

	}
	for(int heads= 0;heads<=n;++heads)
	{
		int tails = n-heads;
		if(heads>tails)
		{
			ans+=dp[heads];
		}
	}
	printf("%.10lf\n",ans);



}

Measured memory_bytes: 256
n, l = map(int, input().split(' '))
result = 0
res = 10 ** 10
count = 0
for i in range(1,n+1):
    count += l+i-1
    if res > abs(l + i -1):
        res = abs(l + i  -1)
        result = l + i -1

print(count -result)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

i64 C[3030][3030];

int N, M, L[3030], R[3030];
char S[3030];
vector<pair<int, int> > ops;

i64 dp[3030][3030];
int ones[3030];

int most[3030];

int main()
{
	C[0][0] = 1;
	for (int i = 1; i <= 3010; ++i) {
		C[i][0] = 1;
		for (int j = 1; j <= 3010; ++j) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
	}

	scanf("%d%d%s", &N, &M, S);
	int lar = -1;
	for (int i = 0; i < M; ++i) {
		scanf("%d%d", L + i, R + i);
		--L[i];
	}
	S[N++] = '0';
	L[M] = N - 1;
	L[M++] = N;

	ones[0] = 0;
	for (int i = 1; i <= N; ++i) ones[i] = ones[i - 1] + (S[i - 1] == '1' ? 1 : 0);

	for (int i = 0; i < N; ++i) most[i] = i + 1;
	for (int i = 0; i < M; ++i) most[L[i]] = max(most[L[i]], R[i]);
	for (int i = 1; i < N; ++i) most[i] = max(most[i], most[i - 1]);

	dp[0][0] = 1;
	for (int i = 0; i < N; ++i) {
		int rig = most[i];
		for (int j = 0; j <= i; ++j) {
		//	printf("%d %d: %lld\n", i, j, dp[i][j]);
			int one = ones[rig] - j;
			int zero = (rig - ones[rig]) - (i - j);
		//	printf("%d %d\n", one, zero);
			if (one < 0 || zero < 0 || dp[i][j] == 0) continue;
			if (one) ADD(dp[i + 1][j + 1], dp[i][j]);
			if (zero) ADD(dp[i + 1][j], dp[i][j]);
		}
	}
	printf("%lld\n", dp[N][ones[N]]);
	return 0;
}


Measured memory_bytes: 83968
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);

		long N = scanner.nextLong();
		long ans=0;

		for(long i=1; i<=N ;i++) {
			boolean three = (i%3==0);
			boolean five = (i%5==0);
			if(!three && !five) {
				ans+=i;
			}
		}
		System.out.println(ans);
	}


}


Measured memory_bytes: 35816
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long ll;
const int md=1e9+7;
int fac[8009],inv[8009],f[4005][4005],a[200005],b[200005],ans,n;
inline ll qpow(ll a,int b){
	ll res=1;
	while(b){if(b&1)res=res*a%md;a=a*a%md;b>>=1;}
	return res;
}
inline int C(int n,int m){return 1ll*fac[n]*inv[m]%md*inv[n-m]%md;}
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d%d",a+i,b+i),f[2001-a[i]][2001-b[i]]++;
    for(int i=1;i<4002;i++)
        for(int j=1;j<4002;j++)
            f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%md;   
    fac[0]=1;
    for(int i=1;i<=8002;i++)fac[i]=1ll*fac[i-1]*i%md;
    inv[8002]=qpow(fac[8002],md-2);
    for(int i=8001;i>=0;i--)
        inv[i]=1ll*inv[i+1]*(i+1)%md;
    for(int i=0;i<n;i++)ans=(ans+f[2001+a[i]][2001+b[i]])%md;
    for(int i=0;i<n;i++)ans=((ans-C((a[i]+b[i])<<1,b[i]<<1))%md+md)%md;
    ans=(500000004ll*ans)%md;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 64512
#include <cstdio>
#include <vector>
using namespace std;

int main() {
  int N, K;
  while(1) {
    scanf("%d%d", &N, &K);
    if(N == 0) break;

    vector<int> S(K);
    for(int i=0; i<K; i++) scanf("%d", &S[i]);

    vector<int> sum(K);
    for(int i=0; i<N; i++) {
      for(int j=0; j<K; j++) {
        int val; scanf("%d", &val);
        sum[j] += val;
      }
    }

    bool ok = true;
    for(int i=0; i<K; i++) {
      if(sum[i] > S[i]) ok = false;
    }
    printf("%s\n", ok ? "Yes" : "No");
  }
  return 0;
}



Measured memory_bytes: 2512
#include <cstdio>
#define N 2010
#define mod 1000000007
int n,k,f[N*N],inv[N*N],a[N][N];
inline int C(int x,int y){
	return 1ll*f[x]*inv[y]%mod*inv[x-y]%mod;
}
int main(){
//	freopen("a.in","r",stdin);
	scanf("%d%d",&n,&k);if(k==1){puts("1");return 0;}
	f[0]=f[1]=1;for(int i=2;i<=n*k;++i) f[i]=1ll*f[i-1]*i%mod;
	inv[0]=inv[1]=1;for(int i=2;i<=n*k;++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	for(int i=2;i<=n*k;++i) inv[i]=1ll*inv[i-1]*inv[i]%mod;
	a[0][0]=1;
	for(int i=1;i<=n;++i){
		for(int j=0;j<=i;++j){
			a[i][j]=a[i-1][j];
			if(j) a[i][j]=(a[i][j]+1ll*(n-j+1)*C(n-i+(n-j+1)*(k-1)-1,k-2)%mod*a[i][j-1]%mod)%mod;
		}
	}
	printf("%d\n",a[n][n]);
	return 0;
}

Measured memory_bytes: 46464
#include<iostream>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
const long long INF=4000000000000000000LL;
typedef pair<long long,int> P;
int N,a,b,c,d;

int main(){
	cin>>N;
	a=N/1000;
	N%=1000;
	b=N/100;
	N%=100;
	c=N/10;
	N%=10;
	d=N;
	char e[2]={'+','-'};
	int s=0;
	bool l=0;
	for(int i=0;i<2;++i){
		for(int j=0;j<2;++j){
			for(int k=0;k<2;++k){
				s=a;
				if(i==0)s+=b;
				else s-=b;
				if(j==0)s+=c;
				else s-=c;
				if(k==0)s+=d;
				else s-=d;
				if(s==7){
					cout<<a<<e[i]<<b<<e[j]<<c<<e[k]<<d<<"=7"<<endl;
					l=1;
					break;
				}
			}
			if(l)break;
		}
		if(l)break;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    ll a,b,c,x,y,m,ans;
    cin >> a >> b >> c >> x >> y;
    m = min(x, y);
    ans = m * min(2 * c, a + b) + (x - m) * min(2 * c, a) + (y - m) * min(2 * c, b);

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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

    vector<ll> L(N+1);
    L[0] = 2;
    L[1] = 1;
    for (int i=2; i<N+1; ++i) {
        L[i] = L[i-1] + L[i-2];
    }

    print(L[N]);
}




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

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

  if ( n / 10 % 111 == 0 ) {
    cout << "Yes" << endl;
  }
  else if (n % 1000 % 111 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <regex>
using namespace std;

vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            res.push_back(i);
            if (N / i != i) res.push_back(N / i);
        }
    }
    sort(res.begin(), res.end());

    return res;
}

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

    int ans = 0;
    for (int i=1; i<=N; i++) {
        if (i % 2 == 0) continue;

        if (enum_divisors(i).size() == 8) ans++;
    }

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

Measured memory_bytes: 3612
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

n = input_n
sum = 0
n.to_s.each_char do |s|
  sum += s.to_i
end
if sum % 9 == 0
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 15660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[1010];
int main()
{
    int n,m,i,cnt=0;double num=0;cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i],num+=a[i];
    num/=(4.0*m);
    for(i=1;i<=n;i++)
        if(a[i]>=num)cnt++;
    if(cnt>=m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int tate = sc.nextInt();
		int yoko = sc.nextInt();
		String[] ary = new String[tate];

		for(int i  = 0 ; i < ary.length ; i++) {
			ary[i] = sc.next();
		}
		for(int i = 0 ; i < tate + 2 ; i++) {
			if(i == 0 || i == tate + 1) {
				for(int j = 0 ; j < yoko + 2; j++) {
					System.out.print("#");
				}

			}else {
				System.out.print("#" + ary[i - 1] + "#");
			}
			System.out.println();
		}
	}
}


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

int n,a[100009];
int main(){
   cin >> n;
   a[0] = 0; a[n+1] = 0;
   for(int i=1;i<=n;i++) cin >> a[i];
   int cost = a[0];
   for(int i=1;i<=n+1;i++) cost += abs(a[i-1] - a[i]);

   for(int i=1;i<=n;i++){
     if(a[i-1]<=a[i]&&a[i]<=a[i+1]) cout << cost << endl;
     else if(a[i-1]>=a[i]&&a[i]>=a[i+1]) cout << cost << endl;
     else{
       if(a[i-1] <= a[i+1]){
         if(a[i+1] <= a[i]) cout << cost-( 2*abs(a[i+1]-a[i]) ) << endl;
         else if(a[i-1] >= a[i]) cout << cost-( 2*abs(a[i-1]-a[i]) ) << endl;
       }else{
         if(a[i+1] >= a[i]) cout << cost-( 2*abs(a[i+1]-a[i]) ) << endl;
         else if(a[i-1] <= a[i]) cout << cost-( 2*abs(a[i-1]-a[i]) ) << endl;
       }
     }
   }
   return 0;
 }


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
  int n; cin >>n;
  vector<int> a(n);
  cinf(n,a);
  ll sum=0;
  for(int i=0;i<n;i++){
  	sum+=a[i];
  }
  ll left=0;
  ll ans=1e18;
  for(int i=0;i<n-1;i++){
  	left+=a[i];
  	ans=min(ans,abs(sum-left-left));
  }
  cout << ans <<endl;
} 

Measured memory_bytes: 1024
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
#define PI 3.14159265358979

int main(void)
{

    int a,b,x;
    double c;
    
    cin>>a>>b>>x;

    int s = pow(a,2);
    double bound = atan(b/a);
    double ans;
    if(s*b/2<=x)
    {
        double last = s*b-x;
        c=atan(2*last/pow(a,3));
        
        ans = c*180/PI;
       
        
    }

    else//少ない場合
    {
        double inner =  x;
        c = atan((a*b*b)/2/inner);
        ans = c*180/PI;
    }
 cout<<setprecision(12)<<ans<<endl;

}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <limits>
#include <cmath>
#include <typeinfo>


using namespace std;

//  ||
// \


/*void sort(int arr[], int n) {
	int tmp = 0;
	for(int i = 0; i < n-1; i++) {
		tmp = i;
		for(int j = i+1; j < n; j++) {
			if(arr[j] < arr[tmp]) {
				tmp = j;
				swap(arr[tmp], arr[i]);
			}
		}
	}
}*/

int main() {
	int n = 0, max = 0;
	cin >> n;
	int v[n];
	int c[n];
	for(int i = 0; i < n; i++) {
		cin >> v[i];
	}
	for(int i = 0; i < n; i++) {
		cin >> c[i];
	}
	for(int i = 0; i < n; i++) {
		if(v[i] - c[i] >= 0) {
			max = max + v[i] - c[i];
		}
	}
	cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr array<int, 4> dx = {1, 0, -1, 0};
constexpr array<int, 4> dy = {0, 1, 0, -1};
constexpr int div_ru(int a, int b)
{
    return (a + b - 1) / b;
}

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

    string s;
    int k;
    cin >> s >> k;

    string head = s;
    int k_head = 0;
    for (int i = 1; i < s.size(); i++)
    {
        if (head[i] == head[i - 1])
        {
            head[i] += 'A' - 'a';
            k_head++;
        }
    }

    string even = s;
    int k_even = 0;
    if (even[0] == head.back())
    {
        even[0] += 'A' - 'a';
        k_even++;
    }
    for (int i = 1; i < s.size(); i++)
    {
        if (even[i] == even[i - 1])
        {
            even[i] += 'A' - 'a';
            k_even++;
        }
    }

    string odd = s;
    int k_odd = 0;
    if (odd[0] == even.back())
    {
        odd[0] += 'A' - 'a';
        k_odd++;
    }
    for (int i = 1; i < s.size(); i++)
    {
        if (odd[i] == odd[i - 1])
        {
            odd[i] += 'A' - 'a';
            k_odd++;
        }
    }

    const int ans = k_head + k / 2 * k_even + (div_ru(k, 2) - 1) * k_odd;
    cout << ans << endl;
}


Measured memory_bytes: 256
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
*/
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define hcf __gcd

bool is_prime(ll n){
    if(n==2) return true;
    if(n%2==0) return false;
    for(ll i=3;i*i<=n;i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}

int main(void){
     ios::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen ("C:\\Users\\Animesh\\Desktop\\i.txt", "r", stdin);
    //freopen ("C:\\Users\\Animesh\\Desktop\\o.txt", "w", stdout);
#endif
    int a[3]; cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==5 && a[1]==5 && a[2]==7)
        cout<<"YES";
    else cout<<"NO";

return 0;
/* check for bounds before submitting */
}


Measured memory_bytes: 3656
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=n-1;i>0;i--){
        printf("%d ",a[i]);
    }
    cout << a[0] <<endl;
    return 0;
}

Measured memory_bytes: 1192
#include <stdio.h>

int main(){
  int n;
  long int d;
  scanf("%d %ld", &n, &d);
  
  long int x, y;
  int count = 0;
  for (int i=0; i<n; i++){
    scanf("%ld %ld", &x, &y);
    if (x*x+y*y <= d*d){
      count++;
    }
  }
  
  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 1728
#ifndef TKLIB_SEGTREE_HPP
#define TKLIB_SEGTREE_HPP

#include <vector>
#include <functional>

namespace tklib {

template <typename T, typename Op = std::plus<T>>
class Segtree {
private:
    std::size_t N;
    std::vector<T> data;
    T idelem;
    const Op &op;

public:
    Segtree(std::size_t n, T idelem, const Op &op = Op())
    : N(1), idelem(idelem), op(op) {
        while(N < n) N <<= 1;
        data.assign(2 * N, idelem);
    }

    template <typename InputIt>
    Segtree(InputIt first, InputIt last, T idelem, const Op &op = Op())
    : N(1), idelem(idelem), op(op) {
        std::vector<T> buffer(first, last);
        while(N < buffer.size()) N <<= 1;
        data.assign(2 * N, idelem);
        std::swap_ranges(buffer.begin(), buffer.end(), data.begin() + N);
        for(int i = N - 1; i > 0; --i) data[i] = op(data[2 * i], data[2 * i + 1]);
    }

    void update(std::size_t pos, T val) {
        for(data[pos += N] = val; pos >>= 1; ) {
            data[pos] = op(data[pos << 1], data[(pos << 1) + 1]);
        }
    }

    T query(std::size_t left, std::size_t right) {
        T vl = idelem, vr = idelem;
        for(left += N, right += N; left < right; left >>= 1, right >>= 1) {
            if(left & 1) vl = op(vl, data[left++]);
            if(right & 1) vr = op(data[--right], vr);
        }
        return op(vl, vr);
    }

    T operator[](std::size_t k) {
        return data[k + N];
    }
};

} // nasmespace tklib

#endif // TKLIB_SEGTREE_HPP

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N; cin >> N;
    vector<pair<int, int>> X(N);
    for(int i=0; i<N; ++i) cin >> X[i].first >> X[i].second;
    sort(begin(X), end(X));

    int const mod = 998244353;
    vector<int> dp(N + 1, 1);

    auto op = [](int a, int b){return max(a, b);};
    tklib::Segtree<int, decltype(op)> st(N - 1, 0, op);
    
    for(int i=N-1; i>=0; --i) {
        int k = lower_bound(begin(X), end(X), pair<int, int>(X[i].first + X[i].second, 0)) - begin(X);
        st.update(i, max(k, st.query(i + 1, k)));
        dp[i] = (dp[i + 1] + dp[st[i]]) % mod;
    }

    cout << dp[0] << '\n';
}

Measured memory_bytes: 4608
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007ll //998244353ll
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)    
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int k;
    cin>>k;
    string s="";
    while(k--)
    {
        s+='A';
        s+='C';
        s+='L';
    }
    cout<<s;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
//using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_c() {
	ll a, b, c, d, e, f;
	ll sum, sugar;

	cin >> a >> b >> c >> d >> e >> f;

	ll w1 = 100 * a;
	ll w2 = 100 * b;
	ll s1 = c;
	ll s2 = d;
	ll water;
	float nodo = -1;
	ll ans1, ans2;

	for (ll i = 0; i <= 3000; i += w1) {
		for (ll j = 0; j + i <= 3000; j += w2) {
			water = i + j;
			for (ll k = 0; k <= (i + j)/100 * e; k += s1) {
				if (water + k > f) break;

				for (ll l = 0; l + k <= (i + j) / 100 * e; l += s2) {
					sugar = k + l;

					sum = water + sugar;
					if (sum <= f && sugar <= (i + j) / 100 * e) {
						if ((float)100 * sugar / sum > nodo) {
							nodo = (float)100 * sugar / sum;
							ans1 = sum;
							ans2 = sugar;
						}
					}
				}
			}
		}
	}
	cout << ans1 << " " << ans2 << "\n";
}

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

	solve_abc_c();

	return 0;
}

Measured memory_bytes: 256
import sys
n,m = map(int,input().split())
a = list(map(int,input().split()))
count = 0
a = sorted(a,reverse=True)
sums = sum(a)
for i in range(m):
    if a[i] < sums*(1/(4*m)):
        print("No")
        sys.exit()
    count += 1
print("Yes")

Measured memory_bytes: 38384
#include <iostream>
#include <vector>

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define vs vector<string>
#define pb push_back
using namespace std;

int main(void){
  string s;
  cin>>s;
  cout<<(s.find("AC") == -1 ?"No":"Yes")<<endl;
}

Measured memory_bytes: 256
def examA():
    X = I()
    X -= 400
    ans = 8 - X//200
    print(ans)
    return

def examB():
    A, B, C = LI()
    K = I()
    cnt = 0
    while(A>=B):
        B *= 2
        cnt += 1
    while(B>=C):
        C *= 2
        cnt += 1

    if cnt<=K:
        print("Yes")
    else:
        print("No")
    return

def examC():
    N, K = LI()
    A = LI()
    ans = ["Yes"]*(N-K)
    for i in range(N-K):
        if A[i+K]<=A[i]:
            ans[i] = "No"
    for v in ans:
        print(v)
    return

def examD():
    N = I()
    A = LI()
    l = A[0]
    cnt = 1000
    for a in A[1:]:
        if l<a:
            cnt += cnt//l * (a-l)
            l = a
        elif l>a:
            l = a
    ans = cnt
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 10580
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> ans;
    int last = -1;
    int pos = 0;
    for (int i = 0; i <= k; i++) {
        int mi = 1e9;
        for (int j = 0; j < n; j++) {
            if (j != last && a[j] < mi) {
                mi = a[j];
                pos = j;
            }
        }

        for (int j = 0; j < n; j++) {
            if (j != last && j != pos) {
                ans.push_back(j);
                a[j]--;
            }
        }

        last = pos;
        ans.push_back(last);
        a[last]--;
        if (a[last] < 0) {
            cout << -1;
            return 0;
        }
    }

    cout << ans.size() << endl;
    for (int i : ans) cout << i + 1 << ' ';
}

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

int n;
vector<vector<pair<int, bool>>> data;
int mask = 0;
int ans = 0;

void solve(int idx) {
    if(idx == n) {
        bool f = true;
        for(int i = 0; i < n; i++) {
            if(!(mask & (1 << i))) continue;
            for(auto &p : data[i]) {
                int u = p.first;
                bool kind = p.second;
                f &= ((bool)(mask & (1 << u)) == kind);
            }
        }

        ans = max(ans, __builtin_popcount(mask) * f);
        return;
    }

    solve(idx + 1);
    mask ^= (1 << idx);
    solve(idx + 1);
}

int main() {
    cin >> n;
    data.resize(n, vector<pair<int, bool>>());
    for(int i = 0; i < n; i++) {
        int k; cin >> k;
        while(k--) {
            int u;
            bool kind;
            cin >> u >> kind;
            data[i].push_back({--u, kind});
        }
    }

    solve(0);
    cout << ans;
}

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

ll solve() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    sort(A.begin(), A.end(),greater<>());

    // Ax+Ayがaa以上となる組み合わせcm
    auto get_m = [&](ll aa) {
        ll cm = 0;
        for ( ll i = 0; i < N; i++ ) {
            if ( A[i] + A[0] < aa ) break; 
            ll p = upper_bound(A.begin(), A.end(), aa - A[i], greater<>()) - A.begin();
            //cm += max(p-i+1, 0LL);
            cm += p;
        }
        return cm;
    };
    // Ax+Ayがaa以上となる組み合わせcmがM未満 r:ok
    auto chk_m = [&](ll aa) {
        ll cm = get_m(aa);
        return cm < M;
    };

    ll l = 0, r = 2*A[0]+1;
    while ( r - l > 1 ) {
        ll m = ( r + l ) / 2;
        if ( chk_m(m) ) r = m;
        else l = m;
    }
    // r:A+A最低値+1
    ll cu = get_m(r);

    vector<ll> ca(N+1);
    for ( int i = 0; i < N; i++ ) {
        ca[i+1] = ca[i] + A[i];
    }
    ll sum_a = 0;
    for ( ll i = 0; i < N; i++ ) {
        if ( A[i] + A[0] < r ) break;
        ll p = upper_bound(A.begin(), A.end(), r - A[i], greater<>()) - A.begin();
        // sum_a += ca[p+1] - ca[i];
        // sum_a += A[i] * (p-i+1);
        sum_a += ca[p];
        sum_a += A[i] * (p);
    }

    sum_a += l * (M - cu);
    return sum_a;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
	int a, b;
	scanf("%d%d", &a, &b);
	if(a < b){
		printf("a < b\n");
	}else if(a > b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 2600
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}	
char mem[114514];
char t[114514];
int a[114514];
int ans[114514];
signed main(){
	ic(n) ic(m)
	if(n*500>=m)c("Yes")
	else c("No")
}	

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define MP make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6+7;
const double eps = 1e-6;
const double pi = acos(-1);
const int mod = 998244353;
using namespace std;
//拓展欧几里得算法求解丢番图方程 ax+by=c
ll exgcd(ll a,ll b,ll &x,ll &y)
{
    if(b==0)
    {
        x=1;
        y=0;
        return a;
    }
    else
    {
        ll d=exgcd(b,a%b,y,x);
        y-=a/b*x;
        /*ll d=exgcd(b,a%b,x,y);
        ll t=y;
        y=x-a/b*y;
        x=t;*/
        return d;
    }
}
ll inv(ll a,ll p)//拓展欧几里得求逆元
{
    ll x,k;
    ll d=exgcd(a,p,x,k);
    if(d!=1) return -1;
    else return (x%p+p)%p;
}
ll fac[1000002];
void factorial()//求maxn以内的数的阶乘%p
{
    fac[0] = fac[1] = 1;
    for(ll i = 2; i < maxn; i++)
        fac[i] = fac[i - 1] * i % mod;
}
ll C(ll a, ll b)//计算C(a, b)
{
    return fac[a] * inv(fac[b], mod) % mod* inv(fac[a - b], mod) % mod;
}
int main(){
    factorial();
    ll n,a,b,k;
    cin>>n>>a>>b>>k;
    ll ans=0;
    for(ll x=0;x<=n;x++){
        if(a*x>k) break;
        if((k-a*x)%b!=0) continue;
        ll y=(k-a*x)/b;
        if(y>n) continue;
        ans+=C(n,x)*C(n,y)%mod;
        ans%=mod;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 8064
S = input()
n = len(S)
ans = 0

for start in range(n):
    for end in range(start + 1, n + 1):
        T = S[start:end]
        flag = True
        for i in range(len(T)):
            if T[i] not in "ACGT":
                flag = False
                break
        if flag: ans = max(ans, end - start)

print(ans)

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

long int factorial(long a){
    long sum=1;
    while(a>0){
        sum*=a;
        --a;
    }
    return sum;
}

long int fanc(long n,long m)
{
    long bunsi = factorial(n),
         bunbo = factorial(m)*factorial(n-m);
    return bunsi/bunbo;
}

int main()
{
    long n;
    cin >> n;
    long x[n],y[n];
    F(n) cin >> x[i] >> y[i];
    double sum=0;
    long s=factorial(n);
    F(n){
        for(int j=i+1;j<n;++j){
            for(int k=0;k<factorial(n)*(n-1)/fanc(n,2);++k){
                sum += sqrt(pow(x[i]-x[j],2.0)+pow(y[i]-y[j],2.0));
            }
        }
    }
    double ans=sum/s;
    printf("%.10f\n",ans);
    return 0;
}

Measured memory_bytes: 256
import math

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
distance = [0,0,0,0]

for i in range(n):
  distance[0] += math.fabs(x[i] - y[i])
  distance[1] += (x[i] - y[i])**2
  distance[2] += math.fabs((x[i] - y[i])**3)
  distance[3] = max(distance[3],math.fabs(x[i] - y[i]))

distance[1] = math.sqrt(distance[1])
distance[2] = distance[2]**(1/3)

for i in range(4):
  print(distance[i])



Measured memory_bytes: 5692