akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element


signed main()
{
	int N;
	cin >> N;
	REP(i, N)
	{
		int a;
		cin >> a;
		if (a % 2 == 0)
		{
			if (a % 3 != 0 && a % 5 != 0)
			{
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;

//解説ac

int main()
{
	int n, m,k;
	cin >> n >> m >> k;
	vector<int> aa(n);
	vector<int> bb(m);
	rep(i, n) cin >> aa[i];
	rep(i, m) cin >> bb[i];
	ll tota = 0;
	rep(i, m) tota += bb[i];
	int j = m;
	int ans = 0;
	rep(i, n + 1) { //iがaaの本の数
		while (tota > k and j > 0)
		{
			--j; //読むbを減らしていく
			tota -= bb[j];
		}
		if (tota > k) break;
		ans = max(ans, i + j);
		if (i == n) break;
		tota += aa[i];
	}
	cout << ans << endl;

}


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

ll gcd(ll a,ll b){
    if(b>a) swap(a,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;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}

int main() {
    ll N,K;
    cin >> N >> K;
    vector<ll>d(K);

    d[K-1]=1;
   
    for(ll i=K; i>0; i--){
         ll sum=0;
        for(ll j=2*i; j<K+1; j+=i){
            
        
         sum+=d[j-1];}
         ll z;
         z=rep_jijo(K/i,N);
  
     d[i-1]=z-sum;
     d[i-1]%=mod;
    
    }
ll ans=0;
    rep(i,K){
ans+= d[i]*(i+1);
ans%=mod;
    }



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



Measured memory_bytes: 4056
N=int(input())
P=list(map(int,input().split()))
ps=""
for i in range(N):
  ps+=str(P[i])
Q=list(map(int,input().split()))
qs=""
for i in range(N):
  qs+=str(Q[i])

stack=[]
stack.append("")
res=[]
while stack:
  d=stack.pop()
  if len(d)==N:
    res.append(d)
    continue
  for i in range(1,N+1):
    if str(i) not in d:
      stack.append(d+str(i))
  
res=res[::-1]
a=0
b=0
for i in range(len(res)):
  if res[i]==ps:
    a=i+1
  if res[i]==qs:
    b=i+1

print(abs(a-b))

Measured memory_bytes: 6248
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
	int N,M,X; cin >> N >> M >> X;
	vector<int> A(M);
	rep(i,M) cin >> A[i];
	int now = 0;
	repr(i,X,N+1){
		rep(j,M){
			if(i == A[j]) now++;
		}
	}
	int now2 = 0;
	for(int i = X; i >= 0; i--){
		rep(j,M){
			if(i == A[j]) now2++;
		}
	}
	int ans = min(now,now2);
	cout << ans << endl;
}



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


struct ok
{

    long long int a,b;



};

bool ok1(ok x,ok y)
{
    return x.a<y.a;

}

int main()
{

long long int i,n;
ok array[200009];

cin>>n;

for(i=0;i<n;i++)
{
 cin>>array[i].a;
 array[i].b=i+1;

}

sort(array,array+n,ok1);

for(i=0;i<n;i++)
cout<<array[i].b<<endl;
return 0;
}

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

#define FOR(i,s,e) for(int i=(s);(i)<(int)(e);++(i))
#define REP(i,e) FOR(i,0,e)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define ppb(x) pop_back(x)
#define mp make_pair
#define mt make_tuple
#define t0(t) get<0>((t))
#define t1(t) get<1>((t))
#define t2(t) get<2>((t))

typedef long long ll;

int main() {
  int x;
  fscanf(stdin, "%d ", &x);
  puts(x==0 ? "1" : "0");
  return 0;
}


Measured memory_bytes: 3776
#include<stdio.h>

static const int N = 100;

int min(int a, int b){ return a < b ? a : b; }

int main(){
  int i, j, k, l;
  int n, p[N+1], m[N+1][N+1];
  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ){
    scanf("%d %d", &p[i-1], &p[i]);
  }

  for ( i = 1; i <= n; i++ ) m[i][i] = 0;
  for ( l = 2; l <= n; l++ ){
    for ( i = 0; i <= n-l+1; i++ ){
      j = i+l-1;
      m[i][j] = (1<<21);
      for ( k = i; k <= j-1; k++ ){
	m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
      }
    }
  }

  printf("%d\n", m[1][n]);
  
  return 0;
}



Measured memory_bytes: 2112
import sys
n = int(input())
input_line = [[int(i) for i in str.split()] for str in sys.stdin.read().splitlines()]
for i in range(n):
    input_line[i] = [] if len(input_line[i]) == 2 else input_line[i][2:]
is_visit = [False] * n
distance = [0] * n
queue = [1]

while len(queue) != 0:
    id = queue.pop(0)
    is_visit[id-1] = True
    for node_id in input_line[id-1]:
        if not is_visit[node_id-1]:
            distance[node_id-1] = distance[id-1] + 1
            queue.append(node_id)
            is_visit[node_id-1] = True

for i in range(n):
    d = distance[i] if is_visit[i] else -1
    print('{0} {1}'.format(i+1, d))






Measured memory_bytes: 5616
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);

int main()
{
    int p[3];
    for (int i = 0; i < 3; i++)
    {
        std::cin >> p[i];
    }
    std::sort(p, p+3);
    if((p[0]!=p[1] && p[1]==p[2]) || (p[0]==p[1] && p[1]!=p[2])) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}







int main() {
  string S;
  cin >> S;
  set<string> s;
  int n = S.length();
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  if (n == 2) {
    if (S[0] == S[1]) {
      cout << "1\n";
    } else {
      cout << "2\n";
    }
    return 0;
  }
 
  int dp[n]{};
  // 1文字目
  dp[0] = 1;
  // 2文字目
  if (S[0] == S[1]) {
    dp[1] = 1; // aa -> a, a
  } else {
    dp[1] = 2; // ab -> a, b
  }
  // 3文字目
  if (S[0] != S[1] && S[1] != S[2]) {
      dp[2] = 3; // aba -> a, b, a
  } else {
      dp[2] = 2; // ?aa -> ?a, a
  }
  for (int i = 3; i < n; i++) {
      if (S[i - 1] == S[i]) {
          dp[i] = dp[i - 3] + 2; // ??aa -> ?, ?a, a or ?, ?, aa
      } else {
          dp[i] = dp[i - 1] + 1; // ?ab -> ?, a, b or ?a, b
      }
  }
  cout << dp[n - 1] << "\n";
  return 0;
}

Measured memory_bytes: 1284
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

//WA

int main(void){
	ll N,A[200010],itr=0,d=0,ans=0;
	scanf("%lld",&N);
	rep(i,N)scanf("%lld",&A[i]);
	ll l=0,r=0,sum=0;
	while(1){
		// printf("%d,%d\n",l,r);
		if((sum+A[r])==(sum^A[r])){
			sum+=A[r];
			if(r<N-1){
				r++;
			}else{
				ans+=(r-l+1)*(r-l+1+1)/2;
				break;
			}
		}else{
			ans+=(r-1-l+1);
			sum-=A[l];
			l++;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> pll;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define vuni(v) v.erase(unique(v.begin(), v.end()), v.end());
#define mins(m, s) m.insert(make_pair(s, 1));
#define mfin(m, s) m.find(s) != m.end()

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9 + 7;

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

    cnt = 0;
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= N / i; j++) {
            int k = N - i * j;
            if(i >= 1 && j >= 1 && k >= 1) {
                cnt++;
                // cout << i << " " << j << " " << k << endl;
            }
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3548
import bisect
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29


def main():
    X,Y,A,B,C = isRaw()
    ps = isRaw()
    qs = isRaw()
    rs = isRaw()
    ps.sort(reverse=True)
    ps = ps[:X]
    qs.sort(reverse=True)
    qs = qs[:Y]
    rs.sort()
    pqr = ps+qs+rs
    pqr.sort(reverse=True)
    return sum(pqr[:X+Y])

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 111596
#include<stdio.h>

int main() {

	int n;
	int i;
	int flag,count;
	char c[400];
	int Answer[150],a=0;

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

		for(i=0;i<3*n;i++)
			scanf("%c",&c[i]);

		flag=0,count=0;
		for(i=1;i<3*n;i+=3) {
			if(c[i+1]=='u') {
				if(flag==0) flag++;
				else if(flag==1) {
					count++;
					flag=0;
				}
				else if(flag==-1) flag++;
			}

			else {
				if(flag==0) flag--;
				else if(flag==-1) {
					count++;
					flag=0;
				}
				else if(flag==1) flag--;
			}
		}
		Answer[a]=count;
		a++;
	}

	for(i=0;i<a;i++)
		printf("%d\n",Answer[i]);

	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define ll  long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pb push_back
#define Max(x,y,z) max(x,max(y,z))
#define f first
#define s second
#define lbd lower_bound
#define sz(x)       (ll)x.size()
#define pi 3.1415926536
#define mod 1000000007
using namespace std;
void solve()
{
    ll n,m,k,x,y=0,res=0,l,cnt=0,sum=0,z,sum1=0,cnt1=0,h,res1;
    cin>>n;
    ll ar[n],br[n];
    rep(i,0,n)
    cin>>ar[i];
    rep(i,0,n) cin>>br[i];
    rep(i,0,n)
    if(ar[i]-br[i]>0)
        sum+=(ar[i]-br[i]);
    cout<<sum;
}
int main()
{
    ll t;
   // cin>>t;
    t=1;
    while(t--)
        solve();
}


Measured memory_bytes: 256
#include <iostream>
#define M 100
#define N 100
using namespace std;

int main()
{
	int ary[N][M];
	int n, m;
	int i, j;
	int *c;
	int sum = 0;

	cin >> n >> m;

	c = new int[m];

	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			cin >> ary[i][j];
		}
	}

	for (j = 0; j < m; j++) {
		cin >> c[j];
	}

	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			sum += ary[i][j] * c[j];
		}
		cout << sum << endl;
		sum = 0;
	}

	delete [] c;

	return 0;
}

Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  cout << "A" << b[0] << "C" << endl;
}

Measured memory_bytes: 3544
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;

int main(){
	char a[4];
	scanf("%s",a + 1);
	if(a[1] == a[3]) printf("Yes\n");
	else printf("No\n");
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int main()
{
	set<char> st;
	string str = "";
	cin >> str;

	REP(i, str.length())
	{
		st.insert(str[i]);
	}

	st.size() == str.length() ? COUT("yes") : COUT("no");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
int main(){
    int N,M,ns=0,ms=0;

    cin>>N;
    cin>>M;

    if(N>1){
       
        for (int i = 1; i < N; i++)
            {
                ns+=i;

        
    }
    }
    if(M>1){
        
        for (int i = 1; i < M; i++)
            {
                ms+=i;

        
    }
    }
    
    cout<<ms+ns<<endl;
    return 0;
}

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

int main(){

  int a,b;

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

  if(a + b < 24) printf("%d\n", a + b);

  else printf("%d\n", a + b - 24);
  
  return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

const int MAX = 3010000;
long long fac[MAX], finv[MAX], inv[MAX];
bool initialized = false;

/**
 * @fn
 * This function must be called at first.
 */
void combination_init() {
    initialized = true;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

/**
 * @fn
 * Calculates the combination  ( nCK % p: N choose K mod p).
 *
 * @brief constraint: 1 ≤ k ≤ n ≤ 10^7
 * @return nCK % MOD
 */
long long combination(int n, int k) {
    assert(initialized);
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/**
 * @fn
 * Calculates the factorial of the number.
 *
 * @return N! % MOD
 */
long long factorial(int n) {
    assert(initialized);
    if (n < 0) return 0;
    return fac[n] % MOD;
}

/**
 * @fn
 * Calculates the combination ( nCK % p: N choose K mod p).
 *
 * @brief constraint: 1 ≤ k ≤ 10^7 and 1 ≤ n ≤ 10^9
 * @return nCK % MOD
 */
long long combination2(int n, int k) {
    assert(initialized);
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll res = 1;
    k = min(k, n - k);
    for (long long x = 1; x <= k; x++) {
        res *= (n - x + 1);
        res %= MOD;
        res *= inv[x];
        res %= MOD;
    }
    return res;
}

ll f(ll r, ll c) {
    return combination(r + c + 2, r + 1) - 1;
}

void Main() {
    ll r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    combination_init();
    ll ans = f(r2, c2);
    ans %= MOD;
    ans -= f(r2, c1 - 1);
    ans %= MOD;
    if (ans < 0) ans += MOD;
    ans -= f(r1 - 1, c2);
    ans %= MOD;
    if (ans < 0) ans += MOD;
    ans += f(r1 - 1, c1 - 1);
    ans %= MOD;
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 70784
// C++ 14
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>

#define ll long long
#define loop(x, start, end) for(int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)

#define MAX 1000

using namespace std;



int lcs(string &s1, string &s2) {
    int dp[MAX+1][MAX+1];
    int l1 = s1.length();
    int l2 = s2.length();
    int maxl = 0;
    
    s1 = ' ' + s1;
    s2 = ' ' + s2;
    
    loop(i, 0, l1+1) {
        dp[i][0] = 0;
    }
    loop(j, 0, l2+1) {
        dp[0][j] = 0;
    }
    
    loop (i, 1, l1+1) {
        loop (j, 1, l2+1) {
            if (s1[i] == s2[j]) dp[i][j] = 1 + dp[i-1][j-1];
            else dp[i][j] = max(
                dp[i-1][j],
                dp[i][j-1]
            );
            
            maxl = max(maxl, dp[i][j]);
        }
        
    }
    
    return maxl;
}

int main(void) {
    int n;
    string s1, s2;
    
    cin >> n;
    loop(i, 0, n) {
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << endl;
    }
}


Measured memory_bytes: 6968
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    print(n**3)
    return

#B
def B():
    n = II()
    a = LI()
    b = LI()
    c = LI()
    ans = 0
    for i in range(n):
        ans += b[a[i] - 1] + (c[a[i] - 1] if i != n - 1 and a[i] + 1 == a[i + 1] else 0)
    print(ans)
    return

#C
def C():
    n = II()
    b = LI()
    ans = b[0]
    for i in range(n-1):
        if b[i] >= b[i + 1]:
            ans += b[i + 1]
        else:
            ans += b[i]
    print(ans)
    return

#D
def D():
    n, k = LI()
    s = S()
    a = []
    for i in range(n):
        if i == n - 1:
            a.append(s[i])
        elif s[i] != s[i + 1]:
            a.append(s[i])
    print(min(n - 1, n - len(a) + 2 * k))
    return

#E
def E():
    return

#F
def F():
    return


#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 39280
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define debug1(a) cout<<#a<<" "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<" "#c<<" "<<(c)<<endl;
typedef long double ld;
vector<pair<ld, ld>> v;
ld fact(ld n)
{
	ld res = 1;
	for (int i = 1; i <= n; i++)
	{
		res *= i;
	}
	return res;
}
void swap(pair<ld, ld> &a, pair<ld, ld> &b)
{
	pair<ld, ld> temp;
	temp = a;
	a = b;
	b = temp;
}
ld val = 0;
void permutation(vector<pair<ld, ld>> v, ll start, ll end)
{
	if (start == end)
	{
		for (int i = 1; i < v.size(); i++)
		{
			pair<ld, ld> prev = v[i - 1];
			pair<ld, ld> now = v[i];
			val += sqrt(pow((abs(prev.first - now.first)), 2) + (pow((abs(prev.second - now.second)), 2)));
		}

		return;
	}
	int i;
	for (i = start; i <= end; i++)
	{
		//swapping numbers
		swap(v[i], v[start]);
		//fixing one first digit
		//and calling permutation on
		//the rest of the digits
		permutation(v, start + 1, end);
		swap(v[i], v[start]);
	}
}
void solve()
{
	ll n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		ld x, y;
		cin >> x >> y;
		v.push_back({x, y});
	}
	permutation(v, 0, n - 1);
	ld res = val / fact(n);
	cout << fixed << setprecision(10) << res << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t = 1;
	while (t--)
	{
		solve();
	}
}

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

int main(int, char**) {
        int a, b, c, d;
        std::cin >> a >> b >> c >> d;
        int t = (c + (b - 1)) / b;
        int k = (a + (d - 1)) / d;
        if (t <= k) {
                std::cout << "Yes" << std::endl;
        } else {
                std::cout << "No" << std::endl;
        }
        return 0;
}


Measured memory_bytes: 3648
#include<cstdio>
#include<math.h>

int main(){
	double a,b,c,d;
	scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
	printf("%f\n", sqrt((c - a) * (c - a) + (d - b) * (d -b)));
	return 0;
}

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

int main() {
  int a, b;
  char op;
  cin >> a >> op >> b;
  if (op == '+') cout << a + b << endl;
  else cout << a - b << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

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

	int count = 0;
	for(int i = 0; i < s.size(); i++) count += s[i] == t[i];
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a[100005];
int ans[100005];
int qian[100005];
int hou[100005];
int gcd(int v,int b){
    if(v%b==0){
        return b;
    }
    return gcd(b,v%b);
}
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	qian[0]=a[2];
	qian[1]=a[1];
	hou[0]=a[n-1];
	hou[1]=a[n];
	for(int i=1;i<n;i++){
		hou[i+1]=gcd(hou[i],a[n-i]);
//		cout<<hou[i+1]<<" ";
	}
//	cout<<endl;
	for(int i=1;i<n;i++){
		qian[i+1]=gcd(qian[i],a[i+1]);
//		cout<<qian[i+1]<<" ";
	}
//	cout<<endl;
	for(int i=1;i<=n;i++){
		ans[i]=gcd(qian[i-1],hou[n-i]);
	}
	int maxn=0;
	for(int i=1;i<=n;i++){
		maxn=max(ans[i],maxn);
	}
	cout<<maxn;
	return 0;
} 

Measured memory_bytes: 1792
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top,S[1000];

void push (int x){
    S[top+=1] = x ;

}

int pop(){
    top--;
    return S[top+1];
}
int main(){
    int a,b;
    top = 0;
    char s[100];
    
    while(scanf("%s",s)!=EOF){
        if(s[0]=='+'){
            a=pop();
            b=pop();
            push(a+b);


        }
        else if(s[0]=='-'){
            b=pop();
            a=pop();
            push(a-b);
        }
        else if(s[0]=='*'){
            a=pop();
            b=pop();
            push(a*b);

        }
        else{
            push(atoi(s));
        }       
    }
    printf("%d\n",pop());
    return 0;
}    


Measured memory_bytes: 2760
#include <stdio.h>

int main(void)
{
	int N, K, X, Y;

	scanf("%d%d%d%d", &N, &K, &X, &Y);
	if (K < N) {
		printf("%d\n", K * X + (N - K) * Y);
	} else {
		printf("%d\n", N * X);
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L

int mxN = 50000000;
vector<int> cnt(mxN + 1);

int main() {
    int n, k;
    cin >> n >> k;
    long double ans = 0;
    for (int i = 1; i <= n; i++) {
        long double x = (long double)1 / n;
        int cnt = 0;
        int m = i;
        while (m < k) {
            m *= 2;
            cnt++;
        }
        x = (long double)x * (pow((long double)1 / 2, cnt));

        ans += x;
    }
    cout << fixed << setprecision(12) << ans;

    return 0;
}

Measured memory_bytes: 198440
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
 
int main() {
	ll n,k;
	cin >> n >> k;
	ll c[100001] = {};
	int a,b;
	for (int i=0;i<n;i++) {
		cin >> a >> b;
		c[a]+=b;
	}
	ll d=0;
	for (int i=0;i<100001;i++) {
		d+=c[i];
		if (d>=k) {
			cout << i;
			return 0;
		}
	}
}

Measured memory_bytes: 1024
n = gets.to_i
ary_M = Array.new
ary_A = Array.new
ary_R = Array.new
ary_C = Array.new
ary_H = Array.new
[*0..(n-1)].each{|i|
  str = gets.chomp.to_s
  s = str[0]
  case s
  when "M" then
    ary_M.push( str.dup )
  when "A" then
    ary_A.push( str )
  when "R" then
    ary_R.push( str )
  when "C" then
    ary_C.push( str )
  when "H" then
    ary_H.push( str )
  end
}

ary = [ary_M, ary_A, ary_R, ary_C, ary_H]

sum = 0
[*0..4].each{|i|
  next if ary[i].size == 0
  [*(i+1)..4].each{|j|
    next if ary[j].size == 0
    [*(j+1)..4].each{|k|
      next if ary[k].size == 0
      sum += ary[i].size * ary[j].size * ary[k].size
    }
  }
}
puts sum.to_s

Measured memory_bytes: 11132
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {
	
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	if ((abs(b - a) <= d && abs(c - b) <= d)||abs(c-a)<=d)printf("Yes");
	else printf("No");


}

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


int main(){
	int n;
	string s;
	cin >> n;
	cin >> s;
	bool flag=1;
	int count=1;
	rep(i,n-1){
		if(s[i]==s[i+1]) continue;
		count++;
	}
	cout << count << endl;

	return 0;
}


Measured memory_bytes: 512
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N, M;
  cin >> N >> M;
  string S;
  cin >> S;

  vector<vector<pii>> change(N + 2), clear(N + 2);
  set<pii> s;
  change[0].emplace_back(0, -1);
  clear[1].emplace_back(0, -1);
  vector<int> dp(N + 1, -1);
  vector<int> from(N + 1, -2);
  rep(i, 0, N + 1) {
    for (pii x : change[i]) {
      s.insert(x);
    }
    for (pii x : clear[i]) {
      s.erase(x);
    }
    if (S[i] == '1') continue;
    if (sz(s)) {
      pii mn = *begin(s);
      dp[i] = mn.first;
      from[i] = mn.second;
      if (i == N) break;
      int l = i + 1;
      int r = min(N, i + M) + 1;
      pii q = {mn.first + 1, i};
      change[l].push_back(q);
      clear[r].push_back(q);
    }
  }
  if (dp[N] == -1) {
    cout << -1 << endl;
    return 0;
  }
  int idx = N;
  vi ans;
  while (1) {
    int prev = from[idx];
    if (prev == -1) break;
    ans.push_back(idx - prev);
    idx = prev;
  }
  reverse(all(ans));
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int WWW = 0;WWW < (n);WWW++)cerr << v[WWW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

int main(){
	ll n,k,q;
	cin >> n >> k >> q;
	vector<pair<ll,ll>> v;
	REP(i,n){
		ll tmp;cin >> tmp;
		v.PB(MP(tmp,i));
	}
	sort(ALL(v));
	ll ans = v[q-1].FI - v[0].FI;
	REP(i,n){
		set<ll> place;
		place.insert(-1);
		place.insert(n);
		vector<int> kazu(n+10);
		for(int j = 0;j <= i;j++)place.insert(v[j].SE);
		vector<ll> seica;
		for(ll j = i+1;j < n;j++){
			auto it = place.lower_bound(v[j].SE);
			ll tmpA = *it;
			it--;
			ll tmpB = *it;
			if(tmpA - tmpB - 1 - kazu[tmpA]>= k){
				seica.PB(v[j].FI);
				kazu[tmpA]++;
			}
		}
		
		DBG(cout << "seica.size() " << seica.size() << endl;);
		DBG(cout << "path" << endl;)
	//	DBG(cout << "NOW " << seica[q-1] - seica[0] << endl;)
		sort(ALL(seica));
		if(seica.size() >= q)ans = min(ans,seica[q-1]-seica[0]);
	}
	
	cout << ans << endl;	
	
	return 0;
}


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

#define f first 
#define s second 
#define pb push_back               
#define mp make_pair 

using namespace std;                    

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int N = (int)1e5 + 123, mod = (int)1e9 + 7;

int n, m, q, ans[N];
vector< int > v[2];

int main(){    
	cin >> n >> m;
	if(m == 1){
		int x;
		cin >> x;
		if(x == 1)
			cout << x << endl << 1 << endl << 1;
        else
        	cout << x << endl << 2 << endl << x - 1 << " " << 1;
		return 0;
	}
	for(int i = 0; i < m; i++){
		int x;
		cin >> x;
		v[x&1].pb(x);
	}                             
	sort(v[0].begin(),v[0].end());
	sort(v[1].begin(),v[1].end());
	
	if(v[1].size() > 2){
		cout << "Impossible" ;
		return 0;
	}                          
	
	if(!v[1].empty())
       	cout << (ans[q++] = v[1][0]) << " ";
	for(int i = 0; i < v[0].size(); i++)
		cout << (ans[q++] = v[0][i]) << " ";
	for(int i = 1; i < v[1].size(); i++)
		cout << (ans[q++] = v[1][i]) << " ";
	cout << endl; 
	ans[0]--;
	ans[q - 1]++;
	if(ans[0] == 0){
		cout << q - 1 << endl;
		for(int i = 1; i < q; i++)
			cout << ans[i] << " ";
	}else{
		cout << q << endl;
		for(int i = 0; i < q; i++)
			cout << ans[i] << " ";
	}//das
	return 0;
}


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

using namespace std;

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

	cin >> N;

	long long int X[N];
	for(int i=0;i<N;i++){
		cin >> X[i];
	}

	long long int s_X[N];
	for(int i=0;i<N;i++){
		s_X[i] = X[i];
	}
	sort(s_X,s_X+N);
	double mid = ((double)s_X[N/2 - 1] + s_X[N/2])/2;

	for(int i=0;i<N;i++){
		if(X[i] <= mid) cout << s_X[N/2] << "\n";
		else 			cout << s_X[N/2 - 1] << "\n";
	}

	return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
 
#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()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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


    rep(i, 10000){
        ll tx8 = i*0.08;
        ll tx10 = i*0.1;
        if(tx8 == a && tx10 == b){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

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

#define ll long long
#define endl '\n'
#ifndef _WINDOWS
// no getchar_unlocked on Windows so just call getchar
#define getchar getchar_unlocked
#endif

template <typename Func>
inline void loop(int e, Func&& f) {
    for (int i = 0; i < e; i++) {
        std::forward<Func>(f)(i);
    }
}
template <typename Func>
inline void loop(int s, int e, Func&& f) {
    for (int i = s; i < e; i++) {
        std::forward<Func>(f)(i);
    }
}
template <typename T>
inline void scanpn(T& num) {
    register int c;
    num = 0;
    c = getchar();
    for (; (c > 47 && c < 58); c = getchar()) num = num * 10 + c - 48;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    n = n % k;
    cout << min(k - n, n) << endl;
    return 0;
}


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

using namespace std;

bool field[5000][5];
int top[5];

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		memset(field, 0, sizeof(field));
		memset(top, 0, sizeof(top));

		while (n--)
		{
			int d, p, q;
			scanf("%d %d %d", &d, &p, &q);
			--q;

			int width = d == 1 ? p : 1;
			int pos = -1;
			for (int i = 5000-1; pos == -1; --i)
				for (int j = 0; j < width; ++j)
					if (field[i][q + j] || i == -1)
					{
						pos = i + 1;
						break;
					}

			if (d == 1)
				for (int i = 0; i < p; ++i)
					field[pos][q + i] = true;
			else
				for (int i = 0; i < p; ++i)
					field[pos + i][q] = true;

			while (true)
			{
				bool vanished = false;
				for (int i = 0; i < 5000; ++i)
				{
					int j;
					for (j = 0; j < 5 && field[i][j]; ++j)
						;
					if (j == 5)
					{
						for (j = 0; j < 5; ++j)
							field[i][j] = false;
						vanished |= true;
					}
				}
				if (!vanished)
					break;

				int diff = 0;
				for (int i = 0; i < 5000; ++i)
				{
					int j;
					for (j = 0; j < 5 && !field[i][j]; ++j)
						;
					if (j == 5)
						++diff;
					else if (diff)
						for (int j = 0; j < 5; ++j)
						{
							field[i - diff][j] = field[i][j];
							field[i][j] = false;
						}
				}
			}
		}
		int ans = 0;
		for (int i = 0; i < 5000; ++i)
			for (int j = 0; j < 5; ++j)
				if (field[i][j])
					++ans;
		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 0
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

fn main() {
    input! {
        A: i64,
        B: i64,
        C: i64,
        X: i64 ,
        Y: i64,
    }

    let mut ans = std::i64::MAX;
    for ab in 0..=max(X, Y) * 2 {
        let x = max(X - ab / 2, 0);
        let y = max(Y - ab / 2, 0);

        let cand = A * x + B * y + C * ab;
        ans = min(ans, cand);
    }

    println!("{}", ans);
}


Measured memory_bytes: 2112
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	while (true){
		if (n/100 == n%100/10 && n%100/10 == n%10) break;
		n++;
	}
	cout << n << endl;
	return 0;
	
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        switch (s) {
            case "a":
                System.out.println("b");
                break;
            case "b":
                System.out.println("c");
                break;
            case "c":
                System.out.println("d");
                break;
            case "d":
                System.out.println("e");
                break;
            case "e":
                System.out.println("f");
                break;
            case "f":
                System.out.println("g");
                break;
            case "g":
                System.out.println("h");
                break;
            case "h":
                System.out.println("i");
                break;
            case "i":
                System.out.println("j");
                break;
            case "j":
                System.out.println("k");
                break;
            case "k":
                System.out.println("l");
                break;
            case "l":
                System.out.println("m");
                break;
            case "m":
                System.out.println("n");
                break;
            case "n":
                System.out.println("o");
                break;
            case "o":
                System.out.println("p");
                break;
            case "p":
                System.out.println("q");
                break;
            case "q":
                System.out.println("r");
                break;
            case "r":
                System.out.println("s");
                break;
            case "s":
                System.out.println("t");
                break;
            case "t":
                System.out.println("u");
                break;
            case "u":
                System.out.println("v");
                break;
            case "v":
                System.out.println("w");
                break;
            case "w":
                System.out.println("x");
                break;
            case "x":
                System.out.println("y");
                break;
            case "y":
                System.out.println("z");
                break;
            case "z":
                System.out.println("a");
                break;
        }
    }
}

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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max({a * c, a * d, b * c, b * d});
  return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long k,n,m;
	cin>>n>>m>>k;
	vector<long long> v1(n+2,0);
	vector<long long> v2(m+2,0);
	for(int i=1;i<=n;i++){
	    cin>>v1[i];
	    v1[i]+=v1[i-1];
	}
	for(int i=1;i<=m;i++){
	    cin>>v2[i];
	    v2[i]+=v2[i-1];
	}
	int j=m,val=0;
	for(int i=0;i<=n;i++){
	    if(v1[i]>k) break;
	    while(v2[j]>(k-v1[i]))  j--;
	    val=max(val,(i+j));
	}
	cout<<val<<endl;
	return 0;
}

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

using namespace std;

int n;
int gem[51];

int solve(int index) {
    if (index++ > n) {
        return 0;
    }

    return max(solve(index) + gem[index], solve(index));
}

int main() {

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

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

    int ret = solve(0);
    cout << ret << endl;

    return 0;
}


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

const int MaxN = 100000 + 5;
const int MaxD = 50 + 5;

typedef long long llt;

int N; llt K;
llt A[MaxN];
llt dp[MaxD][2];
bool vis[MaxD][2];

void init() {
  scanf("%d %lld", &N, &K);
  for (int i = 1; i <= N; ++i)
    scanf("%lld", &A[i]);
}

llt dfs(int x, bool lim) {
  if (x < 0) return 0;
  if (vis[x][lim] == true) return dp[x][lim];
  vis[x][lim] = true;
  int cnt1 = 0;
  for (int i = 1; i <= N; ++i)
    if (A[i] & (1ll << x)) cnt1++;

  if (lim == false)
    dp[x][lim] = dfs(x - 1, false) + (1ll << x) * max(cnt1, N - cnt1);
  else
    if (K & (1ll << x)) dp[x][lim] = max(dfs(x - 1, true) + (1ll << x) * (N - cnt1), dfs(x - 1, false) + (1ll << x) * cnt1);
    else dp[x][lim] = dfs(x - 1, true) + (1ll << x) * cnt1;
  return dp[x][lim];
}

void solve() {
  cout << dfs(50, true) << endl;
}

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

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include <vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define vsort(v) sort(v.begin(), v.end())
#define rv(v) reverse(v.begin(), v.end())
#define ll long long
using vll = vector<ll>;
const ll MOD = 1e9 + 7;

int main() {
	int n, m;
	cin >> n >> m;
	priority_queue<ll> pq;
	rep(i, n) {
		ll t;
		cin >> t;
		pq.push(t);
	}
	rep(i, m) {
		ll k;
		k = pq.top(); pq.pop();
		pq.push(k / 2);
	}
	ll ans = 0;
	while (!pq.empty()) {
		ans += pq.top();
		pq.pop();
	}
	cout << ans << endl;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int c=0;
    for(int i=0;i<s.size();i++)
    {
            if(s[i]!=t[i])
            {
                c++;
            }
    }
    cout<<c;
}


Measured memory_bytes: 3860
import sys
import itertools
input = sys.stdin.readline


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def f(A):
    N = len(A)
    D = {}

    for a in A:
        D[a] = D.setdefault(a, 0) + 1
    
    return sum([v * (v - 1) // 2 for v in D.values()])


def main():
    A = input().strip()

    c = f(A)

    N = len(A)
    print(N * (N - 1) // 2 - c + 1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3500
import java.util.Scanner;
//import java.io.*;
//import java.util.Arrays;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		//String text = scan.next();
		Main mySystem = new Main();
		int n = scan.nextInt();
		int det[][][] = new int[n][8][8];
		int x[] = new int[n];
		int y[] = new int[n];
		for(int i = 0 ; i < n ; i++){
			for(int j = 0 ; j < 8 ; j++){
				String in = scan.next();
				char[] ounT = in.toCharArray();
				for(int k = 0 ; k < 8 ; k++){
					det[i][k][j] = Integer.parseInt(""+ounT[k]);
				}
			}
			x[i] = scan.nextInt();
			y[i] = scan.nextInt();
		}
		for(int i = 0 ; i < n ; i++){
			mySystem.bakuhatu(det , x[i]-1 , y [i]-1 , i);
		}
		for(int i = 0 ; i < n ; i++){
			System.out.println("Data " + (i+1) +":");
			for(int j = 0 ; j < 8 ; j++){
				for(int k = 0 ; k < 8 ; k++){
					System.out.print(det[i][k][j]);
				}
				System.out.println();
			}
		}
	}
	public void bakuhatu(int[][][] det , int x , int y , int n){
		int hantei = 0;
		if(det[n][x][y] == 1){
			det[n][x][y] = 0;
			for(int i = 1 ; i <= 3 ; i++){
				if(x+i < 8){
					kensaku(det , x+i , y , n);
				}else{
					break;
				}
			}
			for(int i = 1 ; i <= 3 ; i++){
				if(y+i < 8){
					kensaku(det , x , y+i , n);
				}else{
					break;
				}
			}
			for(int i = 1 ; i <= 3 ; i++){
				if(x-i >= 0){
					kensaku(det , x-i , y , n);
				}
			}
			for(int i = 1 ; i <=3 ; i++){
				if(y-i >= 0){
					kensaku(det , x , y-i , n);
				}
				hantei = 1;
			}
		}else{
			if(hantei == 1){
				System.out.println("Data " + (n+1) +":");
				for(int j = 0 ; j < 8 ; j++){
					for(int k = 0 ; k < 8 ; k++){
						System.out.print(det[n][k][j]);
					}
					System.out.println();
				}
			}
		}
	}
	public int[][][] kensaku(int[][][] det , int x , int y , int n){                                                                                                                                                                                                         
		if(det[n][x][y] == 1){
			det[n][x][y] = 0;
			for(int i = 1 ; i <= 3 ; i++){
				if(x+i < 8){
					bakuhatu(det , x+i , y , n);
				}else{
					break;
				}
			}
			for(int i = 1 ; i <= 3 ; i++){
				if(y+i < 8){
					bakuhatu(det , x , y+i , n);
				}else{
					break;
				}
			}
			for(int i = 1 ; i <= 3 ; i++){
				if(x-i >= 0){
					bakuhatu(det , x-i , y , n);
				}
			}
			for(int i = 1 ; i <=3 ; i++){
				if(y-i >= 0){
					bakuhatu(det , x , y-i , n);
				}
			}
		}
		return det;
	}
}

Measured memory_bytes: 26660
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n,m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;
  return 0;
}

Measured memory_bytes: 256