akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin>>n;
  int n2 = pow(2,n);
  vector<int> s(n2), created;
  REP(i,n2){
	cin>>s[i];
  }
  sort(ALL(s));
  created.push_back(s.back());
  s.pop_back();
  REP(i,n){
    REP(j,pow(2,i)){
//      int a = s.back();
//      s.pop_back();
      auto itr = lower_bound(ALL(s),created[j]);
//      cout << created[j] << " " << a << endl;
      if(itr==s.begin()){
        cout << "No" << endl;
        return 0;
      }else{
        itr--;
        created.push_back(*itr);
        s.erase(itr);
      }
    }
//    cout << endl;
  }
  if(created.size()==n2&&s.size()==0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 2424
import sys
input = sys.stdin.readline

a,b,c = map(int,input().split())
k = int(input())

while a >= b:
    b *= 2
    k -= 1

if k < 0:
    print("No")
else:
    for i in range(k):
        c *= 2
    if b < c:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 61820
#include <stdio.h>
#include <iostream>
#include <vector>

int pvec(std::vector<int> vec) {
  std::cout << vec.at(0);
  for (int i =1; i< vec.size();i++){
    std::cout << " " << vec.at(i) ;
  }
  std::cout << std::endl;
}

int main(){
  int N ;
  std::cin >> N;

  std::vector<int> vec(N);
  for (int i=0; i < N ; i++) {
    std::cin >> vec.at(i);
  }


  pvec(vec);
  /* insertion sort */
  int v ;
  int j ;
  for (int i=1; i < vec.size() ; i++) {
    v = vec.at(i);
    j = i -1;
    while( j >=0 and vec.at(j) > v ) {
      vec.at(j+1) = vec.at(j);
      j--;
    }
    vec.at(j+1) = v;
    pvec(vec);
  }

}


Measured memory_bytes: 3164
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
double solve(int a, int b, int h, int m){
	return sqrt((double)a*a+b*b-2*a*b*cos((double)(30*h-(double)11*m/2)*M_PI/180));
}
int main(){
	int A, B, H, M;
  	cin >> A >> B >> H >> M;
	printf("%0.20lf", solve(A,B,H,M));
	return 0; 
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

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

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll h;
    cin>>h;
    ll ans=1;
    // for(ll i=0; h>=1; i++) {
    //     ans += h;
    //     h=h/2;
    //     dbg(h);
    // }
    ll cnt=0;
    for(ll i=0; h>=1; i++) {
        h=h/2;
        cnt++;
    }
    for(ll i=0; i<cnt; i++) {
        ans = ans*2;
    }
    cout<<ans-1<<endl;
    return  0;
}


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

int main() {

  string N;

  cin >> N;

  int A, B, C, D;

  A = N.at(0);
  B = N.at(1);
  C = N.at(2);
  D = N.at(3);


  if (( A == B ) && ( B == C ))  cout << "Yes" << endl;
   else if (( B == C ) && ( C == D ))  cout << "Yes" << endl;
   else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, n) for (int i = (n)-1; i >= 0; i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase(unique(ALL(v)), v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 2e18;
const double PI = acos(-1);

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, H, W;
	cin >> N >> H >> W;
	int ans = 0;
	REP(i, N)
	{
		int A, B;
		cin >> A >> B;
		if (H <= A && W <= B)
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
p = sorted(p,reverse=True)
q = list(map(int,input().split()))
q = sorted(q,reverse=True)
r = list(map(int,input().split()))
r = sorted(r)
c_ori = c
while c >= 1 and ((x >= 1 and p[x-1] < r[c-1]) or (y >= 1 and q[y-1] < r[c-1])):
    if x >= 1 and y >= 1 and p[x-1] < q[y-1]:
        x = x-1
        c = c-1
    elif x >= 1 and y >= 1 and p[x-1] >= q[y-1]:
        y = y-1
        c = c-1
    elif y == 0:
        x = x-1
        c = c-1
    else:
        y = y-1
        c = c-1
               
sum = 0
if x >= 1:
    for i in range(x):
        sum += p[i]
#print(sum)
if y >= 1:
    for i in range(y):
        sum += q[i]
#print(sum)
if c_ori > c:
    for i in range(c,c_ori):
        sum += r[i]
print(sum)

Measured memory_bytes: 106980
/*
Submitted With (^^) by -> Hossam ^_^
_____________________
|     ___     ___     |
|    (^_^)   (^_^)    |
|   /( | )\_/( | )\   |
|_____|_|_____|_|_____|
*/

#include <bits/stdc++.h>

using namespace std;

inline void prep()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
};

#define X first
#define Y second
#define ll long long
#define inf (0x7fffffffffffffff)
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << (x) << " ";
#define ZXC cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl;

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 20;

int main()
{
    prep();

    int n, k;
    cin >> n >> k;

    if(k == n) return puts("1"), 0; 

    int a[n];
    int idx = -1;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        if(a[i] == 1) idx = i;
    }

    k--;

    int cnt = (n - 1 + k - 1) / k;
  
    cout << cnt << endl;

    // ZXC
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	while (true) {
		int n, m; cin >> n >> m;
		if (n == 0 && m == 0) return 0;
		int ans = 0;
		vector<int> a(n); for (int i = 0; i < n; i++)cin >> a[i];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (i == j) continue;
				else { 
					if (a[i] + a[j] <= m) ans = max(ans, a[i] + a[j]);
				}
			}
		}
		if (ans == 0) cout << "NONE" << endl;
		else cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3140
#include<stdio.h>
int main(){
    int N;
    scanf("%d",&N);
    int V[N];
    int C[N];
    int sum=0;

    for(int i=0;i<N;i++){
        scanf("%d",&V[i]);

    }
    for(int m=0;m<N;m++){
        scanf("%d",&C[m]);
        if((V[m]-C[m])>0){
            sum+=V[m]-C[m];
        }
    }
    printf("%d\n",sum);
}


Measured memory_bytes: 128
#include<stdio.h>

int num;

int main(void)
{
    int j;
    int min=100;

    scanf("%d", &num);

    for(j=0;j<num;j++) {
        int a;
        scanf("%d", &a);
        int iCnt=0;
        while(0 == a%2) {
            a /= 2;
            iCnt++;
        }
        if(min>iCnt) {
            min = iCnt;
        }
    }

    printf("%d\n", min);
    return 0;
}

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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define int ll
#define tcase int t; cin>> t; for( ; t; --t)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;

int n;

int32_t main(){
	fastio;
	cin>> n;
	vi a(n);
	vi b(n);
	vi c(n, 0);
	for(int i = 0; i<n; ++i) cin>> a[i];
	for(int i = 0; i<n; ++i) cin>> b[i];
	for(int i = 0; i<n-1; ++i) cin>> c[i];
	int res = 0;
	for(int i =0 ; i<n; ++i){
		res += b[a[i]-1];
		if(i>0 && a[i] - a[i-1] == 1)
			res += c[a[i]-2];
	}
	cout<< res<< endl;
	return 0;
}


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

namespace ABC149
{
    class Program
    {
        static void Main(string[] args)
        {
            c();
        }

        public static void a()
        {
            string[] st = Console.ReadLine().Split(' ');
            string ans = "";
            ans += st[1];
            ans += st[0];
            Console.WriteLine(ans);
        }

        public static void b()
        {
            long[] abk = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
            long a = abk[0], b = abk[1], k = abk[2];
            long a1 = a;
            a -= k;
            if(a < 0)
            { a = 0; }
            k -= a1;
            if(k < 0)
            { k = 0; }
            b -= k;
            if(b < 0)
            { b = 0; }
            Console.WriteLine("{0} {1}", a, b);
        }

        public static void c()
        {
            long x = long.Parse(Console.ReadLine());
            if(x == 2)
            {
                Console.WriteLine(2);
                return;
            }
            for (long j = 3; j <= x; j += 2 )
            {
                if (x == j)
                {
                    Console.WriteLine(j);
                    break;
                }
                else if (x % j == 0)
                {
                    //Console.WriteLine("{0} {1}",j, x % j);
                    x++;
                    j = 3;
                }
                else if(x == j)
                {
                    Console.WriteLine(j);
                    break;
                }
            }
        }
    }
}


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

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

using namespace std;
using lint=long long;

const double EPS=1e-3;

int main(){
	int n;
	lint L,T; scanf("%d%lld%lld",&n,&L,&T);
	vector<int> x(n),dir(n);
	rep(i,n) scanf("%d%d",&x[i],&dir[i]);

	lint cnt=0;
	rep(i,n) if(dir[0]!=dir[i]) {
		lint d;
		if(dir[0]==1) d=x[i]-x[0];
		else          d=L-(x[i]-x[0]);

		if(2*(T-0.1)>d){
			cnt+=1+(2*(T-0.1)-d)/L;
		}
	}

	vector<double> pos(n);
	rep(i,n){
		if(dir[i]==1){
			pos[i]=(x[i]+T)%L;
			pos[i]-=0.1;
			if(pos[i]<0) pos[i]+=L;
		}
		else{
			pos[i]=(x[i]-T%L+L)%L;
			pos[i]+=0.1;
		}
	}
	double goal=pos[0];
	sort(pos.begin(),pos.end());
	int i_goal;
	rep(i,n) if(abs(pos[i]-goal)<EPS) i_goal=i;

	int idx;
	if(dir[0]==1){
		idx=cnt%n;
	}
	else{
		idx=(-cnt)%n;
		if(idx<0) idx+=n;
	}

	vector<double> ans(n);
	ans[idx]=goal;
	rep(i,n){
		ans[idx]=pos[i_goal];
		idx=(idx+1)%n;
		i_goal=(i_goal+1)%n;
	}

	rep(i,n) printf("%.0f\n",ans[i]);

	return 0;
}


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

#define ll              long long int
#define ull             unsigned long long int
#define pii             pair < int, int>
#define pll             pair < ll, ll>
#define sc              scanf
#define scin(x)         sc("%d",&(x))
#define scln(x)         sc("%lld",&(x))
#define pf              printf
#define NL              pf("\n")
#define ms(a,b)         memset(a,b,sizeof(a))
#define pb(a)           push_back(a)
#define mp              make_pair
#define db              double
#define EPS             10E-10
#define ff              first
#define ss              second
#define sqr(x)          (x)*(x)
#define vi              vector< int >
#define vl              vector< ll >
#define vii             vector<vector< int > >
#define vll             vector<vector< ll > >
#define DBG             pf("HI\n")
#define MOD             1000000007
#define CIN             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define RUN_CASE(t,T)   for(__typeof(t) t=1;t<=T;t++)
#define CASE(t)         printf("Case %d: ",t)
#define CASEL(t)        printf("Case %d:\n",t)
#define intlimit        2147483648
#define longlimit       9223372036854775808
#define infinity        (1<<28)
#define gcd(a, b)       __gcd(a,b)
#define lcm(a, b)       (((a)/gcd(a,b))*b)
#define mx              1234567899
#define TC              int t;scin(t);while(t--)
#define PI              2*acos(0.0)
#define rep(i,a,b)      for( i=a; i<=b; i++)
#define rev(i,a,b)      for( i=a; i>=b; i--)
#define file            freopen("E:\\file.txt", "r", stdin);ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x)          x.begin(),x.end()
#define DEBUG(args...)    do {   cerr << #args << ' ' ;  print(args); } while(0); cerr<< endl ;
using namespace std;
int get(int n,int p){int res = 0;while(n>=p) res+=n/p,n/=p;return res;}
template<class T> T power(T N,T P){ return (P==0)?  1: N*power(N,P-1); }
void VC(vector<ll> &v){for(int i=0;i<v.size();i++) printf("%lld ", v[i]);printf("\n");}

template< typename T > void print(const T& v) {    cerr << v << ' ' ;}
template< typename T1, typename... T2 >
void print( const T1& first, const T2&... rest ){
    print(first);
    print(rest...) ;
}
///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

long long BigMod(long long int a, long long int b, int M) { long long remainder, answer = 1;remainder = a%M; while(b!=0){if(b%2==1) answer = (answer*remainder)%M;remainder = (remainder*remainder)%M;b/=2;}return answer;}
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int a,b, cnt = 1, ans =0;
    cin >> a >> b;
    while(cnt<b)
    {
        cnt--;
        cnt+=a;
        ans++;
    }cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin>>s;
int n = s.size();
int ans=0;
int l=0;
int i=0;
while(i<n)
{
if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')
{
l++;
}
else
{
l=0;
}
if(l>ans)
{ans=l;
}
i++;
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#include<math.h>
#include<string.h>
int main()
{
    ll a,b,c,d,test,i,j,k,l,m,o,p;
    cin>>a>>b;
    d=a;
    j=b;
    for( ;b>0;)
    {
        c=a%b;
        a=b;
        b=c;
    }
    m=(d*j)/a;
    cout<<m<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int a, b, c, d, e, k;
  scanf("%d",&a); 
  scanf("%d",&b); 
  scanf("%d",&c); 
  scanf("%d",&d); 
  scanf("%d",&e); 
  scanf("%d",&k);
  if(e - a <= k) printf("Yay!");
  else printf(":(");
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
N = gets.to_i
D = gets.chomp.split(" ").map(&:to_i)
MOD = 998244353

C = Array.new(N, 0)
D.each{|i|
  C[i] += 1
}
ans, cnt = [1, 0]
C.each_with_index{|c, i|
  (ans = 0; break) if i == 0 && (c != 1 || D[0] != 0)
  cnt += c
  next if c == 1 && i == 0
  break if c == 0
  ans = (ans * C[i-1]**C[i]) % MOD
}

puts cnt == N ? ans : 0


Measured memory_bytes: 9996
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

ll mod_inv(ll x, ll mod) {
	return mod_pow(x, mod - 2, mod);
}

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

	ll n, m;
	cin >> n >> m;

	ll a = 0;
	ll b = 0;
	Array flag(n + 1,true);
	Array con(n + 1, 0);

	REP(i, m) {
		ll p;
		string s;
		cin >> p >> s;
		if (flag[p]) {
			if (s == "AC") {
				flag[p] = false;
				a++;
				b += con[p];
			}
			else {
				con[p]++;
			}
		}
	}

	cout << a << " " << b << endl;

	return 0;
}

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

int main(){
  int A,B; cin >>A >>B;
  if (A<=8 and B<=8) cout <<"Yay!" <<endl;
  else cout <<":(" <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define  vi vector<int>
#define pb push_back
//#define int long long
#define boost ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0)
#define pi pair<int,int>
#define F first
#define S second
using namespace std;
 
//int mod=(int)(1e9+7);
 
void solve()
{   
	int n;
	cin>>n;
	vi v;
	ll int sum = 0;
	unordered_map<ll int, ll int> m;
	for(int i=0; i<n; i++)
	{
		ll int a;
		cin>>a;
		if(m.find(a) != m.end())
		{
			m[a]++;
		}
		else m[a] = 1;
		sum += a;
		v.push_back(a);
	}
	ll int Q;
	cin>>Q;
	for(ll int i=0; i<Q; i++)
	{
		ll int b,c;
		cin>>b>>c;
		if(m.find(b) != m.end())
		{
			int f = m[b];
			m.erase(b);
			sum = sum -f*b + f*c;
			if(m.find(c) != m.end())
			{
				m[c] += f;
			}
			else m[c] = f;
		}
		cout<<sum<<endl;
	}
}
 
int main()
{ boost;
 //cout<<fixed<<setprecision(14 );
  // int t;cin>>t;
  // for(int i=1;i<=t;i++)
  solve();
 // cout<<"Case #"<<i<<": "<<solve()<<endl;
 
return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;

    set<int> st;
    int x = 1;

    if(n <= 5){
        st = {2, 5, 63};
        if(n >= 4) st.insert(20);
        if(n == 5) st.insert(30);
    }

    while(st.size() < n){
        int r = x % 6;
        if(r == 0 || r == 2 || r == 3 || r == 4){
            st.insert(x);
        }
        x++;
    }

    int sum = SUM(st);
    switch(sum%6){
        case 2:
            st.erase(8);
            while(x%6 != 0) x++;
            st.insert(x);
            break;
        case 3:
            st.erase(9);
            while(x%6 != 0) x++;
            st.insert(x);
            break;
        case 5:
            st.erase(9);
            while(x%6 != 4) x++;
            st.insert(x);
    }

    for(auto i : st){
        cout << i << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1280
n = int(input())
s = []
for i in range(n):
    s.append(input())
ans = 0
r = 0
l = 0
a = 0
b = 0
c = 0
for i in range(n):
    ans += s[i].count('AB')
    list = s[i]
    if list[-1] == 'A' and list[0] == 'B':
        r += 1
        l += 1
        c += 1
    elif list[-1] == 'A': # and list[0] != 'B':
        r += 1
        a += 1
    elif list[0] == 'B': # and list[-1] != 'A':
        l += 1
        b += 1
    # print(ans, last, start)
ans += min(r, l)
if a == 0 and b == 0 and c > 0:
    ans -= 1
print(ans)

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define rep(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 int long long
#define FOR(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
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);
    
    string s,t; cin >> s >> t;
    bool flag = true;
    VI a(30,0),b(30,0);
    rep(i,s.size()){
        a[s[i] - 'a']++;
        b[t[i] - 'a']++;
    }
    SORT(a);
    SORT(b);
    rep(i,30) if(a[i] != b[i]) flag = false;
    if(flag) Yes;
    else No;

    return 0;
}



Measured memory_bytes: 916
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
 
ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
	}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	int n,y,sum;
	cin >> n >> y;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n-i;j++){
			sum=10000*i+5000*j+1000*(n-i-j);
			if(sum==y){
				cout << i << " " << j << " " <<  n-i-j << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;

int n , m ;
char s[ 505 ][ 505 ] ;

void init() {
  scanf( "%d%d" , &n , &m ) ;
  for ( int i = 0 ; i < n ; i ++ )
    scanf( "%s" , s[ i ] ) ;
}

char v[ 505 ][ 505 ] , w[ 505 ][ 505 ] ;

void process() {
  for ( int i = 0 ; i < n ; i ++ ) {
    for ( int j = 0 ; j < m ; j ++ ) {
      v[ i ][ j ] = w[ i ][ j ] = '.' ;
      if ( s[ i ][ j ] == '#' ) {
        v[ i ][ j ] = w[ i ][ j ] = '#' ;
      }
    }
  }
  for ( int i = 1 ; i < n - 1 ; i ++ ) {
    if ( i % 2 == 0 ) {
      for ( int j = 1 ; j < m - 1 ; j ++ )
        v[ i ][ j ] = '#' ;
    } else {
      for ( int j = 1 ; j < m - 1 ; j ++ )
        w[ i ][ j ] = '#' ;
    }
  }
  for ( int i = 0 ; i < n ; i ++ ) v[ i ][ 0 ] = '#' ;
  for ( int i = 0 ; i < n ; i ++ ) w[ i ][ m - 1 ] = '#' ;

  for ( int i = 0 ; i < n ; i ++ ) {
    for ( int j = 0 ; j < m ; j ++ ) {
      printf( "%c" , v[ i ][ j ] ) ;
    }
    puts( "" ) ;
  }
  puts( "" ) ;
  for ( int i = 0 ; i < n ; i ++ ) {
    for ( int j = 0 ; j < m ; j ++ ) {
      printf( "%c" , w[ i ][ j ] ) ;
    }
    puts( "" ) ;
  }
}

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


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

using namespace std;

int main()
{
    string s;
    cin >> s;
    int d = 0;
    if (s == "SAT")
        d = 1;
    else if (s == "FRI")
        d = 2;
    else if (s == "THU")
        d = 3;
    else if (s == "WED")
        d = 4;
    else if (s == "TUE")
        d = 5;
    else if (s == "MON")
        d = 6;
    else if (s == "SUN")
        d = 7;
    cout << d << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define chmin(a, b) a=min(a, b)
#define chmax(a, b) a=max(a, b)
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n, m; cin>>n>>m;
    for(int i=m/n; ; i--){
        if(m%i==0){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
import sys,math
n=int(input())
a=list(map(int,input().split()))
numbers={}
flag=0
for i in range(n):
  if a[i] in numbers:
    numbers[a[i]]+=1
  else:
    numbers[a[i]]=1
pointer=2
while pointer<10**6+1:
  count=0
  pointer2=pointer
  while pointer2<10**6+1:
    if pointer2 in numbers:
      count+=numbers[pointer2]
    pointer2+=pointer
  if count>=2:
    flag=1
    break
  pointer+=1
if flag==0:
  print('pairwise coprime')
  sys.exit()
ans=a[0]
for i in range(1,n):
  ans=math.gcd(a[i],ans)
if ans==1:
  print('setwise coprime')
else:
  print('not coprime')

Measured memory_bytes: 241732
#include <stdio.h>

int main(void){
  int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  int aa,bb;
  aa=(int)((float)a/0.08+0.9999);
  bb=(int)((float)b/0.1+0.9999);
  int m;
  if(aa>bb){
    m=aa;
  }else{
    m=bb;
  }
  if(((int)((float)m*0.08)==a) & ((int)((float)m*0.1)==b)){
    printf("%d",m);
  }else{
    printf("%d",-1);
  }
  return 0;
}

Measured memory_bytes: 1732
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]
A.insert(0,[0,0,0])
ind = 0
for i in range(1,N+1):
    t2,x2,y2 = A[i][0],A[i][1],A[i][2]
    t1,x1,y1 = A[i-1][0],A[i-1][1],A[i-1][2]
    d = dist((x2,y2),(x1,y1))
    if not(t2-t1>=d and (t2-t1-d)%2==0):
        ind = 1
        break
if ind==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 27324
#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <functional>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, n, m, h, w, a, b, sum = 0, ans = 0;
  scanf("%lld%lld", &n, &m);
  ll x[n];
  pair< ll, pair<ll, ll> > e[m];
  for(i = 0; i < n; ++i) scanf("%lld", &x[i]), sum += x[i];
  for(i = 0; i < m; ++i) {
    scanf("%lld%lld%lld", &e[i].second.first, &e[i].second.second, &e[i].first);
    e[i].second.first--, e[i].second.second--;
    if(e[i].first > sum) ++ans;
  }
  sort(e, e + m);
  if(!ans) {
    printf("0");
    return 0;
  }
  ans = 0;
  ll uf[n], now[n];
  ll num[n];
  for(i = 0; i < n; ++i) uf[i] = i, now[i] = x[i], num[i] = 0;
  for(i = 0; e[i].first <= sum; ++i) {
    ll ra = 0, rb = 0, na = e[i].second.first, nb = e[i].second.second, tmpa, tmpb;
    while(uf[na] != na) ra++, na = uf[na];
    while(uf[nb] != nb) rb++, nb = uf[nb];
    if(na != nb) {
      if(ra < rb) {
        uf[na] = nb, now[nb] += now[na], now[na] = 0;
        tmpa = now[nb], tmpb = nb;
        num[nb] += num[na], num[na] = 0;
      } else {
        uf[nb] = na, now[na] += now[nb], now[nb] = 0;
        tmpa = now[na], tmpb = na;
        num[na] += num[nb], num[nb] = 0;
      }
    } else tmpa = now[na], tmpb = na;
    if(tmpa >= e[i].first) ans += num[tmpb] + 1, num[tmpb] = 0;
    else num[tmpb]++;
  }
  printf("%lld", m - ans);
  return 0;
}

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

int answer = 0;
int N;
vector<vector<int>> edges;
void dfs(int currentNode, vector<bool> visited)
{
    visited.at(currentNode) = true;
    bool allVisited = true;
    for(bool ed : visited){
        if(!ed){
            allVisited = false;
            break;
        }
    }
    if(allVisited){
        answer++;
        return;
    }
    for(int nextNode: edges.at(currentNode))
    {
        if(visited.at(nextNode)){
            continue;
        }
        dfs(nextNode, visited);
    }
}

int main()
{
    int M;
    cin >> N >> M;
    edges = vector<vector<int>>(N);
    for(int i = 0; i < M ;i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edges.at(a).push_back(b);
        edges.at(b).push_back(a);
    }
    vector<bool> visited(N, false);
    dfs(0, visited);
    cout << answer << endl;
    return 0;
}

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

class Union{
public:
	Union():id(++n), group(this){};
	Union* get_u(){
		if (group == this){
			return group;
		}else{
			return (group = (group->get_u()));
		}
	}
	int get_id(){
		return id;
	}
	void set_u(Union &other){
		group = other.get_u();
	}
	void join(Union &other){
		get_u()->set_u(other);
	}
	bool question(Union &other){
		return get_u() == other.get_u();
	}
private:
	int id;
	Union* group;
	static int n;
};
int Union::n{-1};
int main(){
	int n, m;
	std::cin >> n >> m;
	std::vector<Union> vec(n);
	int a, b;
	for (auto i = 0; i < m; ++i){
		std::cin >> a >> b;
		vec.at(a).join(vec.at(b));
	}
	int q;
	std::cin >> q;
	for (auto i = 0; i < q; ++i){
		std::cin >> a >> b;
		if (vec.at(a).question(vec.at(b))){
			std::cout << "yes\n";
		}else{
			std::cout << "no\n";
		}
	}
}

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

int main(){
  int d[100]={0};
	string s;
	cin >> s;
	rep (i, s.size()){
		char a=s[i];
		d[a-'a']++;
	}
	rep (i, 26){
		if ( d[i]==0 ){
		cout << char (i+'a') << endl;
		return 0;
		}
	}
	cout << "None" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
    int n; cin >> n;
    vector<int> a(n);
    for(auto &i : a) {
        cin >> i;
    }

    vector<int> ans;
    int target = 1;
    for(int i = 0; i < n; i++) {
        if(a[i] == target) {
            ans.push_back(a[i]);
            target++;
        }
    }

    if((int)ans.size() == 0) cout << "-1";
    else cout << n-ans.size();
    return 0;
}

Measured memory_bytes: 2168
#include <stdio.h>
#define N 10000
#define Q 500

int main()
{
  int n,s[N],q,t[Q],i,j;
  int cnt=0;

  scanf("%d",&n);
  for(i=0 ; i<n ; i++)
    {
      scanf("%d",&s[i]);
    }

  scanf("%d",&q);
  for(i=0 ; i<q ; i++)
    {
      scanf("%d",&t[i]);
    }

  for(j=0 ; j<q ; j++)
    {
      i=0;
      s[n] = t[j];
      while(s[i] != t[j])
	{
	  i++;
	}
      if(i!=n) cnt++;
    }
    

  printf("%d\n",cnt);
  
  return 0;
}



Measured memory_bytes: 2104
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define reads(s) string s; cin >> s;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define setprec cout << fixed << showpoint << setprecision(20);
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	read(a);
	cout << a+a*a+a*a*a;
}



















Measured memory_bytes: 3652
#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 ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;
const bool debug = 1;
//----------------------//

int N;
int a[112345];

int main() {
	cin >> N;
	REP(i, N) scanf("%d", a + i);
	
	int x = 0;
	REP(i, N) x ^= a[i];
	
	int cnt[32] = {};
	REP(i, N) {
		FOR(j, 1, 32) {
			if ((a[i] >> j & 1) && (a[i] & ((1ll<<j)-1)) == 0) cnt[j]++;
		}
		if (a[i] & 1) cnt[0]++;
	}
	
	int ans = 0;
	for (int i = 31; i >= 0; i--) if (x >> i & 1) {
		if (cnt[i] == 0) { ans = -1; break; }
		x ^= (1ll<<(i+1))-1;
		ans++;;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 640
import math
def average(dat):
    ans = 0
    for i in range(len(dat)):
        ans += dat[i]
    return ans/len(dat)
N = int(input())
A = list(map(int,input().split()))
K = average(A)
if K%1 == 0:
    B = int(K)
    ans_2 = 0
    for i in range(N):
        ans_2 += (A[i]-B)**2
    print(ans_2)
else:
    B = math.ceil(K)
    C = math.floor(K)
    ans_2 = 0
    ans_3 = 0
    for i in range(N):
        ans_2 += (A[i]-B)**2
        ans_3 += (A[i]-C)**2
    print(min(ans_2,ans_3))

Measured memory_bytes: 3064
from collections import deque
from bisect import bisect_left
N = int(input())
A = [int(input()) for _ in range(N)]
que = deque()
for i in range(N):
    k = bisect_left(que, A[i])
    if k == 0:
        que.appendleft(A[i])
    else:
        que[k - 1] = A[i]

print(len(que))

Measured memory_bytes: 14036
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    for(size_t i = 0; i < s.size(); i++){
        if(s == t){
            cout << "Yes" << '\n';
            return 0;
        }
        s = s.back() + s.substr(0, s.size() - 1);
    }
    cout << "No" << '\n';
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Problem {
    public static void Main() {
        var list = new Dictionary<char, int>();
        for (var c = 'a'; c <= 'z'; c++) list.Add(c, 0);
        var str = "";
        while ((str = Console.ReadLine()) != null) {
            foreach (var c in str)
                if (char.IsLetter(c))
                    list[char.IsUpper(c) ? char.ToLower(c) : c] += 1;
        }
        foreach (var p in list)
            Console.WriteLine(p.Key + " : " + p.Value);
    }
}


Measured memory_bytes: 9824
# coding: utf-8
# Your code here!

class Dice:
    def __init__(self,lst):
        self.face=lst
        self.order="NNNNWNNNWNNNENNNENNNWNNN"
    
    def roll(self,x):
        tmp=self.face
        if x=="E":
            self.face=[tmp[3],tmp[1],tmp[0],tmp[5],tmp[4],tmp[2]]
        if x=="W":
            self.face=[tmp[2],tmp[1],tmp[5],tmp[0],tmp[4],tmp[3]]
        if x=="N":
            self.face=[tmp[1],tmp[5],tmp[2],tmp[3],tmp[0],tmp[4]]
        if x=="S":
            self.face=[tmp[4],tmp[0],tmp[2],tmp[3],tmp[5],tmp[1]]
    
    def showDown(self):
        return self.face[0]
    
    def query(self,lst):
        tmp=self.face
        ans=-1
        for i in self.order:
            self.roll(i)
            if self.face[0]==lst[0] and self.face[1]==lst[1]:
                ans=self.face[2]
                break
        self.face=tmp
        return ans
    
    def isEqual(self,another):
        tmp=self.face
        ans=False
        for i in self.order:
            self.roll(i)
            flg=True
            for j in range(6):
                if self.face[j]!=another.face[j]:
                    flg=False
                    break
            if flg:
                return True

            
    
diceA=Dice(list(map(int,input().split(" "))))
diceB=Dice(list(map(int,input().split(" "))))
if diceA.isEqual(diceB):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5616
#include<stdio.h>
#include<string.h>

int main(void)

{
  int i;
  char str[101];
  for(i=0;i<100;i++)
    {
      str[i] = '0';
    }
  scanf("%s",&str);

  int alphabet[26];
  for(i=0;i<(sizeof(alphabet)/sizeof(alphabet[1]));i++)
    {
      alphabet[i] = 0;
    }

  char judger[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  for(i=0;i<101;i++)
    {
      int j;
      for(j=0;j<(sizeof(alphabet)/sizeof(alphabet[1]));j++)
        {
          if(str[i]==judger[j])
            {
              alphabet[j]++;
            }
          else
            {
            }
        }
    }
  /*
  for(i=0;i<26;i++)
    {
      printf("%c\n",str[i]);
    }
  */
  for(i=0;i<26;i++)
    {
      if(alphabet[i]%2 == 0)
        {
          if(i<25)
            {

            }
          else if(i == 25)
            {
              printf("Yes\n");
              break;
            }
          else
            {
              break;
            }
        }
      else
        {
          printf("No\n");
          break;
        }
    }
}

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

int main(void) {
	bool A = true;
	bool B = false;
	bool C = false;
	char cup1, cup2;
	
	while(scanf("%c,%c", &cup1, &cup2) != EOF) {
		switch(cup1) {
			case 'A' : {
				switch(cup2) {
					case 'B' : {
						if(A || B) {
							bool copy = A;
							A = B;
							B = copy;
						}
						break;
					}
					case 'C' : {
						if(A || C) {
							bool copy = A;
							A = C;
							C = copy;
						}
						break;
					}
				}
				break;
			}
			case 'B' : {
				switch(cup2) {
					case 'A' : {
						if(B || A) {
							bool copy = B;
							B = A;
							A = copy;
						}
						break;
					}
					case 'C' : {
						if(B || C) {
							bool copy = B;
							B = C;
							C = copy;
						}
						break;
					}
				}
				break;
			}
			case 'C' : {
				switch(cup2) {
					case 'A' : {
						if(C || A) {
							bool copy = C;
							C = A;
							A = copy;
						}
						break;
					}
					case 'B' : {
						if(C || B) {
							bool copy = C;
							C = B;
							B = copy;
						}
						break;
					}
				}
				break;
			}
		}
	}
	
	if(A)   cout << 'A' << endl;
	else if(B)   cout << 'B' << endl;
	else if(C)   cout << 'C' << endl;
	
	return 0;
}


Measured memory_bytes: 3168
import sys

# import bisect
# import numpy as np
# from collections import deque
from collections import deque
# map(int, sys.stdin.read().split())
# import heapq
import bisect


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    H = int(input())
    W = int(input())

    print((N - H + 1) * (N - W + 1))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9460
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int cnt = 0;
    int n;
    string s;
    cin >> n >> s;

    FOR(i, 1, n - 1)if(s[i] == 'E') cnt++;
    int ans = cnt;
    REP(i, n - 1) {
        if(s[i] == 'E' and s[i + 1] == 'E') cnt--;
        if(s[i] == 'W' and s[i + 1] == 'W') cnt++;
        ans = min(ans, cnt);
    }

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


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

const int maxn = 105;

int n,x;
int a[maxn];

int main(){
    scanf("%d%d",&n,&x);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++){
	if(a[i] <= x) x-=a[i],a[i]=0;
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
	if(a[i] == 0) ans ++;
    }
    if(x&&a[n] == 0) ans--;
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-10;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int calc(int a,int b){
	int ret=0;
	while(a){
		ret+=a%10;
		a/=10;
	}
	while(b){
		ret+=b%10;
		b/=10;
	}
	return ret;
}
int main(){
	int a;scanf("%d",&a);
	int ret=mod;
	for(int i=1;i<a;i++){
		int b=a-i;
		ret=min(ret,calc(i,b));
	}
	printf("%d\n",ret);
}


Measured memory_bytes: 128
#![allow(unused)]
use std::io::{self, Read};

fn get_stdin() -> String {
    let mut buf = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buf);
    return buf
}

struct Rectangle {
    height: i32,
    width: i32,
}

impl Rectangle {
    fn area(&self) -> i32 {
        self.height * self.width
    }

    fn perimeter(&self) -> i32 {
        2 * (self.height + self.width)
    }
}

fn main() {
    let input = get_stdin();
    let v: Vec<i32> = input
        .split_whitespace()
        .map(|s| s.parse::<i32>().unwrap())
        .collect();
    let rect = Rectangle {
        height: v[0],
        width : v[1],
    };
    println!("{} {}", rect.area(), rect.perimeter());
}



Measured memory_bytes: 5032
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

ll dp[12][10]={};

signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll k;cin>>k;
  rep(i,0,10)dp[1][i]=1;
  
  rep(i,2,11){
    rep(j,0,10){
      if(j)dp[i][j]+=dp[i-1][j-1];
      dp[i][j]+=dp[i-1][j];
      if(j<9)dp[i][j]+=dp[i-1][j+1];
    }
  }

  ll dig=1,tp=1,now=0;
  string ans="";
  while(now<k){
    if(now+dp[dig][tp]>=k){
      ans+=char(tp-0+'0');
      dig--;
      tp=max(tp-1,0ll);
      if(dig==0)break;
    }else{
      now+=dp[dig][tp];
      if(tp<9)tp++;
      else {
        dig++;
        tp=1;
      }
    }
  }
  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 256
n = int(input())
a=[]

b = list(map(int, input().split()))
for i in range(n):
    a+=[[i+1, b[i]] ]
    
    
import operator as op
a.sort(key = op.itemgetter(1))

x=""
for i in range(n):
    x+=str(a[i][0])
    if i!=n-1:
        x+=" "

print(x)

Measured memory_bytes: 22628