akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;
int HMap[1002][1002],RMap[1002][1002] = { 0 };
int H, W;
int OneNum = 0;

int main() {
	cin >> H >> W;
	vector<int> SH(H*W), SW(H*W);

	//??\??????
	for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) {
		int temp;
		cin >> temp;
		HMap[i + 1][j + 1] = temp;
		SH[temp - 1] = i + 1;
		SW[temp - 1] = j + 1;
		RMap[i + 1][j + 1] = -1;
	}
	for (int i = 0; i < H*W; i++) {
		int flag = 0;
		vector<int> Near;

		if (HMap[SH[i] - 1][SW[i]] != 0) {
			if (HMap[SH[i] - 1][SW[i]] > HMap[SH[i]][SW[i]]) {
				flag++;
			}
			else {
				RMap[SH[i]][SW[i]] = RMap[SH[i] - 1][SW[i]];
				Near.push_back(RMap[SH[i] - 1][SW[i]]);
			}
		}
		else {
			flag++;
		}

		if (HMap[SH[i] + 1][SW[i]] != 0) {
			if (HMap[SH[i] + 1][SW[i]] > HMap[SH[i]][SW[i]]) {
				flag++;
			}
			else {
				RMap[SH[i]][SW[i]] = RMap[SH[i] + 1][SW[i]];
				Near.push_back(RMap[SH[i] + 1][SW[i]]);
			}
		}
		else {
			flag++;
		}

		if (HMap[SH[i]][SW[i] + 1] != 0) {
			if (HMap[SH[i]][SW[i] + 1] > HMap[SH[i]][SW[i]]) {
				flag++;
			}
			else {
				RMap[SH[i]][SW[i]] = RMap[SH[i]][SW[i] + 1];
				Near.push_back(RMap[SH[i]][SW[i] + 1]);
			}
		}
		else {
			flag++;
		}

		if (HMap[SH[i]][SW[i] - 1] != 0) {
			if (HMap[SH[i]][SW[i] - 1] > HMap[SH[i]][SW[i]]) {
				flag++;
			}
			else {
				RMap[SH[i]][SW[i]] = RMap[SH[i]][SW[i] - 1];
				Near.push_back(RMap[SH[i]][SW[i] - 1]);
			}
		}
		else {
			flag++;
		}


		if (flag == 4) {
			RMap[SH[i]][SW[i]] = HMap[SH[i]][SW[i]];
		}
		else {
			if (flag != 3) {
				if (count(Near.begin(), Near.end(), -2) == 0) {
					sort(Near.begin(), Near.end());
					Near.erase(unique(Near.begin(), Near.end()), Near.end());
					if (Near.size() != 1) {
						RMap[SH[i]][SW[i]] = -2;
						//OneNum++;
					}
				}
				else
				{
					RMap[SH[i]][SW[i]] = -2;
				}
			}
		}


	}



	for (int i = 0; i < H + 2; i++) {
		for (int j = 0; j < W + 2; j++) {
			//RMap[i][j] << " ";
			//if (j == W + 1) cout << endl;
			if (RMap[i][j] == -2) OneNum++;
		}
	}

	cout << OneNum << endl;	

	return 0;
}


Measured memory_bytes: 18416
import Control.Applicative
import Data.Array.IArray
import Data.List (intercalate)
import Control.Monad

type MGraph = Array (Int, Int) Int

main = do
        n <- readLn
        fs <- replicateM n addNodeIO
        let arr = listArray ((1,1),(n,n)) $ repeat 0
            res = foldl (.) id fs arr
        putStrLn $ showGraph res

addNode :: Int -> [Int] -> MGraph -> MGraph
addNode n vs arr = arr // new
    where new = [((n,i), 1) | i <- vs]

addNodeIO :: IO (MGraph -> MGraph)
addNodeIO = do
        list <- words<$>getLine
        let list' = splitAt 1 list
            n = read.head.fst $ list'
            vs = map read.tail.snd $ list'
        return $ addNode n vs

showGraph arr = intercalate "\n" $ [unwords.map show $ [ arr ! (i,j) | j <- [hmin..hmax]] | i <- [vmin..vmax]]
        where ((vmin,hmin),(vmax,hmax)) = bounds arr

Measured memory_bytes: 6572
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <fstream>

using namespace std;

ifstream fin("../data.txt");

int n, m, p, x, sum;
vector<int> v;

int main() {

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
    sum += x;
  }

  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> p >> x;
    cout << sum - v[p-1] + x << "\n";
  }

  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int maxn=1e4+5;
const int maxm=5e2+5;
const int maxq=55;
const int INF=0x3f3f3f3f;
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int num=0;int base=1;
        while(n)
        {
            int t=n%10;
            if(t==1) t=9;
            else if(t==9) t=1;
            num+=t*base;
            base*=10;
            n/=10;
        }
        printf("%d\n",num);
    }
}


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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define MOD 1000000007

ll mod_inv(ll n)
{
    ll left=MOD-2;  // define MOD!
    ll num=n;
    ll ans=1;
    while(left!=0)
    {
        if(left%2==1)ans=(ans*num)%MOD;
        left/=2;
        num=(num*num)%MOD;
    }
    return ans;
}

int main()
{
  ll n,m;cin>>n>>m;
  queue<int> q;
  ll i;
  ll left=m;
  ll ans=1;
  for(i=2;i*i<=m;i++)
  {
    int kcount=0;
    while(left%i==0)
    {
      kcount++;
      left/=i;
    }
    if(kcount>0)q.push(kcount);
  }
  if(left>1)q.push(1);
  while(!q.empty())
  {
    ll k=q.front();
    q.pop();
    vector<ll> comb(k+1,1);
    rep(i,k)
    {
      comb[i+1]=comb[i]*((n+k-i-1)*mod_inv(i+1)%MOD);
      comb[i+1]%=MOD;
    }
    ans=(ans*comb[k])%MOD;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll x;
    cin >> x;
    ll k = sqrt(2*x);
    k++;
    ll ans = 0;
    repd(i,1,k+1){
        if(i*i+i < 2*x && i*i+3*i+2 >= 2*x){
            ans = i+1; break;
        }
    }
    if(ans == 0)
        cout << 1 << endl;
    else
        cout << ans <<endl;



    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)

delicious_list = []
for i in range(x):
    for j in range(min(y,int(k//(i+1)))):
        for l in range(min(z,int(k//((i+1)*(j+1))))):
             delicious_list.append(a[i]+b[j]+c[l])

delicious_list.sort(reverse = True)
for i in range(k):
    print(delicious_list[i])


Measured memory_bytes: 8708
N,M = map(int,input().split())
abc = []
for _ in range(M):
    abc.append(list(map(int,input().split())))

cost = [-float('inf')]*N
cost[0] = 0

for i in range(N):
    update = False
    for a,b,c in abc:
        a,b = a-1,b-1
        if cost[a] != -(10**10)*N:
            if cost[b] < cost[a] + c:
                cost[b] = cost[a] + c
                update = True
    if i == 0:
        Max = cost[N-1]
    elif i < N-1:
        Max = max(Max,cost[N-1])


if update == True and Max < cost[N-1]:
    print('inf')
else:
    print(Max)


Measured memory_bytes: 3572
#include <iostream>
using namespace std;
//B - 105
int main(void){
    int n;
    std::cin >> n;
    int ans=0;
    for(int i=1;i<=n;i+=2){
        int cnt=0;
        for (int j = 1; j <= i; j++) {
            if(i%j==0)cnt++;
        }
        if(cnt==8)ans++;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++)
	scanf("%d",&a[i]);
	for(int i=0;i<n;i++)
	{
		if(a[i]%2==0)
		{
			if(!(a[i]%5==0||a[i]%3==0))
				{
					printf("DENIED\n");
					break;
				}
		}
		if(i==n-1)
			printf("APPROVED\n");
	}
	return 0;
}

Measured memory_bytes: 128
S = input()


def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            print(f+'=7')
            exit()
    else:
        dfs(i+1, f+'+'+S[i+1], sum+int(S[i+1]))
        dfs(i+1, f+'-'+S[i+1], sum-int(S[i+1]))

dfs(0, S[0], int(S[0]))

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

#define ll long long
#define ar array

int n, a[200000];

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

	cin >> n;
	for(int i=0; i<n; ++i)
		cin >> a[i];
	sort(a, a+n);
	for(int i=0; i+1<n; ++i)
		if(a[i]==a[i+1]) {
			cout << "NO";
			return 0;
		}
	cout << "YES";
}


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

int main() {

    //int a, b, c;
    int a[3];
    int tmp;
    int max;
    cin >> a[0] >> a[1] >> a[2];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            if  (a[i] > a[j]) {
                tmp = a[j];
                a[j] = a[i];
                a[i] = tmp;
            }
        }
    }
    cout << a[2] << " " << a[1] << " " << a[0]  << endl;

    return 0;
}

Measured memory_bytes: 3088
#include<cstdio>

int main()
{
    long long N,K;
    scanf("%lld%lld",&N,&K);
    long long ans=1LL*(N/K)*(N/K)*(N/K);
    if(K%2==0&&N>=K/2)
        ans+=1LL*((N-K/2)/K+1)*((N-K/2)/K+1)*((N-K/2)/K+1);
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using P = pair<int64_t, int64_t>;

const int MOD = 1000000007;

int64_t powMod(int64_t x, int64_t n, int64_t mod = 1000000007) {
    int64_t res = 1LL;
    while(n > 0) {
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n = n >> 1;
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    map<P, P> mp;
    int64_t ans = 0;
    for(int i = 0; i < N; ++i) {
        int64_t A, B;
        cin >> A >> B;
        if(A == 0 and B == 0) {
            ans++;
        } else {
            if(A == 0) {
                mp[{0, 1}].first++;
            } else if(B == 0) {
                mp[{0, 1}].second++;
            } else {
                int64_t G = gcd(abs(A), abs(B));
                A /= G, B /= G;
                if((A > 0) ^ (B > 0)) mp[{abs(B), abs(A)}].second++;
                else mp[{abs(A), abs(B)}].first++;
            }
        }
    }
    int64_t tmp = 1;
    for(auto &[key, val] : mp) {
        auto[s, t] = val;
        tmp *= powMod(2, s) + powMod(2, t) - 1;
        tmp %= MOD;
    }
    ans += tmp - 1 + MOD;
    ans %= MOD;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 18988
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
int main() {
    ios_base::sync_with_stdio(false);
        ll t,n;
        string s;
        cin>>s;
        if(s[0]=='R'&&s[1]=='R'&&s[2]=='R')
            cout<<3<<endl;
        else if((s[0]=='R'&&s[1]=='R')||(s[1]=='R'&&s[2]=='R'))
            cout<<2;
        else if(s[0]=='R'||s[2]=='R'||s[1]=='R')
        cout<<1;
        else
            cout<<0;


        }


Measured memory_bytes: 3624
#N本の花があり、それぞれ1,2....,Nと番号が振られている
#最初全ての花の高さは0
#h=[h_1,h_2,...,h_n]が与えられる
#整数l,rを指定して、l<=x<=rを満たす花xの高さを1増やす、という行為をする
#花xの高さがh_xになるための最小水やり回数を求めよ
n = int(input())
flower_height = list(map(int, input().split()))
count=0
def mizuyari(a):
    return a-1
#(0ではない)一番左端の高さに注目する
#その高さから0の高さにぶち当たるまで右に進める
#進んだところに水やりする
#これを繰り返す
for i in range(n):
    j=i
    while flower_height[i]!=0:
        while i < n-1:
            if flower_height[i+1] != 0: i+=1
            else: break
        flower_height = list(map(mizuyari,flower_height[:i+1])) + flower_height[i+1:]
        i=j
        count += 1
    
print(count)


    

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<ll> a, vector<ll> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, K;
    cin >> N >> K;
    VLL a(N),b(N);
    map<ll, ll> A;
    rep(i,N){
        cin >> a[i] >> b[i];
        A[a[i]]+=b[i];
    }
    VP B;
    stl_rep(i,A){
        B.push_back(pair<ll,ll>(i->F,i->S));
    }
    sort(all(B));
    ll count=0;
    rep(i,B.size()){
        count+=B[i].S;
        if(count>=K){
            cout << B[i].F << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 6904
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N;
	cin >> N;
	vector<int>P(N);
	rep(i, N)cin >> P[i];
	int cnt = N;
	int min = P[0];
	rep(i, N - 1) {
		if (P[i + 1] > min)cnt--;
		else min = (min, P[i + 1]);
	}
	cout << cnt;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
    int N,v,j;
    int A[1000];
    
    cin >> N;
    
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    
    for(int i=0;i<N;i++){
        v = A[i];
        j = i-1;
        while(j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
        }
        for(int i=0;i<N;i++){
            if(i==N-1){
                cout << A[i] << endl;
            }else{
                cout << A[i] << " ";
            }
        }
    }
}


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

int main() {
  int n, k, c; cin>>n>>k>>c;
  string s; cin>>s;

  vector<int> l(k, 0), r(k, 0);
  int cur = 0, d = 1e9;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'o' and d >= c and cur < k) {
      l[cur++] = i;
      d = 0;
    } else {
      ++d;
    }
  }
  cur = k-1, d = 1e9;
  for (int i = n-1; i >= 0; i--) {
    if (s[i] == 'o' and d >= c and cur >= 0) {
      r[cur--] = i;
      d = 0;
    } else {
      ++d;
    }
  }

  for (int i = 0; i < k; i++) {
    if (l[i] == r[i]) {
      cout << l[i]+1 << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3332
// ABC75-C
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る

struct unionfind{
    vector<int> par;
    void init(int n){
        par.assign(n,-1);
    }
    int find(int x){
        if(par[x]<=-1) return x;
        par[x]=find(par[x]);
        return par[x];
    }
    void unite(int x,int y){
        x=find(x),y=find(y);
        if(x==y) return;
        if(size(x)<size(y)) swap(x,y);
        par[x]+=par[y];
        par[y]=x;
    }
    bool same_set(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return -1*par[find(x)];
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n,m;
    cin>>n>>m;
    vector<ipair> hen(m);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        --a,--b;
        hen[i]=ipair(a,b);
    }
    int ans=m;
    rep(i,m){
        unionfind uf;
        uf.init(n);
        rep(j,m){
            if(j==i) continue; //i番目の辺だけ加えない。
            ipair cur=hen[j];
            int ca=cur.first,cb=cur.second;
            uf.unite(ca,cb);
        }
        rep(i,n){
            if(uf.size(i)==n){
                --ans;
                break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
  int n;
  cin >> n;
  vector<int> a(3*n);
  rep(i,3*n){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  ll ans = 0;
  for(int i = 0;i<2*n;i+=2)
  {
    ans += a[n + i];
  }
  cout << ans << endl;
}


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

int main() {
  int N, L;
  cin >> N >> L;

  vector<string> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  sort(S.begin(), S.end());
  for (int i = 0; i < N; i++) {
    cout << S.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
	
  int X,Y;
  cin>>X>>Y;
  cout<<X+Y/2<<endl;
}


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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

char c;
string s="aiueo";

main() {
    cin >> c;
    rep(i,5) {
        if (s[i] == c) {
            ct("vowel")
            return 0;
        }
    }
    ct("consonant")
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	if((a+b)/2<c)
	   cout<<a*x+b*y; 
	else
	  cout<<min(2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y)),2*c*max(x,y));
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main()
{
    int n,i,count=0;
    char s[100];
    scanf("%d\n%s",&n,s);
    for(i=0;i+2<n;i++)
    {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
            count++;
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		sc.close();

		long res = N + 1 - 2;
		for(long i = 1;i <=(long)Math.sqrt((double)N);i++) {
			if(N%i==0) {
				res = Math.min(res, i + N/i  -2);
			}
		}
		System.out.println(res);
	}
}

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

const int N = (int) 1e5 + 10 ;

int arr[N] , brr[N] , crr[N] , n ;

long long gr( int x ) {
    int lo = 1 , hi = n , mid ;
    long long ans = -1 ;
    while( lo <= hi ) {
        mid = ( lo + hi ) / 2 ;
        if( crr[mid] > x ) {
            ans = mid ;
            hi = mid - 1 ;
        } else {
            lo = mid + 1 ;
        }
    }
    return ( ans == -1 ) ? 0 : n - ans + 1 ;
}

long long ls( int x ) {
    int lo = 1 , hi = n , mid ;
    long long ans = -1 ;
    while( lo <= hi ) {
        mid = ( lo + hi ) / 2 ;
        if( arr[mid] < x ) {
            ans = mid ;
            lo = mid + 1 ;
        }
        else {
            hi = mid - 1 ;
        }
    }
    return ( ans == -1 ) ? 0 : ans ;
}

long long solve( ) {
    sort( arr+1 , arr+1+n ) ;
    sort( brr+1 , brr+1+n ) ;
    sort( crr+1 , crr+1+n ) ;
    long long ans = 0 ;
    for( int i = 1 ; i <= n ; i++ ) {
        ans += ls( brr[i] ) * gr( brr[i] ) ;
    }
    return ans ;
}

int main() {
    scanf("%d" , &n ) ;
    for( int i = 1 ; i <= n ; i++ ) scanf("%d" , &arr[i] ) ;
    for( int i = 1 ; i <= n ; i++ ) scanf("%d" , &brr[i] ) ;
    for( int i = 1 ; i <= n ; i++ ) scanf("%d" , &crr[i] ) ;
    long long ans = solve() ;
    printf("%lld\n" , ans ) ;
    return 0 ;
}


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

int main() {
  string s;
  int k;
  char rst = '1';
  cin >> s >> k;
  
  for (int i = 0; i < min((int)s.length(), k); i++) {
    if (s[i] != '1') {
      rst = s[i];
      break;
    }
  }

  cout << rst << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

type Node struct {
	key    int
	parent *Node
	left   *Node
	right  *Node
}

// main
func main() {
	//testFunction()
	solve(bufio.NewScanner(os.Stdin))
}

// test
func testFunction() {
	input := `

10
insert 30
insert 88
insert 12
insert 1
insert 20
find 12
insert 17
insert 25
find 16
print

`
	sc := bufio.NewScanner(strings.NewReader(strings.Trim(input, "\n")))
	solve(sc)
}

func preOrder(node *Node, accm []int) []int {
	if node == nil {
		return accm
	}
	accm = append(accm, node.key)
	accm = preOrder(node.left, accm)
	accm = preOrder(node.right, accm)
	return accm
}

func inOrder(node *Node, accm []int) []int {
	if node == nil {
		return accm
	}
	accm = inOrder(node.left, accm)
	accm = append(accm, node.key)
	accm = inOrder(node.right, accm)
	return accm
}

func postOrder(node *Node, accm []int) []int {
	if node == nil {
		return accm
	}
	accm = postOrder(node.left, accm)
	accm = postOrder(node.right, accm)
	accm = append(accm, node.key)
	return accm
}

//
func NewNode(key int) *Node {
	return &Node{
		key:    key,
		parent: nil,
		left:   nil,
		right:  nil,
	}
}

//func insert(node *Node, key int) *Node {
//	if node == nil {
//		return NewNode(key)
//	}
//
//	if node.key > key {
//		node.left = insert(node.left, key)
//	}
//	if node.key < key {
//		node.right = insert(node.right, key)
//	}
//	node.parent = node
//	return node
//}
func insert(node *Node, key int) *Node {

	var parent *Node
	n := node
	for n != nil {
		parent = n
		if n.key > key {
			n = n.left
		} else {
			n = n.right
		}
	}

	nn := NewNode(key)
	if parent == nil {
		return nn
	}
	nn.parent = parent
	if key < parent.key {
		parent.left = nn
	} else {
		parent.right = nn
	}

	return node
}

func find(node *Node, key int) *Node {
	n := node
	for n != nil && n.key != key {
		if n.key < key {
			n = n.right
		} else {
			n = n.left
		}
	}
	return n
}

//
func printList(accm []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range accm {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Flush()
}

func print(node *Node) {
	var accm []int
	accm = inOrder(node, accm)
	printList(accm)
	fmt.Println()
	accm = make([]int, 0)
	accm = preOrder(node, accm)
	printList(accm)
	fmt.Println()
}

// solve
func solve(sc *bufio.Scanner) {
	var node *Node
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	for i := 0; i < n; i++ {
		sc.Scan()
		command := sc.Text()
		if command == "insert" {
			sc.Scan()
			value, _ := strconv.Atoi(sc.Text())
			node = insert(node, value)
		} else if command == "find" {
			sc.Scan()
			value, _ := strconv.Atoi(sc.Text())
			if found := find(node, value); found != nil {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		} else if command == "print" {
			print(node)
		}
	}
}



Measured memory_bytes: 36380
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> cnt(m,0);
    for(int i=0;i<n;i++){
        ll k;
        cin>>k;
        for(int t=0;t<k;t++){
            ll h;
            cin>>h;
            cnt[h-1]++;
        }
    }
    ll ans=0;
    for(auto &I:cnt){
        if(I==n){ans++;}
    }
    cout<<ans<<endl;
    

    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
mx=len(bin(max(a)))
b=["0"*(mx-len(bin(x)))+bin(x)[2:] for x in a]

out=["" for _ in range(n)]
for i in range(mx-2):
    tot=0
    for j in range(n):
        tot+=int(b[j][i])
    tot=tot%2
    for j in range(n):
        if tot==int(b[j][i]):out[j]+="0"
        else : out[j]+="1"
c=[str(int(y,2)) for y in out]
print(" ".join(c))

Measured memory_bytes: 192448
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 入力
        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] h = new int[n+1];
        for (int i = 1; i <= n; i++) {
            h[i] = sc.nextInt();
        }

        int a, b;
        int[] maxNeighbor = new int[n+1];
        for (int j = 0; j < m; j++) {
            a = sc.nextInt();
            b = sc.nextInt();
            if (maxNeighbor[a] < h[b]) {
                maxNeighbor[a] = h[b];
            }
            if (maxNeighbor[b] < h[a]) {
                maxNeighbor[b] = h[a];
            }
        }

        int count = 0;
        for (int i = 1; i <= n; i++) {
            if (h[i] > maxNeighbor[i]) {
                count++;
            }
        }

        // 出力
        System.out.println(count);
    }
}


Measured memory_bytes: 59320
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
 int a,b,c,d;
 cin >> a >> b>> c >> d;
 int tr=min(a,b);
 int bus=min(c,d);
 cout << tr+bus << endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
using namespace std;

int main() {

	long long A;
	string B;
	cin >> A >> B;

	string str = B.substr(0, 1) + B.substr(2, 1) + B.substr(3, 1);
	int s = stoi(str);

	long long C = (long long)s;

	long long D = A * C;

	D /= 100;

	cout << D << endl;

	return 0;
}



Measured memory_bytes: 3600
import java.util.Scanner;

public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    String str=sc.next();
    int n=0;
    int max=0;
    for(int i=0;i<str.length();i++){
     if(str.charAt(i)=='A'||str.charAt(i)=='G'||str.charAt(i)=='C'||str.charAt(i)=='T'){
          n++;
     }else{
          n=0;
     }
     max=n>max?n:max;
     }
     System.out.println(max);
     }
    }

Measured memory_bytes: 21844
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int D, G;
    cin >> D >> G;
    vector<int> P(D);
    vector<int> C(D);
    for (int i = 0; i < D; ++i) {
        cin >> P[i] >> C[i];
    }

    vector<int> ord(D, 0);
    iota(ord.begin(), ord.end(), 0);

    long long res = 1LL << 50;
    do {
        long long ans = 0;
        long long rem = G;
        for (auto x : ord) {
            long long sc = 100 * (x + 1);
            long long cnt = min((long long)P[x], (rem + sc - 1) / sc);
            ans += cnt;
            rem -= cnt * sc;
            if (cnt == P[x]) {
                rem -= C[x];
            }
            rem = max(0LL, rem);

            if (rem == 0) {
                break;
            }
        }

        res = min(res, ans);

    } while (next_permutation(ord.begin(), ord.end()));

    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
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;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

ll dp[1ll<<25];
ll a[25][25];

int main() {
    cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(20);

    ll N; cin >> N;
    rep(i,N) rep(j, N) cin >> a[i][j];

    dp[0] = 1;
    for(ll s = 1; s < (1<<N); s++) {
        ll cnt = __builtin_popcountll(s);
        rep(l, N) {
            if(!(s>>l&1)) continue;
            dp[s] += dp[s-(1<<l)] * a[cnt-1][l];
            dp[s] %= MOD;
        }
    }
    cout << dp[(1<<N)-1] << endl;
}


Measured memory_bytes: 18688
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

class Solution {
  int n;
  vector<LL> A;
public:
  void run() {
    cin >> n;
    LL ans = 0;
    for (int i = 0; i < n; ++i) {
      LL a, b;
      cin >> a >> b;
      A.push_back(a + b);
      ans -= b;
    }
    sort(A.rbegin(), A.rend());
    for (int i = 0; i < n; ++i) {
      ans += i % 2 ? 0 : A[i];
    }
    cout << ans << '\n';
  }
};

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  Solution().run();
}


Measured memory_bytes: 1400
def judge(s,p):

    sList = list(s)
    pList = list(p)


    for i in range(len(sList)):
        if sList[i] == pList[0]:
            answerNum = 0
            counter = i

            for j in range(len(pList)):
                if pList[j] == sList[counter]:
                    answerNum += 1

                    if answerNum == len(pList):
                        return True
                else:
                    break

                if counter == len(sList) -1 :
                    counter = 0
                else:
                    counter += 1
    return False

if judge(input(),input()):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5564
n=int(input())
h=list(map(int,input().split()))

tmp = 0
ans = 0

for i in range(n-1):
    if(h[i]-h[i+1]>=0):
        tmp += 1
        ans = max(ans, tmp)
        #print(ans)
    else:
        tmp = 0
        #print(ans)

print(ans)

Measured memory_bytes: 14224
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main()
{
    long N,M;
    cin>>N>>M;
    vector<long>p(1000000),ww(1000000);
    vector<bool>ans(1000000,true);
    vector<string>S(1000000);
    for(int i=0;i<M;i++){
        cin>>p[i]>>S[i];
    }
    long wa=0,ac=0;
    for(int i=0;i<M;i++){
        if(ans[p[i]]){
            if(S[i]=="WA"){
                ww[p[i]]++;
            }else{
                ac++;
                ans[p[i]]=false;
                wa+=ww[p[i]];
            }
        }
    }
    cout<<ac<<" "<<wa<<endl;
}

Measured memory_bytes: 28544
#include<bits/stdc++.h>
#define N 100010
using namespace std;
int l[N],r[N],x[N];
bool vl[N],vr[N];
long long ans[N];
int main(){
	int n,m,c;
	long long k;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&x[i]);
		l[i]=i;
		r[i]=i;
	}
	scanf("%d%lld",&m,&k);
	for(int i=0;i<m;i++){
		scanf("%d",&c);
		swap(l[c],l[c+1]);
		swap(r[c-1],r[c]);
	}
	for(int i=1;i<=n;i++){
		if(!vl[i]){
			vector<int> tmp;
			for(int j=i;!vl[j];j=l[j]){
				tmp.push_back(j);
				vl[j]=true;
			}
			for(int j=0;j<tmp.size();j++){
				l[tmp[j]]=tmp[(j+k)%tmp.size()];
			}
		}
		if(!vr[i]){
			vector<int> tmp;
			for(int j=i;!vr[j];j=r[j]){
				tmp.push_back(j);
				vr[j]=true;
			}
			for(int j=0;j<tmp.size();j++){
				r[tmp[j]]=tmp[(j+k)%tmp.size()];
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans[i]+=ans[i-1];
		ans[i]+=x[l[i]];
		ans[i+1]-=x[r[i]];
		printf("%lld\n",ans[i]);
	}
	return 0;
}


Measured memory_bytes: 3556
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll A,B;
	scan(A);scan(B);
	ll ans=A;
	for(ll i=A+1;i<A/4*4+4;i++) ans^=i;
	for(ll i=max(0LL,B/4*4-4);i<=B;i++) ans^=i;
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int x,sum = 0;
  x = N;
  
  while(x != 0){
    sum += x % 10;
    x = x / 10;
  }
  
  if(N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}

Measured memory_bytes: 256
def main():
    n = int(input())
    mod = 10**9 + 7
    if n == 1:
        print(0)
    elif n == 2:
        print(2)
    else:
        ans = pow(10, n, mod) - pow(9, n, mod)*2 + pow(8, n, mod)
        ans %= mod
        print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9180
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
typedef long long LL;
const int N=1000005;
const int MOD=1e9+7;
int add (int x,int y)   {x=x+y;return x>=MOD?x-MOD:x;}
int mul (int x,int y)   {return (LL)x*y%MOD;}
int dec (int x,int y)   {x=x-y;return x<0?x+MOD:x;}
int Pow (int x,int y)
{
	if (y==0) return 1;
	if (y==1) return x;
	int lalal=Pow(x,y>>1);
	lalal=mul(lalal,lalal);
	if (y&1) lalal=mul(lalal,x);
	return lalal;
}
int n;
int JC[N],inv[N];
void Init (int n)
{
	JC[0]=1;for (int u=1;u<=n;u++) JC[u]=mul(JC[u-1],u);
	inv[n]=Pow(JC[n],MOD-2);
	for (int u=n-1;u>=0;u--) inv[u]=mul(inv[u+1],u+1);
}
int C (int x,int y)	{return mul(JC[x],mul(inv[y],inv[x-y]));}
int f[N];
int main()
{
	scanf("%d",&n);
	Init(n);
	int ans=0;
	for (int u=(n+1)/2;u<n;u++)
	{
		f[u]=mul(mul(C(u-1,n-u-1),JC[u]),JC[n-1-u]);
		ans=add(ans,mul(u,dec(f[u],f[u-1])));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 9984
#include <cstdio>

using namespace std;

int main() {
  long long x;
  scanf("%lld", &x);
  long long set;
  set = x / 11;
  if (x % 11 >= 7) {
    printf("%lld", set*2 + 2);
  } else if (x % 11 > 0) {
    printf("%lld", set*2 + 1);
  } else {
    printf("%lld", set*2);
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr int inf  = 1e8;
int water_ub(int A, int B, int F) {
    return (F/(100)) *  100;
}
int main(){
    int A,B,C,D,E,F;
    cin >> A >> B >> C >> D >> E >> F;
    int w_ub = water_ub(A,B,F);
    vector<vector<bool>>dp(w_ub + 1,vector<bool>(F,false));
    dp[0][0] = true;
    for(int i = 0; i < dp.size(); ++i){
        for(int j = 0; j < dp[i].size(); ++j){
            bool valid  = dp[i][j];
            if(not valid ) continue;
            if(i + A < dp.size())
                dp[i + A][j] = true;
            if(i + B < dp.size())
                dp[i + B][j] = true;
            if(j + C < dp[i].size() && i * 100 + j + C <= F && 100 * (j + C) <= E * i * 100)
                dp[i][j + C] = true;
            if(j + D < dp[i].size() && i * 100 + j + D <= F && 100 * (j + D) <= E * i * 100)
                dp[i][j + D] = true;
        }
    }
    pair<int,int>ans = {A*100,0};
    for(int i = 0; i < dp.size(); ++i){
        for(int j = 0 ; j < dp[i].size(); ++j){
            if(not dp[i][j]) continue;
            if((ans.second) * (i * 100  + j) < (j) * (ans.first))
                ans = {i * 100 + j,j};
        }
    }
    cout << ans.first << " " << ans.second << endl;
}




Measured memory_bytes: 4748
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool ip(string s){
	int n=s.size(),l=0,r=n-1;
	while(l<=r) if(s[l++]!=s[r--]) return false;
	return true;
}
int main(){
	string s; cin>>s;
	int n=s.size(),l=0,r=n-1;
	if(ip(s) and ip(s.substr(0,(n-1)/2)) and ip(s.substr((n+3)/2-1))) cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 3624
package main
import "fmt"
func main(){
    // Your code here!
    var n int
    fmt.Scan(&n)
    t := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&t[i])
    }

    l := len(t)
    count := 0
    for i := 0; i < l; i++ {
        if t[i] % 2 == 1 {
            count++
            continue
        }
        
        if t[i] % 3 == 0 || t[i] % 5 == 0{
            count++
            continue
        }
    }
    if count == len(t){
        fmt.Println("APPROVED")
    }else{
        fmt.Println("DENIED")
    }
    
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<list>
#define ll long long
using namespace std;
int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll int n;
	cin>>n;
	cout<<n+pow(n,2)+pow(n,3)<<endl;
	return 0;
} 


Measured memory_bytes: 4180
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n,m; cin >> n >> m;
    int t = 100*n + 1800*m;
    OUT(t*pow(2,m));

    return 0;
}

Measured memory_bytes: 384
// Dont be lazy. Dont look for simple and quick implementations. Be ready to do case-work and implement. Make sure the method is fully correct. 
// Read question properly, ques can be tricky


#include <bits/stdc++.h>
#include <chrono>
using namespace std;
 
#define int long long
 
#define pb push_back
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define f first 
#define s second
#define tup pair<pii,int>
#define ordk order_of_key
// const int M= 998244353;
const int M = 1e9+7;
const int MXN=20; 
 
int power(int a,int b) {int res=1;a%=M;while(b){if((b&1))res=(res*a)%M;a=(a*a)%M;b>>=1;}return res;}
inline void print(int a,int b){ cout << a << ' ' << b << endl;}
inline void print(int a,int b,int c){ cout << a << ' ' << b <<' '<< c << ' ' << endl;}
 
int n;

int32_t main(){
    fast;
    cin>>n;
    int a;
    int b[65];
    memset(b,0,sizeof(b));
    for(int i=0;i<n;++i){
        cin>>a;
        for(int i=0;i<61;++i){
            b[i]+=((a>>i) & 1LL);
        }
    }
    int ans =0,pl=1;
    for(int i=0;i<61;++i){
        int cnt = b[i]*(n-b[i])%M;
        ans =(ans+ cnt * pl%M)%M;
        (pl*=2LL)%=M;
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int n; cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
	int t; cin >> t;
	a.push_back(t);
  }
  sort(a.begin(), a.end());
  int x = a.front(), y = a.back();
  int ans = 1e10;
  for (int i = x; i <= y; i++) {
	int tmp = 0;
	for (int j = 0; j < n; j++) {
	  tmp += (i - a[j])*(i - a[j]);
	}
	ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<cstdio>

long long gcd(long long a, long long b) {
	long long r;
	while((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}

int main() {
	int t;
	scanf("%d", &t);
	for(int i=0;i<t;i++) {
		bool ans;
		long long a, b, c, d;
		scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
		long long g = gcd(b, d);
		long long m = c - a + g * ((d - c + a - 1) / g);
		if(d >= b && a >= b && d - m - b + c >= 0) {
			ans = true;
		} else {
			ans = false;
		}
		printf("%s\n", ans ? "Yes" : "No");
	}
	return 0;
}


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

using namespace std;
using namespace atcoder;

int main(){
	
	int n, m; cin >> n >> m;
	vector<string> grid(n);
	for(int i = 0; i < n; i++) cin >> grid[i];

	mf_graph<int> g(n*m + 2);
	int s = n*m; int t = n*m+1;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			if(grid[i][j] == '#') continue;
			int v = i * m + j;
			if((i+j) % 2) {
				g.add_edge(v, t, 1);
			}else g.add_edge(s, v, 1);

		}
	}

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			if((i+j) % 2 || grid[i][j] == '#') continue;
			int v = i*m+j;
			if(i >= 1 and grid[i-1][j] == '.') {
				g.add_edge(v, (i-1)*m+j, 1);
			}
			if(j >= 1 and grid[i][j-1] == '.') {
				g.add_edge(v, (i * m + j - 1), 1);
			}
			if(i+1 < n and grid[i+1][j] == '.') {
				g.add_edge(v, (i+1)*m+j, 1);

			}
			if(j +1 < m and grid[i][j+1] == '.') {
				g.add_edge(v, (i * m + j + 1), 1);
			}
		}
	}

	cout << g.flow(s, t) << endl;

	auto edges = g.edges();
	for(auto e: edges) {
		if(e.from == s || e.to == t || e.flow == 0) continue;
		int i0 = e.from / m, j0 = e.from % m;
        int i1 = e.to / m, j1 = e.to % m;
		if (i0 == i1 + 1) {
            grid[i1][j1] = 'v';
            grid[i0][j0] = '^';
        } else if (j0 == j1 + 1) {
            grid[i1][j1] = '>'; grid[i0][j0] = '<';
        } else if (i0 == i1 - 1) {
            grid[i0][j0] = 'v';
            grid[i1][j1] = '^';
        } else {
            grid[i0][j0] = '>'; grid[i1][j1] = '<';
        }
	}
	for (int i = 0; i < n; i++) {
        cout << grid[i] << endl;
    }
	
	return 0;
}


Measured memory_bytes: 5508
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define LL long long
using namespace std;
LL read() {
    LL k = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9')
        k = k * 10 + c - 48, c = getchar();
    return k * f;
}
int main() {
    int a = read(), b = read();
    if((a+b) & 1) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    else {
        cout << ((a+b) >> 1) << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
edges = M.times.map { gets.split.map(&:to_i) }

GRAPH = Hash.new { |h, k| h[k] = {} }

edges.each do |a, b|
  GRAPH[a][b] = GRAPH[b][a] = true
end

def dfs(v, visited)
  return if visited[v]
  visited[v] = true

  GRAPH[v].each_key do |t|
    next unless GRAPH[v][t]

    dfs(t, visited)
  end
end

ans = 0

edges.each do |a, b|
  visited = {}
  GRAPH[a][b] = GRAPH[b][a] = false
  dfs(1, visited)

  if visited.size != N
    ans += 1
  end

  GRAPH[a][b] = GRAPH[b][a] = true
end

puts ans


Measured memory_bytes: 2044
let s=readLine()!
var S=Array(s)
var count=1
var k=0
for x in S{
  if count%2==1{
    if x == "L"{
      k=1
    }
  }else{
    if x == "R"{
      k=1
    }
  }
  count+=1
}
if k==1{
  print("No")
}else{
  print("Yes")
}
    

Measured memory_bytes: 7672
N = int(input())
W = list(map(int, input().split()))

tmp1 = W[0]
tmp2 = sum(W) - W[0]

res = abs(tmp2 - tmp1)
for i in range(1, N):
    tmp1 = tmp1 + W[i]
    tmp2 = tmp2 - W[i]
    
    if abs(tmp2 - tmp1) < res:
        res = abs(tmp2 - tmp1)
        
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n, a, b;
    cin >> n >> a >> b;
    if((b - a) % 2){
        cout << "Borys" << endl;
    }
    else
    cout << "Alice" << endl;
}

Measured memory_bytes: 256
while True:
    n, m = list(map(int, input().split()))
    if n == 0 and m == 0:
        break
    a = [int(i) for i in input().split()]
    total = []
    i = 0
    for i in range(n-1):
        for j in range(i+1, n):
            if a[i] + a[j] <= m:
                total.append(a[i] + a[j])

    if len(total) > 0:
        print(max(total))
    else:
        print("NONE")
























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

int main(void) {
	long long N;
	long long K;
	cin >> N >> K;
	vector <long long> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A.begin(), A.end());

	long long l = -1e18;
	long long r = 1e18;
	while (r-l > 1) {
	  long long mid = (l+r) >> 1;
		long long tmp = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] > 0) {
				if (A[0]*A[i] > mid) continue;
				 long long ll = 0;
				 long long rr = N;
				 while (rr - ll > 1) {
					 long long m = (rr+ll) >> 1;
					 if (A[i]*A[m] > mid) rr = m;
					 else ll = m;
				 }
				 tmp += rr;
				 if (A[i]*A[i] <= mid) tmp--;
			}

			if (A[i]==0) {
				if (mid >= 0) tmp += N-1;
			}

			if (A[i] < 0) {
				if (A[N-1]*A[i] > mid) continue;
				long long ll = -1;
				long long rr = N-1;
				while ((rr-ll) > 1) {
					long long m = (rr+ll) >> 1;
					if (A[i]*A[m] > mid) ll = m;
					else rr = m;
				}
				tmp += N-rr;
				if (A[i]*A[i] <= mid) tmp--;
			}
		}
		if (tmp >= K*2) r = mid;
		else l = mid;
	}
  cout << l+1 << endl;
  return 0;
}

Measured memory_bytes: 1792