akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>
int n;
double x[1005], y[1005], X, Y, d, e;
double dist(double a, double b) {
    return a*a + b*b;
}
int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lf%lf", &x[i], &y[i]);
        X += x[i]; Y += y[i];
    }
    X /= n; Y /= n;
    double P = 0.1;
    for (int i = 0; i < 30000; i++) {
        int f = 0;
        d = dist(X - x[0], Y - y[0]);
        for (int j = 1; j < n; j++) {
            e = dist(X - x[j], Y - y[j]);
            if (d < e) { d = e; f = j; }
        }
        X += (x[f] - X)*P;
        Y += (y[f] - Y)*P;
        P *= 0.999;
    }
    printf("%.15lf", sqrt(d));
}

Measured memory_bytes: 128
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> replicateM 2 (getl $ wrds toInt) >>= print

solve :: [[Int]] -> Int
solve = maximum . map sum

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 3668
#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const ll INF = 1LL<<60;
const double PI = acos(-1);
const double EPS = 1e-8;

ll dp[2001][2001];
int K[2000];
int S[100000];
ll SUM[100001];
int l;

ll calc(int a,int b) {
  if (a>b) swap(a,b);
  //cout << a << " " << b << " "  << SUM[b]-SUM[a-1] << endl;
  return (SUM[b]-SUM[a-1])/l;
}

int main() {
  int n,m;
  cin >> n >> m >> l;
  REP(i,n) cin >> K[i];
  REP(i,m) cin >> S[i];

  SUM[0] = 0;
  REP(i,m) SUM[i+1] = SUM[i] + S[i];
  sort(K, K+n);
  ll ans = INF;
  REP(i, n+1)REP(j,n+1)dp[i][j] = INF;
  dp[0][0] = 0;
  REP(now, n) {                 // max(i,j) = now
    REP(j, now+1) {
      if (now == n-1) ans = min(ans, dp[n-1][j] + calc(K[j], K[n-1]));
      else {
        dp[now][now+1] = min(dp[now][now+1], dp[now][j] + calc(K[j], K[now+1]));
        dp[now+1][j] = min(dp[now+1][j], dp[now][j] + calc(K[now], K[now+1]));
      }
    }
    REP(i,now+1) {
      if (now == n-1) ans = min(ans, dp[i][n-1] + calc(K[i],K[n-1]));
      else {
        dp[now+1][now] = min(dp[now+1][now], dp[i][now] + calc(K[i], K[now+1]));
        dp[i][now+1] = min(dp[i][now+1], dp[i][now] + calc(K[now], K[now+1]));
      }
    }
  }
  // REP(i, n+1) {
  //   REP(j, n+1) {
  //     cout << dp[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  cout << ans << endl;
}

Measured memory_bytes: 32000
/*Author : Kartik Bansal
 *Date : 07/09/19
*Time : 16:14 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define tc int t ;cin>>t ;while(t--)
#define pb push_back
#define mp make_pair
#define FOR(i,n) for(int i =0;i<n;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define tra(a) for(auto it : a )cout<<it<<" " ;
#define all(v) v.begin() , v.end()
#define vi  vector<int>
#define vll  vector<long long >
#define vpp vector<pair<int , int >>
#define inf INT_MAX
#define minf INT_MIN
#define ss second
#define ff first
int main()
{
       ios::sync_with_stdio(0) ;
       cin.tie(0) ; cout.tie(0) ;
		 
 			   ll n , a ,b ; 
 			   cin>>n>>a>>b ; 
 			   ll x = a+b ; 
 			   ll o = n/x ;
 			   ll m = n %x ;  
 			   ll ans = o*a + min(a , m ) ; 
 			   cout<<ans ; 

 			    

  return 0 ;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int INF=0x3f3f3f3f,maxn=3;
//vector<int>v[maxn];
//map<int,string>mp[maxn];
//queue<int>q[maxn];
int a[maxn],n,m;
string s;
int main()
{
	int i,j,k=0,ans=0;
	cin>>s;
	for(i=0;i<s.size();i++)
	{
		if(s[i]=='R')
		{
			k++;
		}
		else
		{
			ans=max(ans,k);
			k=0;
		}
	}
	ans=max(ans,k);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3576
import math

l = input().split()
N = int(l[0])

def digits(n):
    d = 0
    while n > 0:
        n //= 10
        d += 1
    return d

def f(a, b):
    da = digits(a)
    db = digits(b)
    return max(da, db)

limit = int(math.sqrt(N) + 1)
# print(limit)

ans = 11

for i in range(1, limit):
    d = N // i
    if d*i == N:
        ans = min(ans, f(i, d))

print(ans)


Measured memory_bytes: 39408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2.2e6;
char c[N];
int a[N],n,b[N];
int C(int n,int k)
{
	if((n&k)==k)return 1;return 0;
 } 
int main()
{//cout<<C(5,0)<<endl;
	cin>>n;scanf("%s",c+1);
	for(int i=1;i<=n;i++)a[i]=c[i]-'0';int fg=0;n--;
	for(int i=1;i<=n;i++){
		b[i]=abs(a[i]-a[i+1]);
		if(b[i]==1)fg=1;
	}int ans=0;
	if(fg)
	{
		for(int i=1;i<=n;i++)b[i]=b[i]%2;
		for(int i=1;i<=n;i++)ans=ans^(C(n-1,i-1)*b[i]);
		cout<<ans;
		return 0;
	}
	for(int i=1;i<=n;i++)b[i]=b[i]/2;
	//for(int i=1;i<=n;i++)cout<<b[i]<<" ";puts("");
	for(int i=1;i<=n;i++)ans=ans^(C(n-1,i-1)*b[i]);
	cout<<ans*2;
}


Measured memory_bytes: 12544
n = gets.to_i
a = n.times.map{gets.split.map(&:to_i)}

m = Array.new(n){Array.new(n){0}}

(0...n).each do |i|
  u, k = a[i][0], a[i][1]
  u -= 1

  (0...k).each do |j|
    v = a[i][j + 2]
    v -= 1

    m[u][v] = 1
  end
end
puts m.map{|l| l.join(' ')}


Measured memory_bytes: 6988
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] num = new int[n];
        for (int i = 0; i < n; i++) {
            num[i] = in.nextInt();
        }
        long count = mergeSort(num, 0, n);
        System.out.println(count);
    }

    public static long merge(int[] num, int left, int mid, int right) {
        int n1 = mid - left;
        int n2 = right - mid;
        int[] L = new int[n1];
        int[] R = new int[n2];
        for (int i = 0; i < n1; i++) {
            L[i] = num[left + i];
        }
        for (int i = 0; i < n2; i++) {
            R[i] = num[mid + i];
        }
        long count = 0;
        int i = 0, j = 0, k = left;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                num[k++] = L[i++];
            } else {
                num[k++] = R[j++];
                count += n1 - i;
            }
        }
        while (i < n1) num[k++] = L[i++];
        while (j < n2) {
            num[k++] = R[j++];
            count += n1 - i;
        }
        return count;
    }

    public static long mergeSort(int[] num, int left, int right) {
        if (left + 1 < right) {
            int mid = (left + right) / 2;
            long a = mergeSort(num, left, mid);
            long b = mergeSort(num, mid, right);
            long c = merge(num, left, mid, right);
            return a + b + c;
        }
        return 0;
    }
}



Measured memory_bytes: 103356
n = int(input())
#n, k = [int(a) for a in input().split()]
#ps = [int(a) for a in input().split()]

a = []

remain = n

while remain != 0:
  t = int(remain % 26)
  a.append(t if t != 0 else 26)
  remain -= a[-1]
  remain /= 26
#a.append(int(remain))
tmp = ' abcdefghijklmnopqrstuvwxyz'
a.reverse()

print(''.join([tmp[i] for i in a]))



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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

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

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

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}


int main(void){
  ios::sync_with_stdio(false);
  ll a,b,n;
  cin >> a >> b >> n;
  ll x;
  if (n >= b-1) x = b -1;
  else x = n;
  ll ans = ll(a*x/b) - a*(x/b);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3656
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
#define fst first
#define snd second
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000003;

void dfs(ll a, ll c, const vector<vector<P>> &e, vll &ans){
    for(auto x: e[a]){
        ll s = x.fst, t = x.snd;
        if(ans[s] < INF){
            continue;
        }
        if(t%2 == 0){
            ans[s] = c;
        }else{
            if(c){
                ans[s] = 0;
            }else{
                ans[s] = 1;
            }
        }
        dfs(s, ans[s], e, ans);
    }
}

int main(){
    ll n; cin >> n;
    vector<vector<P>> e(n+1, vector<P>(0));
    rep(i, 1, n){
        ll a, b, c; cin >> a >> b >> c;
        e[a].emplace_back(mp(b,c));
        e[b].emplace_back(mp(a,c));
    }
    vll ans(n+1, INF);
    ans[1] = 1;
    dfs(1, 1, e, ans);
    rep(i, 1, n+1){
        prtl(ans[i]);
    }
}


Measured memory_bytes: 12664
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL) x = x->left;
  return x;
}

Node treeMaximum(Node x){
  while(x->right != NIL) x=x->right;
  return x;
}

Node treeSearch(Node u, int k) {
  if(u == NIL || k== u->key) return u;
  if(k < u->key ) return treeSearch(u->left,k);
  else return treeSearch((u->right), k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right); //case 1

  y=x->parent;
  while (y != NIL && x == y->right) {
    x = y;
    y = y->parent;
  }
  return y; //case2
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y=z;
  else y=treeSuccessor(z);

  if(y->left != NIL) x=y->left;
  else x=y->right;

  if(x != NIL) x->parent = y->parent;
  if(y->parent == NIL)
    root = x;
  else if(y == y->parent->left)
    y->parent->left = x;
  else y->parent->right = x;

  if(y != z) z->key = y->key;
}

void insert(int k) {
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x!=NIL) {
    y=x;
    if(z->key < x->key) x=x->left;
    else x= x->right;
    z->parent = y;
  }
    
    if(y==NIL) root = z;
    else if(z->key<y->key) y->left = z;
    else y->right = z;
  
}

void inorder(Node u,int n){
  //static int count=0;
  if(u != NIL) {
    inorder(u->left,n);
    //if(count < n) {
      printf(" %d",u->key);
      //count++;
      //} else printf("%d",u->key);
    inorder(u->right,n);
  }
}

void preorder(Node u,int n) {
  //static int count=0;
  if(u==NIL) {
    return ;
  }
  //if(count < n) {
    printf(" %d",u->key);
    //count++;
    //} else printf("%d",u->key);
  preorder(u->left,n);
  preorder(u->right,n);
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
      
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
      
    } else if ( com[0] == 'p' ){
      inorder(root,n);
      printf("\n");
      preorder(root,n);
      printf("\n");
      
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 25172
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<typename T>
using vector2d = vector<vector<T>>;

// 二分探索（改）
// judge を満たすような下限を求める
// left:[X] 定義域の下限
// right:[X] 定義域の上限
// judge:[X -> bool] X を評価する関数
// lower:[bool] falseにすると代わりに上限を求める
// eps:[X] 終了距離

template <typename X>
X BinSearch(X left, X right, function<bool(X)> judge, bool lower = true, X eps = 1) {
    while (right - left > eps) {
        X mid = (right + left) / 2;
        if (judge(mid) == lower) {
            right = mid;
        } else {
            left = mid;
        }
    }
    return lower ? right : left;
}

int main() {
    i64 N, K;
    cin >> N >> K;
    vector<i64> a(N);
    for(auto &x : a) cin >> x;
    sort(WHOLE(a));
    auto f = [&](int x) -> bool {
        vector<bool> dp[2] = {vector<bool>(K, false), vector<bool>(K, false)};
        dp[0][0] = true;
        for (i64 i = 0; i < N; i++) {
            int b = i & 1;
            for (i64 s = 0; s < K; s++) {
                if(i != x && s - a[i] >= 0) {
                    dp[!b][s] = dp[b][s] | dp[b][s - a[i]];
                } else {
                    dp[!b][s] = dp[b][s];
                }
            }
        }
        bool retval = false;
        for(i64 s = max<i64>(0, K - a[x]); s < K; s++) {
            retval |= dp[N & 1][s];
        }
        return !retval;
    };
    int ans = BinSearch<int>(-1, a.size(), f, false);
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
n, a, b, c, d = map(int, input().split())
s = input()

s = '#' + s + '#'

def can_reach(start, end):
    for i in range(start, end+1):
        if s[i] == '#' and s[i+1] == '#':
            return False
    return True

if not can_reach(a, b) or not can_reach(b, d):
    print('No')
    exit()

if c > d:
    can_over = False
    for i in range(b, d+1):
        if s[i-1] == '.' and s[i] == '.' and s[i+1] == '.':
            can_over = True
    if not can_over:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 9464
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
  ll X, Y;

  cin >> X >> Y;

  ll ans = 1;
  ll tmp = X*2;
  while (tmp <= Y) {
    ans++;
    tmp *= 2;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie();
int main()
{
	//IOS;
	int t;
	while(cin>>t)
	{
		map<string,int> m;
		string s;
		while(t--) cin>>s,m[s]++;
		//vector<pair<int,string> > v;
		int max=-1;
		vector<string> v;
		for(map<string,int>::iterator i=m.begin();i!=m.end();++i) 
		{
			if(i->second>max)
			{
				max=i->second;
				v.clear();
				v.push_back(i->first);
			}
			else if(i->second==max)
			{
				v.push_back(i->first);
			}
		}
		for(int j=0;j<v.size();j++) cout<<v[j]<<"\n";
	}
}

Measured memory_bytes: 26868
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007LL

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll n, k;cin >> n >> k;
	vector<P> pla;
	vector<P> mai;

	REP(i, n){
		ll a;cin >> a;
		if(a > 0)pla.EB(abs(a), a);
		else mai.EB(abs(a), a);
	}

	if(k % 2 == 1 && pla.size() == 0){
		sort(ALL(mai));
		ll ans = 1;
		REP(i, k){
			ans = ans * ((MOD * MOD - mai[i].FI) % MOD) % MOD;
		}
		cout << ans << endl;
		return 0;
	}

	sort(ALL(pla), greater<P>());
	sort(ALL(mai), greater<P>());

	ll ans = 1;
	ll cou = 0;
	ll a = 0;
	ll b = 0;

	while(cou < k){
		ll ma_id = min(2LL, k - cou);
		ll a_ma_id = min(ma_id, (ll)pla.size() - a);
		ll b_ma_id = min(ma_id, (ll)mai.size() - b);

		ll A = -LLINF;
		if(a_ma_id > 0)A = pla[a].FI;
		if(a_ma_id > 1)A *= pla[a+1].FI;

		ll B = -LLINF;
		if(b_ma_id > 0)B = mai[b].SE;
		if(b_ma_id > 1)B *= mai[b + 1].SE;

		if(A <= B){
			ans = ans * ((MOD * MOD + B) % MOD) % MOD;
			b += b_ma_id;
			cou += b_ma_id;
		}
		else {
			ans = ans * (A % MOD) % MOD;
			a += a_ma_id;
			cou += a_ma_id;
		}
	}

	//cout << a << " " << b << endl;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 8180
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
#include <stdio.h>
using namespace std;

bool a[123456 * 2 + 1];

int main()
{
	int n;
	while (cin >> n)
	{
		if (n == 0)
		{
			break;
		}

		memset(a, false, sizeof(a));

		int cnt = 0;
		for (int i = 2; i <= n * 2; i++)
		{
			if (a[i] == false)
			{
				if (i > n)
				{
					cnt++;
				}
				for (int j = 1; i * j <= n * 2; j++)
				{
					a[i * j] = true;
				}
			}
		}
		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
int main(void){
	int i,j,N;
  	int A[3][3];
  	int c[3][3];
 	 	for(i=0;i<3;i++)
  		for(j=0;j<3;j++)
          c[i][j]=0;
  scanf("%d %d %d",&A[0][0],&A[0][1],&A[0][2]);
  scanf("%d %d %d",&A[1][0],&A[1][1],&A[1][2]);
  scanf("%d %d %d",&A[2][0],&A[2][1],&A[2][2]);
  scanf("%d",&N);
  int num[N];
  for(i=0;i<N;i++){
  	scanf("%d",&num[i]);
  }
  for(int k=0;k<N;k++){
  	for(i=0;i<3;i++){
  		for(j=0;j<3;j++){
  			if(c[i][j]==0 && A[i][j]==num[k]){
            	c[i][j]=1;
            }
  		}
  		}
    if(c[0][0]==1&&c[0][1]==1&&c[0][2]==1){
    	printf("Yes");
      return 0;
    }
        if(c[1][0]==1&&c[1][1]==1&&c[1][2]==1){
    	printf("Yes");
          return 0;
    }    if(c[2][0]==1&&c[2][1]==1&&c[2][2]==1){
    	printf("Yes");
          return 0;
    }    if(c[0][0]==1&&c[1][0]==1&&c[2][0]==1){
    	printf("Yes");
          return 0;
    }    if(c[0][1]==1&&c[1][1]==1&&c[2][1]==1){
    	printf("Yes");
          return 0;
    }    if(c[0][2]==1&&c[1][2]==1&&c[2][2]==1){
    	printf("Yes");
          return 0;
    }    if(c[0][0]==1&&c[1][1]==1&&c[2][2]==1){
    	printf("Yes");
          return 0;
    }if(c[0][2]==1&&c[1][1]==1&&c[2][0]==1){
    	printf("Yes");
          return 0;
    }
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
     unsigned long int n,t;
     vector<unsigned long int> rec;
     cin >> n;
     priority_queue<unsigned long int> q;
     for(int i=0;i<n;i++){
        cin >> t;
        q.push(t);
     }
     for(int i=0;i<n;i++){
        t=q.top();
        q.pop();
        if(q.empty())
            break;
        if(q.top()==t){
            rec.push_back(t);
            q.pop();
            i++;
            if(rec.size()==2)
                break;
        }
     }
    if(rec.size()==2)
        cout << rec[rec.size()-1]*rec[rec.size()-2];
    else
        cout << '0';
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int x,a;
    cin >> x >> a;
    if(x<a) cout << 0 << endl;
    else if(x>=a) cout << 10 << endl;
}


Measured memory_bytes: 256
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();
		if (C-(A-B) < 0) {
			System.out.println(0);
		} else {
			System.out.println(C-(A-B));
		}
	}
}




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

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

    vector<string> S(N);
    for( int i = 0; i < N; ++i )
        cin >> S[i];


    bool flag = true;
    int A = 0, Un = 0;

    for( int i = 0; i < N; ++i ){
        if( S[i] == "A" ){
            ++A;
        } else if( S[i] == "Un" ){
            ++Un;
            if( A < Un ){
                flag = false;
                break;
            } else if( Un <= A ){
                --A;
                --Un;
            }
        }
    }

    if( A != 0 )
        flag = false;

    if( flag ){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}



Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << x << std::endl
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = std::numeric_limits<T>::max() / 10;
std::mt19937 mt{std::random_device{}()};
int main()
{
    int N;
    std::cin >> N;
    int n = 1;
    for (int sum = 0; sum < N; n++) {
        sum += n;
        if (sum > N) { return std::cout << "No" << std::endl, 0; }
    }
    n--;
    std::cout << "Yes\n"
              << n + 1 << std::endl;
    std::vector<std::vector<int>> ans(n + 1);
    int s = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n - i; j++, s++) {
            ans[i].push_back(s);
            ans[i + j + 1].push_back(s);
        }
    }
    for (int i = 0; i <= n; i++) {
        std::cout << n;
        for (const int e : ans[i]) { std::cout << " " << e; }
        std::cout << std::endl;
    }
    return 0;
}


Measured memory_bytes: 2304
#include <cmath>
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
  int N; cin >> N;
  int x[10] = {}, y[10] = {};
  for (int i = 1; i <= N; i++)
  {
    cin >> x[i] >> y[i];
  }
  
  double ans = 0;
  for (int a = 1; a <= N - 1; a++)
  {
    for (int b = a + 1; b <= N; b++)
    {
      double d = pow(pow((x[a] - x[b]), 2) + pow((y[a] - y[b]), 2), 0.5);
      ans += d * 2 / N;
    }
  }
  
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLD = vector<PLD>;

const int IINF = numeric_limits<int>::max();

int main() {

    LL n;
    cin >> n;
    map<string, LL> m;
    REP(i,n) {
        LL tmp;
        cin >> tmp;
        string str = to_string(tmp);
        if (m[str]==0) { m[str]=1; }
        else { m[str]+=1; }
    }

    LL ans = 0;
    for (auto i=m.begin();i!=m.end();i++) {
        // cout << i->first << " " << i->second << endl;
        if (i->second%2==1) { ans++; }
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

using int64 = long long;

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

  if(K == 0) {
    cout << 1LL * N * N << endl;
    return (0);
  }
  int64 ret = 0;
  for(int i = K + 1; i <= N; i++) {
    for(int j = 0; j <= N; j += i) {
      int h = min(N, j + i - 1);
      int lim = j + K;
      ret += max(0, h - lim + 1);
    }
  }

  cout << ret << endl;
}


Measured memory_bytes: 256
def xgcd(a, b):
    if b == 0:
        g = a
        x = 1
        y = 0
        return g, x, y
    else:
        g, s, t = xgcd(b, a%b)
        x = t
        y = s - a//b*x
        return g, x, y

def invmod(a, p):
    _, x, _ = xgcd(a, p)
    if x < 0:
        x = x + p
    return x

def count_route(n):
  if n < 0:
    return 0
  res = 0
  for i in range(n//2+1):
    res += f[n - i] * inv[i] * inv[n - 2* i]
  return res%const
    
n, m = map(int, input().split())
const = 1000000007
#nまでの階乗をハッシュテーブルに格納する
f = [1 for i in range(n + 1)]
inv = [1 for i in range(n + 1)]
for i in range(1, n+1):
  f[i] = (f[i - 1] * i)%const
  inv[i] = invmod(f[i], const)
prev = 0
ans = 1
for i in range(m):
  m = int(input())
  ans = (ans * count_route(m - 1 - prev))%const
  prev = m + 1
  if ans == 0:
    break
ans = (ans * count_route(n - prev))%const
print(ans)

Measured memory_bytes: 64800
import java.util.*;

public class Main{

	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int x = scan.nextInt();
      	int a = scan.nextInt();
      	if(x < a){
        	System.out.print(0);
        }
      	else{
        	System.out.print(10);
        }
    
    }

}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

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

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

	ll ans = 3 * N * N;
	
	cout<<ans<<endl;
}

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

#define ll long long

using namespace std;

const int MAXN = 100010;
const int MAXM = 100010;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int n, m, k;
ll tot, cnt, ans;

int read() {
	int f = 1, s = 0;
	char ch = getchar();
	while ('0' > ch || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
	while ('0' <= ch && ch <= '9') {s = (s << 1) + (s << 3) + ((int)ch ^ 48); ch = getchar();}
	return s * f;
}

int a[MAXN], b[MAXN];

string s;

bool check(int x, int y, int z, int sum) {
	if (x * x + y * y + z * z + x * y + y * z + z * x > sum) return 1;
	else return 0;
}

bool pd(int x, int y, int z, int sum) {
	if (x * x + y * y + z * z + x * y + y * z + z * x == sum) return 1;
	else return 0;
}

ll count(int x) {
	ll res = 0;
//	if (x == 6) cout << "z" << endl;
	for (int i = 1; i; i++) {
		if (check(i, 1, 1, x)) break;
//		if (x == 6) printf("i: %d\n", i);
		for (int j = 1; j; j++) {
			if (check(i, j, 1, x)) break;
//			if (x == 6) printf("j: %d\n", j);
			for (int k = 1; k; k++) {
				if (check(i, j, k, x)) break;
//				if (x == 6) printf("k: %d\n", k);
				if (pd(i, j, k, x)) ++res;
			}
		}
	}
	return res;
}

int main() {
	int T;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		int num = i;
		cout << count(num) << endl;
	}
	return 0;
}


Measured memory_bytes: 3664
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

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

int grid[110][110];
int modiw[110], modib[110], modir[110];
vector<string> field;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);

    int minV = 1000000;
    int H, W;
    cin >> H >> W;
    //cout << H << " " << W << endl;

    for (int i = 0; i < H; ++i)
    {
        string s;
        cin >> s;
        field.push_back(s);
    }

    for (int i = 0; i < H; ++i)
    {

        int w = 0, r = 0, b = 0;
        string s = field[i];
        for (int j = 0; j < W; ++j)
        {
            if (s[j] == 'W')
            {
                r++;
                b++;
            }
            else if (s[j] == 'R')
            {
                b++;
                w++;
            }
            else
            {
                r++;
                w++;
            }
        }
        if (i == 0)
        {
            modib[i] = b;
            modir[i] = r;
            modiw[i] = w;
        }
        else
        {
            modib[i] = b + modib[i - 1];
            modir[i] = r + modir[i - 1];
            modiw[i] = w + modiw[i - 1];
        }
    }

    for (int i = 0; i < H - 2; ++i)
    {
        for (int j = i + 1; j < H - 1; ++j)
        {
            for (int k = j + 1; k < H; ++k)
            {
                minV = min(minV, modiw[i] + modib[k - 1] - modib[i] + modir[H - 1] - modir[k - 1]);
            }
        }
    }
    cout << minV << endl;

    return 0;
}


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

int main(){
  int n, s=0;
  cin >> n;
  vector<int>l(n);
  for(int i=0;i<n;i++) cin >> l[i];
  sort(l.begin(),l.end());
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      int k=lower_bound(l.begin(),l.end(),l[i]+l[j])-l.begin();
      s += max(0,k-(j+1));
    }
  }
  cout<<s;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  string s;
  cin>>s;
  int n = s.size();
  long long dp[n + 1][2];
  dp[0][0] = 0; dp[0][1] = 1;
  REPP(i, n){
    int d = s[i - 1] - '0';
    dp[i][0] = min(dp[i - 1][0] + d, dp[i - 1][1] + (10 - d));
    dp[i][1] = min(dp[i - 1][0] + d + 1, dp[i - 1][1] + (10 - (d + 1)));
  }
  long long ans = dp[n][0];
  cout << ans << endl;
  return 0;
}


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

// input
int H, W, h, w;


void input() {
    cin >> H >> W >> h >> w;
}


int main() {
    input();
    int ans = (H - h) * (W - w);
    cout << ans << endl;
}


Measured memory_bytes: 3596
from fractions import gcd
from functools import reduce

def gcds(*numbers):
    return reduce(gcd, numbers)

def gcd_list(numbers):
    return reduce(gcd, numbers)

# INPUT
n, x = map(int, input().split())
capitals = list(map(int, input().split()))

# PROCESS
distance_cap = list(map(lambda c: abs(x-c), capitals))
answer = gcd_list(distance_cap)

# OUTPUT
print(answer)




Measured memory_bytes: 16308
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i< (n); i++)
#define REP(i,n) for (int i = 1; i<= (n); i++)
#define MAX_MOD 1000000007LL
#define MOD 998244353LL
const long double PI = acos(-1);
using ll = long long;
using ld = long double;
using namespace std;

int main() {
    int H_1, M_1, H_2, M_2, K;
    cin >> H_1 >> M_1 >> H_2 >> M_2 >> K;
    int min = (H_2*60 + M_2) - (H_1*60 + M_1);
    int ans = min - K;
    cout << ans << endl;
    return 0;
}

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

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 EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int h, w; string s[51];
int main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				cout << '#'; continue;
			}

			int cnt = 0;
			for (int k = -1; k <= 1; k++) {
				for (int l = -1; l <= 1; l++) {
					int nx = i + k; int ny = j + l;
					if (0 <= nx && nx < h && 0 <= ny && ny < w && s[nx][ny] == '#') {
						cnt++;
					}
				}
			}
			cout << cnt;
		}
		cout << endl;

	}

	
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a < 0 && b < 0) {
            System.out.println((b - a + 1) % 2 == 0 ? "Positive" : "Negative");
        } else if (a < 0 && b >= 0) {
            System.out.println("Zero");
        } else if (a == 0) {
            System.out.println("Zero");
        } else {
            System.out.println("Positive");
        }
    }

}


Measured memory_bytes: 21972
#include<iostream>
#include<string>
using namespace std;

int main(){
    string s;
    cin>>s;
    if(s == "Sunny"){
        cout<<"Cloudy"<<endl;
    }else if(s == "Cloudy"){
        cout<<"Rainy"<<endl;
    }else if(s == "Rainy"){
        cout<<"Sunny"<<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

main(){
  int a,b,c,n,i,j,r,f;
  int naname[3];

  while(1){
    scanf("%d %d %d", &a, &b, &c);
    if(a==0 && b==0 && c==0) break;

    naname[0]=a*a+b*b;
    naname[1]=b*b+c*c;
    naname[2]=c*c+a*a;

    scanf("%d", &n);

    for(i=0;i<n;i++){
      scanf("%d", &r);

      f=1;

      for(j=0;j<3;j++){
	if((4*r*r)>naname[j]) f=0;
      }

      if(f==0) printf("OK\n");
      else printf("NA\n");
    }
  }
  return 0;
}

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

using namespace std;

int main() {
  int N, M, k, a;
  cin >> N >> M;
  vector<int> s(N);
  for (int i = 0; i != M; ++i) {
    cin >> k;
    for (int j = 0; j != k; ++j) {
      cin >> a;
      s[a-1] |= (1 << i);
    }
  }

  int p{};
  for (int i = 0; i != M; ++i) {
    cin >> a;
    p |= (a << i);
  }
  
  int ans{};
  int n = lround(pow(2,N));
  for (int i = 0; i != n; ++i) {
    int q{p};
    for (int j = 0; j != N; ++j) {
      if (i & (1 << j)) q = q ^ s[j];
    }
    if (!q) ++ans;
  }
  cout << ans << endl;
}


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

#define endl "\n"

priority_queue<int> Maxheap;//大根堆 
priority_queue<int,vector<int>,greater<int> > Minheap;//小根堆 

ll l,r,B;

void insert(int x){ 
	if(Maxheap.empty()) {
		Maxheap.push(x);
		l+=x;
	}
	else {
		if(x<=Maxheap.top()){
			Maxheap.push(x);
			l+=x;
			if((int)Maxheap.size()-(int)Minheap.size()>=2){
				int t=Maxheap.top();
				Maxheap.pop();
				Minheap.push(t);
				l-=t;
				r+=t; 
			}
		}
		else {
			Minheap.push(x);
			r+=x;
			if(Minheap.size()>Maxheap.size()){
				int t=Minheap.top();
				Minheap.pop();
				Maxheap.push(t);
				l+=t;
				r-=t;
			}
		}
	}
} 

int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int q,op,a,b,x;
	cin>>q;
	l=r=B=0;
	while(q--){
		cin>>op;
		if(op==1) {
			cin>>a>>b;
			insert(a);
			B+=b;
		}
		else{
			if(!Maxheap.empty()) x=Maxheap.top();
			else x=0;
			cout<<x<<' '<<((ll)Maxheap.size()*x-l)+(r-(ll)Minheap.size()*x)+B<<endl;
		}
	}
	return 0;
}
/*
对于f(x)=|x-a1|+|x-a2|+……+|x-an|+B，
作函数图象(作弊操作) 
可以知道若绝对值部分的个数为奇数，那么最小值在
ai的中位数处，如果个数为偶数，那么最小值在中间两个
数之间的所有数，因为要取最小的，自然取中间两个数中小的那个。
思路一：因为是要找中位数，可以用nth_eleemnt找到，时间复杂度为O(n),
然后计算结果，也是要遍历一次，时间复杂度也是O(n),q次询问的时间
复杂度为O(q^2)，故不能这么做。
思路二：用一个大根堆和一个小根堆维护中位数。
用大根堆记录中位数和其左边的数，小根堆记录其右边的数，
这样维护过程的时间复杂度为O(qlogq)，访问中位数的时间复杂度为O(1),
但是如果遍历所有a求解结果，时间复杂度仍是O(n)，总的时间复杂度还是O(q^2),
只是找中位数快了。但是转念一想，既然都知道了中位数x，
中位数左边的值都小于中位数，如果还知道左边数的个数N，那么显然
左边绝对值结果为左边数的个数N乘中位数x减去左边数的和L，同理右边相似， 
右边绝对值计算结果为右边数的和R减去个数M乘中位数x。 
最后结果为(N*x-L)+(R-M*x)+B。
注意容器的size函数返回值为unsigned int类型，避免被其它类型强制转换导致计算错误。 
*/

Measured memory_bytes: 3452
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        String s;
        for (int i = 0; i < h; i++) {
            s = sc.next();
            for (int j = 0; j < 2; j++) {
                System.out.println(s);
            }
        }
    }
}

Measured memory_bytes: 24788
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a:i64 = read();
    let b:i64 = read();
    let c:i64 = read();
    let mut k:i64 = read();

    let mut ans = 0;

    ans += std::cmp::min(a,k);
    k -= a;
    if k > 0 {
        k -= b;
        if k > 0 {
            ans -= k;
        }
        
    }

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


Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,m,i=0,j,h,a,d[1000][1000],c=0;
    string s;
    cin >> n;
    for(i=1;i<n;i++)
    {
        for(j=1;j<n;j++)
        {
            if(i*j>=n)
            {
                break;
            }
            c++;
        }
    }
    cout << c << endl;
    return 0;

}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;
int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    ll ans=0;
    for(ll i=0;i<n;i++){
        ll r=a[i]%2;
        while(r==0&a[i]>0){
            a[i]/=2;
            ans++;
            r=a[i]%2;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
from __future__ import print_function

import sys
input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


n, y = map(int, input().strip().split())
y = y // 1000
if y - n < 0:
    print("-1 -1 -1")
else:
    i = 0
    while y - n - 9 * i >= 0:
        if (y - n - 9 * i) % 4 == 0 and n - i - (y - n - 9 * i) // 4 >= 0:
            j = (y - n - 9 * i) // 4
            k = n - i - j
            print(i, j, k)
            sys.exit()
        i += 1
    del i
    print("-1 -1 -1")


Measured memory_bytes: 38768
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    string S,T,U;
    int A,B;cin >> S >> T >> A >> B >> U;
    if(S == U){
        cout << A-1 << ' ' << B << endl;
    }
    else cout << A << ' ' << B - 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int n;
	int ans = 0;
	cin >> n;

	if (n >= 10) {
		ans += 9;
		if (n >= 1000) {
			ans += 900;
			if (n >= 100000) {
				ans += 90000;
			}
			else if(n >= 10000){
				ans += n - 9999;
			}
		}
		else if(n >= 100){
			ans += n - 99;
		}
	}
	else {
		ans = n;
	}

	cout << ans << endl;
}

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

namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, a, b, x;

            var word = Console.ReadLine().Split(' ');

            n = int.Parse(word[0]);
            a = int.Parse(word[1]);
            b = int.Parse(word[2]);

            if (n * a < b)
                x = n * a;

            else
                x = b;

            Console.WriteLine(x);

            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(long long int i=a; i<n; i++)
#define loop(i,a,n)	for(long long int i=a; i>=n; i--)

int main() 
{	
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	string s;
	int flag=0;
	cin>>s;
	forr(i,0,s.size())
	{
		if(s[i]=='7')
			flag=1;
	}
	cout<<(flag?"Yes":"No");
	
	
	return 0;	
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <time.h>
#include <string.h>
#include <queue>
#include <complex>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef complex<double> base;
ll mod=1e9+7;
double eps=1e-9;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ll pexp(ll x, ll y){if(y<0) return 0; ll ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
string s;
int n, ans=1e9;
int pr[311111];

int main(void)
{
	cin>>n>>s; int i;
	for(i=0 ; i<n ; i++)
	{
		if(i==0 && s[i]=='W') pr[i]=1;
		if(i!=0 && s[i]=='W') pr[i]=pr[i-1]+1;
		if(i!=0 && s[i]=='E') pr[i]=pr[i-1];
	}
	for(i=0 ; i<n ; i++) ans=min(ans,pr[i-1]+(n-i-1)-(pr[n-1]-pr[i]));
	cout<<ans; return 0;
}

Measured memory_bytes: 1796
Imports System

Public Class Program

    Public Shared Sub Main(args As String())
        Dim N As Integer = Integer.Parse(Console.ReadLine)

        Dim p As ULong = 1

        For i As Integer = 1 To N
            p = p * i
            p = p Mod 1000000007
        Next

        Console.WriteLine(p)

    End Sub
End Class

Measured memory_bytes: 11220
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


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)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

int main() {
	int n, x;
	int a[110];
	cin >> n >> x;
	rep(i, n) cin >> a[i];

	sort(a, a + n);

	int ans = 0, sum = 0;
	rep(i, n) {
		sum += a[i];
		if (sum > x) break;
		ans++;
	}
	if (ans == n && x != sum) --ans;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256