akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define ull 		unsigned long long
#define ll 			long long
#define M 			1000000007
#define pb 			emplace_back
#define p_q 		priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 			make_pair
#define lb 			lower_bound
#define ub			upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define cset(a)		__builtin_popcountll(a)
#define hell 		(ull)1e9
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

bool g[(ll)1e3+2][(ll)1e3+2];
int dp[(ll)1e3+2][(ll)1e3+2];
signed main(void)
{ios
	int h,w;
	cin>>h>>w;
	dp[1][1]=1;
	rep(i,1,h+1)
	rep(j,1,w+1)
	{
		char c;cin>>c;
		if(c=='#')
			g[i][j]=1;
	}
	rep(i,1,h+1)
	rep(j,1,w+1)
	{
		if(i==1&&j==1) continue;
		if(g[i][j]) continue;
		dp[i][j]=(dp[i-1][j]+dp[i][j-1])%M;
	}
	cout<<dp[h][w]<<endl;
}

Measured memory_bytes: 9088
h, w = map(int, input().split())
S = [["#"] * (w + 2)]
for i in range(h):
  S.append(["#"] + list(input()) + ["#"])
S.append(["#"] * (w + 2))

def serch(S, x, y, next_temp):
  ans = []
  cand = [[x-1, y], [x+1, y], [x, y-1], [x, y+1]]
  for pos in cand:
    a, b = pos
    if S[a][b] == "." and pos not in next_temp:
      ans.append(pos)
  return ans

def length(S, i, j):
  S[i][j] = 0
  temp = serch(S, i, j, [])
  counter = 0
  while len(temp) != 0:
    next_temp = []
    counter += 1
    for pos in temp:
      x, y = pos
      S[x][y] = counter
      next_temp += serch(S, x, y, next_temp)
    else:
      temp = next_temp
  return counter

import copy
max_l = 0
for i in range(1, h + 1):
  for j in range(1, w + 1):
    if S[i][j] == ".":
      T = copy.deepcopy(S)
      max_l = max(length(T, i, j), max_l)
print(max_l)

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

public class Main {

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

		while (!(line = br.readLine()).equals("0 0")) {

			int hit = 0, blow = 0;

			int[] pos = new int[10];
			char[] r = line.substring(0, line.indexOf(' ')).toCharArray();
			char[] a = line.substring(line.indexOf(' ') + 1).toCharArray();

			for (int i = 0; i < r.length; i++) {
				pos[r[i] - '0'] = i + 1;
			}
			for (int i = 0; i < a.length; i++) {
				if (pos[a[i] - '0'] > 0) {
					if (pos[a[i] - '0'] == i + 1) {
						hit++;
					} else {
						blow++;
					}
				}
			}
			System.out.println(hit + " " + blow);
		}

	}
}

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

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

            long i = 1;
            while(true) {
            	int line = Integer.parseInt(br.readLine());
            	if(line == 0) {
            		break;
            	}
            	st.append("Case ").append(i).append(": ").append(line).append("\n");
                i++;
            }
            System.out.print(st);
    }
}

Measured memory_bytes: 29460
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int a,b,d;
  cin >> a >> b >>d;
  cout << (a+b) * d /2 << endl;
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

    ll ans = 0;

    REP(i,1, N+1)
    {
        ll key = 0;
        string tmp = to_string(i);
        rep(i,tmp.size()) key += tmp[i]-'0';
        if( A <= key && key <= B) ans += i;
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<numeric>
#include<sstream>
#include<cmath>
using namespace std;
long long int mod = 1e9+7;

int main(){
  vector<int> a(5);
  for(int i=0; i<5; i++) cin >> a[i];
  int ans = 0;
  int tmp = 0;
  for(int i=0; i<5; i++) {
    ans += a[i] + (a[i]%10 != 0 ? 10-a[i]%10 : 0);
    tmp = max((a[i]%10 != 0 ? 10-a[i]%10 : 0), tmp);
  }
  cout << ans - tmp << endl;
  return 0;
}


// EOF


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int A,B,C;
    cin >> A >> B >> C;
    if( A == B && A!=C){ cout << "Yes\n";}
    else if(B == C && C != A){cout << "Yes\n";}
    else if(C == A && B != A){cout << "Yes\n";}
    else{cout << "No\n";}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string S;

  cin >> S;

  if(S.at(2) == S.at(3) &&  S.at(4) == S.at(5)) cout << "Yes" << endl;
  else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
import java.util.*;

public class Main {



    public static void main(String[] args) {

        //1_000_000_000_000_001    15


        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();


        StringBuilder sb = new StringBuilder();

        boolean exit = false;
        while(!exit){
            int m = (int)((N-1)%26L);
            char c = (char)('a'+ m);
            sb.insert(0,c);
            N = (N-1)/26L;
            if(N ==0L) exit=true;
        }
        System.out.println(sb.toString());


    }

}


Measured memory_bytes: 35764
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <string>
typedef long long LL;
using namespace std;

int main(){
    LL n;
    LL a;
    LL ans=0;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a;
        while(a%2==0){
            a/=2;
            ans++;
        }
    }
    cout << ans << endl;
}


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

int main() {
    int w,h,n;cin>>w>>h>>n;
    pair<int,int>left(0,0);
    pair<int,int>right(w,h);
    int xy[n][3];
    rep(i,n){
        rep(j,3) cin>>xy[i][j];
    }
    for(int i=0;i<n;i++){
        if(xy[i][2]==1) left.first=max(left.first,xy[i][0]);
        if(xy[i][2]==2) right.first=min(right.first,xy[i][0]);
        if(xy[i][2]==3) left.second=max(left.second,xy[i][1]);
        if(xy[i][2]==4) right.second=min(right.second,xy[i][1]);
    }
    if(right.first<=left.first || right.second<=left.second) cout<<0<<endl;
    else{
        cout<<(right.first-left.first)*(right.second-left.second)<<endl;
    }

}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n, m; cin >> n >> m;
	vector<vector<int>> gr(n + 1);

	for (int i = 1; i <= m; i++) {
		int a, b; cin >> a >> b;
		gr[a].push_back(b);
		gr[b].push_back(a);
	}

	vector<int> parent(n + 1, -1);
	queue<int> q;

	q.push(1);
	parent[1] = 0;

	while (!q.empty()) {
		int par = q.front(); q.pop();
		debug(par);
		for (auto child : gr[par]) {
			if (parent[child] == -1) {
				parent[child] = par;
				q.push(child);
			}
		}
	}
	bool flg = true;
	for (int i = 2; i <= n; i++) if (parent[i] == -1) {flg = false; break;}
	if (flg == false) cout << "No";
	else {
		cout << "Yes" << endl;
		for (int i = 2; i <= n; i++) cout << parent[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 10256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int P = 1e9 + 7;
inline int add(int a, int b) {if((a += b) >= P) a -= P; return a;}
inline int sub(int a, int b) {if((a -= b) < 0) a += P; return a;}
inline int mul(int a, int b) {return 1ll * a * b % P;}
inline int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
const int N = 2020, M = 2 * N;
int cost[2][N][N];
int val[M], col[M];
int ps[2][N];
int inv[2][N];
int f[N][N];
int n;
int main(){
	scanf("%d", &n);
	n = n + n;
	rep(i, 1, n + 1) {
		char s[2];
		scanf("%s%d", s, val + i);
		col[i] = s[0] == 'B';
		ps[col[i]][val[i]] = i;
	}
	rep(c, 0, 2) {
		rep(i, 1, n + 1) if(col[i] == c) {
			rep(j, i + 1, n + 1) if(col[j] == c && val[j] < val[i])
				inv[c][val[i]]++;
		}
	}
	int m = n / 2;
	rep(c, 0, 2) {
		rep(i, 1, m + 1) {
			cost[c][i][0] = ps[c][i] + inv[c][i] - i;
			rep(j, 1, m + 1) {
				int & cur = cost[c][i][j];
				cur = cost[c][i][j - 1] + (ps[c ^ 1][j] > ps[c][i]) - 1;
			}
		}
	}
	rep(i, 1, m + 1) f[0][i] = f[0][i - 1] + cost[0][i][0], f[i][0] = f[i - 1][0] + cost[1][i][0];
	rep(i, 1, m + 1) rep(j, 1, m + 1) {
		f[i][j] = min(f[i - 1][j] + cost[1][i][j], f[i][j - 1] + cost[0][j][i]);
		//dd(i), dd(j), de(f[i][j]);
		//dd(f[i - 1][j]), dd(cost[1][i][j]), dd(f[i][j - 1]), de(cost[0][i][j]);
	}
	printf("%d\n", f[m][m]);
	return 0;
}


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

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> p(10);
  for(int i=0;i<K;i++){
    int a;
    cin>>a;
    p[a]++;
  }
  while(true){
    int D=N,A=0;
    while(D>0){
      A+=p[D%10];
      D/=10;
    }
    if(!A){
      break;
    }
    N++;
  }
  cout<<N<<endl;
}

Measured memory_bytes: 3592
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int MAX_N = 200010;

int n;
int p[MAX_N];

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

  vector<pii> vp;
  rep(i,n) {
    vp.push_back(pii(p[i], i));
  }

  sort(all(vp));

  int ma = 0, tmp = 0;
  for (int i = 0; i < n; ++i) {
    ++tmp;
    if (i == n-1 || vp[i].sc > vp[i+1].sc) {
      ma = max(ma, tmp);
      tmp = 0;
    } 
  }

  cout << n - ma << endl;

  return 0;
}


Measured memory_bytes: 3316
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using static System.Console;
using static System.Math;
class Simple
{
    string S;
    void Solve() {
        //input
        S = io.String;
        //cal
        var alp = Enumerable.Range('a', 'z' - 'a' + 1).Select(c => (char)c);
        var containsDict = new Dictionary<char, int>();
        foreach (var c in alp) containsDict[c] = 0;
        foreach (var c in S) containsDict[c] += 1;
        var t = containsDict.Where(kp => kp.Value == 0).Select(kp => kp.Key);
        var ans = t.Count() > 0 ? t.Min().ToString() : "None";
        //ret
        WriteLine(ans);
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    private void Stream() {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //SetIn(exStdIn);
        Solve();
        io.Flush();
    }
}
class SimpleIO
{
    string[] _nextBuffer;
    int _bufferCnt;
    char[] cs = new char[] { ' ', '"', ',' };
    StreamWriter sw = new StreamWriter(OpenStandardOutput()) {
        AutoFlush = false
    };
    public SimpleIO() {
        _nextBuffer = new string[0];
        _bufferCnt = 0;
        SetOut(sw);
    }
    string Next() {
        if (_bufferCnt < _nextBuffer.Length)
            return _nextBuffer[_bufferCnt++];
        var st = ReadLine();
        while (st == "")
            st = ReadLine();
        if (st != null)
            _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        else
            st = "";
        _bufferCnt = 0;
        return _nextBuffer[_bufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void Flush() => Out.Flush();
}


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

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

      if (A > B) {
            tmp = B;
            B = A;
            A = tmp;
      }

      for (int i = 1; i <= B; i++) {
            if ((A * i) % B == 0) {
                  cout << A * i << endl;
                  break;
            }
      }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    bool flag = true;
    int cnt = 0;
    while (flag) {
        flag = false;
        for (int j=n-1; j>=1; j--) {
            if (a[j] < a[j-1]) {
                swap(a[j], a[j-1]);
                cnt++;
                flag = true;
            }
        }
    }

    rep(i, n) cout << a[i] << ((i<n-1) ? " " : "\n");
    cout << cnt << endl;
}


Measured memory_bytes: 3232
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int x, a, b; readV(x, a, b);

  if (a >= b)
    writeln("delicious");
  else if (x+a >= b)
    writeln("safe");
  else
    writeln("dangerous");
}


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

using namespace std;

const int maxn = 1e5 + 5;
const int INF = 0x7f7f7f7f;

typedef long long ll;

ll a[maxn];
ll sum[maxn];
vector <ll> vt;

bool cmp(int a , int b) {
	return a > b;
}

int main() {
	ll n , m , v , p;
	ios::sync_with_stdio(0);
	cin >> n >> m >> v >> p;
	vt.push_back(0); 
	for(int i = 1 ; i <= n ; i++) {
		cin >> a[i];
	}
	sort(a + 1 , a + n + 1, cmp);
	int ans = p;
	for(int i = 1 ; i <= n ; i++) {
		sum[i] = sum[i - 1] + a[i];
	} 
	for(int i = p + 1 ; i <= n ; i++) {
		if(a[i] + m < a[p]){
			break;
		}
		else {
			if(m * v <= (p - 1) * m + (n - i + 1) * m+ (a[i] + m) * (i - p) - (sum[i - 1] - sum[p - 1])) {
				ans ++;
			}
			else {
				break;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 1792
A = list(map(int, input().split()))
c_7 = 0
c_5 = 0
for i in A:
  if i == 7:
    c_7 += 1
  if i == 5:
    c_5 += 1
if c_7 == 1 and c_5 == 2:
  print("YES")
else:
  print("NO")

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

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n,a,b,dif,x,y,ans;
	cin>>n>>x>>y;
	a=min(x,y);
	b=max(x,y);
	dif=b-a;
	if(dif%2==0) cout<<dif/2;
	else {
		if(a-1<n-b) {
			ans=a-1;
			b-=(a-1);
			a=1;
			dif=b-a;
			ans+=(dif+1)/2;
		} else {
			ans=n-b;
			a+=(n-b);
			b=n;
			dif=b-a;
			ans+=(dif+1)/2;
		}
		cout<<ans;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>

using namespace std;

int main() {
    while(true) {
        int N, M;
        cin >> N >> M;
        if(!N && !M) break;

        vector<vector<int> > v(N+1);
        vector<bool> invite(N+1, false);
        for(int i = 0; i < M; ++i) {
            int a, b;
            cin >> a >> b;
            v[a].push_back(b);
            v[b].push_back(a);
        }
        for(int i = 0; i < v[1].size(); ++i) {
            int person = v[1][i];
            invite[person] = true;
            for(int j = 0; j < v[person].size(); ++j) {
                invite[v[person][j]] = true;
            }
        }

        int cnt = 0;
        for(int i = 2; i < invite.size(); ++i) {
            if(invite[i]) ++cnt;
        }
        cout << cnt << endl;
    }
    return 0;
}

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

const int mod=998244353;
#define ll long long
#define ld long double
#define pb push_back
#define Dracarys ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()

ll po(ll x,ll y,ll md=mod){
	ll res=1;
	x%=md;
	
	while(y){
		if (y&1){
			res=(res*x)%md;
		}
		y>>=1;
		x=(x*x)%md;
	}
	return res;
}

bitset<1000000+5> prime;

void sieve(ll n){
	prime.flip();
	prime[1]=0;
	for (ll i=2;i<=n;i++){
		if (prime[i]){
			for (ll j=i*i;j<=n;j+=i){
				prime[j]=0;
			}
		}
	}
}

void solve(){
	ll n;
	cin>>n;
	
	sieve(1000000+3);
	
	if (n==1){
		cout<<"0\n";
		return;
	}	
	vector<ll> pp,give;
	ll sz=0;
	for (int i=1;i<=sqrt(n);i++){
		ll f1,f2;
		f1=i;f2=n/i;
		if (n%f1==0){
			ll temp=n;
			if (prime[f1]){
				ll ti=0;
				while(temp%f1==0){
					ti++;
					temp/=f1;	
				}
				//check
				pp.pb(f1);give.pb(ti);sz++;	
			}
		}
	}
	
	ll cnt=0;
	for (ll i=0;i<sz;i++){
		ll mx=give[i];
		ll low=1,high=1e8,inter=0;
		while(low<=high){
			ll mid=low+(high-low)/2;
			ll zz=(mid*(mid+1))/2;
			if (zz<=mx){
				inter=mid;
				low=mid+1;
			}
			else
			high=mid-1;
		}		
		cnt+=inter;
	}
	ll rem=n;
	
	for (ll i=0;i<sz;i++){
		rem/=(pow(pp[i],give[i]));
	}
	
	bool flag=true;
	for (ll i=2;i<=sqrt(rem);i++){
		if (rem%i==0){
			flag=false;
			break;
		}
	}
	
	if (rem==1){
		flag=false;
	}
	
	if (flag){
		cnt++;
	}
	
	cout<<cnt<<"\n";
}	

int main(){
	
	Dracarys

	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}



Measured memory_bytes: 4208
// 2012 toi5 start 13:15
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<vector>
//#include<conio.h>
#include<string.h>
#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;

int main(){
	
	long long  n, i, t, sump = 0, sumj = 0, maxv = 0, v = 0;
	int p[100000], j[100000];
	while (cin >> n, n){
		memset(p, 0, sizeof(p));
		memset(j, 0, sizeof(j));
		for (i = 0; i < n; i++){
			cin >> p[i];
			sump += p[i];
		}
		for (i = 0; i < n - 1; i++){
			cin >> j[i];
		}
		sort(j, j + (n-1) , greater<int>());
		for (i = 0, t = n; t >=1 ; t--, i++){//??????????????¬??°????????§??????????????¬??°???
			maxv = t*(sump + sumj);
			sumj += j[i];
			v = max(v, maxv);
		}
		cout << v << endl;
		sump = 0, sumj = 0, maxv = 0, v = 0;
	}
	return 0;
}

Measured memory_bytes: 1968
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<list>
#include<set>
#include<numeric>

#define MOD 1000000007

using namespace std;
typedef long long ll;

ll sum[100010];
ll a[100010];

int main()
{
	while (1) {
		ll n, k;
		cin >> n >> k;
		if (n == 0 && k == 0)break;

		for (int i = 1; i <= n; i++) {
			cin >> a[i];
		}

		sum[1] = a[1];
		for (int i = 2; i <= n; i++) {
			sum[i] = sum[i - 1] + a[i];
		}

		ll mx = 0;
		ll ans = 0;
		for (int i = k; i <= n; i++) {
			mx = sum[i] - sum[i - k];
			ans = max(mx, ans);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 4600
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<cmath>
#include<unordered_set>
#include<map>
#include<string>
#include<iomanip>
#include<unordered_map>
using namespace std;
#define int unsigned long long
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define LM LONG_MAX
#define LS LONG_MIN
#define cfM 998244353
#define ccM 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define sp setprecision(9)
int max(int b,int a)
{if(b>a)return b;else return a;}
int min(int b,int a)
{if(b<a)return b;else return a;}
int ab(int b)
{if(b<0) return (-1*b);else return(b);}
template<typename T>
struct mkpair{
	T F;
	T S;
};
int32_t main()
{
	//CHECK IF NEGATIVE INPUT UNSIGNED->SIGNED
	int n;
	cin>>n;
	float arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	sort(arr,arr+n);
	float cnt=arr[0];
	for(int i=1;i<n;i++)
	{
		cnt=(cnt+arr[i])/2;
	}
	//cout<<typeid(cnt).name()<<endl;
	cout<<sp<<cnt<<endl;

	
}


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

using namespace std;

#define int long long

signed main(){
	
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    
    map<int,int> mp;
    int n,flag=0;
    cin >> n;
    for(int i=0;i<n;i++){
    	int a;
    	cin >> a;
    	if(mp[a]){
    		flag=1;
		}
		mp[a]++;
	}
	if(flag){
		cout << "NO";
	}
	else{
		cout << "YES";
	}
    
}

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

using namespace std;

int n;
int a[200005];
typedef long long ll;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
        a[i]=a[i]-(i+1);

    sort(a,a+n);

    ll ans=0;
    for(int i=0;i<n/2;i++)
        ans+=(a[n-1-i]-a[i]);

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


Measured memory_bytes: 1024
while True:
    N=input()
    if N==0:break
    W,H=map(int,raw_input().split())
    L=[[0]*W for i in range(H)]
    for i in range(N):
        x,y=map(int,raw_input().split())
        L[y-1][x-1]=1
    S,T=map(int,raw_input().split())
    maxInt=0
    for i in range(H-T+1):
        for j in range(W-S+1):
            cnt=0
            for k in range(T):
                for l in range(S):
                    cnt+=L[i+k][j+l]
            maxInt=max(maxInt,cnt)
    print maxInt

Measured memory_bytes: 4368
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int bfs[SIZE],from[SIZE];
void print(int x) {
    if(!x)return;
    print(from[x]);
    W(x-from[x]);
}
int main(){
    int N,M;
    R(N,M);
    string s; R(s);
    set<int>AA;
    FOR(i,1,N){
        if(s[i]=='0')AA.insert(i);
    }
    int rr=1;
    bfs[0]=0;
    REP(i,rr){
        int x=bfs[i];
        if(x==N){
            print(N);
            return 0;
        }
        auto it=AA.lower_bound(x+1);
        auto it0=it;
        while(it!=AA.end()){
            if(*it<=x+M){
                bfs[rr++]=*it;
                from[*it]=x;
                it++;
            }
            else break;
        }
        AA.erase(it0,it);
    }
    W(-1);
    return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define pi 3.14159
#include <map>
#include <iterator>
using namespace std;
int main()
 {
 	long long int w,h,x,y;
 	cin>>w>>h>>x>>y;
 	cout << fixed << setprecision(9) <<w*h/2.0<<" "; 
 	if(2*x==w&&2*y==h)
 		cout<<"1"<<endl;
 	else
 		cout<<"0"<<endl;
 }

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define all_acc(x) (x).begin(),(x).end(),0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool {return abs(i) < abs(j);});
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;

//出力するよ
void output(vector<pair<char,int>> s){
    int n=s.size();
    for(int i=0;i<n;i++){
        //if(i!=0) cout<<" ";
        //if(i==index) cout<<"["<<s[i]<<"]";
        cout<<s[i].first<<" "<<s[i].second<<endl;//<<endl;
    }
    //cout<<endl;
}

int partition(vector<pair<char,int>> &a,int p,int r){
    int x=a[r].second;
    int i=p-1;
    for(int j=p;j<(r);j++){
        if(a[j].second<=x){
            i++;
            pair<char,int> key=a[i];
            a[i]=a[j];
            a[j]=key;
        }
    }
    pair<char,int> key=a[i+1];
    a[i+1]=a[r];
    a[r]=key;
    return i+1;
}

void quickSort(vector<pair<char,int>> &a,int p,int r){
    if(p<r){
        int q=partition(a,p,r);
        quickSort(a,p,q-1);
        quickSort(a,q+1,r);
    }
}

void merge(vector<pair<char,int>> &a,int left,int mid,int right){
    int n1=mid-left;
    int n2=right-mid;
    vector<pair<char,int>> l(n1+1);
    vector<pair<char,int>> r(n2+1);
    for(int i=0;i<n1;i++) l[i]=a[left+i];
    for(int i=0;i<n2;i++) r[i]=a[mid+i];

    l[n1]=make_pair('A',pow(10,10));
    r[n2]=make_pair('A',pow(10,10));
    int i=0,j=0;

    for(int k=left;k<right;k++){
        //ここが比較しているところ
        //cnt++;
        if(l[i].second<=r[j].second){
            a[k]=l[i];
            i++;
        }else{
            a[k]=r[j];
            j++;
        }
    }
}

void mergeSort(vector<pair<char,int>> &a,int left,int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergeSort(a,left,mid);
        mergeSort(a,mid,right);
        merge(a,left,mid,right);
    }
}

signed main(){
    int n; cin>>n;
    vector<pair<char,int>> a(n);
    vector<pair<char,int>> b(n);
    for(int i=0;i<n;i++){
        char c; int ni;
        cin>>c>>ni;
        a[i]=make_pair(c,ni);
        b[i]=make_pair(c,ni);
    } 

    mergeSort(b,0,n);
    quickSort(a,0,n-1);
    int stable=1;
    for(int i=0;i<n;i++){
        if(a[i].first!=b[i].first){
            stable=0;
            break;
        }
    }
    //output(b);
    if(stable) cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    output(a);
}


Measured memory_bytes: 7444
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        int entire_sum = 0;
        for(int i = 1; i <= n; i++) {
            int sum = 0;
            int m = i;
            while(m > 0) { //各桁の合計を計算
                sum += m % 10;
                m /= 10;
            }
            if(a <= sum && sum <= b) {
                entire_sum += i;
                count++;
            }
        }
        System.out.println(entire_sum);
    }
}

Measured memory_bytes: 27068
#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>;
//pow(x,n)
//cout << fixed << setprecision(桁数);
//string = to_string(数値)
//int = stoi(文字列)
//(int)(char-'0')
//string = itoa(int)
//円周率: M_PI

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

    int syou1 = b/k;
    int syou2 = (a-1)/k;
    if(b%k==0 || syou1>syou2){
        cout << "OK" << endl;
    }
    else cout << "NG" << endl;

    
}







Measured memory_bytes: 3624
gets
a = gets.split(' ').map(&:to_i)
gets
b = gets.split(' ').map(&:to_i)
def binary_search(a,b)
  count = 0
  b.each do |key|
    right = a.length
    left = 0
    while left < right
      mid = (left + right)/2
      if a[mid] == key
        count += 1
        break
      elsif a[mid] < key
        left = mid + 1
      else
        right = mid
      end
    end
  end
  count
end
puts binary_search(a,b)

Measured memory_bytes: 17952
import heapq

N,M = map(int, input().split())

jobs = {}
for _ in range(N):
  a,b = map(int, input().split())
  if a > M:
    continue
  if M - a in jobs:
    jobs[M-a].append(b)
  else:
    jobs[M-a] = [b]

q = []
heapq.heapify(q)

ans = 0
for i in reversed(range(0, M)):
  if i in jobs.keys():
    for job in jobs[i]:
      heapq.heappush(q, (-job, job))
  
  if len(q) > 0:
    ans += heapq.heappop(q)[1]

print(ans)


Measured memory_bytes: 26060
while 1:
    n=input()
    if n==0: break
    ans={}
    x=[raw_input().split() for _ in range(n)]
    w=[]
    for a,b,c in x:
        if not a in w: w.append(a)
        ans.setdefault(a,0)
        ans[a]+=int(b)*int(c)
    y=[k for k,v in ans.items() if v>=1000000]
    if len(y)==0:
        print 'NA'
    else:
        for z in w:
            if z in y: print z

Measured memory_bytes: 4636
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int n; cin>>n;
    vector<int> a(n), b(n);
    ll sum = 0;
    int minusCnt = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(a[i] < 0) minusCnt++;
        b[i] = abs(a[i]);
        sum += b[i];
    }

    int bmin = *min_element(b.begin(), b.end());

    if(minusCnt % 2 == 0){
        cout << sum << endl;
    }
    else{
        cout << sum - bmin * 2 << endl;
    }
}

Measured memory_bytes: 1152
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int l;
	string str;
	getline(cin,str);
	l=str.size();
	for(int i=0;i<l-4;i++){
		if(str[i]=='a'&&str[i+1]=='p'&&str[i+2]=='p'&&str[i+3]=='l'&&str[i+4]=='e'){
	        	str[i]='p';
			str[i+1]='e';
			str[i+2]='a';
			str[i+3]='c';
			str[i+4]='h';
		}
		else if(str[i]=='p'&&str[i+1]=='e'&&str[i+2]=='a'&&str[i+3]=='c'&&str[i+4]=='h'){
	        	str[i]='a';
			str[i+1]='p';
			str[i+2]='p';
			str[i+3]='l';
			str[i+4]='e';
		}
	}
	cout<<str<<endl;
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int N=105;
int st[N],a[N];
int main(){
    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    int top=0;
    int ans=0;
    for(int i=1;i<=n;i++){
        if(top&&st[top]>=a[i]){
            ans+=st[top]-a[i];
            while(top&&st[top]>=a[i]) top--;
        }
        st[++top]=a[i];
    }
    ans+=st[top];
    cout<<ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct Task{int A, B;};

bool comp(const Task &a, const Task &b){
	return a.B < b.B;
}

int main(){
	int n;
	cin >> n;
	vector<Task> va(n);
	for(int i = 0; i < n; i++) cin >> va[i].A >> va[i].B;
	sort(va.begin(), va.end(), comp);
	int s = 0;
	for(int i = 0; i < n; i++){
		if(va[i].B - va[i].A < s){
			cout << "No" << endl;
			return 0;
		}
		s += va[i].A;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1920
#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int):
    x = N // (A+B)
    r = N % (A+B)

    ans = A * x + r
    if r >= A:
        ans -= (r - A)

    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
get_input(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

f('a', C) :- is_lower(C).
f('A', _).

main:-
    get_string(S),
    string_code(1, S, C),
    f(R, C),
    writeln(R).


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

int main()
{
  int n,x;
  while(1)
    {
      int cnt=0;
      cin >> n >> x;
      if(n==0&&x==0) break;
      for(int i=1;i<=n;i++)
        {
          for(int j=i+1;j<=n;j++)
            {
              for(int k=j+1;k<=n;k++)
                {
                  if(i+j+k==x) cnt++;
                }
            }
        }
      cout << cnt << endl;
    }
  return 0;
}

Measured memory_bytes: 3092
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
void read(int &x){
    char ch;bool ok;
    for(ok=0,ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')ok=1;
    for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());if(ok)x=-x;
}
#define rg register
const int maxn=4e5+10;
int n,ans,mx,r[maxn],ll,rr;
struct oo{int l,r;}a[maxn],s[maxn];
bool cmp(oo a,oo b){return a.l==b.l?a.r<b.r:a.l>b.l;}
int main(){
    read(n);int lx=0,rx=n+1;a[n+1].r=1e9;
    for(rg int i=1;i<=n;i++){
	read(a[i].l),read(a[i].r),mx=max(mx,a[i].r-a[i].l+1);
	if(a[i].l>a[lx].l)lx=i;
	if(a[i].r<a[rx].r)rx=i;
    }
    ans=max(0,a[rx].r-a[lx].l+1)+mx;rr=a[rx].r,ll=a[lx].l;
    for(rg int i=1;i<=n;i++)s[i]=(oo){max(a[i].r-ll+1,0),max(rr-a[i].l+1,0)};
    sort(s+1,s+n+1,cmp);r[n+1]=1e9;
    for(rg int i=n;i;i--)r[i]=min(r[i+1],s[i].r);
    for(rg int i=1;i<n;i++)ans=max(ans,s[i].l+r[i+1]);
    printf("%d\n",ans);
}


Measured memory_bytes: 3456
#include <stdio.h>          // printf(), putchar(), scanf()
#include <stdbool.h>

int
main(int argc, char** argv)
{
	while (true)
	{
		int x, y;
		int m, n;

		scanf("%d %d", &m, &n);
		if (m == 0 && n == 0)
			break;

		for (x = 1; x <= n; ++x)
			printf("#");

		printf("\n");
		for (y = 2; y <= m - 1; ++y)
		{
			putchar('#');
			for (x = 2; x <= n - 1; ++x)
				printf(".");

			printf("#\n");
		}

		for (x = 1; x <= n; ++x)
			printf("#");

		printf("\n\n");
	}

	return 0;
}

Measured memory_bytes: 592
num = int(input())
line =[int(x) for x in input().split()]
count = 0
flag = True
while flag:
  for i in range(num):
    if line[i]%2 != 0:
      flag = False
      break
    else:
      line[i] = line[i]//2
  if flag:
    count += 1
  else:
    break
print(count)

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

int main()
{
    long long int h,c=1,ans;
    cin>>h;
    while(h!=1)
    {
        h=h/2;
        c++;
    }
    ans=pow(2,c)-1;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int  n; cin >> n;
	string s; cin >> s;
	int cleft=0,cright=0;
	for(int i=s.size()-1;i>=0;--i)
	{
		if(s[i]==')')
		cleft++;
		else if(s[i]=='('&&cleft>0)
		{
			cleft--;
		}
	}	
	rep(i,cleft)cout<<'(';
	cout<<s;
	cright=cleft=0;
	rep(i,n)
	{
		if(s[i]=='(')
		cright++;
		else if(s[i]==')'&&cright>0)
		{
			cright--;
		}
	}	
	rep(i,cright)cout<<')';
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=3e5+10;
char a[25][25];
int ox[]={0,0,1,-1};
int oy[]={1,-1,0,0};
bool visited[25][25];
int main()
{
    FASTINOUT;
    int r,c;
    cin>>r>>c;
    for (int i=1; i<=r; i++)
    {
        for (int j=1; j<=c; j++)
        {
            cin>>a[i][j];
        }
    }
    int ans=0;
    for (int i=1; i<=r; i++)
    {
        for (int j=1; j<=c; j++)
        {
            if (a[i][j]=='.')
            {
                queue<pair<pair<int,int>,int>>q;
                q.push({{i,j},0});
                while (!q.empty())
                {
                    int x_a=q.front().first.first;
                    int y_a=q.front().first.second;
                    int cnt=q.front().second;
                    q.pop();
                    if (visited[x_a][y_a])
                        continue;
                    visited[x_a][y_a]=true;
                    for (int k=0;k<4;k++){
                        if (x_a+ox[k]>=1&&x_a+ox[k]<=r&&y_a+oy[k]>=1&&y_a+oy[k]<=c&&a[x_a+ox[k]][y_a+oy[k]]=='.'){
                            ans=max(ans,cnt+1);
                            q.push({{x_a+ox[k],y_a+oy[k]},cnt+1});
                        }
                    }
                }
                memset(visited,false,sizeof visited);
            }
        }
    }
    cout<<ans-1<<endl;
    return 0;
}


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

int main() {
  long n, total = 0;

  cin >> n;

  vector<long> a;

  for (int i = 0; i < n; i++) {
    long tmp;
    cin >> tmp;
    a.push_back(tmp);
    total += tmp;
  }

  long ans = LONG_MAX, tmp = 0;

  for (int i = 0; i < n; i++) {
    tmp += a.at(i);
    total -= a.at(i);
    ans = min(ans, abs(tmp - total));
  }

  cout << ans;

  return 0;
}

Measured memory_bytes: 2420
#include <stdio.h>
#include <string.h>
int main()
{
  char S[28];
  int len;
  int f[28] ={0};
  int tmp = -1;
  char ng_w[1];

  scanf("%s", S);
  len = strlen(S);

  if(strcmp(S,"zyxwvutsrqponmlkjihgfedcba")==0)
  {
    puts("-1");
    return 0;
  }

  if(len == 26)
  {
    //----------------------------------------------------
    //len==26
    //----------------------------------------------------
    // printf("len:%d\n", len);
    for (int i = len - 1; i > 0; i--)
    {
      if (S[i - 1] < S[i] && i)
      {
        tmp = i - 1;
        ng_w[0] = S[i - 1];
        // printf("NG at [%d]\n", tmp);
        // printf("NG word is %c\n", ng_w[0]);
        break;
      }
    }
    for (int i = 0; i < tmp; i++)
    {
      f[S[i] - 'a'] = 1;
      // printf("f[%d]:%d\n", S[i] - 'a', f[S[i] - 'a']);
    }
    for (int i = ((ng_w[0] - 'a') + 1); i < 28; i++)
    {
      if (f[i] == 0)
      {
        S[tmp] = 'a' + i ;
        // printf("S[%d]:%c\n",tmp, S[tmp]);
        S[tmp + 1] = '\0';
        break;
      }
    }
  }

  //----------------------------------------------------
  //len<26
  //----------------------------------------------------
  else if(len<26)
  {
    for (int i = 0; S[i] != '\0'; i++)
    {
      f[S[i] - 'a'] = 1;
      // printf("f[%d]:%d\n", S[i] - 'a', f[S[i] - 'a']);
    }
    
    for (int i = 0; i < 28; i++)
    {
      if (f[i] == 0)
      {
        // printf("i:%d\n",i);
        S[len] = 'a' + i ;
        S[len + 1] = '\0';
        // printf("S[len]:%c\n", S[len]);
        // printf("S[]:%s\n", S);
        break;
      }
    }
  }

  // printf("S[]:%s\n", S);
  printf("%s\n", S);

  return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1001001001;

const int mod = 1000000007;


int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size() - 1; i++) {
        if (s[i] == s[i + 1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;

}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	long double a, b;
	cin >> a >> b;
	cout << setprecision(20) << a / b << endl;
}

Measured memory_bytes: 256
using System;

public class Prgram {
	public static void Main(string[] args) {
		string input = Console.ReadLine();
		int n = int.Parse(input);
		int sum = 0;
		for (int i = 0; i < input.Length; i++) {
			sum += int.Parse(input[i].ToString());
		}
		if (n % sum == 0) {
			Console.WriteLine("Yes");
		} else {
			Console.WriteLine("No");
		}
	}
}

Measured memory_bytes: 11220
#include <iostream>
#include <list>

using namespace std;

int main(){
	list<int> list;
	auto it = list.begin();

	int n, cmd, x, d;
	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> cmd;

		switch(cmd){

			case 0:
				cin >> x;
				it = list.insert(it, x);
				break;

			case 1:
				cin >> d;
				advance(it, d);
				break;

			case 2:
				it = list.erase(it);
				break;
		}
	}

	for(auto i : list){
		cout << i << endl;
	}

	return 0;
}



Measured memory_bytes: 18508
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split();
            List<int> a = input.Select(x => int.Parse(x)).ToList();

            int count = 0;

            for (int i = a.Count - 1; i >= 0; i--)
            {
                if (a[i] % 2 != 0) a.RemoveAt(i);
            }
            while (a.Count > 0)
            {
                while (a[0] % 2 == 0)
                {
                    a[0] = a[0] / 2;
                    count++;
                }
                a.RemoveAt(0);

            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 14048
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
int nx[4]={0,-1,0,1};
int ny[4]={-1,0,1,0};

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

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


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

int main()
{
  int a,b,c; cin>>a>>b>>c;
  if (a < c && c < b)
  {
    cout << "Yes" << endl;
  }
  else if (b < c && c < a)
  {
    cout << "Yes" << endl;
  }
  
  else
  {
    cout << "No" << endl;
  }
  
  
}

Measured memory_bytes: 3636