akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define uint unsigned int
#define lli long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()

#define forn(i, n)  for(int i=0;i<n;++i)
#define rforn(i,start) for(int i = start; i >= 0;--i)
#define forsn(i,start,end) for(int i=start;i<end;++i)
#define rforsn(i,start,end) for(int i=start;i>=end;--i)
#define debug(x) cout<<#x<<" = "<<x<<"\n";
const int CONST = 1e9 + 7;

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	#ifndef ONLINE_JUDGE
    //    freopen("input.txt", "r", stdin);
	//  freopen("output.txt","w",stdout);
	#endif
    
    int n;
    cin>>n;
    int tmp = n%10;
    if(n%10==3){
        cout<<"bon";
    }
    else if(tmp==0 || tmp==1||tmp==6||tmp==8){
        cout<<"pon";
    }
    else{
        cout<<"hon";
    }

	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#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 FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  int n;
  cin >> n;
  cout << n * n * n << endl;
  return 0;
}



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

int main(){
    string S;
    cin>>S;
    int ans=700;
    rep(i,3) {
        if (S.at(i)=='o') {
            ans+=100;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
nm = list(map(int, input().split()))
n = nm[0]
xf = 0
if n == 0:
  xf = 1
m = nm[1]
nl = [None for i in range(n)]
result = ""
zf = 0

for i in range(m):
  temp = list(map(int, input().split()))
  keta = temp[0]
  c = temp[1]
  if keta == 1 and c == 0 and n != 1:
    zf = 1
  elif nl[keta-1] == None:
    nl[keta-1] = c
  else:
    if nl[keta-1] != c:
      zf = 1
if zf == 1 or xf == 1:
  print("-1")
else:
  for i in range(len(nl)):
    if nl[i] == None:
      if i==0 and n != 1:
        nl[i]=1
      else:
        nl[i]=0
  nl = list(map(str, nl))
  length = 0
  while length != len(nl):
    result = result + nl[length]
    length += 1
  print(result)
  
  


Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <algorithm>
const int MaxN = 2500;
typedef long long LL;
using namespace std;

LL f[55][MaxN + 5];
int n, s;
int a[55];
int main() 
{
	while(~scanf("%d%d", &n, &s)) {
		for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
		memset(f, 0, sizeof(f));
		f[0][0] = 1;
		for (int i = 1; i <= n; i++) {
			for (int j = MaxN; j >= 0; j--) {
				for (int k = 1; k <= i; k++) {
					if(j >= a[i]) f[k][j] += f[k - 1][j - a[i]];
				}
			}
		}
		LL ans = 0;
		for (int i = 1; i <= MaxN; i++) {
			for (int j = 1; j <= n; j++) {
				if((i % j == 0) && (i / j == s)) {
					ans += f[j][i];
				}
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int d;
    cin>>d;
    if(d==25)
        cout<<"Christmas"<<endl;
    else if(d==24)
        cout<<"Christmas Eve"<<endl;
    else if(d==23)
        cout<<"Christmas Eve Eve"<<endl;
    else
        cout<<"Christmas Eve Eve Eve"<<endl;

}


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


#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
const int mod = 1e9+7;
void solve(){
   int n;
   cin >> n;
   int t[n];
   ll sum = 0;
   for(int i = 0 ;i  < n ; i++){
      cin>>t[i];
      sum += t[i];
   }
   int m;
   cin >> m;
   int a, b;
   for(int i =  0 ; i < m; i++){
      cin >> a >> b;
      ll temp = sum - t[a-1];
      temp += b;
      cout<<temp<<"\n";
   }
}


int main(){
   solve();
}

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

vector <int> in;
vector <vector <int> > perm;

void gen(vector <int> &in ,int index)
{
    if(index == in.size() - 1)
    {
        perm.push_back(in);
        return ;
    }

    for(int i = index ; i < (int) in.size() ; i++)
    {
        swap(in[i] , in[index]);
        gen(in , index + 1);
        swap(in[i] , in[index]);
    }
}


int main()
{

    int n ;
    cin >> n;
    vector <pair<int,int>> p(n);

    for(auto &pp : p)
        cin>>pp.first>>pp.second;

   
    in = vector <int>(n);

    for(int i = 0; i < n ;i++)
        in[i] = i;
    
    gen(in ,0);

    double ans = 0.0;



    for(auto per : perm)
    {
        double cur = 0.0;
        for(int i = 1; i < per.size() ; i++)
        {
            int a = per[i];
            int b = per[i-1];
            //cout << " coordinates : "<<p[a].first<<","<<p[a].second<<" and "<<p[b].first<<","<<p[b].second << endl;

            cur += sqrt((p[a].first - p[b].first)*(p[a].first - p[b].first) + (p[a].second - p[b].second)*(p[a].second - p[b].second));
        }

        ans += (cur);

    }

    

    ans = ans / ((int) perm.size());

    printf("%lf\n",ans);
  
  return 0;
}


Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i = 0;i < n;i++)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()

template<class T> bool chmax(T& a,T b){ if(a < b){ a = b; return true; }else return false; }
template<class T> bool chmin(T& a,T b){ if(a > b){ a = b; return true; }else return false; }
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
using vpi = vector<Pi>;
using vpl = vector<Pl>;
 
#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout << "[" << #a << "," << #b << "] = " << "[" << a << "," << b << "]" << '\n'
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
	cout << "{"; for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i]; cout << "}";
	return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
	cout << "{\n"; for (auto& vec : arr)cout << "  " << vec << ",\n"; cout << "}";
	return out;
}
template<class S,class T> ostream &operator << (ostream& out, const pair<S,T>& p){
  cout << "{" << p.first << "," << p.second << "}" << '\n';
  return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
	for (auto& i : arr)cin >> i; return in;
}

/////////////////////////////////////////////////////////////////////////
int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(20);
  
  ll n,x,m;cin >> n >> x >> m;
  map<ll,int> M;
  vl cy;
  ll sum = 0;
  ll cnt = 0;
  ll rp = 0;
  while(true){
    if(cnt == n){
      cout << sum << '\n';
      return 0;
    }
    if(x == 0){
      //cout << "zero" << '\n';
      cout << sum << '\n';
      return 0;
    }else if(x == 1){
      //cout << "one" << '\n';
      cout << (n - cnt) + sum << '\n';
      return 0;
    }else if(M.count(x)){
//      cout << "hit " << x << '\n';
      rp = cnt - M[x];
      break;
    }
    M[x] = cnt;
    sum += x;
    cy.pb(x);
    x = (x * x) % m;
    cnt++;
  }

  ll s2 = 0;
  for(int i = cnt - rp;i < cnt;i++) s2 +=cy[i];
  ll r = (n - cnt) % rp;
  ll add = 0;
  for(int i = cnt - rp;i < cnt - rp + r;i++) add += cy[i];
  
  ll ans = sum + ((n-cnt)/rp)*s2 + add;
  cout << ans << '\n';
  return 0;
}


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

int main() {
  int n; cin>>n;
  vector<string> v(n);
  rep(i,n){cin>>v.at(i);}
  
  map<string,int> a;
  rep(i,n){
    if(a.count(v.at(i))){a[v.at(i)]++;}
    else{a[v.at(i)]=1;}
  }
  
  vector<string> vec;
  pair<string,int> p;
  int vmax=0;
  for(p:a){
    vmax=max(vmax,p.second);
  }
  for( p:a){
    if(p.second==vmax){vec.push_back(p.first);}
  }
  sort(vec.begin(),vec.end());
  rep(i,vec.size()){
    cout<<vec.at(i)<<endl;
  }
}
      

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

using namespace std;

typedef long long/*--------------------*/ll;
typedef long double/*------------------*/ld;
typedef unsigned long long/*-----------*/ull;
typedef pair<ll, ll >/*----------------*/pll;
typedef std::vector<pll >/*------------*/vpll;

#define rep(i,a)/*---------------------*/for(i = 0 ; i < a ; i++)
#define repr(i,a)/*--------------------*/for(i = a ; i >= 0 ; i--)
#define REP(i,a,b)/*-------------------*/for(i = a ; i <= b ; i++)
#define REPR(i,a,b)/*------------------*/for(i = a ; i >= b ; i--)

#define YES/*--------------------------*/cout << "YES" << endl
#define NO/*---------------------------*/cout << "NO" << endl

#define lb/*---------------------------*/lower_bound
#define ub/*---------------------------*/upper_bound
#define pb/*---------------------------*/push_back
#define popb/*-------------------------*/pop_back
#define mem(a,b)/*---------------------*/memset(a,b,sizeof(a))
#define sz/*---------------------------*/size()
#define mpp/*--------------------------*/make_pair
#define bs/*---------------------------*/binary_search
#define gcd(a, b)/*--------------------*/__gcd(a, b)
#define lcm(a, b)/*--------------------*/((a)*((b)/gcd(a,b)))
#define sqr(x)/*-----------------------*/(x)*(x)
#define all(a)/*-----------------------*/a.begin(),a.end()

#define ff/*---------------------------*/first
#define ss/*---------------------------*/second

#define endl/*-------------------------*/'\n'
#define inf/*--------------------------*/(ll)2e15
#define MOD/*--------------------------*/(ll)1000000007

void solve();
void boost()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	boost();
	ll t,i;
	t = 1;
    //cin >> t;
	REP(i,1,t)
	{
       //cout << "Case "<< i << ": ";
       solve();
	}
	return 0;
}
void solve()
{
    string s,t;
    cin >> s >> t;
    ll i,j,k,n = s.length();
    repr(i,n-t.length())
    {
        bool chk = true;

        //cout << i << endl;
        j = i;
        k = 0;
        while(j < n and k < t.length())
        {
            if(s[j] == '?')
            {
                j++;k++;
                continue;
            }
            if(s[j] != t[k])
            {
                chk = false;
                break;
            }
            ++j,++k;
        }
        if(chk == true)
        {
            j = i;
            k = 0;
            while(k < t.length())
            {
                s[j] = t[k];
                ++j,++k;
            }
            rep(i,n)
            {
                if(s[i] == '?')
                    s[i] = 'a';
            }
            cout << s << endl;
            exit(0);
        }
    }
    cout << "UNRESTORABLE" << endl;
}


Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

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

// -------------------------------------------------------------------------------

int vector_finder(std::vector<LL> vec, LL number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N, M, X;
	VL A;
	cin >> N >> M >> X;
	FOR(i, 0, M)
		A.push_back(IN<LL>());

	LL t = X;
	LL ans = 0;
	LL count = 0;
	while (t<=N) {
		if (vector_finder(A, t)) {
			ans++;
		}
		t++;
	}
	t = X;
	while (t >=0) {
		if (vector_finder(A, t)) {
			count++;
		}
		t--;
	}
	ans = min(ans, count);
	O(ans);

	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Gabriel Carrillo
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        OMatching solver = new OMatching();
        solver.solve(1, in, out);
        out.close();
    }

    static class OMatching {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            long mod = (long) 1e9 + 7;
            int[][] grid = new int[n + 1][n];
            long[] dp = new long[(1 << n) + 1];
            dp[0] = 1;
            for (int i = 1; i <= n; i++)
                for (int j = 0; j < n; j++)
                    grid[i][j] = in.nextInt();

            for (int i = 1; i < 1 << n; i++) {
                int j = Integer.bitCount(i);
                for (int k = 0; k < n; k++) {
                    if ((i & (1 << k)) != 0) {
                        dp[i] += dp[i ^ (1 << k)] * grid[j][k];
                        if (dp[i] > mod) dp[i] -= mod;
                    }
                }
            }
            out.println(dp[(1 << n) - 1]);

        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public InputReader(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }
}



Measured memory_bytes: 41684
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define itn int
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}
int n,k;
ll dp[3005][3005];
int main(){
	for(int i=0;i<3005;i++)dp[i][0]=1;
	for(int i=1;i<3005;i++)
	for(int j=1;j<=i;j++)dp[i][j]=(dp[i-1][j]+dp[i-1][j-1])%mod;
	cin>>n>>k;
	for(itn i=0;i<k;i++)o(dp[k-1][i]*dp[n-k+1][i+1]%mod);
}


Measured memory_bytes: 69120
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define endl '\n'
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}

template <class T> struct FenwickTree {
    vector<T> dat;
    explicit FenwickTree(int size): dat(size + 5, 0) {}
    inline void add(int i, const T&v) { while(i < dat.size()){ dat[i]+=v; i += i&-i;} }
    inline T sum(int i)         const { return (i<=0)? 0 : dat[i] + sum(i - (i&-i)); }
    inline T sum(int s, int t)  const { return sum(t) - sum(s-1); }
};

#define L second
#define R first

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

    int N, M;

    cin >> N >> M;
    vector<pii> r(M);

    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        r[i] = pii(b, a);
    }

    sort(ALL(r));

    int ans = 0;
    FenwickTree<int> ft(N);

    for (const auto &e: r) {
        if (ft.sum(e.L, e.R-1) <= 0) {
            ft.add(e.R - 1, 1);
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

int main() {
    int k;
    cin >> k;

    cout << (k/2) * ((k+1)/2) << endl;

    return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;


int main(){

  ll n;cin>>n;
  ll a;
  vector<ll>ev,ov;
  rep(i,0,n){
    cin>>a;
    if(i%2==0)ev.push_back(a);
    else ov.push_back(a);
  }
  if(n%2==0){
    reverse(ov.begin(),ov.end());
    rep(i,0,ov.size())cout<<ov[i]<<" ";
    rep(i,0,ev.size())cout<<ev[i]<<" ";
  }else{
    reverse(ev.begin(),ev.end());
    rep(i,0,ev.size())cout<<ev[i]<<" ";
    rep(i,0,ov.size())cout<<ov[i]<<" ";
  }

  return 0;
}


Measured memory_bytes: 3948
import java.util.*;

public class Main{
    public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();

    if(a > b){
        System.out.println("a > b");
    }else if(a < b){
        System.out.println("a < b");
    }else if(a == b){
        System.out.println("a == b");
    }

    }
}


Measured memory_bytes: 26284
while True:
    cards = input()
    
    if cards == '-':
        break
    
    m = int(input())
    #print(m)
    for i in range(m):
        
        h = int(input())
        #print(h)
        #print(cards[:(h)], cards[(h):])
        cards =  cards[(h):] + cards[:(h)]
        #print(cards)
        
    print(cards)


Measured memory_bytes: 5596
import sys

N = int(input())
p2 = [pow(2,i) for i in range(17) if pow(2,i) <= (N-1)]
m = max(p2)
print('0\n')
s = input()
if s == 'Vacant':
    sys.exit()
elif s == 'Male':
    search = 'F'
else:
    search = 'M'
print('{}\n'.format(m))
s = input()
if s == 'Vacant':
    sys.exit()
elif s == 'Male':
    if search == 'M':
        left = 0
        right = m
    else:
        right = N-1
        left = N-1-m
        print('{}\n'.format(right))
        s = input()
        if s == 'Vacant':
            sys.exit()
        elif s == 'Male':
            search = 'rF'
        else:
            search = 'rM'
else:
    if search == 'F':
        left = 0
        right = m
    else:
        right = N-1
        left = N-1-m
        print('{}\n'.format(right))
        s = input()
        if s == 'Vacant':
            sys.exit()
        elif s == 'Male':
            search = 'rF'
        else:
            search = 'rM'
while True:
    mid = (left+right) // 2
    print('{}\n'.format(mid))
    s = input()
    if s == 'Vacant':
        sys.exit()
    elif s == 'Male':
        if search == 'M':
            right = mid
        elif search == 'rF':
            right = mid
        elif search == 'rM':
            left = mid
        else:
            left = mid
    else:
        if search == 'F':
            right = mid
        elif search == 'rF':
            left = mid
        elif search == 'rM':
            right = mid
        else:
            left = mid

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n, int k) {
    return fact[n]*ifact[n-k];
  }
} c(10000007);
// c(5, 2) → 10, c.p(5, 2) → 20, c.fac[4] → 24

int main() {
  // sortして、最小値、最大値として何回貢献するか
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  sort(A.begin(), A.end());
  mint ans = 0;
  rep(i, N) {
    //最小として
    ans -= mint(A[i]) * c((N-1-i), K-1);
    ans += mint(A[i]) * c(i, K-1);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 159804
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 



int A[200005], B[200005];
 
int32_t main()
{
    fast;
    int n, m, k; cin >> n >> m >> k;
    For(i, 0, n) {
        cin >> A[i];
    }
    For(i, 0, m) {
        cin >> B[i];
    }
    int as = 0, bs = 0, bp = 0, ans = 0; // as -> a_sum, bs -> b_sum, bp -> b pointer
    For(i, 0, n) as += A[i];

    for(int i = n; i >= 0; i--) {
        if(i < n) as -= A[i];
        if(as <= k) {
            while(bp < m and as + bs + B[bp] <= k) {
                bs += B[bp];
                bp++;
            }
            ans = max(ans, i + bp);
            
        }
        
    }
    cout << ans << "\n";


    return 0;
}

Measured memory_bytes: 6748
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;

map<int, int>memo;
int N, A, B, C, D;

int solve(int n) {
	if (n == 0)return 0;
	if (n == 1)return D;
	if (memo[n] != 0)return memo[n];

	int res = LLINF;
	if (res / D > n)res = n * D;
	if (n % 2 == 0) {
		chmin(res, solve(n / 2) + A);
	}
	else {
		chmin(res, solve(n / 2) + A + D);
		chmin(res, solve((n + 1) / 2) + A + D);
	}
	if (n % 3 == 0) {
		chmin(res, solve(n / 3) + B);
	}
	else {
		if (n / 3 != 0)chmin(res, solve(n / 3) + B + D * (n % 3));
		else chmin(res, D*n);
		chmin(res, solve((n + 3) / 3) + B + D * (3 - (n % 3)));
	}
	if (n % 5 == 0) {
		chmin(res, solve(n / 5) + C);
	}
	else {
		if (n / 5 != 0)chmin(res, solve(n / 5) + C + D * (n % 5));
		else chmin(res, D*n);
		chmin(res, solve((n + 5) / 5) + C + D * (5 - (n % 5)));
	}
	return memo[n] = res;
}

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

	int t; cin >> t;
	while (t--) {
		memo.clear();
		cin >> N >> A >> B >> C >> D;
		cout << solve(N) << endl;
	}
		
	return 0;
}



Measured memory_bytes: 4368
#include<bits/stdc++.h>
using namespace std;
int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string a[n];
    for(int i = 0; i<n; i++){
        cin >> a[i];
    }
    int m;
    cin >> m;
    string b[m];
    for(int i = 0; i<m; i++){
        cin >> b[i];
    }
    int ans = 0;
    for(int i = 0; i<n; i++){
        int count = 0;
        for(int j = 0; j<n; j++){
            if(a[i]==a[j]){
                count++;
            }
        }
        for(int j = 0; j<m; j++){
            if(a[i]==b[j]){
                count--;
            }
        }
        ans = max(ans,count);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 
 
using namespace std;
long long mod = 1e9 + 7;
long long INF = 1e7;
double EPS = 1e-12;
typedef long long int lld;
long double tick(){static clock_t oldt; clock_t newt=clock();
    long double diff=1.0L*(newt-oldt)/CLOCKS_PER_SEC; oldt = newt; return diff; }
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
inline lld sc() { lld a; scanf("%lld", &a); return a; }
inline int scd() { int a; scanf("%d", &a); return a; }
inline double scf() { double a; scanf("%lf",&a); return a; }
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define all(c) (c).begin(), (c).end()
#define sz(a) ((int)a.size())
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
template <typename T1> void printIt(T1 t1) { cout << t1 << " )" << endl; }
template <typename T1, typename... T2>
void printIt(T1 t1, T2... t2) { cout << t1 << " , "; printIt(t2...); }
#define errorpair(a) cout<<#a<<" = ( "<<((a).first)<<" , "<<((a).second)<<" )\n";
#define mset(a, v) memset(a, v, sizeof(a))
#define popcount __builtin_popcountll

typedef pair<lld,lld> PA;

lld powP(lld x, lld y) {
    lld ans = 1, po = x % mod;
    while(y > 0) {
        if(y & 1) ans = ans * po % mod;
        y >>= 1; po = po * po % mod;
    }
    return ans;
}
 
bool bitSet(lld n, lld bit){
    if((n & (1LL << bit)) != 0) return true;
    else return false;
}
 
lld findGcd(lld a, lld b){
    while(a != 0) { lld temp = b % a; b = a; a = temp; }
    return b;
}

#define lim 300010
#define lim2 200010
#define qqqqqq 210
// Ab :)
// inline lld sqr(lld x) { return x * x; }
// unordered_map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];

// vector<lld> G[lim];
// string S[lim];
// lld A[lim];

int main(){
    lld h1 = sc(), m1 = sc(), h2 = sc(), m2 = sc(), k = sc();
    lld val1 = h1 * 60 + m1;
    lld val2 = h2 * 60 + m2;
    prL(max(0LL, val2 - val1 - k));
    return 0;
}


Measured memory_bytes: 3816
import java.util.*;

public class Main {
    static List<Integer> startPointList = new ArrayList<>();
    static List<Integer> endPointList = new ArrayList<>();
    static Set<Integer> vertexSet = new HashSet<>();

    public static void main(String args[]){
        Integer result = null;

        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            Integer startPoint = Integer.parseInt(scanner.next());
            startPointList.add(startPoint);
            Integer endPoint = Integer.parseInt(scanner.next());
            endPointList.add(endPoint);
            vertexSet.add(startPoint);
            vertexSet.add(endPoint);
        }

        result = topological(vertexSet, startPointList, endPointList);
        judge(result);





    }

    public static Integer topological(Set<Integer> vertexSet, List<Integer> startPointList, List<Integer> endPointList){
        boolean notConnect = true;
        Iterator<Integer> verIterator = vertexSet.iterator();

        while (verIterator.hasNext()){
            Integer vertex = verIterator.next();
            Iterator<Integer> endIterator = endPointList.iterator();
            Iterator<Integer> startIterator = startPointList.iterator();
            while (endIterator.hasNext()){
                Integer endPoint = endIterator.next();
                Integer startPoint = startIterator.next();
                if(vertex.equals(endPoint)){
                    if(startPoint.equals(endPoint)){
                        startIterator.remove();
                        endIterator.remove();
                    }
                    notConnect = false;
                    break;
                }else {
                    notConnect = true;
                }
            }
            if(notConnect == true){
                Iterator<Integer> startIterator2 = startPointList.iterator();
                Iterator<Integer> endIterator2 = endPointList.iterator();
                while (startIterator2.hasNext()){
                    Integer startPoint = startIterator2.next();
                    Integer endPoint = endIterator2.next();
                    if(startPoint.equals(vertex)){
                        startIterator2.remove();
                        endIterator2.remove();
                    }
                }
                verIterator.remove();
            }
        }

        return startPointList.size();
    }

    static void judge(Integer result){
        Integer judge = null;

        if(result.equals(0)){
            System.out.println(0);
        }else {
            Integer result2 = topological(vertexSet, startPointList, endPointList);
            if(result.equals(result2)){
                System.out.println(1);
            }else {
                result = result2;
                judge(result);
                }

            }
        }

    }


Measured memory_bytes: 34644
#include <stdio.h>

int B[100000];
long A[100000];

void QSort(int left, int right);

int main(void) {
  int N,M,i,number=0;
  long ans=0;

  scanf("%d %d",&N,&M);

  for(i=0;i<N;i++){
    scanf("%ld %d",&A[i],&B[i]);
  }

  QSort(0,N-1);

  for(i=0;i<N;i++)
  {
    if(number+B[i]>=M){
      ans+=(long)A[i]*((long)M-(long)number);
      number=M;
//      printf("%d %ld\n",number,ans);
      break;
    }else{
      number+=B[i];
      ans+=A[i]*(long)B[i];
//      printf("%d %ld\n",number,ans);
    }
  }

  printf("%ld",ans);
  return 0;
}

void QSort(int left, int right)
{
    int i, j;
    int pivot;
    int temp;

    i = left;
    j = right;
    pivot = A[(left + right) / 2];
    while(1){
        while (A[i] < pivot){i++;}
        while (pivot < A[j]){j--;}
        if (i >= j){break;}

        temp = A[i];
        A[i] = A[j];
        A[j] = temp;
        temp = B[i];
        B[i] = B[j];
        B[j] = temp;

        i++;
        j--;
    }

    if (left < i - 1){QSort(left, i - 1);} 
    if (j + 1 <  right){QSort(j + 1, right);}
}


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

 
int main() {
    vector<vector<int>> vec(3,vector<int>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++) cin >> vec.at(i).at(j);
            }
    vector<vector<int>> bol(3,vector<int>(3,0));

    int N,t;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> t;
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(vec.at(j).at(k)==t) bol.at(j).at(k) =1;
            }
        }

    }
    int m;
    bool C=false;
 for(int i=0;i<3;i++){
     m=0;
     for(int j=0;j<3;j++){
       m += bol.at(i).at(j);
     }
     if (m==3) C=true;
      }
       
    for(int i=0;i<3;i++){
     m=0;
     for(int j=0;j<3;j++){
       m += bol.at(j).at(i);
     }
     if (m==3) C=true;
      }

    if(bol.at(1).at(1)==1){
    int x=0;
    for(int i=0;i<3;i++) x+=bol.at(i).at(i);
    if(x==3) C=true;

    int y=bol.at(0).at(2)+bol.at(2).at(0);
    if(y==2) C=true;
 }

      if(C) cout << "Yes" << endl;
      else cout << "No" << endl;




    /* for(int i=0;i<3;i++) {
        for(int j=0;j<3;j++) {
            cout << bol.at(i).at(j) << " ";
        }
        cout << endl;
    } */
    
    }


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

#include <stdio.h>
using namespace std;

void trace(int A[], int N) {
	for (int i = 0; i < N; i++) {
		cout << A[i];
		if (i != N - 1)
			cout << " ";
	}
	cout << endl;
}

void insertionSort(int A[], int N) {
	for (int i = 1; i < N; i++) {
		int tmp = A[i];
		int j = i - 1;
		while (j >= 0 && A[j] > tmp) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = tmp;
		trace(A, N);
	}
}

int main(void) {
	int N;
	int A[100];
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> A[i];
	trace(A, N);
	insertionSort(A, N);
	return 0;
}



Measured memory_bytes: 3104
# -*- coding: utf-8 -*-
N = int(input())
tmp = input()
As = [int(a) for a in tmp.split()]

dic = {}
maxes = [0, 0]
for a in As:
    if a not in dic:
        dic[a] = 0
    dic[a] += 1
    if dic[a] % 2 == 0:
        if maxes[0] < a:
            maxes[0], maxes[1] = a, maxes[0]
        elif maxes[1] < a:
            maxes[1] = a

print(maxes[0] * maxes[1])


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

using namespace std;

int main(){

bool f[102];
string st;
string S1,S2;
int x,c=0;
for(int i=0;i<102;i++)
f[i]=false;
cin>>st;
cin>>x;
for(int i=0;i<x;i++)
{cin>>S1;
S2=S1+S1;
for(int j=0;j<(int)(S1.size());j++)
for(int k=0;k<(int)(st.size());k++)
{if(S2[j+k]!=st[k])break;if(k==(st.size()-1))f[i]=true;}
}
for(int i=0;i<102;i++)
if(f[i]==true)c++;

cout<<c<<endl;
return 0;
}

Measured memory_bytes: 1208
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};
struct note{
	string date;
	int time;
	char e;
	int id;
};
int main() {
	int n;
	while (cin>>n,n) {
		vector<note> notes;
		vi bless(1000, 0);
		vi blessed(1000, -1);
		REP(i, n) {
			string s1, s2;
			char e;
			int id;
			cin >> s1 >> s2 >> e >> id;
			int time=atoi(s2.substr(0, 2).c_str()) * 60 + atoi(s2.substr(3, 2).c_str());
			if (id == 0) {
				if (e == 'I') {
					FOR(j,1, 1000)
						if (blessed[j] != -1)
							blessed[j] = time;
					blessed[0] = time;
				}
				else {
					FOR(j,1, 1000)
						if (blessed[j] != -1)
							bless[j] += time- blessed[j];
					blessed[0] = -1;
				}
			}
			else {
				if (e == 'I') {
					blessed[id] = time;
				}
				else {
					if(blessed[0]!=-1)
						bless[id] += time - blessed[id];
					blessed[id] = -1;
				}
			}
		}
		int ans = 0;
		FOR(i,1, bless.size())
			ans = max(ans, bless[i]);
		cout << ans << endl;
	}
}

Measured memory_bytes: 3148
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;

namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var c = CinTAr();
            int b = c[0] * 3 + c[1];
            Cout(Math.Floor(b / 2.0));
            Cin();
        }

        static int[] yakusuu(int n)
        {
            if(n == 1)
            {
                return new int[] { 1 };
            }
            HashSet<int> res = new HashSet<int>();
            for(int i = 1; i < Math.Ceiling(n / 2.0); i++)
            {
                if(n % i == 0)
                {
                    res.Add(i);
                    res.Add(n / i);
                }
            }
            return res.ToArray();
        }

        static readonly int MOD1E9 = (int)1e9 + 7;
        static string Cin() { return ReadLine(); }
        static string[] CinAr() { return ReadLine().Split(' '); }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return S2i(x); }).ToArray(); }
        static long CinL() { return S2L(Cin()); }
        static long[] CinLAr() { return CinAr().Select((x, i) => { return S2L(x); }).ToArray(); }
        static double CinD() { return S2D(Cin()); }
        static double[] CinDAr() { return CinAr().Select((x, i) => { return S2D(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static long S2L(string s) { return long.Parse(s); }
        static double S2D(string s) { return double.Parse(s); }
        static void OYes() { Cout("Yes"); }
        static void ONo() { Cout("No"); }
        static void Cout(object s) { WriteLine(s); }
        /// <summary>
        /// Debug時のみの使用を推奨
        /// </summary>
        /// <typeparam name="Type"></typeparam>
        /// <param name="types"></param>
        static void CoutAr<Type>(IEnumerable<Type> types)
        {
            string text = "";
            foreach (var i in types)
            {
                text += " " + i;
            }
            WriteLine(text.Substring(1));
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main()
{
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 cout.tie(NULL);
	 map<int,int>m;
	 int n;
	 cin>>n;
	 for(int i=2;i<=n;i++)
	 {
	 	   int x=i;
	 	   for(int j=2;j<=sqrt(i);j++)
	 	   {
	 	   	    if(i%j==0)
	 	   	    {
	 	   	    	  while(i%j==0)
	 	   	    	     {
	 	   	    	     	 i/=j;
	 	   	    	     	 m[j]++;
	 	   	    	     }	
	 	   	    }
	 	   }
	 	   if(i>=2)
	 	   	m[i]++;
	 	   i=x;
	 }
	 int res=1;
	 const int mod=1e9+7;
	 for(auto x:m)
	 {
	 	  res*=(x.second+1);
	 	  res%=mod;
	 }
	 cout<<res<<endl;
	 return 0;
}

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

using namespace std;

int main()
{
	int N;
	vector<int> A;

	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];
	/*
	N = 5;
	A[0] = 2;
	A[1] = 1;
	A[2] = 5;
	A[3] = 4;
	A[4] = 3;
	*/

	long long s = 0;
	int max = 0;
	int dif;

	for (int i = 0; i < N; i++)
	{
		dif = max - A[i];
		s += dif > 0 ? dif : 0;
		max = dif > 0 ? max : A[i];
		//cout << "max = " << max << endl;
	}
	cout << s << endl;
	return (0);
}


Measured memory_bytes: 3588
#include <iostream>

int main()
{
  int s[3];
  std::cin >> s[0] >> s[1] >> s[2];
  int sevenCnt = 0;
  int fiveCnt = 0;
  for(auto && st : s) {
    if(st == 5) fiveCnt++;
    if(st == 7) sevenCnt++;
  }
  if(fiveCnt == 2 && sevenCnt ==1) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
import string


def solve(S):
    ans = 1000
    for v in string.ascii_lowercase:
        tans = 0
        s = S
        while s.count(v) < len(s):
            tans += 1
            ns = []
            for i in range(len(s) - 1):
                if s[i] == v or s[i + 1] == v:
                    ns.append(v)
                else:
                    ns.append(s[i])
            s = "".join(ns)
        ans = min(ans, tans)

    return ans

if __name__ == "__main__":
    print(solve(input()))


Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
long N, ans=0; cin >> N; long A, freq[100001]={};
REP(i, N){ cin >> A; freq[A]++; ans+=A; }
long Q; cin >> Q; long B, C; 
REP(i, Q){ 
  cin >> B >> C; 
  ans-=freq[B]*B; ans+=freq[B]*C; 
  freq[C]+=freq[B]; freq[B]=0;
  cout << ans << "\n";
}
}


Measured memory_bytes: 4428
#include <iostream>
#include <algorithm>
#include <array>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INT_MAX 2000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(i = (a); i < (b); i++)
#define bitget(a,b) (((a) >> (b)) & 1)

using namespace std;

int i, j, k;

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	int a, b;
	a = 0;
	b = 0;
	int flag = 0;
	rep(i, 0, n + 1) {
		rep(j, 0, m + 1) {
			if ((i*(m - j))+((n - i)*j) == k) {
				flag = 1;
				break;
			}
		}
		if (flag == 1) {
			break;
		}
	}

	if (flag == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N, K = gets.split.map(&:to_i)

if K % 2 == 0
  count_0 = 0
  count_2k = 0
  1.upto(N) do |n|
    if n % K == 0
      count_0 += 1
    elsif (n - K/2) % K == 0
      count_2k += 1
    end
  end

  p count_0**3 + count_2k**3
else
  count = 0

  1.upto(N) do |n|
    if n % K == 0
      count += 1
    end
  end

  p count**3
end


Measured memory_bytes: 1916
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let xl = sc.read_pairs::<i64>(n);

    let mut range = vec![];
    for &(x, l) in xl.iter() {
        range.push((x - l, x + l));
    }

    range.sort_by(|x, y| x.1.cmp(&y.1));
    let mut prev = range[0];
    let mut ans = 1;
    for (x, y) in range.into_iter().skip(1) {
        if x >= prev.1 {
            ans += 1;
            prev = (x, y);
        }
    }
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 4860