akhauriyash/Code-Regression huggingface dataset:
#define DIN freopen("input.txt","r",stdin);
#define DOUT freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define REP_(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int,int> P;
int read()
{
    int x=0,flag=1; char c=getchar();
    while((c>'9' || c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

LL n,a[100];

int main()
{
    n=read();
    REP(i,1,n) a[i]=read();
    LL m=1000;
    REP(i,2,n) if(a[i]>a[i-1]) m+=m/a[i-1]*(a[i]-a[i-1]);
    cout<<m;

    return 0;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>


using namespace std;
typedef long long int ll;


int main() {
    ll N;
    cin >> N;
    vector<vector<int> > a(N, vector<int>(3));
    for(size_t i = 0; i < N; i++)
    {
        for (size_t j = 0; j < 3; j++)
        {
            cin >> a[i][j];
        }
    }

    bool flag = true; 
    for(size_t i = 0; i < N; i++)
    {
        if (a[i][0] %2 == 0) {
            if ((a[i][1] + a[i][2]) %2 == 1 || (a[i][1] + a[i][2]) > a[i][0]){
                flag = false;
            }
        } else {
            if ((a[i][1] + a[i][2]) % 2 == 0 || (a[i][1] + a[i][2]) > a[i][0]){
                flag = false;
            }
        }
    }
    if(flag) {cout <<  "Yes" << endl;} 
    else {cout << "No" << endl;}
    return 0;
}

Measured memory_bytes: 5760
#include <stdio.h>
#include <math.h>
int main()
{
    int n;
    scanf("%d",&n);
    int sz[100000],asd[100000];
    int i;
    int s;
    for(i=1; i<=n; i++)
    {
        scanf("%d",&sz[i]);
    }
    s=0;
    sz[0]=0;
    for(i=1; i<=n; i++)
    {
        s=s+fabs(sz[0]-sz[i]);
        sz[0]=sz[i];

    }
    s=s+fabs(sz[0]);
    sz[0]=0;
    for(i=1; i<=n; i++)
    {
        asd[i]=s-fabs(sz[i]-sz[i-1])-fabs(sz[i+1]-sz[i])+fabs(sz[i-1]-sz[i+1]);
        printf("%d\n",asd[i]);
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 30

signed main()
{
    string S;
    cin >> S;
    vector<int> ans;
    REP(i, S.length()) {
        if(S[i] == '1') { ans.push_back(1); }
        else if(S[i] == '0') { ans.push_back(0); }
        else if(ans.size() > 0) { ans.pop_back(); }
    }
    REP(i, ans.size()) {
        printf("%lld", ans[i]);
    }
    printf("\n");

    return 0;
}


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

int comp(const void *a, const void *b)
{
	return *(int*)a - *(int*)b;
}

int main(){
	int n = 0, a[20], q, m[200],cnt=0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	scanf("%d", &q);
	for (int i = 0; i < q; i++){
		scanf("%d", &m[i]);
	}
	qsort(a, n, sizeof(int), comp);
	for (int i = 1; i < 1 << n; i++){
		int sum=0;
		for (int j = 0; j < n; j++){
			sum += (i >> j & 1) * a[j];
		}
		for (int k = 0; k < q; k++){
			if (m[k] == sum){
				m[k] = 0;
			}
		}
	}
	for (int k = 0; k < q; k++){
		if (m[k]){
			printf("no\n");
		}
		else{
			printf("yes\n");
		}
	}

	return 0;
}

Measured memory_bytes: 1016
#include <iostream>

using namespace std;

int main() {
    int N ;

    cin >> N;

    int guusuuCnt = 0;
    int kisuuCnt = 0;
    
    for (int i=1; i<=N; i++) {
        if (i%2 == 0) {
            guusuuCnt++;
        } else {
            kisuuCnt++;
        }
    }

    cout << ((double)kisuuCnt/N);

    return 0;
}

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

int a[100005];
int main(){
	int n;cin>>n;
  int odd=0;
  	for(int i=0;i<n;i++){
    	cin>>a[i];
      if(a[i]%2)odd=(odd+1)%2;
    }
  cout<<(odd?"NO":"YES");
}

Measured memory_bytes: 640
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans=0,n,xa=0,bx=0,ba=0;
    cin >>n;
    for(int i=0;i<n;i++){
        string s;
        cin >>s;
        for(int i=0;i<s.size()-1;i++){
            if (s[i]=='A'&&s[i+1]=='B')ans++;
        }
        //ans+=count(s.cbegin(), s.cend(), "AB");
        if (s[0]=='B'&&s[s.size()-1]=='A'){
            ba++;
        }else if(s[0]=='B'){
            bx++;
        }else if(s[s.size()-1]=='A'){
            xa++;
        }
    }
    dbg cout <<ans<<endl;
    if(bx==0&&xa==0){
        ans+=max(0LL,ba-1);
    }else{
        ans+=max(0LL,ba-1)+min(bx+((ba>=1)?1:0),((ba>=1)?1:0)+xa);
    }
    

    cout <<ans<<endl;

    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100005
#define LL long long
using namespace std;
LL S[2*N];
int n,m,lw,R,C,xi[N],yi[N],xj[N],yj[N],w[2*N];
struct edge{
	int l,r;
	edge(int _l=0,int _r=0){ l=_l,r=_r;}
}A[N];
bool cmp(edge p,edge q){ return p.l<q.l||(p.l==q.l&&p.r<q.r);}
void GG(){ printf("NO"); exit(0);}
LL RD(){ return ((LL)(rand())<<31)|rand();}
int Get(int x,int y)
{
	if(x==0) return y;
	if(y==C) return C+x;
	if(x==R) return R+C+C-y;
	if(y==0) return C+R+C+R-x;
}
void check()
{
	int i,p,q,u,v; m=0;
	for(i=1;i<=n;i++){
		p=xi[i],q=yi[i],u=xj[i],v=yj[i];
		if(p!=0&&p!=R&&q!=0&&q!=C) continue;
		if(u!=0&&u!=R&&v!=0&&v!=C) continue;
		++m,A[m].l=Get(p,q),A[m].r=Get(u,v);
	  }
	for(i=1;i<=m;i++){
		if(A[i].l>A[i].r) swap(A[i].l,A[i].r);
		w[++lw]=A[i].l,w[++lw]=A[i].r;
	  }
	sort(w+1,w+lw+1);
	for(i=1;i<=m;i++){
		LL z=RD();
		S[A[i].l=lower_bound(w+1,w+lw+1,A[i].l)-w]^=z;
		S[A[i].r=lower_bound(w+1,w+lw+1,A[i].r)-w]^=z;
	  }
	for(i=1;i<=lw;i++) S[i]^=S[i-1];
	for(i=1;i<=m;i++)
		if(S[A[i].r-1]^S[A[i].l]) GG();
}
int main()
{
	int i; srand(time(NULL));
	scanf("%d %d %d",&R,&C,&n);
	for(i=1;i<=n;i++)
		scanf("%d %d %d %d",&xi[i],&yi[i],&xj[i],&yj[i]);
	check();
	printf("YES");
	return 0;
}


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

public class Main {
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		int tmp = -1;
		
		int a = sc.nextInt(), b;
		for (int i = 0; i < n - 1; i++) {
			b = sc.nextInt();
			if (a + b >= l) {
				tmp = i;
				break;
			}
			a = b;
		}
		
		if (tmp < 0) {
			out.println("Impossible");
		} else {
			out.println("Possible");
			for (int i = 1; i <= tmp; i++) {
				out.println(i);
			}
			for (int i = n - 1; i > tmp; i--) {
				out.println(i);
			}
		}
		
		out.flush();
	}
	
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	
	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}
	
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
	
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
	
	public int nextInt() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
}

Measured memory_bytes: 17164
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

vector<ll>graph[100005];
vector<ll>deg(100005,0);
vector<ll>dp(100005,0);
queue<ll>q;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,m;
    cin>>n>>m;
    for(ll i=0;i<m;i++){
        ll a,b;
        cin>>a>>b;
        graph[a].push_back(b);
        deg[b]++;
    }
    for(ll i=1;i<=n;i++){
        if(deg[i]==0){
            q.push(i);
        }
    }
    while(!q.empty()){
        ll tete=q.front();
        q.pop();
        vector<ll>::iterator it=graph[tete].begin();
        for(it;it!=graph[tete].end();it++){
            dp[*it]=max(dp[*it],dp[tete]+1);
            deg[*it]--;
            if(deg[*it]==0)q.push(*it);
        }
    }
    ll res=0;
    for(ll i=1;i<=n;i++){
        res=max(res,dp[i]);
    }
    cout<<res<<endl;
    return 0;
    }


Measured memory_bytes: 7296
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")

#define DEBUG(x) cout << ">> " << #x << ": " << x << endl;
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
typedef long long ll;
typedef long double ld;

int main() { _
  int k; cin >> k;
  vector<ll> v(k, 0);
  for (int i = 0; i < k; i++) {
    cin >> v[i];
  }
  ll minn = 2, maxx = 3;
  if (v[k-1] != 2) {
    cout << -1 << endl;
    return 0;
  }
  else {
    for (int i = k-2; i >= 0; i--) {
      if (v[i] > maxx) {
        cout << -1 << endl;
        return 0;
      }
      else maxx = (ll (maxx/v[i]) + 1) * v[i] - 1;

      if (maxx < 0) maxx = __LONG_LONG_MAX__;

      if (v[i] < minn) {
        minn = minn % v[i] == 0 ? minn : (ll (minn/v[i]) + 1) * v[i];
      }
      else minn = v[i];

      if (minn > maxx) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << minn << " " << maxx << endl;
  return 0;
}

Measured memory_bytes: 1024
A, B, C, D = map(int, input().split())
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

print((B-A+1) - ((B//C - (A-1)//C) + (B//D - (A-1)//D) - (B//lcm(C, D) - (A-1)//lcm(C, D))))

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    string kan[] = {"ld", "mb", "mp", "nc", "nd", "ng", "nt", "nw", "ps", "qu", "cw", "ts"};
    map<string, int> index;
    for(int i=0; i<12; ++i)
        index.insert(make_pair(kan[i], 26+i));

    vector<vector<int> > num(38, vector<int>(38, 0));
    for(;;){
        string s;
        if(!(cin >> s))
            break;
        int n = s.size();

        vector<int> j;
        for(int i=0; i<n; ++i){
            if(i < n-1 && index.find(s.substr(i, 2)) != index.end()){
                j.push_back(index[s.substr(i, 2)]);
                ++ i;
            }else{
                j.push_back(s[i] - 'a');
            }
        }

        for(unsigned i=0; i<j.size()-1; ++i)
            ++ num[j[i]][j[i+1]];
    }

    for(int i=0; i<38; ++i){
        int k = 0;
        for(int j=1; j<38; ++j){
            if(num[i][j] > num[i][k])
                k = j;
        }
        if(i < 26)
            cout << (char)('a' + i) << ' ';
        else
            cout << kan[i-26] << ' ';
        if(k < 26)
            cout << (char)('a' + k) << ' ';
        else
            cout << kan[k-26] << ' ';
        cout << num[i][k] << endl;
    }

    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void){
    int n;
    cin >> n;
    double num[n];
    for(int i = 0; i < n; i++)
        cin >> num[i];
    sort(num, num+n);
    double ans;
    for(int i = 0; i < n-1; i++){
        num[i+1]=(num[i]+num[i+1])/2;
    }
    cout << fixed << setprecision(10) << num[n-1] << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b , c;
    cin >> a >> b >> c;
    int count = max(max(a, b), c)*3 -(a+b+c);
    if(count%2 == 1)
	count += 3;
    cout << count/2 <<endl;
}




Measured memory_bytes: 256
N=int(input().strip())
ans=0
grid=[]
for i in range(N):
    x=list(input().split())
    grid.append(x)
    if grid[i][1]=='JPY':
        ans+=float(grid[i][0])
    elif grid[i][1]=='BTC':
        ans+=float(grid[i][0])*380000.0
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
	vector<ll>a;
	ll x;
	cin >> x;
	for (int i = 2; i <= 31; i++) {
		ll num = i * i;
		while (1) {
			if (num <= 1000)a.push_back(num);
			else break;
			num *= i;
		}
	}
	a.push_back(1);
	sort(a.begin(), a.end());
	for (int i = a.size() - 1; i >= 0; --i) {
		if (a[i] <= x) {
			cout << a[i] << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		String input_str = scanner.next();
		int input = Integer.parseInt(input_str);

		int hour = 3600;
		int minute = 60;

		if(input >= 0 && input <= 86400) {
			int output_h = input / hour;
			int output_m = (input % hour) / minute;
			int output_s = input % minute;

			System.out.println(output_h + ":" + output_m + ":" + output_s);
		}

    	scanner.close();
    }
}



Measured memory_bytes: 26020
import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int n = sc.nextInt();
			char[] s = sc.next().toCharArray();
			HashSet<Character> hset1 = new HashSet<Character>();
			HashSet<Character> hset2 = new HashSet<Character>();
			HashSet<Integer> ret = new HashSet<Integer>();
			int num =0;
			for(int i=0;i<n;i++) {
				num=0;
				for(int j=0;j<=i;j++) {
					hset1.add(s[j]);
					
				}
				
				for(int k=i+1;k<n;k++) {
					
					hset2.add(s[k]);
					
				}
				
				for(char a:hset1) {
					if(hset2.contains(a)) {
						num++;
					}
				}
				ret.add(num);
				hset1.clear();
				hset2.clear();
			}
			
			System.out.println(Collections.max(ret));
			
		}	
	}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define ll long long  
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int n;
  cin>>n;
  if(n%2==0){
        cout<<((n/2)/(n*1.0))<<endl;
  }else{
      cout<<((n/2 +1)/(n*1.0))<<endl;
    }
  
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

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

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

int main(){
  int i,j;
  int n,k;
  cin>>n>>k;
  int cnt=0;
  while(n>=1){
    n/=k;
    cnt++;
  }
  cout<<cnt<<endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;

int func(long long int k){
  string s = to_string(k);
  int tmp = 0;
  for(int i=0; i<s.size(); i++){
    tmp += s[i]-'0';
  }
  return tmp;
}

int main(){

  int n;cin >> n;
  int s = func(n);
  cout << ( n%s == 0 ? "Yes" : "No" ) << endl;

  return 0;
}



//


Measured memory_bytes: 256
#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() {
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

int main() {
  int a, b, c ,d,e; cin >> a >> b >> c >> d >> e;
  int ax = ((a + 9) / 10) * 10;
  int bx = ((b + 9) / 10) * 10;
  int cx = ((c + 9) / 10) * 10;
  int dx = ((d + 9) / 10) * 10;
  int ex = ((e + 9) / 10) * 10;

  // cout << ax << " ";
  // cout << bx << " ";
  // cout << cx << " ";
  // cout << dx << " ";
  // cout << ex << " ";
  // cout << endl;
  
  vector<int> T;
  
  int ay = a % 10; T.push_back(ay);
  int by = b % 10; T.push_back(by);
  int cy = c % 10; T.push_back(cy);
  int dy = d % 10; T.push_back(dy);
  int ey = e % 10; T.push_back(ey);

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

  // for (auto x: T) {
  //   cout << x << " ";
  // }
  // cout << endl;

  if (!ay && !by && !cy && !dy && !ey) {
    cout << ax + bx + cx + dx + ex << endl;
  } else {
    cout << ax + bx + cx + dx + ex - 10 + *lower_bound(T.begin(), T.end(), 1) << endl;
  }


}


Measured memory_bytes: 256
#pragma GCC optimize ("Ofast", "unroll-loops", "loop-nest-optimize")

#include <bits/stdc++.h>

#define REP(i, n) REPI(i, 0, n)
#define REP1(i, n) REPI(i, 1, n)
#define REPI(i, init, n) for(int i = init; i < n; i++)
#define MS(arr, val) memset(arr, val, sizeof(arr))
#define SZ(x) (x).size()
#define ALL(x) (x).begin(), (x).end()
#define EB emplace_back
#define UB upper_bound
#define LB lower_bound
#define FS first
#define SC second

#ifdef __WIN32__
inline size_t fread_unlocked(void *_buf, int _sz, int _cnt, FILE *_stream)
{
	return fread(_buf, _sz, _cnt, _stream);
}//fread_unlocked
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
//typedef pair<int, int> P;

char buf[100000];

inline char gc()
{
	static char *st = buf, *ed = buf;

	if (st >= ed)
	{
		st = buf;
		ed = st + fread_unlocked(buf, 1, sizeof(buf), stdin);

		if (st == ed) return EOF;
	}//if

	return *(st++);
}//gc

template<class T>
inline bool rit(T &_a)
{
	char _c = gc();
	bool neg = false;
	for (; _c < '0' || _c > '9'; _c = gc())
	{
		if (_c == EOF) return false;
		if (_c == '-') neg = true;
	}//for

	for (_a = 0; _c >= '0' && _c <= '9'; _c = gc())
		_a = _a * 10 + _c - '0';

	if (neg) _a = -_a;

	return true;
}//rit

template<class S, class ...T>
inline bool rit(S &_a, T&... _b)
{
	if (!rit(_a)) return false;
	return rit(_b...);
}//rit

//============================================================================//

const int MAX_N = 0 + 10;
//const int INF8 = 0x3f;
//const int INF32 = 0x3f3f3f3f;
//const int MOD = 1e9 + 7;
//const int MOD = 46337; //maximum prime int for multiplying
//const LL MOD = 2999999929; //maximum prime LL for multiplying
//const LL INF64 = 0x3f3f3f3f3f3f3f3f;
//const DB PI = acos(-1);

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int N, mx = 0;
	string s;
	map<string, int> mp;
	
	cin >> N;
	while (N--)
	{
		cin >> s;
		mp[s]++;
		mx = max(mx, mp[s]);
	}//while
	
	for (auto x : mp)
	{
		if (x.SC == mx) cout << x.FS << '\n';
	}//for x
	
	return 0;
}//main


Measured memory_bytes: 23936
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl toInt <*> getl (wrds toInt) >>= mapM_ print

solve :: Int -> [Int] -> [Int]
solve 2 [x,y] = cdiv $ x `gcd` y
solve 3 [x,y,z] = cdiv $ x `gcd` y `gcd` z

cdiv :: Int -> [Int]
cdiv x = sort $ f x 1
  where
    f y d
      | d ^ 2 > y = []
      | d ^ 2 == y = [d]
      | y `mod` d == 0 = d : (y `div` d) : f y (d+1)
      | otherwise = f y (d+1)

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 4160
#include<iostream>
#include<string>
#define LL long long
LL MOD = 1000000007;
using namespace std;
int main(){
    int n;
    cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    LL ans=1;
    int i=0;
    bool state;
    while(i<n){
        //cout<<i<<endl;
        if(i==0){
            if(s1[0]==s2[0]){
                ans*=3;
                i++;
                state=0;
            }
            else if(s1[0]==s1[1]){
                ans*=6;
                i+=2;
                state=1;
            }
        }

        else{
            if(s1[i]==s2[i]){
                if(!state) {ans*=2;ans%=MOD;}
                if(state) {ans%=MOD;}
                i++;
                state=0;
            }
            else{
                if(!state){ans*=2;ans%=MOD;}
                if(state){ans*=3;ans%=MOD;}
                i+=2;
                state=1;
            }
            
            //cout<<ans<<endl;
        }
    }
    cout<<ans<<endl;
}

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

int main(){
  int h, n, sum, a;
  sum = 0;
  cin >> h >> n;
  for(int i = 0; i < n; i++) {
    cin >> a;
    sum += a;
  }
  
  string ans = sum >= h ? "Yes" : "No";
  
  cout << ans << endl;
}

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

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

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

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

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b; cin>>a>>b;
	cout << max(0, a-2*b) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> pth[55][55];

void init() {
	for (int i=1; i<=50; i++) {
		for (int j=0; j<i; j++) {
			for (int k=1; k<=i; k++) {
				if (i%k==j||pth[i%k][j].size()>0) {
					pth[i][j].push_back(k);
				}
			}
		}
	}
}

bool used[55];

int main() {
	init();
	int n;
	scanf("%d", &n);
	int a[n], b[n];
	for (int i=0; i<n; i++) scanf("%d", &a[i]);
	for (int i=0; i<n; i++) scanf("%d", &b[i]);
	/*for (int i=1; i<=50; i++) {
		for (int j=0; j<i; j++) {
			printf("%d %d\n", i, j);
			for (auto it:pth[i][j]) printf("%d ", it);
			printf("\n");
		}
	}*/
	set<int> pos[n];
	for (int i=0; i<n; i++) {
		if (a[i]==b[i]) continue;
		pos[i].insert(a[i]);
		if (pth[a[i]][b[i]].empty()) {
			printf("-1\n");
			return 0;
		}
	}
	long long ans=0;
	while (true) {
		int lrg=0;
		for (int i=0; i<n; i++) {
			if (pos[i].empty()) continue;
			int mnz=51;
			for (auto it:pos[i]) {
				if (pth[it][b[i]].size()) mnz=min(mnz,pth[it][b[i]][0]);
			}
			lrg=max(mnz,lrg);
		}
		if (lrg==0) break;
		used[lrg]=true;
		for (int i=0; i<n; i++) {
			vector<int> v;
			bool fin=false;
			for (auto it:pos[i]) {
				if (it%lrg==b[i]) {
					fin=true;
					break;
				}
				if (pth[it%lrg][b[i]].size()) v.push_back(it%lrg);
			}
			if (fin) {
				pos[i].clear();
				continue;
			}
			for (auto it:v) {
				pos[i].insert(it);
			}
		}
		/*printf("%d\n", lrg);
		for (int i=0; i<n; i++) {
			for (auto it:pos[i]) printf("%d ", it);
			printf("\n");
		}*/
	}
	for (int i=0; i<=50; i++) {
		if (used[i]) {
			ans+=1LL<<i;
			//printf("%d\n", i);
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 384
N, Y = map(int, input().split())

for c in range(N + 1):
    for b in range(N + 1):
        a = N - c - b
        if Y - 1000 * c - 5000 * b == 10000 * a and a >= 0:
            print(a, b, c)
            break
    else:
        continue
    break
else:
    print(-1, -1, -1)


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] t = new int[n];
		int i = 0;
		for(i = 0; i < n; i++) {
			t[i] = scan.nextInt();
		}
		int m = scan.nextInt();
		int[] t2 = new int[n];
		int[] p = new int[m];
		int[] x = new int[m];
		int[] t_sum = new int[m];
		for(i = 0; i < m; i++) {
			for(int j = 0; j < n; j++) {
				t2[j] = t[j];
			}
			p[i] = scan.nextInt();
			x[i] = scan.nextInt();
			t2[p[i] - 1] = x[i];
			t_sum[i] = 0;
			for(int j = 0; j < n; j++) {
				t_sum[i] = t_sum[i] + t2[j];
			}
		}
		for(i = 0; i < m; i++) {
			System.out.println(t_sum[i]);
		}
	}
}

Measured memory_bytes: 21972
N = int(input())
D, X = [int(i) for i in input().split()]
A = []
for i in range(N):
    A.append(int(input()))

count = 0
for Ai in A:
    temp = D // Ai
    if D % Ai == 0:
        count += temp
    else:
        count += 1 + temp

print(X + count)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    if(n % 2 == 1){
      System.out.println("No");
    } else {
      String a = s.substring(0, n/2);
      String b = s.substring(n/2,n);
      if(a.equals(b)){
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }

    }
  }
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vi vector<int>

int main(){


  int n;
  cin>>n;
  vi data(n);
  
  rep(i,n){
    int tmp;
    cin>>tmp;
    data.at(i)=tmp;
  }
  
  vi mins(n);
  mins.at(0)=data.at(0);
  for (int i=1;i<n;i++){
    mins.at(i)=min(mins.at(i-1),data.at(i));
  }
  

  int answer=0;
  rep(i,n){
    if (data.at(i)==mins.at(i)){
      answer++;
    }
  }

  
  
  cout<<answer<<endl;
  

  
  
  
}



Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#include<queue>
using namespace std;

int main(void)
{
	int ls,lt,i,j,cnt,mn;
	char s[1001],t[1001];
	scanf("%s",s);
	scanf("%s",t);
	ls=strlen(s);
	lt=strlen(t);
	mn=10000;
	for(i=0;i<ls-lt+1;i++)	{
		cnt=0;
		for(j=0;j<lt;j++)	{
			if(s[i+j]!=t[j])	cnt++;
		}
		mn=min(cnt,mn);
	}
	printf("%d\n",mn);
	return 0;
}

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

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

    a--;

    int ans = 0;
    int tot = 1;
    while (tot < b) {
        tot += a;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
alphabets = ('a'..'z').to_a
alphabet_count = alphabets.size
array = [n]
while array[0] > alphabet_count
  upper_digit, current_digit = array[0].divmod(alphabet_count)
  if current_digit == 0
    current_digit = alphabet_count
    upper_digit -= 1
  end
  array[0] = current_digit
  array.unshift(upper_digit)
end
puts array.map { |i| alphabets[i - 1] }.join


Measured memory_bytes: 14120
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
using namespace std;

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

	string str;
	cin >> str;

	stack<int> s;
	stack<pair<int, int>> s2;
	int sum = 0;
	for(int i = 0; i < str.length(); ++i){
		if(str[i] == '\\'){
			s.push(i);
		}
		else if(str[i] == '/' && !s.empty()){
			int a = s.top();
			s.pop();
			sum += i - a;
			int b = i - a;
			while(!s2.empty() && s2.top().first > a){
				b += s2.top().second;
				s2.pop();
			}
			s2.push(make_pair(a, b));
		}
	}
	cout << sum << endl;

	vector<int> ans;
	while(!s2.empty()){
		ans.push_back(s2.top().second);
		s2.pop();
	}
	cout << ans.size();
	for(int i = ans.size() - 1; i >= 0; --i){
		cout << " " << ans[i];
	}
	cout << endl;

	return 0;
}

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

int main()
{
    string S, T, R, P;
    cin >> S >> T;
    map<char, char> s_mp, t_mp;

    for (int index = 0; index < S.size(); index++)
    {
        s_mp[S[index]] = T[index];
        t_mp[T[index]] = S[index];
    }

    for (int index = 0; index < S.size(); index++)
    {
        R += s_mp[S[index]];
        P += t_mp[T[index]];
    }
    if (T == R && S == P)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

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

const int  r  = 100000;

int main(){
  int n;
  int in;
  int x[r] = {0};

  cin >> n;
  
  for(int i=0; i<n; ++i){
    cin >> in;
    if(in-1 >= 0) ++x[in-1];
    ++x[in];
    if(in+1 < n) ++x[in+1];
  }

  sort(x, x+r);
  reverse(x, x+r);

  cout << x[0] << endl;
  
  return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
		var s = ReadLine();
		var t = ReadLine();
		var max = 0;
		for(int i = 0; i <= s.Length - t.Length; i++)
		{
			var count = 0;
			for(int j = 0; j < t.Length; j++)
			{
				if(s[i + j] == t[j])
				{
					count++;
				}
			}
			max = Max(max, count);
		}
		WriteLine(t.Length - max);
	}
}


Measured memory_bytes: 17548
import java.util.*;
import java.io.*;
public class Main{

	private static final int m = 0;
	public static void main(String[] args) throws Exception  {
Scanner  sc=new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
int n=sc.nextInt();
int k=sc.nextInt();
int a[]=new int[n];
long sum=0;
for(int i=0;i<n;i++) {
	a[i]=sc.nextInt();
	sum+=a[i];
}
if(sum<k) {
	System.out.println(n);
}else {

long sum1=0;
	long count=0;
long ans=n;

Arrays.sort(a);
	for(int i=n-1;i>=0;i--) {
		if(sum1+a[i]<k)
		sum1+=a[i];
		else{
			
			
	ans=Math.min(ans,i);
		}
	
	}

	System.out.println(ans);
}


		
		
	}
	}

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

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

#define fr first
#define sc second

int main(){
	int n;
	string s;
	cin >> n >> s;
	
	static int cnt[2][300010] = {};
	for(int i = 1 ; i <= n ; i ++){
		if(s[i-1] == 'W')cnt[0][i] ++;
		else cnt[1][i] ++;
	}
	for(int i = 1 ; i+1 <= n ; i ++){
		cnt[0][i+1] += cnt[0][i];
	}
	for(int i = n-1 ; i >= 1 ; i --){
		cnt[1][i] += cnt[1][i+1];
	}
	
	/*for(int i = 1 ; i <= n ; i ++){
		cout << cnt[0][i];
	}
	cout << endl;
	for(int i = 1 ; i <= n ; i ++){
		cout << cnt[1][i];
	}
	cout << endl;*/
	
	int ret = n;
	for(int i = 1 ; i <= n ; i ++){
		//cout << i << " " << cnt[0][i-1]+cnt[1][i+1] << endl;
		ret = min( ret , cnt[0][i-1]+cnt[1][i+1] );
	}
	cout << ret << endl;
}



Measured memory_bytes: 3076
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;
int main(){
  int n,l;
  cin>>n>>l;
  vector<string> str;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    str.push_back(s);
  }
  sort(str.begin(),str.end());
  for(int i=0;i<n;i++){
    cout<<str[i];
  }
  cout<<endl;
  return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	int32 N;
	cin >> N;
	int32 res = 0;
	FOR(i, 1, N+1){
		int32 cnt = 0;
		if(i%2 == 0) continue;
		FOR(j, 1, i+1){
			if(i%j == 0) cnt++;
		}
		if(cnt == 8) res++;
	}
	cout << res << endl;
}


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

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

    int a, b, c, d, t, aoki;
    cin >> a >> b >> c >> d;
    if(c%b == 0) t=c/b;
    else if(c%b != 0) t=(c/b)+1;
    if(a%d == 0) aoki = a/d;
    else if(a%d != 0) aoki=(a/d)+1;
    if(t<=aoki)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll comb[60][60];
void initComb() {
  comb[0][0] = 1;
  rep(i, 55) rep(j, i+1){
    comb[i+1][j] += comb[i][j];
    comb[i+1][j+1] += comb[i][j];
  }
}

int main(){
  initComb();
  int N, A, B;
  cin >> N >> A >> B;
  vector<ll> v(N);
  map<int, int> mp;
  rep(i, N) {
    cin >> v[i];
    mp[v[i]]++;
  }
  sort(v.rbegin(), v.rend());
  ll sum = 0;
  bool same = true;
  int cnt = 1;
  rep(i, A) {
    sum += v[i];
    if(i) {
      if(v[i] == v[i-1])
        cnt++;
      else {
        same = false;
        cnt = 1;
      }
    }
  }
  if(same) {
    ll ans = 0;
    for(int i=A; i<=B; i++)
      ans += comb[mp[v[A-1]]][i];
    cout << fixed << setprecision(6) << sum/(double)A << endl;
    cout << ans << endl;
  } else {
    ll ans = comb[mp[v[A-1]]][cnt];
    cout << fixed << setprecision(6) << sum/(double)A << endl;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lowbit(a) ((a) & -(a))
#define clean(a, b) memset(a, b, sizeof(a))
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 9;
// typedef pair<int,int>P;

int _;

//========================================================================
ll Pp[maxn],Cc[maxn],mp[5009];
ll a[maxn],sum[maxn];
vector<ll>ve[5009];
//========================================================================
int main()
{
    ll n,k;
    ll x;
    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        Pp[i]=a[i];
    }
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&x);
        Cc[i]=x;
    }
    ll ans=-1e18;
    for(ll i=1;i<=n;i++)
    {
        ll now=i;
        clean(mp,0);
        while(1)
        { 
            now=Pp[now];
            // printf("mp[%lld]=%lld\n",now,mp[now]);
            if(mp[now]==1) break;
            mp[now]=1;
            sum[i]+=Cc[now];
            ve[i].push_back(Cc[now]);
        }
        int len=ve[i].size();
        ll d=k/len;
        ll m=k%len;
        // printf("%lld %lld %lld\n",d,m,len);
        now=0;
        if(sum[i]>0) 
        {
            if(m==0) 
            {
                now=(d-1)*sum[i];
                m=len;
            }
            else now=d*sum[i];
            for(int j=0;j<m;j++) now+=ve[i][j],ans=max(ans,now);
        }
        else 
        {
            if(d==0)             
            {
                for(int j=0;j<m;j++) now+=ve[i][j],ans=max(ans,now);
            }
            else 
            {
                for(int j=0;j<len;j++) now+=ve[i][j],ans=max(ans,now);
            }
        }
    }
    // for(int i=1;i<=n;i++)
    // {
    //     int len=ve[i].size();
    //     for(int j=0;j<len;j++) printf("%lld ",ve[i][j]);
    //     printf("\n");
    // }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 219096
from decimal import Decimal
a,b,c = map(int,input().split())
a = Decimal(a) ** Decimal(0.5)
b = Decimal(b) ** Decimal(0.5)
c = Decimal(c) ** Decimal(0.5)
if Decimal(a) + Decimal(b) < Decimal(c):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9984
#include <stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for (int i = 0; i < n; ++i) {
        scanf("%d",&a[i]);
    }
    int rev[n];
    for (int i = 0; i <n; ++i) {
        rev[a[i]-1]=i+1;
    }
    for (int i = 0; i <n; ++i) {
        printf("%d ",rev[i]);
    }
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int N, M, a, b;
  cin >> N >> M;
  vector<ll> h(N);
  vector<bool> flag(N, true);
  vector<vector<int> > m(N);
  rep(i, N){
    cin >> h[i];
  }

  rep(i, M){
    cin >> a >> b;
    a--;
    b--;
    m[a].push_back(b);
    m[b].push_back(a);
  }
  
  bool f;
  int ans = 0;
  rep(i, N){
    f = true;
    if(flag[i]){
      for(int k : m[i]){
        if (h[i] <= h[k]) f = false;
     }
      if(f) {
        ans++;
        // print(i);
      }
    }
  }
  print(ans);

}


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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

const long MOD = 998244353;

vector<long> p2;

long calc(int n, string &s, int k) {
    long res = 0;
    for (int i = 0; i < k; i++) {
        if (s[i] == '1') {
            res += p2[k - i - 1];
            res %= MOD;
        }
    }
    bool ok = true;
    for (int i = k; i < n; i++) {
        if (s[i] > (s[i - k] ^ 1)) {
            break;
        }
        if (s[i] < (s[i - k] ^ 1)) {
            ok = false;
            break;
        }
    }
    if (ok) {
        res = (res + 1) % MOD;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);

    int n;
    string x;
    cin >> n >> x;
    vector<int> d;

    p2.push_back(1);
    for (int i = 0; i < n; i++) {
        p2.push_back(p2.back() * 2 % MOD);
    }

    for (int i = 1; i <= n; i++) {
        if (n % i == 0 && n / i % 2 == 1) {
//            cerr << i << "\n";
            d.push_back(i);
        }
    }
    vector<long> r(d.size());
    for (int i = 0; i < d.size(); i++) {
        r[i] = calc(n, x, d[i]);
        for (int j = 0; j < i; j++) {
            if (d[i] % d[j] == 0 && d[i] / d[j] % 2 == 1) {
                r[i] -= r[j];
                r[i] %= MOD;
            }
        }
//        cout << d[i] << " " << r[i] << "\n";
    }

    long res = 0;
    for (int i = 0; i < d.size(); i++) {
        res += (2ll * d[i] * r[i]);
        res %= MOD;
    }
    if (res < 0) res += MOD;
    cout << res;

    return 0;
}

Measured memory_bytes: 3652
from sys import stdin

def main():
    input = stdin.readline

    H = int(input())

    ans = 0
    bai = 0

    while H >= bai*2:
        if(bai == 0):
            bai = 1
        else:
            bai = bai * 2
        ans = ans + bai
    
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
package main

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

func max(a int, b int) int {
	if a >= b {
		return a
	}
	return b
}

type Node struct {
	Index     int
	Value     int
	Neighbors []*Node
	Len       int
	IsSearched  bool
}

var nodes []*Node
var already map[int]bool

// dp[i]: 長さiの増加部分列において最後の値の最小値
func search(n *Node, dp []int) {
	if n.IsSearched {
		return
	}
	n.IsSearched = true

	idx := sort.SearchInts(dp, n.Value)
	befVal := dp[idx]
	dp[idx] = n.Value
	n.Len = sort.SearchInts(dp, MAX_INT)
	for _, to := range n.Neighbors {
		search(to, dp)
	}
	dp[idx] = befVal
}

func solve(N int, a []int, u []int, v []int) []int {
	//fmt.Printf("%v, %v, %v\n", a, u, v)
	res := make([]int, N)
	nodes = make([]*Node, N)
	for i := 0; i < N; i++ {
		nodes[i] = &Node{i, a[i], nil, 0, false}
	}
	for i := 0; i < N-1; i++ {
		nodes[u[i]-1].Neighbors = append(nodes[u[i]-1].Neighbors, nodes[v[i]-1])
		nodes[v[i]-1].Neighbors = append(nodes[v[i]-1].Neighbors, nodes[u[i]-1])
	}

	dp := make([]int, N)
	for i:=0; i<N; i++ {
		dp[i] = MAX_INT
	}
	//fmt.Printf("準備完了！！\n")
	search(nodes[0], dp)

	for i := 0; i < N; i++ {
		res[i] = nodes[i].Len
	}
	//fmt.Printf("%#v\n", nodes)
	return res
}


func main() {
	sc.Split(bufio.ScanWords)
	var N int
	nextInt(&N)
	var a []int
	nextInts(&a)

	u := make([]int, N-1)
	v := make([]int, N-1)
	var tmpu, tmpv int
	for i := 0; i < N-1; i++ {
		nextInt(&tmpu, &tmpv)
		u[i] = tmpu
		v[i] = tmpv
	}
	//fmt.Printf("N: %d, a: %v, u: %v, v: %v\n", N, a, u, v)
	res := solve(N, a, u, v)
	for _, v := range res {
		fmt.Printf("%d\n", v)
	}
}


const MAX_INT int = 1_000_000_000
var sc = bufio.NewScanner(os.Stdin)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)

func nextLine() string {
	buffer := make([]byte, 0)
	for true {
		line, isPrefix, err := reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func nextInt(A ...*int) {
	L := strings.Split(nextLine(), " ")
	for i, a := range A {
		*a, _ = strconv.Atoi(L[i])
	}
}
func nextInts(A *[]int) {
	L := strings.Split(nextLine(), " ")
	(*A) = make([]int, len(L))
	for i, l := range L {
		(*A)[i], _ = strconv.Atoi(l)
	}
}

func nextInt64() int64 {
	sc.Scan()
	hoge := sc.Text()
	i, e := strconv.ParseInt(hoge, 0, 64)
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 81216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String x = br.readLine();
		String y = br.readLine();
		int a = Integer.parseInt(x);
		int b = Integer.parseInt(y);
		System.out.println(2*b-a);
	}

}


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

int main() {
  int n;
  cin>>n;
  int a[100005];
  for(int i=0;i<n;i++)cin>>a[i];
  int ans = 0;
  for(int i=0;i<n;i++){
    int j=i;
    while(j<n-1 && a[j+1]<= a[j])
           j++;
    ans = max(ans,j-i);
    i=j;
  }
    cout<<ans<<"\n";
}


Measured memory_bytes: 4000
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    ll i,j,k,x,y,z,p,q,s;
    ll n,m,tmp;
    //string s[200000];
    string str;
    ll sum=0;
    ll strr[200005];
    cin>>n>>k>>s;
    rep(i,k) cout<<s<<" ";
    rep(i,n-k) {
        if(s==1000000000){
        cout<<1<<" ";
        }else{
            cout<<s+1<<" ";
        }
    }
    ln;
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int a,b;
    cin>>a>>b;
    int x=1;
    while(1){
        int c=x*0.08;
        int d=x*0.1;
       // cout<<c<<endl<<d<<endl;
        if(c==a&&d==b){
            cout<<x<<endl;
            return 0;
        }
        if(c>a||d>b){
            cout<<-1<<endl;
            return 0;
        }
        x++;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<P> vp;
typedef vector<bool> vb;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

class Graph{
	private:
	int V;
	vvi List;
	bool Bipartite_Matching_dfs(int v,vi& match,vb& used){
		used[v]=1;
		for(auto i=List[v].begin();i!=List[v].end();i++){
			int w=match[*i];
			if(w<0||!used[w]&&Bipartite_Matching_dfs(w,match,used)){
				match[v]=*i;
				match[*i]=v;
				return 1;
			}
		}
		return 0;
	}
	public:
	Graph(int v){
		V=v;
		List=vvi(v);
	}
	int Bipartite_Matching(){
		int ans=0;
		vi match(V,-1);
		for(auto i=0;i<V;i++){
			if(match[i]<0){
				vb used(V);
				if(Bipartite_Matching_dfs(i,match,used)) ans++;
			}
		}
		return ans;
	}
	void add_edge(int x,int y){
		List[x].push_back(y);
		List[y].push_back(x);
	}
};

int X,Y,E;

int main(){
	cin>>X>>Y>>E;
	Graph gra(X+Y);
	int s,t;
	for(int i=0;i<E;i++){
		cin>>s>>t;
		gra.add_edge(s,t+X);
	}
	cout<<gra.Bipartite_Matching()<<endl;
}

Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
int main(){
  char a,b;
  cin>>a>>b;
  if(a=='H'){
    if(b=='D')
      cout<<"D"<<endl;
    if(b=='H')
      cout<<'H'<<endl;
  }
  if(a=='D'){
    if(b=='H')
      cout<<'D'<<endl;
    if(b=='D')
      cout<<'H'<<endl;
  }
 
  return(0);
}

Measured memory_bytes: 256