akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//pbds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>   using orderedSet =tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;
///use less_equal in pbds template to work as multiset...................................................
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
//BFS+DFS
#define boundary(i,j) (i>=0 && i<n && j>=0 && j<m)
int X[]={-1,1,0,0};
int Y[]={0,0,1,-1};
/*
struct cmp{
bool operator()(const pii &a,const pii &b)
{
    if(a.first==b.first) return a.second<b.second;///second value small to big
    else return a.first>b.first;///first value big to small
}
};
///in pq true means swap required  ,false means swap  not required...
set<pii,cmp>st;
priority_queue<pii,deque<pii>,cmp>pq;
*/
ll mod=1e9+7;
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     ll n;
     cin>>n;
     ll w=1LL,x=1LL,y=1LL,z=1LL;
     for(ll i=1; i<=n; i++)
     {
         w=(w*10LL)%mod;
     }
     for(ll i=1; i<=n; i++)
     {
         x=(x*9LL)%mod;
     }
     for(ll i=1; i<=n; i++)
     {
         y=(y*8LL)%mod;
     }
    z=(w-x+mod)%mod;
    z=(z-x+mod)%mod;
    z=(z+y)%mod;
     cout<<z<<endl;

}




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

int main() {
  int n;
  cin >> n;
  
  vector<vector<int>> a(2,vector<int>(n));
  for (int i = 0; i < 2; i++){
    for (int j = 0; j < n; j++){
      cin >> a.at(i).at(j);
    }
  }
  
  vector<int> c(n);
  
  for (int i = 0; i < n; i++){
    for (int j = 0; j <= i; j++){
      c.at(i) += a.at(0).at(j);
    }
    for (int j = i; j < n; j++){
      c.at(i) += a.at(1).at(j);
    }
  }
  sort(c.begin(), c.end());
  cout << c.at(n - 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define F first
#define S second
#define inf (long long) 1e18
#define f(i,n)  for(int i=0;i<n;i++)
#define f(i,n) for(int i=n-1;i>=0;i--)
#define f(i,n) for(int i=1;i<=n;i++)

const int MOD = 1e9 + 7;

void solve()
{
    int n,a,b;
    cin >> n >> a >> b;
    char str[n];
    cin >> str;
    int p=0,bp=0;
    for(int i=0;i<n;i++)
    {
        if(str[i]=='a')
        {
            if(p<a+b)
            {
                p++;
                cout << "Yes" <<"\n";
            }
            else{
                cout << "No" << "\n";
            }
        }
        else if(str[i]=='b')
        {
            if(p<a+b && bp+1<=b){
                p++;bp++;
                cout << "Yes" << "\n";
            }
            else
            {
                cout << "No" << "\n";
            }
        }
        else
            cout << "No" << "\n";
    }
}


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


Measured memory_bytes: 3728
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def main():
    # n, m = map(int, input().split())
    # a = [int(input()) for i in range(m)]
    n, m = map(int, readline().split())
    a = set(map(int, read().split()))
    mod = 1000000007

    # フィボナッチ数列を作る要領で行う
    d = [0] * (n+1)
    # 2回0が続く状況aに連番があったら即座に終了する
    cnt = 0 
    # d[0]とd[1]を規定。aに1が含まれていることを考慮して場合分けしておく
    d[0] = 1
    if 1 not in a:
        d[1] = 1
    # else:
    #     d[1] = 1
    # 階段番号は2~nまでを見る必要がある
    for i in range(2, n+1):
        if i in a:
            d[i] = 0
            cnt += 1
            if cnt == 2:
                print('0')
                exit()
        else:
            d[i] = (d[i-1] + d[i-2]) % mod
            cnt = 0
    # print(d)  
    ans = d[n]        
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 17784
import java.util.*;
import java.io.*;
 
class Main{
    public static void main(String args[])throws IOException{
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       String s;
       while((s=br.readLine())!=null){
           String[] str = s.split(" ");
           int n = Integer.parseInt(str[0]);
           int x = Integer.parseInt(str[1]);
           if(n==0 && x==0) break;
           int count=0;
           for(int i=1; i<n; ++i){
               for(int j=i; j<n; ++j){
                   if(i==j) continue;
                   int num = x - (i+j);
                   if(num<1) break;
                   if(num<j) break;
                   if(i != num && j != num && num <= n) count++;
                   num = 0;
               }
           }     
       System.out.println(count);
       }
    }
}

Measured memory_bytes: 16916
import math
a, b, x = map(int, input().split())
c = (2*x)/(a**2)-b
if c <= 0:
    c = (2*x)/(a*b)
    print(math.degrees(math.atan2(b, c)))
else:
    print(math.degrees(math.atan2(b-c, a)))

Measured memory_bytes: 3188
x = gets.to_i

num = [1]
b = 2
p = 2

while true
  result = b ** p
  if b ** 2 > x
  	break
  elsif result > x
  	b += 1
  	p = 2
  else
  	num << result
  	p += 1
  end
end

puts num.max


Measured memory_bytes: 1788
N = int(input())
A = list(map(int, input().split()))

a = list(set(A))
a_c = {}
for v in A:
  if v in a_c:
    a_c[v] += 1
  else:
    a_c[v] = 1

def cmb(n):
  if n < 2: return 0
  else:
    return n * (n-1)//2

S = 0
for k in a_c:
  S += cmb(a_c[k])

for i in range(N):
  print(S - cmb(a_c[A[i]]) + cmb(a_c[A[i]]-1))

Measured memory_bytes: 27132
// Two Switches
#include <cmath>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int count = 0;
    if (min(B, D) > max(A, C)) count = min(B, D) - max(A, C);
    cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;

int mtoi(char c){
  if(c=='m'){
    return 1000;
  }
  if(c=='c'){
    return 100;
  }
  if(c=='x'){
    return 10;
  }
  if(c=='i'){
    return 1;
  }
  return 0;
}

int ctoi(char c){
  if(!mtoi(c)){
    return c-'0';
  }
  return 0;
}

int toi(string s){
  int sum=0;
  for(int i=0;i<s.size();i++){
    if(mtoi(s[i])){
      if(i==0){
        sum+=mtoi(s[i]);
      }else{
        if(ctoi(s[i-1])){
          sum+=mtoi(s[i])*ctoi(s[i-1]);
        }else{
          sum+=mtoi(s[i]);
        }
      }
    }
  }
  return sum;
}

string itom(int a){
  string s;
  if(a/1000==1){
    s+='m';
  }
  else{
    if(a/1000!=0){
      s+=(char)('0'+a/1000);
      s+=('m');
    }
  }
  if(a/100%10==1){
    s+=('c');
  }
  else{
    if(a/100%10!=0){
      s+=(char)('0'+a/100%10);
      s+=('c');
    }
  }
  if(a/10%10==1){
    s+=('x');
  }else{
    if(a/10%10!=0){
      s+=(char)('0'+a/10%10);
      s+=('x');
    }
  }
  if(a%10==1){
    s+=('i');
  }
  else{
    if(a%10!=0){
      s+=(char)('0'+a%10);
      s+=('i');
    }
  }
  return s;
}

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    string s,t;
    cin>>s>>t;
    //printf("seisuu=%d %d\n",toi(s),toi(t));
    cout<<itom( toi(s)+toi(t))<<endl;
  }
  return 0;
}



Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000000007
#define MAXN 100005
#define ll long long
#define pb push_back
#define sortv(v) sort(v.begin(),v.end())
#define tc(t) int t;cin>>t;while(t--)
#define copy copy_n
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define frr(i,a,b) for(long long i=a;i>=b;i--)
#define frn(i,a,b,n) for(long long i=a;i<=b;i=i+n)
#define gcd(x,y) __gcd(x,y)
#define ld long double
#define um unordered_map
#define mkp make_pair
#define b_s binary_search
#define des greater<ll>()
#define fi first
#define se second
#define PI 3.1415926535
#define FP(n) fixed<<setprecision(n)
ll mul(ll a, ll b, ll p = mod) {return ((a % p) * (b % p)) % p;}
ll add(ll a, ll b, ll p = mod) {return (a % p + b % p) % p;}
void input(ll a[], ll sz) {fr(i, 0, sz) cin >> a[i];}
void print(ll a[], ll sz) {fr(i, 0, sz) {if (i == sz - 1) cout << a[i] << "\n"; else cout << a[i] << " ";}}
ll maxr(ll a[], ll sz) {ll ma; fr(i, 0, sz) {if (i == 0) ma = a[i]; else if (a[i] > ma) ma = a[i];} return ma;}
ll minr(ll a[], ll sz) {ll mi; fr(i, 0, sz) {if (i == 0) mi = a[i]; else if (a[i] < mi) mi = a[i];} return mi;}
ll isprm(ll n) {
    if (n <= 1)  return 0;
    if (n <= 3)  return 1;
    if (n % 2 == 0 || n % 3 == 0) return 0;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return 0;
    return 1;
}
/*ll spf[MAXN];
void sieve()
{
    spf[1]=1;
    for (ll i=2; i<MAXN; i++)
        spf[i] = i;
    for (ll i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for(ll i=3;i*i<MAXN;i++)
    {
        if (spf[i]==i)
        {
            for (int j=i*i;j<MAXN;j+=i)
                if (spf[j]==j)
                    spf[j]=i;
        }
    }
}*/
ll power(ll x, ll y, ll p = mod)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p = mod)
{
    return power(n, p - 2, p);
}
ll ncrMod(ll n, ll r, ll p = mod)
{
    if (r == 0)
        return 1;
    ll fac[n + 1];
    fac[0] = 1;
    for (ll i = 1 ; i <= n; i++)
        fac[i] = fac[i - 1] * i % p;
    return (fac[n] * modInverse(fac[r], p) % p *
            modInverse(fac[n - r], p) % p) % p;
}
//a+b=xor(a,b)+2*(a&b)//
struct comp
{
    bool operator()(const pair<ll, ll> &a,
                    const pair<ll, ll> &b)const
    {
        if (a.fi == b.fi)
        {
            return (a.se > b.se); //second elem in descending
        }
        return (a.first < b.first);//first elem in ascending
    }
};










int main()
{
    fio;
    ll n,a[100005],b[100005],c[100005],dp[100005][3];
    cin>>n;
    fr(i,0,n)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    fr(i,0,100005)
    fr(j,0,3)
    dp[i][j]=0;
    for(ll i=n-1;i>=0;i--)
    {
        dp[i][0]=a[i]+max(dp[i+1][1],dp[i+1][2]);
        dp[i][1]=b[i]+max(dp[i+1][0],dp[i+1][2]);
        dp[i][2]=c[i]+max(dp[i+1][0],dp[i+1][1]);
    }
    ll ans=max(dp[0][0],dp[0][1]);
    ans=max(ans,dp[0][2]);
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 4992
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=1005;
int ans[N][N];
int ans1[N][N];
int main()
{
    int n,m,r,c;
    scanf("%d%d%d%d",&n,&m,&r,&c);
    if(n%r==0&&m%c==0){
        puts("No");
        return 0;
    }
    puts("Yes");
    bool flag=false;
    if(n%r==0){
        swap(n,m);
        swap(r,c);
        flag=true;
    }
    for(int j=c;j<=m;j+=c)
        ans[1][j]=999999999;
    for(int i=r;i<=n;i+=r){
        for(int j=c;j<=m;j+=c)
            ans[i][j]=-1000000000,ans[i+1][j]=999999999;
    }
    if(flag){
        for(int i=1;i<=n;i++)
            for(int j=1;j<=m;j++){
                ans1[j][i]=ans[i][j];
            }
        memcpy(ans,ans1,sizeof ans);
        swap(n,m);
        swap(r,c);
    }
    for(int i=1;i<=n;i++,puts(""))
        for(int j=1;j<=m;j++)
            printf("%d ",ans[i][j]);
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
#define all(v) v.begin(),v.end()
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n))
typedef bitset<13> MASK;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<vector<int>> vvi;

//set iterator can be increamnted and decreamnted
void fast() {
    cin.tie(0);
    cin.sync_with_stdio(0);
}


int main() {
    fast();
    ll n;cin>>n;
    ll ans=0;
    for (int i = 1; i <=n ; ++i) {
        ll l=1,r=n,mid,solu=0;
        while(l<=r){
            mid=(l+r)/2;
            if(mid*i<=n-1)solu=mid,l=mid+1;
            else r=mid-1;
        }
        ans+=solu;
    }
    cout<<ans;
}


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

// class Solve {
// private:
// 	bool isCat

// public:
// 	bool is_last_query{};
// 	Solve()
// 	{
// 		if (hashFunc == ".")
// 		{
// 			is_last_query = true;
// 			return;
// 		}
// 	}
// };

std::string S;
int priority[4];

int64_t calcFormula(int&);
int64_t calcExpression(int&);
int64_t calcNum(int&);
int translate(char);
int64_t calcOperation(int64_t, int64_t, int);

int main()
{
	// while (!Solve().is_last_query);
	std::cin >> S;
	int64_t max{LLONG_MIN};
	priority[3] = -1;
	for (priority[0] = 0; priority[0] < 3; priority[0]++)
		for (priority[1] = 0; priority[1] < 3; priority[1]++)
			for (priority[2] = 0; priority[2] < 3; priority[2]++)
			{
				int s_i{};
				max = std::max(max, calcFormula(s_i));
			}
	printf("%lld\n", max);

	return 0;
}

int64_t calcFormula(int& s_i)
{
	using pii = std::pair<int, int64_t>;
	std::stack<pii> st;
	st.push({3, calcExpression(s_i)});
	while (s_i < (int)S.size() && S[s_i] != ')')
	{
		int ope{translate(S[s_i])};
		s_i++;
		while (priority[ope] <= priority[st.top().first])
		{
			pii tmp{st.top()};
			st.pop();
			st.top().second = calcOperation(st.top().second, tmp.second, tmp.first);
		}
		st.push({ope, calcExpression(s_i)});
	}
	while (st.size() >= 2)
	{
		pii tmp{st.top()};
		st.pop();
		st.top().second = calcOperation(st.top().second, tmp.second, tmp.first);
	}
	return st.top().second;
}

int64_t calcExpression(int& s_i)
{
	int64_t ret{};
	if (S[s_i] == '(')
	{
		s_i++;
		ret = calcFormula(s_i);
		s_i++;
	}
	else
		ret = calcNum(s_i);
	return ret;
}

int64_t calcNum(int& s_i)
{
	int64_t ret{};
	while (s_i < (int)S.size() && isdigit(S[s_i]))
	{
		ret = 10 * ret + S[s_i] - '0';
		s_i++;
	}
	return ret;
}

char operators[8]{"*+-"};
int translate(char c)
{
	for (int i{}; i < 3; i++)
		if (c == operators[i])
			return i;
}

int64_t calcOperation(int64_t a, int64_t b, int ope)
{
	if (ope == 0) return a * b;
	else if (ope == 1) return a + b;
	else return a - b;
}


Measured memory_bytes: 3320
/*
date 2018-__-__
time:from:  to:
problem's name:
statue:
writer:Patrick_y
*/
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#include <math.h>
#include <stdio.h>
#include <time.h>
#define mp make_pair
typedef long long ll;
using namespace std;
const int INF=20050226;
/*------------main part------------*/



int dis[INF];
int main()
{
	int n;
	cin>>n;
	deque<int> q;
	q.push_back(1);
	for(int i=0;i<=n;i++)
	{
		dis[i]=INF;
	}
	dis[1]=1;
	while(!q.empty())
	{
		int x=q.front();
		q.pop_front();
		if(dis[(x*10)%n]>dis[x])
		{
			dis[(x*10)%n]=dis[x];
			q.push_front((x*10)%n);
		}
		if(dis[(x+1)%n]>dis[x]+1)
		{
			dis[(x+1)%n]=dis[x]+1;
			q.push_back((x+1)%n);
		}
	}
	cout<<dis[0];
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline bool Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
struct Node{
    vector<P> edges;
    bool done;
    ll cost;
};
ll n;
vector<Node> to(100005);
void dfs(ll node){
    to[node].done = true;
    for(P p:to[node].edges){
        if (to[p.first].done) continue;
        to[p.first].cost = p.second+to[node].cost;
        dfs(p.first);
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    ll a,b,c;
    rep(i,n-1){
        to[i].done = false;
        cin >> a >> b >> c;
        --a;
        --b;
        to[a].edges.push_back(P(b,c));
        to[b].edges.push_back(P(a,c));
    }
    ll q,k;
    cin >> q >> k;
    to[k-1].cost = 0;
    dfs(k-1);
    ll x,y;
    rep(i,q){
        cin >> x >> y;
        --x;
        --y;
        PRINT(to[x].cost+to[y].cost);
    }
}


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

int main(){
	int n, x, Min = 1000000, Max = -1000000;
	long long sum = 0;

	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> x;

		if(x < Min) Min = x;
		if(x > Max) Max = x;
		sum += x;
	}

	cout << Min << " " << Max << " " << sum << endl;

	return 0;
}


Measured memory_bytes: 3088
#include <iostream>

using namespace std;

int main(void){

  int a,b,i,p;
  cin >> a;
  cin >> b;
  p = 0;

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

    if (a >= b){
    p = p + a;
    a = a-1;
    }

    else{
    p = p + b;
    b = b-1;

    }


  }

  cout << p << endl;

  return 0;

}


Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef pair<int, int> II;
typedef pair<int, II> III;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<III> v;
	for (int i = 0; i < n; ++i) {
		int a, b;
		cin >> a >> b;
		v.push_back({ b, { b - a, a } });
	}
	sort(v.begin(), v.end());
	int t = 0;
	bool ans = true;
	for (int i = 0; i < n; ++i) {
		t += v[i].second.second;
		if (t > v[i].first) {
			ans = false;
			break;
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 4596
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
using namespace std;

int main(int argc, char* argv[]){

	int R;
	scanf("%d", &R);

	double pi = M_PI;

	printf("%f\n", 2.0*(double)R*pi);

	return 0;
}





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

struct UF {
	UF *p;
	int s;
	UF() :p(nullptr), s(1) {}
	UF *Find() {
		if (p == nullptr)
			return this;
		return p = p->Find();
	}
	int Union(UF &n) {
		auto *r = Find(), *nr = n.Find();
		if (r == nr) return 0;
		if (r->s < nr->s) swap(r, nr);
		nr->p = r, r->s += nr->s;
		return 1;
	}
} u[111111];
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		n -= u[x].Union(u[y]);
	}
	cout << n << endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(ll i = (k); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;
#define MOD 1000000007LL
template <typename T>
ostream& operator<<(ostream& s, const vector<T> &vec){
    for(int i=0;i<vec.size();i++){
        if(i) s << ',';
        else s << '{';
        s <<setw(2)<< vec[i];
    }
    s << '}' << endl;
    return s;
}


template <typename T>
T powm(T a, T b, T mod=MOD){
    if(b && b%2){
        return a*powm(a*a,b/2)%mod;
    }else if(b){
        return powm(a*a,b/2)%mod;
    }else{
        return 1;
    }
}

int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int> c(n);
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,n){
        cin>>c[i];
        rep(j,m)cin>>a[i][j];
    }
    int ans = MOD;
    rep(i,1<<n){
        bitset<12> bt(i);
        bool b=false;
        rep(k,m){
            int un=0;
            rep(j,n){
                if(bt[j]) un+=a[j][k];
            }
            if(un<x) {b=true;break;}
        }
        if(b) continue;
        int sum=0;
        rep(j,n){
            if(bt[j]) sum+=c[j];
        }
        ans=min(ans,sum);
    }
    if(ans==MOD) ans=-1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll A, B;
    cin >> A >> B;
    vector<string> s(100, "");
    rep(i, 100){
      if(i % 2 == 0){
        rep(j, 99){
          s.at(i) += ".";
        }
        s.at(i) += "#";
      }
      else{
        s.at(i) += ".";
        rep(j, 99){
          s.at(i) += "#";
        }
      }
    }
    ll c = 0;
    bool comp = false;
    if(A != 1){
      rep(i, 50){
        rep(j, 49){
          s.at(2*i).at(2*j+1) = '#';
          c++;
          if(c == A-1){
            comp = true;
            break;
          }
        }
        if(comp){
          break;
        }
      }
    }
    c = 0;
    comp = false;
    if(B != 1){
      rep(i, 50){
        rep(j, 49){
          s.at(99-2*i).at(2*j+2) = '.';
          c++;
          if(c == B-1){
            comp = true;
            break;
          }
        }
        if(comp){
          break;
        }
      }
    }
    cout << 100 << " " << 100 << endl;
    rep(i, 100){
      cout << s.at(i) << endl;
    }
}

Measured memory_bytes: 3616
import fractions

def gcd_list(a):
    ans = a[0]
    for i in range(1, N):
        ans = fractions.gcd(ans, a[i])
    return ans

N,X = map(int, input().split())
*x, = map(int, input().split())

dl = []
for i in range(N):
    dl.append(abs(x[i]-X))

print(gcd_list(dl))

Measured memory_bytes: 16280
import sys
from io import StringIO
import unittest

doTest=0

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    ans = ["hi", "hihi", "hihihi", "hihihihi", "hihihihihi"]

    yn(readline().strip() in ans)

    return

if doTest==0:
    resolve()
    sys.exit()

Measured memory_bytes: 6200
function main(input) {
    const args = input.split(' ');
    const D = parseInt(args[0], 10);

    if (D === 25) {
        console.log("Christmas");
    }
    else if (D === 24) {
        console.log("Christmas Eve");
    }
    else if(D === 23) {
        console.log("Christmas Eve Eve");
    }
    else if(D === 22) {
        console.log("Christmas Eve Eve Eve");
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
import sys
read = sys.stdin.buffer.read

import math
n, *lst = map(int, read().split())
t = prep = math.ceil(n / lst[0])
for i in lst[1:]:
  tt = math.ceil(n / i)
  if tt <= prep:
    t += 1
  else:
    t += 1 + tt - prep
    prep = tt
print(t)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int i = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int i = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int i = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}

int solve(){
    int n; cin >> n;
    vector<int> a(n); rep(i,n) cin >> a[i];
    int max = a[0];
    ll ans = 0;
    for(int i = 1; i < n; ++i){
        if(max > a[i]){
            ans += max - a[i];
        }
        else{
            chmax(max, a[i]);
        }
    }

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

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


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

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

  map<string, int> mp;

  mp.emplace("AC", 0);
  mp.emplace("WA", 0);
  mp.emplace("TLE", 0);
  mp.emplace("RE", 0);

  for (int i = 0; i < n; i++) {
    string tmp;
    cin >> tmp;
    mp[tmp]++;
  }
   
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
  return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	cout << s.substr(0, 3) << endl;
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (n > k * 2) {

	}
	return fac[n] / (fac[k] * fac[n - k]);
}

ll dp[201010][2];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char c[10][10];
vector<vector<ll>>tree;
ll cnt[202020];
bool flag[202020];

void dfs(ll x) {
	flag[x] = true;
	for (auto nv : tree[x]) {
		if (flag[nv] == false) {
			cnt[nv] += cnt[x];
			dfs(nv);
		}
	}
}

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, q;
	cin >> n >> q;
	tree.resize(n);
	rep(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	rep(i, q) {
		ll p, x;
		cin >> p >> x;
		p--;
		cnt[p] += x;
	}
	dfs(0);
	rep(i, n) {
		cout << cnt[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 25128
#include <stdio.h>

int main(void) {
	int a, b;
	scanf("%d %d", &a, &b);
	if(a==b) {
		printf("a == b\n");
	} else if(a>b) {
		printf("a > b\n");
	} else {
		printf("a < b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include<stdio.h>

int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(-1000 <= a&&1000 > b){
    if(a < b)printf("a < b\n");
    else if(a > b)printf("a > b\n");
    else if(a == b)printf("a == b\n");
  }
  return 0;
}

Measured memory_bytes: 1820
import sys
sys.setrecursionlimit(100000000)

N,M = map(int,input().split())
graph = {i:[] for i in range(N)}
for _ in range(M):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    graph[x].append(y)
    graph[y].append(x)


def f(u,c):
    color[u] = c
    for v in graph[u]:
        if color[v] == 0: # まだ塗られていない場合
            if not f(v,-c):
                return False
        else:
            if color[v] == c: # 隣接している頂点が同色の場合 二部グラフではない
                return False
    return True 

flag = True
color = [0 for _ in range(N)]
for i in range(N):
    if color[i] == 0:
        if not f(i,1):
            flag = False
            break

if flag: # 二部グラフ
    ans = color.count(1)*color.count(-1) - M
else:
    ans = N*(N-1)//2 - M

print(int(ans))

Measured memory_bytes: 37096
X, Y = map(int, input().split())
candidate = []
end = 0
for i in range(X, Y+1):
    temp = []
    while True:
        if i <= Y:
            temp.append(i)
        else:
            if len(temp)>len(candidate):
                candidate = temp
                end = 1
            break
        i *= 2
    if end == 1:
        break
    
print(len(candidate))

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b){ return b ? gcd(b , a % b ) : a;}
ll lcm(ll a, ll b){ return a / gcd( a, b ) * b; }

ll f( ll x, int c, int d ){
	ll res = x;
	res -= x / c;
	res -= x / d;
	res += x / lcm( c, d );
	return res;
}

int main(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans = f(b,c,d) - f (a-1,c,d);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
/*****include*****/
#include <iostream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
/*****変数置き場*****/
	int month_table[] = {31,28,31,30,31,30,31,31,30,31,30,31};
	int mnt_leap_table[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	int numdate1 = 0;
	int numdate2 = 0;
	int sum_date = 0;
	int year1,month1,day1,year2,month2,day2;
	/*****処理部*****/
	while(1){
		cin >> year1 >> month1 >> day1 >> year2 >> month2 >> day2;
		if(year1<0 || month1<0 || day1<0 || year2<0 || month2<0 || day2<0)	break;
		numdate1 = 0;
		numdate2 = 0;
		sum_date = 0;
		
		if((year1%4 == 0 && year1%100!=0) || year1%400==0)
			for(int i=1;i<month1;i++)
				numdate1 += mnt_leap_table[i-1];
		else
			for(int i=1;i<month1;i++)
				numdate1 += month_table[i-1];
		numdate1 += day1;
		if((year2%4 == 0 && year2%100!=0) || year2%400==0)	
		for(int i=1;i<month2;i++)
			numdate2 += mnt_leap_table[i-1];
		else
			for(int i=1;i<month2;i++)
				numdate2 += month_table[i-1];
		numdate2 += day2;
		for(int i=year1;i<year2;i++){
			if((i%4==0 && i%100!=0) || i%400==0)	
				sum_date += 366;
			else
				sum_date += 365;
		}
		sum_date += numdate2 - numdate1;
		cout << sum_date << endl;
	}
	/*****処理終了後*****/
	return 0;
}

Measured memory_bytes: 1160
r,g,b,n= map(int, input().split())
[r,g,b] = sorted([r,g,b])
cnt = 0
for i in range(n//b+1):
  for j in range((n-b*i)//g+1):
    if n>=b*i+g*j and (n-(b*i+g*j))%r==0: cnt += 1
print(cnt)

Measured memory_bytes: 65576
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

c = input()

print(string.ascii_lowercase[string.ascii_lowercase.index(c)+1])

Measured memory_bytes: 31160
#include<cstdio>
using namespace std;

int main() {
  int n, Rt;
  int maxv = -2e9;
  int minv = 2e9;

  scanf("%d", &n);

  for ( int i = 0; i < n; i++ ) {
    scanf("%d", &Rt);
    maxv = maxv > Rt-minv ? maxv : Rt-minv;
    minv = minv < Rt ? minv : Rt;
  }

  printf("%d\n", maxv);

  return 0;
}


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

int main() {
  string s;
  cin >> s;
  
  if(s == "ABC") cout << "ARC" << endl;
  else if(s == "ARC") cout << "ABC" << endl;
}



Measured memory_bytes: 3548
n, m, x, y =  (int(i) for i in input().split())
xs = [int(i) for i in input().split()]
ys = [int(i) for i in input().split()]

def is_war(x,y,xs,ys):
    mx = max(xs)
    my = min(ys)
    z = (mx + my) / 2
    if my <= mx or my <=x:
        return True
    if mx >=my or mx >=y:
        return True
    if x < z <=y:
        return False
    return True
    # if my <= x:
    #     return True
    # elif mx >= y:
    #     return True
    # elif my <= mx:
    #     return True
    # else:
    #     return False

if is_war(x,y,xs,ys):
    print("War")
else:
    print("No War")



Measured memory_bytes: 3064
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long n = Long.parseLong(scan.next());
        scan.close();

        if (n == 1) {
            System.out.println(0);
            return;
        }

        Map<Long, Integer> pMap = new HashMap<Long, Integer>();
        for (long i = 2; i < Math.sqrt(n); i++) {
            int count = 0;
            while (n % i == 0) {
                count++;
                n /= i;
            }
            if (count > 0) {
                pMap.put(i, count);
            }
        }
        if (n != 1) {
            pMap.put(n, 1);
        }

        int ans = 0;
        for (int pCount : pMap.values()) {
            int i = 1;
            while (pCount >= i) {
                pCount -= i;
                ans++;
                i++;
            }
        }

        System.out.println(ans);
    }

}


Measured memory_bytes: 35740
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int main() {
	cin >> n;
	vector<int> a(1 << n);
	for (int i = 0; i < 1 << n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) {
		vector<int> b;
		for (int j = 0; j < a.size(); j += 2) {
			if (a[j] > a[j + 1]) b.push_back(a[j] - a[j + 1]);
			if (a[j] == a[j + 1]) b.push_back(a[j]);
			if (a[j] < a[j + 1]) b.push_back(a[j + 1] - a[j]);
		}
		a = b;
	}
	cout << a[0] << endl;
	return 0;
}

Measured memory_bytes: 1916
H = int(input())

memo_count = {}
def searchCount(h):
    if h==1: # 脱出条件
        return 1
    elif h in memo_count:
        return memo_count[h]
    else:
        h_half = int(h / 2)
        memo_count[h] = 1 + 2*searchCount(h_half)
        return memo_count[h]

print(searchCount(H))


Measured memory_bytes: 3060
/**
*   @Author : MeGaCrazy
*   @InitTime : Sat Dec 29 19:36:06 2018
*   @Idea :
*
*
*
*
*
*  Happy Solving :)
**/
#include <bits/stdc++.h>
using namespace std;

int main(){
#ifndef ONLINE_JUDGE
//   freopen("in","r",stdin);
   //freopen("out","w",stdout);
#endif
      int n;
      scanf("%d",&n);
      long long cura,curb;
      scanf("%lld %lld",&cura,&curb);
      for(int i=1;i<n;i++){
      	 long long a,b;
      	 scanf("%lld %lld",&a,&b);
      	 long long d=max(cura/a,curb/b);
      	 while(cura > a*d || curb > b*d)d++;
      	 cura=d*a;
      	 curb=d*b;
      }
      printf("%lld",cura+curb);



}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
int main(void)
{
  int kaisu;
  int i;
  scanf("%d",&kaisu);
  for(i=0;i<kaisu;i++){
    double a,b,c,d,e,f;
    double kyori;
    scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f);
    kyori=sqrt((d-a)*(d-a)+(e-b)*(e-b));
    if(kyori<c-f)
      puts("2");
    else if(kyori<f-c)
      puts("-2");
    else if(kyori<=c+f)
      puts("1");
    else
      puts("0");
  }
  return 0;
}


Measured memory_bytes: 2028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int n;
    string s; 
    cin >> n >> s;
    int left = 0, right = n - 1;
    int ans = 0;
    while(left <= right){
        if(s[left] == 'W'){
            while(right >= 0){
                if(s[right] != 'R') {
                    right--;
                } else {
                    break;
                }
            }
            if(right < left) break;
            ans++;
            right--;
        }
        left++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    while(S.length()) {
        S.pop_back();
        if(S.length() % 2 == 1) continue;
        int half = S.length() / 2;
        bool ok = true;
        rep(i, half) {
            if (S[i] != S[i + half]) ok = false;
        }
        if(ok) {
            cout << S.length() << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
         
typedef long long ll;
using namespace std;
        
#define F first
#define S second
#define sqr(x) x*x
#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define repit(i, n) for(auto it = n.begin(); it != n.end(); ++it)
       
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);}
          
bool comp(pair<string, int> a, pair<string, int> b){
    return a.S < b.S;
}

int main(){ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    int sum = 0 ;
    for(int i =0 ; i < sz(s); ++i){
        sum += s[i] - '0';
    }
    if(atoi(s.c_str()) % sum == 0) cout << "Yes";else{
        cout << "No";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int X,i,j,M=1;
  cin>>X;
  for(i=1;i<1000;i++){
    if(pow(i,1)>X) break;
    for(j=2;j<1000;j++){
      if(pow(i,j)<=X){
        int a=pow(i,j);
        M=max(M,a);
      }else break;
    }
  }
  cout<<M<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] maze = new char[h][w];
		int[][] distance = new int[h][w];
		Boolean[][] flag = new Boolean[h][w];
		int whiteCount = 0;
		
		for (int i = 0; i < h; i++) {
			String line = sc.next(); 
			for (int j = 0; j < w; j++) {
				char c = line.charAt(j);
				maze[i][j] = c;
				if (c == '.') {
					whiteCount++;
				}
			}
		}
	
		for (int i = 0; i < h; i++) {
			Arrays.fill(distance[i], Integer.MAX_VALUE);
		}
		
		for (int i = 0; i < h; i++) {
			Arrays.fill(flag[i], false);
		}
		
		Deque<Point> queue = new ArrayDeque<>();
		Point start = new Point(0, 0);
		flag[start.y][start.x] = true;
		distance[0][0] = 1;
		queue.addLast(start);
		int dx[] = {1, 0, -1, 0};
		int dy[] = {0, 1, 0, -1};
		
		while (!queue.isEmpty()) {
			Point p = queue.removeFirst();
			
			for (int i = 0; i < 4; i++) {
				int tmpX = p.x + dx[i];
				int tmpY = p.y + dy[i];
				if (tmpX >= 0 && tmpX < w && tmpY >= 0 && tmpY < h && flag[tmpY][tmpX] == false && maze[tmpY][tmpX] == '.') {
					flag[tmpY][tmpX] = true;
					queue.addLast(new Point(tmpX, tmpY));
					//if (distance[tmpY][tmpX] < distance[p.y][p.x] + 1) {
						distance[tmpY][tmpX] = distance[p.y][p.x] + 1;
					//}
				}
			}
		}
		if (flag[h - 1][w - 1]) {
			System.out.println(whiteCount - distance[h - 1][w - 1]);
		} else {
			System.out.println(-1);
		}
		
		/*
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				System.out.print(distance[i][j] + " ");
			}
			System.out.println();
		}
		*/
	}
}

class Point {
	public int x, y;
	
	public Point(int x, int y) {
		this.x = x;
		this.y = y;
	}
}

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

#define int long long
#define endl "\n"
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define IN freopen("input.txt","r",stdin);
#define OUT freopen("output.txt","w",stdout);

const int N = 2e5 + 5;

void solve();
int32_t main()
{
    IOS;
    int cnt=0;
    for(int i=1;i<=5;i++){
        int x;
        cin >> x;
        if(x==0)
            cnt = i;
    }
    cout << cnt << endl;

}



Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <bool Directed, typename TEdge, bool Index> struct graph {
    using EType = TEdge;
    vector<TEdge> edges;
    vector<vector<int>> adj;
    graph(int n) : adj(n + Index) {}
    graph(int n, int m) : graph(n) { edges.reserve(m << not Directed); }
    TEdge& operator()(int e) { return edges[e]; }
    vector<int>& operator[](int u) { return adj[u]; }
    int size() { return adj.size() - Index; }
    void add_edge(const TEdge& e) {
        adj[e.u].push_back(edges.size());
        edges.push_back(e);
        if(not Directed) {
            adj[e.v].push_back(edges.size());
            edges.push_back(e.reverse());
        }
    }
};
struct edge {
    int u, v;
    edge reverse() const { return {v, u}; }
    friend ostream& operator<<(ostream& os, const edge& e) {
        return os << "(" << e.u << ", " << e.v << ")";
    }
};
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    graph<0, edge, 1> g(n, n - 1);
    for(int i = 1; i < n; i++) {
        int x, y;
        cin >> x >> y;
        g.add_edge({x, y});
    }
    vector<ll> C(n + 1), prod_S(n + 1, 1), prod_U(n + 1), sub(n + 1), ans(n + 1);
    function<void(int, int)> dfs1 = [&](int u, int from) {
        C[u] = 1;
        for(int e : g[u]) {
            if(g(e).v != from) {
                dfs1(g(e).v, u);
                C[u] = C[u] * C[g(e).v] % m;
            }
        }
        C[u] = (C[u] + 1) % m;
        ll p = 1;
        for(auto it = g[u].begin(); it != g[u].end(); it++) {
            if(g(*it).v != from) {
                prod_S[g(*it).v] = prod_S[g(*it).v] * p % m;
                p = p * C[g(*it).v] % m;
            }
        }
        p = 1;
        for(auto it = g[u].rbegin(); it != g[u].rend(); it++) {
            if(g(*it).v != from) {
                prod_S[g(*it).v] = prod_S[g(*it).v] * p % m;
                p = p * C[g(*it).v] % m;
            }
        }
    };
    dfs1(1, 0);
    function<void(int, int)> dfs2 = [&](int u, int from) {
        C[u] = (C[u] + C[from]) % m;
        prod_U[u] = (prod_U[from] * prod_S[u] % m + 1) % m;
        sub[u] = (sub[from] + prod_U[u]) % m;
        ans[u] = (C[u] - sub[u] + m) % m;
        for(int e : g[u]) {
            if(g(e).v != from) {
                dfs2(g(e).v, u);
            }
        }
    };
    dfs2(1, 0);
    for(int v = 1; v <= n; v++) {
        cout << ans[v] << endl;
    }
    return 0;
}

Measured memory_bytes: 18816
#include <iostream>
#include <ctype.h>

int main() {
    unsigned int num;
    unsigned int output;

    std::cin >> num;
    

    if((num % 2) == 0){
        output =  num;
    }else{
        output =  num * 2;
    }

    std::cout << output << std::endl;

}

Measured memory_bytes: 256
s=input()
n=len(s)
k=0
if n%2==0:
  n2=int(n/2)
  k+=n2
  for i in range(n2):
    if '0' in s[n2-i-1:n2+i+1] and '1' in s[n2-i-1:n2+i+1]:
      break
    k+=1
  print(k)
else:
  n3=int((n-1)/2)
  k+=n3
  for i in range(n3+1):
    if '0' in s[n3-i:n3+i+1] and '1' in s[n3-i:n3+i+1]:
      break
    k+=1
  print(k)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long 
#define mod 1000000007
int main(){
  int n;
  cin>>n;
  int arr[n];
  for(int i=0; i<n; i++)	cin>>arr[i];
  int ans[n];
  int all = arr[0];
  for(int i=1; i<n; i++){
  	all = int(all^arr[i]);
  } 
  for(int i=0; i<n; i++){
  	ans[i] = int(all^arr[i]);
  	cout<<ans[i]<<" ";
  }

  return 0;
}

Measured memory_bytes: 5168
while True:
    s = raw_input().split()
    if s[1] == '?':
        break
    elif s[1]=='+':
        print (int(s[0])+int(s[2])) 
    elif s[1]=='-':
        print (int(s[0])-int(s[2])) 
    elif s[1]=='*':
        print (int(s[0])*int(s[2])) 
    elif s[1]=='/':
        print (int(s[0])/int(s[2])) 

Measured memory_bytes: 6448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<int> vei;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	//cout.precision(10);
	cin.tie(0);
	ios::sync_with_stdio(false);

    string s, t; cin >> s >> t;
    rep(i,s.length()) {
        string one = s.substr(0, i);
        string two = s.substr(i, s.size() - i);
        if(two + one == t) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256