akhauriyash/Code-Regression huggingface dataset:
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif
using namespace std;

ll money[] = { 
    300000,
    200000,
    100000,
};

int main() {
    ll d = 400000;
    ll X, Y;
    cin >> X >> Y;
    ll ans = 0;
    if(X == 1 && Y == 1) ans += d;
    X--; Y--;
    if(X < 3) ans += money[X];
    if(Y < 3) ans += money[Y];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef pair<int, int> pint;
typedef pair<int, long long> pll;
vector<vector<pll> > G;
vector<long long> W;

int N;
int main() {
    while (cin >> N) {
        W.clear(); W.resize(N);
        G.clear(); G.resize(N*2);
        for (int i = 0; i < N; ++i) {
            cin >> W[i];
            G[i].push_back(pll(i+N, W[i]));
            G[i+N].push_back(pll(i, W[i]));
        }
        for (int i = 0; i < N-1; ++i) {
            int u, v;
            long long w;
            cin >> u >> v >> w;
            --u, --v;
            G[u].push_back(pll(v, w));
            G[v].push_back(pll(u, w));
        }
        
        priority_queue<pair<long long, pint>
        , vector<pair<long long, pint> >
        , greater<pair<long long, pint> > > que;
        

        vector<long long> dist(N*2, -1);
        vector<int> visit(N*2, 0);
        
        long long res = 0;
        int iter = 0;
        for (int i = 0; i < N; ++i) {
            que.push(make_pair(0, pll(i + N, -1)));
        }
        while (!que.empty()) {
            auto cur = que.top();
            que.pop();
            int v = cur.second.first;
            if (visit[v]) {
                int nv = cur.second.second;
                if (visit[v] > visit[nv]) {
                    res += dist[v] + cur.first;
                }
                continue;
            }
            visit[v] = iter++;
            dist[v] = cur.first;
            for (auto e : G[v]) {
                int nv = e.first;
                long long wei = e.second;
                que.push(make_pair(dist[v] + wei, pint(nv, v)));
            }
        }
        
        cout << res << endl;
    }
}

        

	














Measured memory_bytes: 61800
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

int main(){
  vint A(3);
  cin >> A[0] >> A[1] >> A[2];
  sort(A.begin(),A.end());
  int ans = 0;
  ans += A[2]-A[1];
  A[1] += ans;
  A[0] += ans;
  if((A[2]-A[0])%2 == 0){
	ans += (A[2]-A[0])/2;
  }
  else{
    ans += (A[2]-A[0]+1)/2 + 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 1e6 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int LN = 22;
const int SN = 320;

long long n, m, u, v, k, t, q, x, d, p, a, b, c, s;

int dp[N][2];
string str;

int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> str;
   str = "$" + str;
   dp[0][0] = dp[0][1] = 0;
   for (int i = 1; i < str.size(); ++i) {
      if (i > 1) dp[i][1] = dp[i - 2][0] + 1;
      dp[i][0] = dp[i - 1][1] + 1;
      if (i > 2 and (str[i - 2] != str[i] or str[i - 3] != str[i - 1])) dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1);
      if (str[i - 1] != str[i]) dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);
   }
   
   cout << max(dp[str.size() - 1][0], dp[str.size() - 1][1]) << endl;
}


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

int main() {

 int N, M;
 cin >> N >> M;

 vector<pair<int,int>> sc(N);
 for (int i = 0; i < M; i++) {
   cin >> sc[i].first >> sc[i].second;
 }

 // N=1のときは、答えは0から9まで
 // N=2のときは、答えは10から99まで
 // N=3のときは、答えは100から999まで
 int start[3] = {0,10,100};
 int end[3] = {9,99,999};

 // Nに合わせて可能性がある答えを小さい数から順番に確認する。
 for (int i = start[N - 1]; i <= end[N - 1]; i++) {

   // 文字列にしておく
   string str = to_string(i);

   // 答えが存在するか(true)しないか(false)
   bool flg = true;

   // 1桁ごと確認する。
   // 見ている桁とs_iが同じだったら、
   // その桁の値とc_iが同じかチェックする。
   // 値とc_iが異なると答えは存在しない。
   for (int j = 0; j < N; j++) {
     for (int k = 0; k < M; k++) {
       if (j + 1 == sc[k].first) {
         if (sc[k].second != str[j] - '0'){
           flg = false;
         }
       }
     }
   }

   // flaがtrueのままfor文が終わった最初のiが答え。
   if (flg) {
     cout << i << endl;
     return 0;
   }

 }
 cout << -1 << endl;
 return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int N=sc.nextInt();
      int L=sc.nextInt();

      int tasteN=0;
      int tasteN1=0;
      int[] app = new int[N+1];
      int[] dif = new int[N+1];

      int num=0;
      int min=999999;

      for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      }

      for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      }

      for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      }

      for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      }


      System.out.println(app[num]);

    }
}


Measured memory_bytes: 23636
class Dice

  def initialize(dice)
    @top  = dice[0]
    @side   = [ dice[2], dice[1], dice[3], dice[4] ]
    @bottom = dice[5]
  end

  def roll(action)
    b = @bottom
    u = @top
    case action
    when "N"
      @top   = @side[2]
      @bottom  = @side[0]
      @side[2] = b
      @side[0] = u
    when "E"
      @top   = @side[3]
      @bottom  = @side[1]
      @side[3] = b
      @side[1] = u
    when "S"
      @top   = @side[0]
      @bottom  = @side[2]
      @side[0] = b
      @side[2] = u
    when "W"
      @top   = @side[1]
      @bottom  = @side[3]
      @side[1] = b
      @side[3] = u
    end
  end

  def same_dice?(sub)
    i = 0
    while true
      if south == sub.south
        4.times do
          if all_num == sub.all_num
            return true
          end
          roll("E")
        end
      end
      if i > 6
        return false
      elsif i == 3
        roll("E")
        roll("N")
      else
        roll("N")
      end
      i += 1
    end
  end

  def top
    @top
  end

  def bottom
    @bottom
  end

  def north
    @side[0]
  end

  def east
    @side[1]
  end

  def south
    @side[2]
  end

  def west
    @side[3]
  end

  def all_num
    [@top, @bottom, @side[2], @side[1], @side[3], @side[4]]
  end
end

num = (gets.to_i) - 1
dice = Dice.new(gets.split.map(&:to_i))

(1..num).each do |i|
  dice_2 = Dice.new(gets.split.map(&:to_i))
  if dice_2.same_dice?(dice)
    puts "No"
    exit
  end
end
puts "Yes"

Measured memory_bytes: 8920
import sys
readline = sys.stdin.readline
from bisect import bisect_left
INF = 10 ** 11

def main():
    A, B, Q = map(int, readline().rstrip().split())
    S = [int(readline()) for _ in range(A)]
    T = [int(readline()) for _ in range(B)]

    for _ in range(Q):
        x = int(readline())
        s_right_idx = bisect_left(S, x)
        if s_right_idx == 0:
            s_right = S[s_right_idx]
            s_left = -INF
        elif s_right_idx == A:
            s_left = S[s_right_idx-1]
            s_right = INF
        else:
            s_left,  s_right = S[s_right_idx - 1], S[s_right_idx]
        
        t_right_idx = bisect_left(T, x)
        if t_right_idx == 0:
            t_right = T[t_right_idx]
            t_left = -INF
        elif t_right_idx == B:
            t_left = T[t_right_idx-1]
            t_right = INF
        else:
            t_left,  t_right = T[t_right_idx - 1], T[t_right_idx]

        s_left_d, s_right_d = x - s_left, s_right - x
        t_left_d, t_right_d = x - t_left, t_right - x

        res1 = max(s_right_d, t_right_d)
        res2 = max(s_left_d, t_left_d)
        res3 = min(s_right_d * 2 + t_left_d, t_right_d * 2 + s_left_d)
        res4 = min(s_right_d + t_left_d * 2, t_right_d + s_left_d * 2)
        res = min(res1, res2, res3, res4)
        print(res)


if __name__ == '__main__':
    main()

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

int main(){
  string s;
  cin>>s;
  for(int i=0;;i++){
    cout<<s[i];
    if(i==3){
      cout<<" ";
      break;
    }
  }
  
  for(int i=4;i<12;i++){
    cout<<s[i];
  }
  cout<<endl;
  return 0;
}

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


int main(void){

    int n;
    scanf("%d", &n);
    int i, j;
    int bfrtime[n], m;
    for (i = 0; i < n;i++) scanf("%d", &bfrtime[i]);
    scanf("%d", &m);

    int p[m],drink_time[m];
    for (i = 0; i < m;i++){
        scanf("%d %d", &p[i], &drink_time[i]);
    }
    int sum = 0, temp;
    for (i = 0; i < m;i++){
        int c = p[i] - 1;
        temp = bfrtime[c];
        bfrtime[c] = drink_time[i];
        for (j = 0; j < n;j++){
            sum += bfrtime[j];
        }
        printf("%d\n", sum);
        bfrtime[c] = temp;
        sum = 0;
    }

    return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    vll A(N);
    REP(i, N) cin >> A[i];

    multiset<ll> s;

    REP(i, N) {
        auto it = s.lower_bound(A[i]);

        if (it == s.begin()) {
            s.insert(A[i]);
        } else {
            it--;
            s.erase(it);
            s.insert(A[i]);
        }
    }

    print(s.size());
    
}


Measured memory_bytes: 8688
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> LV;

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


int main() {
	llong N,K;
    cin >>N >> K;
    double ans = 0;
    FOR(n,1,N+1){
        double k = log2( double (K)/double (n) );
        double s = ceil(k);
        if(s<0) s=0;
        double t = pow(1.0/2.0,s);
        ans += t/N;
    }
    ans = ans;





    cout << setprecision(13) <<ans << endl;





}


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

using namespace std;


#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 (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int A, B, K;
	cin >> A >> B >> K;
	int a = 0;
	print(max(a, A - K));
	if (K - A > 0) {
		print(max(a, B - (K - A)));
	}
	else {
		print(B);
	}
}

Measured memory_bytes: 256
#include <array>
#include <cstddef>
#include <functional>
#include <type_traits>
#include <utility>

template <class Key, class T, Key Empty, std::size_t N,
	class Hash = std::hash<Key>>
	struct mu_hashmap {

	std::array<std::pair<Key, T>, N> table;
	Hash hash;

	explicit mu_hashmap(Hash hash = Hash()) : table(), hash(hash) {
		for (auto itr = table.begin(), end = table.end(); itr != end; ++itr) {
			itr->first = Empty;
		}
	}

	T& operator[](const Key key) {
		typename std::array<std::pair<Key, T>, N>::iterator itr =
			table.begin() + hash(key) % N;
		while (itr->first != key) {
			if (itr->first == Empty) {
				itr->first = key;
				break;
			}
			++itr;
			if (itr == table.end()) {
				itr = table.begin();
			}
		}
		return itr->second;
	}
};

#include<cstddef>
#include<cstdint>
#include<iostream>

int main() {
	using usize = std::size_t;
	using u32 = std::uint_fast32_t;
	using i64 = std::int_fast64_t;

	usize n;
	std::cin >> n;

	u32 ans = 0;
	i64 acc = 0;
	mu_hashmap<i64, u32, 200000ULL * 1000000000 + 1, (1ULL<<20)+5> count;
	++count[acc];

	for (usize i = 0; i != n; ++i) {
		i64 a;
		std::cin >> a;

		acc += a;
		ans += count[acc];
		++count[acc];
	}

	std::cout << ans << std::endl;

	return 0;
}



Measured memory_bytes: 16640
//
//  main.cpp
//  ITP1_8-A
//
//  Created by Saicj on 2015/07/15.
//  Copyright (c) 2015??´ saicj. All rights reserved.
//

#include <stdio.h>
#include <cctype>
#include <iostream>

using namespace std;

int main(int argc, const char * argv[])
{
    
    
    char ch;
    //    bool toUpper = true;
    //    bool space = false;
    
    while (1) {
        
        scanf("%c", &ch);
        
        if (isupper(ch) || islower(ch)){
            
            if (isupper(ch)) {
                ch = tolower(ch);
            }else if(islower(ch)){
                ch = toupper(ch);
            }
            
        }
        //
        //        if (isdigit(ch)){
        //           toUpper = true;
        //        }
        //
        //        if (isspace(ch)){
        //            space = true;
        //        }
        //
                printf("%c", ch);
        
        
        
        
        if (ch == '\n') {
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
#define int long long 
#define uint unsigned long long 
#define double long double 
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sz(a) (int)(a).size()
#define hell 1000000007
#define vi vector<int> 
#define vb vector<bool> 
#define vpi vector<pair<int,int>> 
#define x first 
#define y second 
#define endl '\n'

using namespace std;


void solve(){
	int n;
	cin >> n;
	for(int i = 1 ; i <= 9 ; i++ ){
		for(int j = 1 ; j <= 9 ; j++ ){
			if( i*j == n ){
				cout << "Yes" << endl;
				return ;
			}
		}
	}
	cout << "No" << endl;
}

int32_t main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(10);

	int t = 1;
	//cin >> t ;
	while(t--){
		solve();
	}
	return 0;
}

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

using namespace std;
using ll = long long;

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0, now = 0;
  rep(i, n) {
    if (s[i] == 'R')
      ++now;
    else {
      ans = max(ans, now);
      now = 0;
    }
  }
  ans = max(ans, now);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3564
import java.util.Scanner;

class Main{
  
 private static long solve(int[] weight, int[] value, int N, int W) {
  	long[][] T = new long[N][W+1];
  	
    for (int wt = weight[0]; wt <= W; wt++)
  	  T[0][wt] = value[0]; 
  	for(int i = 1; i < N; i++) {
        T[i][weight[i]] = value[i];
  		for(int w = 1; w <= W; w++) {
  			if(w >= weight[i]) {
  				T[i][w] = Math.max(T[i-1][w], T[i-1][w - weight[i]] + value[i]);
  			}
          	else{
              	T[i][w] = T[i-1][w];
            }
  		}
  	}
  	return T[N-1][W];
  }
    
 public static void main(String... args){
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int W = sc.nextInt();

      int[] weight = new int[N] ;
      int[] value = new int[N] ;

      for(int i = 0; i< N; i++){
            weight[i] = sc.nextInt();
            value[i] = sc.nextInt();
      }
      System.out.println(solve(weight, value, N, W));
      if(sc != null)
        sc.close();
  }
}


Measured memory_bytes: 125268
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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 main(){
   int n, m;
   cin >> n >> m;
   vector<int> l(m), r(m);

   int left_max = -INF, right_min = INF;
   for(int i = 0; i < m; i++){
      cin >> l[i] >> r[i];
      if(l[i] > left_max){left_max = l[i];}
      if(r[i] < right_min){right_min = r[i];}
   }

   int ans = 0;
   for(int i = left_max; i <= right_min; i++){
      ans++;
   }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>

using namespace std;

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

	cin >> a >> b >> c;

	if (a < b && b < c)
		cout << "Yes" << endl;

	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3044
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e12;
const ll N =(1e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;


void solve(){
	int n,S;
	cin >> n >> S;
	if(n == 0){
		if(S == 0){
			cout << 0 << " 0" << endl;
			return;
		}
		cout << -1 << endl;

		return;
	}
	if(n == 1 && S > 0){
		cout << -1 << endl;
		return;
	}	
	if(n > 1 && S >= (1ll<<n)){
		cout << -1 << endl;
		return;
	}
	if(n == 1){
		cout << "0 0 1 1\n";
		return;
	}
	int k = (1ll<<n);
	vector<int> ans;
	for(int i = 0;i<k;i++){
		if(i != S){
			ans.pb(i);
		}
	}
	ans.pb(S);
	for(int i= k-1;i>=0;i--){
		if(i != S){
			ans.pb(i);
		}
	}
	ans.pb(S);
	for(int i =0;i<ans.size();i++){
		cout << ans[i] << " ";
	}
	cout << endl;
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

Measured memory_bytes: 5276
# li = list(map(int, input().split()))
N, K = map(int, input().split())
A_N = list(map(int, input().split()))


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


next = A_N[0]
for i in range(len(A_N)):
    next = gcd(A_N[i], next)

if K > max(A_N):
    print('IMPOSSIBLE')
elif next == 1:
    print('POSSIBLE')
elif K % next ==0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 14224
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
#include<deque>
#include<chrono>
using namespace std;
#define pi 3.141592653589793238


#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f0 get<0>
#define f1 get<1>
#define f2 get<2>
typedef vector<ll> vi;
typedef vector<vi> vvi;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    
    //cin >> T;
    while (T--) {
        ll a , v, b ,w, t;
        cin >> a>>v>>b >> w;
        cin >> t;
        ll mina , maxa;
        mina = a - v * t;
        maxa = a + v * t;
        ll minb, maxb;
        minb = b - w * t;
        maxb = b + w * t;
        if(a < b){
            if(maxa >= maxb){
                cout << "YES";
            }
            else{
                cout << "NO";
            }
        } 
        else{
            if(minb >= mina){
                cout << "YES";

            }
            else{
                cout << "NO";
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0)
    {
        if(b&1)
            res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)
        return true;
    while(d!=n-1)
    {
        x=(x*x)%n;
        d*=2;
        if(x==1)
            return false;
        if(x==n-1)
            return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)
        return false;
    if(n<=3)
        return true;
    ll d=n-1;
    while(d%2==0)
        d/=2;
    for(int i=0; i<k; i++)
    {
        if(!miller_rabin(d,n))
            return false;
    }
    return true;
}
int n;
string s;
ll ans = 0;

void solve(ll x,ll y){
    if(x==n+1){
        ans += y;
        return;
    }
    ll cur = 0;
    for(ll i=x;i<=n;i++){
        cur = (10*cur) + (s[i]-'0');
        solve(i+1,y+cur);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll sum=1;
    ll mod=1e9+7;
    for(int i=2;i<=n;i++)sum=(sum*i)%mod;
    cout<<sum;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  using ld = long double;
  cout << fixed << setprecision(15);

  ll L;
  cin >> L;

  ld a = L / 3.0L;
  cout << a * a * a << endl;
}

Measured memory_bytes: 256
N,K =  map(int, input().split())
i=1
X=N%K
A=[]
A.append(X)
if K!=1:
    while True:
        A.append(abs(A[i-1]-K))
        if A[i] in (A):
            break
        i+=1
    print(min(A))
else:
    print(0)

Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <vector>

using u64 = unsigned long long;

u64 pow10(int n) { return n == 0 ? 1 : pow10(n - 1) * 10; }

int main() {
  int n, k;
  std::scanf("%d%d", &n, &k);
  std::vector<u64> p(n);
  for (u64 &e : p)
    std::scanf("%llu", &e);
  u64 ans = 0;
  u64 sum = k;
  for (int i = 0; i != n; i += 1) {
    sum += p[i];
    if (i >= k)
      sum -= p[i - k];
    ans = std::max(ans, sum);
  }

  ans *= 5 * pow10(6);
  //ans -= ans / pow10(6);

  std::printf("%llu.%07llu\n", ans / pow10(7), ans % pow10(7));

  return 0;
}


Measured memory_bytes: 1792
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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;}

long K,S,X,Y,Z,cnt;
deque<long> XY;
inline void solve(){
  IN2(K,S);
  UP(X,0,K){
    UP(Y,0,K){
      XY.pb(X+Y);
    }
  }
  for(auto e:XY){
    Z=S-e;
    if(Z>=0&&Z<=K)cnt++;
  }
  OUT(cnt);
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 51460
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[20],y[20];
signed main(){
	int n,ans=0;
	cin>>n;
	f(i,n){
		cin>>x[i];
	}
	f(i,n){
		cin>>y[i];
		ans+=max((int)(0),x[i]-y[i]);
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    string s;
    int flag=1,n;
    cin>>s;
    n=s.size()/2+1;
    for(int i=0;i<n-1;i++){
        if(s[i]==s[i+n] && s[i]==s[s.size()-1-i]){}
        else flag=0;
    }
    
    if(flag==1)cout<<"Yes";
    else if(flag==0)cout<<"No";
}


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

int main() {
    int N = 0;
    int flag = 0;
    int count = 1;
    string kari;

    cin >> N;
    vector<string> vec(N);

    for(int k = 0; k < N; k++){
        cin >> vec.at(k);
    }

    sort(vec.begin(), vec.end());
    kari = vec.at(0);

    for(int k = 1; k < N; k++){
        if(kari != vec.at(k)){
            count++;
            kari = vec.at(k);
        }
    }
    
    cout << count << endl;
    
}


Measured memory_bytes: 9600
N,M = map(int, raw_input().split())
L = []
R = []
for i in range(M):
	l1,r1 = map(int, raw_input().split())
	L.append(l1)
	R.append(r1)
l2 = max(L)
r2 = min(R)
if(l2 <= r2):
	print(r2-l2+1)
else:
	print(0)

Measured memory_bytes: 12164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int H,W,M;
    cin>>H>>W>>M;
    int h[M],w[M];
    set<pair<int,int>> s;
    int hs[H]{},ws[W]{};
    int hm=0,wm=0;
    rep(i,M){
        cin>>h[i]>>w[i];
        h[i]--;
        w[i]--;
        s.insert({h[i],w[i]});
        hs[h[i]]++;
        ws[w[i]]++;
        hm=max(hm,hs[h[i]]);
        wm=max(wm,ws[w[i]]);
    }
    int ans=hm+wm;
    vector<int> hh,ww;
    rep(i,H){
        if(hm==hs[i])hh.push_back(i);
    }
    rep(i,W){
        if(wm==ws[i])ww.push_back(i);
    }

    for(auto i:hh){
        for(auto j:ww){
            if(s.find({i,j})==s.end()){
                cout<<ans<<endl;
                return 0;
            }
        }
    }
    cout<<ans-1<<endl;
    



    



}


Measured memory_bytes: 39712
import java.util.*;

public class Main {
    public static void main(String myon[]){
        Scanner cin=new Scanner(System.in);
        int h=cin.nextInt();
        int w=cin.nextInt();
        int c[][]=new int[11][11];
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                c[i][j]=cin.nextInt();
            }
        }
        int a[][]=new int[h][w];
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                a[i][j]=cin.nextInt();
            }
        }
        for(int k=0;k<10;k++){
            for(int i=0;i<10;i++){
                for(int j=0;j<10;j++){
                    c[i][j]=Math.min(c[i][k]+c[k][j],c[i][j]);
                }
            }
        }
        int ans=0;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(a[i][j]==-1)continue;
                ans+=c[a[i][j]][1];
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 46396
#include<bits/stdc++.h>
using namespace std;
char st[16]={'C', 'O', 'D', 'E', 'F', 'E', 'S', 'T', 'I', 'V', 'A', 'L', '2', '0', '1', '6'};
char ss[16];
int sum;
int main(){
	cin>>ss;
	for(int i=0;i<16;i++){
		if(ss[i]!=st[i]){
			sum++;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

long long a[101010];

main(){
	int n;
	long long l;
	scanf("%d%lld",&n,&l);
	for(int i=0;i<n;i++)scanf("%lld",&a[i]);
	
	for(int i=0;i+1<n;i++){
		if(a[i]+a[i+1]>=l){
			puts("Possible");
			for(int j=1;j<=i;j++)printf("%d\n",j);
			for(int j=n-1;j>=i+1;j--)printf("%d\n",j);
			return 0;
		}
	}
	puts("Impossible");
}

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

int n;
string s;

void mrgmkn(char mc) {
	if(s.size() == n) {
		cout << s << "\n";
		return;
	}
	for(char c = 'a'; c <= mc; ++c) {
		s += c;
		mrgmkn((c == mc ? mc + 1 : mc));
		s.pop_back();
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	mrgmkn('a');
	return 0;
}


Measured memory_bytes: 1536
import java.io.PrintWriter;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		
		int n=in.nextInt();
		BTNode[] tree=new BTNode[n];
		for(int i=0;i<n;i++)tree[i]=new BTNode();
		
		for(int i=0;i<n;i++) {
			int id=Integer.parseInt(in.next()),
					l=Integer.parseInt(in.next()),
					r=Integer.parseInt(in.next());
			
			if(l!=-1) {
				tree[id].lc=l;
				tree[l].p=id;
			}
			if(r!=-1) {
				tree[id].rc=r;
				tree[r].p=id;
			}
		}
		in.close();
		
		//print
		PrintWriter out=new PrintWriter(System.out);
		for(int i=0;i<n;i++) {
			out.print("node "+i+": ");
			out.print("parent = "+tree[i].p+", ");
			out.print("sibling = "+sibling(tree,i)+", ");
			out.print("degree = "+degree(tree,i)+", ");
			out.print("depth = "+depth(tree,i)+", ");
			out.print("height = "+height(tree,i,0)+", ");
			out.println(nodeType(tree,i));
			out.flush();
		}
		
	}
	
	static int sibling(BTNode[] tree,int p) {
		if(tree[p].p==-1)return -1;
		
		if(tree[tree[p].p].lc==p)return tree[tree[p].p].rc;
		else return tree[tree[p].p].lc;
	}
	
	static int degree(BTNode[] tree,int pos) {
		int cnt=0;
		
		if(tree[pos].lc!=-1)cnt++;
		if(tree[pos].rc!=-1)cnt++;
		
		return cnt;
	}
	
	static int depth(BTNode[] tree,int p) {
		int cnt=0,pos=p;

		while(tree[pos].p!=-1) {
			pos=tree[pos].p;
			cnt++;
		}

		return cnt;
	}
	
	static int height(BTNode[] tree,int pos,int h) {
		if(tree[pos].lc==-1 && tree[pos].rc==-1)return h;
		
		int l=0,r=0;
		if(tree[pos].lc!=-1)l=height(tree,tree[pos].lc,h+1);
		if(tree[pos].rc!=-1)r=height(tree,tree[pos].rc,h+1);
		
		if(l>r)return l;
		else return r;
	}
	
	static String nodeType(BTNode[] tree,int p) {
		if(tree[p].p==-1)return "root";
		else if(tree[p].lc==-1 && tree[p].rc==-1)return "leaf";
		else return "internal node";
	}

}

class BTNode{
	int p=-1,lc=-1,rc=-1;
}



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

using namespace std;
  
int main(){
    
    int N;
    cin >> N;

    int h[N+1][3];
    for(int i=1; i<=N; i++){
        cin >> h[i][0] >> h[i][1] >> h[i][2];
    }

    int dp[N+1][3];
    dp[1][0] = h[1][0];
    dp[1][1] = h[1][1];
    dp[1][2] = h[1][2];

    for(int i=2; i<=N; i++){
        dp[i][0] = h[i][0] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = h[i][1] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = h[i][2] + max(dp[i-1][0], dp[i-1][1]);
    }

    cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << "\n";
    
    return 0; 
} 

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


int main() {
    int N;
    cin >> N;
    vector<tuple<string, int, int>> P;
    string s; int p;
    rep(i, N){
        cin >> s >> p;
        P.push_back(make_tuple(s, i + 1, p));
    }
    sort(P.begin(), P.end());

    vector<pair<int, int>> answer;
    string prev_s;
    int j;
    rep(i, N){
        tie(s, j, p) = P.at(i);
        if (i > 0 && s != prev_s){
            sort(answer.begin(), answer.end());
            reverse(answer.begin(), answer.end());
            for (auto a: answer){
                cout << a.second << endl;
            }
            answer = {};
        }
        answer.push_back(make_pair(p, j));
        prev_s = s;
    }
    if (answer.size()){
        sort(answer.begin(), answer.end());
        reverse(answer.begin(), answer.end());
        for (auto a: answer){
            cout << a.second << endl;
    }
    }
}

Measured memory_bytes: 3568
package main

import (
	"fmt"
)

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	for i := range s {
		fmt.Scan(&s[i])
	}

	BtoA := 0
	headB := 0
	tailA := 0
	containAB := 0
	for i := range s {
		head := s[i][0]
		tail := s[i][len(s[i])-1]
		if head == 'B' && tail == 'A' {
			BtoA++
		} else if head == 'B' {
			headB++
		} else if tail == 'A' {
			tailA++
		}
		for j := 0; j < len(s[i])-1; j++ {
			if s[i][j:j+2] == "AB" {
				containAB++
			}
		}
	}

	ans := containAB
	if headB+tailA == 0 {
		ans += max(0, BtoA-1)
	} else {
		ans += BtoA + min(headB, tailA)
	}
	fmt.Println(ans)
}


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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

string s;
vector<int> ax[2];
int x[2];
bool dp[2][16001];

int main(){
    cin >> s >> x[0] >> x[1];
    {
        int now = 0;
        int con = 0;
        int i = 0;
        for ( ; i < s.size(); i++) {
            if (s[i] != 'F') {
                break;
            }
        }
        if (i) x[0] -= i;
        for ( ; i < s.size(); i++) {
            if (s[i] == 'T') {
                if (con > 0) ax[now].push_back(con);
                now ^= 1;
                con = 0;
                continue;
            }
            con++;
        }
        if (con > 0) ax[now].push_back(con);
    }
    if (x[0] < -8000 || x[0] > 8000) {
        cout << "No" << endl;
        return 0;
    }
    rep(i,2) {
        memset(dp, 0, sizeof(dp));
        dp[0][8000] = true;
        int ho = 0, ge = 1;
        rep(j,ax[i].size()) {
            rep(k,16001) {
                if (dp[ho][k]) {
                    if (k+ax[i][j] <= 16000) dp[ge][k+ax[i][j]] = true;
                    if (k-ax[i][j] >= 0) dp[ge][k-ax[i][j]] = true;
                }
            }
            swap(ho, ge);
            memset(dp[ge], 0, sizeof(dp[ge]));
        }
        if (!dp[ho][x[i]+8000]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}
































Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Debug.Trace

main = do
  [a,b] <- words <$> getLine
  putStrLn $ if a == "H" then b
             else if b == "H" then "D"
                  else "H"


Measured memory_bytes: 380
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 六 12/15 20:16:34 2018
 * Ended  Time*  : 六 12/15 20:34:22 2018
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
#define debug(x) std::cerr << #x << " = " << (x) << std::endl
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

inline void OPEN(string s){
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

const int MAXN = 2e5;
deque<LL> que[3];
vector<LL> a;
int n, ans;

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		LL x; scanf("%lld", &x);
		a.push_back(x);
	}
	sort(a.begin(), a.end());
	for(int i = 0; i < a.size(); i++) que[1].push_back(a[i]);
	for(int k = 31; k >= 0; k--){
		LL ned = (1LL << k);
		int now = (k & 1);
		LL x = 0, y = 0;
		while(!que[now].empty()){
			if(x == 0){
				x = que[now].front();
				que[now].pop_front();
			}
			if(y == 0){
				if(que[now].empty()){
					que[!now].push_back(x);
					x = 0;
					break;
				}
				y = que[now].back();
				que[now].pop_back();
			}
			if(x + y == ned){
				ans++;
				x = y = 0;
			}
			else if(x + y < ned){
				que[!now].push_back(x);
				x = 0;
			}
			else if(x + y > ned){
				que[2].push_back(y);
				y = 0;
			}
		}
		if(x != 0) que[!now].push_back(x);
		if(y != 0) que[2].push_back(y);
		while(!que[2].empty()){
			que[!now].push_back(que[2].front());
			que[2].pop_front();
		}
	}
	printf("%d\n", ans);
    return 0;
}


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

int main(){
  int N, i, j, v, k;
  int A[100];

  scanf("%d", &N);
  if(N < 0 || 100 < N)
    exit(1);
  for(i = 0; i < N; i++){
    scanf("%d", &A[i]);
    if(A[i] < 0 || 1000 < A[i])
      exit(2);
  }
  for(k = 0; k < N-1; k++)
    printf("%d ", A[k]);
  printf("%d\n", A[k]);
  
  for(i = 1; i < N; i++){
    v = A[i];
    j = i - 1;
    while(0 <= j && v < A[j]){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    for(k = 0; k < N-1; k++)
      printf("%d ", A[k]);
    printf("%d\n", A[k]);
  }

  return 0;
}

Measured memory_bytes: 600
def main():
    n = int(input())
    T = [0] * n
    X = [0] * n
    Y = [0] * n
    for i in range(n):
        t,x,y = map(int,input().split())
        T[i] = t
        X[i] = x
        Y[i] = y

    for i in range(n):
        if i == 0:
            b_t = 0
            b_x = 0
            b_y = 0
        dist = abs(X[i] - b_x) + abs(Y[i] - b_y)
        time = T[i] - b_t

        if time < dist:
            print('No')
            return
        m = time % dist
        if m % 2 != 0:
            print('No')
            return
        b_t = T[i]
        b_x = X[i]
        b_y = Y[i]
    print('Yes')
if __name__ == '__main__':
    main()


Measured memory_bytes: 11732
from itertools import accumulate
import sys
input=sys.stdin.readline
def prm(x):
    if x == 1 or x == 4:
        return False
    for i in range(2,int(x**0.5+1)):
        if x%i==0:
            return False
    else:
        return True
def like2017(x):
    if x == 2:
        return False
    if prm(x) and prm((x+1)//2):
        return True
q=int(input())
l=[0]*(10**5+1)
for i in range(1,10**5+1):
    if like2017(i):
        l[i]=1
acl = list(accumulate(l))
for i in range(q):
    l,r=map(int,input().split())
    print(acl[r]-acl[l-1])

Measured memory_bytes: 6972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int P = 1e9 + 7;
ll power(ll x, ll t) {
	ll ret = 1;
	for(; t; t >>= 1, x = x * x % P) {
		if(t & 1) {
			ret = ret * x % P;
		}
	}
	return ret;
}
ll C(int n, int m) {
	ll ret = 1;
	for(int i = 1; i <= m; ++i) {
		ret = ret * power(i, P - 2) % P;
	}
	for(int i = n; i > n - m; --i) {
		ret = ret * i % P;
	}
	return ret;
}
int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans = (power(2LL, n) - 1 + P) % P;
	ans = ((ans - C(n, a) - C(n, b)) % P + P) % P;
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
use std::vec::Vec;
use std::collections::HashSet;

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

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

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let n: usize = read();
    let mut s = HashSet::new();
    for _ in 0..n {
      let t: String = read();
      s.insert(t);
    }

    println!("{}", s.len());
}


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

int main()
{
    int N;
    char a;
    cin>>N;
    set<char> group;
    for(int i=0;i<N;i++){cin >>a;group.insert(a);}
    if(group.size()==3)
    cout << "Three" << endl;
    else if(group.size()==4)
    cout <<"Four"<< endl;
    return 0;
}


Measured memory_bytes: 256
N,M,C=map(int,input().split())

B=list(map(int,input().split()))

A=[]
for i in range(N):
    A.append(list(map(int,input().split())))

result=0

for i in range(N):
    sum=C
    for j in range(M):
        sum+=A[i][j]*B[j]
    if sum>0:
        result+=1

print(result)

Measured memory_bytes: 3064
import sys
dic = [['a', 0], ['b', 0], ['c', 0], ['d', 0], ['e', 0], ['f', 0], ['g', 0], ['h', 0], ['i', 0], ['j', 0], ['k', 0], ['l', 0], ['m', 0], ['n', 0], ['o', 0], ['p', 0], ['q', 0], ['r', 0], ['s', 0], ['t', 0], ['u', 0], ['v', 0], ['w', 0], ['x', 0], ['y', 0], ['z', 0]]  
for s in sys.stdin.read().lower():
	if s == '':
		break
	for i in s:
		for j in range(0, 26):
			if dic[j][0] == i.lower():
				dic[j][1] += 1
				break
for i in range(0, 26):
	print dic[i][0], ':', dic[i][1]

Measured memory_bytes: 4280