akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define PER(i, x, y) for(ll i = x; i > y; i--)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll num[13];
bool used[24];
ll ans = 0;

void solve(ll n) {
    if (n < 12) {
        if (num[n] == 0) {
            used[n] = false;
            used[24 - n] = false;
            solve(n + 1);
        } else if (num[n] == 1) {
            used[n] = true;
            used[24 - n] = false;
            solve(n + 1);
            used[n] = false;
            used[24 - n] = true;
            solve(n + 1);
        } else {
            used[n] = true;
            used[24 - n] = true;
            solve(n + 1);
        }
    } else {
        ll dis = 20;
        ll tmp = 0;
        REP(i, 1, 24) {
            if (used[i]) {
                dis = min(dis, i - tmp);
                tmp = i;
            }
        }
        dis = min(dis, 24 - tmp);
        ans = max(ans, dis);
    }
}

int main() {
    ll N;
    cin >> N;
    ll D[N];
    fill(num, num + 13, 0);
    REP(i, 0, N) {
        cin >> D[i];
        num[D[i]]++;
    }
    if (num[0] != 0 || num[12] > 1) {
        cout << 0 << endl;
        return 0;
    }
    REP(i, 1, 12) {
        if (num[i] > 2) {
            cout << 0 << endl;
            return 0;
        }
    }
    used[0] = true;
    if (num[12] > 0) {
        used[12] = true;
    } else {
        used[12] = false;
    }
    solve(1);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define fi first
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
namespace IO{
	const int L=1<<15;char ibuf[L|1],*iS=ibuf,*iT=ibuf,obuf[L|1],*oS=obuf,*oT=obuf+L,c,st[66];int tp=0,f;
	inline char gc(){if(iS==iT) iT=(iS=ibuf)+fread(ibuf,sizeof(char),L,stdin);return (*iS++);}
	inline void flush(){fwrite(obuf,sizeof(char),oS-obuf,stdout);oS = obuf;}
	inline void pc(char c){*oS++=c;if(oS==oT) flush();}
	#define gc getchar
	#define pc putchar
	inline ll read(){ll x=0;f=1,c=gc();for(;!isdigit(c);c=gc())if(c=='-')f=-1;for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c&15);return x*f;}
	inline void write(ll x){if(!x) pc('0');if(x<0) pc('-'),x=-x;while(x) st[++tp]=x%10+'0',x/=10;while(tp) pc(st[tp--]);}
	inline void writeln(ll x){write(x);pc('\n');}
	inline void wri(ll x){write(x),pc(' ');}
	struct IOflusher{~IOflusher(){flush();}}_ioflusher_;
}using IO::read;using IO::write;using IO::writeln;using IO::wri;
const int maxn = 1e5+233;
ll a[maxn],b[maxn],ans,suma,sumb;
int n;
vector<pair<ll,ll> > V;
bool vis[maxn];
int main(){
	n = read();
	rep(i,0,n){
		a[i] = read(),b[i] = read();
		ans += a[i] + b[i];
		suma += a[i];
		sumb += b[i];
		V.push_back(make_pair(a[i],i));
		V.push_back(make_pair(b[i],i));
	}
	ll res = max(suma,sumb);
	sort(V.begin(),V.end(),greater<pair<ll,ll> >());
	mem(vis,false);
	bool flag = false;
	ll sum=0;
	rep(i,0,n){
		if(vis[V[i].se]){
			flag = true;
		}
		sum += V[i].fi;
		vis[V[i].se] = true;
	}
	if(flag){
		res = max(res,sum);
	} else{
		for(int i=n;i<(n<<1);++i){
			if(V[n-1].se == V[i].se){
				res = max(res,sum+V[i].fi-V[n-2].fi);
			} else{
				res = max(res,sum+V[i].fi-V[n-1].fi);
			}
		}
	}
	writeln(ans-res);
	return 0;
}

Measured memory_bytes: 7536
module ABC134

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_C

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_C (len_sequence, val_sequence)

    ! arguments for this <subroutine>
    integer(INT32), intent(in) :: len_sequence
    integer(INT32), intent(in) :: val_sequence(:)

    ! arrays for this <subroutine>
    integer(INT32), allocatable :: maxval_left (:)
    integer(INT32), allocatable :: maxval_right(:)

    ! support variables for this <subroutine>
    integer(INT32) :: itr

    ! STEP.01
    ! allocate the array to store the maximum values
    allocate( maxval_left (0_INT32:len_sequence - 1_INT32) )
    allocate( maxval_right(2_INT32:len_sequence + 1_INT32) )

    ! STEP.02
    ! initialize the array to store the maximum values
    maxval_left (0_INT32               ) = 0_INT32
    maxval_right(len_sequence + 1_INT32) = 0_INT32

    ! STEP.03
    ! search the maximum values of the given sequence

    do itr = 1_INT32, len_sequence - 1_INT32, 1_INT32
      maxval_left(itr) = max( maxval_left(itr - 1_INT32), val_sequence(itr) )
    end do

    do itr = len_sequence, 2_INT32, -1_INT32
      maxval_right(itr) = max( maxval_right(itr + 1_INT32), val_sequence(itr) )
    end do

    ! STEP.04
    ! output the answer of this task
    do itr = 1_INT32, len_sequence, 1_INT32
      write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') max( maxval_left(itr - 1_INT32), maxval_right(itr + 1_INT32) )
    end do

    ! STEP.05
    ! deallocate the array to store the maximum values
    deallocate( maxval_left  )
    deallocate( maxval_right )

    ! STEP.END
    return

  end subroutine task_C

end module ABC134


program main

  ! <module>s to import
  use, non_intrinsic :: ABC134

  ! require all variables to be explicitly declared
  implicit none

  ! variables for this <program>
  integer(INT32) :: N

  ! arrays for this <program>
  integer(INT32), allocatable :: A(:)

  ! support variables for this <program>
  integer(INT32) :: itr

  ! STEP.01
  ! read out the length of the given sequence
  read(unit=INPUT_UNIT, fmt=*) N

  ! STEP.02
  ! allocate the array to store the given sequence
  allocate( A(1_INT32:N) )

  ! STEP.03
  ! read out the values of the given sequence
  do itr = 1_INT32, N, 1_INT32
    read(unit=INPUT_UNIT, fmt=*) A(itr)
  end do

  ! STEP.04
  ! calculate & output the answer of this task
  call task_C (N, A(:))

  ! STEP.05
  ! deallocate the array to store the given sequence
  deallocate( A )

end program main

Measured memory_bytes: 3968
#include<iostream>
#include<cstdio>
#include<cstring>

typedef long long ll;
const int N=2001000,MOD=1000000007;

ll qpow(ll a,ll b){ll c=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)c=c*a%MOD;return c;}

int fact[N],ifact[N];

int C(int n,int m)
{
	if(n<m)return 0;
	return (ll)fact[n]*ifact[m]%MOD*ifact[n-m]%MOD;
}

int f(int n,int k)
{
	return C(n-k+1,k);
}

int n;

int main()
{
	fact[0]=1;
	for(int i=1;i<N;i++)fact[i]=(ll)fact[i-1]*i%MOD;
	ifact[N-1]=qpow(fact[N-1],MOD-2);
	for(int i=N-1;i;i--)ifact[i-1]=(ll)ifact[i]*i%MOD;

	scanf("%d",&n);

	int ans=(ll)fact[n-1]*(n-1)%MOD;

	for(int k=1;k<n;k++)
	{
		ans=(ans-(ll)f(n-3,k)*fact[n-k-1]%MOD*fact[k]%MOD)%MOD;
	}

	ans=(ans+MOD)%MOD;
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 15872
a = list(map(str,input()))
b = list(map(str,input()))
c = list(map(str,input()))
s = a.pop(0)
while True:
  if a == [] and s == "a":
    print("A")
    exit()
  elif b == [] and s == "b":
    print("B")
    exit()
  elif c == [] and s == "c":
    print("C")
    exit()
  if s == "a":
    s = a.pop(0)
  elif s == "b":
    s = b.pop(0)
  elif s == "c":
    s = c.pop(0)
  

Measured memory_bytes: 8952
h,w,d = map(int,input().split())
lst = [0]*(h*w+1)
for i in range(h):
    a = list(map(int,input().split()))
    for j in range(w):
        lst[a[j]] = (i,j)
cost = [0]*(h*w+1)
for t in range(1,d+1):
    now = t
    while now <= h*w-d:
        nxt = now+d
        x0,y0 = lst[now]
        x1,y1 = lst[nxt]
        cost[nxt] = cost[now]+abs(x0-x1)+abs(y0-y1)
        now += d
q = int(input())
for i in range(q):
    l,r = map(int,input().split())
    print(cost[r]-cost[l])

Measured memory_bytes: 81288
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    set<ll> S;
    ll n;
    cin>>n;
    vector<ll> ans(n*n,-1);
    for(int i=0;i<n*n;i++){S.insert(i);}
    vector<pll> A(n);
    for(int i=0;i<n;i++){cin>>A[i].F; A[i].S=i+1; A[i].F--;}
    sort(A.begin(),A.end());
    for(int i=0;i<n;i++){
        ll cnt=1;
        for(auto I=S.begin();I!=S.end() && (*I)<A[i].F && cnt<A[i].S;){
            ans[(*I)]=A[i].S;
            I=S.erase(I);
            cnt++;
        }
        if(cnt!=A[i].S){cout<<"No"<<endl; return 0;}
        ans[A[i].F]=A[i].S;
        S.erase(A[i].F);
    }
    
    reverse(A.begin(),A.end());
    for(int i=0;i<n;i++){
        if(A[i].S==n){continue;}
        ll cnt=0;
        auto I=S.end();
        --I;
        for(;cnt<n-A[i].S && *I>A[i].F;--I,cnt++){
            ans[*I]=A[i].S;
            I=S.erase(I);
            if(I==S.begin()){cnt++; break;}
        }
        if(cnt!=n-A[i].S){cout<<"No"<<endl; return 0;}
    }
    
    cout<<"Yes"<<endl;
    for(int i=0;i<n*n;i++){
        cout<<ans[i];
        if(i+1!=n*n){cout<<" ";}
    }
    cout<<endl;
    
    
    return 0;
}


Measured memory_bytes: 14848
#include<bits/stdc++.h>
using namespace std;
string s[101];
int main(){
    int n,L; cin>>n>>L;
    for(int i=1;i<=n;i++){
    	cin>>s[i];	
	}sort(s+1,s+n+1);
	for(int i=1;i<=n;i++){
		cout<<s[i];
	}cout<<endl;return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<string, string> sP;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int px[6] = { 0,1,-1,1,0,1 }, py[6] = { -1,-1,0,0,1,1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second



int main() {
	ll n, k, a[5010] = {0}, ans = 0;
	cin >> n >> k;
	for (int i = 1;i <= n;i++)cin >> a[i];
	sort(a+1, a + n+1);
	int l = 0, r = n + 1, mid;
	while (r - l > 1) {
		mid = (r + l) / 2;
		bool dp[5010][5010] = { 0 };
		dp[0][0] = 1;
		for (int i = 1;i <= n;i++) {
			for (int j = 0;j <= k;j++) {
				if (dp[i - 1][j])dp[i][j] = 1;
				if (i == mid)continue;
				if (dp[i - 1][j] && j + a[i] <= k)dp[i][j + a[i]] = 1;
			}
		}
		bool fl = 0;
		for (int i = max(0LL,k - a[mid]);i < k;i++) {
			if (dp[n][i])fl = 1;
		}
		if (fl)r = mid;
		else l = mid;
	}
	for (int i = 1;i <= n;i++) {
		if (a[i] <= a[l])ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 24832
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>



int main() {

	int size;

	std::cin >> size;

	int a[100];

	for (int i = 0; i < size; i++) {
		std::cin >> a[i];
	}

	//初期書き出し
	for (int i = 0; i < size; i++) {
		printf("%d", a[i]);
		if (i + 1 != size)printf(" ");
	}
	printf("\n");
	//初期書き出し終わり

	int temp;
	for (int i = 1; i < size; i++) {
		for (int j = i; j > 0; j--) {
			if (a[j] < a[j - 1]) {
				temp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = temp;
			}else {
				break;
			}
		}

		//書き出し
		for (int i = 0; i < size; i++) {
			printf("%d", a[i]);
			if (i + 1 != size)printf(" ");
		}
		printf("\n");
		//書き出し終わり
	}


	//system("pause");
	return 0;
}


Measured memory_bytes: 3192
t = input()

from collections import deque

d = deque(list(t))
l = []
k_0 = "X"

for i in range(len(t)):
    k = d.popleft()
    if k != "?":
        l.append(k)
        k_0 = k
    else:
        l.append("D")
        k_0 = "D"

print("".join(l))


Measured memory_bytes: 12468
import java.util.*;

 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double d = sc.nextDouble();
		double t = sc.nextDouble();
		double s = sc.nextDouble();

		if(d / s <= t)
		System.out.println("Yes");
		else
		System.out.println("No");
	}
}

Measured memory_bytes: 37252
A, B, C = map(int,input().split())
K = int(input())

ans = 'No'
if A < B < C:
    ans = 'Yes'

res = 0
while A >= B:
    B *= 2
    res += 1

if B < C and res <= K:
    ans = 'Yes'

while B >= C:
    C *= 2
    res += 1

if res <= K:
    ans = 'Yes'

print(ans)


Measured memory_bytes: 9184
#include <stdio.h>
 
 
int main()
{
  //n<=20, q<=200
   
  int n, q, i, j, num, m;
  int A[2001]={1};
   
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &num);
    for(j=2000-num; j>=0; j--){
      if(A[j])
        A[j+num] = 1;
    }
  }
     
  scanf("%d", &q);
  for(i=0; i<q; i++){
    scanf("%d", &m);
    if(A[m])
      puts("yes");
    else
      puts("no");
  }
   
  return 0;
}

Measured memory_bytes: 2696
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>

int main() {

	int N, X;
	std::cin >> N >> X;

	std::vector<int> M(N);

    for (int i = 0; i < N; i++)std::cin >> M[i];

	int len_M = M.size();
	int sum_M = std::accumulate(M.begin(), M.end(), 0);

	X -= sum_M;

	int M_min;
	M_min = *std::min_element(M.begin(), M.end());

	int ans = X / M_min;
	ans += len_M;

	std::cout << ans << std::endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.begin(), c.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
#define Sort(a) sort(Range(a));
#define DeSort(a) sort(RevRange(a));

using namespace std;
using ll = long long;

int main(void){
    Cin(string, a);
    a[5] = a[13] = ' ';
    Cout(a);
    //Cout(() ? "Yes" : "No");
    //Cout(() ? "YES" : "NO");
}

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

using namespace std;

struct node{
    string s = "";
    int vote = 0;
};
vector <node> book;

bool cmp(node a, node b){
    if(a.vote!=b.vote)
        return a.vote > b.vote;
    return a.s < b.s;
}
vector <string> ticket;
int main(){
    int n;
    cin>>n;
    for(int i = 0; i < n; i ++){
        string s;
        cin>>s;
        ticket.push_back(s);
    }
    sort(ticket.begin(), ticket.end());
    node a;
    a.s = ticket[0];
    a.vote = 0;
    for(int i = 0; i < ticket.size(); i++){
        if(a.s!=ticket[i]){
            book.push_back(a);
            a.s=ticket[i];
            a.vote=1;
        }
        else{
            a.vote++;
        }
        //cout<<i<<" : " <<a.s<<" + 1"<<endl;
    }
    book.push_back(a);
    sort(book.begin(), book.end(), cmp);
    int highest = book[0].vote;
    int all = 0;
    for(int i = 0; i < book.size(); i++){
        if(book[i].vote == highest)
            all = i;
        else
            break;
    }
    for(int i = 0; i <= all; i++){
        cout<<book[i].s<<endl;
    }
    /*for(int i = 0; i < book.size(); i++){
        cout<<book[i].vote<<endl;
    }*/
}


Measured memory_bytes: 18672
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
from math import hypot, sqrt

vertexs = []
for line in stdin:
    vertexs.append(tuple(float(s) for s in line.split(',')))

s = 0.0
x0, y0 = vertexs[0]
for i in range(1, len(vertexs)-1):
    x1, y1 = vertexs[i]
    x2, y2 = vertexs[i+1]

    a = hypot(x0 - x1, y0 - y1)
    b = hypot(x1 - x2, y1 - y2)
    c = hypot(x2 - x0, y2 - y0)
    z = (a + b + c) / 2.0
    s += sqrt(z * (z-a) * (z-b) * (z-c))
print('{:.6f}'.format(s))

Measured memory_bytes: 4488
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int a[12];
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == 'B')
		{
			int j = 1;
			while (true)
			{
				if (s[i-j]!=3&&s[i-j]!='B')
				{
					s[i - j] = 3;
					break;
				}
					j++;
			}
		}

	}
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == '1' || s[i] == '0')
		{
			cout << s[i];
		}
	}
	return 0;
}

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

int n,a[105];

int main() {
	cin>>n;
	for (int i=0;i<n;i++) cin>>a[i];
	for (int i=n-1;i>=0;i--) if (i==n-1) cout<<a[i];
	else cout<<' '<<a[i];
	cout<<'\n';
}


Measured memory_bytes: 3076
package main

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

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
        sc.Scan()
        return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
        buf := make([]byte, 0, 1000000)
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func strSprit(str string) []string {
        cols := strings.Split(str, " ")
        return cols
}

func parseInt(str string) int {
        n, _ := strconv.Atoi(str)
        return n
}

func intSprit(str string) []int {
        strs := strSprit(str)
        cols := make([]int, len(strs))
        for i, v := range strs {
                cols[i] = parseInt(v)
        }
        return cols
}

type SortSlice []int

func (s SortSlice) Len() int {
        return len(s)
}

func (s SortSlice) Swap(i, j int) {
        s[i], s[j] = s[j], s[i]
}

func (s SortSlice) Less(i, j int) bool {
        return s[i] < s[j]
}

func reverseString(str string) string {
        buf := []rune(str)
        for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 {
                buf[i], buf[j] = buf[j], buf[i]
        }
        return string(buf)
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
        s := nextLine()
        t := nextLine()

        if s == t {
                fmt.Println("Yes")
                return
        }

        for i := 0; i < len(s); i++ {
                s = string(s[len(s)-1]) + s[:len(s)-1]
                if s == t {
                        fmt.Println("Yes")
                        return
                }
        }
        fmt.Println("No")

}


Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 3050;

long long binpow(long long x, long long p, int mod) {
  long long res = 1;
  while (p) {
    if (p & 1) {
      res = (res * x) % mod;
      p--;
    } else {
      x = (x * x) % mod;
      p /= 2;
    }
  }
  return res % mod;
}

int mod = (int) 1e9 + 7;

long long inv(long long x) {
  return binpow(x, mod - 2, mod) % mod;
}

long long f[MAXN], invF[MAXN];

long long cnk(long long n, long long k) {
  long long res = 1ll * f[n] * invF[k] % mod;
  res = res * invF[n - k] % mod;
  return res;
}

int subMod(int a, int b) {
  int res = a - b;
  return res < 0 ? res + mod : res;
}

int n;
long long dp[MAXN];
long long dp2[MAXN][MAXN];

int main() { 

  scanf("%d %d", &n, &mod);

  f[0] = 1; invF[0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i] = 1ll * i * f[i - 1] % mod;
    invF[i] = inv(f[i]);
  }

  dp2[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0) {
        dp2[i][j] = 1;
        continue;
      }
      dp2[i][j] = (dp2[i - 1][j] + dp2[i - 1][j - 1]) % mod;
      dp2[i][j] = (dp2[i][j] + 1ll * dp2[i - 1][j] * j % mod) % mod;
    }
  }

  for (int i = 0; i <= n; i++) {
    long long mul = binpow(2, binpow(2, n - i, mod - 1), mod) % mod;
    for (int j = 0; j <= i; j++) {
      long long cur = dp2[i][j];
      cur = cur * binpow(2, j * (n - i), mod) % mod;
      cur = cur * mul % mod;
      dp[i] = (dp[i] + cur) % mod;
    }
  }

  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    long long cur = cnk(n, i) * dp[i] % mod;
    if (i % 2 == 0) {
      ans = (ans + cur) % mod;
    } else {
      ans = subMod(ans, cur) % mod;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 70272
N = gets.chomp.to_i

ans = (N * (N + 1)) / 2
# puts ans

numOf3s = N / 3
numOf5s = N / 5
numOf15s = N / 15

threes = 0
fives = 0
fifteens = 0

for i in 1..numOf3s do
    threes += i * 3
end

for i in 1..numOf5s do
    fives += i * 5
end

for i in 1..numOf15s do
    fifteens += i * 15
end

# puts threes, fives, fifteens

ans = ans - threes - fives + fifteens

puts ans


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

using ll = long long;

#define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
#define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

int N;
ll dp[500001], dp2[500001];
int leaf_cnt[500001];
int g[500001][2];

ll dfs(int v, int depth) {
    for(int i = 0; i < 2; ++i) {
        int to = g[v][i];
        if(to == N) {
            leaf_cnt[v]++;
        } else {
            dfs(to, depth + 1);
            leaf_cnt[v] += leaf_cnt[to];
            dp2[v] += dp2[to];
        }
    }
    dp2[v] += leaf_cnt[v];

    ll& res = dp[v];
    int l = g[v][0], r = g[v][1];
    dp[v] = min({dp2[l] + (leaf_cnt[l] == 0 ? 1 : leaf_cnt[l]) + 1 + dp[r],
                 dp[l] + dp2[r] + (leaf_cnt[r] == 0 ? 1 : leaf_cnt[r]) + 1,
                 dp[l] + depth + dp[r] + 2});
    return dp[v];
}

int main() {
    BEGIN_STACK_EXTEND(128*1024*1024);

    cin >> N;
    for(int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        a -= (a != N);
        b -= (b != N);
        g[i][0] = a;
        g[i][1] = b;
    }
    cout << dfs(0, 0) << endl;
    
    END_STACK_EXTEND;
}


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

int main(void)
{  
	int N, i, x = 0, max_x = 0;
	char S[100];
	cin >> N;
	for (i = 0; i <= N; ++i) {
		S[i] = getchar();
	}
	for (i = 0; i <= N; ++i) {
		switch (S[i]) {
		case 'I':
			++x;
			break;
		case 'D':
			--x;
			break;
		default :break;
		}
		if (x > max_x)max_x = x;
	}
	cout << max_x << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

const ll nmax=2000005;


ll fac[nmax],finv[nmax],inv[nmax];

void comint(){
 fac[0]=fac[1]=1;
 finv[0]=finv[1]=1;
 inv[1]=1;
 for(ll i=2;i<nmax;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;
}
}

ll com(ll n, ll k){
 if(n<k||n<0||k<0) return 0;
 return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}


ll mod_pow(ll x, ll n){
 ll res=1;
  while(n>0){
   if(n&1) res=res*x%mod;
   x=x*x%mod;
   n>>=1;
}
return res;
}


void solve(){
  ll k;
  string s;
   cin >> k >> s;
  ll n=s.size();
  comint();
  ll ans=0;
  repr(i,n+k,n-1){
   ll r=n+k-1-i; 
   ll tot=mod_pow(26,r)*mod_pow(25,k-r);
    tot%=mod;
    tot*=com(n+k-r-1,n-1);
    tot%=mod;
    ans+=tot;
    ans%=mod;
  }
  
  
  
  cout << ans << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 51196
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <sstream>

#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>

#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main(){
	int a;
	cin >> a;
	a = a + pow(a,2) + pow(a,3);
	cout << a << endl;


	return 0;
}


Measured memory_bytes: 4044
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<set>
#include<string>
using namespace std;
const int N=10+5,dx[]={0,0,1,-1},dy[]={1,-1,0,0},INF=0x3f3f3f3f;

int main()
{
    //freopen("out.txt","w",stdout);
    int n,sz[10];
    while(~scanf("%d",&n)){
        bool flag=0;
        int a,last,ans=1;
        last=-1;
        for(int i=0;i<4;i++){
            a=(n%10);
            //printf("%d",a);
            if(a==last) ans++;
            else ans=1;
            if(ans>=3) flag=1;
            last=a;
            n/=10;
        }

        if(flag) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
const int mm=1e6;
ll d[mm];
int main()
{
	int i,n,m,s,l;
	cin>>n;
	 s=0;
	for(i=0;i<n;i++)
	{
		cin>>d[i];
		if(d[i]%2==0&&(d[i]%3)&&(d[i]%5))
		{
			s=1;
		}
	}
	if(s)
	printf("DENIED\n");
	else
	printf("APPROVED\n");






}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

template<typename T> bool chmax( T &a, T b ) { if ( a < b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, T b ) { if ( a > b ) { a = b; return ( true ); } else { return ( false ); } }

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp( a, b ) make_pair( a, b )
#define mt( ... ) make_tuple( __VA_ARGS__ )

#define F first
#define S second

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

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()

#define MOD ( (ll)( 1e9 + 7 ) )


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

	int cnt[2] = { 0 };
	rep( i, S.size() )
	{
		if ( S[i] == '0' )
		{
			cnt[i % 2]++;
		}
	}

	int eB, eW, oB, oW;
	eB = cnt[0];
	oB = cnt[1];
	eW = ( ( S.size() + 1 ) / 2 ) - cnt[0];
	oW = ( S.size() - ( ( S.size() + 1 ) / 2 ) ) - cnt[1];

	int rB, rW;
	if ( oB < eB )
	{
		rB = eW;
		rB += oB;
	}
	else
	{
		rB = oW;
		rB += eB;
	}

	if ( oW < eW )
	{
		rW = eB;
		rW += oW;
	}
	else
	{
		rW = oB;
		rW += eW;
	}

	cout << min( rB, rW ) << endl;

	return ( 0 );
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N;
	cin >> N;
	V<int> a(N);
	rep(i,N) cin >> a[i];
	sort(all(a));
	cout << a[N/2] - a[N/2-1] << endl;
}


Measured memory_bytes: 640
N, P = map(int, input().split())
A = list(map(int, input().split()))
def comb(n, k):
  ret = 1
  for i in range(1, k+1):
    ret = ret * (n+1-i) // i
  return ret
Even = 0
Odd = 0
for a in A:
  if a % 2 == 0:
    Even += 1
  else:
    Odd += 1
ans = 0
while P <= Odd:
  ans += comb(Odd, P)
  P += 2
print(ans * 2 ** Even)

Measured memory_bytes: 61676
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def gcd(a,b):
        if a == 0:
            return b
        return gcd(b%a, a)
    k = I()
    ans = 0
    for a in range(1,k+1):
        for b in range(1,k+1):
            g = gcd(a,b)
            for c in range(1,k+1):
                ans += gcd(g,c)
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


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

class TEST
{

    static void Main()
    {
        var n = int.Parse(Console.ReadLine());

        Dictionary<string, int> ans = new Dictionary<string, int>();

        ans["AC"] = 0;
        ans["WA"] = 0;
        ans["TLE"] = 0;
        ans["RE"] = 0;

        for (int i = 0; i < n; i++)
        {
            var ss = Console.ReadLine();

            if (ans.ContainsKey(ss))
            {
                ans[ss]++;
            }
        }

        foreach (var p in ans)
        {
            Console.Write(p.Key + " x " + p.Value + "\n");
        }
    }



}






Measured memory_bytes: 21240
#include <bits/stdc++.h>
#define ll long long
#define pb(x) push_back((x))
#define line() cerr << "DEBUG @" << __LINE__ << endl;
#define debug(x) \
  cerr << "DEBUG @" << __LINE__ << " -> " << #x << " = " << x << endl;
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  vector<ll> v;
  v.pb(a*d);
  v.pb(a*c);
  v.pb(b*d);
  v.pb(b*c);
  sort(v.begin(), v.end());
  // for (int x : v) {
  //   cout << x << ' ';
  // }
  // cout << endl;
  cout << v.back() << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    
    // s -> g (1st)
    rep(i, (gy - sy)) {
        cout << "U";
    }
    
    rep(i, (gx - sx)) {
        cout << "R";
    }
    
    // g -> s (1st)
    rep(i, (gy - sy)) {
        cout << "D";
    }
    
    rep(i, (gx - sx)) {
        cout << "L";
    }
    
    // s -> g (2nd)
    cout << "L";
    rep(i, (gy - sy + 1)) {
        cout << "U";
    }
    
    rep(i, (gx - sx + 1)) {
        cout << "R";
    }
    cout << "D";
    
    // g -> s (2nd)
    cout << "R";
    rep(i, (gy - sy + 1)) {
        cout << "D";
    }
    
    rep(i, (gx - sx + 1)) {
        cout << "L";
    }
    cout << "U";
    
    cout << endl;
    return 0;
}


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

int main() {
    ll n,k;
    std::cin >> n>>k;
    if(k==1){
        std::cout << 0 << std::endl;
        return 0;
    }
    vector<ll> a(n);
    vector<ll> sum(n+1);
    sum[0] = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        sum[i+1] = sum[i]+a[i];
    }
    
    map<ll,ll> cou;
    
    cou[0] = 1;
    
    ll res = 0;
    
    for (int i = 0; i < n; i++) {
        res += cou[(sum[i+1]%k-(i+1)%k+k)%k];
        cou[(sum[i+1]%k-(i+1)%k+k)%k]++;
        if(i-k+2>=0) cou[(sum[i-k+2]%k-(i-k+2)%k+k)%k]--;
    }
    
    std::cout << res << std::endl;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

/*************** using variables ***************/
int n, a;
/**********************************************/

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

    cin >> n >> a;

    if(n % 500 <= a){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	h := nextInt()
	w := nextInt()
	if h == 1 || w == 1 {
		fmt.Println(1)
		return
	}
	fmt.Println((h*w + 1) / 2)
}


Measured memory_bytes: 640
//
// Created by jal on 2019-10-08.
//

#include <bits/stdc++.h>
using namespace std;
const int N = 100010, INIT_VALUE = INT_MAX;
vector<int>a(N);
struct Tree{
    int Min;
    int left, right;
};
vector<Tree>nodes(4*N);
int getMin(int root, int left, int right){
    if(left <= nodes[root].left and right >= nodes[root].right){
        return nodes[root].Min;
    }
    int mid = (nodes[root].left + nodes[root].right) >> 1;
    if(right <= mid){
        return getMin(2*root, left, right);
    }
    if(left > mid){
        return getMin(2*root+1, left, right);
    }
    return min(getMin(2*root, left, mid), getMin(2*root+1, mid+1, right));
}
void update(int root, int index, int x){
    if(nodes[root].left == nodes[root].right){
        nodes[root].Min = x;
        return;
    }
    int mid = (nodes[root].left + nodes[root].right) >> 1;
    if(index <= mid){
        update(2*root, index, x);
    }
    else{
        update(2*root+1, index, x);
    }
    nodes[root].Min = min(nodes[root*2].Min, nodes[root*2+1].Min);
}
void createTree(int root, int left, int right){
    nodes[root].left = left;
    nodes[root].right = right;
    if(left == right){
        nodes[root].Min = INIT_VALUE;
        return;
    }
    int mid = (left + right) >> 1;
    createTree(root*2, left, mid);
    createTree(root*2+1, mid+1, right);
    nodes[root].Min = min(nodes[root*2].Min, nodes[root*2+1].Min);
}
int main(){
    int n, q;
    scanf("%d %d", &n, &q);
    createTree(1, 0, n-1);
    for(int i = 0; i < q; i++){
        int com;
        scanf("%d", &com);
        if(com == 1){// find(s, t)
            int s, t;
            scanf("%d %d", &s, &t);
            cout << getMin(1, s, t) << endl;
        }
        else{// update(index, x)
            int index, x;
            scanf("%d %d", &index, &x);
            update(1, index, x);
        }
    }
    return 0;
}



Measured memory_bytes: 7644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Queue;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while (true) {
			String str[] = br.readLine().split(" ");
			int x = Integer.parseInt(str[0]);
			int y = Integer.parseInt(str[1]);
			int s = Integer.parseInt(str[2]);

			if (x == 0 && y == 0 && s == 0)
				break;

			int max = 0;

			for (int i = 1; i < s; i++) {
				for (int j = 1; j < s; j++) {
					int a = changeTax(x, i);
					int b = changeTax(x, j);
					// System.out.println(a + " " + b);
					if (a + b == s) {
						int c = changeTax(y, i);
						int d = changeTax(y, j);
						max = Math.max(max, c + d);
					}
				}
			}
			System.out.println(max);
		}
	}

	static int changeTax(int x, int p) {
		double d = (double) (p * (100 + x)) / 100;
		return (int) Math.floor(d);
	}
}



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

int main() {
    long long num;
    long long cnt = 0;
    int index = 0;
    bool chk = false;
    cin >> num;

    vector<long long> vec(num);
    for (int i = 0; i < num; i++) cin >> vec.at(i);

    sort(vec.begin(), vec.end(), greater<int>());
    for (int i = 0; i < num-1; i++) {
        if (chk == false) {
            chk = true;
            cnt += vec.at(index);
            index++;
        }else{
            chk = false;
            cnt += vec.at(index);
        }
    }
    cout << cnt;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos,arra[ohara];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

     cin>>n;
     ll start=0,end=n-1,cntt=0;
     rep(i,n)cin>>a[i];
     rep(i,n){
       if(i%2==0)cnt+=max(0LL,a[i]);
       else ans+=max(0LL,a[i]);
     }
     if(ans!=0||cnt!=0)Cout(max(ans,cnt));
     if(ans==0&&cnt==0){
       ans=-LINF;
       ll flags;
       rep(i,n){
         if(ans<=a[i]){
         ans=a[i],flags=i;
         }
       }
       Cout(ans);
       cnt=n;
       rep(i,n-flags-1)arra[cntt++]=cnt,cnt--;
       rep(i,flags)arra[cntt++]=1;
       Cout(cntt);
       rep(i,cntt)Cout(arra[i]);
       return 0;
     }
     if(cnt>=ans){//奇数

     cnt=0;
      rep(i,n){
       start=i;
       if(i%2==0&&a[i]>=0)break;
       arra[cntt++]=1;
       cnt++;
     }
     cnt=n-cnt;
     rrrep(i,n-1,0){
       end=i;
       if(i%2==0&&a[i]>=0)break;
       arra[cntt++]=cnt;
       cnt--;
     }
     rrep(i,start+2,end+1){
       if(i%2==0){
         if(a[i]>=0)arra[cntt++]=2;
         else arra[cntt++]=3;
       }
     }
     }
     else{

       cnt=0;
        rep(i,n){
       start=i;
       if(i%2!=0&&a[i]>=0)break;
       arra[cntt++]=1;
       cnt++;
     }
     cnt=n-cnt;
     rrrep(i,n-1,0){
       end=i;
       if(i%2!=0&&a[i]>=0)break;
       arra[cntt++]=cnt;
       cnt--;
     }
     rrep(i,start+2,end+1){
       if(i%2!=0){
         if(a[i]>=0)arra[cntt++]=2;
         else arra[cntt++]=3;
       }
     }

     }
     Cout(cntt);
     rep(i,cntt)Cout(arra[i]);
     
       
return 0;
}


Measured memory_bytes: 2304
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let mut k = io.read::<usize>();
    let f = |x: i64| -> i64 {
        let mut xx = x;
        let mut ret = 0;
        while xx > 0 {
            ret += xx % 10;
            xx /= 10;
        }
        ret
    };

    let mut dp = vec![999; k as usize];
    dp[1] = 1;
    let mut q = VecDeque::new();
    q.push_back(1usize);
    while let Some(qq) = q.pop_front() {
        let mut u = (qq * 10) % k;
        if dp[u] > dp[qq] {
            dp[u] = dp[qq];
            q.push_front(u);
        }
        u = (qq + 1) % k;
        if dp[u] > dp[qq] + 1 {
            dp[u] = dp[qq] + 1;
            q.push_back(u);
        }
    }
    io.writeln(dp[0]);
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


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

int main (){
  
  int a,b;
  
  cin>>a>>b;
  
  if ((a*b)%2==0){
    
    cout<<"Even"<<endl;
  }
  
  else{
    
    cout<<"Odd"<<endl;
  }
  return 0;
  
}


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

using namespace std;

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

int main() {
	string s;
	cin >> s;
	rep(i, s.size()) s[i] = (s[i]=='1'? '9':(s[i]=='9'? '1':s[i]));
	cout<< s << endl;;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <map>
#include <unordered_set>
#include <tuple>
#include <queue>
#include <set>
#include <cstring>
#include <functional>
#include <random>
#include <chrono>

#define ar array
#define all(arr) (arr).begin(), (arr).end()
#define range(i, n) for (int i=0; i < n; ++i)
#define rall(arr) (arr).rbegin(), (arr).rend()

typedef long long ll;
typedef long double ld;

using namespace std;

const ll INF = 1e18;
const int INFi = 2e9;
const int maxN = 1e5 + 5;
const int md2 = 998244353;
const int md = 1e9 + 7;

double getTime() { return clock() / (double) CLOCKS_PER_SEC; };

void solve() {
    int n; cin >> n;
    ll ans1 = 1, ans2 = 1, ans3 = 1;
    for(int i = 1; i <= n; ++i) ans1 = (1ll * ans1 * 10) % md;
    for(int i = 1; i <= n; ++i) ans2 = (1ll * ans2 * 9) % md;
    for(int i = 1; i <= n; ++i) ans3 = (1ll * ans3 * 8) % md;
    cout << ((ans1 - ans2 * 2 + ans3) % md + md) % md << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //cout << setprecision(15) << fixed;
    int tests = 1;
    //cin >> tests;
    range(_, tests) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3636