akhauriyash/Code-Regression huggingface dataset:
// Problem : A - Bichrome Cells
// Contest : AtCoder - AtCoder Beginner Contest 074
// URL : https://atcoder.jp/contests/abc074/tasks/abc074_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
int n;cin>>n;
int x;cin>>x;
cout<<n*n-x;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


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

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)



signed main(){

	string s, t;
	cin >> s >> t;
	if (s.length() < t.length()){
		cout << "UNRESTORABLE" << endl;
		return 0;
	}
	vector<string> v;	// 候補
	// 開始位置
	for (int i = 0; i <= s.length() - t.length(); i++){
		bool ok = true;
		string tmp = s;
		for (int j = 0; j < t.length(); j++){
			if (! (s[i + j] == t[j] || s[i + j] == '?')){
				ok = false; break;
			}
			tmp[i + j] = t[j];
		}
		if (ok){
			for (int j = 0; j < s.length(); j++){
				if (tmp[j] == '?') tmp[j] = 'a';
			}
			v.push_back(tmp);
		}
	}
	if (v.size() == 0){
		cout << "UNRESTORABLE" << endl;
		return 0;
	}
	sort(v.begin(), v.end());
	cout << v[0] << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())


def num2alpha(n):
    if n <= 26:
        return chr(96+n)
    elif n % 26 == 0:
        return num2alpha(n//26-1)+chr(122)
    else:
        return num2alpha(n//26)+chr(96+n % 26)


print(num2alpha(n))


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

int main(){
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	for(int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	sort(a.begin(), a.end());
	int q;
	scanf("%d", &q);
	vector<int> b(q);
	for(int i = 0; i < q; i++)
		scanf("%d", &b[i]);
	sort(b.begin(), b.end());
	vector<int> d;
	set_symmetric_difference(a.begin(), a.end(), b.begin(), b.end(), back_inserter(d));
	for(auto x: d)
		printf("%d\n", x);
}



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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    if(n >= 1000){
        cout << "ABD" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}


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

using namespace std;
// #define int long long
mt19937 rnd(time(0));
typedef long long ll;
typedef long double ld;

// #define _GLIBCXX_DEBUG
#define f first
#define s second
#define pb push_back
#define pii pair<int, int> 
#define vi vector<int>

void solve(){
    string s;
    cin >> s;
    int n = s.size();
    bool ok = 1;
    for (int i = 0; i < n - 1; ++i) 
        ok &= (s[i] == s[n - 2 - i]);
    if (s[0] == '0' || s[n - 1] == '1' || !ok) {
        cout << -1 << endl;
        exit(0);
    }
    int now = 2;
    cout << 1 << ' ' << 2 << endl;
    for (int i = 1; i < n - 1; ++i) {
        if (s[i] == '1') {
            if (now != 0)
                cout << now << ' ' << i + 2 << endl;
            now = i + 2;
        } else {
            cout << now << ' ' << i + 2 << endl;
        }
    }
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int t = 1;
    while(t--){
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 1616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld ;
#define pb push_back
#define fi first
#define se second
const int N = 3e6+5;
ll a[N];
ll b[N];
bool vis[N];
void solve(){
    int n;
    cin>>n;
    set<string >s;
    for(int i=0;i<n;i++){
        string a;
        cin>>a;
        s.insert(a);
    }
    cout<<(int)s.size()<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//    preprocess();
    int t =1;
 //   cin>>t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 19248
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define F first
//#define S second

typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e12;
const ll mlnf = -1e12;
const double e = 1e-10;

using Graph = vector<vector<int>>;

void debug_vector(vector<int>& v)
{
    int n = v.size();
    for (int i = 0; i < n; i++) {
        cout << v[i] << " ";
    }
    cout << endl;
}


//////////////////////
//// coding start ////
//////////////////////

// global variety
int N;
int d[110];
int f[110];
int ans;
// function
void solve();
void dfs(const Graph &G, int v);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

void solve(){
    cin >> N;
    Graph G(N);
    rep(i, N){
        int hoge; cin >> hoge;
        int k; cin >> k;
        rep(j, k){
            int tmp;
            cin >> tmp;
            tmp--;
            G[i].push_back(tmp);
        }
    }
    rep(i, N) d[i] = -1;
    rep(i, N) f[i] = -1;
    ans = 0;
    for (int i = 0; i < N; i++){
        if (d[i] != -1) continue;
        ans++;
        dfs(G, i);
    }
    rep(i, N){
        cout << i+1 << " " << d[i] << " " << f[i] << endl;
    }
    
    return ;    
}

void dfs(const Graph &G, int v){
    d[v] = ans;
    for(auto next_v : G[v]){
        if (d[next_v] != -1) continue;
        ans++;
        dfs(G, next_v);
    }
    ans++;
    f[v] = ans;
}



Measured memory_bytes: 3156
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

struct Point {
	int d;
	vll coords;
	Point(int dim, vll& coordinates):d(dim),coords(coordinates){
		assert(dim == isize(coordinates));
	}
};

ll diam_l1(int dim, vector<Point>& pts){
	ll ans = 0;
	for (int mask = 1; mask < (1 << dim); mask++) {

		auto get_val = [&](Point p) {
			ll val = 0;
			int basis = mask;
			rep(i, dim) {
				int dig = basis % 2;
				basis /= 2;
				val += p.coords[i]*(dig == 1 ? 1 : -1);
			}
			return val;
		};

		auto cmp = [&](Point p, Point q){
			return get_val(p) <= get_val(q);
		};

		Point maxp = *max_element(all(pts), cmp);
		Point minp = *min_element(all(pts), cmp);
		ans = max(ans, get_val(maxp) - get_val(minp));
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	vector<Point> pts = vector<Point>();
	rep(i, n) {
		int x, y; cin >> x >> y;
		vll coords = {x, y};
		pts.pb(Point(2, coords));
	}
	cout << diam_l1(2, pts);
}

Measured memory_bytes: 15748
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	int a = 0, b = 0, c = 0, d = 0;
	rep(i, n) {
		string s;
		cin >> s;
		if (s == "AC")
			a++;
		else if (s == "WA")
			b++;
		else if (s == "TLE")
			c++;
		else
			d++;
	}
	cout << "AC x " << a << "\nWA x " << b << "\nTLE x " << c << "\nRE x " << d << endl;
	return 0;
}

Measured memory_bytes: 3660
import sys
sys.setrecursionlimit(10**6)

def main(n):
	a = list(map(int, input().split()))
	a = list(set(a))
	while True:
		m = a[0]
		flg= True
		for k in a[1:]:
			if k % m == 0:
				continue
			if k % m < m:
				m = k%m
				a = [m]+a
				flg = False
		if flg:
			print(m)
			break
	return
main(int(input()))

Measured memory_bytes: 14252
#include <bits/stdc++.h>
    using namespace std;
    int main()
    {
      int a ;
      int b ;
      char c;
      
      scanf("%d %c %d",&a, &c, &b);
      
      if(c == '+')
      {
        cout << a+b ;
      }
      else
      {
        cout << a-b ;
      }
    }

Measured memory_bytes: 256
#include<iostream>
#include<cctype>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define N 4100
#define inf 1e9+7
#define ll long long
#define mo 924844033
using namespace std;
inline ll read()
{
    ll x=0,flag=1;
    char ch=0;
    while(!isdigit(ch)){ch=getchar();if(ch=='-')flag=-1;}
    while(isdigit(ch)) {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x*flag;
}
ll x,y;
ll g[N],fac[N],flag[N];
int dp[N][N][2];
ll exgcd(ll a,ll b)
{
    if(!b)
    {
        x=1;
        y=0;
        return a;
    }
    ll d=exgcd(b,a%b);
    ll t=x;
    x=y;
    y=t-(a/b)*y;
    return d;
}
ll f(ll a)
{
    exgcd(a,mo);
    return (x%mo+mo)%mo;
}
ll c(ll a,ll b)
{
    if(a<b)return 0;
    ll up=fac[a];
    ll down=(fac[b]*fac[a-b])%mo;
    return (up*f(down))%mo;
}
int main()
{
    ll n,k,i,j,o,cnt=0;
    n=read();
    k=read();
    fac[0]=1;
    for(i=1;i<=n;i++)
    fac[i]=(fac[i-1]*i)%mo;
    for(i=1;i<=k;i++)
    {
        for(o=1;o<=2;o++)//加减各加一遍
          for(j=i;j<=n;j+=k)
          {
              cnt++;
              if(i!=j)flag[cnt]=1;
          }
    }
    dp[0][0][0]=1;
    for(i=1;i<=2*n;i++)
    {
        for(j=0;j<=n;j++)
        {
            dp[i][j][0]=(dp[i-1][j][0]+dp[i-1][j][1])%mo;
            if(flag[i]&&j)dp[i][j][1]=dp[i-1][j-1][0];
        }
    }
    for(i=0;i<=n;i++)
    g[i]=( (dp[2*n][i][0]+dp[2*n][i][1])%mo * fac[n-i] )%mo;
    g[0]=fac[n];
    for(i=n;i>=0;i--)
    {
        for(j=i+1;j<=n;j++)
        g[i]=(g[i]-c(j,i)*g[j])%mo;
        g[i]=(g[i]+mo)%mo;
    }
    printf("%lld",g[0]);
    return 0;
}

Measured memory_bytes: 128512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = NM[0];
            var M = NM[1];
            string[] A = new string[N];
            string[] B = new string[M];

            for (int i = 0; i < N; i++)
            {
                A[i] = Console.ReadLine();
            }

            for (int i = 0; i < M; i++)
            {
                B[i] = Console.ReadLine();
            }


            bool ok = true;
            for (int searcindex = 1; searcindex <= N - M; searcindex++)
            {

                for (int c = 0; c < N - M + 1; c++)
                {
                    int prex = -1;
                    ok = true;

                    for (int cc = 0; cc < M; cc++)
                    {
                        int x = A[c + cc].IndexOf(B[cc],searcindex);
                        if (x >= 0 && cc == 0)
                        {
                            prex = x;
                        }
                        else if (x >= 0 && x == prex)
                        {
                        }
                        else
                        {
                            ok = false;
                            break;
                        }
                    }

                    if (ok)
                    {
                        break;
                    }
                }
                if (ok)
                {
                    break;
                }

            }

            string ans = "No";
            if (ok)
            {
                ans = "Yes";
            }
            Console.WriteLine(ans);
            Console.ReadLine();

        }
    }
}


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

int main() {
    vector<int> vec(5), amari(5), x(5);
    int sum = 0, mini =9, n=0;
    for (int i = 0; i < 5; i++) {
        cin >> vec.at(i);
        amari.at(i) = vec.at(i) % 10;
        x.at(i) = vec.at(i) - amari.at(i);
        if(amari.at(i) != 0) {
            x.at(i) += 10;
            mini = min (mini, amari.at(i));
            n ++;
        }

        sum += x.at(i);
    }
    sum = sum + mini -10;
    if (n == 0) sum += 1;

    cout << sum   << endl;


}

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

#define Int long long int
#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()


int main(){
    char c;
    char a;
    REP(i,3){
        REP(j,3){
            cin >> c;
            if(i==j)cout << c;
            //cin >> a;
        }
    }
    cout << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;

int main() {
	int n; cin>>n;
  	string str; cin>>str;
  	
  	ll r = 0; ll g = 0; ll b = 0;
  	for (int i=0;i<n;i++) {
    	if (str[i]=='R') {
        	r++;
        } else if (str[i]=='G') {
        	g++;
        } else {
        	b++;
        }
    }
//  	cout << "R: " << r << " G: " << g << " B: " << b << endl;
  	ll totalNumOfCase=r*g*b;
//  	cout << "total num of case: " << totalNumOfCase << endl;
	ll totalNumOfInvalidCase=0;
	for (int i=0; i<n-2;i++) {
      	for (int j=i+1;j<=n-1;j++) {
          	int k = j+(j-i);
          	if (k > n-1) { break; }
//	    	cout << "i: " << i << endl;
//        	cout << "j: " << j << endl;
//          	cout << "k: " << j+(j-i) << endl;
//          	cout << "***********" << endl;
//          	cout << "j+1: " << j+1 << endl;
          	if (str[i]!=str[j]&&str[i]!=str[k]&&str[j]!=str[k]) {
            	totalNumOfInvalidCase++;
            }
        }
//	    cout << "--------" << endl;
    }  	
    ll ans = totalNumOfCase-totalNumOfInvalidCase;
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
using namespace std;

int main(void){
    vector<long long> a(5);
    long long n,ans=0;
    cin >> n;
    for(int i=0; i<5; i++){
        cin >> a[i];
        ans=max(ans,(n+a[i]-1)/a[i]+4);
    }
    cout << ans << endl;
    return 0;
}

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#ifdef BTK
#define DEBUG if(1)
#else
#define DEBUG if(0)
#endif

#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
const string ok = "Yes";
const string ng = "No";

const int inf=1145141919;
int main(){
    string s;
    cin>>s;
    int n=s.size();
    int bit=0;
    map<int,int> x;
    x[bit]=0;
    REP(i,n){
        int t=s[i]-'a';
        bit^=(1<<t);
        int ans=inf;
        REP(c,26){
            if(x.count(bit^(1<<c))){
                if(x.count(bit)==0)
                    x[bit]=inf;
                chmin(x[bit],x[bit^(1<<c)]+1);
            }
        }
    }
    
    cout<<max(x[bit],1)<<endl;
    
    return 0;
}


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

int N;
int a[100010];

int main() {
    cin >> N;
    for (int i = 1; i <= N; i++) scanf("%d", &a[i]);
    a[0] = a[N+1] = 0;
    int sum = 0;
    for (int i = 0; i <= N; i++) sum += abs(a[i] - a[i+1]);
    for (int i = 1; i <= N; i++) {
        int res = sum + abs(a[i+1]-a[i-1]) - (abs(a[i] - a[i-1]) + abs(a[i+1] - a[i]));
        printf("%d\n", res);
    }
}

Measured memory_bytes: 1664
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(ll i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF (INT_MAX)
#define VEC2(type,name,w,h) vector<vector<type>>name(h,vector<type>(w))

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

int main(void){
    ll a,n;
    cin>>n;
    vector<ll> t(n+1);
    t[0]=0;
    rep(i,n){
        cin>>a;
        t[i+1]=t[i]+a;
    }
    ll mn=INF;
    rep(i,n-1){
        mn=min(mn,abs(t[n]-t[i+1]*2));
    }
    cout<<mn;
}
/*
*/

Measured memory_bytes: 4796
import bisect
n = int(input())
l = list(map(int, input().split()))
cnt = 0
l.sort()
for i in range(n):
	for j in range(i+1,n):
		wa = l[i] + l[j]
		r = bisect.bisect_left(l, wa)
		cnt += r - j- 1
print (cnt)

Measured memory_bytes: 3188
#![allow(unused_imports, non_snake_case)]
use proconio::{
    input, fastout,
    marker::{Chars, Bytes, Usize1}
};

macro_rules! max {($ a : expr $ (, ) * ) => {{$ a } } ; ($ a : expr , $ b : expr $ (, ) * ) => {{std :: cmp :: max ($ a , $ b ) } } ; ($ a : expr , $ ($ rest : expr ) ,+ $ (, ) * ) => {{std :: cmp :: max ($ a , max ! ($ ($ rest ) ,+ ) ) } } ; }
macro_rules! min {($ a : expr $ (, ) * ) => {{$ a } } ; ($ a : expr , $ b : expr $ (, ) * ) => {{std :: cmp :: min ($ a , $ b ) } } ; ($ a : expr , $ ($ rest : expr ) ,+ $ (, ) * ) => {{std :: cmp :: min ($ a , min ! ($ ($ rest ) ,+ ) ) } } ; }
macro_rules! chmin {($ base : expr , $ ($ cmps : expr ) ,+ $ (, ) * ) => {{let cmp_min = min ! ($ ($ cmps ) ,+ ) ; if $ base > cmp_min {$ base = cmp_min ; true } else {false } } } ; }
macro_rules! chmax {($ base : expr , $ ($ cmps : expr ) ,+ $ (, ) * ) => {{let cmp_max = max ! ($ ($ cmps ) ,+ ) ; if $ base < cmp_max {$ base = cmp_max ; true } else {false } } } ; }


#[fastout]
fn main() {
    input!{
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }
    println!("{}", max!{a*c, a*d, b*c, b*d});
}


Measured memory_bytes: 2196
#include <stdio.h>

#define N 2000
#define M 2000

int solve(int,int);

int n,q,A[N],m[M];

int main(){

  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){

    scanf("%d",&A[i]);

  }

  scanf("%d",&q);

  for(i=0;i<q;i++){

    scanf("%d",&m[i]);

  }

  for(i=0;i<q;i++){

    j=0;

    if(solve(j,m[i])==1) printf("yes\n");
    if(solve(j,m[i])==0) printf("no\n");

 

    }
  
  return 0;
}

int solve(int i ,int m){

  int res;


  if(m==0) return 1;

  if(i>=n) return 0;

  res=solve(i+1,m) || solve(i+1,m-A[i]);

}
  

Measured memory_bytes: 588
w,h,n=map(int,input().split())
x1,x2,y1,y2=0,w,0,h
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1 and x > x1:
    x1 = x
  elif a==2 and x < x2:
    x2 = x
  elif a==3 and y > y1:
    y1 = y
  elif a==4 and y < y2:
    y2 = y
if x1 > x2 or y1 > y2:
  print(0)
else:
  print((x2 - x1)*(y2 - y1))

Measured memory_bytes: 9204
#include<iostream>

using namespace std;

bool check(string s)
{
    int i, j;
    for (i = 0, j = s.length() - 1; i < j; i++, j--) {
        if (s[i] != s[j]) {
            return false;
        }
    }
    return true;
}

int main()
{
    string s;
    string sub1;
    string sub2;

    cin >> s;
    sub1 = s.substr(0, (s.length() - 1) / 2);
    sub2 = s.substr((s.length() + 3) / 2 - 1);

    if (!check(s)) {
        cout << "No" << endl;
        return 0;
    }
    if (!check(sub1)) {
        cout << "No" << endl;
        return 0;
    }
    if (!check(sub2)) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    return 0;
}


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  int n_takahashi = 0;
  while(C > 0){
    C -= B;
    n_takahashi++;
  }
  
  int n_aoki = 0;
  while(A > 0){
    A -= D;
    n_aoki++;
  }
  
  if (n_takahashi <= n_aoki) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

import fractions
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

import math
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import collections
def main():
    A,B = map(int, input().split())

    da = make_divisors(A)
    db = make_divisors(B)
    cds = set(da) & set (db)
    P = prime_factorize(max(cds))
    P.append(1)
    c = collections.Counter(P).keys()
    x = cds & set(c)
    print(len(x))


if __name__ == '__main__':
    main()


Measured memory_bytes: 7252
import sys
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N, M = map(int, readline().split())
ab = map(int, read().split())
ab = sorted(zip(ab, ab), key=itemgetter(1))

right_island = ab[0][1]
answer = 1

for i, j in ab:
    if i >= right_island:
        answer += 1
        right_island = j

print(answer)

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

using namespace std;


int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL); 
  int n; 
  cin >> n;
  vector<int> wrong;
  for (int i = 1; i <= n; i++) {
    int x; 
    cin >> x;
    if (x == i) wrong.push_back(i);
  }
  int m = wrong.size();
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    int cntaux = 1;
    while (i+1 < m and wrong[i+1] == wrong[i]+1) {
     cntaux++;
     i++;
    }
    cnt += (cntaux+1)/2;
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 892
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
#define N (ll)(1e6+3)
#define INF (ll)(1e18+3)
#define MOD (ll)(1e9+7)
 
#define ll long long
#define rep(i,a,n) for(ll i = a; i < n; i++)
#define per(i,a,n) for(ll i = n-1; i >= a; i--)
 
//using namespace __gnu_pbds;
using namespace std;
 
// typedef
// tree<
//     pair<ll,ll>,
//     null_type,
//     less<pair<ll,ll>>,
//     rb_tree_tag,
//     tree_order_statistics_node_update>
// ordered_set;

ll n;
vector<pair<ll,ll> > g[N];

ll total;
ll sz[N];
bool found = false;
ll mnedgeAll = INF;

void dfs(ll u, ll par) {
    sz[u] = 1;
    rep(i,0,g[u].size()) {
        ll ch = g[u][i].first;
        if (ch == par) continue;
        dfs(ch,u);
        sz[u] += sz[ch];
    }
    bool cen = (n-sz[u])*2 <= n;
    ll mnedge = INF;
    rep(i,0,g[u].size()) {
        ll ch = g[u][i].first;
        mnedge = min(mnedge, g[u][i].second);
        if (ch == par) continue;
        ll mn = min(sz[ch],n-sz[ch]);
        ll cost = g[u][i].second;
        total += 2*mn*cost;

        if (sz[ch]*2 == n) {
            total -= cost;
            found = true;
        }
        cen &= sz[ch]*2 <= n;
    }
    if (cen) {
        mnedgeAll = min(mnedgeAll, mnedge);
    }
}

void solve() {
    cin >> n;
    rep(i,0,n-1) {
        ll a, b, c; cin >> a >> b >> c;
        a--, b--;
        g[a].push_back({b,c});
        g[b].push_back({a,c});
    }

    dfs(0,0);
    if (!found) total -= mnedgeAll;
    cout << total << endl;
}
 
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

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

using namespace std;

int ans[5][10];
double ch[] = {1.1,0.6,0.2,0.1};
double d[3];

int main(){
	int l,r;
//	int la = 0,lb = 0,lc = 0,ld = 0,ra = 0,rb = 0,rc = 0,rd = 0;
	while(cin >> d[0] >> d[1]){
//		if(d[0] + d[1] == 0)break;
		for(int l = 0;l < 2;l++){
			for(int i = 0;i < 4;i++){
				if(d[l] >= ch[i]){
					ans[l][i]++;
					break;
				}
			}
		}
	}
	for(int i = 0;i < 4;i++){
		cout << ans[0][i] << " " <<  ans[1][i] << endl; 
	}
}


Measured memory_bytes: 3056
N = int(input())
ANS = []
for i in range(N) :
    if i != 0 and i != N :
        a = str(i)
        b = str(N-i)
        L = []
        K = []
        for j in range(len(a)) :
            c = int(a[j])
            L.append(c)
        for k in range(len(b)) :
            d = int(b[k])
            K.append(d)
        ans = sum(L)+sum(K)
        ANS.append(ans)
print(min(ANS))



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

int main() {
  int A, B;
  cin >> A >> B;
  
  int ans;
  if (A >= 13) ans = B;
  else if (6 <= A && A <= 12) ans = B / 2;
  else ans = 0;

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

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

struct point {
    double x, y;
    double dist(const point& p) {
        return sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y));
    }
};

set<string> bag;
void generarPermutaciones(string s, int l, int r) {
    if(l == r) {
        bag.insert(s);
    } else {
        for(int i = l; i <= r; i++) {
            swap(s[l], s[i]);
            generarPermutaciones(s, l+1, r);
            swap(s[l], s[i]);
        }
    }
}

int main() {
    int n;
    cin >> n;
    string per;
    point p[n];
    for(int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y;
        per.push_back(i+'0');
    }

    generarPermutaciones(per, 0, n-1);
    double ans = 0.0;
    for(auto i : bag) {
        for(int j = 0; j < (int)i.size()-1; j++) {
            int ind = i[j]-'0';
            int prox = i[j+1]-'0';
            ans += p[ind].dist(p[prox]);
        }
    }

    ans /= (int)bag.size();
    printf("%.6lf", ans);
    return 0;
}

Measured memory_bytes: 3968
from collections import defaultdict


def eratos(n):
    if n <= 1:
        return []
    used = [False] * n
    used[0] = used[1] = True
    primes = []
    for i in range(n):
        if used[i] is False:
            primes.append(i)
            for j in range(i * 2, n, i):
                used[j] = True
    return primes


n = int(input())
primes = eratos(n + 1)
primes_dict = defaultdict(lambda: zip(primes, [1] * len(primes)))
X = n
d = 2
defactors = defaultdict(int)

for i in range(2, n + 1):
    if primes_dict[i] == 1:
        defactors[i] += 1
        continue

    for prime in primes:
        if i == 1:
            continue
        while i % prime == 0:
            defactors[prime] += 1
            i //= prime

ans = 1
mod = 10 ** 9 + 7
for key, value in defactors.items():
    ans = (ans * (value + 1)) % mod 
print(ans)



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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll n;
  cin >> n;
  if (n == 1)
    cout << 0 << endl;
  else {
    cout << (n - 1) * n / 2 << endl;
  }
}


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

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

int N, M;
ll K;
ll X[100010], D[100010];
int A[100010], P[100010], R[100010], T[100010];

void solve(ll k) {
    if(k == 1) {
        for(int i = 0; i < N - 1; i++) R[i] = P[i];
        return;
    }
    solve(k / 2);

    for(int i = 0; i < N - 1; i++) T[i] = R[ R[i] ];
    for(int i = 0; i < N - 1; i++) R[i] = T[i];

    if(k % 2) {
        for(int i = 0; i < N - 1; i++) T[i] = R[ P[i] ];
        for(int i = 0; i < N - 1; i++) R[i] = T[i];
    }
}

int main() {
    scanf("%d", &N);

    for(int i = 0; i < N; i++) {
        scanf("%lld", &X[i]);
    }
    for(int i = 0; i < N - 1; i++) {
        D[i] = X[i + 1] - X[i];
    }

    scanf("%d %lld", &M, &K);

    for(int i = 0; i < M; i++) {
        scanf("%d", &A[i]);
        A[i]--;
    }
    for(int i = 0; i < N - 1; i++) P[i] = i;
    for(int i = 0; i < M; i++) {
        swap(P[ A[i] - 1 ], P[ A[i] ]);
    }

    solve(K);

    printf("%lld\n", X[0]);
    ll prev = X[0];
    for(int i = 1; i < N; i++) {
        printf("%lld\n", prev + D[ R[i - 1] ]);
        prev += D[ R[i - 1] ];
    }
}


Measured memory_bytes: 4352
#include "stdio.h"
#include "string.h"

int main(int argc, char const *argv[]) {
  char S[200000];
  scanf("%s", S);
  int N=strlen(S);
  // for (size_t i = 0; i < N; i++) {
  //   printf("%c", S[i]);
  // }
  int Si[N];
  for (size_t i = 0; i < N; i++) {
    Si[i]=S[i]-'0';
  }
  // for (size_t i = 0; i < N; i++) {
  //   printf("%d", Si[i]);
  // }
  int zero=0;
  int one=0;
  for (size_t i = 0; i < N; i++) {
    if (Si[i]==0) {
      zero++;
    }else{
      one++;
    }
  }
  int ans=0;
  if (zero>one) {
    ans=N-(zero-one);
  }else{
    ans=N-(-zero+one);
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main() {
  i64 N, X;
  cin >> N >> X;
  auto P = [](i64 N) -> i64 { return (1LL << (N + 1)) - 1; };
  auto C = [](i64 N) -> i64 { return (1LL << (N + 2)) - 3; };
  i64 ans = 0;
  for(int L = N - 1;L >= 0;L--) {
    X--;
    if(X == 0) { cout << ans << endl; return 0; }
    if(X - C(L) < 0) continue;
    X -= C(L);
    ans += P(L);
    if(X == 0) { cout << ans << endl; return 0; }
    X--;
    ans++;
    if(X == 0) { cout << ans << endl; return 0; }
    if(X - C(L) < 0) continue;
    X -= C(L);
    ans += P(L);
    if(X == 0) { cout << ans << endl; return 0; }
    X--;
    cout << ans << endl;
    return 0;
  }
  cout << ans + X << endl;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
const ll mod = 998244353;

int n;
vector<array<int, 2>> v;
ll dp[maxn];

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

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

  sort(v.begin(), v.end());
  vector<pair<int,int>> stk;
  stk.push_back({n, (int)2e9});
  dp[n] = 1;

  for (int i=n-1; i>=0; i--) {
    while (v[i][0]+v[i][1] > stk.back().second) {
      stk.pop_back();
    }

    int take = stk.back().first;
    dp[i] = dp[take]; // if we take ith, we'll have to take everything

    dp[i] +=  dp[i+1]; // don't take ith
    dp[i] %= mod;
    
    stk.push_back({i, v[i][0]});
  }

  dp[0] %= mod;
  dp[0] += mod;
  dp[0] %= mod;
  cout<<dp[0]<<endl;
  return 0;
}
// don't forget to read in the input :^)


Measured memory_bytes: 4340
#include <stdio.h>

typedef struct {
	int s,t,c;
} edge_t;

int getId(int town,int ticket) {
	return ticket*100+town;
}

int main(void) {
	static int edgeNum;
	static int cost[11*100];
	static edge_t edges[500*11*2*2];
	int c,n,m,s,d;
	while(scanf("%d%d%d%d%d",&c,&n,&m,&s,&d)==5 && (c|n|m|s|d)!=0) {
		int i,j;
		int answer;
		edgeNum=0;
		for(i=0;i<m;i++) {
			int a,b,f;
			scanf("%d%d%d",&a,&b,&f);
			a--;b--;
			for(j=1;j<=c;j++) {
				edges[edgeNum].s=getId(a,j);
				edges[edgeNum].t=getId(b,j);
				edges[edgeNum].c=f;
				edgeNum++;
				edges[edgeNum].s=getId(a,j);
				edges[edgeNum].t=getId(b,j-1);
				edges[edgeNum].c=f/2;
				edgeNum++;
				edges[edgeNum].s=getId(b,j);
				edges[edgeNum].t=getId(a,j);
				edges[edgeNum].c=f;
				edgeNum++;
				edges[edgeNum].s=getId(b,j);
				edges[edgeNum].t=getId(a,j-1);
				edges[edgeNum].c=f/2;
				edgeNum++;
			}
			edges[edgeNum].s=getId(a,0);
			edges[edgeNum].t=getId(b,0);
			edges[edgeNum].c=f;
			edgeNum++;
			edges[edgeNum].s=getId(b,0);
			edges[edgeNum].t=getId(a,0);
			edges[edgeNum].c=f;
			edgeNum++;
		}
		for(i=0;i<11*100;i++)cost[i]=100000000;
		cost[getId(s-1,c)]=0;
		for(i=0;i<11*100;i++) {
			for(j=0;j<edgeNum;j++) {
				if(cost[edges[j].t]>cost[edges[j].s]+edges[j].c) {
					cost[edges[j].t]=cost[edges[j].s]+edges[j].c;
				}
			}
		}
		answer=100000000;
		for(i=0;i<=c;i++) {
			if(cost[getId(d-1,i)]<answer)answer=cost[getId(d-1,i)];
		}
		printf("%d\n",answer);
	}
	return 0;
}

Measured memory_bytes: 776
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        if (n == 1) {
            System.out.println(problem112a());
        } else {
            int a = Integer.parseInt(br.readLine());
            int b = Integer.parseInt(br.readLine());
            System.out.println(problem112a(a, b));
        }
    }

    private static String problem112a() {
        return "Hello World";
    }

    private static int problem112a(int a, int b) {
        return a + b;
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
double dist(double x1, double x2, double y1, double y2) {
    double dx = x1 - x2;
    double dy = y1 - y2;
    return sqrt(dx * dx + dy * dy);
}
/* main */
int main(){
    int N;
    cin >> N;
    vector<double> x(N), y(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
    vector<int> v(N);
    for (int i = 0; i < N; i++) v[i] = i;
    double ans = 0;
    double cnt = 0;
    do {
        double tmp = 0;
        for (int i = 0; i < N - 1; i++) {
            ans += dist(x[v[i]], x[v[i+1]], y[v[i]], y[v[i+1]]);
        }
        cnt++;
    } while (next_permutation(v.begin(), v.end()));
    cout << fixed << setprecision(10) << ans / cnt << '\n';
}


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

using namespace std;

int f(int n)
{
    if(n % 2 == 0)
    {
        return n >> 1;
    }
    else
    {
        return 3 * n + 1;
    }
}

int main()
{
    int s;
    vector<int> a;
    map<int, bool> appeared;

    cin >> s;

    a.push_back(s);
    appeared[s] = true;

    for(int i = 1; i <= 1000000; ++i)
    {
        a.push_back(f(a.back()));
        if(appeared.count(a.back()) != 0)
        {
            cout << i + 1 << endl;
            break;
        }
        appeared[a.back()] = true;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int []A = new int[N];
			//Map<Integer,Integer> S = new TreeMap<Integer,Integer>();
			int[] B  = new int[N];
			
			for(int i = 1;i<N;i++) {
				A[i] = scan.nextInt();
				B[A[i]-1]++;
			}
			
			for(int i = 0;i<N;i++) {
				System.out.println(B[i]);
			}
			
			
			
			
			
			
			
		}
		
		
	}
		

}


Measured memory_bytes: 61604
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>
#include<chrono>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));


struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

ll mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll)((ld)a * b / mod) * mod;
        if (val < 0) val += mod;
        if (val >= mod) val -= mod;
        return val;
    }
    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2) val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }
    ll inv(ll a) {
        return poww(a, mod - 2);
    }
}

ll const maxn = 3e5+5;

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("output.txt", "w", stdout);
    char c; cin >> c;
    if (c <= 'Z' and c >= 'A') {
        cout << 'A';
    } else {
        cout << 'a';
    }

  
    return 0;
}

/*

*/

Measured memory_bytes: 3580
n = int(input())
a = list(map(int,input().split()))
c = 0
for i in range(n-2):
    if a[i] < a[i+1] and a[i+1] < a[i+2]:
        c+= 1
    elif a[i] > a[i+1] and a[i+1] > a[i+2]:
        c+= 1
print(c)

Measured memory_bytes: 9176
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), std::greater<char>());
    int idx = 0;
    while(idx < s.size() && idx < t.size())
    {
        if(s[idx] < t[idx])
        {
            cout << "Yes" << endl;
            return 0;
        }
        else if (s[idx] > t[idx])
        {
            cout << "No" << endl;
            return 0;
        }
        else
        {
            ++idx;
        }
    }
    if (s.size() < t.size())
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){

  string s;
  cin >> s;

  P(s.erase(sz(s)-8));
  
  return  0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String x = sc.next();

        int n = 0;

        for (int i = 0; i < x.length(); i++) {
            n += Character.getNumericValue(x.charAt(i));
        }

        if (n % 9 == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

        sc.close();

        }

    }



Measured memory_bytes: 40156
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long int
#define MAXN 1000

using namespace std;

typedef vector<int,int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

bool isPrime(int n){
    if(n == 2) return true;
    if(n%2 == 0) return false;
    for(int i = 3; i <= sqrt(n); i++){
        if(n%i == 0)
            return false;
    }
    return true;
}

int nextPrime(int n){
    while(!isPrime(n)){
        n++;
    }
    return n;    
}

void solve(){
    int n;
    cin >> n;
    cout << nextPrime(n) << endl;
}

int main(){
    // int t;
    // scanf("%d", &t);
    // while(t--){
    //     solve();
    // }

    solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
      Scanner sc =new Scanner(System.in);
      int N = sc.nextInt();
      double T = sc.nextDouble();
      double A = sc.nextDouble();
      double[] H = new double[N];
      double min = (double)1000;
      int ans =0;
      for (int i=0; i<N; i++) {
        H[i] = Math.abs((double)T - sc.nextDouble() * 0.006 -A);
        min = Math.min(H[i],min);
      }
      for (int i=0; i<N; i++) {
        if(H[i] == min) {
          ans = i+1;
          break;
        }
      }
      System.out.println(ans);
    }
}

Measured memory_bytes: 26068
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x / GCD(x, y) * y;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

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

    vector<int> d(N);
    rep(i, N) cin >> d[i];

    sort(d.begin(), d.end());
    d.erase(unique(d.begin(), d.end()), d.end());

    cout << d.size() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
using namespace std;

const double PI=acos(-1);

int main(){
    long h ;
    cin >> h;

    if(h == 1) cout << 1 << endl;
    else{
        long a = h;
        long cnt = 0, sum = 0;;
        while(a != 0){
            a/=2;
            sum += pow(2, cnt);
            cnt++;
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

#define SIZE 100

int  H, W;
char C[SIZE][SIZE];

int main() {
    std::cin >> H >> W;
    for (int h=0; h<H;++h) {
        for (int w=0; w<W; ++w) {
            std::cin >> C[h][w];
        }
    }
    for (int h=0; h<H; ++h) {
        for (int w=0; w<W; ++w) {
            std::cout << C[h][w];
        }
        std::cout << '\n';
        for (int w=0; w<W; ++w) {
            std::cout << C[h][w];
        }
        std::cout << '\n';
    }
    return 0;
}

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

int main(){
	int a,b,c;
	char s,t;
	int rectangle = 0,diamond = 0;
	while(cin >> a >> s >> b >> t >> c){
		if(a*a + b*b == c*c)rectangle++;
		if(a == b)diamond++;
	}
	cout << rectangle << endl << diamond << endl;
}


Measured memory_bytes: 3108