akhauriyash/Code-Regression huggingface dataset:
/***************************************** START OF TEMPLATE *********************************************/

#include<bits/stdc++.h>

using namespace std;

#define  SPEED          ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  newl           cout<<"\n";
#define  f              first
#define  s              second
#define  pb             push_back
#define  mp             make_pair
#define  sym(s)         s="#"+s+"#";
#define  sqr(v)         v*v;
#define  all(x)         (x).begin(),(x).end()
#define  alll(x, n)     x+1, x+n+1
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  mset1d(a,n,v)  foo(i,0,n+5)a[i]=v;
#define  mset2d(a,n,m,v)foo(i,0,n+5)foo(j,0,m+5)a[i][j]=v;
#define  INP(a,n)       foo(i,1,n) cin>>a[i];
#define  deb1d(a,n)     foo(i,1,n)cout<<a[i]<<" ";newl;
#define  deb2d(a,n,m)   foo(i,1,n){foo(j,1,m){cout<<a[i][j]<<" ";}newl;}    
#define  debm(a)        for(auto it: a)cout<<"{"<<it.f<<","<<it.s<<"}, ";newl;
#define  debp(a,n)      foo(i,1,n)cout<<"{"<<a[i].f<<","<<a[i].s<<"}, ";newl;
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<" ";newl;
#define  deb2(a,b)      cout<<a<<" "<<b;newl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c;newl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d;newl;
#define  ll             long long
#define  ld             long double
#define  pll            pair<ll,ll>
#define  vll            vector<ll>
#define  vpll           vector<pll>

const ld   PI    =  3.14159265358979323846; 
const ll   MOD   =  1e+9+7;
const ll   INF   =  LLONG_MAX;
const int  INFi  =  INT_MAX;
const ll   N     =  2e+5+8;

vll adj[N]; ll vis[N];
ll dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

ll test_cases = 1; randomINIT;

/*********************************************************************************************************/
/***************************************** VARIABLE DECLARATIONS *****************************************/
ll n,x;


/***************************************** FUNCTION IMPLEMENTATIONS **************************************/



/***************************************** START OF MAIN FUNCTION ****************************************/
void MAIN(ll tc){
    ll cnt =0;
    cin>>n;
    foo(i,1,n){
        cin>>x;
        cnt+=(i&1 && x&1);
    }
    deb1(cnt);
}

int main(){
    SPEED;

    //cin>>test_cases;
    foo(i,1,test_cases){
    MAIN(i);
    }
}

Measured memory_bytes: 8288
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int[] a = new int[n];
			for(int i=0;i<n;i++)a[i]=sc.nextInt();
			int s = 0;
			for(int j=n-1;j>=1;j--){
				for(int i=0;i<j;i++){
					if(a[i+1]<a[i]){
						int t = a[i];
						a[i]=a[i+1];
						a[i+1]=t;
						s++;
					}
				}
			}
			System.out.println(s);
		}
	}
}

Measured memory_bytes: 20800
using System;

public class Test
{
	public static  void Main( )
	{
		string s = Console.ReadLine().Trim();
		string p = Console.ReadLine().Trim();
		s = s+s;
		if( -1 != s.IndexOf( p ) ) {
			Console.WriteLine( "Yes" );
		} else {
			Console.WriteLine( "No" );			
		}
	}
}

Measured memory_bytes: 9816
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(n,v) cout<<#v<<":";for(int i=0;i<n;i++)cout<<v[i]<<" ";cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

int main(){
    int w,h;
    cin>>w>>h;
    ll ans=0;
    vector<ll> p(w);
    rep(i,w){
        cin>>p[i];
        ans+=p[i];
    }
    vector<ll> q(h);
    rep(i,h){
        cin>>q[i];
        ans+=q[i];
    }
    sort(ALL(p));
    sort(ALL(q));
    vector<ll> sump(w+1,0);
    rep(i,w){
        sump[i+1]=sump[i]+p[i];
    }

    //w=p,h=q
    rep(i,h){
        int idx=(lower_bound(ALL(p),q[i])-p.begin());
        idx--;
        ans+=sump[idx+1];
        ans+=q[i]*(w-idx-1);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    ll dx = x2 - x1, dy = y2 - y1;
    cout << string(dy, 'U');
    cout << string(dx, 'R');
    cout << string(dy, 'D');
    cout << string(dx, 'L');
    cout << 'L';
    cout << string(dy+1, 'U');
    cout << string(dx+1, 'R');
    cout << 'D';
    cout << 'R';
    cout << string(dy+1, 'D');
    cout << string(dx+1, 'L');
    cout << 'U' << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include "string.h"
#include <vector>
#include <cstdlib>
#include <cmath>

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<int>A;
	vector<int>B;
	vector<int>C;
	vector<int>D;
	int N,M;
	int a,b,c,d;
	cin >> N >> M;
	for(int i = 0;i < N;i++){
		cin >> a >> b;
		A.push_back(a);
		B.push_back(b);
	}
	for(int j = 0;j < M;j++){
		cin >> c >> d;
		C.push_back(c);
		D.push_back(d);
	}
	long long int minDis = 10e16;
	int dis = 0;
	int index = 0;
	for(int i = 0;i < N;i++){
		for(int j = 0;j < M;j++){
			dis = abs(A[i] - C[j]) + abs(B[i] - D[j]);
			if(minDis > dis){
				minDis = dis;
				index = j + 1;
			}
		}
		cout << index << endl;
		minDis = 10e16;
		index = 0;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> inline int Log2(T& x) {int k; for(k=0; (T(1)<<k)<=x; ++k); return k;} // number of binary digits


int main() {
  string s; cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 200000;

vector<pair<ll,ll>> prime_factorize(ll n) {
  vector<pair<ll, ll>> res;
  for (long long a = 2; a * a <= n; a++){
    if(n % a != 0) continue;
    ll ex = 0; //指数
    while(n % a == 0){
      ex++;
      n /= a;
    }
    res.push_back(make_pair(a, ex));
  }
  if(n != 1){
    res.push_back(make_pair(n, 1));
  }
  return res;
}

ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
// n= 200000までのやつ
void COMinit()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
ll COM(int n, int k){
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll n, m;
  cin >> n >> m;
  COMinit();
  auto vec = prime_factorize(m);
  ll ans = 1;
  for(auto pf : vec){
    int num = pf.second;
    ll tmp = COM(num + n - 1, n - 1);
    ans = (ans * tmp) % MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 8288
#include<stdio.h>
int main(){
	unsigned short set;            	/* 使用できる最大値格納用変数 */
	unsigned long tag;            	/* 目標値格納用変数 */
	unsigned short mid;            	/* 計算用変数 */
	int agg[100];       	/* 計算結果格納用配列 */
	int i, j;           	/* ループ変数 */
	int input_count = 0;	/* 入力数カウンタ */
	int num_count = 0;  	/* 目標を満足する値のカウンタ */
	
	/* 配列の初期化 */
	for(i = 0;i < 100;i++){
		agg[i] = 0;
	}
	
	/* 数値の入力、演算を無限ループ */
	while(1){
		/* 使用できる最大値、目標値の入力 */
		scanf("%d %ld", &set, &tag);
		
		/* 終了処理 */
		if(set == 0 && tag == 0){
			break;
		}
		/* カウンタをリセット */
		num_count = 0;
		
		/* 目標を満足する値をカウント */
		for(i = 1;i < set;i++){
			for(j = i;j <= set;j++){
				/* i + j と目標値の差をmidに代入 */
				mid = tag - (i + j);
				/* midがiとjの間にある場合カウント*/
				if(mid > i && mid < j){
					num_count++;
				}
			}
		}
		
		/* カウントした結果を格納 */
		agg[input_count] = num_count;
		/* 入力数をカウント */
		input_count++;
	}
	
	/* 結果の出力 */
	for(i = 0;i < input_count;i++){
		printf("%d\n", agg[i]);
	}
	
	return 0;
}



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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

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

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)
#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(V.begin(),V.end(),c))

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int M1,D1,M2,D2;
    cin >>M1>>D1>>M2>>D2;

    cout << ((D2==1) ? "1" : "0") <<endl;
    return (0);
}

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


int main() {
  long long a;cin >> a;
  string b;cin >> b;
  int b1=b[0],b2=b[2],b3=b[3];
  long long c=(b1-48)*100+(b2-48)*10+b3-48;
  cout << a*c/100 << endl;

}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<string.h>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;

#define ll long long
void read(__int128 &x)
{
    x = 0;
    char ch;
    int flag = 1;
    while ((ch = getchar()))
    {
        if (ch == '-') flag = -1;
        if (ch >= '0' && ch <= '9') break;
    }
    x = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9')
    {
        x = x * 10 + ch - '0';
    }
    x *= flag;
}

void out(__int128 x)
{
    if (x < 0)
    {
        x = -x;
        putchar('-');
    }
    if (x >= 10) out(x / 10);
    putchar(x % 10 + '0');
}
const int maxn = 1e5 + 10;
int n, m;
int sz[maxn];
set<int>g[maxn];
int h[maxn];
int main()
{
    scanf("%d%d", &n, &m);

    for(int i = 1; i <= n; i++)
        scanf("%d", &h[i]);

    for(int i = 1; i <= m; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].insert(v);
        g[v].insert(u);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        bool flag = 1;
        for(auto x : g[i])
            if(h[x] >= h[i])
            {
                flag = 0;
                break;
            }
        if(flag)
            ans++;
    }
    printf("%d\n", ans );
}


Measured memory_bytes: 18248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i, n) for (int i = 0; i < n; i++)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

//メモ化再帰、DP
int memo[100100];

int rec (int n) {
    if (n == 0) return 0;
    if (memo[n] != -1) return memo[n];

    int res = n;
    for (int pow6 = 1; pow6 <= n; pow6 *= 6) {
        res = min (res, rec (n - pow6) + 1);
    }
    for (int pow9 = 1; pow9 <= n; pow9 *= 9) {
        res = min (res, rec (n - pow9) + 1);
    }
    return memo[n] = res;
}

int main() {
    int n;
    cin >> n;
    rep (i, n + 1) memo[i] = -1;
    cout << rec (n) << "\n";
}


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

#define int long long
#define endl "\n"
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) rep(i,n)
#define repn(i,n) for(int i=n;i>=0;i--)

signed main(){
  cin.tie(0);
  //ios::sync_with_stdio(false);
  string s;
  cin>>s;
  stack<char> c,cprev;
  stack<int> now,nowprev,prevmove;
  now.push(1);
  prevmove.push(-1);
  int ans=0;
  int num=0,num2=0;
  rep(i,s.size() ){

    if(s[i]=='(' || s[i]==')'){
      if(s[i]=='('){
        c.push(s[i]);
        if(prevmove.top() == 0) now.push(1);
        prevmove.push(0);
      }else{
        if(c.empty() ){
          prevmove.push(2);
          nowprev.push(now.top());
          now.pop();
          now.push(1);
        }else{
          cprev.push(c.top());
          c.pop();
          if(prevmove.top() == 1){

            nowprev.push(now.top() );
            now.pop();

          }
          ans+=now.top();
          num=now.top();now.pop();
          now.push(num+1);
          prevmove.push(1);
        }
      }
      cout<<ans<<endl;
    }else{
      num=prevmove.top();prevmove.pop();
      if(num==2){
        cout<<ans<<endl;
        now.pop();
        now.push(nowprev.top() );
        nowprev.pop();
        continue;
      }
      if(num==1){
        c.push(cprev.top() );cprev.pop();
        num2=now.top();now.pop();
        ans-=(num2-1);
        now.push(num2-1);
        if(prevmove.top() == 1){
          if(nowprev.top() == -1) nowprev.pop();
          else{
            now.push(nowprev.top() );
            nowprev.pop();
          }
        }
      }else{
        if(prevmove.top() == 0) now.pop();
        c.pop();
      }
      cout<<ans<<endl;
    }
  }




  return 0;
}



Measured memory_bytes: 6704
//////////////////////////
//      _        ____   //
//  U  /"\  u U /"___|  //
//   \/ _ \/  \| | u    //
//   / ___ \   | |/__   //
//  /_/   \_\   \____|  //
//   \\    >>  _// \\   //
//  (__)  (__)(__)(__)  //
//  Compro by NULL_CT©  //
//////////////////////////
// STL libs
#include <algorithm>
#include <array>
#include <bits/stdint-intn.h>
#include <bitset>
#include <cctype>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

// Boost
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/irange.hpp>

#define ALL(LIST) (LIST.begin()), (LIST.end())

using namespace std;
using boost::irange;
using boost::multiprecision::cpp_int;

constexpr int64_t MOD = 1000000007;

vector<int64_t> divisor(const int64_t &_n) {
  vector<int64_t> head, tail;
  for (int64_t i = 1; i * i <= _n; i++) {
    if (_n % i == 0) {
      head.push_back(i);
      if (i * i != _n)
        tail.push_back(_n / i);
    }
  }
  head.insert(head.end(), tail.rbegin(), tail.rend());
  return head;
}

int64_t kadanes(const vector<int64_t> &_ls) {
  int64_t highestMax = 0, currentMax = 0, length = _ls.size();
  for (int64_t i = 0; i < length; i++) {
    currentMax = max(_ls[i], currentMax + _ls[i]);
    highestMax = max(highestMax, currentMax);
  }
  return highestMax;
}

void execution();

int main() {
#ifndef DEBUG
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
#endif
  // cout<<fixed<<setprecision(20);

  execution();
  return 0;
}

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

void execution() {
  int64_t h,num=1,ans=0;
  cin>>h;

  while(true){
    if(h == 1){
      ans+=num;
      cout<<ans<<"\n";
      return;
    }
    h/=2;
    ans+=num;
    num*=2;
  }
}


Measured memory_bytes: 3192
h, w = gets.split.map(&:to_i)
res = []
h.times do |i|
  res[i] = gets.chomp.chars
end
samej = []
w.times do |j|
  tmp = []
  h.times do |i|
    tmp << res[i][j]
  end
  samej << j if tmp.join == '.' * h
end
samei = []
h.times do |i|
  tmp = []
  w.times do |j|
    tmp << res[i][j]
  end
  samei << i if tmp.join == '.' * w
end
h.times do |i|
  line = []
  w.times do |j|
    print res[i][j] unless samei.include?(i) || samej.include?(j)
  end
  print "\n" unless samei.include?(i)
end


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

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

    int ans = (H-h)*(W-w);

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,a[10][10];
main()
{
	while(cin>>n>>m,n)
	{
		for(int i=0;i<n;i++)for(int j=0;j<m;j++)cin>>a[i][j];
		int ans=0;
		for(int x1=0;x1<n;x1++)for(int x2=x1+2;x2<n;x2++)
			for(int y1=0;y1<m;y1++)for(int y2=y1+2;y2<m;y2++)
			{
				int A=10,B=0;
				for(int i=x1;i<=x2;i++)for(int j=y1;j<=y2;j++)
				{
					if(i==x1||i==x2||j==y1||j==y2)A=min(A,a[i][j]);
					else B=max(B,a[i][j]);
				}
				if(A>B)
				{
					int now=0;
					for(int i=x1+1;i<x2;i++)for(int j=y1+1;j<y2;j++)
						now+=A-a[i][j];
					if(ans<now)ans=now;
				}
			}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        int posCC, posR;
        Scanner scan = new Scanner(System.in);
        posCC = scan.nextInt();
        posR = scan.nextInt();

        int prizeMoney = 0;

        int [] prizeAmt = {300000, 200000, 100000};
        if (posCC < 4) {
            prizeMoney += prizeAmt[posCC - 1];
        }
        if (posR < 4) {
            prizeMoney += prizeAmt[posR - 1];
        }
        if (posCC == 1 && posR == 1)
            prizeMoney += 400000;

        System.out.println(prizeMoney);
    }
}

Measured memory_bytes: 27024
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var nx = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long X = nx[1];
        //ちゅーごくじょーよてーり
        //オーダーによってSの終端が決定する
        //まず影響するのは降順のみなことは自明に分かって、
        //で、「次」を選ぶことができる順番は
        //「確率」「期待値」
        //aを取り除いた場合、その後に適用できるのはそれ以前全て。

        int[] s = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToArray();

        long[] dp = new long[X + 1];
        dp[X] = 1;
        int remain = s.Length - 1;
        foreach (var mod in s)
        {
            for (int i = 0; i < dp.Length; i++)
            {
                var tem = dp[i];
                dp[i % mod] += tem;
                dp[i % mod] %= 1000000007;
                dp[i] += tem * (remain - 1);
                dp[i] %= 1000000007;
            }
            remain--;
        }

        ModInt res = 0;
        for (int i = 0; i < dp.Length; i++)
        {
            res += dp[i] * i;
        }
        Console.WriteLine(res);
    }
}

struct ModInt
{
    const int MOD = 1000000007;
    long Data;
    public ModInt(long data) { Data = data; Eval(); }

    private long Eval() => (Data %= MOD) < 0 ? Data += MOD : Data;
    public static implicit operator long(ModInt modInt) => modInt.Eval();
    public static implicit operator ModInt(long val) => new ModInt(val);
    public static ModInt operator +(ModInt a, ModInt b) => new ModInt(a.Eval() + b.Eval());
    public static ModInt operator -(ModInt a, ModInt b) => new ModInt(a.Eval() - b.Eval());
    public static ModInt operator *(ModInt a, ModInt b) => new ModInt(a.Eval() * b.Eval());
    public static ModInt operator /(ModInt a, ModInt b) => a * Power(b.Eval(), MOD - 2);

    public override string ToString() => Data.ToString();

    static ModInt Power(ModInt n, long m)
    {
        ModInt res = 1;
        while (m > 0)
        {
            if ((m & 1) == 1) res *= n;
            n *= n;
            m >>= 1;
        }
        return res;
    }
}


Measured memory_bytes: 13792
import std.stdio;

/**
解き方

1 <= A <= 500
1 <= B <= 500
上記の制約からして、要素数の最大値は1,000
一方でグリッドの大きさはh=100, w=100で決め打ちにすれば必ず10マスに1マスは割り当てれる
つまり解答例のような小さめのグリッドで効率よく埋める必要はない

上半分は白地(.)に一マスずつ黒(#)を置くために使う (最大 33x49=1617個)
0   #..#..#..
1   ..#..#..#
2   #..#..#..
|
49  .........
50  #########
51  ##.##.##.
52  .##.##.##
53  ##.##.##.
|
100 .##.##.##
下半分は黒地(#)に一マスずつ白(.)を置くために使う

 */
void main() {
    int a, b;
    readf("%d %d\n", &a, &b);
    writeln("100 100");
    // 1 for background
    int black = 1;
    int white = 1;

    // upper for black on white
    foreach (h; 0 .. 49) {
        write(".");
        foreach (w; 1 .. 99) {
            if (((h % 2 == 0 && w % 3 == 0) || (h % 2 == 1 && w % 3 == 2)) && black < b) {
                write("#");
                ++black;
            }
            else {
                write(".");
            }
        }
        write(".");
        writeln();
    }
    // 49th row for white boundary
    foreach (w; 0 .. 100) {
        write(".");
    }
    writeln();

    // 50th row for white boundary
    foreach (w; 0 .. 100) {
        write("#");
    }
    writeln();
    // lower for white on black
    foreach (h; 51 .. 100) {
        write("#");
        foreach (w; 1 .. 99) {
            if (((h % 2 == 0 && w % 3 == 0) || (h % 2 == 1 && w % 3 == 2)) && white < a) {
                write(".");
                ++white;
            }
            else {
                write("#");
            }
        }
        write("#");
        writeln();
    }
    assert(white == a, "white NG");
    assert(black == b, "black NG");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#include <algorithm>
struct Product { long w, v; };

int main() {
  int N, W;
  cin >> N >> W;
  vector<Product> p(N);
  for (Product& i : p) {
    int w, v;
    cin >> w >> v;
    i.w = w;
    i.v  = v;
  }
  vector<vector<long> > table(N+1, vector<long>(N*1000+1, 9999999999));
  for(int i = 0; i < N+1;i++){
    table[i][0] = 0;
  }
  for (int i = 1; i < N+1; i++) {
    for (int v = 1; v <= 1000*N; v++) {
      if(v - p[i-1].v >= 0){
       
          
        table[i][v] = min(table[i-1][v],table[i-1][v-p[i-1].v]+p[i-1].w);
       
      }else{
      table[i][v] = table[i-1][v];
      }
    }
  }
  int maxv = 0;
  for(int i = 1; i <= 1000*N;i++){

    if(table[N][i] <= W){
      if(i > maxv){
        maxv=i;
      }
    }
  }
  cout << maxv << endl;
}


Measured memory_bytes: 80256
n,m = map(int,input().split())
lis = [[1,0] for i in range(n)]
lis[0][1] = 1
for i in range(m):
  a,b = map(int,input().split())
  if lis[a-1][1] == 1:
    lis[b-1][1] = 1
    if lis[a-1][0] == 1:
      lis[a-1][1] = 0
  lis[a-1][0] -= 1
  lis[b-1][0] += 1
ans = 0
for i in range(n):
  if lis[i][1] == 1:ans += 1
print(ans)


Measured memory_bytes: 13172
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVETSE(c) reverse((c).begin(),(c).end())
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define ALL(a)  (a).begin(),(a).end()
// int gcd(int a,int b){return b?gcd(b,a%b):a;}
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}

using namespace std;

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();}
template<class T> T maxt(T x,T y) {
    if (x>y) return x;
    else return y;
}
template<class T> T mint(T x,T y) {
    if (x>y) return y;
    else return x;
}
//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
//cout << fixed << setprecision(10) << ans << defaultfloat << endl;
typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<double> Vd;
typedef vector<string> Vs;

long long m = 1e9+7, mod = 1e9+7;
//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

//約数列挙
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


int main() {
  int N,ix;
  string s,ans,ref="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  cin >> N >> s;
  rep(i,s.length()) {
    ix =((s[i] - 'A') + N) % 26;
    ans.push_back(ref[ix]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <stdint.h>
#include <vector>

using namespace std;

int MOD = 1000000007;

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

  vector<uint32_t> A(60,0);

  for (int n=0; n<N; ++n) {
    uint64_t a;
    cin >> a;
    for (int idx = 0; a; ++idx, a/=2) {
      if (a&1)
	++A[idx];
    }
  }

  uint64_t sum = 0;
  for (int idx=0; idx<60; ++idx) {
    if (A[idx] == 0 || A[idx] == N)
      continue;
    uint64_t num1 = A[idx], num0 = N - num1;
    uint64_t fraction = num1*num0;
    if (fraction >= MOD)
      fraction %= MOD;
    uint64_t exponent = uint64_t(1) << idx;
    if (exponent >= MOD)
      exponent %= MOD;
    sum += (fraction * exponent)%MOD;
    sum %= MOD;
  }

  cout << sum << endl;

  return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N;
  for(int i = 0 ; i<N ; i++){
    cin >> S;
    if (S == "Y"){
      cout << "Four" << endl;
      break;} // Yがあった瞬間にfourを出力して終わり

    else if (i == N-1){
      cout <<"Three" << endl;} // 最後までYがなかったらthreeを出力して終わり

  }
}  


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define mod                   1000000007
#define ll                    long long
#define Author                std::ios_base::sync_with_stdio(0);
#define u_map                 unordered_map<ll,ll>
#define n_map                 map<ll,ll>
#define vt                    vector<ll>
#define n_pair                pair<ll,ll>
#define all(v)                v.begin(),v.end()
#define frr(i,j,k)           for(int i=j; i<k; i++)
#define frp(i,j,k)           for(int i=j; i>=k; i--)
#define pb(a)                 push_back(a)
#define lb(v,t)               lower_bound(all(v),t)-v.begin()
#define ub(v,t)               upper_bound(all(v),t)-v.begin()
#define in(t)                 scanf("%lld",&t);
#define out(t)                printf("%lld\n",t);
#define inputarr(a,n)        for(int i=0;i<n;++i) cin>>a[i]
#define printarr(a,n)        for(int i=0;i<n;++i) cout<<a[i]<<" "
#define mem(a)              memset(a,0,sizeof(a))
int main(){
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3624
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let d = read_vec::<i64>();
    let mut edges = vec![vec![]; n];
    for i in 0..m {
        let v = read_vec::<usize>();
        let (u, v) = (v[0] - 1, v[1] - 1);
        edges[u].push((v, i));
        edges[v].push((u, i));
    }
    let mut colored = vec![0; n];
    let mut answers = vec![1000_000_000; m];

    let mut didx = (0..n).map(|x| (d[x], x)).collect::<Vec<_>>();
    didx.sort();

    'outer: for (di, i) in didx {
        if colored[i] != 0 {
            continue;
        }
        let mut found = false;
        for &(to, edge_i) in edges[i].iter() {
            if colored[to] != 0 {
                answers[edge_i] = di;
                colored[i] = -1 * colored[to];
                found = true;
            }
        }
        if found {
            continue;
        }
        for &(to, edge_i) in edges[i].iter() {
            if di == d[to] {
                colored[i] = 1;
                colored[to] = -1;
                answers[edge_i] = di;
                continue 'outer;
            }
        }
        // debug!(di, i, colored);
        println!("-1");
        return;
    }

    assert!(colored.iter().all(|&x| x != 0));
    'ou: for i in 0..n {
        for &(to, edge_i) in edges[i].iter() {
            if colored[to] != colored[i] && answers[edge_i] == d[i] {
                continue 'ou;
            }
        }
        println!("-1");
        return;
    }

    for color in colored {
        if color == 1 {
            print!("B");
        } else {
            print!("W");
        }
    }
    println!("");
    for ans in answers {
        println!("{}", ans);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 18844
import itertools
def resolve():
    N = int(input())
    L = list(map(int,input().split()))
    count=0
    for i,j,k in itertools.combinations(L,3):
        if i+j > k and i+k > j and j+k > i and i!=j and j!=k and k!=i:
            count +=1 
    print(count)
resolve()

Measured memory_bytes: 67436
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()

cnts = [[0]*10 for _ in range(10)]

for i in range(1,N+1):
    s,e = str(i)[0] , str(i)[-1]
    cnts[int(s)][int(e)] += 1

ans = 0
for s in range(10):
    for e in range(10):
        ans += cnts[s][e] * cnts[e][s]

print(ans)


Measured memory_bytes: 4328
n=int(input())
A=list(map(int,input().split()))
A.sort()
ans=10**9

for i in range(A[0],A[n-1]+1):
    res=0
    for j in range(n):
        res+=(i-A[j])**2
    ans=min(ans,res)

print(ans)
        

Measured memory_bytes: 2940
import java.util.Scanner;
public class Main {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d;

if (a < b) {

}else{
d = a;
a = b;
b = d;
}
if (b < c) {
} else { 
 d = b;
 b = c;
 c = d;  
} 
if(a < b){
}else{
d = a;
a = b;
b = d;
}
System.out.printf("%d %d %d\n", a, b, c);
}
}


Measured memory_bytes: 26324
A,B=map(int,input().split())
from fractions import gcd
g=gcd(A,B)
def prime_factorization(n):
    r={}
    for i in range(2,int(n**.5)+1):
        num=0
        while(True):
            x,y=divmod(n,i)
            if y!=0:
                break
            n=x
            num+=1
        if num>0:
            r[i]=num
    if n>1:
        r[n]=1
    return r
print(len(prime_factorization(g).keys())+1)

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int n;
    cin >> n;
    
    vector<int> cnt(1000010, 0);
    cnt[n]++;
    int v = INF;
    int index = 1;
    while(cnt[n] != 2){
        if(n%2 == 0) n /= 2;
        else n = 3 * n + 1;

        if(v > n){
            v = min(v, n);
        }
        cnt[n]++;
        index++;
    }
    cout << index << endl;
    return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
 
const int MAXN = 1e5+5;
const int MOD = 1e9+7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}
#define YES {cout << "Yes\n"; return 0;}

int N;
map<int,int> M;

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        M[a]++;
    }

    if (M.size() > 3) FAILNO;
    if (M.size() == 1) {
        auto it1 = M.begin();
        if (it1->fi != 0) FAILNO;
        YES;
    }

    if (M.size() == 2) {
        if (M.begin()->fi != 0) FAILNO;
        auto it1 = M.begin();
        auto it2 = next(it1);
        if (it1->se*2 != it2->se) FAILNO;
        YES;
    }

    auto it1 = M.begin();
    auto it2 = next(it1);
    auto it3 = next(it2);

    if (!(it1->se == it2->se && it2->se == it3->se)) FAILNO;

    int a1 = it1->fi;
    int a2 = it2->fi;
    int a3 = it3->fi;

    if ((a1^a2) != a3) FAILNO;
    YES;
    
    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

bool is_prime(int N){
  int x = sqrt(N);
  if(N == 1) return false;
  if(N == 2 || N == 3) return true;
  int sep = 2;
  while(sep <= x){
    if(N % sep == 0){
      return false;
    }
    sep++;
  }
  return true;
}

int main(){
  int X;
  cin >> X;
  int result = X;
  if(X == 1 || X == 2){
    cout << 2 << endl;
    return 0;
  }

  while(1){
    if(is_prime(result)) break;
    result++;
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <numeric>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <sstream>


using namespace std;

using ll =  long long int;

int main() {
    ios::sync_with_stdio(false);

    int N;



    cin >> N;

    string Head="ABC";

    std::ostringstream sout;
    sout << std::setfill('0') << std::setw(3) << N;
    std::string s = sout.str();

    string Num=s;

    string Ans=Head+Num;

    cout << Ans << endl;

    return 0;
}

Measured memory_bytes: 504
# ABC162d


def main():
    import sys
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

    n = int(input())
    s = input()
    l = set(list('RGB'))
    cum = [[0]*(n+1) for _ in range(3)]
    for i in range(n):
        ind = -1
        if s[-i - 1] == 'R':
            ind = 0
        elif s[-i - 1] == 'G':
            ind = 1
        elif s[-i - 1] == 'B':
            ind = 2
        for j in range(3):
            cum[j][n - i-1] = cum[j][n - i]
        cum[ind][n - i-1] += 1
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            if s[i] == s[j]:
                continue
            last = l.copy()
            last.discard(s[i])
            last.discard(s[j])
            ind = -1
            string = last.pop()
            if string == 'R':
                ind = 0
            elif string == 'G':
                ind = 1
            elif string == 'B':
                ind = 2
            ans += cum[ind][min(j+(j-i)+1, n)]+cum[ind][j+1] - \
                cum[ind][min(j+(j-i), n)]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68796
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s; cin>>s;
	int x=0;
	rep(i,0,4){
		if(s[i]=='+') ++x;
		else --x;
	}
	cout<<x;
	
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var A, B int
	fmt.Scan(&A, &B)
	fmt.Println(A * B / calcGCD(A, B))
}

func calcGCD(a, b int) int {
	if b == 0 {
		return a
	} else {
		return calcGCD(b, a%b)
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n;
  cin >> n;
  vl a(n,0),cnt(n,0);
  rep(i,n-1){
    cin >> a[i];
    a[i]--;
    cnt[a[i]]++;
  }
  rep(i,n){
    cout << cnt[i] << endl;
  }
}

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

int n, a, b;

int main() {
	cin >> n >> a >> b;
  	if (a + 2 >= b) cout << n + 1 << endl;
  	else {
      	if (n <= a - 1) cout << n + 1 << endl;
      	else {
          if ((n - a) % 2 == 0) cout << (long long)(n + 1 - a) / 2 * (b - a) + a + 1 << endl;
          else cout << (long long)(n + 1 - a) / 2 * (b - a) + a << endl;
        }
    }
}

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

int main(){
	int N;
	cin >> N;
	string S;
	cin >> S;
	vector<int> L(N), R(N);
	for (int i = 1; i < N; i++) {
		L[i] = L[i-1];
	 	if (S[i-1] == 'W') L[i]++;
	}
	for (int i = N-2; i >= 0; i--) {
		R[i] = R[i+1]; 
		if(S[i+1] == 'E') R[i]++;
	}
	int ans = N;
	rep(i,N) ans = min(ans, L[i]+R[i]);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 6064
#include <iostream>
using namespace std;
int n,s,c;
void f(int m,int a,int t){
	if(a == n){
		if(t == s) ++c;
	}
	else {
		for(int i = m + 1;i < 10;++i){
			f(i,a + 1,t + i);
		}
	}
	return;
}
int main(){
	while(cin >> n >> s && (n != 0 || s != 0)){
		c = 0;
		for(int i = 0;i < 10;++i) f(i,1,i);
		cout << c << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
using ll = long long;
int f(double x){
  int y = x;
  double z = x / y;
  if(z != 1) return y+1;
  else return y;
}

int main(){
  double n, k;
  cin >> n >> k;
  double ans = 0;
  for(int i = 1; i <= n; i++){
    double x = k / i;
    double y;
    if(x > 1){
     y = f(log2(x));}
    else{ y = 0;}
    ans += pow(2, -y);
    //cout << log2(x) << " " << ans << " ";
  }
  cout << fixed << setprecision(10);
  cout << ans / n << endl;
}


Measured memory_bytes: 512
def main():
    inputs = str(input())
    stack = []
    pond = [Pond(-1, 0, 0)]

    for i, string in enumerate(inputs):
        if string == "\\":
            stack.append(i)
        elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

    printPonds(pond)

def printPonds(pond):
    size = 0
    eachSize = []
    for p in pond:
        size += p.size
        eachSize.append(p.size)
    eachSize[0] = len(pond)-1
    print(size)
    print(*eachSize)

class Pond:
    def __init__(self, x1, x2, size):
        self.x1 = x1
        self.x2 = x2
        self.size = size

    def merge(self, newPond):
        self.x1 = newPond.x1
        self.x2 = newPond.x2
        self.size += newPond.size
        return self

    def includedBy(self, newPond):
        return self.x1 >= newPond.x1 and self.x2 <= newPond.x2

if __name__ == "__main__":
    main()


Measured memory_bytes: 6304
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<memory.h>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll a,b;
  cin >> a >> b;
  string ans;
  if(a>0)ans="Positive";
  else if(b>=0)ans="Zero";
  else{
    if((b-a+1)%2==0)ans="Positive";
    else ans="Negative";
  }
  cout << ans << endl;
return 0;}

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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

vector<PII> all_positive(int n)
{
	vector<PII> ans;
	FOR(i, 0, n - 1) ans.PB({i, i + 1});
	return ans;
}

vector<PII> all_negative(int n)
{
	vector<PII> ans;
	RFOR(i, n, 1) ans.PB({i, i - 1});
	return ans;
}

const int N = 1 << 10;
int n;
int a[N];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	cin >> n;
	FOR(i, 0, n) cin >> a[i];
	vector<PII> ans;
	
	int mx = -INF, mn = INF;
	FOR(i, 0, n)
	{
		mx = max(mx, a[i]);
		mn = min(mn, a[i]);
	}
	
	if (mx + mn >= 0)
	{
		int pos = -1;
		FOR(i, 0, n) if (a[i] == mx) pos = i;
		FOR(i, 0, n) if (i != pos) ans.PB({pos, i});
		auto tut = all_positive(n);
		for(auto i: tut) ans.PB(i);
	}
	else
	{
		int pos = -1;
		FOR(i, 0, n) if (a[i] == mn) pos = i;
		FOR(i, 0, n) if (i != pos) ans.PB({pos, i});
		auto tut = all_negative(n);
		for(auto i: tut) ans.PB(i);
	}
	
	cout << SZ(ans) << endl;
	for(auto i: ans) cout << i.X + 1 << ' ' << i.Y + 1 << endl;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		String t = sc.next();
		char[] sAry = s.toCharArray();
		char[] tAry = t.toCharArray();
		char[] ans = new char[2 * n];
		for(int i = 0; i < n; i++){
			ans[2 * i] = sAry[i];
			ans[2 * i + 1] = tAry[i];
		}
		System.out.println(new String(ans));
	}
}


Measured memory_bytes: 22228
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a = read(&mut stdin_lock, &mut buf, b' ');
    let b = read(&mut stdin_lock, &mut buf, b'\n');
    println!("{}", solve(a, b));
}

fn solve(a: u8, b: u8) -> String {
    if (a % 2 == 0) || (b % 2 == 0) {
        "No".to_owned()
    } else {
        "Yes".to_owned()
    }
}

#[test]
fn example1() {
    assert_eq!("Yes", solve(3, 1))
}

#[test]
fn example2() {
    assert_eq!("No", solve(1, 2))
}

#[test]
fn example3() {
    assert_eq!("No", solve(2, 2))
}


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

using namespace std;

map<int,bool> hsh;

int main()
{
  int n,i;

  scanf("%d",&n);
  while(n--)
  {
    scanf("%d",&i);
    if (hsh.find(i)!=hsh.end())hsh.erase(i);
    else hsh[i]=true;
  }
  printf("%d\n",(int)hsh.size());
}


Measured memory_bytes: 4864
#include <iostream>

using namespace std;

int main() {
  string o, e;
  cin >> o >> e;
  int i = 0;
  for (; e[i] != '\0'; i++) {
    cout << o[i];
    cout << e[i];
  }
  if (o[i] != '\0') {
    cout << o[i];
  }
  cout << endl;
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    string ans = "No";
    for (int i=1; i<=9; i++) {
        if (N%i==0 and N/i<10) {
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		if (1200 > scan.nextInt()) {
			System.out.println("ABC");
		} else {
			System.out.println("ARC");
		}

	}

}


Measured memory_bytes: 23124
//-----------------------
// author : xyqkoala
// time : 2020-08-29
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


void solve(){
	int d,t,s;
	cin>>d>>t>>s;
	if((t*s) >= d){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) {
        cin >> a[i];
        a[i]--;
    }

    vector<ll> kosu(n, 0);
    REP(i, n) {
        kosu[a[i]]++;
    }

    ll ans_all = 0;
    REP(i, n) {
        if(kosu[i] == 0) continue;
        ans_all += kosu[i] * (kosu[i] - 1) / 2;
    }

    REP(i, n) {
        ll tmp = ans_all;
        tmp -= kosu[a[i]] * (kosu[a[i]] - 1) / 2;
        if(kosu[a[i]] > 1) tmp += (kosu[a[i]] - 1) * (kosu[a[i]] - 2) / 2;

        cout << tmp << endl;
    }
    return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <math.h>

using namespace std;

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

long long lcm(long long a, long long b){
    long long temp = gcd(a, b);
    return temp ? (a/temp * b) : 0;
}

int main(){
    long long a, b; cin >> a >> b;
    if(b < a) swap(a,b);
    cout << lcm(a, b) << endl;
    return 0;
}

Measured memory_bytes: 256