akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string x;cin>>x;
    ll ans = 0, ex = 0;
    for(char c:x){
        if(c=='T')ex++;
        else ex--;
        ans=max(ans,ex);
    }
    cout<<2*ans<<endl;

    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

// #define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;

using P = pair<int, int>;


vector<int> to[100005];
int frie[100005];



signed main(){
    int n, k, q;
    cin >> n >> k >> q;
    if(q<k) {
        rep(i,n) cout << "Yes" << endl;
        return 0;
    }
    vector<int> aa(n,0);
    int ma = 0;
    rep(i,q) {
         int a;
         cin >> a;
         a--;
         aa[a]++;
    }
    rep(i,n) aa[i] = k - q + aa[i];
    rep(i,n) {
        if(aa[i]>0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

     

    return 0;
}



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

using namespace std;
int main()
{
    char s[11];
    int count=0,h=0;
    scanf("%s",s);
    for(int i=0;;i++)
    {
        if(s[i])
        {
            if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G')
                {
                    count++;
                    if(count>h)
                        h=count;
                }
            else count=0;
        }
        else break;
    }
    cout<<h;
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())

# n:人の数
# m:食べものの種類

foods = list(range(1, m+1))

for _ in range(n):
    ans = list(map(int, input().split()))[1:]

    new_foods = []
    for a in ans:
        if a in foods:
            new_foods.append(a)

    foods = new_foods

print(len(foods))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	
	if(a<=b){
		for(int i=1;i<=b;i++)
		cout<<a;
	}
	else {
	
		for(int i=1;i<=a;i++)
		cout<<b;
	}
		
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
//Leonidas
#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container'.',hpp>
//#include <ext/pb_ds/tree_policy'.',hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1e9+7;
//const int mod=1009;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int32_t main()
{
    speed
    int l,r,d;
    cin>>l>>r>>d;
    cout<<r/d-(l-1)/d;
    return 0;
}


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

const int M = 1000005;
int main() {
    int n; cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    vector<int> cnt(M, 0);
    rep(i, n){
        if(cnt[a[i]] != 0){
            cnt[a[i]]++;
            continue;
        }
        for(int j = a[i]; j < M; j+=a[i]) cnt[j]++;
    }

    int ans = 0;
    rep(i, n){
        if(cnt[a[i]] == 1) ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7988
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 100001;
int p=1000000007;
typedef long long ll;
int main()
{
  int n,t,i;
  int c[N_MAX];
  ll res=1;
  cin >> n;
  fill(c,c+n,0);
  for(i=0;i<n;i++){
    cin >> t;
    if((n+t)%2!=1||(t==0&&c[t]>=1)||c[t]>=2){
      cout << "0" << endl;
      return 0;
    }
    c[t]++;
  }
  for(i=0;i<n;i++)
    if(c[i]>0){
      res*=c[i];
      res%=p;
    }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    int N; cin >> N;
    vector<l_l> p(N);
    rep(i,N) {
        ll x,l; cin >> x >> l;
        p[i].fs = x + l;
        p[i].sc = x - l;
    }
    sort(all(p));

    int id = 1;
    ll nowX = p[0].fs;
    int cnt = 1;
    while(id < N) {
        if(p[id].sc >= nowX) { cnt++; nowX = p[id].fs; }
        id++;
    }
    cout << cnt << endl;





}

Measured memory_bytes: 1920
n = int(input())
a = {}
xy = {}
for i in range(n):
    a[i] = int(input())
    xy[i] = {}
    for j in range(a[i]):
        xy[i][j] = list(map(int,input().split()))
ans = []
for i in range(2 ** n):
    flag = []
    k_low = bin(i)[2:]
    if len(k_low) < n:
        k_low = "0" * (n-len(k_low)) + k_low
    for k in k_low:
        flag.append(int(k))
    mujun = 0
    for x in range(len(xy)):
        if flag[x] == 1:
            for y in range(len(xy[x])):
                if flag[xy[x][y][0]-1] != xy[x][y][1]:
                    mujun = 1
    if mujun == 0:
        ans.append(flag)
sum_list = []
for answer in ans:
    sum_list.append(sum(answer))
print(max(sum_list))

Measured memory_bytes: 51676
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

int main() {
  long long int N, cnt = 0;
  string S;
  vector<long long int> a_v, b_v, c_v, k_v(26, 0), p_v;
  std::map<std::string, int> mp;
  int flag = 0;
  cin >> N;
  for (int i = 0 ; i < N; i++) {
    long long int p;
    cin >> p;
    p_v.push_back(p);
  }
  for (int i = 1; i < N-1; i++) {
    if ((p_v[i-1] < p_v[i] && p_v[i] < p_v[i+1]) ||
        (p_v[i-1] > p_v[i] && p_v[i] > p_v[i+1])) {
      cnt++;
    }
  }
  cout << cnt << endl;
  // for (int i = 0; i < N; i++) {
  //   //cout << i << endl;
  //   long long int t;
  //   cin >> t;
  //   a_v.push_back(t);
  // }
  // sort(a_v.begin(), a_v.end());
  // for (int i = 0; i < N; i++) {
  //   //cout << i << endl;
  //   long long int t;
  //   cin >> t;
  //   b_v.push_back(t);
  // }
  // sort(b_v.begin(), b_v.end());
  // for (int i = 0; i < N; i++) {
  //   //cout << i << endl;
  //   long long int t;
  //   cin >> t;
  //   c_v.push_back(t);
  // }
  // sort(c_v.begin(), c_v.end());

  // int min_j = 0, max_k = N;
  // long long int sum = 0, a_cnt = 0, c_cnt = 0;
  // for (int i = 0; i < N; i++) {//b
  //   a_cnt = c_cnt = 0;
  //   for (int j = N-1; j >= 0; j--) { // a
  //     if (a_v[j] >= b_v[i]) {
  //       break;
  //     }
  //     else {
  //       a_cnt++;
  //     }
  //   }

  //   for (int k = 0; k < N; k++) { // c
  //     if (c_v[k] <= b_v[i]) {
  //       break;
  //     }
  //     else {
  //       c_cnt++;
  //     }
  //   }
  //   sum += a_cnt*c_cnt;
  // }

  // cout << sum << endl;
  // // int min_j = 0, min_k = 0;
  // // for (int i = 0; i < N; i++) {//c
  // //   int flag = -1;
  // //   for (int j = 0; j < N; j++) {//b
  // //     if (c_v[i] < b_v[j]) {
  // //       flag = 0;
  // //       min_j = j;
  // //       for (int k = 0; k < N; k++) {//a
          
          
  // //       }
  // //     }
  // //   }
  // // }
  // // if (N == 1) {
  // //   printf("%lld", t_v[0]);
  // //   return 0;
  // // }
  // // long long int mul = lcm(t_v[0], t_v[1]);
  // // //printf("%lld\n", mul);

  // for (int i = 2; i < N; i++) {
  //   mul = lcm(mul, t_v[i]);
  //   //printf("%d %lld\n", i, mul);
  //   // cout << i << " " <<  mul << endl;
  // }
  // cout << mul << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

int main(int argc, const char * argv[]) {
    int N;
    cin >> N;
    vector<ll> VL(N), VR(N);
    for (int n=0; n<N; ++n) {
        cin >> VL[n] >> VR[n];
    }
    
    sort(VL.begin(), VL.end(), greater<ll>());
    sort(VR.begin(), VR.end());
    
    for (int n=1; n<N; ++n) {
        VL[n] += VL[n-1];
        VR[n] += VR[n-1];
    }
    
    ll Res = VL[0] - VR[0];
    Res = max(Res, VL[0] -VR[1]);
    for (int n=0; n<N-1; ++n) {
        for (int dif=-1; dif<=1; ++dif) {
            Res = max(Res, VL[n]-VR[n+dif]);
        }
    }
    Res *= 2;
    cout << Res << endl;

    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    ll n,x;cin>>n>>x;
    vector<ll> ans(2*n-1,0);

    if(x==1 || x==2*n -1){
        cout<<"No"<<endl;
        return 0;
    }

    cout<<"Yes"<<endl;

    if(x>(2*n-1)/2){
        ans[(2*n-1)/2]=2*n-1;
        ans[(2*n-1)/2 -1]=1;
        ans[(2*n-1)/2 +1]=x;
        if((2*n-1)/2 +2 <2*n-1)ans[(2*n-1)/2 +2]=2;
        ll ind=0;
        for(int i=3;i < 2*n-1;i++)
        {
            if(ans[ind]==0){
                if(i!=x){
                    ans[ind]=i;
                    ind++;
                }
            }else{
                ind++;
                i--;
            }
        }
    }else{
        ans[(2*n-1)/2]=1;
        ans[(2*n-1)/2 -1]=2*n-1;
        ans[(2*n-1)/2 +1]=x;
        if((2*n-1)/2 +2 <2*n-1)ans[(2*n-1)/2 +2]=2*n-2;
        ll ind=0;
        for(int i=2;i < 2*n-2;i++)
        {
            if(ans[ind]==0){
                if(i!=x){
                    ans[ind]=i;
                    ind++;
                }
            }else{
                ind++;
                i--;
            }
        }
    }

    rep(i,2*n-1){
        cout<<ans[i]<< (i==2*n-2 ? '\n' : ' ');
    }
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
typedef pair<mp,mp> mmp;
ll inf =  1e9;

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

int main(){
 while(1){
  ll w,h;
  cin>>w>>h;
  if(w==0)break;
  vector<vector<ll> > t(h,vector<ll>(w,4) );
  for(ll i=0;i<h;i++){
   for(ll j=0;j<w;j++)cin>>t[i][j];
  }

  ll c[4];
  for(ll i=0;i<4;i++)cin>>c[i];

  priority_queue<mmp,vector<mmp>,greater<mmp> > q;
  vector<vector<vector<ll> > > dp(4,vector<vector<ll> >(h,vector<ll>(w,inf) ) );
  //dp[0][0][0] = 0;
  //ll dir = 0;
  q.push( mmp( mp(0,0) , mp(0,0) ) );

  while( !q.empty() ){
   mmp now = q.top();
   q.pop();
   ll x = now.second.first;
   ll y = now.second.second;
   ll dir = now.first.second;
   ll cost = now.first.first;
   if( dp[dir][x][y] != inf ) continue;
   dp[dir][x][y] = cost;
   if( t[x][y] != 4 ){
    ll nd = (dir + t[x][y])%4;
    ll nx = x + dx[nd];
    ll ny = y + dy[nd];
    if( 0<= nx && nx < h && 0<= ny && ny < w )
     q.push( mmp( mp( cost , nd ) , mp( nx,ny ) ) );
   }

   for(ll i=0;i<4;i++){
    ll nd = (dir + i)%4;
    ll nx = x + dx[nd];
    ll ny = y + dy[nd];
    if( 0<= nx && nx < h && 0<= ny && ny < w )
     q.push( mmp( mp( cost+c[i] , nd ) ,mp( nx,ny ) ) );
   }

  }
  ll res = inf;
  for(ll i=0;i<4;i++) res = min( res , dp[i][h-1][w-1] );
  cout<<res<<endl;

 }
    return 0;
}



Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1)
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y<<endl;


return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>
#include <algorithm>

int main(void)
{
  const std::list<std::string> list{ "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  std::string input;
  
  std::cin >> input;
  
  auto itr = std::find(list.begin(), list.end(), input);  
  std::size_t index = std::distance(list.begin(), itr);
  
  std::cout << 7 - index << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int a,b;
	cin >> a >>b;
	cout << a + b/2 << endl;
	return 0;
}


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

int main()
{
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);

	vector<int> v;
	v.clear();

	int sum = a+b;
	v.push_back(sum);
	sum = 0;
    sum = b+c;
	v.push_back(sum);
	sum = 0;
	sum = a+c;
	v.push_back(sum);
	sum = 0;

	sort(v.begin(), v.end());

	printf("%d\n", v[0]);

	return 0;
}


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

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int n; cin >> n;
    cout << (n + 111-1) / 111 * 111 << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3648
N,M = list(map(int,input().split(" ")))
As = list(map(int,input().split(" ")))

# N → 10^4 数字0-9 → 10^5

match= [-1,2,5,5,4,5,6,3,7,6]

dp = [-1 for _ in range(N + 100)] #N 本使ったときの最大値
dp[0] = 0
for num in As:
    dp[match[num] ]  = 1

for i in range(N + 1):
    for num in As:
        match_num = match[num]
        if i - match_num >= 0:
            #数字numを使うときのマッチの本数
            dp[i] = max( dp[i - match_num] + 1 , dp[i])
# print(dp)

ans = []
cot = N
As.sort(reverse=True)
while True:
    if cot == 0:
        break
    for num in As:
        if dp[cot - match[num]]  == dp[cot] - 1:
            ans.append(str(num))
            cot -= match[num]
            break
print("".join(ans))

Measured memory_bytes: 43376
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n, k;
	cin >> n >> k;
	int arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr, arr + n);
	ll sum = 0;
	for (int i = 0; i < k; i++)
		sum += arr[i];
	cout << sum;
	return 0;
}


Measured memory_bytes: 3536
#include<iostream>
#include<cstdio>
using namespace std;
const int mod=1e9+7;
int n,k,ans;
int read(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int main()
{
	n=read(); k=read(); int res=1;
	for(int i=1;i<=n+1;i++){
		res=(res+n+1-i+1-i)%mod;
		if(i>=k)ans=(ans+res)%mod;
	} cout<<(ans+mod)%mod<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)

int n, m;
int x[51], y[51], z[51];
int dp1[51][51][51];
int dp2[51][51][51];
const int INF = 1e9;
int cost(int a, int b, int c) {
    if (dp1[a][b][c] != -INF) return dp1[a][b][c];
    int res = -INF;
    rep(i, b + 1) rep(j, c + 1) {
        if (i == 0 && j == 0)
            res = max(res, z[a]);
        else if (i + j <= 8)
            res = max(res, i * x[a] + j * y[a]);
    }
    return dp1[a][b][c] = res;
}
int dfs(int a, int b, int c) {
    if (a == n) return 0;
    if (dp2[a][b][c] != -INF) return dp2[a][b][c];
    // int res = dfs(a + 1, b, 0) + z[a];
    int res = -INF;

    rep(i, b + 1) {
        int s = -INF;
        rep(j, i + 1) {
            rep(k, c + 1) {
                if (k == 0 && j == 0)
                    s = max(z[a], s);
                else if (j + k <= 8)
                    s = max(s, j * x[a] + k * y[a]);
            }
        }
        res = max(res, dfs(a + 1, b - i, i) + s);
    }

    // rep(i, b + 1) { res = max(res, dfs(a + 1, b - i, i) + cost(a, i, c)); }

    return dp2[a][b][c] = res;
}
int main() {
    rep(i, 51) rep(j, 51) rep(k, 51) dp1[i][j][k] = -INF;
    rep(i, 51) rep(j, 51) rep(k, 51) dp2[i][j][k] = -INF;
    cin >> n >> m;
    rep(i, n) cin >> x[i] >> y[i] >> z[i];
    cout << dfs(0, m, 0) << endl;
}

Measured memory_bytes: 4140
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
template<typename T>
T minch(T& l, T r) {
    return l = min(l, r);
}
template<typename T>
T maxch(T& l, T r) {
    return l = max(l, r);
}
template<typename T>
void output(const T& val) {
    cout << val << endl;
}
template<typename T>
void output(const vector<T>& vec, const bool newline = false) {
    for (const T& val : vec)cout << val << (newline ? '\n' : ' '); cout << endl;
}
template<typename T>
void output(const vector<vector<T>>& mat) {
    for (const auto& row : mat)output(row);
}
// ============ template finished ============

int main()
{
    ll N, K;
    cin >> N >> K;
    ll times = N / K;
    N -= K * times;
    output(min(N, abs(K - N)));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, k, choice[3001][3001];
ll MOD = 1e9+7;

ll choiceINIT(ll n, ll m){
	for(ll i = 0; i <= n; i++){for(ll j = 0; j <= m; j++){choice[i][j] = 0;}}
	choice[0][0] = 1;
	for(ll i = 1; i <= n; i++){
		choice[i][0] = 1;
		for(ll j = 1; j <= m; j++){
			choice[i][j] = choice[i-1][j-1]+choice[i-1][j];
			choice[i][j] %= MOD;
		}
	}
	return 0;
}

int main() {
	cin >> n >> k;
	
	//choiceINIT(n, k);
	if(n != k){
		choiceINIT(2000, 1000);
		//cout << ((choice[n-k-1][0]+choice[n-k-1][1])*choice[k-1][0])%MOD << endl;
		
		for(ll i = 1; i <= k; i++){
			ll ans = (n-k-1-(i-2) >= 0 && i > 1)? choice[n-k-1][min(i-2, n-k-1-(i-2))] : 0;
			ans += (n-k-1-(i-1) >= 0)? 2*choice[n-k-1][min(i-1, n-k-1-(i-1))] : 0;
			ans += (n-k-1-i >= 0)? choice[n-k-1][min(i, n-k-1-i)] : 0;
			ans %= MOD;
			ans *= choice[k-1][min(i-1, k-i)];
			ans %= MOD;
			cout << ans << endl;
		}
	}
	else{
		cout << 1 << endl;
		
		for(ll i = 2; i <= k; i++){
			cout << 0 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 46336
n, x = list(map(int, input().split()))
vs = list(map(int, input().split()))

c = 0
for i in range(n-1):
    sum2 = vs[i] + vs[i+1]
    if sum2 <= x:
        continue

    surplus = sum2 - x
    c += surplus
    vs[i+1] -= min(vs[i+1], surplus)

print(c)

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

#include <bits/stdc++.h>
#include <sys/resource.h>

#define FOR(i,s,e) for(int i=(s);i<(int)(e);i++)
#define FOE(i,s,e) for(int i=(s);i<=(int)(e);i++)
#define REP(i,n)   FOR(i,0,n)
#define ALL(x) (x).begin(), (x).end()
#define CLR(s) memset(s,0,sizeof(s))
#define PB push_back
#define ITER(v)      __typeof((v).begin())
#define FOREACH(i,v) for(ITER(v) i=(v).begin();i!=(v).end();i++)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int> vi;
#define x first
#define y second


void set_stack_size() {
    const rlim_t kStackSize = 256 * 1024 * 1024;   // min stack size = 256 MB
    struct rlimit rl;
    int result;

    result = getrlimit(RLIMIT_STACK, &rl);
    if (result == 0)
    {
        if (rl.rlim_cur < kStackSize)
        {
            rl.rlim_cur = kStackSize;
            result = setrlimit(RLIMIT_STACK, &rl);
            if (result != 0)
            {
                fprintf(stderr, "setrlimit returned result = %d\n", result);
            }
        }
    }
}


int main() {
    set_stack_size();

    for (int n; cin >> n; ) {
        vector<LL> a(n), ans(n);
        for (auto &x : a) cin >> x;

        LL x1 = 0LL;
        for (int i = 0; i < n; i++) {
            x1 += a[i] * (i % 2 == 0 ? 1 : -1);
        }
        ans[0] = x1;
        for (int i = 1; i < n; i++) {
            ans[i] = a[i - 1] * 2 - ans[i - 1];
        }

        for (auto &x : ans) cout << x << " ";
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 2944
// Problem Link: 
// Tutorial Link: 

#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long
#define ll  long long
#define all(v) v.begin(), v.end()
#define pb push_back
#define pLL pair<LL,LL>
#define ff first
#define ss second
#define rep(i,a,b) for(LL i=a;i<b;++i)
#define repb(i,a,b) for(LL i=a;i>b;--i)
#define ld double
#define mp make_pair
#define vLL vector<LL>
#define vpLL vector<pLL>
#define vld vector<ld>
#define pld pair<ld,ld>
#define vpld vector<pld>
#define SLL set<LL>
#define SpLL set<pLL>
#define FIO ios::sync_with_stdio(false)
#define mod 1000000007

LL n, k, kk, p[5005], c[5005], vis[5005];

pLL circle(LL v) {
	LL cnt = 0, cur = v, sum = 0;
	while(true) {
		if(p[cur] == v) return mp(sum + c[v], cnt+1);
		cur = p[cur];
		sum += c[cur];
		cnt++;
	}
}

int main()
{
	FIO;
	cin >> n >> kk;
	rep(i,1,n+1) cin >> p[i];
	rep(i,1,n+1) cin >> c[i];
	LL ans = -mod*100LL;
	rep(i,1,n+1) {
		LL cnt = 0, cur = i, sc = 0;
		rep(j,1,n+1) vis[j] = 0;
		vis[i] = 1;
		LL chk = false;
		k = kk;
		while(cnt < k) {
			sc += c[p[cur]];
			ans = max(ans, sc);
			cur = p[cur];
			cnt++;
			if(chk == false && vis[cur] == 1) {
				chk = true;
				pLL val = circle(cur);
				if(val.ff > 0) {
					sc += val.ff * ((k-cnt-1)/val.ss);
				}
				k -= ((k-cnt-1)/val.ss)*val.ss;
				ans = max(ans, sc);
				// cout << i << " "<< sc << " " << k << endl;
			}
			vis[cur] = 1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3736
#include<stdio.h>
#include<string.h>
int main()
{
    char s[105];
    int l,i;
    scanf("%s",s);
    l=strlen(s);
    for(i=0; i<l; i++)
    {
        s[i]='x';
    }
    s[i]='\0';
    printf("%s\n",s);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;

typedef long long       ll;
typedef long double     ld;

typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vll>     vvll;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef pair<ll, int>   pli;
typedef pair<ll, ll>    pll;
typedef vector< pii >   vpi;
typedef vector< pll >   vpll;

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

#define pb           push_back
#define mod          1000000007
#define INF          1e17
#define mini         INT_MIN
#define maxo         INT_MAX
#define eb           emplace_back
#define ff           first
#define ss           second
#define re           return 
#define endl         "\n" 

#define all(c)       c.begin(),c.end()
#define be           begin()
#define en           end()
#define sz(x)        (ll)x.size()
#define mem(a,val)   memset(a,val,sizeof(a))
#define mk(x,y)      make_pair(x,y)
#define mid(s,e)     ((s)+((e)-(s))/2) 

#define fo(i,a,b)     for(ll i = (ll)(a); i <= (ll)(b); i++)
#define rf(i,a,b)    for(ll i = (ll)(a); i >= (ll)(b); i--)
#define read(a,n)    for(int i=0;i<n;i++)cin>>a[i];
#define show(a,n)    for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;
#define p2(n)        (1LL << (n))
#define deb(x) cout <<#x << " = " << x << " | " << "LINE: "<<__LINE__<< endl;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void add(ll &x, ll y){ x += y; if(x>=mod) x %= mod; if(x<0) x = x%mod + mod; }

//============== *** START OF CODE ***


const ll maxn = 2e5+5;
ll ans = -1e17;
ll a[maxn]; 

map<string,ll> mp;

ll go(int n,int left){
    if(left==0) re 0;
    if(n==1) re a[1];
    if(n==2) re max(a[1],a[2]);
    string temp = to_string(n) + "|" + to_string(left);
    if(mp.count(temp))return mp[temp];

    if(n&1 and left==(n+1)/2) return mp[temp] = a[n]+go(n-2,left-1);
    return mp[temp]=max(a[n]+go(n-2,left-1),go(n-1,left));
}
void solve()
{
    int n;rd(n);   
    read((a+1),n);
   
    ans = go(n,n/2);
    pp(ans);
}


void prep(){}

//=============== *** END OF CODE ***

int main(){
    speedio; cout<<fixed<<setprecision(12);

// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    prep();
    int t = 1;
    // cin >> t;
    while(t--)
        solve();

    return 0;
}

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

using namespace std;

 map<string,int>p;
int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
	  cin>>a[i];
  }
  sort(a.begin(),a.end());
  long double car=(a[0]+a[1]+0.0)/2.0;
  for(int i=2;i<n;i++){
	  car=(car+a[i]+0.0)/2.0;
  } 
  cout<<setprecision(100)<<car<<endl;

}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll x, m;
	cin>>x>>m;
	vector<ll> s(m+1, 0);
	rep(i, m) cin>>s[i+1];
	ll q;
	cin>>q;
	ll l1 = 0, l2 = 0, r1 = x, r2 = x, d = -1, p = 0;
	rep(_, q){
		ll t, a;
		cin>>t>>a;
		while(p<m && s[p+1]<=t){
			ll ds = s[p+1]-s[p];
			if(d<0){
				ll t2 = min(l2, ds);
				l2 -= t2; r2 -= t2;
				ds -= t2;
				ds = min(ds, r2);
				r2 -= ds;
				l1 += ds;
			} else {
				ll t2 = min(x-r2, ds);
				l2 += t2; r2 += t2;
				ds -= t2;
				ds = min(ds, x-l2);
				l2 += ds;
				r1 -= ds;
			}
			p++;
			d *= -1;
			//cerr<<s[p]<<" "<<d<<" "<<l1<<" "<<r1<<" "<<l2<<" "<<r2<<endl;
		}
		t -= s[p];
		ll a2;
		if(a<=l1) a2 = l2;
		else if(a>=r1) a2 = r2;
		else a2 = l2+a-l1;
		a2 += d*t;
		//cerr<<t<<" "<<a2-d*t<<" "<<a2<<endl;
		cout<<max(0LL, min(x, a2))<<endl;
	}
	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()

int main(){
  ll N,ans=0;
  cin >> N;
  vecp A(N),B(N);
  rep(i,N){
    cin >> B.at(i).first >> B.at(i).second;
  }
  rep(i,N){
    cin >> A.at(i).first >> A.at(i).second;
  }
  sort(all(A));
  sort(all(B));
  set<ll> C;
  ll j=0;
  rep(i,N){
    while(j<N&&B.at(j).first<A.at(i).first){
      C.insert(B.at(j).second);
      j++;
    }
    if(!C.empty()){
      auto a=C.lower_bound(A.at(i).second);
      if(a!=C.begin()){
        a--;
        ans++;
        C.erase(a);
      }
    }
  }
  cout << ans << endl;
    
}

Measured memory_bytes: 3600
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
#define SSTR(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x)).str()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define endl '\n'

vector<vector<vector<double>>> dp;
int n; double N;

double solve(int a, int b, int c) {
	if (dp[a][b][c] != -1) return dp[a][b][c];
	if (a+b+c == 0) return 0;
	
	int d = n-a-b-c;
	double ans = 0;	
	if (a) ans += (1 + solve(a-1, b, c)) * a;
	if (b) ans += (1 + solve(a+1, b-1, c)) * b;
	if (c) ans += (1 + solve(a, b+1, c-1)) * c;
	if (d) ans = (ans + d) / (N - d);
	else ans /= N;
	
	dp[a][b][c] = ans;
	return ans;
}

int main() {
	#ifndef ONLINE_JUDGE
	#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;
	N = n;
	dp.resize(n+1, vector<vector<double>> (n+1, vector<double> (n+1, -1)));
	
	vi freq(3);
	for_(i, 0, n) {
		int k; cin >> k;
		freq[k-1] += 1;
	}
	
	cout << setprecision(10) << fixed << solve(freq[0], freq[1], freq[2]) << endl;

	return 0;
}


Measured memory_bytes: 219884
import Control.Applicative ((<$>))
import Control.Monad (foldM)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = do
  B.getLine
  B.lines <$> B.getContents >>= solve

solve :: [ByteString] -> IO ()
solve bs = foldM f Leaf bs >> return ()
  where f :: BSTree Int -> ByteString -> IO (BSTree Int)
        f tr bs = case B.words bs of
                   [_, bn] -> return (bstInsert (readi B.readInt bn) tr)
                   _ -> do
                     printList $ inOrder tr
                     printList $ preOrder tr
                     return tr

data BSTree a = Leaf | Node a (BSTree a) (BSTree a) deriving Show

bstInsert :: (Ord a) => a -> BSTree a -> BSTree a
bstInsert x (Node y lt rt) | x > y = Node y lt (bstInsert x rt)
                           | x < y = Node y (bstInsert x lt) rt
                           | otherwise = Node y lt rt
bstInsert x Leaf = Node x Leaf Leaf

foldPre :: (a -> b -> b) -> b -> BSTree a -> b
foldPre f z Leaf = z
foldPre f z (Node x l r) = f x y2
  where y1 = foldPre f z r
        y2 = foldPre f y1 l

foldIn :: (a -> b -> b) -> b -> BSTree a -> b
foldIn f z Leaf = z
foldIn f z (Node x l r) = foldIn f y2 l
  where y1 = foldIn f z r
        y2 = f x y1

preOrder :: BSTree a -> [a]
preOrder = foldPre (:) []

inOrder :: BSTree a -> [a]
inOrder = foldIn (:) []

printList :: (Show a) => [a] -> IO ()
printList = putStrLn . (' ':) . unwords . map show

readi :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> a
readi f s = let Just (n, _) = f s in n



Measured memory_bytes: 155732
from math import*
from bisect import*
n,*t=map(int,open(0).read().split())
m=int(log2(n))+1
x=t[:n]
l=t[n]
d=[[bisect(x,y+l)-1for y in x]]+[[0]*n for _ in range(m)]
for i in range(m):
    for j in range(n):
        d[i+1][j]=d[i][d[i][j]]
for a,b in zip(t[n+2::2],t[n+3::2]):
    a-=1
    b-=1
    if b<a:a,b=b,a
    c=1
    for i in range(m,-1,-1):
        if d[i][a]<b:
            a=d[i][a]
            c+=2**i
    print(c)

Measured memory_bytes: 37228
h,w,k = map(int, input().split())
memo = [[0]*w for i in range(h+1)]
for i in range(0, w):
    memo[0][i] = 0
memo[0][0] = 1

for i in range(1, h+1):
    for j in range(0, 1 << (w-1)):
        skip = False
        for l in range(w-2):
            skip = skip or ((j >> l) & 1 and (j >> (l+1)) & 1)
        if not skip:
            for l in range(w):
                if l-1 >= 0 and (j >> (l-1)) & 1:
                    memo[i][l] += memo[i-1][l-1]
                elif l+1 < w and (j >> l) & 1:
                    memo[i][l] += memo[i-1][l+1]
                else:
                    memo[i][l] += memo[i-1][l]
                memo[i][l] = memo[i][l] % 1000000007

print(memo[h][k-1])


Measured memory_bytes: 3064
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 1e5 + 10 , P = 1e9 + 7;
int n , a[N] , cnt[N] , fac[N] = {1} , ifac[N];
int inv(int x){return x == 1 ? 1 : P - ll(P / x) * inv(P % x) % P;}
int comb(int a,int b){return ll(fac[a])*ifac[b]%P*ifac[a-b]%P;}

int main(){
    rep(i,1,N) fac[i] = ll(fac[i-1]) * i % P;
    ifac[N - 1] = inv(fac[N - 1]);
    per(i,1,N) ifac[i-1] = ll(ifac[i]) * i % P;
    scanf("%d",&n);
    rep(i,0,n+1) {
        scanf("%d",a + i);
        cnt[a[i]] ++;
    }
    rep(i,1,n+1) if(cnt[i] == 2) {
        int l = find(a , a + n + 2 , i) - a;
        int r = find(a + l + 1 , a + n + 2 , i) - a;
        int remain = n + 1 - (r - l + 1);
        rep(k,1,n+2) {
            int ans = comb(n + 1 , k);
            if(remain + 1 >= k) {
                ans -= comb(remain , k - 1);
                if(ans < 0)
                    ans += P;
            }
            printf("%d\n",ans);
        }
        return 0;
    }
    return 0;
}


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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String c = scanner.next();
		String[] array = {"a", "i", "u", "e", "o"};
		String result = "consonant";

		if (Arrays.asList(array).contains(c)) {
			result = "vowel";
		}
		System.out.println(result);
	}

}

Measured memory_bytes: 21844
def calc(a, b, c)
  a,b = b,a if a > b
  (c-(b-a)+1)/2 + b
end

n, m, k = gets.split.map(&:to_i)
l1 = Array.new(n){ Array.new(n, 1<<31) }
l2 = n.times.map{[]}
l3 = []
n.times{ |i| l1[i][i] = -1 }
m.times do
  a, b, c = gets.split.map(&:to_i)
  a -= 1; b -= 1
  l1[a][b] = l1[b][a] = c
  l2[a] << b; l2[b] << a
  l3 << [a,b,c]
end

visited = n.times.map{ false }
arr = []
dist = n.times.map{ 1<<31 }
k.times do
  visited[n = gets.to_i - 1] = true
  arr << n
  dist[n] = 0
end

until arr.empty?
  s = arr.min{ |a,b| dist[a] <=> dist[b] }
  arr.delete s
  l2[s].each do |t|
    d = dist[s] + l1[s][t]
    if (old = dist[t]) > d
      dist[t] = d
      arr << t if old == 1 << 31
    end
  end
end
p m.times.map{ |i| calc(dist[l3[i][0]], dist[l3[i][1]], l3[i][2]) }.max

Measured memory_bytes: 89556
#include <iostream>
#include <cstdio>
using namespace std;
int n, buc[101000], ans; 
int main(){
	scanf("%d", &n);
	for( int i = 1, x; i <= n; ++i ){
		scanf("%d", &x);
		++buc[x];
	}
	for( int i = 1, sum = 0; i <= 100000; ++i ){
		sum += buc[i];
		if( sum == n/2 )
			++ans;
	}
	printf("%d\n", ans);
	return 0;
}

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


int main(){
  int N, i;
  string S;

  cin >> N;
  
  for(i=0;i<N;i++){
    cin >> S;
    if(S == "Y"){
      cout << "Four" << endl;
      break;
    }
    if(i == N-1)
      cout << "Three" << endl;
  }
}


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

using namespace std;
using ll =long long;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
#define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
static const ll INF = 1LL << 60;
//Write From this Line

int main()
{
	int n;
	cin >> n;
	int ans = 0;
	ans += n % 2; n /= 10;
	ans += n % 2; n /= 10;
	ans += n % 2; n /= 10;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

ll mod_pow(ll x, ll n, ll mod){ // x ^ n % mod
    ll res = 1;
    while(n > 0){
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    const ll MOD = 1000000007;
    ll ans = mod_pow(10,n,MOD) - mod_pow(9,n,MOD) - mod_pow(9,n,MOD) + mod_pow(8,n,MOD);
    ans += MOD * 100;
    ans %= MOD;
    cout << ans << endl;
    return 0;
}




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

long long sumNum (vector<int> &separated, string str, int n) {
  long long ret = stoll(str);
  for (int i = 1; i < n; i++) {
    for (int pre : separated) {
      ret += pre;
    }
    int now = atoi(str.substr(0,i).c_str());
    ret += now;
    separated.push_back(now);
    int size = str.size() - i;
    ret += sumNum(separated, str.substr(i,size), size);
    separated.pop_back();
  }
  return ret;
}

int main() {
  string S;
  cin >> S;
  
  vector<int> separated;
  cout << sumNum(separated, S, S.size()) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <string.h>
#include <bitset>

#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<int>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

int main(){
	
	int n,m;
	cin >> n >> m;
	
	if(n == m) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define db double
#define ll long long
main(){  
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i=0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    if (v.back() - v[0] >= 2){
        cout << "No";
        return 0;
    }
    if (v[0] != v.back()){
        int L = 1;
        for (int i=1; i < v.size(); i++) if (v[i] == v[0]) L++;
        int other = v[0]+1 - L;
        if (other <= 0){
            cout << "No";
            return 0;
        }
        if (2*other <= n-L){
            cout << "Yes";
            return 0;
        }
        cout << "No";
        return 0;
    }
    if (v[0] == n-1){
        cout << "Yes";
        return 0;
    }
    if (2*v[0] <= n){
        cout << "Yes";
    }
    else cout << "No";
}

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

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

  int64_t lb1=1,lb2=2,l;

  if(N==1){
    l = 1;
  }else{
    for(int i = 2; i <= N; i++){
      l = lb1 + lb2;
      lb2 = lb1;
      lb1 = l;
    }
  }
  cout << l << endl;
  
}

Measured memory_bytes: 256
b1,b2,b3 = map(int,input().split())
if b1 == 1 and b2 == 0 and b3 == 0:
    print("Close")
elif b1 == 0 and b2 == 1 and b3 == 0:
    print("Close")
elif b1 == 0 and b2 == 0 and b3 == 0:
    print("Close")
elif b1 == 1 and b2 == 1 and b3 == 0: 
    print("Open")
elif b1 == 0 and b2 == 0 and b3 == 1:
    print("Open")
else:
    pass


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9+7
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 long long int gcd(long long int m,long long int n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
long long int lcm(long long int number1,long long int number2){
	return number1 * number2 / gcd(number1,number2);	

}
int main(){
  ll A,B,C,D,E,F;
  cin>>A>>B>>C>>D>>E>>F;
  
  double max2=0;
  ll sugar=0;
  ll water=0;
  
  for(ll i=0;i*100*A<F;i++){//A
    for(ll j=0;j*100*B<F;j++){//B
      for(ll k=0;k*C<F;k++){//C
        for(ll m=0;m*D<F;m++){//D
          if(i==0&&j==0){
            continue;
          }
          if(k*C+m*D+A*100*i+B*100*j>F){
            continue;//ここのIFは順番が逆だとアウト
          }
          
          
          
        double unko=double(double(k*C+m*D)/double(A*100*i+B*100*j+k*C+m*D));
          
          if(max2<=unko&&(k*C+m*D)<=E*(A*i+B*j)){
            max2=double(double(k*C+m*D)/double(A*100*i+B*100*j+k*C+m*D));
          sugar=(k*C+m*D);
            water=(A*100*i+B*100*j);
          }
          }
        }
      }
    }
  
  
  cout<<water+sugar<<" "<<sugar<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <regex>
#include <climits>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#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, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define forin(i, a) for(auto i: (a))
#define p(...) printf(__VA_ARGS__); cout << endl;
#define in(...) __VA_ARGS__; input__(__VA_ARGS__);
#define input(...) in(__VA_ARGS__)
#define out(...) output__(__VA_ARGS__);
#define output(...) out(__VA_ARGS__)
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](auto const &a, auto const &b){ return c ;}
#define key(t, x, compare) [](const t &a, const t &b){ return a x compare b x ;}
#define unless(a) if(!(a))

using namespace std;

using pii = pair<int, int>;

template <class... T>
void input__(T &...a) {
  for(auto v: {&a...}) {
    cin >> *v;
  }
}

void output__(){
  cout << endl;
}

template <class Head, class... T>
void output__(Head const &v, T const &...a) {
  if(sizeof...(a) == 0) {
    cout << v;
  } else {
    cout << v << " ";
  }
  output__(a...);
}

int main(){
  int in(n);
  int list_input(a, n);
  double ave = accumulate(a, a + n, 0) / (double)n;
  if(ave - (int)ave >= 0.5) {
    ave++;
  }
  int result = 0;
  rep(i, n) {
    int tmp = a[i] - (int) ave;
    result += tmp * tmp;
  }
  out(result);
}


Measured memory_bytes: 256
a = input()
a_li = list(map(int, a))


if (a_li.count(0) == 0 or a_li.count(1) == 0):
    print(0)
elif (a_li.count(1) >= a_li.count(0)):
    print(a_li.count(0)*2)
elif (a_li.count(0) >= a_li.count(1)):
    print(a_li.count(1)*2)


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

int main () {
    int N, M;
    while (cin >> N >> M) {
        // P(AC) = 0.5
        // 1/0.5^M = 2^M times to AC
        // 2^M * (1900 * M + 100 * (N - M)) ?
        ll ans = (1 << M) * (1900 * M + 100 * (N - M));
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
int digit(ull n){
	ull ret=0;
	while(n>0){
		n/=10;
		ret++;
	}
	return ret;
}
int main(){
	ull n;
	cin>>n;
	int res=digit(n);
	for(ull a=1;a*a<=n;a++){
		if(n%a!=0) continue;
		ull b=n/a;
		res=min(res,max(digit(a),digit(b)));
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256