akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())

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

	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	int x;
	cin>>x;

	int ans=1;
	int xx=x;

	while(xx%360 != 0)
	{
		ans++;
		xx+=x; 
	}

	cout << ans << "\n";
}

Measured memory_bytes: 3648
import java.io.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main/*Change to Main When Submitting*/ {
    static BufferedReader __in;
    static PrintWriter __out;
    static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        __in = new BufferedReader(new InputStreamReader(System.in));
        __out = new PrintWriter(new OutputStreamWriter(System.out));

        read();
        int A = nextInt(), B = nextInt(), C = nextInt(), D = nextInt();
        printyn((int)ceil((double)C / B) <= (int)ceil((double)A / D));

        close();
    }

    static final int IBIG = 1000000007;
    static final int IMAX = 2147483647;
    static final long LMAX = 9223372036854775807L;
    static void read() throws IOException {input = new StringTokenizer(__in.readLine());}
    static String readLine() throws IOException {return __in.readLine();}
    static int nextInt() {return Integer.parseInt(input.nextToken());}
    static int readInt() throws IOException {return Integer.parseInt(__in.readLine());}
    static long nextLong() {return Long.parseLong(input.nextToken());}
    static void print(String s) {__out.print(s);}
    static void println(String s) {__out.println(s);}
    static void print(Object o) {__out.print(o);}
    static void println(Object o) {__out.println(o);}
    static void printy() {__out.println("Yes");}
    static void printY() {__out.println("YES");}
    static void printn() {__out.println("No");}
    static void printN() {__out.println("NO");}
    static void printyn(boolean b) {__out.println(b ? "Yes" : "No");}
    static void printYN(boolean b) {__out.println(b ? "YES" : "NO");}
    static void println(int... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), i++); __out.println(a[a.length - 1]);}
    static void println(long... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), i++); __out.println(a[a.length - 1]);}
    static void println() {__out.println();}
    static void close() {__out.close();}
}

Measured memory_bytes: 33064
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define fs first
#define sc second
#define pb push_back
#define sz size() 
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;

const static int INF = 1e8;
const static D EPS = 1e-8;

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

  ll ans = 1e18;
  if(a%2) ans = min(ans,b*c);
  else ans = 0;
  if(b%2) ans = min(ans,c*a);
  else ans = 0;
  if(c%2) ans = min(ans,a*b);
  else ans = 0;

  cout << ans << endl;
}


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

int main() {
    int h, w;
    cin >> h >> w;

    vector<string> a(h);
    rep(i, h) cin >> a[i];

    vector<vector<int>> dist(h, vector<int>(w, -1));
    queue<pair<int, int>> que;

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

    rep(i, h) rep(j, w) {
        if (a[i][j] == '#') {
            dist[i][j] = 0;
            que.push(make_pair(i, j));
        }
    }

    while (!que.empty()) {
        pair<int, int> from = que.front();
        que.pop();

        rep(i, 4) {
            int ny = dy[i] + from.first;
            int nx = dx[i] + from.second;

            if (ny < 0 || h <= ny || nx < 0 || w <= nx) continue;
            if (dist[ny][nx] != -1) continue;
            if (a[ny][nx] == '#') continue;

            dist[ny][nx] = dist[from.first][from.second] + 1;
            que.push(make_pair(ny, nx));
        }
    }

    int ans = -1;
    rep(i, h) ans = max(ans, *max_element(dist[i].begin(), dist[i].end()));

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

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

int main(){
    double n,k;
    cin>>n>>k;
    double ans=0;
    for(int i=1; i<=n; ++i){
        int x=i,cnt=0;
        while(x<k){
            x*=2;
            cnt++;
        }
        ans+=(1/n)*(pow((double)1/2,cnt));
    }
    printf("%.15f",ans);
    return 0;
}

Measured memory_bytes: 384
n = int(input())

t_now = 0
p = (0,0)
ans = True

for _ in range(n):
    t,x,y = map(int,input().split())
    td = t - t_now
    d = abs(p[0]-x) + abs(p[1]-y)
    tmp = td - d
    if tmp >= 0 and tmp % 2 == 0:
        t_now = t
        p = (x,y)
        continue
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
vector <int> edges[N];
int dist[N];
int in_degree[N];
bool visited[N];
void dfs(int now){
	visited[now] = 1;
	for (auto i : edges[now]){
		if (!visited[i]){
			--in_degree[i];
			//cout << ">" << now << " " << i << "<\n";
			dist[i] = max(dist[now]+1, dist[i]);
			if (in_degree[i] == 0)
				dfs(i);
			//visited[i] = 0;
		}
	}
}

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		int x, y;
		cin >> x >> y;
		edges[x].emplace_back(y);
		in_degree[y]++;
	}
	for (int i = 1; i <= n; i++){
		if (!visited[i] && in_degree[i] == 0){
			dfs(i);
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++){
		//cout << dist[i] << " " <<i << "@\n";
		ans = max(dist[i], ans);
	}
	cout << ans <<"\n";
}


Measured memory_bytes: 16112
//Optimize
#pragma GCC optimize("Ofast")

//Head File
#include<bits/stdc++.h>
using namespace std;

#define il inline

//Variable
#define ll long long
#define ull unsigned long long
#define db double
#define lb long double
#define ui unsigned int

//Debug
#define B cerr<<"Break Point"<<endl;
#define P(x) cerr<<#x<<' '<<"="<<' '<<(x)<<endl;
#define p(x) cerr<<#x<<' '<<"="<<' '<<(x)<<' ';
#define ml(x) cerr<<"Size of array is "<<x*4/1024/1024<<" MB"<<endl;

//Vector
#define vc vector
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define vbe(x) x.begin(),x.end()

//Memset
#define ms(x) memset(x,0,sizeof(x))
#define MS(x) memset(x,0x3f3f3f3f,sizeof(x))

//Pair
#define fi first
#define se second

//File

#define fin(x) freopen(x,"r",stdin)
#define fou(x) freopen(x,"w",stdout)
void fio()
{
    #ifndef ONLINE_JUDGE
    freopen("sample.in","r",stdin);
    freopen("sample.out","w",stdout);
    #endif
}
void pti()
{
    double timeuse = clock()*1000.0/CLOCKS_PER_SEC;
    cerr<<"Timeuse "<<timeuse<<"ms"<<endl;
}
void end()
{
    pti();
    exit(0);
}

//Inf
#define INF 0x3f3f3f3f
#define LINF ((long long)(0x3f3f3f3f3f3f3f3f))

//IO
#define pc(s) putchar(s)
#define say(s) cout<<s<<endl
namespace io
{
    const int SIZ=55;int que[SIZ],op,qr;char ch;
    template<class I>
    il void gi(I &w)
    {
        ch=getchar(),op=1,w=0;
	while(!isdigit(ch)){if(ch=='-') op=-1;ch=getchar();}
        while(isdigit(ch)){w=w*10+ch-'0';ch=getchar();}w*=op;
    }
    template<typename T,typename... Args>
    il void gi(T& t,Args&... args){gi(t);gi(args...);}
    template<class I>
    il void print(I w)
    {
        qr=0;if(!w) putchar('0');if(w<0) putchar('-'),w=-w;
	while(w) que[++qr]=w%10+'0',w/=10;
        while(qr) putchar(que[qr--]);
    }
}
using io::gi;
using io::print;

const ll mod=1e9+7;

ll n,a,b;

ll qpow(ll x,ll y)
{
    ll res=1;
    while(y)
    {
	if(y&1) res=res*x%mod;
	x=x*x%mod;
	y>>=1;
    }
    return res;
}
ll inv(ll x)
{
    return qpow(x,mod-2);
}
ll calc(ll x,ll y)
{
    ll res=1;
    for(int i=x-y+1;i<=x;++i) res=res*i%mod;
    for(int i=1;i<=y;++i) res=res*inv(i)%mod;
    return res;
}
int main()
{
    gi(n),gi(a),gi(b);
    ll res=qpow(2,n);
    res=(res-calc(n,a)+mod)%mod;
    res=(res-calc(n,b)+mod)%mod;
    res=(res-calc(n,0)+mod)%mod;
    print(res);
    end();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << # x << "; "<< x << endl


int main() {
	long long N, total, A;
	cin >> N;
	total = 1;
	vector<long long> data(N);
	for (int i = 0; i < N; i++) {
		cin >> A;
		if (A != 0) {
			data.at(i) = A;
		}
		else {
			cout << 0 << endl;
			exit(0);
		}
	}
	for (int j = 0; j < N; j++) {
		
		if (total > 1000000000000000000/data.at(j) || total < 0) {
			cout << -1 << endl;
			break;
		}
		else if (total <= 1000000000000000000 && j + 1 < N) {
			total *= data.at(j);
			continue;
		}
		else {
			total *= data.at(j);
			cout << total << endl;
		}
	}
}




Measured memory_bytes: 4384
#include<iostream>
#include<algorithm>
#include<string>
#define INF (1ULL<<20)
using namespace std;
 
int dp[1001][1001];
 
int main()
{
    fill(dp[0], dp[1000],INF);
    string s1, s2;
    cin >> s1 >> s2;
    int s1size = s1.size()+1, s2size = s2.size()+1;
    for (int i = 0; i < s1size; ++i) {
        for (int j = 0; j < s2size; ++j) {
            if (j == 0) {
                dp[i][0] = i;
                continue;
            }
            if (i == 0) {
                dp[0][j] = j;
                continue;
            }
            dp[i][j] = min(min(dp[i - 1][j - 1] + (s1[i - 1] != s2[j - 1]), dp[i][j - 1] + 1), dp[i - 1][j] + 1);
        }
    }
    cout << dp[s1size-1][s2size-1] << endl;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void uniq(vector<int> &vec){sort(vec.begin(), vec.end());vec.erase(unique(vec.begin(), vec.end()), vec.end());}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n;
    cin>>n;
    VPii a;
    REP(i,0,n){
        int t1,t2;
        cin>>t1>>t2;
        a.pb(mp(t2,t1));
    }
    sort(ALL(a));
    int now=0;
    REP(i,0,n){
        now+=a[i].second;
        if(now>a[i].first){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 6512
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>

using namespace std;

int color[105][105];

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

    int h, w;
    cin >> h >> w;

    int n;
    cin >> n;

    for (int i = 0; i <= h + 1; ++i) {
        color[i][0] = color[i][w + 1] = -1;
    }
    for (int i = 0; i <= w + 1; ++i) {
        color[0][i] = color[h + 1][i] = -1;
    }

    char direction = 'E';
    int x = 1, y = 0;

    for (int i = 1; i <= n; ++i) {
        int nr;
        cin >> nr;

        while (nr--) {
            if (direction == 'E') {
                if (color[x][y + 1] == 0) {
                    ++y;
                    color[x][y] = i;
                }
                else {
                    direction = 'S';
                    ++x;
                    color[x][y] = i;
                }
            }
            else if (direction == 'S') {
                if (color[x + 1][y] == 0) {
                    ++x;
                    color[x][y] = i;
                }
                else {
                    direction = 'W';
                    --y;
                    color[x][y] = i;
                }
            }
            else if (direction == 'W') {
                if (color[x][y - 1] == 0) {
                    --y;
                    color[x][y] = i;
                }
                else {
                    direction = 'N';
                    --x;
                    color[x][y] = i;
                }
            }
            else if (direction == 'N') {
                if (color[x - 1][y] == 0) {
                    --x;
                    color[x][y] = i;
                }
                else {
                    direction = 'E';
                    ++y;
                    color[x][y] = i;
                }
            }
        }
    }

    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            cout << color[i][j] << " ";
        }
        cout << "\n";
    }

    return 0;
}


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

int main() {
  
  int gyo,retu;
  int sum[100] = {0};
  int vec1[100][100];
  int vec2[100];
  
  cin >> retu >> gyo;
  
  for (int i = 0; i < retu; i++) {
    for (int j = 0; j < gyo; j++) {
      cin >> vec1[i][j];
    }
  }
  
  for (int i = 0; i < gyo; i++) {
    cin >> vec2[i];
  }
  
  for (int i = 0; i < retu; i++) {
    for (int j = 0; j < gyo; j++) {
      sum[i] += vec1[i][j] * vec2[j];
    }
    cout << sum[i] <<endl;
  }
  
}

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

int main()
{

        int n;
        cin >> n;
        string t[n];
        string h[n];
        for (int i = 0; i < n; ++i) {
                cin >> t[i] >> h[i];
        }
        int tc = 0;
        int hc = 0;
        for (int i = 0; i < n; ++i) {
                string ts = t[i];
                string hs = h[i];
                int tl = ts.length();
                int hl = hs.length();
                int c = 0;
                while (1) {
                        if (c == tl || c == hl) {
                                if (tl == hl) {
                                        tc += 1;
                                        hc += 1;
                                        break;
                                }
                                else if (tl > hl) {
                                        tc += 3;
                                        break;
                                }
                                else {
                                        hc += 3;
                                        break;
                                }
                        }
                        if (ts[c] > hs[c]) {
                                tc += 3;
                                break;
                        }
                        else if (ts[c] < hs[c]) {
                                hc += 3;
                                break;
                        }
                        c++;
                }




        }
        cout << tc << " " << hc << endl;
}



Measured memory_bytes: 3232
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int n;
	cin >> n;
	int ans = 0;
	int cnt = 0;
	while (cnt<n) {
		ans++;
		cnt += ans;
	}
		cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
template<typename T>
vector<T> smallest_prime_factors(T n) {

    vector<T> spf(n + 1);
    for (int i = 0; i <= n; i++) spf[i] = i;


    for (T i = 2; i * i <= n; i++) {

        // 素数だったら
        if (spf[i] == i) {

            for (T j = i * i; j <= n; j += i) {

                // iを持つ整数かつまだ素数が決まっていないなら
                if (spf[j] == j) {
                    spf[j] = i;
                }
            }
        }
    }

    return spf;
}

template<typename T>
vector<T> factolization(T x, vector<T> &spf) {
    vector<T> ret;
    while (x != 1) {
        ret.push_back(spf[x]);
        x /= spf[x];
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int gcd(int x,int y){
	if(y == 0)return x;
	return gcd(y,x%y);
}

signed main() {

    constexpr int MAX = 1000000;
	int N;cin >> N;
    auto spf = smallest_prime_factors(MAX);
	vector<int> a(N);
	rep(i,N)cin >> a[i];
	int g = a[0];
	for(int i = 1;i < N;i++){
		g = gcd(g,a[i]);
	}
	if(g != 1){
		cout << "not coprime" << endl;
		return 0;
	}

	vector<int> cnt(1100000);
    rep(i,N) {
        int x = a[i];
        auto result = factolization(x, spf);
		set<int> st;
        for (auto z: result){	
			st.insert(z);
		}
		for(auto z:st){
			if(cnt[z]){
				cout << "setwise coprime" << endl;
				return 0;
			}
			cnt[z] = 1;
		}
		
    }
	cout << "pairwise coprime" << endl;

    return 0;
}

Measured memory_bytes: 27472
#include<bits/stdc++.h>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define ull unsigned long long int  // ranges from (0 - twice of long long int)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define mod 1000000007LL
#define llpair pair<ll,ll>
#define INF 1000000000000000000ll
#define np next_permutation
#define PI acos(-1)
#define deb(x) cout<<#x<<" "<<x<<endl;
//ALWAYS USE ll DATA TYPE FOR INTEGER(FASTER THAN INTEGER AS WELL AS SOMETIMES WITHOUT USE LONG UR ANSWER WILL NOT ACCEPTED) && DOUBLE FOR DECIMAL VALUE
template<typename T> // for removing front element from the vector
void pop_front(std::vector<T> &v)
{
    if (v.size() > 0) {
        v.erase(v.begin());
    }
}
template<typename R> // for removing back element from the vector or can directly
void pop_back(std::vector<R> &v) // use vec.pop_back() function...
{
    if (v.size() > 0) {
        v.erase(v.begin()+v.size()-1);
    }
}

bool isprime(ll n)  //IN  O(sqrt(n))
{
    if(n<=1) return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;

    return true;
}

vector<ll> factors(ll n){    //IN  O(sqrt(n))

    vll v;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            v.pb(i);
            if((n/i)!=i)
            v.pb(n/i);
        }
    }
    return v;
}

ll power(ll a, ll n)  // using Binary Exponential in TC O(logn)
{                     // Self Written By </ME> :)
    ll res=1;
    while(1)
    {
        if(n%2){
            res=res*a; n--;
        }
        if(n==0) break;
        a=a*a; n/=2;
    }
    return res;
}

ll ts(ll arr[],int l,int r,int x) // ternary search to find x in sorted array arr
{
    
    while(l<=r)
    {
        ll mid1= l+(r-l)/3;
        ll mid2= r -(r-l)/3;
        if(arr[mid1]==x || arr[mid2]==x)
            return 1;
        if(x<arr[mid1])
            r=mid1-1;
        else if(x>arr[mid2])
            l=mid2+1;
        else
        {
            l=mid1+1;
            r=mid2-1;
        }
    }

    return -1;
}

int main() {
    //auto start = chrono::high_resolution_clock::now();
    fio;
    ll t=1;
    //cin>>t;
    while(t--)
    {
      string s; cin>>s;
      int flag1=0,flag2=0;
      for(int i=0;i<s.length();i++)
      {
        if(s[i]=='A')
            flag1=1;
        else if(s[i]=='B')
            flag2=1;
      }

    if(flag1==1 && flag2==1)
    cout<<"Yes"<<"\n";
    else
        cout<<"No"<<"\n";   

    }

    
    //auto finish = chrono::high_resolution_clock::now();
    //cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;cin>>s;
  bool isok=true;
  rep(i,3) if(s[i]==s[i+1]) isok=false;;
  print(isok?"Good":"Bad");
  return 0;
}

Measured memory_bytes: 256
fn main() {
    proconio::input! {
        n: usize,
        s: proconio::marker::Chars,
        t: proconio::marker::Chars,
    }
    let mut a = s.clone();
    for i in 0..n {
        if a.ends_with(&t) {
            println!("{}", a.len());
            return;
        }
        a.insert(a.len() - i, t[n - 1 - i]);
    }
    println!("{}", a.len());
}


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

int ctoi(char c) {
    int n = c - '0';
    return n;
}

int pow_int(int x, int n) {//x^n
    if (n == 0) {
        return 1;
    }else {
        int y = x;
        for (int i = 0; i < n; i++) {
            x *= y;
        }
        return x;
    }
}

long long pow_ll(int x, int n) {//x^n
    if (n == 0) {
        return 1;
    }else {
        long long ans = 1;
        for (int i = 0; i < n; i++) {
            ans *= x;
        }
        return ans;
    }
}


int main() {
    char a;
    cin >> a;
    int n = a;
    if (n < 97) {
        cout << "A" << endl;
    }else {
        cout << "a" << endl;
    }
}

Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

	static int ans;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		long sum = 0;
		for(int i = 0; i < n; i++ ) {
			a[i] = sc.nextInt();
		}
		for(int i = 1; i <n;i++) {
			if(a[i-1] > a[i]) {
				sum = sum + a[i-1] - a[i];
				a[i] = a[i-1];
			}
			
		}
		
		System.out.println(sum);
	}
}

Measured memory_bytes: 59776
import java.util.Scanner;
class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int i = 1;
        while(i <= 9) {
        		if(n%i == 0) {
        			int a = n/i;
        			if(a >= 1 && a <= 9) {
        				System.out.println("Yes");
        				break;
        			}
        		}
        		i++;
        		if(i==10) System.out.println("No");
        }
    }
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h, w; cin >> h >> w;
    int a = (h & 1) * (w & 1);
    int b = (h & 1) * w + (w & 1) * h - a * 2;
    int c = h * w - (b + a);
    b /= 2, c /= 4;
    string s;
    map<char, int> m;
    for (int i = 0; i < h; i++) {
        string s; cin >> s;
        for (auto &x: s) m[x]++;
    }
    for (auto &iter: m) {
        while (iter.second >= 4 && c) c--, iter.second -= 4;
        while (iter.second >= 2 && b) b--, iter.second -= 2;
        while (iter.second >= 1 && a) a--, iter.second -= 1;
    }
    if (a | b | c) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MAX = 1e5 + 5, MOD = 998244353;
constexpr ll LINF = 1ll << 60; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }, dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

ll modulo_pow(ll x, int n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }

int N;
vi A;
int sumA;

int main() {
    cin >> N;
    A.resize(N);
    rep(i, N) {
        cin >> A[i];
        sumA += A[i];
    }

    vv<ll> dp = vvec<ll>(N + 1, sumA + 300 + 1, 0);
    dp[0][0] = 1;
    rep(i, 1, N + 1) {
        rep(j, 0, sumA + 1) {
            dp[i][j] += 2 * dp[i - 1][j];
            dp[i][j] %= MOD;
            dp[i][j + A[i - 1]] += dp[i - 1][j];
            dp[i][j + A[i - 1]] %= MOD;
        }
    }
    ll ge_half = 0;
    rep(j, (sumA + 1) / 2, sumA + 1) {
        ge_half += dp[N][j];
        ge_half %= MOD;
    }

    vv<ll> dp2 = vvec<ll>(N + 1, sumA + 300 + 1, 0);
    dp2[0][0] = 1;
    rep(i, 1, N + 1) {
        rep(j, 0, sumA + 1) {
            dp2[i][j] += dp2[i - 1][j];
            dp2[i][j] %= MOD;
            dp2[i][j + A[i - 1]] += dp2[i - 1][j];
            dp2[i][j + A[i - 1]] %= MOD;
        }
    }
    ll half = sumA % 2 ? 0 : dp2[N][sumA / 2];

    ll ans = (modulo_pow(3, N) + MOD - 3 * ge_half % MOD + 3 * half) % MOD;
    write(ans);
}

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

#undef int
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
#define int long long int
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int t = 1;
	while (t--) {
		int n;
		cin >> n;
		int arr[n], brr[n];
		for (int i = 0; i < n; i++)
			cin >> arr[i] >> brr[i];
		for (int i = 0; i < n - 2; i++) {
			if (arr[i] == brr[i] && arr[i + 1] == brr[i + 1] && arr[i + 2] == brr[i + 2]) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3636
while(True):
    var=input()
    var=var.split()
    a=int(var[0])
    b=int(var[2])
    op=str(var[1])
    if(op=="?"):
        break
    elif(op=="+"):
        print(a+b)
    elif(op=="-"):
        print(a-b)
    elif(op=="*"):
        print(a*b)
    elif(op=="/"):
        print(a//b)


Measured memory_bytes: 5596
#include <stdio.h>

int main(void){
  int i=0;
  long int x,n=100;
  scanf("%ld",&x);
  while(1){
    n=n*1.01;
    i++;
    if(n>=x){
      printf("%d",i);
      return 0;
    }
  }
  return 0;
}

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


long pow(long A, long P){
	long a = A, p = P;
	if(p == 0) return 1;
	if(p == 1) return a;
	long adash = a * a;
	if(p % 2) return pow(adash, p / 2) * a;
	else return pow(adash, p / 2);
}

int main(){
	long N;
	cin >> N;
	long tmpN = N;
	long i = 1;
	tmpN--;
	while(tmpN - pow(26, i) >= 0){
		tmpN -= pow(26, i);
		i++;
	}
	string ans = "";
	for(long j = 0;j<i;j++){
		long keta = pow(26, i - j - 1);
		long num = tmpN / keta;
		char pls = 'a' + num;  
		ans = ans + pls;
		tmpN = tmpN % keta;
	}
	cout << ans << endl;
}


Measured memory_bytes: 4012
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int d;

	while ( cin >> d )
	{
		int res = 0;

		for ( int i = 0; i * d < 600; i++ )
		{
			res += d * pow( i * d, 2 );
		}

		cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 0
def solve():
    _, *p_l = map(int, open(0).read().split())
    count = 0

    for i, p in enumerate(p_l):
        if i + 1 != p:
            count += 1
            if count > 2:
                print('NO')
                exit()
    print('YES')


if __name__ == '__main__':
    solve()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int x;
    cin >> x;
    for(int i=0;i<10;i++){
        if(x<400 + i*200){
            cout << 9 - i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3652
n = int(input())
a = []
ans = []
c = {}
for i in range(n):
    a.append(int(input()))
    ans.append(0)
ans[0] = 1
c[a[0]] = 0
for i in range(1,n):
    if a[i] not in c:
        c[a[i]] = i
    if a[i] == a[i-1]:
        ans[i] = ans[i-1]
    else:
        ans[i] = (ans[i-1] + ans[c[a[i]]]) % 1000000007
        c[a[i]] = i
print(ans[i])

Measured memory_bytes: 36576
n=int(input())
xl=[list(map(int, input().split())) for _ in range(n)]

rl=[]
for x,l in xl:
    right=x-l
    left=x+l
    rl.append([right,left])
rl.sort(key=lambda x: x[1])
# print(rl)

cnt=0
pos=-float('inf')
for i in range(n):
    if rl[i][0]>=pos:
        pos=rl[i][1]
        cnt+=1
print(cnt)



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

#define mx 105
#define ll long long

int ar[mx][mx];
char ch[mx][mx];

int n,m,k,ii;

void solve()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)scanf("%s",ch[i]+1);

    if(ch[1][1]=='#')ar[1][1]=1;

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(i==1 && j==1)continue;

            if(i>1)
            {
                int val=0;
                if(ch[i-1][j]!=ch[i][j] && ch[i][j]=='#')val++;
                ar[i][j]=ar[i-1][j]+val;
            }
            else ar[i][j]=1000;

            if(j>1)
            {
                int val=0;
                if(ch[i][j-1]!=ch[i][j] && ch[i][j]=='#')val++;
                ar[i][j]=min(ar[i][j],ar[i][j-1]+val);
            }
        }
    }
    printf("%d\n",ar[n][m]);
}

int main()
{
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   int t=1;
  // scanf("%d",&t);
   while(t--)solve();
   return 0;
}


Measured memory_bytes: 3828
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    map<string,int>in;
    rep(i,n){
      string s;
      int tmp;
      cin>>s>>tmp;
      in[s]=tmp;
    }
    int m;
    cin>>m;
    rep(i,m){
      string s;
      int k;
      cin>>s>>k;
      int co=0;
      rep(j,k){
	string tmp;
	cin>>tmp;
	co+=in[tmp];
      }
      if(in[s]>co)in[s]=co;
    }
    string out;
    cin>>out;
    cout<<in[out]<<endl;
  }

}

Measured memory_bytes: 1224
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    Integer n = Integer.parseInt(sc.nextLine());
    List<Integer> vs = Arrays.stream(sc.nextLine().split(" ")).map(Integer::parseInt)
        .collect(Collectors.toList());
    List<Integer> cs = Arrays.stream(sc.nextLine().split(" ")).map(Integer::parseInt)
        .collect(Collectors.toList());

    int sum = 0;
    for (int i = 0; i < n; i++) {
      sum += Math.max(vs.get(i) - cs.get(i), 0);
    }

    System.out.println(sum);
  }
}


Measured memory_bytes: 28492
#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>
#include<thread>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;

const ll MOD = 1000000007;

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

	cout << (B - 1 + A - 2) / (A - 1) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 2003;

int n, m;
char a[N][N];

int a1[N][N], a2[N][N], a3[N][N], a4[N][N];

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            if (a[i][j] == '#')
                continue;
            if (j == 0)
                a1[i][j] = 1;
            else
                a1[i][j] = a1[i][j - 1] + 1;
        }
        for (int j = m - 1; j >= 0; --j)
        {
            if (a[i][j] == '#')
                continue;
            a2[i][j] = a2[i][j + 1] + 1;
        }
    }
    for (int j = 0; j < m; ++j)
    {
        for (int i = 0; i < n; ++i)
        {
            if (a[i][j] == '#')
                continue;
            if (i == 0)
                a3[i][j] = 1;
            else
                a3[i][j] = a3[i - 1][j] + 1;
        }
        for (int i = n - 1; i >= 0; --i)
        {
            if (a[i][j] == '#')
                continue;
            a4[i][j] = a4[i + 1][j] + 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            ans = max(ans, a1[i][j] + a2[i][j] + a3[i][j] + a4[i][j] - 3);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	int n;
	cin >> n;
	queue<int> pq;
	vector<int> tot;
	int digit = 0;
	pq.push(3);
	pq.push(5);
	pq.push(7);
	while(1) {
		digit++;
		if(digit == 9) break;
		queue<int> tmp = pq;
		while(!pq.empty()) pq.pop();
		while(!tmp.empty()) {
			int a = tmp.front();
			tmp.pop();
			rep(i, 3) {
				int t = (i == 0) ? 3 : (i == 1) ? 5 : 7;
				int now = a * 10 + t;
				pq.push(now);
				tot.push_back(now);
			}
		}
	}
	int ans = 0;
	sort(all(tot));
	vector<int> v753;
	rep(i, tot.size()) {
		int tmp = tot[i];
		bool use3 = false;
		bool use5 = false;
		bool use7 = false;
		while(tmp) {
			int t = tmp % 10;
			tmp/= 10;
			if(t == 3) use3 = true;
			if(t == 5) use5 = true;
			if(t == 7) use7 = true;
		}
		if(use3 && use5 && use7) v753.push_back(tot[i]);
	}
	sort(all(v753));
	rep(i, v753.size()) {
		if(v753[i] > n) break;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
ll n,m,k,ans;
string s,t;
const ll powll = 1LL<<1;

int main(void){
  //dp[i+1][s][j] = (i桁目までで条件を満たす数の総数)　s 未満フラグ01、j3フラグ01
  int n,a,b; cin >> n >> a >> b;
  ll i = 2;
  ll p = n;
  ll ans1 = 1;
  while(p > 0){
    if(p&1) ans1 = (ans1*i)%MOD;
    i = (i*i)%MOD;
    p>>=1;
  }
  ll ans2 = 1, ans3 = 1;
  ll y1 = 1;
  ll y2 = 1;
  rep(i,a) y1 = (y1*(i+1))%MOD;
  rep(i,b) y2 = (y2*(i+1))%MOD;
  p = MOD-2;
  while(p > 0){
    if(p&1){
      ans2 = (ans2*y1)%MOD;
      ans3 = (ans3*y2)%MOD;
    }
    y1 = (y1*y1)%MOD;
    y2 = (y2*y2)%MOD;
    p>>=1;
  }
  rep(i,a) ans2 = (ans2*(n-i))%MOD;
  rep(i,b) ans3 = (ans3*(n-i))%MOD;
  cout << (2*MOD+ans1-1-ans2-ans3)%MOD << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cassert>
#include <list>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <limits>
using namespace std;
typedef long long          ll;
typedef unsigned long long ull;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define left(x)		   (x << 1)
#define right(x) 	   (x << 1) + 1
#define mid(l, r) 	   ((l + r) >> 1)
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define debug(x)	   {cerr <<#x<<" = " <<x<<"\n"; }
#define debug2(x, y)       {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<"\n";}
#define debug3(x, y, z)    {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<"\n";}
#define debug4(x, y, z, w) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<", "<<#w << " = " <<w <<"\n";}
#define ss                 second
#define ff                 first
#define m0(x) 		   memset(x,0,sizeof(x))

template<typename T >T min_ ( T a , T b ) { return a > b ? b : a ; }
template < typename T ,  typename... Ts > T min_( T first , Ts... last ){ return  min_(first, min_(last...)); }
template<typename T >T max_ ( T a , T b ) { return a > b ? a : b ; }
template < typename T ,  typename... Ts > T max_( T first , Ts... last ){ return  max_(first, min_(last...)); }

template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<typename T> ostream& operator<< (ostream& out, const vector<T>& v) {
    out << "["; size_t last = v.size() - 1; for(size_t i = 0; i < v.size(); ++i) {
    out << v[i]; if (i != last) out << ", "; } out << "]"; return out;
}
const int mod = 1e9+7;

ll pwr(ll base, ll p){
ll ans = 1; while(p) { if(p&1) ans=(ans*base)%mod; base=(base*base)%mod; p/=2; } return ans;
}
ll gcd(ll a, ll b) {  return b == 0 ? a : gcd(b,a%b); }
ll lcm(ll a, ll b) {  return a*(b/gcd(a,b)); }

const long double PI = (long double)(3.1415926535897932384626433832795);
const ll  mx_ll   = numeric_limits<ll> :: max();
const int mx_int  = numeric_limits<int> :: max();

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

    ull X; cin >> X;

    ull curr = 100;
    int cnt = 0;
    while(true) {
        ull tmp = curr + curr/100;
        //debug2(tmp, curr);
        cnt += 1;
        if(tmp >= X) {
            break;
        }
        curr = tmp;
    }
    cout << cnt << endl;

    

    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

int main() {
  std::string S;
  std::cin >> S;
  std::reverse(S.begin(), S.end());
  std::array<int, 2019> count{};
  ++count[0];
  int cur = 0, ten = 1;
  long long ans = 0;
  for (int i: range(0, S.size())) {
    cur = (cur + ten * (S[i] - '0')) % 2019;
    ans += count[cur];
    ++count[cur];
    ten = (ten * 10) % 2019;
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<int> a(n); for(int & i : a) cin >> i;
  sort(a.begin(), a.end());
  int s = 0;
  for(int i = 0; i < n; i++) s += a[i];
  s -= a[n - 1];
  if(a[n - 1] < s) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = 0; i < K; i++){
        if (i % 2 == 0){
            A /= 2;
            B += A;
        }
        else {
            B /= 2;
            A += B;
        }
    }
    cout << A << " " << B << endl;
}



Measured memory_bytes: 256
class UnionFind
  def initialize n
    @size = Array.new(n,1)
    @parent = Array.new(n,&:itself)
  end

  def get_root x
    @parent[x] == x ? x : get_root(@parent[x])
  end

  def unite x,y
    x = get_root(x)
    y = get_root(y)
    return if x == y
    x,y = y,x if @size[x] < @size[y]
    @size[x] += @size[y]
    @parent[y] = x 
  end

  def same_root? x,y
    return get_root(x) == get_root(y)
  end

  def size x
    return @size[get_root(x)]
  end
end
n,m,k = gets.chomp.split.map(&:to_i)
uf = UnionFind.new(n+1)
frientCnt = Array.new(n+1,0)
blockCnt = Array.new(n+1,0)
m.times do
  a,b = gets.chomp.split.map(&:to_i)
  uf.unite(a,b)
  frientCnt[a] += 1
  frientCnt[b] += 1
end
k.times do
  c,d = gets.chomp.split.map(&:to_i)
  if uf.same_root?(c,d)
    blockCnt[c] += 1
    blockCnt[d] += 1
  end
end
ans = []
1.upto(n) do |i|
  ans << uf.size(i) - frientCnt[i] - blockCnt[i] - 1
end
puts ans.join(" ")

Measured memory_bytes: 6908
#include "bits/stdc++.h"

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

typedef long long LL;
typedef unsigned long UL;

using namespace std;


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

	long long int n;
	cin >> n;

	if (n == 1)
	{
		cout << 0 << endl;

		return 0;
	}

	cout << (n - 1) * n / 2 << endl;

	return 0;
}


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

int main(){
int y, m, d;  
char op, opp;
cin >> y >> op >> m >> opp >> d;
if(y > 2019) cout << "TBD" << endl;
  else if ((y == 2019) && (m >= 5)) cout << "TBD" << endl;
  else cout << "Heisei" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(int I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


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

	ll N,K;
	cin >> N >> K;
	vector<ll> dt[N];
	FOR(i,0,N){
		ll d,t;
		cin >> t >> d;
		t--;
		dt[t].push_back(d);
	}
	priority_queue<ll> ONE,TWO,CHA;
	FOR(i,0,N){
		SORT(dt[i]);
		REV(dt[i]);
		if(dt[i].size()>0)ONE.push(dt[i][0]);
		FOR(j,1,dt[i].size()){
			TWO.push(dt[i][j]);
		}
	}
	ONE.push(-1);
	TWO.push(-1);
	ll ans=0,ansp=0,cut=0;
	FOR(i,0,K){
		if(ONE.top()>=TWO.top()){
			ans += ONE.top();
			cut++;
			ONE.pop();
		}else{
			ans += TWO.top();
			CHA.push(-TWO.top());
			TWO.pop();
		}
	}
	ans += cut*cut;
	ansp = ans - cut*cut;
	while(1){
		if(ONE.size()==1)break;
		if(CHA.size()==0)break;
		ansp += CHA.top();
		ansp += ONE.top();
		CHA.pop();
		ONE.pop();
		cut++;
		ans = max(ans,ansp+cut*cut);
	}
	cout << ans << endl;
}

Measured memory_bytes: 6904
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;


int main(){
	int n, m;
	cin >> n >> m;
	int sum = 0;
	while (m--){
		int a;
		cin >> a;
		sum += a;
	}
	if (sum > n) cout << -1 << endl;
	else cout << n - sum << endl;
}

Measured memory_bytes: 3636