akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
#define ll long long
int main () {
  ll n;
  cin >> n;
  vector<ll> x;
  for (ll i = 0; i < n; i++) {
    ll sub;
    cin >> sub;
    x.push_back(sub - i + 1);
  }
  sort(x.begin(), x.end());
  ll middle = n / 2;
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    ans = ans + abs(x[i] - x[middle]);
  }
  cout << ans << endl;
}

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

#define N 1000007
int x[N], y[N], s[N];

int main() {
  cin.tie(0); ios_base::sync_with_stdio();
  int n, r, l;
  cin >> n >> r >> l;

  int n0 = 1;
  while(n0 < n) n0 <<= 1;
  for(int i=0; i<n; ++i) {
    int j = (y[i+n0] = i), k = i+n0;
    while(!(k&1)) y[k >>= 1] = j;
  }
  int prv = 0;
  for(int i=0; i<r; ++i) {
    int d, t, p; cin >> d >> t >> p;
    s[y[1]] += t - prv;
    d += n0-1;
    x[d] += p;
    while(d) {
      if(x[d] < x[d^1] || (x[d] == x[d^1] && y[d] > y[d^1])) {
        x[d>>1] = x[d^1]; y[d>>1] = y[d^1];
      } else {
        x[d>>1] = x[d]; y[d>>1] = y[d];
      }
      d >>= 1;
    }
    prv = t;
  }
  s[y[1]] += l - prv;
  int t = -1, a = -1;
  for(int i=0; i<n; ++i) {
    if(t < s[i]) {
      t = s[i]; a = i;
    }
  }
  cout << a+1 << endl;
  return 0;
}



Measured memory_bytes: 5060
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
    double a,b,c;
    cin >> a >> b >> c;
    double PI = acos(-1);
    c = c*PI/180;
    double S = a*b*sin(c)/2;
    double L = sqrt(a*a + b*b -2*a*b*cos(c)) + a + b;
    double h = S / a * 2;
    printf("%lf\n%lf\n%lf\n", S, L, h);
    return 0;
}


Measured memory_bytes: 3464
#include<bits/stdc++.h>
#include<algorithm>
#include<string.h>
#define ll long long
#define Start ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define fr first
#define sc second
#define M_PI           3.14159265358979323846
using namespace std;
int n,m;
int Dp[200200];
int A[100100];
int Solve(int i)
{
    if(i==n-1)
        return 0;
    if(i>n-1)
        return 1e9;
    if(Dp[i]!=1e9)
    return Dp[i];
    for(int k=1; k<=m; k++)
    {
        Dp[i]=min(Dp[i],Solve(i+k)+abs(A[i+k]-A[i]));
    }
    return Dp[i];

}
int main()
{
    Start;

    cin>>n>>m;
    for(int i=0; i<n; i++)
        cin>>A[i];
    for(int i=0;i<n;i++)
        Dp[i]=1e9;
    cout<<Solve(0);
}


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

int main() {
  int n,tmp,s =0;
  scanf("%d" ,&n);
  tmp =n;
  while(tmp> 0){
    s += tmp%10;
    tmp /= 10;
  }
  if(n%s==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ; 
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fast ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define pii pair<int,int> 
long long MOD  = 1e9+7;
double dp[3010][3010];
double a[3010];

signed main(){
    fast;
    int n; cin >> n;
    for(int i=1 ; i<=n ; i++)
        cin >> a[i];
    dp[1][0] = (1-a[1]);
    dp[1][1] = a[1];

    for(int i=2 ; i<=n ; i++){
        for(int j=0 ; j<=n ; j++){
            if(j>i)
                continue;
            if(j==0){
                dp[i][j] += dp[i-1][j]*(1-a[i]); 
            }
            else{
                dp[i][j] += dp[i-1][j-1]*a[i] + dp[i-1][j]*(1-a[i]);
            }
        }
    }

    // for(int i=0 ; i<=n ; i++){
    //     for(int j=0 ; j<=n ; j++){
    //         cout << dp[i][j] << " " ;
    //     }
    //     cout << endl;
    // }
    
    double sum = 0;
    for(int i=(n+1)/2 ; i<=n ; i++){
        sum += dp[n][i];
    }

    cout << fixed << setprecision(15) << sum << endl;
}

Measured memory_bytes: 69248
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    ll X, N;
    cin >> X >> N;
    if(N!=0)
    {
        vector<ll> p(N+1);
        for(size_t i=0;i<N; i++)
        {
            cin >> p[i];
        }
        p[N]=102;
        sort(p.begin(), p.end());
        ll idx=0;
        ll minX = INF;
        ll min_i=0;
        for(ll i=0;i<=101; i++)
        {
            if(p[idx]==i)
            {
                idx++;
                continue;
            }
            //cerr << i << ":" << abs(i-X) << endl;
            if(abs(i-X) < minX)
            {
                minX= abs(i-X);
                min_i = i;
            }
        }
        cout << min_i << endl;
    }else cout << X << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> B(N - 1);
  for (int i = 0; i < N - 1; i++){
    cin >> B[i];
  }
  int sum = B[0];
  for (int i = 0; i < N - 2; i++){
    sum += min(B[i], B[i + 1]);
  }
  sum += B[N - 2];
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000007
//S.size()

using namespace std;


typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;

ll GCD(ll x, ll y) {
    return x ? GCD(y % x, x) : y;
}

int main(void){
  unsigned long long
  A,B,C,D,num1 = 0 ,num2 = 0,num = 0,c_All,d_All,cd_All,c_Sub,d_Sub,cd_Sub;

  cin>>A>>B>>C>>D;

  for(unsigned long long i = A -1;i > 0;i--){
    if(i % D == 0 || i % C ==0){
      num = i;
      break;
    }
  }




  c_All = B / C;
  d_All = B / D;
  cd_All = B / (C * D / GCD(C,D));
  c_Sub = (A-1) / C;
  d_Sub = (A-1) / D;
  cd_Sub = (A-1) / (C * D / GCD(C,D));

  cout<<B - (A-1) - (c_All + d_All - cd_All) + (c_Sub + d_Sub - cd_Sub)<<endl;



}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;


int main() {
    ll n, m;
    cin >> n >> m;

    vector<vector<ll>> edges(n);
    rep(i, m) {
        ll u, v;
        cin >> u >> v;
        u--;
        v--;
        edges[u].push_back(v);
    }

    vector<vector<ll>> dp(n, vector<ll>(3, INF));

    struct Task {
        ll next, cost;
    };

    queue<Task> q;

    ll s, t;
    cin >> s >> t;
    s--;
    t--;
    q.push({s, 0});

    while (!q.empty()) {
        Task front = q.front();
        q.pop();
        for (ll to : edges[front.next]) {
            ll next_cost = front.cost + 1;
            ll next_cost_type = next_cost % 3;
            if (dp[to][next_cost_type] <= next_cost) {
                continue;
            }
            q.push({to, next_cost});
            dp[to][next_cost_type] = next_cost;
        }
    }

    if (dp[t][0] == INF) {
        cout << -1 << endl;
    } else {
        cout << dp[t][0] / 3 << endl;
    }

}


Measured memory_bytes: 11264
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
 
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	int x = 1;
	rep(i,n){
		x = min(x * 2,x + k);
	}
	cout << x << '\n';
	return 0;
}


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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

typedef long long ll;
const ll MOD = 1e9 + 7;

double sub_dp(int i, const std::vector<std::vector<int>> &from) {
  int N = from.size();
  std::vector<double> dp(N);

  for(int j = N - 2; j >= 0; --j) {
    if(from[j].size() == 1) {
      dp[j] = dp[from[j][0]] + 1;
    } else {
      dp[j] = 0;
      for(int t : from[j]) {
        dp[j] += dp[t];
      }

      if(i == j) {
        int argmax = from[j][0];
        double max = dp[argmax];
        for(int t : from[j]) {
          if(dp[t] > max) {
            max = dp[t];
            argmax = t;
          }
        }
        dp[j] -= max;
        dp[j] /= from[j].size() - 1;
        ++dp[j];
      } else {
        dp[j] /= from[j].size();
        ++dp[j];
      }
    }
  }

  return dp[0];
}

int main() {
  int N, M;
  std::cin >> N >> M;

  std::vector<std::vector<int>> from(N);
  rep(i, M) {
    int s, t;
    std::cin >> s >> t;
    --s; --t;
    from[s].push_back(t);
  }

  double E = sub_dp(0, from);
  for(int i = 1; i < N -1; ++i) {
    E = std::min(E, sub_dp(i, from));
  }

  std::cout << std::fixed << std::setprecision(10) << E << '\n';
}


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

int main()
{
    int N;
    cin >> N;
    string S;
    map<string, int> mp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;
    for (int i = 0; i < N; i++) {
        cin >> S;
        mp[S]++;
    }
    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: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int N,M; cin >> N >> M;
    vector<int> s(M);
    vector<char> c(M);
    for(int j = 0; j < M; ++j) cin >> s[j] >> c[j];
    for(int i = 0; i <= 999; ++i) {
        string T = to_string(i);
        if(T.size()!=N) continue;
        int flg = 1;
        for(int j = 0; j < M; ++j) {
            if(s[j]>T.size()) {
                flg = 0;
                continue;
            }
            if(T[s[j]-1]!=c[j]){
                flg = 0;
                continue;
            }
        }
        corner(flg,T);
    }
    cout << -1 << endl;



    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;



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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vi cnt(100010);
    rep(i,n){
        int a; cin>>a;
        cnt[a]++;
    }
    int ans=0;
    rep(i,100000){
        int cand = cnt[i]+cnt[i+1]+cnt[i+2];
        chmax(ans,cand);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
const int maxn = 1e7+5;
int pre[maxn],dis[maxn];
//int find(int x){
//	while(x!=pre[x]){
//		int r = pre[x];
//		pre[x] = pre[r];
//		dis[x] += dis[r];
//		x = r;
//	}
//	return x;
//}
int find(int x){
	if(x==pre[x]){
		return x;
	}
	int r = find(pre[x]);
	dis[x] += dis[pre[x]];
	return pre[x] = r;
} 
bool merge(int x,int y,int d){
	int px = find(x);
	int py = find(y);
	if(px==py){
		return d==(dis[y]-dis[x]);
	}
	pre[py] = px ;
	dis[py] = dis[x]+d-dis[y];
	return true;
}
void init(){
	for(int i=0;i<maxn;i++){
		pre[i] = i;
	}
}
int main()
{
	init(); 
	int n,m,ans=1;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int x,y,d;
		cin>>x>>y>>d;
		if(ans){
			ans = merge(x,y,d);
		}
	}

	if(ans){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl; 
	}
	return 0;
}

Measured memory_bytes: 41216
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define repeat(n) for(int __i__=0;__i__<n;__i__++)
#define loop_from_to(from, to, i) for(int i=from;i<=to;i++)
#define multi_cin(n, array) loop(n,i){cin>>array[i];}
#define assign_if_smaller(var, val) if(var>val)var=val;
#define assign_if_larger(var, val) if(var<val)var=val;
using namespace std;

long COST_LIMIT = 1000 * 2000 * 150;

int main(int argc, char const* argv[])
{
  int n, m;
  while (cin >> n >> m) {
    if (n == 0 && m == 0) break;

    // memory alloc and init
    long cost_table[3][10][m + 1];
    int pos[3][10];
    int slip[3][10];
    int stones[3];

    // per row operation
    loop(n, row_i) {
      int pp = (row_i + 1) % 3, p = (row_i + 2) % 3, crr = row_i % 3;
      cin >> stones[crr];

      // read stone info
      loop(stones[crr], i) {
        cin >> pos[crr][i] >> slip[crr][i];
      }

      // set initial value
      fill(cost_table[crr][0], cost_table[crr][9] + m + 1, COST_LIMIT);
      if (row_i == 0) {
        loop(stones[crr], i) cost_table[crr][i][m] = 0;
      }
      if (row_i == 1 && m > 0) {
        loop(stones[crr], i) cost_table[crr][i][m - 1] = 0;
      }

      // normal jump
      if (row_i >= 1) {
        loop(stones[crr], c_i) {
          loop(m + 1, m_i) {
            long min_cost = COST_LIMIT;
            loop(stones[p], p_i) {
              int jump_cost = (slip[p][p_i] + slip[crr][c_i]) * abs(pos[p][p_i] - pos[crr][c_i]);
              long cost = cost_table[p][p_i][m_i] + jump_cost;
              assign_if_smaller(min_cost, cost);
            }
            assign_if_smaller(cost_table[crr][c_i][m_i], min_cost);
          }
        }
      }

      // big jump
      if (row_i >= 2) {
        loop(stones[crr], c_i) {
          loop_from_to(1, m, m_i) {
            long min_cost = COST_LIMIT;
            loop(stones[pp], pp_i) {
              int jump_cost = (slip[pp][pp_i] + slip[crr][c_i]) * abs(pos[pp][pp_i] - pos[crr][c_i]);
              long cost = cost_table[pp][pp_i][m_i] + jump_cost;
              assign_if_smaller(min_cost, cost);
            }
            assign_if_smaller(cost_table[crr][c_i][m_i - 1], min_cost);
          }
        }
      }

      // // show
      // loop(stones[crr], c_i) loop(m + 1, m_i) 
      //   cout << "row: " << row_i << ", col: " << c_i << ", m:" << m_i << ", cost: " << cost_table[crr][c_i][m_i] << endl;
    }

    long min_cost = COST_LIMIT;
    loop_from_to(0, !!m, d) {
      loop(stones[(n - 1 - d) % 3], i) {
        loop_from_to(d, m, j) {
          assign_if_smaller(min_cost, cost_table[(n - 1 - d) % 3][i][j]);
        }
      }
    }

    cout << min_cost << endl;

  }
  return 0;
}

Measured memory_bytes: 1180
#include<stdio.h>

int main(){
  //counter
  int i,j;

  //input
  int n;
  scanf("%2000000d",&n);
  
  int A[n];
  int k=0;  // TODO serching "k"
  for(i=0;i<n;i++){
    scanf("%10000d",&A[i]);
    if(A[i]>k){
      k = A[i];
  }
  }

  
  //Counting Sort

  int C[k+1];
  for(i=0;i<k+1;i++){
    C[i] = 0;
  }
  for(j=0;j<n;j++){
    C[A[j]]++;
  }
  for(i=1;i<k+1;i++){
    C[i] = C[i] + C[i-1];
  }
    int B[n];
    for(j=(n-1);j>=0;j--){
    B[C[A[j]]-1] = A[j];
    C[A[j]]--;
    }

  //output
  for(i=0;i<n-1;i++){
    printf("%d ",B[i]);
  }
  printf("%d\n",B[n-1]);
  


    return 0;
}



Measured memory_bytes: 17404
#include <stdio.h>
#include <math.h>
typedef long long ll;

int main()
{
    int n;
    scanf("%d",&n);
    int p[n];
    int ans=1;
    scanf("%d",&p[0]);
    int min=p[0];
    for(int i=1;i<n;i++){
        scanf("%d",&p[i]);
        if(min>p[i]){
            ans++;
            min=p[i];
        }
    }
    printf("%d",ans);
}


Measured memory_bytes: 896
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,k,ans;
int main()
{
	scanf("%d%d",&n,&k);
	ans=k;
	for(int i=1;i<n;i++)
		ans*=(k-1);
	printf("%d",ans);
	//return 0;
}

Measured memory_bytes: 128
// AOJ 2013
#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
#include<algorithm>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

typedef pair<int,int> P;

const int NMAX = 10008;

int n;
vector<P> diagram;
bool used[NMAX];

int second(int h, int m, int s) {
  return 3600 * h + 60 * m + s;
}

P read_schedule() {
  int h, m, s, H, M, S;
  scanf("%d:%d:%d %d:%d:%d",  &h,&m,&s, &H,&M,&S);

  int t = second(h,m,s), T = second(H,M,S);
  return make_pair(t, T);
}

int solve() {
  int trains = 0;
  while (true) {
    int _i = 0;
    while (_i < n and used[_i]) { _i++; }
    if (_i == n) break;
    used[_i] = true;
    trains++;
    int last = diagram[_i].second;
    for (int i = _i; i < n; i++) {
      if (used[i] or diagram[i].first < last) {
        continue;
      } else {
        used[i] = true;
        last = diagram[i].second;
      }
    }
  }
  return trains;
}

void init() {
  diagram.clear();
  REP(i, n) {
    used[i] = false;
  }
}

int main() {
  while (cin >> n and n) {
    init();
    REP(i, n) {
      diagram.push_back(read_schedule());
    }
    sort(diagram.begin(), diagram.end());
    cout << solve() << endl;
  }
}

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

int main()
{
    ll x; cin >> x;
    if(x == 0){
        cout << "1" << endl;
    }
    else cout << "0" << endl;


}


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main() {
    int N;
    cin >> N;
    int a[N];
    for (int i = 0;i < N;i++){
        cin >> a[i];
    }
    sort(a,a+N);
    int m = a[N-1];
    int p = 0;
    for (int i = 0;i < N-1;i++){
        p = p + a[i];
    }
    cout << p + m/2 << endl;

}

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

int main()
{
  int X,A,B,C ;
  cin>>A>>B>>C>>X ;
  int count=0 ;
  for(int a=0;a<=A;a++){
    for(int b=0;b<=B;b++){
      for(int c=0;c<=C;c++){
        if(500*a+100*b+50*c==X) count++ ;
      }
    }
  }
  
  cout<<count<<endl ;
  return 0 ;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin, n, k;
    vector<int> a(n);
    REP(i, 0, n) {
        cin, a[i];
    }
    REP(i, 0, n - k) {
        print((a[i] < a[i + k]) ? "Yes" : "No");
    }
    return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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; }



void func(long long ABCD){

}

int main(){
    // cout << fixed << setprecision(5);

    string s;
    cin>>s;

    string e = "-+";

    REP(i,0,2)REP(j,0,2)REP(k,0,2){
        lli a = s[0]-'0';
        lli b = s[1]-'0';
        lli c = s[2]-'0';
        lli d = s[3]-'0';

        lli ans = s[0]-'0';
        if(i==0)a-=b;
        else a+=b;
        if(j==0)a-=c;
        else a+=c;
        if(k==0)a-=d;
        else a+=d;
        if(a==7){
            cout<<ans<<e[i]<<b<<e[j]<<c<<e[k]<<d<<"=7"<<endl;
            return 0;
        }

    }
    
    return 0;
}


Measured memory_bytes: 256
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
D = [x[i + 1] - x[i] for i in range(len(x) - 1)]
# print(D)


def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)


if len(x) == 1:
    print(x[0])
    exit()
# if len(x) == 2:

ans = 0
for i in range(len(D)):
    if i == 0:
        ans = D[i]
    else:
        ans = gcd(D[i], ans)
print(ans)


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

int main() {
	int n, a, b, temp_a, temp_b;	
	while (cin >> n) {
		a = 0; b = 0; if (n == 0) break;
		for (int i = 0; i < n; i++) {
			cin >> temp_a >> temp_b;
			if (temp_a == temp_b) {
				a = a + temp_a; b = b + temp_b;
			}
			else {
				a = a + (temp_a > temp_b ? temp_a + temp_b : 0);
				b = b + (temp_a < temp_b ? temp_a + temp_b : 0);
			}
		}
		cout << a << " " << b << endl;
	}
	return 0;
}


Measured memory_bytes: 3004
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
	int count = 2;
	Scanner sc = new Scanner(System.in);
	int x =sc.nextInt();
	int result = x;
	if(1<=x && x<= 100) {
	for(int i = 0; i < count; i++) {
		 result = result *x;
	}
	System.out.println(result);
	}
	sc.close();
	}
	}

Measured memory_bytes: 26128
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
Map = [[] for _ in range(N)]
for i in range(N):
    S = list(input())[:-1]
    for j in range(N):
        s = S[j]
        if s == "1":
            Map[i].append(j)
error = 0
MAX = 0
for i in range(N):
    E = 0
    flag = 1
    vmax = 0
    depth = [-1]*N
    depth[i] = 1
    q = deque([i])
    while len(q) != 0:
        cur = q.popleft()
        for chi in Map[cur]:
            if depth[chi] == -1:
                depth[chi] = depth[cur]+1
                vmax = max(vmax,depth[cur]+1)
                q.append(chi)
            else:
                if depth[chi] != depth[cur]:
                    continue
                else:
                    E = 1
                    break
    if E == 0:
        MAX = max(vmax,MAX)
    else:
        error += 1
if error == N:
    print(-1)
else:
    print(MAX)
    


        


    

Measured memory_bytes: 10892
N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(len(a) - 1):
    if a[i] > x:
        ans += a[i] - x
        a[i] = x

    if a[i] + a[i+1] > x:
        prev = a[i+1]
        a[i+1] -= a[i] + a[i+1] - x
        ans += prev - a[i+1]

print(ans)


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n,ans=0;
    cin>>n;
    vector<ll> x(n),l(n);
    for (int i = 0; i < n; i++)
    {
        cin>>x[i]>>l[i];
    }
    vector<pll> p(n);
    for (int i = 0; i < n; i++)
    {
        p[i]=make_pair(x[i]-l[i],x[i]+l[i]);
    }
    sort(all(p));
    ll now=INT_MIN;
    for (int i = 0; i < n; i++)
    {
        ll le=p[i].first;
        ll ri=p[i].second;
        if(now<=le)
        {
            now=ri;
            ans++;
        }
        else
        {
            now=min(now,ri);
        }
        
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include<vector>
#include <algorithm>

using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> odd((n+1)/2);
    vector<int> even(n/2);
    for(int i = 0;i < (n+1)/2;i++){
        cin >> odd[i];
        if(i < (n+1)/2 -1  | n%2 == 0) cin >> even[i];
    }
    vector<int> v;
    if(n%2 == 0){
        reverse(even.begin(),even.end());
        even.insert(even.end(), odd.begin(), odd.end());
        v = even;
    }
    else{
        reverse(odd.begin(), odd.end());
        odd.insert(odd.end(), even.begin(), even.end());
        v = odd;
    }
    for(int i = 0;i < n-1; i++){
        cout << v[i] << " ";
    }
    cout << v[n-1] << endl;
    return 0;
}

Measured memory_bytes: 4088
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


A, B = ds_in()
if B % A == 0:
    print(A + B)
else:
    print(B - A)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,l,m,val,hr,mn,s,n;
    while(cin>>n)
    {
        mn=n/60;
        hr=mn/60;
        mn=mn%60;
        s=n%60;
        cout<<hr<<":"<<mn<<":"<<s<<endl;

    }
}



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

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

const int INF = 1e9;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> cnt(M);
    vector<vector<int>> sum(M, vector<int>(N + 1));
    rep(i, N) {
        int a; cin >> a; a--;
        cnt[a]++;
        sum[a][i + 1]++;
    }
    rep(i, M) rep(j, N) sum[i][j + 1] += sum[i][j];
    vector<int> dp(1 << M, INF);
    dp[0] = 0;
    rep(bit, 1 << M) {
        bitset<20> bs(bit);
        int pos = 0;
        rep(i, M) if(bs[i]) pos += cnt[i];
        rep(i, M) if(!bs[i]) {
            chmin(dp[bit | (1 << i)], dp[bit] + cnt[i] - sum[i][pos + cnt[i]] + sum[i][pos]);
        }
    }
    cout << dp[(1 << M) - 1] << '\n';
    return 0;
}



Measured memory_bytes: 14736
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
#define RP(i, f, t) for (int i = f; i < t; i++)
#define PR(i, f, t) for (int i = t - 1; i >= f; i--)
int main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> p(m);
    string s[m];
    RP(i, 0, m)
    cin >> p[i] >> s[i];
    ll pena[n];
    RP(i, 0, n)
    pena[i] = 0;
    bool AC[n];
    RP(i, 0, n)
    AC[i] = false;
    RP(i, 0, m)
    {
        if (!AC[p[i] - 1])
        {
            if (s[i] == "AC")
            {
                AC[p[i] - 1] = true;
            }
            else
            {
                pena[p[i] - 1]++;
            }
        }
    }

    ll res = 0, res2 = 0;

    RP(i, 0, n)
    {
        if (AC[i])
        {
            res2++;
            res += pena[i];
        }
    }
    cout << res2 << " " << res << endl;
}

Measured memory_bytes: 7424
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
        string s = ReadLine();
        int ct1 = 0, ct2 = 0;
        char c1 = '\0', c2 = '\0';

        for (int i = 0; i < 4; i++)
        {
            char c = s[i];

            if      (c == c1){ ct1++; }
            else if (c == c2){ ct2++; }
            else if (c1 == '\0')
            {
                c1 = c;
                ct1++;
            }
            else if (c2 == '\0')
            {
                c2 = c;
                ct2++;
            }
        }

        bool good = (ct1 == 2) && (ct2 == 2);
        WriteLine(good?"Yes":"No");
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

ll sa(ll a, int b)
{
	if (b > a) return (b - a);
	else return (a-b);
}
int main()
{
	int n, a, b, c;
	cin >> n >> a >> b >> c;
	int l[n];

	ll min = INF;
	REP(i, n){
		cin >> l[i];
	}

	string s = string(n, '0');


	while (s != string(n, '3')){
		if (s[0] == '3'){
			for (int i = 0; i < n; i++){
				if (s[i] == '3') continue;
				else {
					s[i] = s[i] + 1;
					for (int j = 0; j < i; j++){
						s[j] = '0';
					}
					break;
				}
			}
		}
		else s[0] += 1;

		int an, bn, cn;
		an = bn = cn = 0;
		int cnt = 0;
		ll ans = 0;
		bool flag[3] = {};
		REP(i, n){
			if (s[i] == '1'){
				if (an != 0) cnt++;
				an += l[i];
				flag[0] = 1;
			}
			else if (s[i] == '2'){
				if (bn != 0) cnt++;
				bn += l[i];
				flag[1] = 1;
			}
			else if (s[i] == '3'){
				if (cn != 0) cnt++;
				cn += l[i];
				flag[2] = 1;
			}

		}
		if (flag[0] == 0 or flag[1] == 0 or flag[2] == 0) continue;
		ans += sa(an, a);
		ans += sa(bn, b);
		ans += sa(cn, c);
		ans += cnt * 10;

		if (min > ans){
			min = ans;
		}
	}
	cout << min << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<int,ll>Pil;
typedef pair<int,Pil>Piil;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y,sx,sy,cost;
};
int a[101];

int main() {

	int n;
	cin>>n;
	rep(i,n)cin>>a[i];

	int t=0;
	rep(i,n-1){
		int minj=i;
		for(int j=i+1; j<n; j++){
			if(a[j]<a[minj])minj=j;
		}
		int x=a[i];
		if(x!=a[minj])t++;
		a[i]=a[minj];
		a[minj]=x;
	}
	rep(i,n-1)cout<<a[i]<<" ";
	cout<<a[n-1]<<endl;
	cout<<t<<endl;

	return 0;
}



Measured memory_bytes: 3132
import sys
input=sys.stdin.readline

h,w=map(int,input().split())
ch,cw=map(int,input().split())
dh,dw=map(int,input().split())

s=[]
for i in range(h):
    sub=input().rstrip()
    s.append(sub)

check=[[-1]*w for i in range(h)]
stack=[(ch-1,cw-1)]
check[ch-1][cw-1]=0
d=[(1,0),(-1,0),(0,1),(0,-1)]


count=0

while True:
    temp=[]
    while len(stack)>0:
        now=stack.pop()
        temp.append(now)
        for i in d:
            x=now[0]+i[0]
            y=now[1]+i[1]
            if 0<=x<=h-1 and 0<=y<=w-1:
                if s[x][y]=='.':
                    if check[x][y]==-1:
                        check[x][y]=count
                        stack.append((x,y))

    count+=1
    for k in temp:
        for i in range(-2,3):
            for j in range(-2,3):
                x=k[0]+i
                y=k[1]+j
                if 0 <= x <= h - 1 and 0 <= y <= w - 1:
                    if s[x][y] == '.':
                        if check[x][y] == -1:
                            check[x][y]=count
                            stack.append((x,y))
    if len(stack)==0:
        break

print(check[dh-1][dw-1])

Measured memory_bytes: 87528
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, x, y, d, p, a[100], c[100]; double b[100];
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		scanf("%d%d%d", &x, &y, &d);
		for(int j = 0; j < d; j++) scanf("%d%lf%d", &a[j], &b[j], &c[j]);
		int ret = 0;
		for(int j = 0; j < d; j++) {
			int r = x, s = 0;
			if(a[j] == 0) {
				for(int k = 0; k < y; k++) s += r * b[j], r -= c[j];
				r += s;
			}
			else {
				for(int k = 0; k < y; k++) r = r * (1 + b[j]) - c[j];
			}
			ret = max(ret, r);
		}
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 2576
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int k = Integer.parseInt(sc.next());
    int x = Integer.parseInt(sc.next());
    if (k * 500 >= x) {
      pw.println("Yes");
    } else {
      pw.println("No");
    }
  }
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    ll n;cin>>n;
    vector<ll> a(n);
    ll sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    ll plus_per_sousa=n*(n+1)/2;
    if(sum%plus_per_sousa!=0){
        cout<<"NO"<<endl;
        return 0;
    }
    ll k=sum/plus_per_sousa;

    bool f=true;
    ll ans=0;
    rep(i,n){
        ll bunsi=a[i]-a[(i+1)%n]+k;
        if(bunsi<0){
            f=false;break;
        }
        if((bunsi%n)!=0){
            f=false;break;
        }
        ans+=bunsi/n;
    }
    if(f)    cout<<"YES"<<endl;
    else                cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
int main() 
{

  fast();
  
    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt","w",stdout);
    // #endif
    ll n;
    cin >> n;
    set<char>ss;
    char c;
    f(i,0,n)
    {
    	cin >> c;
    	ss.add(c);
    }
    cout<<((ss.size()==3)?"Three":"Four");

    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 

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

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase 

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


ll t,i,x,j,y,z=0,k=0,n;
string s;
cin>>n>>t>>k;		ll a[n];
// n=s.size();
// z=0;
rep(i,0,n,1)	cin>>a[i];

sort(a,a+n);

rep(i,0,n,0){
	x=1;	z++;	ll e=a[i]+k;
	j=i+1;
	while(j<n && j-i+1<=t && a[j]<=e )	j++;
	i=j;
}

ce(z)

}




Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int n;
  cin >> n;
  vector<int> numbers(n);
  for (int i = 0; i < n; ++i) cin >> numbers[i];

  int passed = 0, smallest = 200001;
  for (int i = 0; i < n; ++i) {
    if (smallest >= numbers[i]) {
      smallest = numbers[i];
      ++passed;
    }
  }

  cout << passed << endl;
  return 0;
}

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

int main() {
  int r, D, x2000;
  cin >> r >> D >> x2000;
  
  int x;
  x = x2000;
  for (int i = 0; i < 10; i++) {

      x = r * x - D;

    cout << x << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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;}

int N, M;
const int MAXN = 200005;
vi to[MAXN];

int main () {
  cin >> N >> M;
  REP(i,M) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    to[a].push_back(b);
  }

  bool can = false;
  for (auto c : to[0]) {
    for (auto d : to[c]) {
      if (d == N-1) {
        can = true;
        break;
      }
    }
    if (can) break;
  }

  cout << (can ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

ll a, b, c, d, e, f;
bool wt[3001], sg[3001];

int main(int argc, char **argv) {
	cin >> a >> b >> c >> d >> e >> f;
	CLEAR(wt); CLEAR(sg);
	for (int i = 0; i * 100 <= f; i += a) {
		wt[i] = true;
		for (int j = i + b; j * 100 <= f; j += b) wt[j] = true;
	}
	for (int i = 0; i <= f; i += c) {
		sg[i] = true;
		for (int j = i + d; j <= f; j += d) sg[j] = true;
	}
	int rw = 0, rs = 0;
	REP(i, f + 1) REP(j, f + 1) if (wt[i] && sg[j] && 100 * i + j <= f && e * i >= j && j * (100 * rw + rs) >= rs * (100 * i + j)) {
		rw = i;
		rs = j;
	}
	cout << (100 * rw + rs) << ' ' << rs << endl;
	return 0;
}


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

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int N = 110;

int n, a[2*N], res;

int main()
{
    init_ios();
    cin >> n;
    for (int i = 1; i <= 2*n; ++i)
    	cin >> a[i];
    sort(a+1, a+2*n+1);
    for (int i = 2*n-1; i >= 1; i -= 2)
    	res += a[i];
    cout<<res<<"\n";
}

Measured memory_bytes: 256
n,k = map(int,input().split())
"""
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
"""
mod = 10**9+7 #出力の制限
"""
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
"""
ans = 0

for i in range(k,n+2):
    #print(i)
    min_num = (i*(0+i-1))//2
    max_num = (i*(n-i+1+n))//2
    #print(min_num,max_num)
    #print(min_num,max_num)
    ans += max_num - min_num+1
    ans %= mod
    #print(ans)

print(ans)
#a = cmb(n,r,mod)

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

void print_vec(vector<int> vec)
{
  cout << "[";
  for (int i = 0; i < vec.size(); i++)
  {
    cout << vec.at(i);
    if (i < vec.size() - 1)
    {
      cout << ", ";
    }
  }
  cout << "]...size: " << vec.size() << endl;
}

int main()
{
  int n, m;
  cin >> n >> m;
  bool err = false;
  priority_queue<int> pq;
  pq.push(m);

  rep(i, n)
  {
    int in, out;
    cin >> in >> out;
    m = m + in - out;

    if (m < 0)
    {
      err = true;
    }

    pq.push(m);
  }

  if (err)
  {
    printf("0\n");
  }
  else
  {
    printf("%d\n", pq.top());
  }
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
using namespace std;
 
int main(){
    
    int A,B,C;

    cin >> A>>B>>C;

    if(A<B){
        if(A<=C && C<=B){
            cout << "Yes";
        }else{
            cout << "No";
        }
    }else{
        if(B<=C && C<=A){
            cout <<"Yes";
        }else{
            cout << "No";
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int A, B; cin >> A >> B;
  int i, c = 1;
  for (i = 0; c < B; ++i) {
    c += A-1;
  }
  cout << i << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
	
def main():
	N = int(input())
	
	tmp = make_divisors(N)
	ans = []
	
	for i in tmp:
		a = i - 1
		if a == 0:
			continue
		if N // a == N % a:
			ans.append(a)
	
	print(sum(ans))
	
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 4016