akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
  string s, t;
  cin >> s;
  cin >> t;
  bool ans = true;
  if(s.size() + 1 == t.size()){
    for(int i = 0; i < s.size(); i++){
      if(s.at(i) != t.at(i)){
        ans = false;
        break;
      }
    } 
  }
  else{
    ans = false;
  }
  if(ans){
    std::cout << "Yes" << '\n';
  }
  else{
    std::cout << "No" << '\n';
  }
  return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

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

    int N;
    cin >> N;
    vector<long long> D(N);

    for (auto &d : D)
        cin >> d;

    vector<pair<long long, int>> sorted;

    for (int i = 0; i < N; i++)
        sorted.emplace_back(D[i], i);

    sort(sorted.begin(), sorted.end());
    vector<int> parent(N, -1);
    vector<int> subtree_size(N, 1);
    vector<long long> answer(N, 0);

    for (int i = N - 1; i > 0; i--) {
        int current = sorted[i].second;
        long long goal = sorted[i].first - (N - 2 * subtree_size[current]);
        int index = lower_bound(sorted.begin(), sorted.end(), make_pair(goal, 0)) - sorted.begin();
        int who = (index < i && sorted[index].first == goal) ? sorted[index].second : -1;

        if (who < 0) {
            cout << -1 << '\n';
            return 0;
        }

        answer[who] += answer[current] + subtree_size[current];
        subtree_size[who] += subtree_size[current];
        parent[current] = who;
    }

    if (answer[sorted.front().second] != sorted.front().first) {
        cout << -1 << '\n';
        return 0;
    }

    for (int i = N - 1; i > 0; i--) {
        int current = sorted[i].second;
        cout << current + 1 << ' ' << parent[current] + 1 << '\n';
    }
}


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

void solve(std::string S)
{
    S.replace(3, 1, "8");
    cout << S << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? ((x) : -(x)))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;

int main()
{
	int i, j;
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a + b + c >= 22) printf("bust");
	else printf("win");
}

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

//??°???????????????????????????
class MathScore
{

public:

	//?????????????????????
	MathScore( int _MidExamScore , int _TermEndExamScore , int _ReexamScore )
		: MidtermExaminationScore( _MidExamScore ) ,
		  TermEndExaminationScore( _TermEndExamScore ) ,
		  ReexaminationScore( _ReexamScore ){}

	//?????????
	bool IsValid()
	{

		return ( MidtermExaminationScore != -1 ||
				 TermEndExaminationScore != -1 ||
				 ReexaminationScore      != -1 );

	}

	//????????¬????????£?????°??????
	char CalcRating()
	{

		if( MidtermExaminationScore == -1 || TermEndExaminationScore == -1 )
		{

			//??????????????????????????????????¬????
			return 'F';

		}

		int TotalExamScore = MidtermExaminationScore + TermEndExaminationScore;

		if( TotalExamScore >= 80 )
		{

			return 'A';

		}
		else if( TotalExamScore >= 65 )
		{

			return 'B';

		}
		else if( TotalExamScore >= 50 )
		{

			return 'C';

		}
		else if( TotalExamScore >= 30 )
		{

			if( ReexaminationScore >= 50 )
			{

				return 'C';

			}
	
			return 'D';

		}

		return 'F';

	}

private:

	//??????????¨??????°
	int MidtermExaminationScore;

	//??????????¨??????°
	int TermEndExaminationScore;

	//???????¨??????°
	int ReexaminationScore;

};

//????????\???
void InputMathScore( MathScore *OutMathScore )
{

	int m , f , r;

	std::cin >> m;
	std::cin >> f;
	std::cin >> r;
	
	*OutMathScore = MathScore( m , f , r );

}

//Entry Point
int main( int argc , char *argv[] )
{

	std::vector< MathScore > Scores;

	while( true )
	{

		MathScore Score( -1 , -1 , -1 );
		InputMathScore( &Score );
		if( !Score.IsValid() )
		{

			break;

		}

		Scores.push_back( Score );

	}

	for( std::vector< MathScore >::iterator it = Scores.begin() ; it != Scores.end() ; ++it )
	{

		std::cout << it->CalcRating() << std::endl;

	}

	return 0;

}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
#define endl "\n"
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define F first
#define S second
typedef long long int ll;
const int INF = 1e9;

using namespace std;

void solve()
{
    ll i, j, n, k;
    cin>>n>>k;
    cout<<n*k<<endl;
}
 
int main()
{
    FASTIO
    solve();
    return 0;
}

Measured memory_bytes: 3608
n = int(input())
a = list(map(int, input().split()))
a.sort()
n = {}
pop = 0
for ai in a:
    n[ai] = n.get(ai, 0) + 1
for ni in n:
    if ni < n[ni]:
        pop += n[ni] - ni
    elif ni > n[ni]:
        pop += n[ni]
print(pop)

Measured memory_bytes: 17780
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
typedef vector<vector<ll> > matrix;
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    stringstream geek(x);
    geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll f[2000001];



ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}

/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}


bool in(float x1,float y1,float x,float y,float r )
{
    if(abs(x1-x)*abs(x1-x)+abs(y1-y)*abs(y1-y)<=r*r) return true;
    return false;
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{

        return (a.second<b.second);
}
//
//vector<vector<int> >matrix;
matrix mul(matrix A,matrix B)
{
    matrix C(3, vector<ll>(3));
    for(int i=1;i<=2;i++)
    for(int j=1;j<=2;j++)
     for(int k=1;k<=2;k++)
         C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
    return C;

}
matrix pow(matrix A, int p)
{
    if (p == 1)
        return A;
    if (p % 2)
        return mul(A, pow(A, p-1));
    matrix X = pow(A, p/2);
    return mul(X, X);
}
ll fib(int N)
{
    vector<ll> F1(3);
    F1[1] = 1;
    F1[2] = 1;
    matrix T(3, vector<ll>(3));
    T[1][1] = 0, T[1][2] = 1;
    T[2][1] = 1, T[2][2] = 1;
    if (N == 1)
        return 1;
    T = pow(T, N-1);
    ll res = 0;
    for(int i=1;i<=2;i++)
        res = (res + T[1][i] * F1[i]) ;
    return res;
}
ll bit[10005]={0};
ll sum(ll i)
{
    ll ans=0;
    while(i>0)
    {
        ans+=bit[i];
        i-=(i&(-i));
    }
    return ans;
}
ll update(ll n,ll i)
{
    while(i<=n)
    {
        bit[i]+=1;
        i+=(i&(-i));
    }
}
//int C[10005][1];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
   int n;
   cin>>n;
   int o=0;
   for(int i=0;i<n;i++)
   {
       int a;
       cin>>a;
       if(a&1) o++;
   }
   if(o>=1)
    cout<<"first";
   else
    cout<<"second";

}
   //C[10005][10005];


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll popcount(ll x){
  ll res=0;
  for(ll i=0; i<=40; i++){
    if(x>>i&1) res++;
  }
  return res;
}

ll f(ll x){
  if(x==0) return 0;
  ll cnt=popcount(x);
  return 1+f(x%cnt);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  string s; cin>>s;
  
  ll cnt=0;
  rep(i,n) if(s[i]=='1') cnt++;
  
  ll f1=0, f2=0;
  vll t1(n+1,1), t2(n+1,1);
  // s%(mod popcount(s)+1), s%(mod popcount(s)-1) の前計算
  for(ll i=1; i<=n; i++){
    t1[i]=t1[i-1]*2%(cnt+1);
    if(cnt>1) t2[i]=t2[i-1]*2%(cnt-1);
  }
  
  for(ll i=0; i<n; i++){
    f1=f1*2+(s[i]=='1');
    f1%=(cnt+1);
    if(cnt>1){
      f2=f2*2+(s[i]=='1');
      f2%=(cnt-1);
    }
  }
  
  for(ll i=0; i<n; i++){
    if(s[i]=='1'){
      if(cnt==1) cout<<0<<endl;
      else{
        ll tmp=f2-t2[n-1-i];
        tmp%=(cnt-1);
        if(tmp<0) tmp+=cnt-1;
        ll ans=f(tmp)+1;
        cout<<ans<<endl;
      }
    }else{
      ll tmp=f1+t1[n-1-i];
      tmp%=(cnt+1);
      ll ans=f(tmp)+1;
      cout<<ans<<endl;
    }
  }
  
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main (){
    int n,k;
    int ans=0;
    cin >> n >> k;
    map<int,int>mp;
    vector<int>num;
    rep(i,n){
        int a;
        cin >> a;
        mp[a]++;
    }
    if(mp.size()<=k){
        cout << ans << endl;
        return 0;
    }
    else for(auto p:mp) num.emplace_back(p.second);
    sort(num.begin(),num.end());
    int v=mp.size()-k;
    rep(i,v){
        ans+=num[i];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 10748
INF = 10**10 - 1

#指定数分の複数の整数を順番に受けてリストに入力
N,Wmax = map(int, input().split())
w = [0]*(N+1)
v = [0]*(N+1)
Vsum = 0
for i in range(1,N+1):
    w[i],v[i] = map(int, input().split())
    Vsum += v[i]

#dpの初期化
dp = [[INF] * (Vsum+1) for i in range(N+1)]
for i in range(0,N+1):
    dp[i][0] = 0
#print(dp[0])

for i in range(1,N+1):
    for vv in range(1,Vsum+1):
        if v[i] > vv:
            dp[i][vv] = dp[i-1][vv]
        else:
            dp[i][vv] = min(dp[i-1][vv],dp[i-1][vv-v[i]]+w[i])
    #print(dp[i])

Vmax = 0
for vv in range(1,Vsum+1):
    if dp[N][vv] <= Wmax:
        Vmax = vv
print(Vmax)


Measured memory_bytes: 119788
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll mod = 1e9+7;

int main(void){
  int n;
  cin >> n;
  for(int i = 0;i <= 50000;++i){
    int res = (i * 108) / 100;
    if(res == n){
      cout << i << endl;
      return 0;
    }
  }
  puts(":(");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair
#define fst first
#define snd second
#define fr(i, a, b) for(int i=a; i<b; i++)


int main() {
    int n; cin >> n;
    if(n&1) cout << 1.0 * (n+1) / 2 / n<< endl;
    else cout << 1.0 * n / 2 / n << endl;
}


Measured memory_bytes: 256
n , k = map(int,input().split())
h = list(map(int,input().split()))
import numpy as np
h = np.array(h)
dp =np.zeros(n,dtype = int)
for i in range(1,n):
    s = max(0,i-k)
    dp[i] = np.min(dp[s:i] + np.abs(h[s:i] - h[i]))
print(dp[-1])

Measured memory_bytes: 20600
/************************************************
 *Author*        :skyNebula
 *Created Time*  : 六 10/20 13:43:57 2018

*********************************************/

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>


using namespace std;

char s[15];
vector<char> ans;



int main()
{
    while(~scanf("%s",s)){
        int len = strlen(s);
        for(int i = 0; i < len; i++){
            if(s[i] == '0' || s[i] == '1'){
                ans.push_back(s[i]);
            }
            else {
                if(ans.empty())continue;
                ans.pop_back();
            }
        }
        for(int i = 0; i < ans.size(); i++){
            if(ans.empty()){
                break;
            }
            printf("%c",ans[i]);
        }
        if(!ans.empty())printf("\n");

    }

    return 0;
}


Measured memory_bytes: 256
n = int(input())
listB = list(map(int, input().split()))
listA = []

flag=1
while flag:
    index=len(listB)-1
    while index > -1:
        if listB[index] == index+1:
            listA.append(listB[index])
            del listB[index]
            break
        index-=1
    if index == -1:
        print(-1)
        flag=0
        break
    if listB == []:
        break
listA.reverse()
if flag:
    for ans in listA:
        print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<utility>
#include<queue>
using namespace std;
#define LL long long
#define MOD 1000000007

int a, b, c, d, n, m, A[10], ans = 0;
string s;

int main() {
	cin >> a;
	cout << (a < 1000 ? "ABC" : "ABD") << endl;;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
n,k = map(int,input().split())
ki = [[]for _ in range(n)]
mod = 10**9+7
fact = [1]*(max(n,k)+1)
for i in range(1,max(n,k)+1):
    fact[i] = (fact[i-1]*i)%mod
invfact = [1]*(max(n,k)+1)
invfact[-1] = pow(fact[-1],mod-2,mod)
for i in range(max(n,k)-1,0,-1):
    invfact[i] = (invfact[i+1]*(i+1))%mod

def P(a,b,mod):
    return (fact[a]*invfact[a-b])%mod
    
for i  in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    ki[a].append(b)
    ki[b].append(a)

    

def dfs(now,last = -1):
    res = 1
    
    if last != -1:
        if len(ki[now]) == 1:return 1
        res = P(k-2,len(ki[now])-1,mod)
        if k-1 < len(ki[now]):res = 0
    for next in ki[now]:
        if next == last:continue
        res *= dfs(next,now)
    return res
ans = dfs(0,-1)

ans *= P(k,len(ki[0])+1,mod)
ans %= mod
if(len(ki[0])+1>k):ans = 0
print(ans)
            


Measured memory_bytes: 109380
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    ll n;
    cin >> n;
    ll p[n];
    rep(i, n)cin >> p[i];
    ll mn = 100000000;
    ll ans = 0;
    rep(i, n){
        if(mn >= p[i])ans++;
        mn = min(mn, p[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
question_num, my_submit = list(map(int, input().split(' ')))
sub_list = [[]]*my_submit

for i in range(my_submit):
    sub_list[i] = input().split(' ')

question_results = ['hoge'] + [[False, 0, 0] for i in range(question_num)] # bool(ac?), wa, ac

for j in sub_list:
    if question_results[int(j[0])][0] == False:
        if j[1] == 'WA':
            question_results[int(j[0])][1] += 1
        elif j[1] == 'AC':
            question_results[int(j[0])][0] = True
            question_results[int(j[0])][2] += 1

ac = 0
wa = 0
for k in question_results:
    if k is not 'hoge':
        if k[0] == True:
            ac += 1
            wa += k[1]

print(ac, wa)


Measured memory_bytes: 43152
import sys
sys.setrecursionlimit(100000)

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
parent = [i for i in range(n)]
count = [1 for i in range(n)]

def root(i):
    if i == parent[i]:
        return i
    parent[i] = root(parent[i])
    return parent[i]

def merge(i, j):
    parent[j] = i
    count[i] += count[j]

ret = [0] * m + [n * (n - 1) // 2]
for i in range(m - 1, -1, -1):
    a, b = ab[i]
    ra, rb = root(a - 1), root(b - 1)
    if ra == rb:
        ret[i] = ret[i + 1]
    else:
        ret[i] = ret[i + 1] - count[ra] * count[rb]
        merge(ra, rb)

for i in range(1, m + 1):
    print(ret[i])

Measured memory_bytes: 46968
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
   	int n;
   	cin >> n;
   	int q = ceil((double)(100*n)/(double)108);
   	//cout << q << "\n";
   	int prod=q*1.08;
   	//cout << prod << "\n";
   	if(prod<n||prod>n) cout << ":(";
   	else cout << q;
   	cout << "\n";
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<map>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define fdj(a,b) for(int j=a-1;j>=b;--j)
#define fdo(a,b) for(int o=a-1;o>=b;--o)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
//////////////////////

int const N = 2e5 + 41;
int const MOD = 1e9 + 7;

int w, h, a, b;
int ans;

void add(int &a, int b){
	a += b;
	if(a >= MOD) a -= MOD;
}

int mul(int a, int b){
	return (ll) a * b % MOD;
}

int bp(int x, int d){
	int cur = x;
	int res = 1;
	while(d){
		if(d&1) res = mul(res, cur);
		cur = mul(cur, cur);
		d >>= 1;
	}
	return res;
}

int f[N], invf[N];

void init(){
	f[0] = 1;
	fi(1, N){
		f[i] = mul(f[i-1], i);
	}
	fi(0, N) invf[i] = bp(f[i], MOD-2);
}

int getc(int n, int k){
	if(k > n) return 0;
	int res = f[n];
	res = mul(res, invf[k]);
	res = mul(res, invf[n-k]);
	return res;
}

void solve(){
	ans = getc(w-1+h-1, w-1);
	fi(1, b+1){
		int v0 = getc(h-a+i-2, i-1);
		int v1 = getc(a-1+w-i, w-i);
		int v = mul(v0, v1);
		ans -= v;
		while(ans < 0) add(ans, MOD);
	}
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	init();

	scanf("%d %d %d %d",&h,&w,&a,&b);

	solve();

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  int k,x;
  cin>>k>>x;
  vector<int>b(300,0);
  for(int i=x-k+1;i<=x;i++){
    for(int j=0;j<k;j++){
      b[i+j+100]++;
    }
  }
  rep(i,300){
    if(b[i]){
      cout<<i-100<<" ";
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int N = 2010;
bitset<N> dp[N], wx[N], wy[N];

int main() {
    int n;
    cin >> n;
    FOR(i,1,n-1){
        string s;
        cin >> s;
        REP(j,i){
            if (s[j] == '1'){
                wx[i].set(j);
                wy[j].set(i);
            }else{
                wx[j].set(i);
                wy[i].set(j);
            }
        }
    }

    REP(i,n){
        dp[i].set(i);
    }

    FOR(len,1,n-1){
        REP(l,n+1-len){
            int r = l + len - 1;
            if (l > 0){
                if ((wx[l - 1] & dp[l] & dp[r]).any()) dp[r].set(l - 1);
            }
            if (r < n - 1){
                if ((wx[r + 1] & dp[l] & dp[r]).any()) dp[l].set(r + 1);
            }
        }
    }
    cout << (dp[0] & dp[n - 1]).count() << endl;

    return 0;
}


Measured memory_bytes: 1792
N = int(input())
H = list(map(int, input().split()))

max_h = max(H)
memo = [['0'] for _ in range(max_h)]
for i, h in enumerate(H):
    for j, v in enumerate(memo):
        if j+1 > h:
            v += '0'
        else:
            v += '1'


for i, v in enumerate(memo):
    v += '0'


for i, v in enumerate(memo):
    memo[i] = ''.join(v)


ans = 0
for i, v in enumerate(memo):
    ans += v.count('10')


print(ans)

Measured memory_bytes: 39408
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define LL(x) ll x; scanf("%lld",&x)
#define INPUT(x) cin >> x
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define RREP1(x,n) for(int x = n-1; x >= 0; x--)
#define RREP2(x,s,e) for(int x = s; x >= e; x--)
#define BR printf("\n")
#define INF_INT 2147483647
#define INF_LL 9223372036854775807

typedef long long ll;

int main(){
    INT(N);INT(T);
    int ts[200001] = {};
    REP1(i,N){
        INPUT(ts[i]);
    }
    int all = T;
    RREP1(i,N-1){
        if (ts[i+1] - ts[i] >= T) {
            all += T;
        }else{
            all += ts[i+1] - ts[i];
        }
    }
    
    cout << all << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



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

int n;
cin>>n;

int ans = 0 ;
while(n)
{
    ans +=n%10;
    n/=10;
}
cout<<ans<<endl;
 return 0;
}


Measured memory_bytes: 3616
N=int(input())
A=[]

dp=[[0 for i in range(3)] for j in range(N+1)]


for i in range(N):
    B,C, D = map(int, input().split())
    A.append([B,C, D])
#print(A)

for i in range(N):
    for j in range(3):
        for k in range(3):
            if j==k:
                continue
            dp[i+1][k]=max(dp[i+1][k],dp[i][j]+A[i][k])

print(max(dp[N][0],dp[N][1],dp[N][2]))

Measured memory_bytes: 73692
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if (N==1) {
			System.out.println(1);
			return ;
		}
		int M = sc.nextInt();
		Set<Integer> set = new HashSet<Integer>();
		for (int i=0;i<M;i++) {
			set.add(sc.nextInt());
		}
		long A[]= new long[N];
		A[0]=1;
		if (set.contains(1)==false) {
			A[1]=1;
		}
		for(int i=2;i<N;i++) {
			if (set.contains(i)==false) {
				A[i]=(A[i-1]+A[i-2])%1000000007;
			}
		}
		System.out.println((A[N-1]+A[N-2])%1000000007);
	}
}

Measured memory_bytes: 61780
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> s(n);
    int sum = 0;
    rep(i, 0, n){
        cin >> s[i];
        sum += s[i];
    }
    if(sum % 10){
        cout << sum << endl;
    }else{
        int MIN = sum;
        rep(i, 0, n){
            if((sum - s[i]) % 10){
                if(MIN > s[i]){
                    MIN = s[i];
                }
            }
        }
        cout << sum - MIN << endl;
    }
}

Measured memory_bytes: 256
#ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O20")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
#define rep(i, times) for(ll i = 0; i < (times); ++i)
#define p(x) (cout << x << "\n")
using ll = size_t; using ld = long double; using namespace std;

#ifndef __GNUC__
string text =
R"X(
8
7 3 5 4 2 1 6 8
3 8 2 5 4 6 7 1
)X";
stringstream iss{text};
#endif

class CountOrder
{
	ll N{0};
	vector<ll> p, q;
	void inp( ) {
		iss >> N; p.resize(N); q.resize(N);
		rep(n, N) { iss >> p[n]; }
		rep(n, N) { iss >> q[n]; }
		//for_each(begin(p), end(p), [](auto x) { cout << x << "\n"; });
	}
	void change( ) {
		long long sa{0};
		if (p > q) swap(p, q);
		do {
			if (p == q) break;
			++sa;
		} while (next_permutation(begin(p), end(p)));
		p(sa);
	}
public:
	void procedures( ) {
		inp( );
		change( );
	}
};
//https://atcoder.jp/contests/abc145/tasks/abc145_c
int main( ) {
	cin.tie(0);	ios::sync_with_stdio(0);
	cout << fixed << setprecision(15);
	class CountOrder a; a.procedures( );
}

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

int main() {
  int n, q;
  cin >> n;
  map<long long, long long> a;
  long long ans = 0;
  for(int i = 0; i < n; i++){
    long long k;
    cin >> k;
    a[k]++;
    ans += k;
  }
  
  cin >> q;
  for(int i = 0; i < q; i++){
    long long b, c;
    cin >> b >> c;
    if(a.count(b)){
      long long cnt = a.at(b);
      ans = ans - b * cnt + c * cnt;
      a.erase(b);
      a[c] += cnt;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 7552
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int n, m, tmp;
  cin >> n >> m;
  vector<int> a, aHalf;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  std::sort(a.begin(),a.end(),std::greater<int>());
  a.erase(std::unique(a.begin(), a.end()), a.end());

  for (int i = 0; i < a.size(); i++) {
    aHalf.push_back(a.at(i) / 2);
  }

  int count = 0;
  int half = (a.at(0) / 2);
  int check = 1;
  for (int x = half; x <= m; x += a.at(0)) {
    check = 1;
    for (int i = 1; i < a.size(); i++) {
      if (a.at(i) == a.at(0)) continue;
      if ((x - aHalf.at(i)) % a.at(i) != 0) {
        check = 0;
        break;
      }
    }
    if (check == 1) count++;
  }

  cout << count << endl;
  return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
//#include<unordered_map>
using namespace std;
#define ll long long
#define dd cout<<endl
const long long int inf = 1e18+7;
const int mod = 1e9+7;

inline ll int max(ll int a,ll int b) { return a>b?a:b; }
inline ll int min(ll int a,ll int b) { return a<b?a:b; }

const int maxn=2e5+10;

vector<int>v[maxn];
bool book[maxn];

int maxx;

int dfs(int now)
{
	int cnt=0;
	for(int i=0,to;i<v[now].size();i++)
	{
		to=v[now][i];
		
		if(!book[to])
		{
			book[to]=true;
			cnt++;
			cnt+=dfs(to);
		}
		
	}
	
	return cnt;
}

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	int n,m;
	cin>>n>>m;
	
	for(int i=0,x,y;i<m;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	
	maxx=1;
	
	for(int i=1;i<=n;i++)
	{
		if(!book[i])
		{
			book[i]=true;
	
			int cnt=dfs(i)+1;
			
			if(cnt>maxx)
				maxx=cnt;
		}
	}
	
	cout<<maxx<<endl;
	
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A;
  int a;
  for (int i=0; i<N; i++) {
    cin >> a;
    A.push_back(a);
  }
  sort(A.begin(), A.end());
  int cnt = 0, p = 0;
  for (int i=0; i<N; i++) {
    if (p == A[i])
      cnt++;
    else
      p = A[i];
  }
  cout << N - (cnt+1)/2 * 2 << endl;
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vpii         vector<pair<int,int>>
#define gph          map<int, vector<int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define FORS(i, n) for(; i < (int)(n); i++)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define printArr(A,n) { cout << #A << " = "; FOR(i,n) cout << A[i] << ' '; cout << endl; }
using namespace std;
#define int long long int

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;cin >> n;
    vi in((1 << n));
    for(int  i =0; i <(1 << n); i++)cin >> in[i];

    vector<pii> ans((1 << n));
    FOR(i, (1 << n))ans[i].first = in[i];
    FOR(bit, n){
        for(int i = 0; i < (1 << n); i++){
            if((i & (1 << bit)) == 0){
                int j = i ^ (1 << bit);
                swap(i, j);
                assert(i < (1 << n));
                assert(j < (1 << n));
                ans[i].second = max(ans[i].second, ans[j].second);
                if(ans[i].first < ans[i].second)swap(ans[i].first, ans[i].second);
                ans[i].second = max(ans[i].second, ans[j].first);
                if(ans[i].first < ans[i].second)swap(ans[i].first, ans[i].second);
                swap(i, j);
            }
        }
    }

    int prev = 0;
    FOR1(i, (1 << n) -1)cout << max(prev, ans[i].first + ans[i].second) <<endl, prev = max(prev, ans[i].first + ans[i].second);
}




Measured memory_bytes: 9216
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	
	int sum1 = 0;
	int sum2 = 0;
	int sum3 = 0;
	int total = 0;
	
	sum1 = n;
	sum2 = n*n;
	sum3 = n*n*n;
	total  = sum1 + sum2 + sum3;
	printf("%d", total);
	return 0;
}

Measured memory_bytes: 1720
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,m,*c = map(int,read().split())
INF = 9**9
dp = [INF] * (n+1)

dp[0] = 0
for i in range(1,n+1):
    for j in c:
        if i-j>= 0:
            dp[i] = min(dp[i],dp[i-j]+1)

print(dp[n])



Measured memory_bytes: 7220
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[3];
		for (int i = 0; i < 3; i++) {
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		System.out.println(a[0] + " " + a[1] + " " + a[2]);
		
	}
}



Measured memory_bytes: 26260
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#define rep(a,b) for(int a=0;a<b;++a)
#define REP(a,b,c,d) for(int a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
	int X; cin >> X;
	if (X == 3 || X == 5 || X == 7) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int k, x;
	cin>>k>>x;
	FOR(i, x-k+1, x+k){
		cout<<i<<" \n"[i==x+k-1];
	}
	return 0;
}


Measured memory_bytes: 256
s = str(input())
k = int(input())

n = len(s)

s_ = list(s)
if len(set(s_)) == 1:
    print((n*k)//2)
    exit()

cur = s[0]
X = []
cnt = 0
for i in range(n):
    if s[i] != cur:
        X.append(cnt)
        cur = s[i]
        cnt = 1
    else:
        cnt += 1
else:
    X.append(cnt)

#print(X)
ans = 0
if s[0] != s[-1]:
    for x in X:
        ans += k*(x//2)
else:
    for i, x in enumerate(X):
        if i == 0 or i == len(X)-1:
            continue
        else:
            ans += k*(x//2)
    ans += X[0]//2
    ans += X[-1]//2
    ans += (k-1)*((X[0]+X[-1])//2)
print(ans)


Measured memory_bytes: 61992
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
       
        int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int N = a[0];
        int T = a[1];
        int cmin = 2000;
        for(int i = 0; i < N; i++)
        {
            int[] b = Console.ReadLine().Split(' ').Select(y => int.Parse(y)).ToArray();
            int c = b[0];
            int t = b[1];
            if(t <= T)
            {
                cmin = Math.Min(cmin, c);
            }
        }
        if(cmin == 2000) Console.WriteLine("TLE");
        else Console.WriteLine(cmin);
        
        
    }
}

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

int main() {
  int n;
  cin >> n;
  if(n<=10 || n==12 || n==14 || n==15 || n==16 || n==18 || n==20 || n==21 || n==24 || n==25 || n==27 || n==28 || n==30 || n==32 || n==35 || n==36 || n==40 || n==42 || n==45 || n==48 || n==49 || n==54 || n==56 || n==63 || n==64 || n==72 || n==81){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
int MOD = 10000000;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 100005;
const int MM = 1000000007;

vector<pii> G[MX];
int N, M, S, T;

void dijkstra(int st, ll dist[MX], ll cnt[MX])
{
	for(int i = 1; i <= N; i++) dist[i] = 1e18, cnt[i] = 0;
	priority_queue<pli, vector<pli>, greater<pli>> Q;
	Q.emplace(0ll, st);
	cnt[st] = 1; dist[st] = 0;
	while(Q.size()){
		pli p = Q.top(); Q.pop();
		int u = p.second;
		if( dist[u] != p.first ) continue;
		for(pii e : G[u]){
			ll d = p.first + e.first;
			int c = e.second;
			if( dist[c] == d ) cnt[c] = (cnt[c] + cnt[u]) % MM;
			else if( dist[c] > d ){
				cnt[c] = cnt[u], dist[c] = d;
				Q.emplace(d, c);
			}
		}
	}
}

ll sq(ll x){ return x*x%MM; }

ll dS[MX], dT[MX], cS[MX], cT[MX];
int main()
{
	scanf("%d%d%d%d", &N, &M, &S, &T);
	for(int i = 1; i <= M; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c); c *= 2;
		G[a].emplace_back(c, b);
		G[b].emplace_back(c, a);
	}
	dijkstra(S, dS, cS);
	dijkstra(T, dT, cT);
	ll d = dS[T] / 2;
	ll ans = cS[T] * cT[S] % MM;
	for(int i = 1; i <= N; i++){
		if( dS[i] == d && dT[i] == d ) ans = (ans + MM - sq(cS[i] * cT[i]%MM)) % MM;
		for(pii e : G[i]){
			int a = i, b = e.second;
			if( dS[a] + e.first == dS[b] && dS[b] + dT[b] == 2*d && dS[a] + dT[a] == 2*d && dS[a] < d && dS[b] > d ){
				ans = (ans + MM - sq(cS[a]*cT[b]%MM)) % MM;
			}
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 15060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
typedef long long ll;
const ll inf=1e+10;
int main(void){
    int n;cin>>n;
    vector<ll> mons(n);
    rep(i,n)cin>>mons[i];
    sort(mons.begin(),mons.end());
    while(true){
        bool jud=false;
        int now=mons[0];
        rep(i,n){
            if(i==0)continue;
            if(mons[i]==inf)break;
            if(mons[i]!=inf)jud=true;
            mons[i]%=now;
            if(mons[i]==0){
                mons[i]=inf;
            }
        }
        if(!jud)break;
        sort(mons.begin(),mons.end());
        //rep(i,n)cout<<mons[i]<<" ";
        //cout<<endl;
    }
    cout<<mons[0]<<endl;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner input=new Scanner(System.in);
		int hor=input.nextInt();
		int ver=input.nextInt();
		
		int[] num=new int[hor];
		
		for(int i=0;i<num.length;i++){
			num[i]=i+1;
		}
		
		for(int i=0;i<ver;i++){
			String[] str=input.next().split(",");
/*			System.out.println(str[0]+" "+str[1]);*/
			int a=Integer.parseInt(str[0]);
			int b=Integer.parseInt(str[1]);
			int change=num[a-1];
			num[a-1]=num[b-1];
			num[b-1]=change;
		}
		
		for(int i=0;i<num.length;i++){
			System.out.println(num[i]);
		}
		
	}

}

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

using namespace std;

#define int long long

#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

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

#define debug(x) cerr << #x << ": " << x << endl;

template <typename T>
T gcd(T m, T n)
{
  return n == 0 ? m : gcd(n, m % n);
}
template <typename T>
T lcm(T m, T n) { return n * m / gcd(n, m); }

const int MOD = 1e9 + 7;

signed main(void)
{
  bool flag = true;
  int n;
  cin >> n;

  for (int a = 9; a >= 1; --a)
  {
    if (n % a == 0)
    {
      n /= a;
      break;
    }
  }

  if (1 <= n && n <= 9)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> a(n, vector<int>(m));
    vector<int> c(n);
    for(int i = 0; i < n; i++){
        cin >> c[i];
        for(int j = 0; j < m; j++)cin >> a[i][j];
    }
    int ans = 12345678;
    int all = 1<<n;
    for(int mask = 0; mask < all; mask++){
        vector<int> level(m);
        int cost = 0;
        for(int i = 0; i < n; i++){
            if((mask>>i)&1){
                cost += c[i];
                for(int j = 0; j < m; j++){
                    level[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        for(int j = 0; j < m; j++){
            if(level[j] < x) ok = false;
        }
        if(ok) ans = min(ans,cost);
    }
    if(ans == 12345678) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3644
n = int(input())
A = [int(input()) for _ in range(n)]

k = max(A)
if A.count(k) >= 2:
    for i in range(n):
        print(k)
else:
    for i in range(n):
        if A[i] < k:
            print(k)
        else:
            A[i] = 0
            print(max(A))


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using ll = long long;
using v_int = std::vector<int>;
using v2_int = std::vector<v_int>;
using v_ll = std::vector<ll>;
using v2_ll = std::vector<v_ll>;
using v_string = std::vector<std::string>;
using v_bool = std::vector<bool>;
using v2_bool = std::vector<v_bool>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using mii = std::map<int, int>;
using mll = std::map<ll, ll>;

const double PI = 3.1415926535897932;
const int INF = 2*(int)1e9;
const ll LINF = (ll)1e18;
const ll MOD = 1000000007;
const int dc[4] = {1, -1, 0,  0};
const int dr[4] = {0,  0, 1, -1};
//const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
//const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T> inline
istream& operator>>(istream &is, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) {
        is >> v[i]; 
    }
    return is;
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }

template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    ll n;
    cin >> n;

    for(ll x = 1; x <= 3500; x++) {
        for(ll y = 1; y <= 3500; y++) {
            if(n*x+n*y-4*y*x != 0) { 
                double z = -(double)(n*x*y)/(n*x+n*y-4*x*y);
                ll z2 = -(n*x*y)/(n*x+n*y-4*x*y);
                if(fabs(z-z2) < 1e-10 && z > 0)  { printf("%lld %lld %lld", x, y, z2); return 0;}
            }
        }
    }
    return 0;
}
/*atcoder*/


Measured memory_bytes: 3776
import java.util.Scanner;
 
public class Main
{
 
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
 
		int a = Integer.parseInt(sc.next());
 		int p = Integer.parseInt(sc.next());
		int ans ;	
      a *=3;
      ans = a + p;
      
      ans /= 2;
      
      System.out.println(ans);
      
      
      	
	}
}

Measured memory_bytes: 21332
#include<iostream>
#include<cstdio>
using namespace std;
int n,x,a,b;
int main(){
 scanf("%d%d%d%d",&n,&x,&a,&b);
 if(n<=x)printf("%d",a*n);
 else printf("%d",a*x+b*(n-x));
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const ll M=2e5+5;
struct Line
{
	ll m;
	ll C;
};
ll h[M],dp[M];
Line seg[4*M];
void init(ll n)
{
	for(ll i=0;i<=4*n;i++)
	{
		seg[i].m=0;
		seg[i].C=1e18;
	}
}
ll getval(ll x,Line L)
{
	return L.m*x+L.C;
}
void update(ll i,ll s,ll e,Line L)
{
	// cout<<s<<" "<<e<<endl;
	ll mi=(s+e)/2;
	bool lef=getval(h[s],L) < getval(h[s],seg[i]);
	bool mid=getval(h[mi],L) < getval(h[mi],seg[i]);
	if(mid)
		swap(seg[i],L);
	if(s==e)
		return;
	if(lef!=mid)
		update(2*i,s,mi,L);
	else
		update(2*i+1,mi+1,e,L);
}
ll getmin(ll i,ll s,ll e,ll x)
{
	ll mid=(s+e)/2;
	if(s==e)
		return getval(x,seg[i]);
	if(h[mid]>=x)
		return min(getval(x,seg[i]),getmin(2*i,s,mid,x));
	return min(getval(x,seg[i]),getmin(2*i+1,mid+1,e,x));
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n,c;
	cin>>n>>c;
	init(n);
	for(ll i=1;i<=n;i++)
		cin>>h[i];
	dp[1]=0;
	for(ll i=2;i<=n;i++)
	{
		Line L;
		L.m=-2*h[i-1];
		L.C=(h[i-1]*h[i-1])+dp[i-1]+c;
		update(1,1,n,L);
		dp[i]=h[i]*h[i]+getmin(1,1,n,h[i]);
	}
	cout<<dp[n]<<"\n";
	return 0;
}

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

using namespace std;
#define ll long long

int main()
{
    ll N, H, W, cnt=0;
    cin >> N >> H >> W;
    for(int i=0; i<N; i++) {
        ll A, B;
        cin >> A >> B;
        if(H<=A && W<=B) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    #define INF 2000000000
    typedef long long int ll;
    typedef pair<ll,ll> ii;
    typedef pair<ii,ll> iii;
    typedef vector<ll> vi;
    typedef vector<ii> vii;
    #define getbit(n,i) (((n)&(1<<(i)))!=0)
    #define setbit0(n,i) ((n)&(~(1<<(i))))
    #define setbit1(n,i) ((n)|(1<<(i)))
    #define togglebit(n,i) ((n)^(1<<(i)))
    #define lastone(n) ((n)&(-(n)))
    #define read freopen("debug\\in.txt","r",stdin)
    #define write freopen("debug\\out.txt","w",stdout)
    #define fi first
    #define se second
    #define getI(a) scanf("%d",&a)
    #define getII(a,b) scanf("%d%d",&a,&b)
    #define PI (acos(-1))
    #define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
    #define mod (1000000007)
    #define asz 500005
    #define pb push_back
    #define ppf pop_front
    #define ppb pop_back
    #define pf push_front
    ll a[200005];
    double b[200005];
    int main()
    {
        ///fastread;
        ll n,i,j,k,l,m;
        cin>>n>>k;
        for(i=1;i<=n;i++)
        cin>>a[i];
        for(i=1;i<=n;i++){
            double temp=(a[i]*(a[i]+1))/2.0;
			temp=temp/(double)a[i];	
        	b[i]=b[i-1]+temp;
		}
		double maxi=-1;
		for(i=k;i<=n;i++){
			maxi=max(maxi,b[i]-b[i-k]);
		}
		printf("%.10lf",maxi);
    	return 0;
    }

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define INF 2e9
using namespace std;
const int N=1e6+1;
const int mod=1e9+7;
ll fastexp(ll base,ll exp){
	base%=mod;
	ll ans=1;
	while(exp>0){
		if(exp&1){
			ans*=base;
			ans%=mod;
		}
		base*=base;
		base%=mod;
		exp/=2;
	}
	return ans;
}
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}
int sumofdigits(int n){
	int sum = 0;
	while(n!=0){
		sum += n%10;
		n = n/10;
	}
	return sum;
}
int arr[N];
int ar[N];
int main() {
		int t;
		cin >> t;
		if(t >= 30){
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
		return 0;
}

Measured memory_bytes: 3584