akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int pos[2000],marked[2000];
vector<int>v[2000];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<n; j++)
        {
            int a;
            cin>>a;
            v[i].push_back(a);
        }
    }
    int i,cnt=0;
    for(i=1; i<=100000000; i++)
    {
        int f=1;
        for(int j=1; j<=n; j++)
        {
            if(marked[j]==i)
                continue;
            int x=j;
            int posx=pos[x];
            if(posx==(n-1))
                continue;
            int valx=v[x][posx];
           // cout<<x<<" "<<valx<<endl;
            int y=valx;
            int posy=pos[y];
            if(posy==(n-1))
                continue;
            int valy=v[y][posy];
           // cout<<y<<" "<<valy<<endl;
            if(x==valy && marked[y]!=i )
            {
                pos[x]++;
                pos[y]++;
               //cout<<pos[x]<<" "<<pos[y]<<" "<<x<<" "<<y<<" "<<i<<endl;
                marked[x]=i;
                marked[y]=i;
                if(pos[x]==(n-1))
                    cnt++;
                if(pos[y]==(n-1))
                    cnt++;
                f=0;
            }

        }
        if(cnt==n)
            break;
        if(f)
        {
            cout<<"-1"<<endl;
            return 0;
        }
    }
    cout<<i<<endl;
    return 0;
}


Measured memory_bytes: 7408
nm = gets().split(" ");
n = nm[0].to_i;
m = nm[1].to_i;
x = gets().split(" ");
y = gets().split(" ");
sumx = 0;
sumy = 0;
for i in 0..n-1
	sumx = sumx + (2*(i+1) - n - 1)*x[i].to_i;
end
for j in 0..m-1
	sumy = sumy + (2*(j+1) - m -1)*y[j].to_i;
end
area = sumx*sumy;
waru = 10**9+7;
ans = area%waru
puts(ans);

Measured memory_bytes: 13844
while gets do
  a, b, n = $_.split(' ').map(&:to_f)
  de = (a/b).to_f - (a/b).to_i
  arr = de.to_s.split('')[2..de.to_s.length].map(&:to_i)
  puts arr[0..(n-1)].inject(:+)
end

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

int main() {
    int n;
    int h[100000];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> h[i];

    if (n == 1) {
        cout << "Yes" << endl;
        return 0;
    }
    for (int i = 1; i < n; i++) {
        if (h[i - 1] - h[i] >= 2) {
            cout << "No" << endl;
            return 0;
        } else if (h[i - 1] - h[i] == 1) h[i]++;
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 4024
N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))
D=sorted(D)
T=sorted(T)
i,j=0,0
count=0
while True:
  now=T[i]
  tmp=0
  for k in range(j,N):
    if D[k]==now:
      j=k+1
      count+=1
      i+=1
      break
  else:
    tmp=k
  if count==M:
    print("YES")
    exit()
  if tmp==N-1:
    print("NO")
    exit()


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

using namespace std;

int main()
{
    long long n;
    cin>>n;
    set<string> s;
    while(n--)
    {
        string s1;
        cin>>s1;
        s.insert(s1);
    }
    cout<<s.size()<<"\n";

    return 0;
}

Measured memory_bytes: 19240
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define all(v) (v).begin(),(v).end()
int main(){
	int n,k;
	cin>>n>>k;
	vector<int> hn(n,0);
	rep(i,n){
		cin>>hn.at(i);
	}
	sort(all(hn));
	reverse(all(hn));
	int p,q;
	q=1e10;
	rep(l,n-k+1){
		p=(hn.at(l)-hn.at(l+k-1));
		q=min(q,p);
	}
	cout<<q<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <climits>
#include <string.h>
#include <cctype>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

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

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

bool comp(int i, int j) {
	return i > j;
}

int main()
{
	int n, d;
	cin >> n >> d;
	vector<vector<int>> pos;
	for (int i = 0; i < n; i++)
	{
		vector<int> hh;
		for (int j = 0; j < d; j++)
		{
			int tmp;
			cin >> tmp;
			hh.push_back(tmp);
		}
		pos.push_back(hh);
	}
	int count = 0;
	for (int i = 0; i < n-1; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			int dis = 0;
			for (int k = 0; k < d; k++)
			{
				dis += (pos[i][k] - pos[j][k]) * (pos[i][k] - pos[j][k]);
			}

			for (int k = 1; k * k <= 40000; k++)
			{
				if (dis == k * k)
				{
					count++;
					break;
				}
				if (k * k > dis)
				{
					break;
				}
			}
		}
	}
	cout << count;
}



Measured memory_bytes: 31616
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



void solve(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll l=a+b,r=c+d;
    if(l>r) cout<<"Left"<<endl;
    else if(l==r) cout<<"Balanced"<<endl;
    else cout<<"Right"<<endl;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void solve() {
    int A,B;
    cin >> A >> B;
    REP(x,3000) {
        ll a = (ll)((double)x*0.08);
        ll b = (ll)((double)x*0.1);
        if (A==a && B == b) {
            cout << x << endl;
            return;
        }
    }
    cout << -1 << endl;
    return;
}

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


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

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

int main() {
    int H, W;
    cin >> H >> W;
    string S[H];
    for (int i = 0; i < H; i++)
    {
        cin >> S[i];
    }

    int d[H][W];
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            d[i][j] = 0;
        }

    }

    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if(S[i][j] == '#'){
                for (int k = 0; k < 8; k++)
                {
                    int x = j + dx[k], y = i + dy[k];
                    if(x < 0 || x >= W || y < 0 || y >= H) continue;
                    if(S[y][x] != '#') d[y][x]++;
                }
            }
        }
    }

    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if(S[i][j] == '#') cout << "#";
            else cout << d[i][j];
        }
        cout << endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long INF = 2147483647;
int N;
vector<int> t;

void update(int i, int x){
    i += N-1;
    t[i] = x;
    while(i > 0){
        i = (i-1)/2;
        t[i] = min(t[2*i+1], t[2*i+2]);
    }
}

int find(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return INF;
    if(a <= l && r <= b) return t[k];
    else{
        int c1 = find(a, b, 2*k+1, l, (l+r)/2);
        int c2 = find(a, b, 2*k+2, (l+r)/2, r);
        return min(c1, c2);
    }
}

int main(void){
    int n, q, c, x, y;
    cin >> n >> q;
    N=1;
    while(N<n) N*=2;
    t.assign(2*N-1, INF);
    for(int j = 0; j < q; j++){
        cin >> c >> x >> y;
        if(c == 0){
            update(x, y);
        }else{
            cout << find(x, y+1, 0, 0, N) << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
long long date,n,tmp,sum=0;
void solve(){
    if(date>=sum) {
        cout<<date-sum<<endl;
    }else{
        cout<<"-1"<<endl;
    }
}

int main(){
    cin>>date>>n;
    rep(i,n){
        cin>>tmp;
        sum+=tmp;
    }
    solve();
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<sstream>
#include<string>
using namespace std;

int main()
{
	int n, i;
	string s;
	stringstream ss;

	getline(cin, s);
	ss.str(s);
	ss>>n;
	for (i = 0; i < n; i++) {
		getline(cin, s);
		while (s.find("Hoshino") != string::npos)
			s[s.find("Hoshino")+6] = 'a';
		cout<<s<<endl;
	}

	return 0;
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a + b > c + d){
    cout << "Left" <<endl;
  }else if(a + b == c + d){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>
#include <math.h>
#include <numeric>
#include <set>

using namespace std;
typedef long long Int;
#define REP(i , x) for(Int i = 0 ; i < x ; ++i)
typedef pair<int, int> P;


int main()
{
	set<int> member;

	vector<int> no;

	int a;
	while (cin >> a){
		member.insert(a);
	}

	REP(i, 30){
		if (member.find(i + 1) == member.end())
			no.push_back(i + 1);
	}
	sort(no.begin(), no.end());

	for (auto x : no){
		cout << x << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int gi()
{
	char c; int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())x=(x<<1)+(x<<3)+c-'0';
	return x*f;
}
const int N=2005;
char s[N][N];
int lft[N][N],rht[N][N],up[N][N],down[N][N];
int main()
{
	int n=gi(),m=gi();
	for(int i=1;i<=n;++i) scanf("%s",s[i]+1);
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=m;++j) lft[i][j]=(s[i][j]=='#'?j:lft[i][j-1]);
		rht[i][m+1]=m+1;
		for(int j=m;j>=1;--j) rht[i][j]=(s[i][j]=='#'?j:rht[i][j+1]);
	}
	for(int j=1;j<=m;++j)
	{
		for(int i=1;i<=n;++i) up[i][j]=(s[i][j]=='#'?i:up[i-1][j]);
		down[n+1][j]=n+1;
		for(int i=n;i>=1;--i) down[i][j]=(s[i][j]=='#'?i:down[i+1][j]);
	}
	int ans=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			ans=max(ans,rht[i][j]-lft[i][j]+down[i][j]-up[i][j]-3);
	printf("%d",ans);
}


Measured memory_bytes: 66944
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 1000000007
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

int n, m, x, a, ans;
int arr[105];

int main(){
    ios::sync_with_stdio(0);
    cin >> n >> m >> x;
    clean(arr,0);
    forn(i,m){
        cin >> a;
        arr[a]++;
    }

    ans = 0;

    forr(i,x,n+1){
        if(i != n){
            ans += arr[i];
        } 
    }

    a = 0;

    for(int i = x; i >= 0; i--){
        if(i != 0){
            a += arr[i];
        }
    }

    ans = min(ans,a);

    cout << ans << "\n";

    return 0;
}

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

int main(){
  int n,m;

  while(cin >> n >> m, n){
    vector<int> a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    
    sort(a.begin(),a.end(),greater<int>());
    
    int ans = 0;
    for(int i=0;i<n;i++){
      if((i+1)%m)ans += a[i];
    }
    cout << ans << endl;
  }
}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string ss;
  int n;
  cin>>ss;
  n=ss.size();
  for(int i=0;i<n/2;i++){
    if(ss[i]!=ss[n-i-1]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  for(int i=0;i<n/2;i++){
    if(ss[i]!=ss[n/2-i-1]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  for(int i=0;i<n/2;i++){
    if(ss[i+n/2+1]!=ss[n-i-1]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]
sortA = sorted(A, reverse = True)
maxA = sortA[0]

for i in range(N):
    if A[i] < sortA[0] or sortA[1] == maxA:
        print(maxA)
    else:
        print(sortA[1])


Measured memory_bytes: 14112
#include <iostream>
#include <vector>

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

void maxHeapify(std::vector<int> &a, int i, int n) {
  int left = 2 * i;
  int right = left + 1;
  // std::cout << left << right << '\n';
  int largest = i;
  if (left <= n && a[left] > a[i]) largest = left;
  if (right <= n && a[right] > a[largest]) largest = right;

  if (largest != i) {
    int temp = a[i];
    a[i] = a[largest];
    a[largest] = temp;
    maxHeapify(a, largest, n);
  }
}

int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n + 1);
  rep(i, n) std::cin >> a[i + 1];

  // buildMaxHeap(a, n);
  for (int i = n / 2; i >= 1; --i) { maxHeapify(a, i, n); }
  rep(i, n) std::cout << " " << a[i + 1];
  std::cout << '\n';
  return 0;
}



Measured memory_bytes: 4676
MOD = 10 ** 9 + 7
 
s = str(input())
 
s = list(s)
 
cur = [0] * 13
 
if s[0] != "?":
    cur[int(s[0])] = 1
else:
    for j in range(10):
        cur[j] = 1
 
for i in range(1,len(s)):
    pre = cur[:]
    cur = [0] * 13
    if s[i] != "?":
        for j in range(13):
            q = (j * 10 + int(s[i])) % 13
            cur[q] += pre[j] % MOD
    else:
        for j in range(13):
            for k in range(10):
                p = (j * 10 + k) % 13
                cur[p] += pre[j] % MOD
 
print(cur[5] % MOD)

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

using namespace std;

typedef pair<int, int> pii;
int n;

int cti(char c) { return (c - '0'); }

int encode(string s) {
	int H = 10 * cti(s[0]) + cti(s[1]);
	int M = 10 * cti(s[3]) + cti(s[4]);
	int S = 10 * cti(s[6]) + cti(s[7]);
	return 3600 * H + 60 * M + S;
}

int main() {
	while (cin >> n, n) {
		priority_queue<pii, vector<pii>, greater<pii> > q;
		for (int i = 0; i < n; i++) {
			string in, out; cin >> in >> out;
			q.push(make_pair(encode(in), 1));
			q.push(make_pair(encode(out), -1));
		}
		
		int ans = 0, cnt = 0;
		while (!q.empty()) {
			int t = q.top().second; q.pop();
			cnt += t;
			ans = max(ans, cnt);
		}
		
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1468
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    int a2 = 0;
    int b2 = 0;
    for (int i = 0; i < b; i++){
        a2 = a2 + a * pow(10, i);
    }
    for (int i = 0; i < a; i++){
        b2 = b2 + b * pow(10, i);
    }
    stringstream a1;
    stringstream b1;
    a1 << a2;
    b1 << b2;
    string aa = a1.str();
    string bb = b1.str();
    if(aa > bb){
        cout << bb << endl;
    }
    else if (aa < bb){
        cout << aa << endl;
    }
    else if (aa == bb){
        cout << aa << endl;
    }
    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main(){
  int a,b,c;
  int f=0,s=0;
  cin>>a>>b>>c;
  if(a==5)f++;
  else if(a==7)s++;
  if(b==5)f++;
  else if(b==7)s++;
  if(c==5)f++;
  else if(c==7)s++;
  if(f==2&&s==1)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

int n, m;
vector <int> adjList[100005];
queue <int> bfs;
bool visited[100005];
int ans;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		int a, b; scanf("%d%d", &a, &b);
		adjList[a].push_back(b);
		adjList[b].push_back(a);
	}
	for (int i = 1; i <= n; i++) {
		if (!visited[i]) {
			ans++;
			visited[i] = true;
			bfs.push(i);
			while (!bfs.empty()) {
				int u = bfs.front(); bfs.pop();
				for (int v : adjList[u]) {
					if (visited[v]) continue;
					visited[v] = true;
					bfs.push(v);
				}
			}
		}
	}
	printf("%d\n", ans - 1);
	return 0;
}


Measured memory_bytes: 9080
def solve():
    # from bisect import bisect_left
    import sys

    N = int(input())
    A = [int(x) for x in sys.stdin.readline().split()]
    B = [int(x) for x in sys.stdin.readline().split()]
    M = max(A) + max(B)
    K = len(bin(M)) - 2
    mask = (1 << K) - 1
    k = K - 1
    T = 1 << k
    ans = 0
    while k >= 0:
        for i in range(N):
            B[i] &= mask
            A[i] &= mask
        B = list(sorted(b & mask for b in B))
        A = list(sorted(a & mask for a in A))
        bit = 0
        T1, T2, T3 = 0, 0, 0
        for a in reversed(A):
            while T1 < N and a + B[T1] < T:
                T1 += 1
            while T2 < N and a + B[T2] < 2 * T:
                T2 += 1
            while T3 < N and a + B[T3] < 3 * T:
                T3 += 1
            # T1 = bisect_left(B, T - a, T1)
            # T2 = bisect_left(B, 2 * T - a, T2)
            # T3 = bisect_left(B, 3 * T - a, T3)
            # T4 = bisect_left(B, 4 * T - a, T4)
            bit += (N - T3) + (T2 - T1)
            bit &= 1
        ans += bit * T
        k -= 1
        T >>= 1
        mask >>= 1

    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 142172
# -*- coding: utf-8 -*-
from scipy.sparse.csgraph import floyd_warshall

N, M, L = map(int,input().split())
  
d = [[0 for i in range(N)] for j in range(N)] 
for i in range(M):
    x,y,z = map(int,input().split())
    d[x-1][y-1] = z
    d[y-1][x-1] = z
for i in range(N):
    d[i][i] = 0

d = floyd_warshall(d, directed = False)
LN = [[0 for i in range(N)] for j in range(N)]

for i in range(N):
    for j in range(N):
        if d[i][j] <= L:
            LN[i][j] = 1
            LN[j][i] = 1

LN = floyd_warshall(LN, directed = False)    
s = []
t = []
Q = int(input())
for i in range(Q):
    s1, t1 = map(int,input().split())
    s.append(s1)
    t.append(t1)
for i in range(Q):
    if LN[s[i]-1][t[i]-1] == float("inf"):
        print(-1)
    else:
        print(int(LN[s[i]-1][t[i]-1]-1))

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            var A= AB[0];
            var B = AB[1];

            var C = Math.Max(A, B);
            var D = Math.Min(A, B);

            Console.WriteLine(C+Math.Max(C-1,D));



            


        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
long long d[100010][2]={};
int main(){
  int i,M=1e9+7;
  char s[100010];
  d[1][1]=2;
  d[1][0]=1;
  scanf("%s",s);
  for(i=1;s[i];i++){
    d[i+1][0]=(d[i][0]*3%M+d[i+1][0])%M;
    if(s[i]=='0')d[i+1][1]=(d[i+1][1]+d[i][1])%M;
    else{
      d[i+1][0]=(d[i+1][0]+d[i][1]    )%M;
      d[i+1][1]=(d[i+1][1]+d[i][1]*2%M)%M;
    }
  }
  printf("%lld\n",(d[i][0]+d[i][1])%M);
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long int H, W;
    cin >> H >> W;

    if (H == 1 || W == 1) {
        cout << 1;
    }
    else if (H != 1 || W != 1) {
    
    if (H % 2 == 0 && W % 2 == 0) {
        cout << (H / 2) * W; 
    }
    else if (H % 2 != 0 && W % 2 == 0) {
        cout << (W / 2) * H;
    }
    else if (H % 2 == 0 && W & 2 != 0) {
        cout << (H / 2) * W;
    } 
    else if (H % 2 != 0 && W % 2 != 0) {
        cout << ((H * W) / 2 ) + 1;
    }
    
    }
}


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

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

double distance(double x1, double y1, double x2, double y2){
    return sqrt(pow(abs(x1-x2), 2)+pow(abs(y1-y2), 2));
}

int main(){
    int n;
	cin>> n;
	rep(q, n){
	        double x1,y1,x2,y2,x3,y3;
	        cin >> x1 >>y1 >>x2 >>y2 >>x3 >>y3;
	        double a = distance(x1, y1, x2, y2), b = distance(x2, y2, x3, y3), c = distance(x3, y3, x1, y1);
	        double s = (a+b+c)/2;
	        double S = sqrt(s*(s-a)*(s-b)*(s-c));

			double r = a*b*c/4/S;

	        double a1 = 2*(x2-x1), b1 = 2*(y2-y1), c1 = x1*x1-x2*x2+y1*y1-y2*y2;
	        double a2 = 2*(x3-x1), b2 = 2*(y3-y1), c2 = x1*x1-x3*x3+y1*y1-y3*y3;
	        double x = (b1*c2-b2*c1)/(a1*b2-a2*b1);
	        double y = (c1*a2-c2*a1)/(a1*b2-a2*b1);
	        printf("%.3f %.3f %.3f\n", x, y, r);
	}
}

Measured memory_bytes: 1244
#include<iostream>
#include<cmath>
#include <iomanip>
using namespace std;
int main(){
	long int N,a;
	double b;
	cin>>N;
	if(N%2==0)
	a=N/2;
	else
	a=(N+1)/2;
	b=(a*1.0000000000)/N;
	cout<<setiosflags(ios::fixed)<<setprecision(10)<<b<<endl;
return 0;
}

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

int main(){
  string s,t;
  cin >> s >> t;

  int cnt = 1000;
  for (int i = 0; i < s.size() - t.size() + 1; i++)
  {
    int temp = 0;
    int k = 0;
    //ここでサイズを入れ替える回数をtempにカウント
    for (int j = i; j < i+t.size();j++){
      if(s[j]!=t[k])
        temp++;
      k++;
    }
    cnt = min(cnt, temp);
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3560
import sys
import math
 
a, b, h, m = map(int, input().split())
 
#if h == 0 and m == 0:
#  print(0)
#  sys.exit()
  
angle_h = (h*60 + m) * (360 / 12 / 60)
angle_m = m * (360 / 60)
 
angle = abs(angle_h - angle_m)
radian = math.radians(angle)
cosine = math.cos(radian)
ans = a*a + b*b - 2*a*b * cosine
ans = math.sqrt(ans)
 
print(ans)

Measured memory_bytes: 9456
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

template <int size>
struct Buffer{
    int idx = 0;
    char buf[size];
    Buffer(){
        cin.read(buf, size - 1);
    }
    int next(){
        int ret = 0;
        while(!isdigit(buf[idx])){ idx++; }
        while(isdigit(buf[idx])){ ret = ret * 10 + buf[idx++] - '0'; }
        return ret;
    }
};
Buffer<(int)2e5> buf;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h = buf.next(), w = buf.next();
    vector<vector<int>> cs(10, vector<int>(10));
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            cs[i][j] = buf.next();
        }
    }
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            for(int k = 0; k < 10; k++){
                cs[j][k] = min(cs[j][k], cs[j][i] + cs[i][k]);
            }
        }
    }
    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int a = buf.next();
            if(a != -1){
                ans += cs[a][1];
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n;
  cin >>n;
  string ans = "";
  while(n--){
      ans+=(char)(n%26+'a');
      n /= 26;
  }
  reverse(ans.begin(),ans.end());
  cout << ans << endl;
}


Measured memory_bytes: 3576
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<string>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define SZ(a) (int)((a).size())
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> Pii;
typedef pair <ll, int> Pli;
typedef unsigned long long ull;
const double eps = 1e-8;
const ll infll = 0x7fffffffffffffff;
const int mod = (int)(1e9) + 7;
const int inf = 0x7fffffff;
const int maxn = (int)(2e5) + 7;
const int maxm = 300;

int K, A, B, flg;

int main() {
	
	scanf("%d%d%d", &K, &A, &B);
	for (int i = A; i <= B; i++) {
		if (i % K) continue;
		flg = 1;
		break;
	}
	if (flg) puts("OK");
	else puts("NG");

	return 0;
}		

Measured memory_bytes: 3132
#include <iostream>
#include <vector>

using namespace std;

int n;

int main()
{
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin >> n;
    cout << a.at(n-1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < (n);i++)
#define COUT(x) cout << (x) << endl;

int main(){
    int a,b,x;
    cin >> a >> b >> x;
    int ans = 0;
    if (2*b<a){
        ans += 2*b*(x/1000);
    }else{
        ans += a*(x/1000);
    }
    x %= 1000;
    if (x==0)
    {
        
    }else if (x<=500)
    {
        ans += min(a,b);
    }else{
        ans += min(a,2*b);
    }
    COUT(ans);
}


Measured memory_bytes: 3132
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
typedef long long LL;
const int MAXN = 1e5 + 8;

vector<int> sons[MAXN];
int len, n;
inline void findthemainlink(int u, int fa, int cnt){
    if(u == n){
        len = cnt;
        return;
    }
    int sz = sons[u].size(), v, i;
    for(i = 0; i < sz; i++){
        v = sons[u][i];
        if(v == fa) continue;
        findthemainlink(v, u, cnt + 1);
    }
}

bool f[MAXN];
inline bool flag(int u, int fa, int cnt){
    if(u == n){
        f[u] = true;
        return true;
    }
    int sz = sons[u].size(), v, i;
    for(i = 0; i < sz; i++){
        v = sons[u][i];
        if(v == fa) continue;
        if(flag(v, u, cnt + 1)){
            if(cnt > len / 2){
                f[u] = true;
                return true;
            }
            else{
                return false;
            }
        }
    }
    return false;
}

int a, b;
inline void dfs(int u, int fa){
    if(f[u]){
        return;
    }
    a++;
    int sz = sons[u].size(), v, i;
    for(i = 0; i < sz; i++){
        v = sons[u][i];
        if(v == fa) continue;
        dfs(v, u);
    }
}

int main()
{
    #ifdef LOCAL
    freopen("b.txt", "r", stdin);
    //freopen("b.out", "w", stdout);
    int T = 4;
    while(T--){
    #endif // LOCAL
    ios::sync_with_stdio(false); cin.tie(0);

    int u, v, i;
    cin >> n;
    for(i = 1; i < n; i++){
        cin >> u >> v;
        sons[u].push_back(v);
        sons[v].push_back(u);
    }
    len = 0;
    findthemainlink(1, -1, 0);
    flag(1, -1, 0);
    a = 0;
    dfs(1, -1);
    b = n - a;
    if(a > b){
        cout << "Fennec" << endl;
    }
    else{
        cout << "Snuke" << endl;
    }





    #ifdef LOCAL
    for(i = 1; i <= n; i++) sons[i].clear();
    memset(f, false, sizeof f);
    cout << endl;
    }
    #endif // LOCAL
    return 0;
}



Measured memory_bytes: 10112
#include<iostream>
#include<math.h>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<string>
#include<string.h>
#include<map>
#include<vector>
#include<set>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n/100==n%10) 
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

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

int main(){
    int s,t,m;
    cin >> s >> t >> m;
    vector<int> a(s);
    rep(i,s) cin >> a[i];
    vector<int> b(t);
    rep(i,t) cin >> b[i];
    int r = 2e9;
    rep(i,m){
        int x,y,z;
        cin >> x >> y >> z;
        int s = a[x-1] + b[y-1] - z;
        r = min(r,s);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    r = min(r,(a[0]+b[0]));
    cout << r << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>p(n+1);
    vector<int>c(n+1);
    for(int i=1;i<=n;i++)
        cin>>p[i];
    for(int i=1;i<=n;i++)
        cin>>c[i];
    long long ans=-1e18;
    for(int i=1;i<=n;i++)
    {
        int cur=i;
        long long sum=0;
        vector<long long> temp;
        while(p[cur]!=i)
        {
            sum+=c[p[cur]];
            temp.push_back(sum);
            cur=p[cur];
        }
        sum+=c[i];
        temp.push_back(sum);
        int sz=(int)temp.size();
        if(k>sz)
        {
            ans=max(ans,(k/sz)*sum+((k%sz>0)?(*max_element(temp.begin(),temp.begin()+k%sz)):0));
            ans=max(ans,(k/sz-1)*sum+*max_element(temp.begin(),temp.end()));
            ans=max(ans,*max_element(temp.begin(),temp.end()));
        }
        else
        {
            ans=max(ans,*max_element(temp.begin(),temp.begin()+k));
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3764
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define IREP(i, v) for(auto i = (v).begin(); i != (v).end(); ++i)
#define IRREP(i, v) for(auto i = (v).rbegin(); i != (v).rend(); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int N, cntInside(0), mincnt(0); ll K; cin >> N >> K;
    VI A(N); 
    REP(i, N) cin >> A[i];
    REP(i, N){
        REP(j, N){
            if(i == j) continue;
            if(i < j && A[i] > A[j]) ++cntInside;
            if(A[i] > A[j]) ++mincnt;
        }
    }
    ll ans(cntInside * K % MOD);
    ans = (ans + (K*(K-1)/2 % MOD * mincnt % MOD)) % MOD;
    if(ans < 0) ans += MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
using namespace std;
int main()
{
    fastio;
    string s;
    long long i,cnt1=0,cnt2=0;
    cin>>s;
    for(i=0;i<s.size();i++)
    {
        if(i%2==0)
        {
            if(s[i]!='0')
            {
                cnt1++;
            }
        }
        else
        {
            if(s[i]!='1')
            {
                cnt1++;
            }
        }
    }
    for(i=0;i<s.size();i++)
    {
        if(i%2==0)
        {
            if(s[i]!='1')
            {
                cnt2++;
            }
        }
        else
        {
            if(s[i]!='0')
            {
                cnt2++;
            }
        }
    }
    cout<<min(cnt1,cnt2);
    return 0;
}

Measured memory_bytes: 3680
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = s, i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = s; i < (n); ++i)
#define VFORS(i, s, n) for(int i = s; i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = s, i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = s, i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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



int main(){
    int n, m; cin >> n >> m;
    VI divisor;
    for(int i = 1; i * i <= m; ++i){
        if(!(m%i)){
            divisor.PB(i);
            if(i*i != m) divisor.PB(m/i);
        }
    }
    RSORT(divisor);
    REP(i, SZ(divisor)){
        if(divisor[i] <= m/n){
            cout << divisor[i] << "\n";
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;
 
int main(){

    int n,k;
    string s;

    cin >> n;
    cin >> s;
    cin >> k;

    char tmpc = s[k - 1];

    for(int i = 0; i < n; i++){
        if(s[i] != tmpc) s[i] = '*';
    }

    cout << s << endl;
    return 0;
}

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

using namespace std;
vector<int> G[100010];
int d[3][100010] = {};
int dfs(int s, int p,int k){
    for(int v:G[s]){
        if(v==p) continue;
        d[k][v] = d[k][s] + 1;
        dfs(v,s,k);
    }
}

int mx[100010] = {};
void dfs2(int s,int p,int dia,int par){
    for(int v:G[s]){
        if(v==p) continue;
        if(d[0][v] + d[1][v]==dia) continue;
        d[2][v] = d[2][s] + 1;
        mx[par] = max(mx[par],d[2][v]);
        dfs2(v,s,dia,par);
    }
}

int n,seg[2][200010];
void init(int n,int x){
    for(int i=n - 1;i>0;i--){
        seg[x][i] = max(seg[x][i<<1],seg[x][i<<1|1]);
    }
}

void update(int val,int p,int x){
    for(seg[x][p += n] = val;p>1;p>>=1){
        seg[x][p>>1] = max(seg[x][p],seg[x][p^1]);
    }
}

int query(int l,int r,int x){
    int res = 0;
    for(l += n,r += n; l<r;l>>=1,r>>=1){
        if(l&1) res = max(res,seg[x][l++]);
        if(r&1) res = max(res,seg[x][--r]);
    }
    return res;
}

int ans[100010];
int main(){
    int i;
    cin >> n;
    for(i=0;i<n - 1;i++){
        int a,b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b); G[b].push_back(a);
    }
    dfs(0,-1,0);
    int j = -1,x = -1;
    for(i=0;i<n;i++){
        if(d[0][i]>x){
            j = i; x = d[0][i];
        }
    }
    for(i=0;i<n;i++){
        d[0][i] = 0;
    }
    dfs(j,-1,0);
    int jj = -1; x = -1;
    for(i=0;i<n;i++){
        if(d[0][i]>x){
            x = d[0][i];
            jj = i;
        }
    }
    int dia = x;
    dfs(jj,-1,1);
    vector<int> choku;
    ans[1] = 1; ans[2] = 1;
    for(i=dia + 1;i<=n;i++){
        ans[i] = 1;
    }
    for(i=0;i<n;i++){
        if(d[0][i] + d[1][i]==dia){
            dfs2(i,-1,dia,i);
            choku.push_back(i);
        }
    }
    for(i=0;i<choku.size();i++){
        int v = choku[i];
        if(mx[v]) update(mx[v] + d[0][v],d[0][v],0);
        if(mx[v]) update(mx[v] + d[1][v],d[1][v],1);
    }
    for(i=3;i<=dia;i++){
        if(i&1){
            if(query(0,n,0)>=i || query(0,n,1)>=i) ans[i] = 0;
            else ans[i] = 1;
        }else{
            int k = i/2;
            if(max(query(0,n,0),query(0,n,1))<i){
                ans[i] = 1;
            }else if(max(query(0,k,0),query(k + 1,n,0))>=i || max(query(0,k,1),query(k + 1,n,1))>=i){
                ans[i] = 0;
            }else if(max(query(k,k + 1,0),query(k,k + 1,1))==i){
                ans[i] = 1;
            }else{
                ans[i] = 0;
            }
        }
    }
    for(i=1;i<=n;i++){
        cout << ans[i];
    }
    cout << endl;
}


Measured memory_bytes: 18384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    double L;
    cin >> L;
    printf("%.10lf\n", L*L*L/27.0);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream> 
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;

#define assert_range(x,a,b) assert((a) <= (x) and (x) <= (b))
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9+7;

using t_mat = vector<vector<int>>;

int count_matchings(const t_mat& mat) {
    int n = mat.size();
    vector<vector<int>> masks_with_size(n+1);
    for (int mask = 0; mask < (1 << n); ++mask) {
        int ones = 0;
        for (int i = 0; i < n; ++i) {
            if (mask & (1<<i)) {
                ++ones;
            }
        }
        masks_with_size[ones].push_back(mask);
    }
    vector<vector<ll>> dp(n+1, vector<ll>(1<<n));
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (auto mask : masks_with_size[i-1]) {
            for (int j = 0; j < n; ++j) {
                if (mask & (1<<j)) continue;
                if (!mat[i-1][j]) continue;
                int new_mask = mask | (1<<j);
                dp[i][new_mask] += dp[i-1][mask];
                dp[i][new_mask] %= MOD;
            }
        }
    }
    return dp[n][(1<<n)-1];
}

int main() {
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    t_mat mat(n, vector<int>(n));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> mat[i][j];
        }
    }
    auto res = count_matchings(mat);
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 386620
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> 
map<T, Int> factorize(T x){
  map<T, Int> res;
  for(Int i=2;i*i<=x;i++){
    while(x%i==0){
      x/=i;
      res[i]++;
    }
  }
  if(x!=1) res[x]++;
  return res;
}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;

  vector<Int> cnt(111,0);
  for(Int i=1;i<=n;i++){
    for(auto p:factorize(i))
      cnt[p.first]+=p.second;
  }

  Int ans=0;
  // 75 = 74 + 1
  if(cnt[2]>=74) ans++;

  // 75 = (2 + 1) * (24 + 1)
  for(Int i=2;i<111;i++)
    for(Int j=2;j<111;j++)
      if(i!=j&&cnt[i]>=2&&cnt[j]>=24) ans++;
  

  // 75 = (4 + 1) * (14 + 1)
  for(Int i=2;i<111;i++)
    for(Int j=2;j<111;j++)
      if(i!=j&&cnt[i]>=4&&cnt[j]>=14) ans++;
  
  // 75 = (2 + 1) * (4 + 1) * (4 + 1)
  for(Int i=2;i<111;i++)
    for(Int j=2;j<111;j++)
      for(Int k=2;k<j;k++)
        if(i!=j&&i!=k&&cnt[i]>=2&&cnt[j]>=4&&cnt[k]>=4) ans++;

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


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

namespace Debt_Hell
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            double temp = 100000;

            for (int i = 0; i < n; ++i)
            {
                temp *= 1.05;
                if (temp % 1000 != 0)
                {
                    temp = ((Math.Ceiling(temp / 1000))) * 1000;
                    
                }

            }

            Console.WriteLine(temp);
        }
    }
}



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

#define MAX 100
#define M 100000

int compute(int w, int h){
  int T[MAX+1][MAX+1][2][2];  

  for ( int i = 0; i <=w; i++ )
    for ( int j = 0; j <= h; j++ )
      for ( int k = 0; k < 2; k++ )
	for ( int l = 0; l < 2; l++ ) T[i][j][k][l] = 0;

  for ( int k = 0; k < 2; k++ )
    for ( int l = 0; l < 2; l++ ) T[1][1][k][l] = 0;

  
  for ( int i = 2; i <= w; i++ ){
    T[i][1][0][0] = T[i][1][0][1] = 1;
  }
  for ( int j = 2; j <= h; j++ ){
    T[1][j][1][0] = T[1][j][1][1] = 1;
  }

  for ( int i = 2; i <= w; i++ ){
    for ( int j = 2; j <= h; j++ ){
      T[i][j][1][0] = (T[i][j][1][0] + T[i][j-1][0][1])%M;
      T[i][j][1][1] = ((T[i][j][1][1] + T[i][j-1][1][0])%M + T[i][j-1][1][1])%M;

      T[i][j][0][0] = (T[i][j][0][0] + T[i-1][j][1][1])%M;
      T[i][j][0][1] = ((T[i][j][0][1] + T[i-1][j][0][0])%M + T[i-1][j][0][1])%M;
    }
  }
  
  return (T[w][h][0][0] + T[w][h][0][1] + T[w][h][1][0] + T[w][h][1][1])%M;
}

main(){
  int w, h;
  while(1){
    cin >> w >> h;
    if ( w == 0 && h == 0 ) break;
    cout << compute(w, h) << endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define iinf 2000000000
#define linf 1000000000000000000LL
#define ulinf 10000000000000000000ull
#define MOD1 1000000007LL
#define mpr make_pair
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef unsigned short US;
typedef pair < int , int > pii;
clock_t __stt;
inline void TStart(){__stt=clock();}
inline void TReport(){printf("\nTaken Time : %.3lf sec\n",(double)(clock()-__stt)/CLOCKS_PER_SEC);}
template < typename T > T MIN(T a,T b){return a<b?a:b;}
template < typename T > T MAX(T a,T b){return a>b?a:b;}
template < typename T > T ABS(T a){return a>0?a:(-a);}
template < typename T > void UMIN(T &a,T b){if(b<a) a=b;}
template < typename T > void UMAX(T &a,T b){if(b>a) a=b;}
int n,p[200005],res;
set < int > cur;
int main(){
    // inputting start
    // 数据结构记得初始化！ n，m别写反！
    scanf("%d",&n);
	int i,j;
	for(i=0;i<n;++i){
		scanf("%d",&j);
		p[j-1]=i;
	}
    #ifdef LOCAL
        TStart();
    #endif
    // calculation start
    // 数据结构记得初始化！ n，m别写反！
    j=1;res=n-1;
	cur.insert(p[0]);
	for(i=0;i<n;++i){
		for(;j<n&&(cur.empty()||p[j]>*(cur.rbegin()));++j) cur.insert(p[j]);
		UMIN(res,n-(j-i));
		cur.erase(cur.find(p[i]));
	}
	printf("%d\n",res);
    #ifdef LOCAL
        TReport();
    #endif
    return 0;
}

Measured memory_bytes: 10368