akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
#define ll long long
const ll N = 1e5+10 ;
int w[N],v[N];
int dp[N];
int main(){
   int n,k;
   cin >> n >> k;
   int m = -1;
   memset(dp,0x3f,sizeof dp);
   dp[0] = 0;
   for(int i = 1;i <= k;++i) {cin>>w[i]>>v[i];}
   for(int i = 1;i <= k;++i){
      for(int j = w[i];j <= 1e4;++j){
         if(dp[j-w[i]] != 0x3f3f3f3f) dp[j] = min(dp[j],dp[j-w[i]] + v[i]);
      }
   }
   m = 0x3f3f3f3f;
   for(int i = n;i <= 1e4;++ i){
      m = min(m,dp[i]);
   }
   cout<<m<<endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Graph Template
//-------------------------------------------------
template<class E>
struct Graph
{
    vector<vector<E> > adj;
    Graph(int N):adj(N){}
    virtual void add_edge(int v, E e){adj[v].push_back(e);}
    vector<E>& operator[](int v){return adj[v];}
    inline int size(){return adj.size();}
};

struct NormalEdge {
    int to;
    NormalEdge(int to):to(to){}
};

struct UWGraph : public Graph<NormalEdge>
{
    UWGraph(int N):Graph(N){}
    void add_edge(int v, int e){adj[v].push_back({e});}
};

//-------------------------------------------------
//--Prim
//-------------------------------------------------
template<class T=int, class E>
T prim(Graph<E> &G, int s=0)
{
    T ret=0;
    using P=pair<T,int>;
    int V = G.size();
    vector<bool> use(V);
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
        T cost; int v;
        tie(cost,v) = que.top(); que.pop();
        if (use[v]) continue;
        ret+=cost; use[v]=true;
        for(auto e:G[v])if(!use[e.to]){
            que.push(P(e.cost,e.to));
        }
    }
    return ret;
}

struct Edge{int to; ll cost;};

const ll INF=1e15;

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin>>N>>M;
    Graph<Edge> G(N);
    rep(i,M){
        int a,b; ll c; cin>>a>>b>>c;
        G.add_edge(a,{b,c});
        G.add_edge(b,{a,c});
    }
    cout<<prim<ll>(G)<<"\n";
    return 0;
}



Measured memory_bytes: 10404
// JAI SHREE RAM
#pragma GCC optimize("O3")
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define sec second
#define fir first
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(ll (i)=(m);(i)<(n);(i)++)
// #define all(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
#define MOD 998244353

void solve()
{
int x,y,z;
cin>>x>>y>>z;
cout<<z<<" "<<x<<" "<<y<<endl;

}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast
	int T;
	// cin >> T;
	T = 1;
	while (T--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>

int main()
{
    int floor[4][3][10]={0};
    int i, j, k, n, b, f, r, v;
    scanf("%d", &n);
    for(i=0; i<n; i++) {
        scanf("%d%d%d%d", &b, &f, &r, &v);
        floor[b-1][f-1][r-1]+=v;
    }

    for(i=0; i<4; i++) {
        if(i) puts("####################");
        for(j=0; j<3; j++) {
            for(k=0; k<10; k++) {
                printf(" %d", floor[i][j][k]);
            }
            putchar('\n');
        }
    }

    return 0;
}

Measured memory_bytes: 612
room=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n=int(input())

for i in range(n):
    data=list(map(int,input().split()))
    room[data[0]-1][data[1]-1][data[2]-1]+=data[3]

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {0}".format(room[i][j][k]),end='')
        print()
    if i<3:print("####################")
                 



Measured memory_bytes: 5624
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	string ss, tt;
	int64 aa, bb, cc, nn;
	cin >> ss;
	if(ss[0] == 'R' && ss[0] == ss[1] && ss[1] == ss[2])
	{
		cout << 3 << endl;
	}
	else if(ss[0] == 'R' && ss[0] == ss[1])
	{
		cout << 2 << endl;
	}
	else if(ss[1] == 'R' && ss[2] == ss[1])
	{
		cout << 2 << endl;
	}
	else if(ss[0] == 'R' || ss[1] == 'R' || ss[2] == 'R')
	{
		cout << 1 << endl;
	}
	else
	{
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
int main(void){
  int A,N;
  int s;
  
  scanf("%d",&N);
  scanf("%d",&A);
  
  s=N%500;
  
  if(s>A){
    printf("No\n");
  }
  else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 1640
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	int ans = n, p = a[0];
	for(int i = 1; i < n; i++){
		if(p == a[i]) ans--;
		else p = a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int b = 0;
		if (s.charAt(2) == s.charAt(3)) {
			b++;
		}
		if (s.charAt(4) == s.charAt(5)) {
			b++;
		}
		if (b == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <string.h>
#include <math.h>
#include <stdlib.h>
using namespace std;

int main(void) {
	// your code goes here
	int n,min=100000;
	cin >> n;
	for(int i=0;i<=n;i++){
		int count=0;
		int t=i;
		while(t>0) {
			count+=t%6;
			t=(t-t%6)/6;
		}
		t=n-i;
		while(t>0) {
			count+=t%9;
			t=(t-t%9)/9;
		}
		min=std::min(min,count);
	}
	cout << min << endl;
	return 0;
}


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

int a,b,t,ans;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>a>>b>>t;
    for(int i=1;i<=t;i++){
        if(i%a==0){ans+=b;}
    }
    cout<<ans<<endl;

    return 0;
}

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

#define IOS cin.tie(0);ios::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    CIN(N);
    ll sum=0;
    RepS(i,1,N){
        if(i%3==0&&i%5==0) continue;
        else if(i%3==0) continue;
        else if(i%5==0) continue;
        else sum+=i;
    }
    printf("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 3752
#include <iostream>
#define N 2010
#define INF 1e18
using namespace std;
long long n, m, a[N], b[N], c[N], d[N/2];
int main() {
	int i, j;
	cin>>n>>m;
	for(i=0; i<m; i++) cin>>a[i]>>b[i]>>c[i];
	for(i=1; i<=n; i++) d[i] = -INF;
	d[1] = 0;
	for(i=0; i<n; i++) for(j=0; j<m; j++) {
		if(d[a[j]] != -INF && d[b[j]] < d[a[j]] + c[j]) {
			d[b[j]] = d[a[j]] + c[j];
			if(i==n-1 && b[j]==n) d[0] = 1;
		}
	}
	d[0] ? cout<<"inf" : cout<<d[n];
	return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    reverse(t.begin(), t.end());

    if (s == t)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
const main = B => {
    const max = Math.max(...B)
    var ans = 0
    const A = []
    for(var i =0;i<B.length-1;i++ ) {
        A.push(Math.min(B[i],B[i+1]))
    }
    return A.reduce((acm,current) => {return acm + current},0)+B[0]+B[B.length-1]
}

const input = require('fs').readFileSync('/dev/stdin','utf8').split("\n")
const N = Number(input[0])
const B = input[1].split(" ").map(x => Number(x))
console.log(main(B))

Measured memory_bytes: 7372
#include <stdio.h>
#include <math.h>

int main() {
    double q;
    while (1) {
        scanf("%lf", &q);
        if (q == -1) break;
        double d, x = q / 2.0;
        while(1) {
            d = x * x * x - q;
            if (fabs(d) < (0.00001 * q)) break;
            x -= d / 3 / x / x;
        }
        printf("%lf\n", x);
    }
}



Measured memory_bytes: 2036
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
#define PB push_back

int sepa[100][4];

main(){
  int n;
  while(cin>>n,n){
    rep(i,n){
      rep(j,4)cin>>sepa[i][j];
    }
    
    int ans=1;
    rep(i,n){
      int d=0;
      vector<double> V[2];
      rep(j,i){
        int dyi=sepa[i][1]-sepa[i][3],dyj=sepa[j][1]-sepa[j][3];
        int dxi=sepa[i][0]-sepa[i][2],dxj=sepa[j][0]-sepa[j][2];
        if(dyi*dxj==dyj*dxi)continue;
        
        double x=(double)((sepa[j][1]-sepa[i][1])*dxi*dxj-(dyj*dxi*sepa[j][0]-dyi*dxj*sepa[i][0]))/(dyi*dxj-dxi*dyj);
        double y=(double)(dxj*dyi*sepa[j][1]-dyi*dyj*sepa[j][0]+sepa[i][0]*dyi*dyj-sepa[i][1]*dxi*dyj)/(dyi*dxj-dyj*dxi);
        

        if(abs(x)>100-EPS || abs(y)>100-EPS)continue;
        bool is=false;
        
        rep(k,V[0].size()){
          if(abs(y-V[1][k])<EPS && abs(x-V[0][k])<EPS){
            is=true;
            break;
          }
        }
        if(is==false){
          ++d;
          V[0].PB(x);
          V[1].PB(y);
        }
      }
      ans+=d+1;
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 916
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <vector>

using namespace std;
typedef long long LL;
#define pb push_back
const int maxn = 100005;
const int S = 350;

int sum[maxn],_sum[maxn];
vector<int> ins[maxn];
int ans[maxn],n,m;

void add(int l,int r)
{
	int sl=l/S,sr=r/S;
	for (int j=sl+1;j<sr;j++) _sum[j]++;
	if (sl!=sr) {
		for (int j=l;j<sl*S+S;j++) sum[j]++;
		for (int j=sr*S;j<=r;j++) sum[j]++;
	}
	else for (int j=l;j<=r;j++) sum[j]++;
}
int main()
{
	#ifdef Amberframe
		freopen("arc068e.in","r",stdin);
		freopen("arc068e.out","w",stdout);
	#endif
	scanf("%d %d",&m,&n);
	for (int l,r,i=1;i<=m;i++)
		scanf("%d %d",&l,&r),ins[r-l+1].pb(l),ans[r-l+1]++;
	for (int i=n;i>=1;i--) ans[i]+=ans[i+1];
	for (int i=1;i<=n;i++)
	{
		for (int j=i;j<=n;j+=i)
			ans[i]+=sum[j]+_sum[j/S];
		for (unsigned j=0;j<ins[i].size();j++)
			add(ins[i][j],ins[i][j]+i-1);
	}
	for (int i=1;i<=n;i++) printf("%d\n",ans[i]);
	return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    int x, a, b;
    cin >> x >> a >> b;

    if (b <= a) {
        puts("delicious");
    } else if (b <= a+x) {
        puts("safe");
    } else {
        puts("dangerous");
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

void pp(int x){
    if (x == 0) cout << 'A';
    else cout << 'B';
}
int main(){
    IOS();
    ll n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    if (k > 2*n) k = 2*n + (k%2);
    list<int> lst;
    REP (i,n) {
        if (s[i] == 'A') lst.push_back(0);
        else lst.push_back(1);
    }
    int flip = 0;
    debug(k);
    while (k--) {
        int cur = lst.front();
        lst.pop_front();
        if (flip) cur ^= 1;
        if (cur == 0) {
            if (flip) cur = 0;
            else cur = 1;
            lst.push_front(cur);
            continue;
        }
        if (flip) lst.push_back(0);
        else lst.push_back(1);
        flip ^= 1;
    }
    while (SZ(lst)) {
        int cur = lst.front();
        lst.pop_front();
        if (flip) pp(cur^1);
        else pp(cur);
    }
    cout << endl;
}


Measured memory_bytes: 9888
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);
struct Edge { int nxt, to; }edge[100000];
LL n, m, sum = 0, f[100000] = {}, W[1000][1000] = {}, now = 0;
char p[1000][1000];
int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++) {
			cin >> p[i][j];
		}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (p[i][j] == '.')
				for (int h = -1; h < 2; h++)
					for (int w = -1; w < 2; w++) {
						if ((w != 0 || h != 0) && h + i < n&&h + i >= 0 && w + j < m&&w + j >= 0)
							if (p[i + h][j + w] == '#')
								W[i][j] += 1;
					}
			if(p[i][j ] == '#')
			std::cout <<"#";
			else std::cout << W[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 2560
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


def solve(data):
    ans = 1
    if 0 in data:
        return 0
    for d in data:
        ans *= d
        if ans > 10 ** 18:
            return -1
    return ans


if __name__ == '__main__':
    n = int(input())
    data = list(map(int, input().split()))
    ans = solve(data)
    #print('ans') # debug
    print(ans)

    #print('\33[32m' + 'end' + '\033[0m') # debug


Measured memory_bytes: 86884
n= int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = 0
cnt = 0

while cnt < n:
    tmp = 0
    for i in range(n-cnt):
        tmp += a1[i]
    for j in range(cnt+1):
        tmp += a2[-1*(j+1)]
    ans = max(ans, tmp)
    cnt += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
     double a, b, c, d, e, f, x, y;
     while(cin >> a >> b >> c >> d >> e >> f){
     	if (a == 0)	y = c / b;
     	else{
	     	b /= a;
    	 	c /= a;
    	}
    	if(d == 0)	y = f / e;
     	else{
     		e /= d;
     		f /= d;
     	}
     	if(!(a == 0 || d == 0))	y = (c - f) / (b - e);
     	x = c - b * y;
     	printf("%.3f %.3f\n", x, y);
     }

	return 0;
}

Measured memory_bytes: 1236
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
int main() {
	int n;
	cin >> n;
	int a, b;
	cin >> a >> b;
	int p[100];
	int cnt1 = 0, cnt2 = 0, cnt3 = 0;
	rep(i, n) {
		cin >> p[i];
	}
	rep(i, n) {
		if (p[i] <= a) {
			cnt1++;
		}
		else if (a + 1 <= p[i] && p[i] <= b) {
			cnt2++;
		}
		else if (b + 1 <= p[i]) {
			cnt3++;
		}
	}
	int ans = min(min(cnt1, cnt2), cnt3);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
/* 本当は個別にヘッダファイルを読みだすべき
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/

using namespace std;

#define rep(i,a,n) for(int i=a,i<n,i++)
#define vvi vector<vector<int>>
#define vi vector<int>
#define pi pair<int,int>

#define ti tuple<int,int,int>
#define gi get<i> //get<i>(data)

int ctoi(char c){
    if(c >= '0' && c <= '9'){
        return c-'0';
    }
    return 0;
}

long long answer = 0;

int dfs(string s, int i, long long presum, long long sum){
    if(i == s.size() -1){//最後の文字まで到達
        sum += presum + ctoi(s.at(i));
        answer += sum;//答えに足して終了させる
        return 0;
    }else{
        presum += ctoi(s.at(i));
        dfs(s,i+1,presum*10,sum);
        sum += presum;
        dfs(s,i+1,0,sum);
        return 0;
    }
}

int main(){
    string S;
    cin >> S;
    
    dfs(S,0,0,0);
    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>

int main()
{
    char c;
    std::cin >> c;
    if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ){
        std::cout << "vowel";
    }
    else{
        std::cout << "consonant";
    }
    return 0;
}


Measured memory_bytes: 256
//  Mayank Agarwal
//  IIIT Hyderabad



#include<bits/stdc++.h>
using namespace std;
const long long int M = 1000000007; 
#define ll long long int
#define ld double
#define pb push_back
#define mp make_pair
ll power(ll x, ll y,  ll p) 
{ 
    ll res = 1;      
    x = x % p;   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;x = (x*x) % p; 
    } return res%p; 
} 
ll modinver(ll a,ll b)
{
    return (power(a,1,M)*power(b,M-2,M))%M;
}
void SieveOfEratosthenes(int n) 
{   
    bool prime[10005]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    double n;
    cin>>n;
    std::vector<pair<double,double> > v;
    for (int i = 0; i < n; ++i)
    {
        double a,b;
        cin>>a>>b;
        v.pb(mp(a,b));
    }
    double ans;
    for (int i = 0; i < n; ++i)
    {
        for (int j= i+1; j < n; ++j)
        {
            ans+=sqrt((v[i].first-v[j].first)*(v[i].first-v[j].first)+(v[i].second-v[j].second)*(v[i].second-v[j].second));
        }
    }
    // cout<<ans<<'\n';
    printf("%.10lf\n",ans*2.0/n);
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

ll N, Z, W;
ll dp[2001][2001];
vector<ll> a;
ll rec(ll i,ll j, ll k,ll alpha, ll beta) {
	ll& res = dp[i][j];
	if (res != -LINF)return res;
	if (i == N || j == N) {
		ll X = (i == 0) ? Z : a[i];
		ll Y = (j == 0) ? W : a[j];
		res = abs(X - Y);
		return res;
	}
	if (k == 1) {
		res = LINF;
		for (int y = i + 1; y <= N;y++) {
			res = min(res, rec(i, y, 0, alpha, res));
			if (alpha >= res) {
				return alpha;
			}
		}
	}
	else {
		for (int x = j + 1; x <= N;x++) {
			res = max(res, rec(x, j, 1, res, beta));
			if (res >= beta) {
				return beta;
			}
		}
	}
	return res;
}

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	cin >> N >> Z >> W;
	a.resize(N + 1);
	for (int i = 1; i <= N;i++) cin >> a[i];
	for (int i = 0; i <= N;i++) {
		for (int j = 0; j <= N;j++) {
			dp[i][j] = -LINF;
		}
	}

	cout << rec(0, 0, 0, -LINF, LINF) << endl;
	return 0;
}

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

int main(void){
   string S,T;
   cin >>S>>T;
   int lenS=S.size();
   int lenT=T.size();
   
   int ans=0;
   rep(i,lenS-lenT+1){
       int cnt=0;
       rep(j,lenT){
          if(S[i+j]==T[j]){
              cnt++;
          }
       }
       ans=max(ans,cnt);
   }
    ans=lenT-ans;
    
   cout<<ans<<endl;
}


Measured memory_bytes: 3580
mod=998244353
N=int(input())
A=[int(i) for i in input().split()]
M=10**6
B=[0 for i in range(M+1)]
for i in range(N):
    B[A[i]]+=1
C=[0 for i in range(M+1)]
for d in range(1,M+1):
    for dk in range(d,M+1,d):
        C[d]+=B[dk]*dk
isPrime=[1 for i in range(M+1)]
isPrime[0]=0;isPrime[1]=0
for i in range(M+1):
    if isPrime[i]==0:
        continue
    for j in range(2*i,M+1,i):
        isPrime[j]=0
Mebius=[1 for i in range(M+1)]
Mebius[0]=0
for i in range(2,M+1):
    if isPrime[i]==0:
        continue
    for j in range(i,M+1,i):
        Mebius[j]*=-1
for i in range(2,M+1):
    for j in range(i*i,M+1,i*i):
        Mebius[j]=0

f=[0 for i in range(M+1)]
for d in range(1,M+1):
    for n in range(d,M+1,d):
        f[n]+=d*Mebius[d]
for n in range(1,M+1):
    f[n]=f[n]*pow(n,mod-2,mod)
ans=0
for d in range(1,M+1):
    ans+=f[d]*C[d]*C[d]
    ans%=mod
tmp=0
for i in range(N):
    tmp+=A[i]
submit=(ans-tmp)*pow(2,mod-2,mod)
print(submit%mod)


Measured memory_bytes: 217032
k,a,b = map(int, input().split())

if b-a<=2:
    print(1+k)
else:
    if k+1>a:
        if (k+1-a)%2 == 0:
            print(((k+1-a)//2)*(b-a)+a)
        else:
            print(((k+1-a)//2)*(b-a)+1+a)
    else:
        print(1+k)


Measured memory_bytes: 38256
#include<stdio.h>
#define MAX 100000
#define NIL -1
typedef struct{
  int p;
  int l;
  int r;
}Node;

Node T[MAX];
int n,D[MAX],H[MAX];//深さを代入,高さを代入

void print(int node_num){
    int i,c,degree;
    printf("node %d: ",node_num);//引数の番号
    printf("parent = %d, ",T[node_num].p);//引数ノードの親
    printf("sibling = %d, ",getSibling(node_num));//兄弟
    if(T[node_num].l!=NIL)degree++;
    if(T[node_num].r!=NIL)degree++;
    printf("degree = %d, ",degree);
    printf("depth = %d, ",D[node_num]);
    printf("height = %d, ",H[node_num]);
    if(T[node_num].p==(-1)) printf("root\n");
    else if(T[node_num].l==NIL && T[node_num].r==NIL) printf("leaf\n");//lに子の一番左のノードを入れる
    else printf("internal node\n");
}
int Depth(int node_num,int p){
  if(node_num==NIL)return 0;
  D[node_num]=p;//初期pは0node uの深さを逐一入れる
  //初期化時全てのノードのp,r,lはNILになってる
  Depth(T[node_num].r,p+1);//今回は右も子供
  Depth(T[node_num].l,p+1);//子のノードがあればpをカウントしてnode_numを子に変更
}
int setHeight(int node_num){
int h1=0,h2=0;
if(T[node_num].l!=NIL) h1=setHeight(T[node_num].l)+1;//高さをカウントし一つ深い層から再帰する;
if(T[node_num].r!=NIL) h2=setHeight(T[node_num].r)+1;
if(h1>h2){
  H[node_num]=h1;
   return h1;
 }//どちらが最深部か比較
else{
  H[node_num]=h2;
   return h2;
}
}

int getSibling(int node_num){
  if(T[node_num].p==NIL)return NIL;
  if(T[T[node_num].p].l!=NIL && T[T[node_num].p].l!=node_num)return T[T[node_num].p].l;
  if(T[T[node_num].p].r!=NIL && T[T[node_num].p].r!=node_num)return T[T[node_num].p].r;
  return NIL;
}

int main(){
  int i,j,depth,left,right,d,node_num,root;//dは次数
  scanf("%d",&n);
    for(i=0;i<n;i++){
      T[i].l=T[i].r=T[i].p=NIL;
    }
    for(i=0;i<n;i++){//ノードの個数
      scanf("%d",&node_num);
      scanf("%d",&left);
      scanf("%d",&right);
      T[node_num].l=left;
      T[node_num].r=right;
      if(left !=NIL)T[left].p=node_num;
      if(right !=NIL)T[right].p=node_num;
      }
    for(i=0;i<n;i++){
      if(T[i].p==NIL)root=i;//root探し
    }
    Depth(root,0);
    setHeight(root);
for(i=0;i<n;i++) print(i);
return 0;
}



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

# define fr first
# define sc second
# define ll unsigned long long
# define mk make_pair
# define pb emplace_back
# define sz(s) (int)s.size()
# define all(s) s.begin(), s.end()

using namespace std;

const int N = 2e5+10;
const int inf = 1e9+7;

int n, k = 1, ans;

int main () {
    cin >> n;
    for(int i = 1; i <= n; i++) {
        ans += k;
        k++;
        if(ans >= n) break;
    }
    for(int i = 1; i < k; i++) {
        if(i != ans - n) cout << i << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	ll A, B, K;

	cin >> A >> B >> K;
	if (A <= K)
	{
		K -= A;
		A = 0;
		B = max((ll)0, B - K);
	}
	else
	{
		A -= K;
	}
	printf("%ld %ld\n", A, B);
}



Measured memory_bytes: 256
def gcd(a, b)
  if (a < b)
    tmp = a; a = b; b = tmp
  end

  while ((c = a % b) > 0)
    a = b
    b = c
  end

  return b
end

while (line = gets)
  a, b = line.chop.split(" ").map{|s| s.to_i}
  g = gcd(a, b)
  l = a * b / g
    printf("%d %d\n", g, l)
end



Measured memory_bytes: 6844
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

"""
S,Tの両方動くが,片方固定して考える.(S = 0とする)
{
    (入力例2に対して)
    S = (0,0)と固定
    T = (0,0)の場合 S≠Tより考えない
    T = (0,1)の場合 8
    T = (1,0)の場合 5
    T = (1,1)の場合 min(5*2+8,8*2+5)
    よって, 8+5+min(5*2+8,8*2+5) = 31
    S = (0,1),(1,0),(1,1)に対しても同じ結果が得られる.
    つまり,S = (0,0)と固定したときの結果が分かれば2**nを掛けると答えが得られる
}
Cは降順ソートしておく.(並び順は関係ないので)
dp[i] := Σ(0<=j<=2**i) f(0,j)とするとans = dp[n]*(2**n)
dp[0] = C[0]
dp[i+1] := dp[i] + Σ(2**i<=j<=2**(i+1)-1) f(0,j) (右辺の左側はi+1桁目が0,右側はi桁目が1)
        := dp[i] + (2**i + i*(2**(i-1))*C[i] + dp[i] 
        := 2*dp[i] + (2**i + i*(2**(i-1)))*C[i]
        := 2*dp[i] + 2**(i-1)*(2+i)*C[i]
{
    (具体例(n=3))
    桁　3 2 1　個数
    --------------
        0 0 0
        0 0 1
        0 1 0
        0 1 1
        1 0 0　1(1*C[3]だけ増える)
        1 0 1　2(2*C[3]だけ増える)
        1 1 0　2(2*C[3]だけ増える)
        1 1 1　3(3*C[3]だけ増える)

    3桁目を見ているとする
    0のとき,dp[2]の分だけ増える
    1のとき,(個数の和)*C[3]+dp[2]だけ増える
        個数の和を求めたいときに,縦で数える
        ⇒3桁目は2**2,2桁目は2**1,3桁目は2**1
        ⇒2**2 + 2*2**1
        3桁目は常に1,2桁目以下は半分だけ1
        つまり,i桁目では2**(i-1) + (i-1)*2**(i-2)
    よって,
    dp[3] = dp[2] + (2**2 + 2*2**(2-1))*C[3] + dp[2]
}
dpは常にmodを取り,2**iも常に計算していては間に合わないので逐次*2をしていく(modをとりながら)
"""
n = I()
c = LI()
c.sort(reverse=True)
dp = [0]*n
dp[0] = c[0]
p = 1
for i in range(n-1):
    dp[i+1] = (2*dp[i] + p*(2+i+1)*c[i+1]) % mod
    p *= 2
    p %= mod
p *= 2
p %= mod
print(dp[-1]*p % mod)

Measured memory_bytes: 96304
object Main extends App {
    val s = io.StdIn.readLine

    def rec(str: String): Boolean = {
        if (str.length == 1) true
        else if (str.tail.contains(str.head)) false
        else rec(str.tail)
    }

    val result = rec(s)
    if (result) println("yes") else println("no")
}

Measured memory_bytes: 25556
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vll vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//以上テンプレ
bool check(ll bit,vector<vector<pll>> vec,ll N){
rep(i,N){
    if(!(bit&(1<<i))){
        continue;
    }else{
        rep(j,vec.at(i).size()){
            ll a=vec.at(i).at(j).first;
            ll b=vec.at(i).at(j).second;
            if(b==1&&!(bit&(1<<(a-1)))){
                return false;
            }else if(b==0&&(bit&(1<<(a-1)))){
                return false;
            }
        }
    }
}return true;
}

int main(){
    ll N;
    cin>>N;
    vector<vector<pll>> s(N);
    //i人目j個目first-1人目がsecond=1なら正直
    rep(i,N){
        ll A;
        cin>>A;
        s.at(i).resize(A);
        rep(j,A){
            cin>>s.at(i).at(j).first>>s.at(i).at(j).second;
        }
    }
    ll count=0;
    for (ll bit = 0; bit < (1<<N); ++bit) {
        if(check(bit,s,N)){
            ll ifcount=0;
            rep(i,N){
                if(bit&(1<<i)){
                    ifcount++;
                }
                chmax(count,ifcount);
            }
        }
}
cout<<count<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
using namespace std;
long long MOD = 1e9 + 7;

int N, X;
int sum, minm = INT_MAX;

int main() {
	cin >> N >> X;
	for (int n = 0; n < N; n++) {
		int m;
		cin >> m;
		sum += m;
		minm = min(minm, m);
	}
	cout << N + floor((long double)(X - sum) / minm) << endl;
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int a, b;
    cin>>a>>b;
    for(int i=1; i<10000; i++){
        int x=i*8/100, y=i*10/100;
        if(x==a && y==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 768
(function() {
    'use strict';

    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;

    // ToDo start
      var Ntmp = (lines[0].split(" "))
      var N = parseInt(Ntmp[0])
      var C = parseInt(Ntmp[1])
      var maxT = 0

      var bangumi = []
        for (var i=0 ; i<N ;i++){
            bangumi[i] = (lines[i+1]).split(" ")
            if (bangumi[i][1] > maxT){
             maxT = bangumi[i][1]
            }
        } 
      var Cyoyaku = []
      for (var i=0;i<C;i++){
          Cyoyaku[i]=[]
          for(var t=0;t<=maxT;t++){
              (Cyoyaku[i]).push('0')
          }
      }

      for (var i=0; i<N;i++){
          for (var t=parseInt(bangumi[i][0]);t<parseInt(bangumi[i][1]);t++){
            var ch =parseInt(bangumi[i][2] )
            Cyoyaku[ch-1][t] = '1'
          }
      }

      for (var i=0;i<C;i++){
          for ( var t=0;t<maxT;t++){
              if( Cyoyaku[i][t+1] == '1' ){
                  Cyoyaku[i][t] = '1'
              }
          }
      }

      var maxcnt = 0;
      for (var t=0;t<maxT;t++){
          var tmpcnt=0;
          for (var tmpc=0;tmpc<C;tmpc++){
              if(Cyoyaku[tmpc][t]=="1"){
                  tmpcnt++;
              }
          }
          if(tmpcnt > maxcnt ){
              maxcnt = tmpcnt
          }
      }

    console.log(maxcnt);

//      console.log( Math.pow(parseInt(lines[0]),2) - parseInt(lines[1])  )
    // ToDo end

    });


})();

function dump_int(i){var s="";while(i){s=(i&1)+s;i>>>=1}return ('0000000000'+s).slice(-10)}

function matchNum(a,b){
    var tlen = 10
    var mnum = 0;
    
    for (var i=0;i<tlen;i++){
        if ( a[i]== b[i] && a[i] =="1" ){
            mnum++;
        }
    }
    return mnum;
}

Measured memory_bytes: 85412
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
 
// ------------------------------------------------------------------------------------------------

ll a;
string s;

int main() {
    fast_io; cout_precision;
    cin >> a >> s;
    cout << ((a < 3200)? "red": s) << endl;
}

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

int main() {
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int mx = 0;
    rep(i,n-1) mx = max(mx,a[i+1]-a[i]);
    mx = max(mx,k-a[n-1]+a[0]);
    cout << k - mx << endl;
}

Measured memory_bytes: 1024
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

void precalc() {
}

const int n = 6;
int ps[2][n];

int read() {
  for (int it = 0; it < 2; ++it) {
    for (int i = 0; i < n; ++i) {
      if (scanf("%d", ps[it] + i) < 1) {
        return 0;
      }
    }
  }
  return 1;
}

void solve() {
  vector<pair<ld, ld> > adds;
  ld cur = 0, v = 0;
  for (int i = 0; i < n; ++i) {
    ld a = ps[0][i], b = ps[1][i];
    if (ps[0][i] + ps[1][i] == 0) {
      continue;
    }

    cur += b;
    v += -b;
    ld x = b / (a + b);
    adds.pb(mp(x, a + b));
    adds.pb(mp(1, -b));
  }

  sort(adds.begin(), adds.end());

  ld res = cur;

  ld last = 0;
  for (int i = 0; i < sz(adds); ++i) {
    cur += v * (adds[i].first - last);
    last = adds[i].first;
    v += adds[i].second;
    res = min(res, cur);
  }
  res /= 100;
  printf("%.18f\n", (double) res);
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  int n;
  cin>>n;
  int tab[3][n+1];
  rep(i,n+1) {
    tab[0][i]=0;
  }
  tab[1][0]=0;
  tab[2][0]=0;
  rep(i,2) {
    rep(j,n) {
      cin>>tab[i+1][j+1];
    }
  }
  rep(i,2) {
    rep(j,n) {
      tab[i+1][j+1]=max(tab[i][j+1]+tab[i+1][j+1],tab[i+1][j]+tab[i+1][j+1]);
    }
  }
  cout<<tab[2][n]<<endl;
}

Measured memory_bytes: 256
import java.util.*;
 
class Main {
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = x%10;
      	int b = (x/10)%10;
        int c = x/100;
        
         
        if(a==1 || a ==9){
          if(a==1){a = 9;}
          else{a = 1;}
        }
        if(b==1 || b ==9){
          if(b==1){b = 9;}
          else{b = 1;}
        }
        if(c==1 || c ==9){
          if(c==1){c = 9;}
          else{c = 1;}
        }
          
      System.out.print(c);
      System.out.print(b);
      System.out.print(a);
       
    }
}

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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());
  cout << v.at(N - 1) - v.at(0) << endl;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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;
}

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{

    int N; cin >> N;
    string S; cin >> S;

    int Bcnt = 0, Wcnt = 0;
    REP(i,N) if(S[i]=='.') Wcnt++;

    int ans = Wcnt;

    REP(i,N){
        if(S[i]=='#') Bcnt++;
        else Wcnt--;
        if(Bcnt+Wcnt < ans) ans = Bcnt+Wcnt;
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    string S;
    cin >> S;

    string op = "+-";
    REP(i,0,1<<3) {
        ll sum = S[0] - '0';
        string eq = {S[0]};
        REP(j,0,3) {
            sum += (1-((i>>j)&1)*2) * (S[j+1]-'0');
            eq.pb(op[(i>>j)&1]);
            eq.pb(S[j+1]);
        }
        if(sum == 7) {
            eq += "=7";
            PR(eq);
            break;
        }
    }

    return 0;
}

/*



*/

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1000000001
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
int main(){
      int n,m;
      while(cin>>n>>m&&n&&m){
            int turn=n-1;
            int nxt[n],bfr[n];
            REP(i,n)nxt[i]=(i+1)%n;
            REP(i,n)bfr[i]=(i-1+n)%n;
            while(nxt[turn]!=turn){
                  REP(j,m){
                        turn=nxt[turn];
                  }
                  nxt[bfr[turn]]=nxt[turn];
                  bfr[nxt[turn]]=bfr[turn];
            }
            cout<<turn+1<<endl;
      }
}

Measured memory_bytes: 1164
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	int a,b,c; cin>>a>>b>>c;
	int ans=min(c, b/a);
	cout<<ans;
	
	return 0;
}

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

int main() {
    int A, B;
    cin >> A >> B;

    cout << A * B << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

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

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    deque<ll> d;
    rep(i, n) {
        ll p = lower_bound(d.begin(), d.end(), a[i]) - d.begin();
        if(p == 0) {
            d.push_front(a[i]);
        }
        else {
            d[p-1] = a[i];
        }
    }

    out(d.size());
    re0;
}

Measured memory_bytes: 1792