akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

//#include "atcoder/all"
//using namespace atcoder;

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<ll> x(n), y(m);
	mint h = 0, w = 0;
	rep(i,n){
		cin >> x[i];
		if(i > 0){
			w += (x[i] - x[i-1]) * i * (n-i);
		}
	}
	rep(j,m){
		cin >> y[j];
		if(j > 0){
			h += (y[j] - y[j-1]) * j * (m-j);
		}
	}
	mint ans = h * w;
	cout << ans.x << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)


// Write From This Line
const int mod = 1e9+7;
int main()
{
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	for(ll i = k; i <= n+1 ; i ++){
		ll left, right; // left:= 小さい方からi 個，right:= 大きい方からi個
		left = (i * (i - 1)) / 2;
		right = (i * (n+1 + n-i) )/ 2;
		ans += (right - left) % mod  + 1;
		ans %= mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3560
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define CARD_ALL 52
using namespace std;
int main(){
	int N,conversion=0;
	int num;
	string type;
	cin >> N;
	vector<int> cards(CARD_ALL,0);
	for(int i=0;i<N;i++){
		cin >> type >> num;
		if(type == "S") conversion = num;
		if(type == "H") conversion = num+13;
		if(type == "C") conversion = num+26;
		if(type == "D") conversion = num+39;
		for(int j=1; j<=CARD_ALL; j++){
			if(j == conversion) cards[j] = conversion;
		}
	}
	for(int i=1;i<=cards.size();i++){
		if(cards[i]==0){
			if(0 < i && i < 14) cout << "S " << i << endl;
			else if(14 <= i && i < 27) cout << "H " << i-13 << endl;
			else if(27 <= i && i < 40) cout << "C " << i-26 << endl;
			else cout << "D " << i-39 << endl;
		}
	}
}

Measured memory_bytes: 1208
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll a;
    cin>>a;
    cout<<a+a*a+a*a*a<<endl;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include<string>
#include <chrono>
using namespace std;
using namespace std::chrono;
typedef long long ll;
#define MAX 1000000
vector<int> brr[1000000 + 10];
int main(){

    for(int i = 1 ; i < MAX + 10 ; i++)
        for(int j = i ; j < MAX + 10; j+=i)
            brr[j].push_back(i);
    int n;
    cin >> n;
    int arr[n];
    unordered_map<int , int> m;
    ll res = 0;
    for(int i = 0 ; i < n ; i++)
        cin >> arr[i] , m[arr[i]]++;
    for(int i = 0 ; i < n ; i++){
        bool f = true;
        auto v = brr[arr[i]];
        if(m[arr[i]] > 1)
            continue;
        for(auto it : v){
           // cout<<it<<" ";
            if(it != arr[i] && m[it])
                f = false;
        }
       // cout<<"\n";
        if(f)
            res++;
    }
    cout<<res;
}


Measured memory_bytes: 141148
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int r, D, x;
    cin >> r >> D >> x;
    vector<int> v(11);
    v[0] = x;
    for (int i = 1; i <= 10; i++) {
        v[i] = v[i - 1] * r - D;
    }
    for (int i = 1; i <= 10; i++)
        cout << v[i] << endl;
    return 0;
}

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

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


// std::vector Declaration
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
   os << "[";
   bool a = 1;
   for (auto e : v ) {
      os << (a ? "" : " "); 
      os << e;
      a = 0;
   }
   os << "]";
   return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
   os << "(" << p.first << " " << p.second << ")";
   return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
   os << "{";
   bool a = 1;
   for (auto e : st) {
      os << (a ? "" : " ");
      os << e;
      a = 0;
   }
   os << "}";
   return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
   os << "{";
   bool a = 1;
   for (auto e : mp) {
      os << (a ? "" : " ");
      os << e.first << ":" << e.second;
      a = 0;
   }
   os << "}";
   return os;
}

// std::tuple Debug
template<int N,class Tuple>
void out(ostream &os,const Tuple &t){}
template<int N,class Tuple,class H,class ...Ts>
void out(ostream &os,const Tuple &t){
   if(N)os<<" ";
   os<<get<N>(t);
   out<N+1,Tuple,Ts...>(os,t);
}
template<class ...Ts>
ostream& operator<<(ostream &os, const tuple<Ts...> &t){
   os<<"(";
   out<0,tuple<Ts...>,Ts...>(os,t);
   os<<")";
   return os;
}

// Debug
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl

struct edge { int to, cost; };

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

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

   vector<int> S(N), T(N), X(N);
   for (int i = 0; i < N; ++i) {
      cin >> S[i] >> T[i] >> X[i];
   }

   vector<int> D(Q);
   for (int i = 0; i < Q; ++i) {
      cin >> D[i];
   }


   vector<int> ord(N);
   iota(ord.begin(), ord.end(), 0);
   sort(ord.begin(), ord.end(), [&](int i,int j){ return X[i] < X[j]; });

   set<int> st(D.begin(), D.end());
   st.insert(-IINF);
   st.insert(IINF);

   map<int,int> ans;
   for (auto i : ord) {
      auto l = st.lower_bound(S[i]-X[i]);
      while (*l < T[i]-X[i]) {
         ans[*l] = X[i];
         l = st.erase(l);
      }
   }

   for (int i = 0; i < Q; ++i) {
      cout << (ans[D[i]] == 0 ? -1 : ans[D[i]]) << endl;
   }


   return 0;
}


Measured memory_bytes: 23552
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char s[5];
  char t[5];
  int cot;
  cin >> s;
  cin >> t;
  if(s[0]==t[0])++cot;
  if(s[1]==t[1])++cot;
  if(s[2]==t[2])++cot;
  cout << cot << endl;
}

Measured memory_bytes: 256
x;char s[20];d(int l,int r){x=abs(s[l]-s[r]);return l<0||!s[r]?3:x&&x<3?2+d(l-1,r+1):fmax(d(l-1,r),d(l,r+1));}main(){scanf("%s",s);x=strchr(s,'i')-s;printf("%d\n",d(x-1,x+3));exit(0);}

Measured memory_bytes: 544
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
while(true){
int n;
vector<int> s;
scanf("%d", &n);
if(n == 0)
break;
s.resize(n);
for(int i = 0; i < n; ++i)
scanf("%d", &s[i]);
sort(s.begin(), s.end());
int sum = 0;
for(int i = 1; i < n - 1; ++i)
sum += s[i];
printf("%d\n", sum / (n - 2));
}
return 0;
}

Measured memory_bytes: 1052
// inputに入力データ全体が入る
function Main(input) {
  
    var M = parseInt(input);
    var ans = 48 - M;

    console.log('%d', ans);


  }
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
using Edge=pair<int,ll>;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// g++ -o a a.cpp -Wall -lm -std=c++14

int main(){
    int n;int a[MAX];int q;int b[MAX],c[MAX];
    cin>>n;rep(i,n)cin>>a[i];
    cin>>q;
    rep(i,q)cin>>b[i]>>c[i];
    ll ans[MAX];
    ans[0]=0;
    rep(i,n){
        ans[0]+=a[i];
    }
    map<ll,ll>m;
    rep(i,n){
        m[a[i]]++;
    }
    rep(i,q){
        ll plus=m[b[i]]*(c[i]-b[i]);
        m[c[i]]+=m[b[i]];
        m[b[i]]=0;
        ans[i+1]=ans[i]+plus;
    }
    rep(i,q)cout<<ans[i+1]<<endl;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

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

signed main() {
  int N, M;
  cin >> N >> M;
  priority_queue<int> A;
  rep(i, N) {
    int a;
    cin >> a;
    A.emplace(a);
  }

  rep(i, M) {
    int a = A.top();
    A.pop();
    a /= 2;
    A.emplace(a);
  }

  int ans = 0;
  rep(i,N){
    ans += A.top();
    A.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 1400
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
#define ll long long
ll gi(){
    ll x=0,w=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')w=0,ch=getchar();
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return w?x:-x;
}
int gc(){
    char ch=getchar();
    while(ch<'A'||ch>'Z')ch=getchar();
    return ch;
}
const int N=405;
struct edge{int to,nxt,w;ll cost;}E[N*N];
int n,m,x[N],y[N],t[N],a[N],b[N],L[N],R[N],D[N],U[N],head[N],cnt,S,T,vis[N],pe[N];
ll v[N],dis[N],ans;queue<int>Q;
void link(int u,int v,ll w){
    E[++cnt]=(edge){v,head[u],1,w};head[u]=cnt;
    E[++cnt]=(edge){u,head[v],0,-w};head[v]=cnt;
}
bool spfa(ll &res){
    memset(dis,63,sizeof(dis));
    dis[S]=0;Q.push(S);
    while(!Q.empty()){
        int u=Q.front();Q.pop();vis[u]=0;
        for(int i=head[u],v;i;i=E[i].nxt)
            if(E[i].w&&dis[v=E[i].to]>dis[u]+E[i].cost){
                dis[v]=dis[u]+E[i].cost;pe[v]=i;
                if(!vis[v])vis[v]=1,Q.push(v);
            }
    }
    if(dis[T]==dis[0])return false;res+=dis[T];
    for(int i=T;i!=S;i=E[pe[i]^1].to)--E[pe[i]].w,++E[pe[i]^1].w;
    return true;
}
ll cal(int k){
    for(int i=1;i<=k;++i)L[i]=D[i]=0,R[i]=U[i]=233;
    for(int i=1;i<=m;++i)
        if(b[i]<k){
            if(t[i]=='L')L[b[i]+1]=a[i]+1;
            if(t[i]=='R')R[k-b[i]]=a[i]-1;
            if(t[i]=='D')D[b[i]+1]=a[i]+1;
            if(t[i]=='U')U[k-b[i]]=a[i]-1;
        }
    for(int i=2;i<=k;++i)L[i]=max(L[i],L[i-1]),D[i]=max(D[i],D[i-1]);
    for(int i=k-1;i;--i)R[i]=min(R[i],R[i+1]),U[i]=min(U[i],U[i+1]);
    memset(head,0,sizeof(head));cnt=1;S=n+k<<1|1;T=n+k+1<<1;
    for(int i=1;i<=n;++i)link(i,n+i,-v[i]-1000000000000000ll);
    for(int i=1;i<=k;++i){
        link(S,n+n+i,0);link(n+n+k+i,T,0);
        for(int j=1;j<=n;++j){
            if(L[i]<=x[j]&&x[j]<=R[i])link(n+n+i,j,0);
            if(D[i]<=y[j]&&y[j]<=U[i])link(n+j,n+n+k+i,0);
        }
    }
    // printf( "t = %d\n" , cnt );
    ll res=0;while(spfa(res));return -res-1000000000000000ll*k;
}
int main(){
    n=gi();
    for(int i=1;i<=n;++i)x[i]=gi(),y[i]=gi(),v[i]=gi();
    m=gi();
    for(int i=1;i<=m;++i)t[i]=gc(),a[i]=gi(),b[i]=gi();
    for(int i=1;i<=n;++i)ans=max(ans,cal(i));
    printf("%lld\n",ans);return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <fstream>
#include <bitset>
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; }

const long long INF = 1LL << 60;
const long long MOD = 1000000007LL;
const long long MAX = 500000LL;
using namespace std;
typedef unsigned long long ull;
typedef  long long ll;


int main()
{
	ll N, M;
	cin >> N >> M;
	vector<vector<pair<ll,ll>>> g(N);
	vector<ll> idg(N, 0);
	vector<ll> dp(N, -1);
	for (ll i = 0; i < M; i++) {
		ll a, b, c;
		cin >> a >> b >> c;
		g[a].push_back(make_pair(b, c));
		idg[b]++;
	}
	queue<ll> q;
	for (ll i = 0; i < N; i++) {
		if (idg[i] == 0) {
			dp[i] = 0;
			q.push(i);
		}
	}
	while (!q.empty()) {
		ll x = q.front();
		q.pop();
		for (pair<ll,ll> xx : g[x]) {
			idg[xx.first]--;
			if (idg[xx.first] == 0) q.push(xx.first);
			chmax(dp[xx.first], dp[x] + xx.second);
		}
	}

	cout << *max_element(dp.begin(), dp.end()) << endl;
	return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(a*b, c) << endl;
}    

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

#define FOR(i,a,b) for(ll i=a; i<b; i++)
#define IN(a) cin>>a
#define OUT(a) cout<<a<<endl

int main(){
  char a;
  IN(a);
  if (isupper(a))
   {
       cout << "A" << endl;
   }
   else
   {
       cout << "a" << endl;
   }
}

Measured memory_bytes: 3628
import sys


def solve(inp):
    N = int(inp.readline().strip())

    for a in range(1, 10):
        for b in range(1, 10):
            if a * b == N:
                return "Yes"
    return "No"


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;
using Graph = vector<vector<int>>;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

void Main()
{
  ll n; cin >> n;
  vll ne(n); rep(i, n) ne[i] = i;
  vll x(n), y(n); rep(i, n) cin >> x[i] >> y[i];
  ld ans = 0.;
  ll kai = 0;
  do
  {
    for(ll i = 1;i < n;i++)
    {
      ll X = x[ne[i - 1]] - x[ne[i]];
      ll Y = y[ne[i - 1]] - y[ne[i]];
      ans += sqrt(X * X + Y * Y);
    }
    kai++;
  } while (next_permutation(all(ne)));
  fin(ans / kai);
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}


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

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))
#define all(v) (v).begin(), (v).end()

int main() {
    int q; cin >> q;
    set<int> s;
    while (q--) {
        int a, x; cin >> a >> x;
        if (a == 0) {
            s.insert(x); cout << s.size() << endl;
            
        } else if (a == 1) {
            cout << s.count(x) << endl;
        } else if (a == 2) {
            s.erase(x);
        } else {
            int y; cin >> y;
            auto b = s.lower_bound(x);
            auto e = s.upper_bound(y);
            for (auto i = b; i != e; i++) {
                cout << *i << endl;
            }
        }
    }
}


Measured memory_bytes: 12352
#include <stdio.h>
#define N 120
#define GRAY 99
#define WHITE 100
#define BLACK 101


void DFS(void);
void DFS_visit(int);


int n,u,k,d[N],f[N],t,color[N],G[N][N];

main(){

  int i,j,v;

  scanf("%d",&n);

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

    scanf("%d%d",&u,&k);

    for(j=1; j<=k; j++){

      scanf("%d",&v);

      G[i][v]=1;

    }

  }

  DFS();

  for(i=1; i<=n; i++)
 printf("%d %d %d\n",i,d[i],f[i]);
   

  return 0; 

}

void DFS(void){

  int i;

  for(i=1; i<=n; i++){
    color[i]=WHITE;
    t=0;
  }
  
  for(i=1; i<=n; i++){
    if(color[i]==WHITE)
      DFS_visit(i);
    
  }

}



void DFS_visit(int u2){

  int i;

  color[u2]=GRAY;

  d[u2]=++t;

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

    if(G[u2][i]==1 && color[i]==WHITE)
      DFS_visit(i);
  }

  color[u2]=BLACK;

  f[u2]=++t;

}

Measured memory_bytes: 648
#include<stdio.h>
int main() {
  int n,l,w,v;
  scanf("%d %d", &n,&l);
  w = n*(l-1)+n*(1+n)/2;
  if(l>0){
      v = w-l;
  }
  else if(l<=0 && l+n-1>=0){
      v = w;
  }
  else if(l+n-1<0){
      v = w-(l+n-1);
  }
  printf("%d",v);
}


Measured memory_bytes: 128
#include<stdio.h>
using namespace std;
 
int main(){
    int n,a,min,max;
    long sum;
    min = 1000000;
    max = -1000000;
    sum = 0;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d",&a);
        sum += a;
        if(a < min){
            min = a; 
        }
        if(a > max){
            max = a;
        }
    }
    printf("%d %d %ld\n",min,max,sum);

    return 0;
}


Measured memory_bytes: 2764
using System;

class MyClass
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        int c = int.Parse(str[2]);
        if (a <= b && b <= c)
        {
            Console.WriteLine("{0} {1} {2}", a, b, c);
        }
        else if (a <= c && c <= b)
        {
            Console.WriteLine("{0} {1} {2}", a, c, b);
        }
        else if (b <= a && a <= c)
        {
            Console.WriteLine("{0} {1} {2}", b, a, c);
        }
        else if (b <= c && c <= a)
        {
            Console.WriteLine("{0} {1} {2}", b, c, a);
        }
        else if (c <= a && a <= b)
        {
            Console.WriteLine("{0} {1} {2}", c, a, b);
        }
        else if (c <= b && b <= a)
        {
            Console.WriteLine("{0} {1} {2}", c, b, a);
        }
    }
}


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

const int N=100010;
struct interval{
	int l,r;
	bool operator<(const interval q)const{
		return r<q.r;
	}
}s[N];
int n;
int maxl[N],lb[N],rb[N];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d %d",&s[i].l,&s[i].r);
	sort(s+1,s+1+n);
	int firl=s[1].l;
	for(int i=n;i>=1;i--) maxl[i]=max(maxl[i+1],s[i].l);
	int now=2,ans=0;
	while(now<=n){
		int tmp=now;
		while(now<=n && s[now].r==s[now+1].r) now++;
		lb[tmp-1]=rb[now+1]=0;
		for(int i=tmp;i<=now;i++) lb[i]=max(lb[i-1],s[i].l);
		for(int i=now;i>=tmp;i--) rb[i]=max(rb[i+1],s[i].l);
		int op=0;
		for(int i=tmp;i<=now;i++){
			op=max(lb[i-1],max(rb[i+1],maxl[now+1]));
			ans=max(ans,max(s[1].r-min(max(firl,op),s[1].r+1)+1+s[i].r-s[i].l+1,s[1].r-firl+1+s[i].r-min(max(s[i].l,op),s[i].r+1)+1));
		}
		firl=min(max(firl,lb[now]),s[1].r+1);
		now++;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PII pair < int , int >
const int _ = 1e5 + 7;
ll fa[_] , sz[_] , N , M , Q;
vector < PII > to0 , to1;
int find(int x){return fa[x] == x ? x : (fa[x] = find(fa[x]));}
void merge(int p , int q){if((p = find(p)) == (q = find(q))) return; fa[p] = q; sz[q] += sz[p];}
signed main(){
	ios::sync_with_stdio(0);
	cin >> N >> M >> Q;
	for(int i = 1 ; i <= N ; ++i) sz[fa[i] = i] = 1;
	for(int i = 1 ; i <= Q ; ++i){
		int A , B , C; cin >> A >> B >> C; ++A; ++B;
		if(C == 0) to0.push_back(PII(A , B));
		else to1.push_back(PII(A , B));
	}
	for(auto t : to0) merge(t.first , t.second);
	for(auto t : to1) if(find(t.first) == find(t.second)){puts("No"); return 0;}
	ll mn = 0 , mx = 0 , cnt = 0; bool flg = 1;
	for(int i = 1 ; i <= N ; ++i) if(find(i) == i){++cnt; mn += sz[i] - 1; mx += sz[i] - 1;}
	for(int i = 1 ; i <= N ; ++i) if(fa[i] == i) sz[i] = 1; else sz[i] = 0;
	for(auto t : to1) merge(t.first , t.second);
	for(int i = 1 ; i <= N ; ++i)
		if(fa[i] == i && sz[i] == 2 && cnt == 2){puts("No"); return 0;}
		else if(sz[i] >= 2) flg = 0;
	mn += cnt - flg; if(M < mn){puts("No"); return 0;}
	mx += cnt * (cnt - 1) / 2; if(M > mx){puts("No"); return 0;}
	puts("Yes"); return 0;
}

Measured memory_bytes: 2936
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    H,W,K = map(int,input().split())
    grid = [list(input()) for _ in range(H)]
    ans = 0
    for bit in range(1<<H):
        row = [0] * H
        for i in range(H):
            if (bit>>i)&1:
                row[i] = 1
        for bit2 in range(1<<W):
            column = [0] * W
            for i in range(W):
                if (bit2>>i)&1:
                    column[i] = 1
            cnt = 0
            for i in range(H):
                for j in range(W):
                    if row[i] == 1 or column[j] == 1:
                        continue
                    if grid[i][j] == '#':
                        cnt += 1
            if cnt == K:
                ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9236
N = int(input())
A, B = map(int, input().split())
p_list = list(map(int, input().split()))

first, second, third = [], [], []
for idx, p in enumerate(p_list):
    if p < A+1:
        first.append(idx)
    elif p < B+1:
        second.append(idx)
    elif p > B:
        third.append(idx)
print(min([len(first), len(second), len(third)]))

Measured memory_bytes: 3064
import sys

n, k = map(int, input().split(" "))
a = [-1] + list(map(int, input().split(" ")))

i = 1
head = []
used = {}
roop = []

index = 0
for _ in range(k):
    index += 1
    i = a[i]
    if i in used:
        head = [ k for k, v in sorted(used.items(), key=lambda x:x[1]) if v < used[i]]
        roop = [ k for k, v in sorted(used.items(), key=lambda x:x[1]) if v >= used[i]]
        if len(head) >= k:
            print(head[k-1])
        else:
            x = (k - 1 - len(head)) % len(roop)
            print(roop[x])
            sys.exit()
    else:
        used[i] = index

print([ k for k, v in sorted(used.items(), key=lambda x:x[1])][k-1])

Measured memory_bytes: 116972
import java.util.Scanner;
import java.util.Arrays;

class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		
		while(true){
			int n = scanner.nextInt();
			int x = scanner.nextInt();
			int count = 0;

			if(n == 0 && x == 0){
				break;
			}

			for(int i = 1; i < x/3; i++){
				for(int j = i+1; j < n; j++){
					int k = x - i - j;
					if(k > j && k <= n){
					    count ++;
					}
				}
			}
			System.out.println(count);
		}
	}

}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
void debug_out() {cerr << endl;}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {cerr << " " << to_string(H), debug_out(T...);}

int main() {
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
#define debug(...) 3
    fastIO;
#endif
    int x;
    cin>>x;
    cout<<(x^1)<<endl;
    return 0;
}


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

int main(int argc, char *argv[])
{
	char str[201], tmp[201];
	int i, h, s_cnt;

	memset(str, '\0', sizeof(str));
	
	while (1) {
		scanf("%s", str);

		if (str[0] == '-') {
			break;
		}

		scanf("%d", &s_cnt);
		int len = strlen(str);

		for (i = 0; i < s_cnt; i++) {
			scanf("%d", &h);
			memset(tmp, '\0', sizeof(tmp));
			memcpy(tmp, &str[h], len - h);
			memcpy(&tmp[len - h], str, h);
			memset(str, '\0', sizeof(str));
			memcpy(str, tmp, len);
		}

		printf("%s\n", str);

	}

	return 0;
}

Measured memory_bytes: 604
p = [True for _ in range(10**5)]
p[0] = False
p[1] = False
for i in range(4,10**5,2):
    p[i] = False
for i in range(3,10**5,2):
    if p[i]:
        d = 2
        while i*d < 10**5:
            p[i*d] = False
            d += 1
n = [0 for _ in range(10**5)]
for i in range(1,10**5,2):
    n[i] = n[i-2]
    if p[i] and p[(i+1)/2]:
        n[i] = n[i-2] + 1

q = int(raw_input())
for _ in range(q):
    l,r = map(int, raw_input().split())
    k = n[r] - n[l]
    if l > 1 and n[l] > n[l-2]:
        k += 1
    print k


Measured memory_bytes: 7788
#ifndef _WIN32
#include<iostream>
#endif
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<string>
#include<stdlib.h>
const int INF = 11 * 4 * 51 * 4 * 114514;
using namespace std;
#define rep(i,n) for(auto i=(n)*0;i<n;i++)
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef vector<VVV> VVVV;

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

	int w, h;
	while (cin >> w >> h, w + h){
		int R = h;
		int C = w;


		vector<string> S(R);
		rep(i, R)rep(j,C){
			string s;
			cin >> s;
			S[i] += s;
		}
		using P=tuple<int, int>;
		using PPP = tuple<int,int, P>;
		vector<P> goal;
		vector<P> start;
		vector<vector<int>> cost(R + 10, vector<int>(C + 10,INF));
		rep(r, R)rep(c, C){
			if (S[r][c] == 'S'){
				cost[r + 5][c + 5] = 0;
				start.push_back(P(r + 5, c + 5));
			}
			else if (S[r][c] == 'T'){
				cost[r + 5][c + 5] = 0;
				goal.push_back(P(r + 5, c + 5));
			}
			else if (S[r][c] == 'X')continue;
			else{
				cost[r + 5][c + 5] = S[r][c] - '0';
			}
		}
		R += 10, C += 10;
		VVV dp(2 ,VV(R,V(C, INF)));
		int m = start.size();
		auto check = [&](int lr, int lc, int rr, int rc){return lc < rc&&abs(lc - rc) + abs(lr - rr) <= 3; };
		priority_queue<PPP> que;
		rep(i, m){
			int r,c;
			tie(r, c) = start[i];
			dp[0][r][c] = 0;
			dp[1][r][c] = 0;
			que.push(PPP(0, 0, P(r, c)));
			que.push(PPP(0, 1, P(r, c)));
		}
		while (!que.empty()){
			auto v = que.top(); que.pop();
			int d, type; P pos;
			tie(d,type, pos) = v;
			int r, c;
			tie(r, c) = pos;
			if (dp[type][r][c]<-d)continue;
			if (type == 0){
				rep(i, 3)rep(j, 5){
					int nc = c + i + 1;
					int nr = r - 2 + j;
					if (check(r, c, nr, nc) && dp[1-type][nr][nc]>dp[type][r][c] + cost[nr][nc]){
						dp[1 - type][nr][nc]=dp[type][r][c] + cost[nr][nc];
						que.push(PPP(-dp[1-type][nr][nc],1-type, P(nr, nc)));
					}
				}
			}
			else
				rep(i, 3)rep(j, 5){
				int nc = c - i - 1;
				int nr = r - 2 + j;
				if (check(nr, nc, r, c) && dp[1 - type][nr][nc]>dp[type][r][c] + cost[nr][nc]){
					dp[1 - type][nr][nc] = dp[type][r][c] + cost[nr][nc];
					que.push(PPP(-dp[1 - type][nr][nc], 1 - type, P(nr, nc)));
				}
				
			}
		}
		int res = INF;

		m = goal.size();
		rep(i, m){
			int r, c;
			tie(r, c) = goal[i];
			res = min({ res, dp[0][r][c], dp[1][r][c] });
		}
		if (res == INF)cout << -1 << endl;
		else
		cout << res << endl;
	}


	return 0;
}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   int l=s.length(),c=0,i,j,n;
   for(i=0;i<l;i++)
   {
       n=0;
       for(j=0;j<l;j++)
       {
           if(s[i]==s[j]) n++;

       }
       if(n%2==0) c++;
           else break;
   }
   if(c==l) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
    return 0;
}





Measured memory_bytes: 3596
#include<stdio.h>
#include<string.h>
int main(void) {
	int i;
	char s[20];
	scanf("%s", s);
	for(i=strlen(s)-1; i >= 0; i--) {
		printf("%c", s[i]);
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 524
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[derive(PartialEq, PartialOrd)]
pub struct OrdFloat<T>(pub T);

impl<T: PartialEq> Eq for OrdFloat<T> {}

impl<T: PartialOrd> Ord for OrdFloat<T> {
    fn cmp(&self, other: &OrdFloat<T>) -> Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

fn main() {
    let (d, g) = read!(i32, i32);
    let pc: Vec<(i32, i32)> = read![i32, i32; d];

    let mut ans = 100000000;
    // 完全に解く問題をbit全探索する
    for i in 0..2i32.pow(d as u32) {
        let mut rest = g;
        let mut count = 0;
        let mut deleted_idx = vec![];
        for j in 0..d {
            if 1 << j & i != 0 {
                // 100(j+1) 点の問題を全部解く
                rest -= 100 * (j + 1) * pc[j as usize].0 + pc[j as usize].1;
                count += pc[j as usize].0;
                deleted_idx.push(j);
            }
        }

        if rest <= 0 {
            ans = min(ans, count);
            continue;
        }

        let exist: Vec<_> = pc
            .iter()
            .enumerate()
            .filter(|&(x, _)| !deleted_idx.contains(&(x as i32)))
            .map(|(x, &y)| (x, y.0, y.1))
            .collect();

        for &e in &exist {
            let point_per_q = 100 * (e.0 as i32 + 1);
            let num = if rest % point_per_q == 0 {
                rest / point_per_q
            } else {
                (rest / point_per_q) + 1
            };
            if num < e.1 {
                ans = min(ans, count + num);
            } else {
                continue;
            }
        }
    }

    println!("{}", ans);
}


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
  string s;
  cin >> s;
  int n = s.size();
  ll ans = 0, c = 0;
  REP(i, n){
    if(s[n-1-i] == 'B'){
      ans += (ll)i-c;
      c++;
    }
  }
  cout << ans << endl;
}

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

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

#define pb     push_back
#define mp     make_pair
#define all(v) v.begin() , v.end()
#define allr(v) v.rbegin(), v.rend()
const ll INF =  0x3f3f3f3f;
const int MOD = 1e9+7;
const int MAX = 55;

ld ncr[MAX][MAX];

void pascal() {
	for (int i = 0; i < MAX; ++i) {
		ncr[i][0] = ncr[i][i] = 1;
		for (int j = 1; j < i; ++j) {
			ncr[i][j] = ncr[i-1][j-1] + ncr[i-1][j];
		}
	}
}

ld power(int a, int b){
	ld ans = 1;
	while(b--)
		ans = ans * a;
	return ans;
}


int n, p, x, y, d;

int main(int argc, char const *argv[])
{
  // ios_base::sync_with_stdio(false);
  
  // #ifndef ONLINE_JUDGE
  // freopen("in","r",stdin);
  // freopen("out","w",stdout);
  // #endif

  pascal();

  scanf("%d %d" , &n, &p);

  for(int i = 1 ; i <= n ; i++){
  	scanf("%d" , &d);
  	if(d&1)
  		y++;
  	else
  		x++;
  }

  ld ans;

  if(n == 1){
  	if(p == 1){
  		if(y)
  			ans = 1;
  		else
  			ans = 0;
  	}
  	else{
  		if(x)
  			ans = 2;
  		else
  			ans = 0;
  	}
  }	
  else if(p == 1){
  	ans = power(2, x);
  	ld temp = 0;
  	int z = 1;

  	while(z <= y){
  		temp = temp + ncr[y][z];
  		z+=2;
  	}
  	ans = ans * temp;
  	// if(y == 0)
  }
  else{
  	ans = power(2, x);
  	ld temp = 0;
  	int z = 0;

  	while(z <= y){
  		temp = temp + ncr[y][z];
  		z+= 2;
  	}
  	ans = ans * temp;
  }

  printf("%.0Lf" , ans);

  return 0;
}  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
signed main(){
	int a=0,b=0;
	string s;
	cin>>s;
	f(i,s.size()){
		if(s[i]=='0') a++;
		else b++;
	}
	cout<<min(a,b)*2<<endl;
}


Measured memory_bytes: 512
S = input()
N = len(S) + 1

A = [-1] * N

if S[0] == '<':
  A[0] = 0

if S[-1] == '>':
  A[-1] = 0

for i in range(1, N-1):
  if S[i-1] == '>' and S[i] == '<':
    A[i] = 0

for i in range(N-1):
  if S[i] == '<':
    A[i+1] = A[i] + 1

for i in range(N-1)[::-1]:
  if S[i] == '>':
    A[i] = max(A[i], A[i+1] + 1)

print(sum(A))

Measured memory_bytes: 23336
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	final long MOD = (long) (1e9 + 7);

	void run() {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int[][] A = new int[H][W];
		int[][] B = new int[H][W];
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < W; ++j) {
				A[i][j] = sc.nextInt();
			}
		}
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < W; ++j) {
				B[i][j] = sc.nextInt();
			}
		}

		boolean[][][] ok = new boolean[H][W][80 * 80 + 10];
		ok[0][0][Math.abs(A[0][0] - B[0][0])] = true;
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < W; ++j) {
				for (int k = 0; k < ok[i][j].length; ++k) {
					if (!ok[i][j][k])
						continue;
					for (int di = 0; di <= 1; ++di) {
						for (int dj = 0; dj <= 1; ++dj) {
							if ((di ^ dj) != 1)
								continue;
							if (i + di < H && j + dj < W) {
								int add = Math.abs(A[i + di][j + dj] - B[i + di][j + dj]);
								for (int sign = -1; sign <= 1; sign += 2) {
									if (Math.abs(k + sign * add) < ok[i][j].length)
										ok[i + di][j + dj][Math.abs(k + sign * add)] |= ok[i][j][k];
								}
							}
						}
					}
				}
			}
		}

		int ans = Integer.MAX_VALUE / 3;
		for (int i = 0; i < ok[H - 1][W - 1].length; ++i) {
			if (ok[H - 1][W - 1][i])
				ans = Math.min(ans, i);
		}
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 67436
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}

int main(){
  LL H,A,i,ans=0;
  scanf("%lld%lld",&H,&A);

  printf("%lld\n",dup(H,A));
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end() 
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define forn(i, n) for(int i=0;i<(n);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int main() {
	long double l; cin >> l;
	cout << fixed << setprecision(9) << pow(l/3, 3);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
    ll a;
    double b;
    cin >> a >> b;
    ll ib = b*100+0.5; //小数はなるべく整数で扱う。
    a *= ib; //+0.5は切り捨て対策。
    a /= 100;
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 3608
#include "stdio.h"

int main()
{
	int input,max = 0;
	int cnt[100]={0};
	int i,ret;

	for(i=0; i < 100; i++) cnt[i]=0;
	
	for(i=0; i < 100; i++)
	{
		ret = scanf("%d", &input);
		if(ret == 1)
		{
			if(input < 1 || input > 100)
			{
				return 0;
			}
			else
			{
				cnt[input-1]++;
			}
		}
		else
		{
			break;
		}
		if(max < cnt[input-1]) max = cnt[input-1];
	}

	for(i=0; i < 100; i++)
	{
		if(max == cnt[i])
		{
			printf("%d\n", i+1);
		}
	}
	return 0;
}


Measured memory_bytes: 2120
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        long A;
        long B;
        long ans;

        Scanner sc = new Scanner(System.in);
        A = sc.nextInt();
        B = sc.nextInt();
        ans = A * B / div(A, B);
        System.out.println(ans);
    }

    public static long div(long i, long j) {
        long l, s;
        if (i>j) { l = i; s = j;}
        else {s = i; l = j;}
        if (l % s != 0) return div(s, l%s);
        else return s;
    }
}


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

// from https://atcoder.jp/contests/abc138/submissions/7012551
vector<int> to[200005];
vector<int> ans;

void dfs(int v,int p=-1) {
    for (int u:to[v]) {
        if (u==p) continue;
        ans[u]+=ans[v];
        dfs(u,v);
    }
}


int main(){
    int mod=1000000007;
    int n,q;
    scanf("%d %d",&n,&q);
    for (int i=1;i<n;i++) {
        int a,b;
        scanf("%d %d",&a,&b);
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    ans.resize(n);
    for (int i=0;i<q;i++) {
        int p,x;
        scanf("%d %d",&p,&x);
        --p;
        ans[p]+=x;
    }
    dfs(0);
    for (int i=0;i<n;i++) printf("%d\n",ans[i]);
    return 0;
}


Measured memory_bytes: 23424
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;






int main(void) {
    int N,D,X;
    int A[100 +1];
    cin >> N >> D >> X;
    for( int i=0; i< N; i++ ) {
        cin >> A[i];
    }

    int c = 0;
    for( int i=0; i<N; i++ ) {
        c+=1;
        int d=1 + A[i];
        while( d <= D ) {
            c+=1;
            d+= A[i];
        }
    }

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

Measured memory_bytes: 256