akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cmath>

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef long long ll;
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX / 100;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("~/Downloads/02.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
const double PI = 3.14159265358979323846;

typedef pair<ll, ll> P;

void print_line(vector<vector<int>> &ans) {
    for (int i = 0; i < ans.size(); i++) {
        for (int y = 0; y < ans[i].size(); y++) {
            cout << ans[i][y];
        }
        cout << endl;
    }
}

struct RangeCount {
    int upper, r_equal, between, l_equal, lower;

    friend std::ostream &operator<<(std::ostream &out, const RangeCount &o) {
        cout << endl;
        cout << "upper" << ' ' << o.upper << endl;
        cout << "r_equal" << ' ' << o.r_equal << endl;
        cout << "between" << ' ' << o.between << endl;
        cout << "l_equal" << ' ' << o.l_equal << endl;
        cout << "lower" << ' ' << o.lower << endl;
        return out;
    }
};


// startは含む
// endは含まない
RangeCount range_count(vector<int>::iterator start, vector<int>::iterator end, int l, int r) {
    if (l > r) return RangeCount{0, 0, 0, 0, 0};
    if (start >= end) return RangeCount{0, 0, 0, 0, 0};

    if (l == r) {
        RangeCount rc;
        auto it_u = upper_bound(start, end, r);
        auto it_l = lower_bound(start, end, r);

        rc.upper = distance(it_u, end);
        rc.r_equal = distance(it_l, it_u);
        rc.between = 0;
        rc.l_equal = rc.r_equal;
        rc.lower = distance(start, it_l);

        return rc;
    }

    RangeCount rc;
    auto it_ru = upper_bound(start, end, r);
    auto it_rl = lower_bound(start, end, r);
    rc.upper = distance(it_ru, end);
    rc.r_equal = distance(it_rl, it_ru);
    auto it_lu = upper_bound(start, end, l);
    auto it_ll = lower_bound(start, end, l);
    rc.between = distance(it_lu, it_rl);
    rc.l_equal = distance(it_ll, it_lu);
    rc.lower = distance(start, it_ll);

    return rc;

}


int main() {

    int n;
    cin >> n;
    vector<int> edges(n);
    rep(i, n) cin >> edges[i];
    sort(edges.begin(), edges.end());
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int a = edges[i], b = edges[j];

            RangeCount rc = range_count(edges.begin() + j + 1, edges.end(), b - a, b + a);

            ans += rc.between;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int func(int a, int b)
{
    return b==0?a:(func(b, a%b));
}

int main(){
    int K;
    cin>>K;
    long long sum=0;
    for(int i=1;i<K+1;i++)
        for(int j=1;j<K+1;j++)
            for(int t=1;t<K+1; t++)
                sum=sum+func(func(i,j),t);
    
    cout<<sum;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int w,h;
  cin>>w>>h;
  int x,y;
  cin>>x>>y;
  double f=(double)w*(double)h/2;
  cout << fixed << setprecision(10) << f<< " ";
  if(2*x==w && 2*y==h)
    cout<<"1";
  else cout<<"0";
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))

b = [0 for _ in range(10*n)]
ind = 10*n // 2
ind_up = ind-1
ind_dw = ind
tmp = -1
for i in range(n):
    tmp *= -1
    if tmp == 1:
        ind_up += 1
        b[ind_up] = A[i]
    else:
        ind_dw -= 1
        b[ind_dw] = A[i]


if n%2 != 0:
    b = b[::-1]
    dw = ind_dw - 1
    up = ind_up
else:
    dw = ind_dw
    up = ind_up + 1

for i in range(dw,up):
    print(b[i],end = ' ')
print()


Measured memory_bytes: 46884
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  int ans = 0;
  while(N > 0){
    ans++;
    N = N - K;
    if(N <= 0){
      break;
    }
    N++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
//#define at(x,i) get<i>(x);//
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    vl v(n);rep(i,n)cin >> v[i];
    ll ans=0;
    rep(i,62){
        ll cnt0=0;
        ll cnt1=0;
        rep(j,n){
            if(((ll)1<<i)&v[j])cnt1++;
            else cnt0++;
        }
        ll tmp=cnt1;
        tmp*=cnt0;
        tmp%=MOD;
        tmp*=((ll)1<<i)%MOD;
        tmp%=MOD;
        ans+=tmp;
        ans%=MOD;
    }
    cout <<ans <<endl;
}

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

const int N=1000005;

int main(){
	
	int a,b;
	
	cin>>a>>b;
	
	if(a*b==15)return !printf("*");
	if(a+b==15)return !printf("+");
	
	return !printf("x");
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
    ll n,a,b;cin>>n>>a>>b;
    ll c=a-b;
    vector<ll> h(n);rep(i,n)cin>>h[i];
    ll ng=0,ok=1e9;
    while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        ll cnt=0;
        rep(i,n){
            ll d=mid*b;
            ll r=max(0LL,h[i]-d);
            cnt+=(r+c-1)/c;
        }
        if(cnt<=mid)ok=mid;
        else ng=mid;
    }
    cout<<ok<<endl;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/
int n, a[3000];

int memo[2][3010][3010];
bool vis[2][3010][3010];

int dfs(int t, int l, int r){
  if(r < l) return 0;
  if(vis[t][l][r]) return memo[t][l][r];
  vis[t][l][r] = true;
  
  if(t == 0){
    int res = -inf;
    chmax(res, dfs((t+1)%2, l+1, r)+a[l]);
    chmax(res, dfs((t+1)%2, l, r-1)+a[r]);
    return memo[t][l][r] = res;
  }else{
    int res = inf;
    chmin(res, dfs((t+1)%2, l+1, r)-a[l]);
    chmin(res, dfs((t+1)%2, l, r-1)-a[r]);
    return memo[t][l][r] = res;
  }
}

signed main(){
  cin >> n;
  rep(i, 0, n) cin >> a[i];

  cout << dfs(0, 0, n-1) << endl;

  return 0;
}


Measured memory_bytes: 158336
#include <bits/stdc++.h>
#define ll long long
#define maxn 200005 /*rem*/
#define mod 998244353
#define db double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fi first
#define se second
using namespace std;
ll ksm(ll a, ll b) {
   if (!b) return 1;
   ll ns = ksm(a, b >> 1);
   ns = ns * ns % mod;
   if (b & 1) ns = ns * a % mod;
   return ns;
}
int n;
int p[maxn], q[maxn], nx[maxn];
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++)
		scanf("%d", &p[i]), q[p[i]] = i;
	int ans = 0;
	for (int i = n; i >= 1; i--) {
		if (i == n) nx[i] = i;
		else {
			if (q[i + 1] > q[i]) nx[i] = nx[i + 1];
			else nx[i] = i;
		}
		ans = max(ans, nx[i] - i + 1);
	}
	cout << n - ans << endl;
	return 0;
}


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

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

int inf = 10000000;
int main(){
    int w,h;
    while(cin >> w >> h&&w!=0){
    vector<vector<int> > p(h,vector<int>(w));
    pair<int,int> s,t;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> p[i][j];
            if(p[i][j]==2){
                s.first = i;
                s.second = j;
                p[i][j]= 0;
            }else if(p[i][j]==3){
                t.first = i;
                t.second = j;
            }
        }
    }
    int ans = inf;
    queue<pair<pair<int,int>,pair<int,vector<vector<int> >>> > q;
    q.push(make_pair(make_pair(s.first,s.second),make_pair(0,p)));
    while(!q.empty()){
        auto xxx = q.front();
        q.pop();
        int xx = xxx.first.first;
        int yy = xxx.first.second;
        int z = xxx.second.first;
        if(z>=10)continue;
        auto pq = xxx.second.second;
        for(int i=0;i<4;i++){
            int x = xx;
            int y = yy;
            auto pp = pq;
            bool flag = 1;
            while(1){
                if(x+dx[i]<0||x+dx[i]>=h)break;
                if(y+dy[i]<0||y+dy[i]>=w)break;
                if(flag){
                    if(pp[x+dx[i]][y+dy[i]]==1){
                        break;
                    }else{
                        flag = 0;
                    }
                }
                if(pp[x+dx[i]][y+dy[i]]==0){
                    x += dx[i];
                    y += dy[i];
                    continue;
                }else if(pp[x+dx[i]][y+dy[i]]==3){
                    ans = min(ans,z+1);
                    break;
                }else{
                    pp[x+dx[i]][y+dy[i]]=0;
                    if(z+1>=10)break;
                    q.push(make_pair(make_pair(x,y),make_pair(z+1,pp)));
                    break;
                }
            }
            if(ans!=inf)break;
        }
        if(ans!=inf)break;
    }
        if(ans==inf){
            cout << -1 << endl;
        }else{
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 65420
#include<bits/stdc++.h>
using namespace std;
int main(){
  int cnt=0;
  string s; cin>>s;
  for(int i=0;i<s.size();++i){
    if(s[i]=='-') --cnt;
    else ++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int res = min(2 * min(X, Y) * C, min(X, Y) * A + min(X, Y) * B);
  int Z = max(X, Y) - min(X, Y);
  if (min(X, Y) == X) {
    res += min(2 * Z * C, Z * B);
  } else {
    res += min(2 * Z * C, Z * A);
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 998244353
INF = float('inf')

class BinomialCoefficient(object):

    def __init__(self, N=210000, MOD=998244353):
        self.fac = [1, 1]
        self.finv = [1, 1]
        self.inv = [0, 1]
        self.MOD = MOD
        for i in range(2, N + 1):
            self.fac.append((self.fac[-1] * i) % MOD)
            self.inv.append((-self.inv[MOD % i] * (MOD // i)) % MOD)
            self.finv.append((self.finv[-1] * self.inv[-1]) % MOD)

    def comb(self, n, r):
        if r < 0 or n < r or r < 0:
            return 0
        return self.fac[n] * self.finv[r] * self.finv[n - r] % self.MOD

coef = BinomialCoefficient()

N, M, K = MI()
ans = 0
for l in range(K + 1):
    lans = pow(M - 1, N - l - 1, MOD)
    lans = M * lans % MOD
    lans = lans * coef.comb(N - 1, l) % MOD
    ans = (ans + lans) % MOD
print(ans)

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  rep(i, n){
    cin >> a[i] >> b[i] >> c[i];
  }
  vector<vector<int>> dp(n, vector<int>(3));
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  rep(i ,n -1){
    dp[i + 1][0] = max(dp[i][1] + a[i + 1], dp[i][2] + a[i + 1]);
    dp[i + 1][1] = max(dp[i][0] + b[i + 1], dp[i][2] + b[i + 1]);
    dp[i + 1][2] = max(dp[i][0] + c[i + 1], dp[i][1] +c[i + 1]);
  }
  cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    bool exist = false;
    for(char c = 'a'; c <= 'z'; c++){
        if(count(s.begin(), s.end(), c) == 0){
            cout << c << endl;
            exist = true;
            break;
        }
    }
    if(!exist) cout << "None" << endl;
}

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

using ll = long long;
const int INF = 1e9+7;

void solve()
{
	ll n;cin >> n;
	if(n<=26)
	{
		cout << char('a'+(n-1))  << '\n';
		return;
	}
	string s="";
	while(n>0)
	{
		n--;
		s += char('a'+(n%26));
		//cout << n%26 << '\n';
		n/=26;
	}
	reverse(s.begin(),s.end());
	cout << s << '\n';

}

int main()
{
	int t=1;
	while(t--) solve();
}	


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll c1=1,c2=0;
ll permute(string a, int l, int r,string s1)  
{  
    // Base case  
    if (l == r)  
        {
        	c1++;
        	if(a==s1)
        	return c1;
		} 
    else
    {  
        // Permutations made  
        for (int i = l; i <= r; i++)  
        {  
  
            // Swapping done  
            swap(a[l], a[i]);  
  
            // Recursion called  
            permute(a, l+1, r,s1);  
  
            //backtrack  
            swap(a[l], a[i]);  
        }  
    }  
} 
int main()
{
	ll n;
	cin>>n;
	ll a1[n];
	ll a2[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a1[i];
	}
	for(ll i=0;i<n;i++)
	{
		cin>>a2[i];
	}
	ll c1=1;
	ll c2=1;
	ll a3[n];
	for(ll i=0;i<n;i++)
	a3[i]=i+1;
	do
	{
		
		c1++;
		ll f=0;
		for(ll i=0;i<n;i++)
		{
			if(a1[i]!=a3[i])
			{
				f=1;
				break;
			}
		}
		if(f==0)
		{
			break;
		}
	}while(next_permutation(a3,a3+n));
	sort(a3,a3+n);
		do
	{
		
		c2++;
		ll f=0;
		for(ll i=0;i<n;i++)
		{
			if(a2[i]!=a3[i])
			{
				f=1;
				break;
			}
		}
		if(f==0)
		{
			break;
		}
	}while(next_permutation(a3,a3+n));
	cout<<abs(c1-c2);	
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<LL>>g;
vector<edge>ed;
vector<Pll>pv;
map<string, LL>ma;
set<LL>st;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n,m,a[110000][2],ans,b[110000];

struct QuickFind {
	vector<int> gi; //親
	vector<vector<int>> vg; //併合した後削除する
	vector<vector<int>> tg; //併合した後削除しない
	int n;

	QuickFind(int size) : n(size) {
		gi.resize(n);
		vg.resize(n);
		tg.resize(n);
		for (int i = 0; i < n; i++) {
			gi[i] = i;
			vg[i].push_back(i);
			tg[i].push_back(i);
		}
	}
	bool same_group(int a, int b) {
		return gi[a] == gi[b];
	}
	void merge(int a, int b) {
		int ga = gi[a];
		int gb = gi[b];
		if (ga == gb) return;
		if (vg[ga].size() < vg[gb].size()) swap(ga, gb);
		for (int j : vg[gb]) gi[j] = ga;
		vg[ga].insert(vg[ga].end(), vg[gb].begin(), vg[gb].end());
		vg[gb].clear();
		tg[ga].insert(tg[ga].end(), tg[gb].begin(), tg[gb].end());
	}
};
QuickFind qk(100100);
int main() {
	cin >> n;
	cin >> m;
	rep(i, m) {
		cin >> a[i][0] >> a[i][1];
	}
	ans = n * (n - 1) / 2;
	Rrep(i, m) {
		b[i] = ans;
		if (qk.same_group(a[i][0], a[i][1]) == 0) {
			LL s = qk.gi[a[i][0]], t = qk.gi[a[i][1]];
			ans -= qk.vg[s].size()*qk.vg[t].size();
			qk.merge(a[i][0], a[i][1]);
		}
	}
	rep(i, m)
		cout << b[i] << endl;
	return 0;
}

Measured memory_bytes: 21560
#include <bits/stdc++.h>
#include <unistd.h>
#include <random>

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      char C;
      cin >> C;
      if(C=='A'){
      	cout << "T" << endl;
      }
      if(C=='T'){
      	cout << "A" << endl;
      }
      if(C=='G'){
      	cout << "C" << endl;
      }
      if(C=='C'){
      	cout << "G" << endl;
      }
}

Measured memory_bytes: 764
/*
**   Contest : AtCoder Beginner Contest 177
**   Problem : A - Don't be late
**
**    Author : Dhiraj Govindvira
**      Date : 29-Aug-2020 ~ Saturday
**      Time : 07:30:24 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define FOR(i, a, b, s)     for(ll i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define FOR1(b)             FOR(i, 0, b, 1)
#define FOR2(i, b)          FOR(i, 0, b, 1)
#define FOR3(i, a, b)       FOR(i, a, b, (a) <= (b) ? 1 :-1)
#define FOR4(i, a, b, s)    FOR(i, a, b, s)
#define GET5(a, b, c, d, e, ...) e
#define FORC(...)           GET5(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)
#define loop(...)           FORC(__VA_ARGS__)(__VA_ARGS__)
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename... T> 
inline void inp(T&... args) {
    ((cin>>args), ...);
}
// scan vector
template <typename T> 
inline istream& operator >>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream& operator >>(istream &in, pair<T, U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

void solve(int &T)
{
    long double a, b, c;
    cin >> a >> b >> c;

    if(a / c > b) cout << "No\n";
    else cout << "Yes\n";
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt", "r", stdin);
        freopen("D:/dhiraj/Programming/o1.txt", "w", stdout);
        // freopen("D:/dhiraj/Programming/e1.txt", "w", stderr);
    #endif

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

    int t = 1;
    for(int i = 1; i <= t; i++) {
        cerr << "Case #" << i << "\n";
        solve(i);
    }
    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
  int k,a,b;
  string ans = "NG";
  cin >> k >> a >> b;
  for(int i = a; i <=b; i++){
    if(i % k == 0) ans = "OK";
  }
  cout << ans << endl;
}

Measured memory_bytes: 3548
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let ns: String = format!("{}", n);
    let ncs: Vec<char> = ns.chars().collect();
    let mut sn: i32 = 0;
    for &c in ncs.iter() {
        let x: i32 = format!("{}", c).parse().unwrap();
        sn += x;
    }
    let ans = if n % sn == 0 { "Yes" } else { "No" };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;


#define LETS_GET_SCHWIFTY ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
#define ff              first
#define ss              second
#define int             long long
#define ll              long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define vpii            vector<pair<int,int> >
#define all(x)          x.begin(),x.end()
#define matrixprint(arr,a,b,c,d) for(int i=a;i<=c;i++){for(int j=b;j<=d;j++){cout<<arr[i][j]<<" ";}cout<<"\n";}
#define show(arr,x,y)   for(int i=x;i<=y;i++){cout<<arr[i]<<" ";}cout<<"\n"
#define sz(x)           (int)x.size()
#define db(x)           cout<<x<<"\n";

const int N = 2e5 + 5;

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

	
//////////////////////////////code//////////////////////////////

vi adj[100005];

int dp[100005][2];

void dfs(int node,int p)
{ 

    dp[node][0] = dp[node][1] = 1;
   
    for(auto &c:adj[node])
    {  
        if(c!=p)
      {
        dfs(c,node);
        dp[node][0] = (dp[node][0]*(dp[c][1] + dp[c][0]))%mod;
        dp[node][1] = (dp[node][1]*dp[c][0])%mod;
      }
        
    }
 
}

void solve()
{
   // cout << "-------------------" << "\n";
    
    int n;
    cin>>n;
    
    
    for(int i=0;i<n-1;i++)
    {
        int u,v;
        cin>>u>>v;
        
        adj[u].pb(v);
        adj[v].pb(u);
        
    }
    
     memset(dp,0,sizeof(dp));
     
     dfs(1,0);
    
    
    int ans = (dp[1][0] + dp[1][1])%mod;
    
    cout<<ans<<"\n";

  
 

   // cout << "-------------------" << "\n";

}

int32_t main()
{

    LETS_GET_SCHWIFTY;

    int t = 1;
    //cin >> t;

    while (t--)
        solve();

}

// check out for following mistakes-
// if using pb operation on vector and then trying to access index..check if sizeof that vec could remain 0 only
// is using prime sieve make sure it fits
// when using factorial template or combinatorics make sure that you edit fillfac fun values and array values


Measured memory_bytes: 16120
#include<stdio.h>

int main(){
  int n,ma,mb,a[40],b[40],c[40],dp[41][401][401]={},i,j,k,min=4000000,nn;
  scanf("%d %d %d",&n,&ma,&mb);
  for(i=0;i<=40;i++)
    for(j=0;j<=400;j++)
      for(k=0;k<=400;k++)
        dp[i][j][k]=40000;
  dp[0][0][0]=0;
  //for(i=0;i<=n;i++)
    //printf("%d\n",dp[i][400][400]);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a[i],&b[i],&c[i]);
    for(j=0;j<=400;j++)
      for(k=0;k<=400;k++){
        if(dp[i][j][k]<dp[i+1][j][k])
          dp[i+1][j][k]=dp[i][j][k];
        if(j>=a[i]&&k>=b[i]&&dp[i+1][j][k]>dp[i][j-a[i]][k-b[i]]+c[i])
          dp[i+1][j][k]=dp[i][j-a[i]][k-b[i]]+c[i];
      }
  }
  for(i=1;i*ma<=400&&i*mb<=400;i++){
    if(min>dp[n][i*ma][i*mb])
      min=dp[n][i*ma][i*mb];
    //printf("%d\n",dp[n][i*ma][i*mb]);
  }
  if(min<40000)
    printf("%d\n",min);
  else
    printf("-1\n");
}

Measured memory_bytes: 25856
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>


#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S,False(1,-1);
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

template<typename A,size_t N,typename T>
void Fill(A(&array)[N],const T &val){
    fill((T*)array,(T*)(array+N),val);
}


ll gcd(ll a,ll b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

const ll INF = 1e9;
ll dp[1010][10100];
int main(){
    double r;
    double pi = 3.1415926535;
    cin >> r;
    cout << fixed << setprecision(15) << r * 2 * pi << endl;
}

Measured memory_bytes: 3232
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <random>

using namespace std;

int main() {
  string output, input;
  cin >> input;
  for (auto&& ch : input) {
    if (ch == 'B') {
      if (!output.empty()) {
        output.pop_back();
      }

    }
    else {
      output.push_back(ch);
    }
  }
  cout << output << endl;
  return 0;
}


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

int main(){
    string s;
    int nc[26]={};

    while(getline(cin, s)){
        for(int i=0; i<(int)s.length(); i++){
            if('a' <= s[i] && s[i] <= 'z') nc[s[i]-'a']++;
            if('A' <= s[i] && s[i] <= 'Z') nc[s[i]-'A']++;
        }
    }
    for(int i=0; i<26; i++){
        cout << (char)('a'+i) << " : " << nc[i] << endl;
    }
    return 0;
}


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


class Program {

	const long mod = 1000000007;
	//public static int[] max;

	static void Main(string[] args) {

		char[] cs = new char[] { ' ', ',' };
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//int n = vals[0];
		//string res="";

		//int y = vals[0];
		//int x = vals[1];

		int[] vals = parseAry(Console.ReadLine().Split(cs));

		string s = "NO";
		if (vals[0] <= vals[2] && vals[0] + vals[1] >= vals[2]) { s = "YES"; }


		//deug
		Console.WriteLine(s);

		int stop=1;
		return;
	}



	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for (int i = 0; i < str.Length; i++) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryl(string[] str) {
		long[] nums = new long[str.Length];
		for (int i = 0; i < str.Length; i++) { nums[i] = int.Parse(str[i]); }
		return nums;
	}



}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;
ll INF = 10000000000000000;
const int MAX_V = 310;
ll cost[MAX_V][MAX_V];
pair<int,ll> d[MAX_V][MAX_V];
bool used[MAX_V];
ll n,l;
void dijkstra(int s){
	d[s][s] = {0,-l};
	int i,v = -1;
	for(i=0;i<n;i++) used[i] = false;
	while(true){
		for(i=0;i<n;i++){
			if(v==-1 || cost[v][i]==-1 || used[i]) continue;
			int cnt = d[s][v].first; ll en = -d[s][v].second;
			if(en - cost[v][i]>=0) d[s][i] = min(d[s][i],{cnt,-(en - cost[v][i])});
			else d[s][i] = min(d[s][i],{cnt + 1,-(l - cost[v][i])});
		}
		v = -1;
		pair<int,ll> p = {2*n,INF};
		for(i=0;i<n;i++){
			if(d[s][i]<p && (!used[i])){
				v = i;
				p = d[s][i];
			}
		}
		if(v==-1) break;
		used[v] = true;
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int i,j,m,q;
	cin >> n >> m >> l;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			cost[i][j] = -1;
			d[i][j] = {2*n,-INF};
		}
	}
	for(i=0;i<m;i++){
		int a,b,c;
		cin >> a >> b >> c; a--; b--;
		if(c>l) continue;
		cost[a][b] = c; cost[b][a] = c;
	}
	for(i=0;i<n;i++) dijkstra(i);
	cin >> q;
	for(i=0;i<q;i++){
		int s,t; cin >> s >> t; s--; t--;
		if(d[s][t].first<=n) cout << d[s][t].first << endl;
		else cout << -1 << endl;
	}
}

Measured memory_bytes: 2688
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, x, y;
    cin >> n >> x >> y;
    x--; y--;
    map<int, int> cnt;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            int dist = j-i;
            chmin(dist, abs(i-x)+1+abs(y-j));
            chmin(dist, abs(i-y)+1+abs(x-j));
            cnt[dist]++;
        }
    }
    rep(k,n-1) cout << cnt[k+1] << endl;
    return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	int N, a = 1;
	cin >> N;
	if(N % 2 == 0){
		cout << N << endl;
	}
	else{
		cout << N * 2 << endl;
	}
	return 0;
}

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

int main(){
    int a,b ;
    cin >> a >> b ;
    int ans = 0 ;
    int now = 1 ;
    bool clear = false ;
    while (clear == false)
    {
        if (now >= b)
        {
            clear = true ;
            break ;
        }else
        {
            now += a-1 ;
            ans ++ ;
        }
        
    }
    cout << ans <<endl ;
}

Measured memory_bytes: 256
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=100000+10;

int n,l,a[N];

int main() {
    n=read(),l=read();
    for (re int i=1;i<=n;++i) a[i]=read();
    int p,mx=0;
    for (re int i=1;i<n;++i)
        if (a[i]+a[i+1]>mx) mx=a[i]+a[i+1],p=i;
    if (mx<l) puts("Impossible");
    else {
        puts("Possible");
        for (re int i=1;i<p;++i) printf("%d\n",i);
        for (re int i=n-1;i>p;--i) printf("%d\n",i);
        printf("%d\n",p);
    }
    return 0;
}


Measured memory_bytes: 1280
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    
    final int ans;
    if (A >= B && A >= C) {
      ans = A*10 + B + C;
    } else if (B >= A && B >= C) {
      ans = B*10 + C + A;
    } else {
      ans = C*10 + A + B;
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include <stdio.h>

int main(void) {
	int H, W;
	while (scanf("%d%d", &H, &W) == 2 && (H|W) != 0) {
		int i, j;
		for (i = 0; i < H; i++) {
			for (j = 0; j < W; j++) putchar((i + j) % 2 == 0 ? '#' : '.');
			putchar('\n');
		}
		putchar('\n');
	}
	return 0;
}



Measured memory_bytes: 2140
N, M = map(int, input().split())
lines = [None] * N
stack = [0]
edges = [[] for _ in range(N)]
for _ in range(M):
    l, r, d = map(int, input().split())
    edges[l-1].append((r-1, d))
    edges[r-1].append((l-1, -d))

for i in range(N):
    if lines[i] is not None:
        continue
    lines[i] = 0
    stack = [i]
    while stack:
        v = stack.pop()
        for u, d in edges[v]:
            if lines[u] is None:
                lines[u] = lines[v] + d
                stack.append(u)
            elif lines[v] + d != lines[u]:
                print("No")
                quit()

print("Yes")


Measured memory_bytes: 82208
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var n = long.Parse(Console.ReadLine());
    long g = 0;
    for(var i = 0;i<=n;i++){
      if(i%3 == 0||i%5 == 0){
       
      }
      else{
        g += i;      
      }  
    }
    Console.WriteLine(g);
  }
}

Measured memory_bytes: 17660
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<(int) (n);i++)
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
using namespace std;
bool s_check(string s){
  string t(s.rbegin(),s.rend());
  return s==t;
}
int main(){
  string s;
  cin>>s;
  int n=s.size();
  if(s_check(s) && s_check(s.substr(0,(n-1)/2)) && s_check(s.substr((n+1)/2))){
      cout<<"Yes";
  }
  else cout<<"No";

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

//5
//10101
//10111
//11101
//00001
//00001

//4
//1000
//3001
//0001
//0001

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		
		int n=sc.nextInt();
		long maxSum=Long.MIN_VALUE,minSum=Long.MAX_VALUE,maxdiff=Long.MIN_VALUE,minDiff=Long.MAX_VALUE;
		long ans=Long.MIN_VALUE;
		for(int i=0;i<n;i++) {
			long x=sc.nextLong(),y=sc.nextLong();
			maxSum=Math.max(x+y, maxSum);
			minSum=Math.min(x+y, minSum);
			maxdiff=Math.max(x-y, maxdiff);
			minDiff=Math.min(x-y, minDiff);
			
		}
		ans=Math.max(ans, Math.max(maxSum-minSum, maxdiff-minDiff));
		System.out.println(ans);
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

}


Measured memory_bytes: 54828
n, m = map(int, input().split())
max_l = 0
min_r = n
for _ in range(m):
    l, r = map(int, input().split())
    max_l = max(l, max_l)
    min_r = min(r, min_r)
print(max(min_r - max_l + 1, 0))

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

void func(long long N){

    string s;
    bool ok = true;
    while(N>0){
        if(ok)ok=false;
        bool flag = false;
        s.push_back((char)('a'+(N-1)%26));
        if((N-1)%26==25)flag=true;
        N/=26;
        if(flag)N--;
    }

    reverse(s.begin(),s.end());
    cout<<s<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    func(N);
    return 0;
}


Measured memory_bytes: 3664
N = int(input())
A = list(map(int, input().split()))

A.sort()
A = A[::-1]
ans = max(A)
M = (N-2)//2
for i in range(M):
    ans += 2*A[i+1]
if N%2 != 0:
    ans += A[M+1]
print(ans)

Measured memory_bytes: 31672
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string S,T;
    cin >> S >> T;
    T.pop_back();
    if(S==T)
    {
        cout << "Yes";
    }   
    else
    {
        cout << "No";
    }
    return 0;
    
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>
#include<string>
typedef unsigned long long ll;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define F first
#define S second
using namespace std;
const ll INF = 1e12;
const int i_INF = 2147483647;

int main() {
  double n,t,a;
  cin>>n>>t>>a;
  vector<double> h(n);
  int ans=-1;
  double min=double(i_INF);
  rep(i,0,n){
    cin>>h[i];
    double d=abs(a-t+h[i]*0.006);
    if(d<min){
      min=d;
      ans=i+1;
    }
  }
  cout<<ans<<endl;
}

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

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    int n;
    int d[50];
    cin >> n;
    rep(i, n) cin >> d[i];

    int ans = 0;
    rep(i, n) {
        for (int j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll ksm(ll a,ll n)
{
    a%=mod;
    ll ans=1,base=a;
    while(n)
    {
        if(n&1)
            ans=(ans*base)%mod;
        base=(base*base)%mod;
        n>>=1;
    }
    return ans%mod;
}
void gcd(ll a,ll b,ll &d,ll &x,ll &y)
{
    if(!b)
    {
        d=a;
        x=1;
        y=0;
    }
    else
    {
        gcd(b,a%b,d,y,x);
        y-=x*(a/b);
    }
}
ll in(ll a,ll mod)
{
    ll d,x,y;
    gcd(a,mod,d,x,y);
    return d==1?(x+mod)%mod:-1;
}
ll C(ll a,ll b)
{
    ll n=a;
    ll ans=1;
    for(int i=0;i<n;i++)
    {
        ans=(ans*b)%mod;
        b--;
    }
    for(int i=0;i<n;i++)
    {
        ans=(ans*in(a,mod))%mod;
        a--;
    }
    return ans%mod;
}
int main()
{
    ll n;
    ll a,b;
    cin>>n>>a>>b;
    ll ans=ksm(2,n);
    ll x=C(a,n);
    ll y=C(b,n);
    if(ans-x<0)
    	ans+=mod;
    ans-=x;
    if(ans-y<0)
    	ans+=mod;
    ans-=y;
    cout<<(ans-1)%mod<<endl;
    return 0;
}

Measured memory_bytes: 256
MOD = 998244353


def solve(A, B, C, D):
    numWays = [[None for c in range(D + 1)] for r in range(C + 1)]

    numWays[A][B] = 1

    for rows in range(A, C + 1):
        for cols in range(B, D + 1):
            if rows == A and cols == B:
                continue
            ways = 0
            if rows > A:
                ways += cols * numWays[rows - 1][cols] % MOD
            if cols > B:
                ways += rows * numWays[rows][cols - 1] % MOD
            if rows > A and cols > B:
                ways -= (cols - 1) * (rows - 1) * numWays[rows - 1][cols - 1] % MOD
            numWays[rows][cols] = ways % MOD

    return numWays[C][D] % MOD


A, B, C, D = [int(x) for x in input().split()]
print(solve(A, B, C, D))


Measured memory_bytes: 288452
import sys
sys.setrecursionlimit(114514)

N=int(input())

path=[[] for _ in range(N+1)]
for _ in range(N-1):
	u,v,w=map(int,input().split())
	path[u].append((v,w))
	path[v].append((u,w))

d=[-1]*(N+1)

def walk(i, c):
	if d[i] == -1:
		d[i] = c
		for x,w in path[i]:
			walk(x, c+w)

walk(1, 0)

for c in d[1:]:
	print(c % 2)


Measured memory_bytes: 82988
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
#ifdef _DEBUG
#define dd(x) cout << #x << " : " << x << endl
#else
#define dd(x)
#endif
using namespace std;
using ll = int64_t;

int main(){
    string s, t; cin >> s >> t;

    cout << t << s << endl;

    return 0;
}


Measured memory_bytes: 3608
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
int main()
{
    ios_base::sync_with_stdio(false);  cin.tie(NULL);
    ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d,z;
    string s;
    cin>>s;
    if(s[s.size()-1]=='s'){
        cout<<s<<"es"<<endl;
    }
    else{
        cout<<s<<"s"<<endl;
    }

    return EXIT_SUCCESS;
}



Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
long long int a[100100], i, n, temp, width, height;
int main()
{
    cin >> n;
    for(i=0;i<n;i++)
        cin >> a[i];
    sort(a, a+n);
    for(i=0;i<n-1;i++)
    {
        if(a[i]==a[i+1])
        {
            temp = height;
            height = a[i+1];
            width = temp;
            i++;
        }
    }
    cout << height*width<< endl;
}


Measured memory_bytes: 4384
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			//			solveA();
			solveB();
			// solveC();
			// solveD();
			// solveE();
			// solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numX = Integer.parseInt(next());
		int numY = Integer.parseInt(next());

		out.print(numX + numY / 2);

		out.println("");
	}

	private void solveB() {
		int numN = Integer.parseInt(next());
		int numT = Integer.parseInt(next());
		int numA = Integer.parseInt(next());

		double[][] wk = new double[numN][2];

		int index = 0;
		double sabun = 999999999;
		for (int i = 0; i < wk.length; i++) {
			wk[i][0] = nextInt();
			wk[i][1] = numT - wk[i][0] * 0.006;
			if (Math.abs(numA - wk[i][1]) < sabun) {
				sabun = Math.abs(numA - wk[i][1]);
				index = i;
			}

		}

		out.println(index + 1);
	}

	private void solveC() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private void solveD() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private void solveE() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private void solveF() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 23252
// Problem : B - Comparing Strings
// Contest : AtCoder Beginner Contest 152
// URL : https://atcoder.jp/contests/abc152/tasks/abc152_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

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

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int a, b; cin >> a >> b;
	string A, B;
	rep(i, b) A += (char)(a+'0');
	rep(i, a) B += (char)(b+'0');
	cout << min(A, B) << endl;
}


Measured memory_bytes: 256