akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
//---------------------------------------------------------------------------------------------------

int main(void){
    // Your code here!
    int n; cin >> n;
    int cnt = 0;
    rep(i,n) {
        int a; cin >> a;
        if (a % 2 == 1) cnt++;
    }
    if(cnt % 2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 3596
#include<stdio.h>

int Num = 0;

void water(int *height, int l, int r){
	if (l > r) return;
	int i, min = height[l], Imin = l;
	for (i = l+1; i <= r; i++){
		if (min > height[i]){
			min = height[i];
			Imin = i;
		}
	}
	Num += min;
	for (i = l; i <= r; i++)
		height[i] -= min;
	water(height, l, Imin-1);
	water(height, Imin+1, r);
	return;
}

int main(void){
	int i, N;
	scanf("%d", &N);
	int height[N];
	for (i = 0; i < N; i++)
		scanf("%d", &height[i]);
	water(height, 0, N-1);
	printf("%d\n", Num);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(long long)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const long long MAXS = 114514;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
signed main(){
    long long a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    long long res = 0;
    if(x>=y){
        res+=min(2*c,b+a)*y;
        x-=y;
        res+=min(2*c,a)*x;
    }
    else{
        res+=min(2*c,a+b)*x;
        y-=x;
        res+=min(2*c,b)*y;
    }
    cout<<res<<endl;
}

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

string dream_rev = "maerd";
string dreamer_rev = "remaerd";
string erase_rev = "esare";
string eraser_rev = "resare";

bool start_with(string S, string prefix) {
  return equal(begin(prefix), end(prefix), begin(S));
}

int main() {
  string S;
  cin >> S;
  reverse(S.begin(), S.end());

  while (true) {
    if (S == "") {
      cout << "YES" << endl;
      break;
    }

    if (start_with(S, dream_rev) || start_with(S, erase_rev)) {
      S = S.substr(5);
    } else if (start_with(S, eraser_rev)) {
      S = S.substr(6);
    } else if (start_with(S, dreamer_rev)) {
      S = S.substr(7);
    } else {
      cout << "NO" << endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 600
/*input
3
1 4
4 6
7 8
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element 
#define ll long long 
#define ld long double
#define pii pair<int,int>
#define f first
#define s second
#define pb emplace_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define sz(_a) (int)(_a.size())
#define FILL(n) memset(n,0,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const int maxn=55;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
pii a[maxn];
int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	map<pii,int> mp;
	REP(i,n){
		cin>>a[i].f>>a[i].s;
	}
	REP(i,n){
		REP(j,n){
			if(i!=j){
				mp[{a[j].f-a[i].f,a[j].s-a[i].s}]++;
			}
		}
	}
	int ans=0;
	for(auto x:mp) ans=max(ans,x.second);
	cout<<n-ans;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
//#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741
ll hell;
ll add(ll a,ll b) {
    return ((a%hell)+(b%hell))%hell;
}
ll sub(ll a,ll b) {
    return ((a%hell)-(b%hell)+hell)%hell;
}
ll mul(ll a,ll b) {
    return ((a%hell)*(b%hell))%hell;
}
void solve() {
    ll k;
    cin>>k;
    hell=k;
    mii m;
    ll ans=1;
    ll prev=0;
    while(1) {
        if (((mul(prev, 10))+7)%k==0) {
            cout<<ans<<endl;
            return;
        }
        if (m[((mul(prev, 10))+7)%k]) {
            break;
        }
        m[((mul(prev, 10))+7)%k]++;
        prev=((mul(prev, 10))+7)%k;
        ans++;
    }
    cout<<-1<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 66140
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;
 
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

char str[55][55];
int d[55][55];

int main(int argc, char* argv[])
{
    int h,w;
    scanf("%d%d",&h, &w);
    int i,j;
    int cnt0=0;
    for(i=0; i<h; i++) {
        scanf("%s", str[i]);
        for(j=0; j<w; j++) {
            if(str[i][j]=='#') cnt0++;
        }
    }

    for(i=0; i<h; i++) {
        for(j=0; j<w; j++) {
            d[i][j]=INF;
        }
    }

    queue<pair<int,int> > que;
    que.push(make_pair(0,0));
    d[0][0]=0;
    while(!que.empty()) {
        auto tmp=que.front();
        que.pop();
        int i=tmp.first;
        int j=tmp.second;
        int k;
        for(k=0; k<4; k++) {
            int i2=i+dx[k];
            int j2=j+dy[k];
            if(i2<0 || i2>=h || j2<0 || j2>=w) continue;

            if(str[i2][j2]=='.') {
                if(d[i][j]+1<d[i2][j2]) {
                    d[i2][j2]=d[i][j]+1;
                    que.push(make_pair(i2,j2));
                }
            }
        }
    }

    if(d[h-1][w-1]<INF) {
        printf("%d\n", h*w-1-d[h-1][w-1]-cnt0);
    }
    else {
        printf("-1\n");
    }
    

    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int> sunuke(N);
  
  for(int j = 0; j < K; j++){
    
    int d;
    cin >> d;
    
    for(int i = 0; i < d; i++){
      int A;
      cin >> A;
      sunuke.at( A - 1 ) = 1;
    }
  }
  
  int sum = 0;
  for(int i = 0; i<N; i++){
    sum += sunuke.at(i);
  }
  
  cout << N - sum << endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int A,B,K;
  int ans=0;
  int i;
  int answer[100]={0};
  cin>>A>>B>>K;
  for(i=1;i<=B;i++){
	if(A%i==0&&B%i==0){answer[ans]=i;ans++;}
  }
cout<<answer[ans-K]<<endl;
}


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

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

using namespace std;

int main() {
    int n,q;
    cin >> n >> q;
    string str;
    cin >> str;
    rep(i, n-1){
        if(str[i] == 'A' && str[i+1] == 'C'){
            str[i] = 'a';
        }
    }
    vector<int> arr(n, 0);
    for(int i = 1; i < n + 1; i++){
        arr[i] = arr[i-1];
        if(str[i - 1] == 'a'){
            arr[i]++;
        }
    }
    /*cout << str << endl;
    rep(i, n){
        cout << arr[i] << " ";
    }*/
    int l, r;
    rep(i, q){
        cin >> l >> r;
        cout << arr[r - 1] - arr[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  
  int num = 0, d1, d2;
  string ans = "No";
  for (int i = 0; i < n; i++) {
    cin >> d1 >> d2;
    if (d1 == d2) num++;
    else num = 0;
    if (num > 2) ans = "Yes";
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <cmath>

int main() {
    int x;
    std::cin >> x;
    int p = x * 2;
    std::vector<bool> v(p+1, false);
    for (int i = 2; i <= std::sqrt(p); i++) {
        long double y = p / i;
        for (int t = 2; t <= y; t++) {
            v[i*t] = true;
        }
    }
    for (int s = 1; s < v.size(); s++) {
        if (s >= x && !v[s]) {
            std::cout << s << std::endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

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

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Here your code !
    int work;
    int rank[3]={0};
    int i;
    for(i=0;i<10;i++){
        scanf("%d\n",&work);
        if(work > rank[0]){
            rank[2] = rank[1];
            rank[1] = rank[0];
            rank[0] = work;
        }else if(work > rank[1]){
            rank[2] = rank[1];
            rank[1] = work;
        }else if(work > rank[2]){
            rank[2] = work;
        }
    }
    for(i=0;i<3;i++){
        printf("%d\n",rank[i]);
    }
    return 0;
}

Measured memory_bytes: 604
def print_living_num(apart)
	# for not printing # at last line
	count = 0
	apart.each do |f|
		f.each do |r|
			r.map{|v| print " #{v}"}
			puts ""
		end
		# not printing # at last line
		if count != 3
			20.times{print "#"}
			puts ""
		end
		count += 1
	end
end

apart = Array.new(4){Array.new(3){Array.new(10){0}}}
n = gets.strip().to_i
n.times do
	lines = gets.strip().split(" ").map{|i| i.to_i}
	b = lines[0]
	f = lines[1]
	r = lines[2]
	v = lines[3]
	apart[b-1][f-1][r-1] += v
end
print_living_num(apart)


Measured memory_bytes: 6892
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i,n) for(int i=n-1;i>=0;i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
 

signed main(){
   
   int q,h,s,d,n;
   cin>>q>>h>>s>>d>>n;
   pair<int,int> p[1111];
   p[0]=make_pair(q*8,1);
   p[1]=make_pair(h*4,2);
   p[2]=make_pair(s*2,4);
   p[3]=make_pair(d*1,8);
   sort(p,p+4);
   int ans=0;
   n*=4;
   rep(i,4){
      ans+=(n/p[i].second)*(p[i].first/(8/p[i].second));
      //DEB(ans)END
      n%=p[i].second;
   }
   
   cout<<ans<<endl;
   
}


Measured memory_bytes: 768
i=input
N=int(i())
A=list(map(int,i().split()))
c=0
flug = 1
while flug:
    flug = 0
    for j in range(1,N)[::-1]:
        if A[j]<A[j-1]:
            A[j],A[j-1]=A[j-1],A[j]
            flug=1
            c+=1
print(*A)
print(c)

Measured memory_bytes: 5612
#include "stdio.h"
int main(int argc, char const *argv[])
{
	int a,b,i,count,result[10000];
	char op[2];
	for(i=0;;i++){
		scanf("%d",&a);
		scanf("%s",op);
		scanf("%d",&b);

		if(op[0] == '?'){
			count = i;
			break;
		}
		else if(op[0] == '+')
			result[i] = a + b;
		else if(op[0] == '-')
			result[i] = a - b;
		else if(op[0] == '*')
			result[i] = a * b;
		else if(op[0] == '/')
			result[i] = a / b;
	}

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

	return 0;
}


Measured memory_bytes: 608
h,w,k = map(int, input().split())
S = [list(input()) for _ in range(h)]
ans = []
n = 1
cnt = 0
for i in range(h):
    if "#" in S[i]:
        ans = []
        for j in range(w):
            if S[i][j] == "#":
                for _ in range(j+1-len(ans)):
                    ans.append(str(n))
                n += 1
        if len(ans) < w:
            x = ans[-1]
            for _ in range(w-len(ans)):
                ans.append(x)
    if ans:
        for _ in range(i+1-cnt):
            print(" ".join(ans))
            cnt += 1
        


Measured memory_bytes: 9840
#include <stdio.h>
#include <stdlib.h>
int selectionSort(int A[],int N)
{
    int i,j,t,sw=0,minj;
    for(i=0;i<N-1;i++)
    {
        minj=i;
        for(j=i;j<N;j++)
        {
            if(A[j]<A[minj]) minj=j;
        }
        t=A[i];A[i]=A[minj];A[minj]=t;
        if(i!=minj) sw++;
    }
    return sw;
}

int main()
{
    int A[100],N,i,sw;
    scanf("%d",&N);
    for(i=0;i<N;i++)
    {
        scanf("%d",&A[i]);
    }
    sw=selectionSort(A,N);
    for(i=0;i<N;i++)
    {
        if(i>0)
        {
            printf(" ");
        }
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",sw);
    return 0;
}



Measured memory_bytes: 2108
/******************************************
* AUTHOR : AMAN SAXENA *
* Nick : blue-meth *
* "There's some good in this world, and it's worth fighting for." *
* INSTITUTION : KIET Group of Institutions *
******************************************/
#include <bits/stdc++.h>

const long long MODULO=1000000007;
const long long N = 1e5 + 7;
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define FOR1(i,a,n) for(int i=a;i<=n;i++)
#define FOR2(i,a,n) for(int i=a;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pi 3.14159265359

using namespace std;

ll amanpower(ll a, ll b) {
	ll r = 1;
	while (b > 0) 
	{
		if (b & 1) r = r * a;
		a = a * a;
		b >>= 1;
	}
	return r;
}

ll amanlcm(ll a, ll b)
{
	 return a*(b/__gcd(a,b));
}
//Prime Numbers

vector<bool>prime(N+1,true);
void sieve()
{
	ll i,j,k;
	prime[0]=prime[1]=false;
	for(i=2;i*i<=N;i++)
	{
		if(prime[i])
		{
			for(j=i*i;j<=N;j+=i)
			{
				prime[j]=false;
			}
		}
	}
}

//Exponentiation

ll power(ll a,ll b)
{
	ll r=1;
	while(b)
	{
		if(b%2==1)
			r=r*a;
		b/=2;
		a*=a;
	}
	return r;
}
ll power(ll a,ll b,ll m)
{
	a=a%m;
	ll r=1;
	while(b)
	{
		if(b%2==1)
			r=(r*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return r;
}

//Prime Factors

vector<ll> factors(ll n)
{
	vector<ll>r;
	ll i,j;
	for(i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			r.push_back(i);
			if(n/i!=i)
				r.push_back(n/i);
		}
	}
	return r;
}


//********* CODE START *********


void solve()
{
	ll n;
	cin>>n;
	ll i,a[n];
	FOR(i,0,n) cin>>a[i];
	ll cur = a[0], ans = 0;
	FOR(i,1,n)
	{
		if(a[i] > cur)
		{
			cur = a[i]; 
		}
		else 
		{
			ans += abs(cur - a[i]);
		}
	}	
	cout << ans << '\n';

}

void test()
{
	int t;
	cin>>t;
	while(t--) //for(int j=1;j<=t;j++) cout << "Case #" << j << ": ";
	{
		solve();
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//#endif
	
	// test();
	solve();

	
	return 0;
}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define endl '\n'

void solvetask(){
    int n; cin >> n;
    cout << n + n*n + n*n*n << endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;// cin >> t;
    while(t--) solvetask();
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
/* clang-format off */
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  int n, m, ans = 0;
  map<string, int> a;
  cin >> n;
  REP(i, n) {
    string s;
    cin >> s;
    if (a.count(s))
      a.at(s)++;
    else
      a[s] = 1;
  }
  cin >> m;
  REP(i, m) {
    string s;
    cin >> s;
    if (a.count(s))
      a.at(s)--;
    else
      a[s] = -1;
  }
  for (auto x : a) {
    ans = max(x.second, ans);
    //cout << x.second << " ";
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
def main():
    bingo = [input().split(" ") for _ in range(3)]
    n = int(input())
    line = [[], [], []]
    v_line = [[], [], []]
    cross1 = []
    cross2 = []
    for _ in range(n):
        num = input()
        found = False
        for i in range(3):
            for j in range(3):
                if bingo[i][j] == num:
                    found = True
                    if i == j:
                        cross1.append((i, j))
                    if i == 0 and j == 2:
                        cross2.append((i, j))
                    if i == 2 and j == 0:
                        cross2.append((i, j))
                    if i == 1 and j == 1:
                        cross2.append((i, j))
                    line[i].append((i, j))
                    v_line[j].append((i, j))
                    continue
            if found:
                continue
    for l in line:
        if len(l) == 3:
            print("Yes")
            return
    for l in v_line:
        if len(l) == 3:
            print("Yes")
            return
    if len(cross1) == 3:
        print("Yes")
    elif len(cross2) == 3:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


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

int main(){
    int N,Q;
    cin>>N>>Q;
    string S;
    cin>>S;
    vector<int> C(N,0);
    for(int i=1;i<N;i++){
        C[i]=C[i-1];
        if(S[i]=='C'&&S[i-1]=='A') C[i]++;
    }
    for(int i=0;i<Q;i++){
        int l,r;
        cin>>l>>r;
        l--;r--;
        cout<<C[r]-(l?C[l]:0)<<endl;
    }
    return 0;
}

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

#define pb push_back
using namespace std;
typedef long long ll;
const int N = 100007;
vector<int> e[N];

ll f[N];
ll ans[N];
int m;

void solve(int u, int p = -1) {

	f[u] = 1;
	for(int v : e[u]) {
		if(v == p) continue;
		solve(v, u);

		f[u] = f[u] * f[v] % m;
	}

	f[u] = (f[u] + 1)%m;
}

void dfs(int u, int p = -1) {

	if(p != -1) { // adiciona f do pai
		f[u] = (f[u] - 1 + m)%m;
		f[u] = f[u] * f[p] % m;
		f[u] = (f[u] + 1)%m;
	}

	ans[u] = (f[u] - 1 + m)%m;

	vector<ll> suf(e[u].size() + 1, 1);
	for(int i = e[u].size()-1; i >= 0; --i) {
		suf[i] = suf[i+1] * f[e[u][i]] % m;
	}

	ll aux = 1;
	for(int i = 0; i < e[u].size(); i++) {
		int v = e[u][i];

		ll valor = f[v]; // valor antes de mudar, pra nao precisar remover o pai
		if(v != p) {
			// remove v
			f[u] = aux * suf[i + 1] % m;
			f[u] = (f[u] + 1)%m; 

			dfs(v, u);	
		}
		
		aux = aux * valor % m;
	}
}

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

	int n; cin >> n >> m;

	for(int i = 0; i + 1 < n; i++) {
		int u, v; cin >> u >> v;
		e[u].pb(v);
		e[v].pb(u);
	}

	solve(1, -1);
	dfs(1, -1);

	for(int i = 1; i <= n; i++) {
		cout << ans[i] << '\n';
	}
}

Measured memory_bytes: 17408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
int ans=10000;
void Main(){
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    For(i, 0, n - m + 1){
        int cnt = 0;
        For(j, 0, m){
            cnt += (s[i + j] != t[j]);
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int a, b;
    cin >> a >> b;
    if (a > b)
    {
        cout << a - 1 << endl;
    }
    else
    {
        cout << a << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    const long long mod=1e9+7;
    int n,k,a[610],b[610],pd[610];
    long long cnt[610][610],dp[610][610],g[2000],ans;
    int main()
    {
    	scanf("%d%d",&n,&k);
    	for(int i=1;i<=k;++i)
    	{
    		scanf("%d%d",&a[i],&b[i]);
    		pd[a[i]]=b[i];
    		pd[b[i]]=a[i];
    	}
    	n<<=1;
    	g[0]=1;
    	for(int i=2;i<=n;i+=2)
    	g[i]=(g[i-2]*(i-1))%mod;
    	for(int i=1;i<=n;++i)
    	{
    		for(int j=i;j<=n;++j)
    		cnt[i][j]=cnt[i][j-1]+(!pd[j]);
    	}


    	for(int i=1;i<=n;++i)
    	{for(int j=i;j<=n;++j)
    		{int ji=0;
    			for(int k=i;k<=j;++k)
    			{if(pd[k]&&(pd[k]>j||pd[k]<i))
                   	ji=1;				
    			}
    			if(ji==1) 	continue;
    			dp[i][j]=g[cnt[i][j]];//还未匹配的 
    			for(int k=i+1;k<=j-1;++k)
    			dp[i][j]=(dp[i][j]-1ll*dp[i][k]*g[cnt[k+1][j]]%mod+mod)%mod;//类似容斥 
    		}
    	}
    	
    	for(int i=1;i<=n;++i)
    	{	for(int j=i;j<=n;++j)
    		ans=(ans+dp[i][j]*g[(n/2-k)*2-cnt[i][j]]%mod)%mod;
    	}
    	printf("%lld\n",ans);
    	return 0;
    }

Measured memory_bytes: 6016
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int b, f, r, v;;
	int house[5][4][11];
	int i, n;

	for (b = 1; b <= 4; b++) {
		for (f = 1; f <= 3; f++) {
			for (r = 1; r <= 10; r++) house[b][f][r] = 0;
		}
	}
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d%d%d", &b, &f, &r, &v);
		house[b][f][r] += v;
	}

	for (b = 1; b <= 4; b++) {
		for (f = 1; f <= 3; f++) {
			for (r = 1; r <= 10; r++) printf(" %d", house[b][f][r]);
			putchar('\n');
		}
		if (b < 4) puts("####################");
	}
	return 0;
}


Measured memory_bytes: 2056
#include<cctype>
#include<cstdio>
#include<cstring>

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

using namespace std;

typedef long long ll;

ll xgcd(ll a,ll b,ll &x,ll &y){
	if(b==0){ x=1; y=0; return a; }
	ll g=xgcd(b,a%b,y,x); y-=a/b*x;
	return g;
}

ll modinv(ll a,ll m){
	ll x,y;
	if(xgcd(a,m,x,y)==1) return (x+m)%m;
	return -1;
}

int p;

bool ok;
int idx;
char s[100010];

int expr();

int factor(){
	if(s[idx]=='('){
		idx++;
		int a=expr();
		idx++;
		return a;
	}
	else{
		int a=0;
		while(isdigit(s[idx])) a=(a*10+(s[idx++]-'0'))%p;
		return a;
	}
}

int term(){
	int a=factor();
	while(s[idx]=='*' || s[idx]=='/'){
		char op=s[idx++];
		int b=factor();
		if(op=='*') a=a*b%p;
		else{
			if(b==0) ok=false;
			else     a=a*modinv(b,p)%p;
		}
	}
	return a;
}

int expr(){
	int a=term();
	while(s[idx]=='+' || s[idx]=='-'){
		char op=s[idx++];
		int b=term();
		if(op=='+') a=(a+b)%p;
		else        a=(a-b+p)%p;
	}
	return a;
}

int main(){
	while(scanf("%d%*c",&p),p){
		static char s[100010];
		fgets(s,100010,stdin);
		int len=strlen(s);
		if(s[len-1]=='\n') s[--len]='\0';

		int k=0;
		rep(i,len) if(s[i]!=' ') ::s[k++]=s[i];
		::s[k]='\0';

		idx=0;
		ok=true;
		int ans=expr();
		if(!ok) puts("NG");
		else    printf("%s = %d (mod %d)\n",::s,ans,p);
	}

	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <sstream>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end(),greater<int>());

    int alice = 0;
    int bob = 0;
    rep(i,n)
    {
        if(i%2==0) alice += a[i];
        else bob += a[i];
    }
    
    cout << alice-bob << endl;
    return 0;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    
    long int n;
    cin>>n;
    
    long int a[n];
    for(int i=0;i<n;i++)a[i]=0;
    long int b[n];
    for(int i=0;i<n;i++)
    {
       
        cin>>b[i];
        a[b[i]-1]++;
    }
    long long int s=0;
    
    for(long int i=0;i<n;i++)
    {
        s+=((a[i]*(a[i]-1))/2);
    }
    
    for(long int i=0;i<n;i++)
    {
        long int z=a[b[i]-1];
        
        cout<<s-((z*(z-1))/2)+(((z-1)*(z-2))/2)<<endl;
    }

    return 0;
}


Measured memory_bytes: 5760
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int a[51], n, A;
long long f[51][51][2600];
int main() {
        scanf("%d%d", &n, &A); f[0][0][0] = 1;
        for(int i = 1; i <= n; i ++ ) scanf("%d", &a[i]);
        for(int i = 0; i < n; i ++ ) for(int j = 0; j <= i; j ++ ) {
                for(int k = 0; k < 2600; k ++ ) if(f[i][j][k]) {
                        f[i+1][j][k] += f[i][j][k];
                        f[i+1][j+1][k+a[i+1]] += f[i][j][k];
                }
        }
        long long ans = 0;
        for(int i = 1; i <= n; i ++ ) ans += f[n][i][i*A];
        printf("%lld\n", ans);
}


Measured memory_bytes: 50048
#include <bits/stdc++.h>
using namespace std;
int A[4];
int B[4];
int MOD = 1'000'000'000 + 7;
long long pow3(int x){
    if(x<=0)return 1;
    if(x%2)return 3 * pow3(x/2) * pow3(x/2) % MOD;
    return pow3(x/2) * pow3(x/2) % MOD;

}
long long ans;
int main(){
    string s;
    cin>>s;
    for(char c:s){
        if(c=='A')B[0]++;
        if(c=='B')B[1]++;
        if(c=='C')B[2]++;
        if(c=='?')B[3]++;
    }
    for(char c:s){
        if(c=='A'){
            A[0]++;
            B[0]--;
        }
        if(c=='B'){
            B[1]++;
            long long l = A[0] * pow3(A[3]) + A[3] * pow3(A[3] - 1);
            long long r = B[2] * pow3(B[3]) + B[3] * pow3(B[3] - 1);
            l %= MOD;
            r %= MOD;
            ans += r * l % MOD;
            ans %= MOD;
            A[1]--;
        }
        if(c=='C'){
            A[2]++;
            B[2]--;
        }
        if(c=='?'){
            B[3]--;
            long long l = A[0] * pow3(A[3]) + A[3] * pow3(A[3] - 1);
            long long r = B[2] * pow3(B[3]) + B[3] * pow3(B[3] - 1);
            l %= MOD;
            r %= MOD;
            ans += r * l % MOD;
            ans %= MOD;
            A[3]++;
        }
    }
    cout<<ans<<'\n';
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
    map<string,int>d;
    string s;
    d["SUN"]=7;
    d["MON"]=6;
    d["TUE"]=5;
    d["WED"]=4;
    d["THU"]=3;
    d["FRI"]=2;
    d["SAT"]=1;
    cin>>s;
    printf("%d",d[s]);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(10);
    int n;
    cin >> n;
    set<int> as, bs, isec;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        as.insert(a);
    }
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        bs.insert(a);
    }

    set_union(as.begin(), as.end(), bs.begin(), bs.end(), inserter(isec, isec.end()));
    vi vs;
    for (int i: isec) {
        vs.push_back(i);
    }
    sort(vs.begin(), vs.end());
    for (int v: vs) {
        cout << v << endl;
    }
}


Measured memory_bytes: 44348
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
typedef long long int ll;
typedef unsigned long long int ull;
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}

int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    if(n==m)printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 128
#include<stdio.h>
#define N 25
#define NIL -1
#define MAX 100000
int n;
typedef struct Node{
  int parent;
  int left;
  int right;
}T;
T Tree[N];
void printP(int r)
{
  if(r==NIL)return;
  printf(" %d",r);
  printP(Tree[r].left);
  printP(Tree[r].right);
}
void printI(int r)
{
  if(r==NIL)return;
  printI(Tree[r].left);
  printf(" %d",r);
  printI(Tree[r].right);
}
void PrintPos(int r)
{
  if(r==NIL)return;
  PrintPos(Tree[r].left);
  PrintPos(Tree[r].right);
  printf(" %d",r);
}
int main()
{
  int i,j,data1,data2,m;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    Tree[i].parent=Tree[i].left=Tree[i].right=NIL;
  }
    for(i=0; i<n; i++){
      scanf("%d",&data1);
      for(j=0; j<2; j++){
	scanf("%d",&data2);
	if(j==0)Tree[data1].left=data2;
	else Tree[data1].right=data2;
	Tree[data2].parent = data1;
      }
    }
  
  for(i=0; i<n; i++)
    if(Tree[i].parent==NIL)m=i;
    printf("Preorder\n");
    printP(m);
    printf("\n");
    printf("Inorder\n");
    printI(m);
    printf("\n");
    printf("Postorder\n");
    PrintPos(m);
    printf("\n");
    return 0;
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;

double a,b,x;

bool isOK(double index,double key){
    double sum=0;
    if((double)tan(index)<=(double)b/a) sum=a*a*b-a*a*a*tan(index)/2.0;
    else sum=a*b*b*tan(PI/2.0-index)/2.0;

    if(sum>=key) return true;
    else return false;
}




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

    cin>>a>>b>>x;

    double ok=0.0;
    double ng=PI/2.0;
    while((double)abs(ok-ng)>0.000000001){
        double mid=(ok+ng)/2.0;
        if(isOK(mid,x)) ok=mid;
        else ng=mid;

    }
    cout << fixed << setprecision(14);
    cout << ok/PI*180 << endl;



}


Measured memory_bytes: 384
//https://atcoder.jp/contests/dp/tasks/dp_c
//C - Vacation

#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	
	int n;
	cin>>n;
	vector<int> dp(3);
	//dp[i] - the cost such that we did activity i on the last consitered day
	for(int day=0; day<n; ++day){
		vector<int> new_dp(3,0);
		vector<int> c(3);
		for(int i=0; i<3; ++i){
			cin>>c[i];
		}
		//a,b,c - a lot of implementation;
		for(int i=0; i<3; ++i){
			for(int j=0; j<3; ++j){
				if(i!=j){
					new_dp[j]=max(new_dp[j], dp[i]+c[j]);
				}
			}
		}
		dp=new_dp;
	}
	cout<<max({dp[0], dp[1], dp[2]})<<"\n";
	
	return 0;
}

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    llint n, ans;
    cin >> n;
    ans = 1;

    for(llint in=1;in<=n;in++) {
        ans *= in;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int a[200005],n,k;
bool check(int x){
    int now=0;
    for(int i=0;i<n;i++){
        now+=(a[i]-1)/x;
    }
    return now<=k;
}
int main(){
    cin>>n>>k;
    int maxn=0;
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        if(a[i]>maxn)   maxn=a[i];
    }
    int l=1,r=maxn;
    while(l<=r){
        int mid=(l+r)>>1;
        if(check(mid))
            r=mid-1;
        else
            l=mid+1;
    }
    cout<<l<<endl;
    return 0;
}

Measured memory_bytes: 4404
from heapq import *
from math import log
from itertools import accumulate
from collections import deque
#maxv=[0]
import sys
sys.setrecursionlimit(100100)

import math
from math import ceil
from bisect import bisect_left


from copy import deepcopy
from itertools import permutations

from math import sqrt
from heapq import *
from math import factorial
from collections import defaultdict

#A,B=map(inr,input().split())
#a=list(map(int,input().split()))
from bisect import bisect_left as bl
from bisect import bisect_right as br
from math import log

from fractions import gcd
import math
from collections import deque

import sys
input=sys.stdin.readline
#s=input()
#l=list(map(int,input().split()))
N=int(input())
A=list(map(int,input().split()))
A=[0]+A
B=[0 for i in A]
def prime_factor(n):
    i = 2
    table = defaultdict(int)
    while i * i <= n:
        while n % i == 0:
            n //= i
            table[i]+=1
        i += 1
    if n > 1:
        table[n]+=1
    return table
K=[]
for n in range(N,0,-1):
    if A[n]-B[n]==0:
        continue
    K.append(n)
    table=prime_factor(n)
    #print(table)
    l=[1]
    if n==1:
        continue
    for i,j in table.items():
        l_=[]
        for k in l:
            l_.extend([k*i**m for m in range(1,j+1)])
        l.extend(l_)
    #print(l)
    for i in l:
        B[i]=1-B[i]
    #print(B)
#print(A)
#print(B)
if len(K):
    print(len(K))
    print(*K,sep=" ")
else:
    print(len(K))


Measured memory_bytes: 108132
h,w=map(int,input().split())


if h%3==0 or w%3==0:
    print(0)
else:
    l=[]
    #縦割り
    l.append(h)
    #横割り
    l.append(w)
    #半縦割り
    for i in range(1,w):
        x,y,z=sorted([i*h,(w-i)*(h//2),(w-i)*(h-h//2)])
        l.append(z-x)
    #半横割り
    for i in range(1,h):
        x,y,z=sorted([i*w,(h-i)*(w//2),(h-i)*(w-w//2)])
        l.append(z-x)
    print(min(l))

Measured memory_bytes: 11060
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	aa := make([]int, 3)
	for i := 0; i < 3; i++ {
		aa[i] = getNextInt(scanner)
	}
	sort.Ints(aa)
	fmt.Fprintln(writer, fmt.Sprintf("%d %d", aa[0], aa[2]))
}



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

int main() {
	int n, tmp;
	stack<int> s;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		s.push(tmp);
	}
	for (int i = 0; i < n; i++) {
		cout << s.top();
		if (i != n - 1)cout << " ";
		else cout << endl;
		s.pop();
	}
	return 0;
}

Measured memory_bytes: 1200
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

int main() {
	string MARCH = "MARCH";
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N,X[200010], y[200010];
	cin >> N;
	REP(i, N) {
		cin >> X[i];
		y[i] = X[i];
	}
	sort(y, y + N);
	REP(i, N) {
		if (X[i] < y[N / 2]) cout << y[N / 2] << endl;
		else cout << y[N / 2-1] << endl;
	}
	return 0;
}


Measured memory_bytes: 3712
using System;

class Program{
	static void Main(){
		double x = 0, y = 0, angle = 0;
		while (true){
			string[] input = Console.ReadLine().Split(',');

			int d = int.Parse(input[0]);
			int t = int.Parse(input[1]);
			
			if (d == 0 && t == 0) break;
			
			x += d * Math.Sin(angle);
			y += d * Math.Cos(angle);
			angle += t * Math.PI / 180;
		}

		Console.WriteLine("{0}\n{1}", (int)x, (int)y);
    }
}

Measured memory_bytes: 9156
#include<bits/stdc++.h>
#define mod 163577857
#define mod1 998244353
#define Mmax 1000005
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int li;
typedef unsigned long long int ull;
using namespace std;
bool sortbysec(const pair<li,li>&a,const pair<li,li>&b)
{
    return (a.second<b.second);
}
bool comp(pair<li,pair<li,li>>a,pair<li,pair<li,li>>b)
{
  if(a.first<b.first)
  return 1;
  else if(a.first>b.first)
  return 0;
  else
  {
    return a.second.first<b.second.first;
  }
}
li mpow(li x,li y)
{
  li ans=1;
  while(y)
  {
    if(y%2!=0)
    ans=(ans%mod)*(x%mod)%mod;
    y/=2;
    x=((x%mod)*(x%mod))%mod;
  }
  return ans;
}
li modInverse(li n)
{
    return mpow(n, mod-2);
}

li nCrModPFermat(li n, li r,li x,li y,li z)
{
   // Base case
   if (r==0)
      return 1;
    // li fac[n+1];
    // fac[0] = 1;
    // for (int i=1 ; i<=n; i++)
    //     fac[i] = fac[i-1]*i%mod;
    return (x* modInverse(y) % mod *modInverse(z) % mod) % mod;
}
void bfs(vector<li>v[],li visit[],li s,li ans[])
{
  deque<li>q;
  q.push_back(s);
  visit[s]=1;
  while(!q.empty())
  {
    li x=q.front();
    q.pop_front();
    for(auto i=v[x].begin();i!=v[x].end();i++)
    {
      if(!visit[*i])
      {
        q.push_back(*i);
        visit[*i]=1;
      }
    }
  }
}
void buildtree(int*tree,int*arr,int start,int end,int treeNode)
{
  if(start<end)
  {
    int mid=start+(end-start)/2;
    buildtree(tree,arr,start,mid,2*treeNode);
    buildtree(tree,arr,mid+1,end,2*treeNode+1);
    tree[treeNode]=tree[2*treeNode]+tree[2*treeNode+1];
  }
}
void update(int*tree,int*arr,int start,int end,int pos,int val,int treeNode)
{
  if(start==end)
  tree[treeNode]=val;
  else
  {
    int mid=start+(end-start)/2;
    if(pos<=mid)
    update(tree,arr,start,mid,pos,val,2*treeNode);
    else
    update(tree,arr,mid+1,end,pos,val,2*treeNode+1);
    tree[treeNode]=tree[2*treeNode]+tree[2*treeNode+1];
  }
}

void dfs(vector<li>v[],li visit[],li s,li c[],li ans[],map<li,li>*m,li pred[])
{
    visit[s]=1;
     (*m)[c[s]]++;
    for(auto i=v[s].begin();i!=v[s].end();i++)
      {
        if(!visit[*i])
        {pred[*i]=s;
           dfs(v,visit,*i,c,ans,m,pred);
        }
      }
      if((*m)[c[pred[s]]]==1)
    ans[s]=(*m).size()-1;
    else
    ans[s]=(*m).size();
}
vector<li>factor(li n)
{
  vector<li>v;
  if(n%2==0)
  {
    while(n%2==0)
    {n/=2;
    v.push_back(2);
    }
  }
  for(li i=3;i<=sqrt(n);i+=2)
  {
    if(n%i==0)
    {
      while(n%i==0)
      {n/=i;
      v.push_back(i);
      }
    }
  }
  if(n>1)
  v.push_back(n);
  return v;
}
int main()
{
// li t,i,j;
// cin>>t;
// while(t--)
// {
//
//   cout<<endl;
// }
li x,ans=0;
cin>>x;
li p=100;
while(p<x)
{
  p*=1.01;
  ans++;
}
cout<<ans;
return 0;
}


Measured memory_bytes: 3724
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            Console.WriteLine((n / 2 + n % 2) / (double)n);
        }
    }
}


Measured memory_bytes: 13140
import math
import collections
import fractions
import itertools
import functools
import operator

def yakusu_rekkyo(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def solve():
    n = int(input())
    cnt = 0
    for i in range(1,n+1):
        hoge = 0
        for j in yakusu_rekkyo(i):
            if j%2 == 1:
                hoge += 1
        if hoge == 8:
            cnt += 1
    print(cnt)
    return 0

if __name__ == "__main__":
    solve()

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

int main()
{
    int64_t H, W;
    cin >> H >> W;
    if (H == 1 || W == 1)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << (H * W + 1) / 2 << endl;
    }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
int INF = 10000000;
int main() {
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	ll cnta = 0, cntb = 0;
	ll x = 0;
	rep(i, n) {
		cin >> a[i];
    }
    rep(i,n){
      cin>>b[i];
    }
    rep(i,n){
		x += b[i] - a[i];
		if (a[i] < b[i]) {
			if ((b[i] - a[i]) % 2 == 1) cntb++;
			cnta += (b[i] - a[i] + 1) / 2;
		}
		else if (a[i] > b[i]) {
			cntb += a[i] - b[i];
		}
	}
	if (cnta <= x&&cntb <= x) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 384
// Aizu 0586: Palindrome
// 2017.10.26 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

char nine[51] = "99999999999999999999999999999999999999999999999999";

long long palindrome(int k, int c)
{
	long long a = 10LL*k + c;
	while (k) {
		a = 10*a + (k%10);
		k /= 10;
	}
	return a;
}

int isprime(long long p)
{
	int i;
	int b = (int)sqrt((double)p);

	if ((p & 1) == 0) return 0;
	for (i = 3; i <= b; i += 2) if (!(p % i)) return 0;
	return 1;
}

int main()
{
	int n, c, k;
	long long x;

	scanf("%d%d", &n, &c);
	if (c < 0) {
		if (n == 1) puts("11");
		else { nine[2*n] = 0, puts(nine); }
	} else {
		nine[n] = 0;
		for (k = atoi(nine); ; k--) {
			x = palindrome(k, c);
			if (isprime(x)) { printf("%lld\n", x); break; }
		}
	}
	return 0;
}

Measured memory_bytes: 1812
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

@r = 10**9+7
s = gets.chomp
nk = 1
dp = na2(s.size+1,13,0)
dp[s.size][0] = 1
s.reverse.each_char.with_index do |c, i|
  now_i = (i)
  mae_i = (i-1)
  if(c != "?")
    d = (c.to_i * nk) % 13
    (0...13).each do |j|
      dp[now_i][j] = dp[mae_i][j - d]
    end
  else
    t = nk
    tail = 0
    sum = 0
    head = 0
    10.times do |j|
      sum += dp[mae_i][head]
      head = (head + t) % 13
    end
    13.times do |j|
      sum -= dp[mae_i][tail]
      sum += dp[mae_i][head]
      dp[now_i][head] = sum % @r
      tail += t
      tail %= 13
      head += t
      head %= 13
    end
  end
  nk *= 10
  nk %= 13
end
p dp[-2][5] %@r


Measured memory_bytes: 22652