akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#define NOT_FOUND -1
static const int MAXN = 100005;
using namespace std;

int binarySearch(int arr[], int n, int key)
{
	int low, mid, high;
	low = 0;
	high = n-1;
	
	mid = (low + high) / 2;
	while (arr[mid] != key && low < high) {
		if (key < arr[mid]) {
			high = mid - 1;
		}
		else {
			low = mid + 1;
		}
		mid = (low + high) / 2;
	}
	if (arr[mid] == key)
		return mid;
	
	return NOT_FOUND;
}

//版本2 
int bs(int arr[], int n, int key)
{
	int low, mid, high;
	low = 0;
	high = n;

	while (low < high) {
		mid = (low + high) / 2;
		if (key == arr[mid]) {
			return mid;
		}
		if (key > arr[mid]) {
			low = mid + 1;
		}
		else if (key < arr[mid]) {
			high = mid;
		}
	}
	
	return NOT_FOUND;
}

int main(void)
{
	int S[MAXN];
	int T[MAXN];
	int n, q, cnt = 0;
	
	cin >> n;
	for (int i = 0; i < n ; i++) {
		cin >> S[i];
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> T[i];
		if (binarySearch(S, n, T[i]) != NOT_FOUND) {
			cnt++;
		}
	}
	cout << cnt << endl;
	
	return 0;
 } 


Measured memory_bytes: 3648
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
low=min(a)+min(b)
cost=[]
for i in range(M):
  x,y,c=map(int,input().split())
  cost.append(a[x-1]+b[y-1]-c)
  
print(min(low,min(cost)))

       

Measured memory_bytes: 18736
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n=int(input())
ab=[]
for i in range(n):
    ab.append(tuple(map(int,input().split())))
ab.sort(key=lambda tup:tup[1])
time=0
for a,b in ab:
    time+=a
    if time>b:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 31832
#include <bits/stdc++.h>
#include <algorithm>
//#include <eigen3/Eigen/Dense>
using namespace std;
//using namespace Eigen;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v) cout << i << ' ' << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vin2(v, w) for (ll i = 0; i < v.size(); ++i) cin >> v[i] >> w[i];
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 (a > b) { a = b; return 1; } return 0; }
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(18);
	int X;
	cin >> X;
	if(X >=30){
		Yes;
	}
	else{
		No;
	}	
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <time.h>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(c) (c).begin(), (c).end()
#define P pair<int, int>
#define chmin(x, y) x = min(x, y)

int main()
{
  string s;
  cin >> s;
  string t;
  for (int i = 0; i < 3; i++)
  {
    t.push_back(s[i]);
  }
  cout << t << endl;
}


Measured memory_bytes: 3632
#include<iostream>

using namespace std;

int main () {
    int W, H, N;
    cin >> W >> H >> N;

    int wTop = 0, wEnd = W;
    int hTop = 0, hEnd = H;

    for (int i = 0; i < N; i++) {
        int x, y, a;
        cin >> x >> y >> a;

        if(a == 1) {
            if (wTop < x) wTop = x;
        } else if (a == 2) {
            if (wEnd > x) wEnd = x;
        } else if (a == 3) {
            if (hTop < y) hTop = y;
        } else {
            if (hEnd > y) hEnd = y;
        }
    }
    if ((hEnd - hTop) > 0 && (wEnd - wTop) > 0) cout << (hEnd - hTop) * (wEnd - wTop) << endl;
    else cout << 0 << endl;
}

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

using namespace std;

int main() {
   string s;
   cin >> s;
   sort(s.begin(), s.end());
   if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) {
      puts("Yes");
   } else {
      puts("No");
   }
}


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

int main() {
  int h,w;
  cin >> h >> w;

  rep(i,w+2) cout << "#";
  cout << endl;

  string s;
  rep(i,h){
    cin >> s;
    cout << "#" << s << "#" << endl;
  }
  rep(i,w+2) cout << "#";
  cout << endl;
    
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
#define trace1(x)                cerr << #x << ": " << x << endl
        #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl
        #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl
	
	using namespace std;
	int main()
	{
		  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
        #endif
		std::ios::sync_with_stdio(false);
		int n;
		cin>>n;
		string s;
		cin>>s;
		map<char,int> mp ; 
		vector<int> v[3] ; 
		int ra[n+2] = {0} , ga[n+2] = {0} , ba[n+2] = {0}  , r= 0 , g = 0 , b = 0 ;
		/*for(int i=0;i<n;++i)
		{
			if(s[i]=='R')
				 ++r; 
			else if(s[i]=='G')
				 ++g ;
			else
				 ++b;
			ra[i] = r  ;
			ga[i] = g ; 
			ba[i] = b ;
		}*/
		int rb[n+2] = {0} , gb[n+2] =  {0} , bb[n+2] = {0} ;
		  r= 0 ; g= 0 ; b = 0 ;
		  for(int i=n-1;i>=0;--i)
		{
			if(s[i]=='R')
				 ++r; 
			else if(s[i]=='G')
				 ++g ;
			else
				++b;
			rb[i] = r ; 
			gb[i] =  g ;
			bb[i] =  b ; 
		}
		/*for(int i=0;i<n;++i)
		{
			trace3(ra[i],ga[i],ba[i]);
			//trace3(rb[i],gb[i],bb[i]);	
		}
		for(int i=0;i<n;++i)
		{
			//trace3(ra[i],ga[i],ba[i]);
			trace3(rb[i],gb[i],bb[i]);	
		}*/
		ll res = 0 ; 
		for(int i=0;i<n;++i)
		{
			if(s[i]=='R')
				res += gb[i]*bb[i]  ; 
			else if(s[i]=='G')
				res += rb[i]*bb[i] ;
			else
				res += rb[i]*gb[i] ;
		}
		ll cnt = 0  ;
		for(int i=0;i<n;++i)
		{
			for(int k=i+2;k<n; k += 2)
			{
				int j = (i+k)/2 ;
				if(s[i]!=s[k] and s[j]!=s[i] and s[j]!=s[k])
					cnt++;
			}
		}
		cout<<res -cnt ;
		return 0;
	}


Measured memory_bytes: 3676
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
const int MAX_N = 100010 ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

class UFT{
public :
	int par[MAX_N] ;
	int rank[MAX_N] ;
	int cnt[MAX_N] ;

	void init(int n){
		for(int i=0;i<n;i++){
			par[i] = i ;
			rank[i] = 0 ;
			cnt[i] = 1 ;
		}
	}

	int find(int x){
		if(par[x]==x) return x ;
		return par[x] = find(par[x]) ;
	}

	void unite(int x,int y){
		x = find(x) ;
		y = find(y) ;
		if(x==y) return ;
		if(rank[x]<rank[y]){
			par[x] = y ;
			cnt[y] += cnt[x] ;
		}else{
			par[y] = x ;
			cnt[x] += cnt[y] ;
			if(rank[x]==rank[y]) rank[x]++ ;
		}
	}

	bool same(int x,int y){
		return find(x)==find(y) ;
	}
};

int main(){
	int n,m,k ;
	cin >> n >> m >> k ;
	UFT uft ;
	uft.init(n) ;
	int frnd[MAX_N] ;
	for(int i=0;i<n;i++) frnd[i] = 0 ;
	for(int i=0;i<m;i++){
		int a,b ;
		cin >> a >> b ;
		frnd[a-1]++ ;
		frnd[b-1]++ ;
		uft.unite(a-1,b-1) ;
	}
	int block[MAX_N] ;
	for(int i=0;i<n;i++) block[i] = 0 ;
	for(int i=0;i<k;i++){
		int a,b ;
		cin >> a >> b ;
		if(uft.same(a-1,b-1)){
			block[a-1]++ ;
			block[b-1]++ ;
		}
	}
	for(int i=0;i<n;i++){
		int num = uft.cnt[uft.find(i)]-frnd[i]-block[i]-1 ;
		if(num<0) num = 0 ;
		cout << num ;
		if(i==n-1) cout << endl ;
		else cout << " " ;
	}
}


Measured memory_bytes: 2816
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = new int[3][];
            for (var i = 0; i < 3; i++) array[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int a2 = 0, a3 = 0, b1 = 0, b2 = 0, b3 = 0;
            var end = array[0][0];

            for (var a1 = 0; a1 <= end; a1++)
            {
                b1 = array[0][0] - a1;
                b2 = array[0][1] - a1;
                b3 = array[0][2] - a1;

                a2 = array[1][0] - b1;

                if (a2 < 0 || a2 + b2 != array[1][1] || a2 + b3 != array[1][2]) continue;

                a3 = array[2][0] - b1;

                if (a3 < 0 || a3 + b2 != array[2][1] || a3 + b3 != array[2][2]) continue;

                Console.WriteLine("Yes");
                return;
            }

            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;

ll dp[1005][15],n,m;
string s;

ll dfs1(ll pos,ll dep){
	if(dep==0) return 1;
	if(pos==s.length()) return 0;
	ll ans = 0;
	ans+=dfs1(pos+1,dep);
	ans%=mod;
	ans+=(9*dfs1(pos+1,dep-1)%mod);
	ans%=mod;
	return ans%mod;
}

ll dfs2(ll pos,ll dep){
	if(dep==0) return 1;
	if(pos==s.length()) return 0;
	ll ans = 0;
	if(s[pos]=='0') ans+=dfs2(pos+1,dep);
	if(s[pos]>'0')
		ans+=dfs1(pos+1,dep);
	ans%=mod;
	if(s[pos]>'0')
		ans+=dfs2(pos+1,dep-1);
	ans%=mod;
	if(s[pos]>'0')
		ans+=(dfs1(pos+1,dep-1)*(s[pos]-'0'-1)%mod);
	ans%=mod;
	return ans%mod;
}

int main() {
	cin>>s;
	cin>>n;
	ll ans = 0;
	ans+=dfs2(1,n-1);
	ans%=mod;
	ans+=(dfs1(1,n-1)*(s[0]-'0'-1)%mod);
	ans%=mod;
	ans+=dfs1(1,n);
	cout<<(ans+mod)%mod;
    return 0;
}

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

D=int(input())
C=[0]+list(map(int,input().split()))
S=[0]+[[0]+list(map(int,input().split())) for i in range(D)]
T=[0]+[int(input()) for i in range(D)]

ANS=0
LAST=[[0]*27 for i in range(D+1)]
for day in range(1,D+1):
    for j in range(1,27):
        LAST[day][j]=LAST[day-1][j]
    t=T[day]
    ANS+=S[day][t]
    LAST[day][t]=day

    for j in range(1,27):
        ANS-=C[j]*(day-LAST[day][j])

    #print(ANS)

M=int(input())
for tests in range(M):
    d,after_t=map(int,input().split())

    before_t=T[d]

    ANS+=S[d][after_t]-S[d][before_t]

    T[d]=after_t

    for day in range(d,D+1):
        if T[day]!=before_t:
            ANS+=C[before_t]*(day-LAST[day][before_t])
            LAST[day][before_t]=LAST[day-1][before_t]
            ANS-=C[before_t]*(day-LAST[day][before_t])
        else:
            break

    ANS+=C[after_t]*(d-LAST[d][after_t])
    LAST[d][after_t]=d

    for day in range(d+1,D+1):    
        if T[day]!=after_t:
            ANS+=C[after_t]*(day-LAST[day][after_t])
            LAST[day][after_t]=LAST[day-1][after_t]
            ANS-=C[after_t]*(day-LAST[day][after_t])

    print(ANS)
    


Measured memory_bytes: 70496
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define debug(x) cerr << #x << " " << x << endl;
#define debug_p(x) cerr << #x << " [" << x.fi << " " << x.se << "]"<<endl;
#define debug_v(x) {cerr << #x << " "; for (auto ioi : x) cerr << ioi << " "; cerr << endl;}
#define debug_vp(x) {cerr << #x << " "; for (auto ioi : x) cerr << '[' << ioi.fi << " " << ioi.se << ']'; cerr << endl;}
#define debug_v_v(x) {cerr << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cerr << ioi2 << " "; cerr << '\n';} cerr << "*/" << #x << endl;}
#define gen_clock(x) ll x = clock(); cerr << "Clock " << #x << " created" << endl;
#define check_clock(x) cerr << "Time spent in " << #x << ": " << (double)(clock() - x)/CLOCKS_PER_SEC << endl; x = clock();
#define reset_clock(x) x = clock()

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

void solve()
{
	int a,b;
	cin>>a>>b;
	cout<<a*b;
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;

int N, A[202020], B[202020];



int check(int d) {
	int msk = 1 << d;
	vector<int>AA(N);
	vector<int>BB[2];
	rep(i, 0, N) {
		AA[i] = A[i]%(2*msk);
		if (B[i]&msk)BB[1].push_back(B[i]%(2*msk));
		else BB[0].push_back(B[i]%(2*msk));
	}
	
	rep(i, 0, 2)sort(all(BB[i]));
 	int cnt = 0;
	rep(i, 0, N) {
		if (AA[i] & msk) {
			int cnt1 = lower_bound(all(BB[1]),3*msk-AA[i]) - BB[1].begin();
			cnt += BB[1].size() - cnt1;
			int cnt2 = lower_bound(all(BB[0]), 2*msk-AA[i]) - BB[0].begin();
			cnt += cnt2;
		}
		else {
			int cnt1 = lower_bound(all(BB[0]), msk - AA[i]) - BB[0].begin();
			cnt += BB[0].size() - cnt1;
			int cnt2 = lower_bound(all(BB[1]), 2 * msk - AA[i]) - BB[1].begin();
			cnt += cnt2;
		}
	}

	if (cnt % 2 != 0)return 1;
	else return 0;
}



int main() {
	cin >> N;
	rep(i, 0, N)cin >> A[i];
	rep(i, 0, N)cin >> B[i];

	int ans = 0;
	rep(d, 0, 29)if (check(d))ans += 1 << d;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4372
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int d[100][100];
int V;
void warshall_floyd() {
    for(int k = 0; k < V; k++) {
        for(int i = 0; i < V; i++) {
            for(int j = 0; j < V; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main() {
    int M;
    // N vertex
    // M edge
    cin >> V >> M;
    vector<int> a(M), b(M);
    vector<int> c(M);
    REP(i, 100) {
        REP(j, 100) { d[i][j] = 100000; }
    }
    REP(i, M) {
        cin >> a[i] >> b[i] >> c[i];
        d[a[i] - 1][b[i] - 1] = c[i];
        d[b[i] - 1][a[i] - 1] = c[i];
    }
    warshall_floyd();
    int cnt = 0;
    REP(i, M) {
        if(c[i] != d[a[i] - 1][b[i] - 1]) {
            // cout << c[i] << " " << d[a[i] - 1][b[i] - 1] << endl;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

namespace ABC_C
{
    class C067
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            List<long> a = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();

            long sunuke = 0;
            long araiguma = a.Sum();
            long mindif = long.MaxValue;
            for (int i = 0; i < N - 1; i++)
            {
                sunuke += a[i];
                araiguma -= a[i];
                long dif = Math.Abs(sunuke - araiguma);
                if (dif < mindif) mindif = dif;
            }

            Console.WriteLine(mindif);
        }
    }
}


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

using namespace std;

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

int main(){

	int data[60][60];
	int minData[30];

	for(int i=0;i<60;i++){
		for(int j=0;j<60;j++){
			data[i][j]=0;
		}
	}
	for(int i=0;i<30;i++){
		minData[i]=10000000;
	}

	int n;
	string tmp;

	cin>>n;

	for(int i=0;i<n;i++){
		cin>>tmp;

		for(int j=0;j<tmp.size();j++){
			data[i][tmp.at(j)-'a']++;
		}
	}

	for(int i=0;i<n;i++){
		for(int j=0;j<26;j++){
			minData[j] = min(minData[j],data[i][j]);
		}
	}

	int tmpFlag=0;
	for(int j=0;j<26;j++){
		//cout<<minData[j]<<endl;
		while(minData[j]){
			tmpFlag=1;
			minData[j]--;
			cout<<(char)('a'+j);
		}
	}
	if(tmpFlag!=0){
		cout<<endl;
	}



	return 0;








}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
typedef long long  ll;
//typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set
// this for long double
#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<n;j++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define ld long double
#define kek cout<<endl; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
#define halt {cout<<-1; return 0;}
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const int N = 1010;
const int INF = 1e8;
const ll MOD1=1073741824;
const long double pi=3.1415926535;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
string bin_rep(int n)
{
          string s="";
      for(int i=31;i>=0;i--)
   {
           if(n&(1<<i)) s+='1';
           else s+='0';
   }
   return s;
}
int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
 
 string s;
 string t;
 cin>>s>>t;
 int ans=0;
 int n=s.size();
 forn
 {
           if(s[i]!=t[i]) ans++;
 }
 cout<<ans;
 
 
 
 
    
 
 
 
  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
   
 
}

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

using namespace std;

int main(){
    int H,W;

    while(cin >> H >> W){
        if(H == 0 && W == 0){
            break;
        }
        
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(i > 0 && i < (H-1)){
                    if(j == 0 || j == (W-1)){
                        cout << "#";
                    }else{
                        cout << ".";
                    }
                }else{
                    cout << "#";
                }
            }
            cout << endl;
        }

        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3100
<?php
$f = fopen( 'php://stdin', 'r' );
$line = fgets( $f );
$items = array_map('intval', explode(" ",$line));
$rem = $items[0];
while($rem>$items[1]) {
    $rem = $rem%$items[1];
}
if(abs($rem-$items[1]) > $rem) {
    echo $rem;
} else {
    echo abs($rem-$items[1]);
}
?>

Measured memory_bytes: 4604
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn gcd(a: u64, b: u64) -> u64 {
    assert!(a != 0 || b != 0);
    if a == 0 {
        b
    } else {
        gcd(b % a, a)
    }
}

fn main() {
    input!{
        n: usize,
        mut a: [u64; n],
    }
    let mut ans = a[0];

    for i in 0..n {
        ans = gcd(ans, a[i]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <deque>
#include <utility>
#include <set>
#include <queue>
#include <functional>

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

#define CHMAX(a, b) a = (a < b ? b : a)

constexpr double EPS = 1e-7;
constexpr int INF = 1 << 30;

using PAIR = std::pair<int, int>;


signed main() {

	while (true) {
		int n;
		std::cin >> n;
		if (n == 0) break;

		std::vector<int> p(n - 1), d(n - 1);
		REP(i, n - 1) std::cin >> p[i];
		REP(i, n - 1) std::cin >> d[i];

		struct Edge { int to, cost; };
		std::vector<std::vector<Edge>> g(n);
		std::vector<int> in(n, 0);

		int sum = 0, tsum = 0, ttsum = 0;
		REP(i, n - 1) {
			--p[i];
			g[i + 1].emplace_back(Edge{ p[i], d[i] });
			g[p[i]].emplace_back(Edge{ i + 1, d[i] });
			++in[i + 1];
			++in[p[i]];
			sum += d[i];
		}
		tsum = sum;
		REP(i, n) {
			if (in[i] == 1) {
				for (auto& e : g[i]) {
					tsum -= e.cost;
				}
			}
		}

		std::vector<bool> ng(n, false);
		int start = -1;
		REP(i, n) if (in[i] == 1) ng[i] = true, start = i;

		std::vector<int> dist(n, INF);
		dist[start] = 0;
		std::queue<int> que({ start });
		while (!que.empty()) {
			int now = que.front(); que.pop();
			for (auto& e : g[now]) {
				int to = e.to;
				int cost = e.cost;

				if (ng[to]) continue;
				if (dist[to] > dist[now] + cost) {
					dist[to] = dist[now] + cost;
					que.push(to);
				}
			}
		}
		 
		// 直径の端点
		int P, Q;
		int ma = -1;
		REP(i, n) if (!ng[i] && dist[i] > ma) {
			P = i;
			ma = dist[i];
		}

		/////////////////////////////////////////////////////////////////////////
		REP(i, n) dist[i] = INF;
		dist[P] = 0;
		que.push(P);
		while (!que.empty()) {
			int now = que.front(); que.pop();
			for (auto& e : g[now]) {
				int to = e.to;
				int cost = e.cost;

				if (ng[to]) continue;
				if (dist[to] > dist[now] + cost) {
					dist[to] = dist[now] + cost;
					que.push(to);
				}
			}
		}
		ma = -1;
		REP(i, n) if (!ng[i] && dist[i] > ma) {
			Q = i;
			ma = dist[i];
		}
		/////////////////////////////////////////////////////////////////////////

		ttsum = tsum;
		int now = Q;
		while (now != P) {
			for (auto& e : g[now]) {
				if (dist[now] > dist[e.to]) {
					ttsum -= e.cost;
					now = e.to;
					break;
				}
			}
		}

		std::cout << sum + tsum + ttsum << "\n";
	}

	return 0;
}


Measured memory_bytes: 3172
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

bool compare(P a, P b){
    return a.second - a.first > b.second - b.first;
}

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

    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    rep(i, m) cin >> x[i];
    sort(ALL(x));

    vector<P> a;
    rep(i, m - 1){
        a.emplace_back(x[i], x[i+1]);
    }
    sort(ALL(a), compare);

    int ans = 0;
    int k = min(n - 1, m - 1);
    rep(i, k){
        ans += a[i].second - a[i].first - 1;
    }

    cout << x[m-1] - x[0] + 1 - ans - min(n, m) << endl;

    return 0;
}


Measured memory_bytes: 3188
N = int(input())
s = {}
for _ in range(N):
    a = input()
    if a in s.keys():
        s[a] += 1
    else:
        s[a] = 1 
M = int(input())
t = {}
for _ in range(M):
    a = input()
    if a in t.keys():
        t[a] += 1
    else:
        t[a] = 1 
ret = 0
for i in s.keys():
    tmp = s[i]
    if i in t.keys():
        tmp -= t[i]
    ret = max(ret, tmp)
print(ret)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ll m1,d2,m2,d1;
    cin>>m1>>d1;
    cin>>m2>>d2;
    if(m1!=m2){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int l = sc.nextInt();
		
		long[][] A = new long[n][m];
		long[][] B = new long[m][l];
		long[][] C = new long[n][l];
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				A[i][j] = sc.nextInt();
			}
		}
		
		for(int j = 0; j < m; j++) {
			for(int i = 0; i < l; i++) {
				B[j][i] = sc.nextInt();
			}
		}

		for(int i = 0; i < n; i++) {
			for(int j = 0; j < l; j++) {
				for(int k = 0; k < m; k++) {
					C[i][j] += (A[i][k] * B[k][j]);
				}
				System.out.printf("%d", C[i][j]);
				if(j != (l-1)) {
					System.out.printf(" ");
				}
			}
			System.out.println();
		}
	}
}



Measured memory_bytes: 89688
#include<iostream>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;

int main(){
    ll n,f,cnt=0;
    vector<ll> monsters,savers;
    
    cin>>n;
    monsters.resize(n+1);
    savers.resize(n);

    for(int i=0; i<n+1; i++){
        cin>>monsters[i];
    }
    for(int i=0; i<n; i++){
        cin>>savers[i];
    }
    for(int i=0; i<n; i++){
        if(monsters[i]<savers[i]){
            savers[i]=savers[i]-monsters[i];
            cnt+=monsters[i];
            //cout<<"cnt+ : "<<monsters[i]<<endl;
            if(monsters[i+1]<savers[i]){
                cnt+=monsters[i+1];
                //cout<<"cnt+ : "<<monsters[i+1]<<endl;                
                monsters[i+1]=0;
            }else{
                monsters[i+1]=monsters[i+1]-savers[i];
                //cout<<"cnt+ : "<<savers[i]<<endl;
                cnt+=savers[i];
            }
        }else{
            //cout<<"cnt+ : "<<savers[i]<<endl;
            cnt+=savers[i];
        }
        //cout<<i<<": cnt : "<<cnt<<endl;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    yorn (a + b >= c)
    return 0;
}

Measured memory_bytes: 3576
// 1_8_C
#include <iostream>
#include <string>
using namespace std;

int main(){
  string s;
  int alphabet[26] = {};
  while(cin >> s){
    for(int i = 0; i < (int)s.length(); i++){
      if('A' <= s[i] && s[i] <= 'Z'){
        alphabet[s[i]-'A']++;
      } else if('a' <= s[i] && s[i] <= 'z'){
        alphabet[s[i]-'a']++;
      }
    }
  }

  for(char c = 'a'; c <= 'z'; c++){
    cout << c << " : " << alphabet[c-'a'] << endl;
  }
  return 0;
}

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

int main()
{
  int n, x;
  cin >> n >> x;
  int sum = 0;
  int ans = 1;
  for (int i = 0; i < n; i++)
  {
    int l;
    cin >> l;
    sum += l;
    if (sum > x)
    {
      break;
    }
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
 int a,b,c;
 cin>>a>>b>>c;
 if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||((a==7&&b==5&&c==5))){
    cout<<"YES";
 }
 else{cout<<"NO";}
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;

int h, w;
int a[81][81], b[81][81];
bool dp[81][81][12800];
// DAME:
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w;

    rep(i, h)rep(j, w) cin >> a[i][j];
    rep(i, h)rep(j, w) cin >> b[i][j];

    dp[0][0][abs(a[0][0] - b[0][0])] = true;

    rep(i, h)rep(j, w)rep(k, 6400){
        if(dp[i][j][k]){
            int kk = abs(a[i+1][j] - b[i+1][j]);
            int kkk = abs(a[i][j+1] - b[i][j+1]);
            dp[i+1][j][k+kk] = true;
            dp[i+1][j][abs(k-kk)] = true;
            dp[i][j+1][k+kkk] = true;
            dp[i][j+1][abs(k-kkk)] = true;
        }
    }
    rep(i, 6600){
        if(dp[h-1][w-1][i]){
            cout << i << endl;
            return 0;
        }
    }
    cout << 11111 << endl;
    return 0;
}

Measured memory_bytes: 81408
#include<iostream>
#include<string>
using namespace std;
int main(){
  short n;
  int taro,hanako;
  string a,b;
  cin >> n;
  taro=0;
  hanako=0;
  for(int i=0;i<n;i++){
    cin >> a >> b;
    if(a>b){
      taro+=3;}
    if(a==b){
      taro++;
      hanako++;}
    if(a<b){
      hanako+=3;}
  }
  cout << taro << " " << hanako << endl;
  return 0;
}

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

#define MOD 998244353

using namespace std;

typedef long long int ll;

vector<ll> factorialCache;
vector<ll> factorialInverseCache;

ll norm(ll v) {
    return v % MOD;
}

ll add(ll a, ll b) {
    return norm(a + b);
}

ll sub(ll a, ll b) {
    return norm(a - b + MOD);
}

ll mul(ll a, ll b) {
    return norm(a * b);
}

ll pow(ll p, ll k) {
    if (k == 0) {
        return 1L;
    }
    ll p2 = pow(mul(p, p), k / 2);
    return k % 2 == 1 ? mul(p2, p) : p2;
}

ll inverse(ll v) {
    return pow(v, MOD - 2);
}

ll getC(int n, int k) {
    while (factorialCache.size() <= n) {
        int index = factorialCache.size();
        ll v = mul(factorialCache[index - 1], index);
        factorialCache.push_back(v);
        factorialInverseCache.push_back(inverse(v));
    }
    return mul(factorialCache[n], mul(factorialInverseCache[k], factorialInverseCache[n-k]));
}

ll solve(int n, int m) {
    long answer = 0L;
    for (int numOnePair = 0; numOnePair <= m / 2; numOnePair++) {
        int numTwo = m + numOnePair;
        int numOne = m - 2 * numOnePair;
        if (n - 1 >= numOne && n - 2 >= 0) {
            long numPatternWithTwoM = mul(n, getC(numTwo - m + n - 2, n - 2));
            long v = mul(numPatternWithTwoM, getC(n - 1, numOne));
            answer = add(answer, v);
        }
        if (n >= numOne) {
            long v1 = getC(numTwo + n - 1, n - 1);
            long v2 = mul(n, getC(numTwo - m + n - 1, n - 1));
            long numPatternWithoutTwoM = sub(v1, v2);
            long v = mul(numPatternWithoutTwoM, getC(n, numOne));
            answer = add(answer, v);
        }
    }
    return answer;
}

int main(void) {
    factorialCache.push_back(1L);
    factorialInverseCache.push_back(1L);

    int n, m;
    cin >> n >> m;
    cout << solve(n, m) << endl;
}

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

using namespace std;

using ll = long long;


int main(int argc, char **argv)
{
    int n;
    cin >> n;

    vector<ll> vec(n);
    
    for (int i = 0; i < n; i++){
        cin >> vec[i];
    }

    if (n == 1 && vec[0] == 1){
        cout << 0 << endl;
        return 0;
    }

    int idx_prev = -1;
    int i;
    for (i = 1; i < n+1; i++){
        auto idx = find(vec.begin() + idx_prev + 1, vec.end(), i);
        if (idx == vec.end()) break;

        idx_prev = idx - vec.begin();

        if (idx - vec.begin() == n - 1){
            i++;
            break;
        }
    }
    if (i == 1){
        cout << -1 << endl;
        return 0;
    }

    cout << n - i + 1 << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
int p[200005];
int q[200005];
int main(void)
{
    int n,k,mx=0,idx=0;
    scanf("%d %d" ,&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%d" ,&p[i]);
        q[i]=p[i]+q[i-1];
    }
    for(int i=k;i<=n;i++)
    {
        if(q[i]-q[i-k]>mx)
        {
            mx=q[i]-q[i-k];
        }
    }
    printf("%.9f" ,(mx+k)/2.0);
    return 0;
}


Measured memory_bytes: 1664
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long

template <class T>
T mymax(T a,T b){
    if(a>=b) return a;
    return b;
}
template <class T>
T mymin(T a,T b){
    if(a<=b) return a;
    return b;
}

ll gcd(ll a, ll b){
    if(a<b){
        swap(a,b);
    }
    while(b){
        ll r = a%b;
        a=b;
        b=r;
    }
    return a;
}

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

struct XX{
    int a;
    int b;
    int z;
    int i;
};

class xxGreater {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
        if((riLeft.b) == (riRight.b)){
            return riLeft.i < riRight.i;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
            //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.b) > (riRight.b);
    }
};

//map<long long,long long> prime_f(long long n){
//    map<long long,long long>res;
//    for(int i=2;i*i<=n;i++){
//        while(n%i==0){
//            ++res[i];
//            n/=i;
//        }
//    }
//    if(n!=1)res[n]=1;
//    return res;
//}


int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
    //getline(cin, target);
    //cin >> x >> y;
    //テスト用
    //ifstream ifs( "1_06.txt" );
    //ifs >> a;
    //ここから
    
    //入力高速化
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N,A,B;
    cin >> N >> A >> B;
    
    if((B-A)%2==0){
        cout << "Alice" << endl;
    }else{
        cout << "Borys" << endl;
    }

    
    //ここまで
    //cout << "debug" << endl;
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}



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

int main(){
    ll N,Q;
    cin>>N;
    ll sum=0;
    map<ll,ll> m;
    for(ll i=0;i<N;++i){
        ll t;
        cin>>t;
        m[t]++;
        sum+=t;
    }
    cin>>Q;
    for(ll i=0;i<Q;++i){
        ll b,c;
        cin>>b>>c;
        ll t=c-b;
        sum+=t*m[b];
        m[c]+=m[b];m[b]=0;
        cout<<sum<<endl;
    }
}

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

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

int main()
{
	int n;
    long long sum=0;
    cin>>n;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++){
            for(int k=1; k<=n; k++){
               	sum+=gcd(i,gcd(j,k)); 
            }
        }
    }
    cout<<sum<<endl;
	return 0;
}

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

int main(){
    int n;
    vector<int> h(25), l(25);

    cin >> n;

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

    cout << count;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
struct TRAMP{
    char mark;
    int number;
};
 
int main(){
    int n,min;
    char buf[3];
    scanf("%d",&n);
 
    TRAMP selectArray[n],bubbleArray[n];
 
    for(int i = 0; i < n; i++){
        scanf("%s",buf);
        selectArray[i].mark = buf[0];
        selectArray[i].number = buf[1] - '0';
        bubbleArray[i] = selectArray[i];
    }
 
    for(int i = n-1; i >= 0; i--){
        for(int j = 0; j < i; j++){
            if(bubbleArray[j].number > bubbleArray[j+1].number) swap(bubbleArray[j], bubbleArray[j+1]);
        }
    }
 
    for(int i = 0; i < n-1; i++){
        min = i;
        for(int j = i+1; j < n; j++){
            if(selectArray[j].number < selectArray[min].number){
                min = j;
            }
        }
        if(i != min){
            swap(selectArray[i],selectArray[min]);
        }
    }
 
    for(int i = 0; i < n-1; i++) printf("%c%d ",bubbleArray[i].mark,bubbleArray[i].number);
    printf("%c%d\n",bubbleArray[n-1].mark,bubbleArray[n-1].number);
    printf("Stable\n");
    for(int i = 0; i < n-1; i++) printf("%c%d ",selectArray[i].mark,selectArray[i].number);
    printf("%c%d\n",selectArray[n-1].mark,selectArray[n-1].number);
 
    int p;
    for(p=0; p < n; p++){
        if(selectArray[p].number != bubbleArray[p].number || selectArray[p].mark != bubbleArray[p].mark)
            break;
    }
    if(p == n){
        printf("Stable\n");
    }else{
        printf("Not stable\n");
    }
 
    return 0;
}


Measured memory_bytes: 2720
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2,s3;
    int a,b;
				cin>>s1>>s2>>a>>b;
				cin>>s3;
				if(s1==s3) a--;
				else b--;
				cout<<a<<" "<<b;
}

Measured memory_bytes: 256
#include <iostream>
#include<string.h>
using namespace std;

int main() {
    int n,a,b,c;
    cin>>n;
    
    int A[n], B[n], C[n];
    int dp[n+1][3];
    int i;
    
    int ans = 0;
    memset(dp, 0, sizeof(dp));
    for(i= 0; i < n; i++)
    {
        cin>>A[i];
        cin>>B[i];
        cin>>C[i];
    }

    for(i= 1; i <= n; i++)
    {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + A[i-1];
        dp[i][1] = max(dp[i-1][2], dp[i-1][0]) + B[i-1];
        dp[i][2] = max(dp[i-1][1], dp[i-1][0]) + C[i-1];
    }
    ans = max(dp[n][0], dp[n][1]);
    ans = max(ans, dp[n][2]);
    cout<<ans;
}

Measured memory_bytes: 2560
import java.util.Scanner;
class Dice{
	int A,S,D,F,G,H,Z;
	Dice(int a,int s,int d,int f,int g,int h){
		A=a;S=s;D=d;F=f;G=g;H=h;
	}
	void turnN() {
		Z=A;
		A=S;S=H;H=G;G=Z;
	}
	void turnS() {
		Z=A;
		A=G;G=H;H=S;S=Z;
	}
	void turnW() {
		Z=A;
		A=D;D=H;H=F;F=Z;
	}
	void turnE() {
		Z=A;
		A=F;F=H;H=D;D=Z;
	}
	void turnright() {
		Z=S;
		S=F;F=G;G=D;D=Z;
	}
	void turnleft() {
		Z=S;
		S=D;D=G;G=F;F=Z;
	}
}
public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		Dice d=new Dice(sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt());
		char [] ch=sc.next().toCharArray();
		for(int i=0;i<ch.length;i++) {
			if(ch[i]=='N')d.turnN();
			else if(ch[i]=='S')d.turnS();
			else if(ch[i]=='E')d.turnE();
			else if(ch[i]=='W')d.turnW();
		}
		System.out.println(d.A);
		sc.close();
	}
}



Measured memory_bytes: 26364
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////

int dp[3010][3010];
//dp[i][j]でsのi文字目までtのj文字目まで見た時に
int main() {
	//まず最長の物の長さを求める
	string s, t; cin >> s >> t;
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < s.size(); ++i) {
		for (int j = 0; j < t.size(); ++j) {
			if (s[i] == t[j]) {
				dp[i + 1][j + 1] = dp[i][j] + 1;
			}
			else {
				dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
			}
		}
	}
	string ans = "";
	int i = s.size(), j = t.size();
	while (i > 0 && j > 0) {
		if (dp[i][j] == dp[i - 1][j]) {
			--i;
		}
		else if (dp[i][j] == dp[i][j - 1]) {
			--j;
		}
		else {
			ans = s[i - 1] + ans;
			--i, --j;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
#define MAX_N 100000
using namespace std;

struct Node {
    int x, c;
};

bool used[MAX_N + 1];
vector<int> es[MAX_N + 1];

void bfs(int a[], int start, int n) {
    fill(used, used + n + 1, false);
    queue<Node> que;
    que.push(Node {start, 0});
    while (!que.empty()) {
        Node p = que.front();
        que.pop();
        used[p.x] = true;
        a[p.x] = p.c;
        for (int v: es[p.x]) {
            if (!used[v])
                que.push(Node {v, p.c + 1});
        } 
    }
}

int count(int f[], int s[], int n) {
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += (f[i] > s[i]) ? -1 : 1;
    }
    return ans;
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i < n; i++) {
        int a, b;
        cin >> a >> b;
        es[a].push_back(b);
        es[b].push_back(a);
    }
    int f[n + 1], s[n + 1];
    bfs(f, 1, n);
    bfs(s, n, n);
    cout << ((count(f, s, n) > 0) ? "Fennec" : "Snuke") << endl;
    return 0;
}


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

int main(){
    int h,w,c,e=0,b=0;
    cin>>w>>h>>c;
        e=h/__gcd(w, h);
        b=w/__gcd(w, h);
        cout<<e*b*c<<"\n";
    return(0);
}


Measured memory_bytes: 3132
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int N, K, S;
    while(cin >> N >> K >> S, N || K || S) {
        // i ??\????????°?????? j ????????£??? k ????????????????????????
        int dp[25][25][255] = {};
        dp[0][0][0] = 1;
        repq(i,1,N) {
            repq(j,0,K) {
                repq(k,0,S) {
                    // i ???????????¨ ????¨???? i ?¢???????
                    if(k - i >= 0 && j != 0) dp[i][j][k] += dp[i-1][j-1][k-i];

                    // i ?????????????????¨ ????¨???????????????????
                    dp[i][j][k] += dp[i-1][j][k];
                }
            }
        }
        cout << dp[N][K][S] << endl;
    }
    return 0;
}

Measured memory_bytes: 4320