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 sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
//const int INF = INT_MAX  ;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

const int mod = 1000000007;

typedef tuple<ll, int, int, int> PC;

int main() {

    int x, y, z, k;
    cin >> x >> y >> z >> k;

    vector<ll> xl(x);
    vector<ll> yl(y);
    vector<ll> zl(z);

    rep(i, x) {
        ll nx;
        cin >> nx;
        xl[i] = nx;
    }

    rep(i, y) {
        ll ny;
        cin >> ny;
        yl[i] = ny;
    }


    rep(i, z) {
        ll nz;
        cin >> nz;
        zl[i] = nz;
    }
    sort(xl.rbegin(), xl.rend());
    sort(yl.rbegin(), yl.rend());
    sort(zl.rbegin(), zl.rend());

    cout << xl[0] + yl[0] + zl[0] << endl;

    priority_queue<PC> staging;

    staging.emplace(xl[1] + yl[0] + zl[0], 1, 0, 0);
    staging.emplace(xl[0] + yl[1] + zl[0], 0, 1, 0);
    staging.emplace(xl[0] + yl[0] + zl[1], 0, 0, 1);

    set<PC> st;

    for (int i = 0; i < k - 1; i++) {
        auto top = staging.top();
        staging.pop();
        ll now = get<0>(top);
        int cx = get<1>(top);
        int cy = get<2>(top);
        int cz = get<3>(top);

        if (cx < x - 1) {
            int nx = cx + 1;
            int ny = cy;
            int nz = cz;
            PC p(xl[nx] + yl[ny] + zl[nz], nx, ny, nz);
            if (st.find(p) == st.end()) {
                st.insert(p);
                staging.emplace(p);
            }
        }

        if (cy < y - 1) {
            int nx = cx;
            int ny = cy + 1;
            int nz = cz;
            PC p(xl[nx] + yl[ny] + zl[nz], nx, ny, nz);
            if (st.find(p) == st.end()) {
                st.insert(p);
                staging.emplace(p);
            }
        }

        if (cz < z - 1) {
            int nx = cx;
            int ny = cy;
            int nz = cz + 1;
            PC p(xl[nx] + yl[ny] + zl[nz], nx, ny, nz);
            if (st.find(p) == st.end()) {
                st.insert(p);
                staging.emplace(p);
            }
        }

        cout << now << endl;

    }


}



Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100010;
int n,cnt;
string a,b,c;

int read(){
    int f=1,x=0;
    char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0';ch=getchar();}
    return f*x;
}
int main(){
    cin>>n;
    cin>>a>>b>>c;
    for(int i=0;i<n;i++){
        set<char> s;
        char ca=a[i],cb=b[i],cc=c[i];
        s.insert(ca);
        s.insert(cb);
        s.insert(cc);
        //cout<<s.size()<<endl;
        cnt+=(s.size()-1);
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n;
LL a[100010], b[100010];

void solve() {
  cin >> n;
  REP(i, n+1) cin >> a[i];
  REP(i, n) cin >> b[i];
  LL res = 0;
  REP(i, n) {
    LL b1 = min(b[i], a[i]);
    res += b1;
    b[i] -= b1;
    a[i] -= b1;
    LL b2 = min(b[i], a[i+1]);
    res += b2;
    b[i] -= b2;
    a[i+1] -= b2;
  }
  cout << res << endl;
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 1792
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
string s;int a;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>s;
	for(int i=0;i<s.size();i++)
	a+=s[i]-'0';
	if(a%9==0)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3732
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#define ll long long
#define str string
#define rtn return
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define db long double
#define MOD 1000000007
#define INF 1e18
#define EPS 1e-15
#define pll pair <ll, ll>
#define vi vector<ll>
#define vpll vector<pll>
#define value_at find_by_order
#define index_of order_of_key
#define fill(a,v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(ll i=0;i<n;++i)
#define per(i,n) for(ll i=n-1;i>=0;--i)
#define loop1(i, n) for (int i=1;i<=n;++i)
#define loop(i, begin, end) for (__typeof(end) i = (begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);std::cout.tie(NULL)

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

template<class T> void remin(T &a, T b) {a = min(a, b);}
template<class T> void remax(T &a, T b) {a = max(a, b);}
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define N 100005

int n, k;
int h[N];
int dp[N];

int solve(int i) {
  if (i == n - 1) rtn 0;
  if (dp[i] != -1) rtn dp[i];
  dp[i] = INF;
  loop(j, 1, k+1) {
    if (i + j < n) {
      remin(dp[i], abs(h[i] - h[i + j]) + solve(i + j));
    }
  }
  rtn dp[i];
}

int main() {
  FAST_IO;
  fill(dp, -1);
  cin >> n >> k;
  rep(i, n) cin >> h[i];
  cout << solve(0);
  rtn 0;
}


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

int n, l, j, u, k, tmp;
int list[100][100];
int lengthlist[100];

void search(int y, int length)
{
  int i;

  length++;
  lengthlist[y] = length;

  for (i = 0; i < n; i++)
  {
    if (list[y][i] == 1)
    {
      if (lengthlist[i] <= length && lengthlist[i] >= 0)
        continue;
      search(i, length);
    }
  }
}

int main()
{
  scanf("%d", &n);
  for (l = 0; l < n; l++)
  {
    scanf("%d", &u);
    scanf("%d", &k);
    for (j = 0; j < k; j++)
    {
      scanf("%d", &tmp);
      list[u - 1][tmp - 1] = 1;
    }
  }
  for (l = 0; l < n; l++)
  {
    lengthlist[l] = -1;
  }
  search(0, -1);

  for (j = 0; j < n; j++)
  {
    printf("%d %d\n", j + 1, lengthlist[j]);
  }

  return 0;
}



Measured memory_bytes: 2032
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#define mes(a, b) memset(a, b, sizeof a)
#define pb push_back
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 2e6+10;
const double eps = 1e-1;
ll n, k;
int main(){
    scanf("%lld%lld",&n,&k);
    ll ans = 0;
    for(ll i = k; k <= n+1; k++){
        ans += (n+(n-k+1))*k/2 - (k-1)*k/2 + 1;
        ans %= mod;
    }
    printf("%lld\n",ans);
    return 0;
}


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

int main() {
	ll n,t=0,a,b;
	cin >> n;
	vector<pair<ll,ll>>ba;
	rep(i,n){
		cin >> a >> b;
		ba.push_back(make_pair(b,a));
	}
	sort(ba.begin(),ba.end());
	rep(i,n){
		if(t+ba.at(i).second>ba.at(i).first){
			puts("No");
			return 0;
		}
		else t+=ba.at(i).second;
	}
  puts("Yes");
}


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

void swap(int *a, int *b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}

int pop_max(int *a, int *n) {
  int i, last = *n - 1;
  for (i = last - 1; i >= 0; i--) {
    if (a[last] < a[i]) {
      swap(a+i, a+last);
    }
  }
  *n = *n - 1;
  return a[last];
}

int best_pizza(int n, int Bp, int Tp, int Bc, int *Tc_arr) {
  int c_sum = Bc;
  int p_sum = Bp;
  while (n > 0) {
    int new_c_sum = c_sum + pop_max(Tc_arr, &n);
    int new_p_sum = p_sum + Tp;
    if (new_c_sum/new_p_sum < c_sum/p_sum) {
      break;
    }
    c_sum = new_c_sum;
    p_sum = new_p_sum;
  }
  return c_sum/p_sum;
}

int main() {
  int i, N, Bp, Tp, Bc, *Tc_arr;
  scanf("%d", &N);
  scanf("%d %d", &Bp, &Tp);
  scanf("%d", &Bc);
  Tc_arr = (int*)malloc(sizeof(int)*N);
  for (i = 0; i < N; i++) {
    scanf("%d", Tc_arr+i);
  }
  printf("%d\n", best_pizza(N, Bp, Tp, Bc, Tc_arr));
  return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
/*#define inf 100000000/*10^8*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)

////////////////////////////////////////
ll INF=10000000000;
ll min(ll a,ll b){
    if(a<b)return a;else return b;
}
ll max(ll a,ll b){
    if(a<b)return b;else return a;
}

int main(){
    int n;cin>>n;
    ll  a[n];rep(i,0,n-1)cin>>a[i];
    vector<ll> s;
    s.push_back(a[0]);
    rep(i,1,n)s.push_back(s[i-1]+a[i]);
    ll ans=INF;
    rep(mid,1,n-3){
        ll MIN,MAX;
        if(s[mid]<=s[n-1]/2){
            vector<ll>::iterator lb = lower_bound(s.begin(), s.end(), s[mid]/2);
            ll pos=lb-s.begin();
            ll q1=min(s[pos],s[mid]-s[pos]);
            if(pos>0){
                ll q2=min(s[pos-1],s[mid]-s[pos-1]);
                q1=max(q1,q2);
            }
            MIN=q1;
            MAX=s[mid]-q1;
            
            vector<ll>::iterator rb = lower_bound(s.begin(), s.end(), (s[n-1]+s[mid])/2);
            ll po=rb-s.begin();
            q1=max(s[po]-s[mid],s[n-1]-s[po]);
            if(po>mid){
                ll q2=max(s[po-1]-s[mid],s[n-1]-s[po-1]);
                q1=min(q1,q2);
            }
            MAX=max(MAX,q1);
            MIN=min(MIN,s[n-1]-s[mid]-q1);
            ans=min(ans,MAX-MIN);
        }else{
            vector<ll>::iterator lb = lower_bound(s.begin(), s.begin()+mid, s[mid]/2);
            ll pos=lb-s.begin();
            ll q1=max(s[pos],s[mid]-s[pos]);
            if(pos>0){
                ll q2=max(s[pos-1],s[mid]-s[pos-1]);
                q1=min(q1,q2);
            }
            MAX=q1;
            MIN=s[mid]-q1;
            vector<ll>::iterator rb = lower_bound(s.begin()+mid, s.end(), (s[n-1]-s[mid])/2+s[mid]);
            pos=rb-s.begin();
            q1=min(s[pos]-s[mid],s[n-1]-s[pos]);
            if(pos>mid){
                ll q2=min(s[pos-1]-s[mid],s[n-1]-s[pos-1]);
                q1=max(q1,q2);
            }
            MIN=min(MIN,q1);
            MAX=max(MAX,s[n-1]-s[mid]-q1);
            ans=min(ans,MAX-MIN);
        }
     //  cout<<mid << " "<<ans<<" "<<MAX <<" "<<MIN<<endl;
    }
    cout<<ans<<endl;
   // rep(i,0,n-1)cout<<s[i]<<" ";
    return 0;
}


Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
int N,H;
int A[100005],B[100005];
int main()
{
	cin>>N>>H;
	for(int i=0;i<N;i++)
	cin>>A[i]>>B[i];
	int x=*max_element(A,A+N);
	sort(B,B+N);
	reverse(B,B+N);
	int ans=(H+x-1)/x;
	for(int i=0;i<N;i++)
	{
		H-=B[i];
		int tmp;
		if(H<=0)tmp=0;
		else tmp=(H+x-1)/x;
		if(ans>i+1+tmp)
			ans=i+1+tmp;
	}
	cout<<ans<<endl;
	return 0; 
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <bitset>

using namespace std;

typedef long long ll;

ll dp[60][60][4000];

int main(){
    int N, A;
    cin >> N >> A;
    vector<int> x(N);
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }
    
    // 組み合わせの公式（パスカルの三角形）
    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= N; j++){
            for(int k = 0; k <= N * 50; k++){
                if(i == 0 && j == 0 && k == 0){
                    dp[i][j][k] = 1;
                }
                else if(i >= 1 && k < x[i - 1]){
                    dp[i][j][k] = dp[i - 1][j][k];
                }
                else if(i >= 1 && j >= 1 && k >= x[i - 1]){
                    dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]];
                }
                else{
                    dp[i][j][k] = 0;
                }
            }
        }
    }
    
    // for(int i = 0; i <= N; i++){
    //     for(int j = 0; j <= N; j++){
    //         cout << i << " " << j << endl;
    //         for(int k = 0; k <= (i + 1) * A; k++){
    //             cout << dp[i][j][k] << " ";
    //         }
    //         cout << endl;
    //     }
    //     cout << endl;
    // }
    
    ll ans = 0;
    for(int i = 1; i <= N; i++){
        ans += dp[N][i][i * A];
        // cout << dp[N][i][i * A] << " ";
    }
    // cout << endl;
    
    cout << ans << endl;
}

Measured memory_bytes: 95744
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int k, x;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> k >> x;
    for (int i = x - k + 1; i <= x + k - 1; i++) {
        if (-1000000 <= i && i <= 1000000) {
            cout << i << " ";
        }
    }
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
fn main() {

    let mut arr: [i32; 10] = [0; 10];

    for i in 0..arr.len() {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        arr[i] = s.trim_right().parse().unwrap();
    }
    arr.sort();
    for i in 0.. 3 {
        println!("{:?}", arr[arr.len() - i - 1])
    }
}



Measured memory_bytes: 5032
s = input()
t = input()

ans = "Yes"
for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        ans = "No"
if ans == "Yes" and (len(s)+1) == len(t):
    ans = "Yes"
else:
    ans = "No"

print(ans)

Measured memory_bytes: 9000
def main():
    S = input()

    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            print(str(i+1) + ' ' + str(i+2))
            exit()
    
    for i in range(len(S)-2):
        if S[i] == S[i+2]:
            print(str(i+1) + ' ' + str(i+3))
            exit()

    print('-1 -1')



if __name__ == "__main__":
    main()

Measured memory_bytes: 39408
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
    int n,ci=1,i;
    cin>>n;
    int a[n+1],b[n+1],c[n];
    for(i=1; i<=n; i++)cin>>a[i];
    for(i=1; i<=n; i++)cin>>b[i];
    for(i=1; i<n; i++)cin>>c[i];
    lli total=0;
    total=b[a[1]];
    for(i=2; i<=n; i++)
    {
        total+=b[a[i]];
        if((a[i]-a[i-1])==1)
            total+=c[a[i-1]];

    }
    cout<<total<<endl;
}


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

object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val input = readLine().split(" ")
    val n = input(0).toInt
    val m = input(1).toInt
    val mod = 1000000007

    if (math.abs(n - m) > 1) {
      println(0)
    } else {
      if (math.abs(n - m) == 0) {
        println(modfactrial(n, mod) * modfactrial(m, mod) % mod * 2 % mod)
      } else {
        println(modfactrial(n, mod) * modfactrial(m, mod) % mod)
      }
    }
  }

  def modfactrial(n: Int, mod: Long): Long = {
    var result = 1L
    for (i <- 1 to n) {
      result = (result * i.toLong) % mod
    }

    return result;
  }
}


Measured memory_bytes: 27080
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

static const int INFTY = 1000;

int main() {
	string s;
	int len;
	cin >> s;
	len = s.length();

	int maxv[26];
	REP(i, 26) maxv[i] = 0;

	int sto;
	int ans = INFTY;
	char c;
	for (int i = 0;i < 26;i++) {
		sto = 0;
		c = 'a' + i;

		for (int j = 0;j < len;j++) {
			if (s[j] == c) {
				maxv[i] = max(maxv[i], sto);
				sto = 0;
			}
			else {
				sto++;
			}
		}
		maxv[i] = max(maxv[i], sto);//最後にcがなかった時用

		//cout << maxv[i] << endl;

		ans = min(ans, maxv[i]);

	}

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

Measured memory_bytes: 256
console.log((args=>{
  const [[N],A] = args.trim().split`\n`.map(r=>r.split` `.map(v=>v|0));
  const MOD = 1e9+7;
  const mul = (a,b) => ((a>>16)*b%MOD*65536+(a&65535)*b)%MOD;
  let sum = 0, sub = A.reduce((a,b)=>(a+b)%MOD);
  for ( let i = 0; i < N; i++ ) {
    sub = ( sub + MOD - A[i] ) % MOD;
    sum = (sum + mul(A[i],sub)) % MOD;
  }
  return sum;
})(require('fs').readFileSync('/dev/stdin','utf8')));


Measured memory_bytes: 50248
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,a,b;
    cin>>n;
    a=n/10;
    b=n%10;
    if(a==9||b==9)
    {
        printf("Yes\n");
    }
    else
        printf("No\n");
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	Main(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		for(int k = 0; k < n; k++){
			String str = sc.next(), st;
			boolean f = false;
			int l = str.length();
			while(l > 1){
				if(l > 2){
					st = str.substring(0, l-2);
				} else {
					st = "";
				}
				int s = Integer.parseInt(str.substring(l-2, l-1));
				int t = Integer.parseInt(str.substring(l-1, l));
				str = st + Integer.toString(s+t);
				l = str.length();
				f = !f;
			}
			if(f){
				str = "Fabre wins.";
			} else {
				str = "Audrey wins.";
			}
			System.out.println(str);
		}
	}
	
	public static void main(String[] args){
		new Main();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 2800

ll table[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int base_week;
ll BASE;

bool is_leap(int year){

	if(year%4 == 0){

		if(year%400 == 0){

			return true;
		}else if(year%100 == 0){

			return false;

		}else{

			return true;
		}

	}else{

		return false;
	}
}

ll calc(ll year,ll month,ll day){

	if(year == 1 && month == 1 && day == 0){
		return 0;
	}

	if(day == 0){ //1日を投げてきた場合

		if(month == 1){

			year--;
			month = 1;
			day = 31;

		}else if(month == 3){

			month = 2;

			if(is_leap(year)){

				day = 29;

			}else{

				day = 28;
			}

		}else{

			month--;
			day = table[day];
		}
	}

	ll ret = ((year-1)/2800)*BASE;
	year = (year-1)%2800+1;

	ll tmp_year = 1,tmp_day = 1,tmp_month = 1,tmp_week = base_week;

	while(tmp_year != year || tmp_month != month || tmp_day != day){

		if(tmp_month == 2){

			if(tmp_day <= 27){

				tmp_day++;

			}else if(tmp_day == 28){

				if(is_leap(tmp_year)){

					tmp_day++;

				}else{

					tmp_day = 1;
					tmp_month = 3;
				}

			}else if(tmp_day == 29){

				tmp_day = 1;
				tmp_month = 3;
			}

		}else if(tmp_month == 12){

			if(tmp_day <= 30){

				tmp_day++;

			}else{

				tmp_year++;
				tmp_month = 1;
				tmp_day = 1;
			}

		}else{

			if(tmp_day == table[tmp_month]){

				tmp_day = 1;
				tmp_month++;

			}else{

				tmp_day++;
			}
		}

		tmp_week = (tmp_week+1)%7;

		if(tmp_day == 13 && tmp_week == 4){
			ret++;
		}
	}

	return ret;
}

int main(){

	int year = 2015,month = 3, day = 15,week_day = 6;

	//1年1月1日の曜日を調べる
	while(year != 1 || month != 1 || day != 1){

		if(day == 1){

			if(month == 3){

				month--;

				if(is_leap(year)){

					day = 29;

				}else{

					day = 28;
				}

			}else if(month == 1){

				year--;
				month = 12;
				day = 31;

			}else{

				month--;
				day = table[month];
			}

		}else{

			day--;
		}

		if(week_day == 0){

			week_day = 6;
		}else{

			week_day--;
		}
	}

	base_week = week_day; //1年1月1日の曜日

	ll base = 0;
	//1年1/1～2800年3/31までの、13日の金曜日を数える
	while(year < 2801){

		if(month == 2){

			if(day <= 27){

				day++;

			}else if(day == 28){

				if(is_leap(year)){

					day++;

				}else{

					day = 1;
					month = 3;
				}

			}else if(day == 29){

				day = 1;
				month = 3;
			}

		}else if(month == 12){

			if(day <= 30){

				day++;

			}else{

				year++;
				month = 1;
				day = 1;
			}

		}else{

			if(day == table[month]){

				day = 1;
				month++;

			}else{

				day++;
			}
		}

		week_day = (week_day+1)%7;

		if(day == 13 && week_day == 4){
			base++;
		}
	}

	BASE = base;
	//printf("BASE:%lld\n",BASE);

	ll start_year,start_month,start_day;
	ll end_year,end_month,end_day;

	scanf("%lld %lld %lld %lld %lld %lld",&start_year,&start_month,&start_day,&end_year,&end_month,&end_day);

	printf("%lld\n",calc(end_year,end_month,end_day)-calc(start_year,start_month,start_day-1));

	return 0;
}



Measured memory_bytes: 3232
import java.util.*;
 
public class Main {
	Scanner sc = new Scanner(System.in);
 
	public static void main(String[] args) {
		new Main();	
	}
 
	public Main() {
		new aoj510().doIt();
	}
	class aoj510{
		void doIt(){
			boolean num[] = new boolean[31];
			for(int i = 0;i < 28;i++)num[sc.nextInt()] = true;
			for(int i = 1;i < 31;i++)if(!num[i])System.out.println(i);
		}
	}
}

Measured memory_bytes: 26172
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#define int long long
using namespace std;

long long mod = 1 << 31;

int power2(int n) {
  int p = 1;
  for (int i = 0; i < n; i++) {
    p *= 2;
  }
  return p;
}

int exor(unsigned a[], int k) {
  for (int i = 0; i < 8; i++) {
    a[i] = a[i] ^ k;
  }
}

int sum(unsigned a[]) {
  int s = 0;
  for (int i = 0; i < 8; i++) {
    s += a[i];
    s %= (mod * 2);
  }
  return s;
}

int calc(unsigned a[]) {
  int ans = 0;
  for (int i = 0; i < 32; i++) {
    int p = (sum(a) / power2(i)) % 2;
    int q = (a[8] / power2(i)) % 2;

    if (p != q) {
      ans += power2(i);
      exor(a, power2(i));
    }
  }
  return ans;
}

signed main() {
  int s;
  cin >> s;
  for (int times = 0; times < s; times++) {
    unsigned n[9];
    for (int i = 0; i < 9; i++) {
      scanf("%x", &n[i]);
    }

    unsigned ans_d = calc(n);
    printf("%x\n", ans_d);
  }

  return 0;
}

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

int main(){
    string a; cin >> a;
    vector<int64_t> c(26, 0); for (char i : a) c[i - 'a']++;
    int64_t ans = (int64_t)a.size() * ((int64_t)a.size() - 1) / 2 + 1;
    for (auto i = 0; i < 26; i++) ans -= c[i] * (c[i] - 1) / 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n), b(n, 0);
  vector<ll> res(n, 0);
  rep(i, n) cin >> a[i];
  k = min(50LL, k);
  rep(j, k) {
    fill(ALL(b), 0);
    rep(i, n) {
      int l = max(0LL, i - a[i]);
      int r = min(n - 1, i + a[i]);
      b[l]++;
      if (r + 1 < n) b[r + 1]--;
    }
    repz(i, 1, n) b[i] += b[i - 1];
    swap(a, b);
  }
  rep(i, n) {
    cout << a[i];
    if (i != n - 1) cout << " ";
    else cout << endl;
  }
  return 0;
}


Measured memory_bytes: 7920
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    ll a,b;
    cin >> a >> b;
    if(a<=0&&b>=0) cout << "Zero" << endl;
    else if(a>0) cout << "Positive" << endl;
    else if(a<0){
        ll c=b-a;
        if(c%2==0) cout << "Negative" << endl;
        else cout << "Positive" << endl;
    }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	int n, m, k; cin >> n >> m >> k;
	int pre_a[n + 1] = {};
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		pre_a[i + 1] = pre_a[i] + x;
	}
	int pre_b[m + 1] = {};
	for (int i = 0; i < m; i++) {
		int x; cin >> x;
		pre_b[i + 1] = pre_b[i] + x;
	}
	int ans = 0;
	for (int i = 0; i < n + 1; i++) {
		int ex = k - pre_a[i];
		if (ex >= 0) {
			int j = upper_bound(pre_b, pre_b + m + 1, ex) - pre_b - 1;
			ans = max(ans, i + j);
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  string s;
  cin >>s;
  ll ss=s.size(),o=0,l=0;
  for(ll i=0;i<ss;i++){
    if(s[i]=='0') o++;
    else l++;
  }
  cout <<ss-abs(o-l)<<endl;
}


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

#define int long long
#define pii pair<int, int>
#define pb push_back

char get(char x, char y){
    string p = "RBG";
    for(auto z : p){
        if( z != x && z != y) return z;
    }
    return p[0];
}

signed main(){

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    int pre_r[n + 1], pre_g[n + 1], pre_b[n + 1];
    pre_r[n] = 0, pre_b[n] = 0, pre_g[n] = 0;
    for(int i = s.size() - 1; i >= 0; i --){
        pre_r[i] = pre_r[i + 1] + (s[i] == 'R');
        pre_g[i] = pre_g[i + 1] + (s[i] == 'G');
        pre_b[i] = pre_b[i + 1] + (s[i] == 'B');
    }
    for(int i = 0; i < n; i++) s.pb('!');
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(s[i] == s[j]) continue;
            char y = get(s[i], s[j]);
            if(y == 'R'){
                ans += pre_r[j + 1];
                ans -= (s[2*j -i] == 'R');
            }

            if(y == 'B'){
                ans += pre_b[j + 1];
                ans -= (s[2*j -i] == 'B');
            }

            if(y == 'G'){
                ans += pre_g[j + 1];
                ans -= (s[2*j -i] == 'G');
            }
        }
    }
    cout << ans << endl;

    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    vector<int> a(3*N);
    for (auto &i : a) cin >> i;

    sort(a.begin(), a.end(), greater<int>());

    ll ans = 0;
    rep(i, N) {
        int j = i*2+1;
        ans += a[j];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1408
#include<cstdio>
#define FOR(i, a, b) for (i = a; i < b; ++i)
#define FOR_I(i, a, b) for (int i = a; i < b; ++i)

using namespace std;

int main()
{
  int n;
  int a[100010];
  int d[100010];
  a[0] = 0;
  scanf("%d\n%d", &n, a + 1);
  int i;
  FOR(i, 2, n + 1) {
    scanf(" %d", a + i);
  }
  a[n + 1] = 0;
  FOR(i, 1, n + 2) {
    d[i] = a[i] > a[i - 1] ? a[i] - a[i - 1] : a[i - 1] - a[i];
  }
  long t = 0;
  FOR(i, 1, n + 2) {
    t += d[i];
  }
  FOR(i, 1, n + 1) {
    long r = t;
    if (!(((a[i - 1] > a[i]) && (a[i] > a[i + 1])) || ((a[i - 1] < a[i]) && (a[i] < a[i + 1])) || (a[i - 1] == a[i]) || (a[i] == a[i + 1]))) {
      int j;
      if (a[i - 1] < a[i]) {
        if (a[i - 1] > a[i + 1]) {
          j = a[i] - a[i - 1];
        } else {
          j = a[i] - a[i + 1];
        }
      } else {
        if (a[i - 1] < a[i + 1]) {
          j = a[i - 1] - a[i];
        } else {
          j = a[i + 1] - a[i];
        }
      }
      r -= 2 * j;
    }
    printf("%ld\n", r);
  }
  return 0;
}

Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		if (s.matches("[A-Z]")) {
			System.out.println("A");
		} else {
			System.out.println("a");
		}
	}
}


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

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    //xの根を求める
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    //xの重みを計算する
    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    
    bool same(int x, int y) {
        return root(x) == root(y);
    }

    //x,yを重みwでマージする
    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    //xとyの差を計算する
    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};


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

    int n,q;
    cin>>n>>q;
    UnionFind<int> uni(n);
    for(int qq=0;qq<q;qq++){
        int a;
        cin>>a;
        if(a==0){
            int x,y,z;
            cin>>x>>y>>z;
            uni.merge(x,y,z);
        }
        else {
            int x,y;
            cin>>x>>y;
            if(!uni.same(x,y)){
                cout<<"?"<<endl;
            }
            else cout<<uni.diff(x,y)<<endl;
        }
    }
    

}


Measured memory_bytes: 4164
from math import ceil

n, h = map(int, input().split())
A = []
B = []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

B.sort(reverse=True)
max_A = max(A)

answer = 0
for b in B:
    if max_A < b:
        h -= b
        answer += 1
    if h <= 0:
        break
if h > 0:
    answer += ceil(h/max_A)

print(answer)


Measured memory_bytes: 11316
#include<cstdio>
#define LL long long
#define mod 1000000007
using namespace std;
LL qmi(LL a,LL b)
{
	LL res=1;
	while(b)
	{
		if(b&1)res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}
int main()
{
	LL n;scanf("%lld",&n);
	printf("%lld",((qmi(10ll,n)-2*qmi(9ll,n)+qmi(8ll,n))%mod+mod)%mod);
	return 0;
}

Measured memory_bytes: 1696
N = int(input())
CSF = []
for i in range(N-1):
    CSF.append(list(map(int,input().split(" "))))

o = []
for i in range(N):
    s = 0
    while i < N - 1:
        C = CSF[i][0]
        S = CSF[i][1]
        F = CSF[i][2]
        s = (s//F+1)*F if s%F else s
        s = max(s,S)
        s += C
        i += 1
    o.append(s)

print('\n'.join(map(str,o)))

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

lint fac[510000],finv[510000],inv[510000];
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<510000;i++){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
lint COM(lint n,lint k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
lint facdiv(lint n,lint k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return (fac[n]*finv[k])%MOD;
}

lint powmod(lint a,lint b){
  return b?powmod(a*a%MOD,b/2)*(b%2?a:1)%MOD:1;
}

int main(void){
    COMinit();
    lint N,M,K;
    cin >> N >> M >> K;
    lint base[N+5]={};
    base[0]=(M*powmod(M-1,N-1))%MOD;
    for(int i=1;i<=N+2;i++) base[i]=(base[i-1]*powmod(M-1,MOD-2))%MOD;
    lint ans=0;
    if(M==1 && K+1==N){
        cout << 1 << endl;
        return 0;
    }
    for(int i=0;i<=K;i++){
        lint add=base[i];
        add=(add*COM(N-1,i))%MOD;
        ans=(ans+add)%MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 17084
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int R[205000];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&R[i]);
	}
    int maxv=-2000000000;
    int minv=R[1];
    for(int i=2;i<=n;i++){
	maxv=max(maxv,R[i]-minv);
    minv=min(minv,R[i]);
    }
    printf("%d\n",maxv);
} 


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

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

	long long int ans = 987654321987654321;
	vector<long long> neg;
	vector<long long> pos;
	for(int i = 0;i  < n;i++)
	{
		if(a[i] < 0)
			neg.push_back(abs(a[i]));
		else if(a[i]>0)
			pos.push_back(a[i]);
		else
			k--;
	}
	// for(auto x : neg) cout << x << endl;
	// cout << endl;
	// for(auto x : pos) cout << x << endl;
	// cout << endl;
	if(k == 0) ans = 0;
	for(int i = 0; i < neg.size(); i++)
	{
		long long now = neg[i];
		long long rem =  k - ((long long)neg.size() - i);
		if(rem > 0)
		{
			if(rem-1 < 0 || rem-1 >=pos.size()) continue;
			now = 2*now + pos[rem-1];	
		}
		//cout << a[i] << " : " << now << endl;
		ans = min(ans,now);
	}

	//cout << "Pos->" << endl;
	for(int i = 0;i < pos.size(); i++)
	{
		long long now = pos[i];
		long long rem = k - i - 1;
		if(rem > 0)
		{
			if((int)neg.size()-rem < 0 || (int)neg.size()-rem >= neg.size()) continue;
			now = 2*now + neg[(int)neg.size() - rem];
		}
		ans = min(ans,now);
	}

	cout << ans << endl;
}

Measured memory_bytes: 2424
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

int main() {
	ll A, V, B, W, T,un,eA,eB;
	cin >> A >> V >> B >> W >> T;
	string Ans;
	
	if (A < B) {
		eA = A + V * T;
		eB = B + W * T;
		if (eA >= eB) {
			cout << "YES" << endl;
			return 0;
		}
		else
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	else if(A > B){
		eA = A - V * T;
		eB = B - W * T;
		if (eA <= eB) {
			cout << "YES" << endl;
			return 0;
		}
		else
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	else
	{

		cout << "YES" << endl;
		return 0;
	}
}

Measured memory_bytes: 3160
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;


int main()
{
double w,h,x,y,z,k;
scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
double sum=0;
int t=0;
sum=w*h/2;
z=w/h;
if(y>x)
{
x=w-x;
}
k=x/y;
if(z==k)
t=1;
printf("%.6f %d\n",sum,t);




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


class FactorialMod{
    void calc_inverse(){
        inverse[0] = 0;
        inverse[1] = 1;
        for(int i=2; i<=max_num; i++){
            inverse[i] = MOD-((MOD/i)*inverse[MOD%i]%MOD);
        }
    }

    void calc_factorial_inverse(){
        factorial[0] = factorial_inverse[0] = 1;
        for (int i=1; i<=max_num; i++) {
            factorial[i] = (factorial[i-1]*i)%MOD;
            factorial_inverse[i] = (factorial_inverse[i-1]*inverse[i])%MOD;
        }
    }

    public:
        int max_num;
        vector<ll> inverse; 
        vector<ll> factorial;
        vector<ll> factorial_inverse;
        FactorialMod(int _max_num){
            max_num = _max_num;
            inverse = vector<ll>(max_num+1);
            factorial = vector<ll>(max_num+1);
            factorial_inverse = vector<ll>(max_num+1);
            calc_inverse();
            calc_factorial_inverse();
        }

        ll combination(int n, int k){
            return (((factorial[n]*factorial_inverse[k])%MOD)*factorial_inverse[n-k])%MOD;
        }

        ll multiChoose(int n, int k){
            return combination(n+k-1, k);
        }
};

int main(){
    int x, y;   cin >> x >> y;
    //重複組み合わせは配列倍(n+k)にする
    FactorialMod calc_mod(x+y);
    ll res=0;
    for(int i=0; i<=x; i++){
        ll cost = (x-i)/2;
        if(i+2*cost==x && cost+2*i==y){
            res = calc_mod.combination(i+cost, cost);
        }else if(x<i+2*cost && y<cost+2*i) break;
    }
    cout << res << endl;
}

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

UL D;
LL C[26];
LL S[400][26];

UL T[400];
set<UL> Appear[26];
LL Score[26] = {};
LL Sum = 0;

LL MaxScore = -1000000000;
UL ans[400];

mt19937 mt;

void CalcScore(UL i){
 Sum -= Score[i];
 Score[i]=0;
 UL Last = -1;
 auto itr = Appear[i].begin();
 for(; itr!=Appear[i].end(); itr++){
  LL intv = (*itr-1) - Last;
  Last = *itr;
  Score[i] -= C[i] * intv * (intv+1) >> 1;
  if(*itr == D) break;
  Score[i] += S[*itr][i];
 }
 Sum += Score[i];
}

void Change(){
 UL d = mt() % D;
 UL t = mt() % 26;
 UL TBuf = T[d]; T[d] = t;
 Appear[TBuf].erase(d);
 Appear[t].insert(d);
 CalcScore(TBuf);
 CalcScore(t);
 if (Sum <= MaxScore - 500) {
  T[d] = TBuf;
  Appear[t].erase(d);
  Appear[TBuf].insert(d);
  CalcScore(t);
  CalcScore(TBuf);
 }
 else if(MaxScore < Sum) {
  rep(d,D) ans[d] = T[d];
  MaxScore = Sum;
 }
}

void Swap(){
 UL d = mt() % (D-1);
 if(T[d]==T[d+1]) return;
 swap(T[d],T[d+1]);
 Appear[T[d]].erase(d+1); Appear[T[d]].erase(d);
 Appear[T[d+1]].erase(d); Appear[T[d+1]].erase(d+1);
 CalcScore(T[d]);
 CalcScore(T[d+1]);
 if (Sum <= MaxScore - 500) {
  swap(T[d],T[d+1]);
  Appear[T[d]].erase(d+1); Appear[T[d]].erase(d+1);
  Appear[T[d+1]].erase(d); Appear[T[d+1]].erase(d+1);
  CalcScore(T[d]);
  CalcScore(T[d+1]);
 }
 else if(MaxScore < Sum) {
  rep(d,D) ans[d] = T[d];
  MaxScore = Sum;
 }
}

void Step(){
 Change();
}

int main() {
 ULL StartP = clock();
 mt.seed(999999999);

 scanf("%u", &D);
 rep(i,26) scanf("%lld",&C[i]);
 rep(i,D)rep(j,26) scanf("%lld",&S[i][j]);
 
 rep(d,D) {
  UL k = mt()%26;
  T[d]=k; Appear[k].insert(d);
 }
 rep(d,D) Appear[T[d]].insert(d);
 rep(i,26) Appear[i].insert(D);
 
 rep(i,26) CalcScore(i);
 MaxScore = Sum;
 while(true){
  ULL CheckP = clock();
  if(CheckP-StartP > CLOCKS_PER_SEC * 3 / 2) break;
  Step();
 }
 
 rep(i,D) printf("%u\n", ans[i]+1);
 
 return 0;
}



Measured memory_bytes: 3924
#include <iomanip>
#include <iostream>

using namespace std;

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

    double result = 0;
    for (int i = 0; i < n; ++i) {
        double a;
        cin >> a;
        result += 1 / a;
    }
    result = 1 / result;
    cout << setprecision(16) << result << '\n';
}


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

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> s(m), c(m);
    rep(i,m) cin >> s[i] >> c[i];

    rep(i,1000) {
        bool ok = true;
        int tmp = i;
        rep(k,n-1) tmp /= 10;
        if(tmp == 0 && n > 1) continue;

        rep(j,m) {
            int tmp = i;
            rep(k,n-s[j]) tmp /= 10;
            if(tmp%10 != c[j]) {
                ok = false;
                break;
            }
        }
        if(ok) {
            cout << i << endl;
            return 0;
        } 
    }

    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	k := scanInt()

	ans := 0
	for i := k; i <= n+1; i++ {
		num1 := (0 + i - 1) * i / 2
		num2 := (n + n - i + 1) * i / 2
		ans += num2 - num1 + 1
		ans %= MOD
	}

	fmt.Fprintln(wr, ans)
}

// MOD constant
const MOD = 1000000007

func add(b, c int) int {
	a := (b + c) % MOD
	if a < 0 {
		a += MOD
	}
	return a
}
func sub(b, c int) int {
	a := (b - c) % MOD
	if a < 0 {
		a += MOD
	}
	return a
}
func mul(b, c int) int {
	a := (b * c) % MOD
	if a < 0 {
		a += MOD
	}
	return a
}
func div(b, c int) int {
	a, p, x, u := c, MOD, 1, 0
	for p != 0 {
		t := a / p
		a, p = p, a-t*p
		x, u = u, x-t*u
	}
	res := b * x % MOD
	if res < 0 {
		res += MOD
	}
	return res
}
func mpow(a, n int) int {
	res := 1
	for n > 0 {
		if n&1 == 1 {
			res = res * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return res
}


Measured memory_bytes: 1760
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

int main(){
  int H, W;
  std::cin>>H>>W;
  std::vector<std::string> a(H);

  for(auto i = a.begin();i != a.end();i++){
    std::cin>>*i;
  }

  std::vector<bool> row(H, false);
  std::vector<bool> col(W, false);
  for(int i = 0;i < H;i++){
    for(int j = 0; j < W;j++){
      if(a[i][j] == '#'){
        row[i] = true;
        col[j] = true;
      }
    }
  }
  for(int i = 0;i < H;i++){
    if(row[i]){
      for(int j = 0;j < W;j++){
        if(col[j]){
          std::cout<<a[i][j];
        }
      }
      std::cout<<std::endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int l, alpha[26] = {0}, i;
	char s;
	while((i = scanf("%c", &s)) != EOF){
		if(s == '\0') break;
		alpha[s - 'a'] ++;
	}
	for(i = 0 ; i < 26 ; i ++){
		if(alpha[i] % 2 != 0){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    string s; cin >> s;
    vector<char> ans;

    rep(i,s.size()){
        if(s[i] == '0' || s[i] == '1'){
            ans.push_back(s[i]);
        }
        else{
            if(ans.size() != 0) ans.pop_back();
            else continue;
        }
    }

    rep(i,ans.size()) cout << ans[i];

    cout << endl;
}

Measured memory_bytes: 256