akhauriyash/Code-Regression huggingface dataset:
// clang-format off
	#define BADSEED random_device{}()
	#include <bits/stdc++.h>
	using namespace std;
	using ll = long long;
	using uint = unsigned int;
	ostream &operator<<(ostream &os, int8_t c) { return os << short(c); }
	istream &operator>>(istream &is, int8_t &c) { short x; is >> x; c = x; return is; }
	#define TM_(...) template <class __VA_ARGS__>
	namespace narut {
	TM_(T) using TupSz = tuple_size<decay_t<T>>;
	TM_(T) constexpr auto spc(T const &t, int) -> decltype((cout << t), 'a') { return ' '; }
	constexpr auto spc(string const &s, int) { return '\n'; }
	TM_(T) constexpr auto spc(T const &t, char) { return '\n'; }
	struct IO {
		TM_(T) static auto out_(ostream &os, T const &t, int) -> decltype(void(os << t)) { os << t; }
		TM_(T, class OS) static auto out_(OS &os, T const &t, int) -> decltype(void(begin(t))) {
			auto it = begin(t), e = end(t);
			if (it != e) out_(os, *it++, 0);
			for (; it != e; out_(os, *it++, 0)) os << spc(*it, 0);
		}
		TM_(T, size_t... Is) static void out_tup(ostream &os, T const &t, index_sequence<Is...>) { (void)initializer_list<int>{0, ((Is == 0) ? 0 : ((os << ' '), 0), (os << get<Is>(t)), 0)...}; }
		TM_(T) static decltype(void(TupSz<T>{})) out_(ostream &os, T const &t, char) { out_tup(os, t, make_index_sequence<TupSz<T>::value>{}); }
		TM_(Sep, class F, class... Ts) static ostream &print(ostream &os, Sep sep, F const &f, Ts const &... ts) { return void(initializer_list<int>{(out_(os, f, 0), 0), (out_(os << sep, ts, 0), 0)..., (os << '\n', 0)}), os; }
		TM_(T) static auto in_(istream &is, T &t, int) -> decltype(void(is >> t)) { is >> t; }
		TM_(T, class IS) static auto in_(IS &is, T &t, int) -> decltype(void(begin(t))) { for (auto &x : t) in_(is, x, 0); }
		TM_(T, size_t... Is) static void in_tup(istream &is, T &t, index_sequence<Is...>) { (void)initializer_list<int>{0, (in_(is, get<Is>(t), 0), 0)...}; }
		TM_(T) static decltype(void(TupSz<T>{})) in_(istream &is, T &t, char) { in_tup(is, t, make_index_sequence<TupSz<T>::value>{}); }
	};
	} // namespace narut
	#define Cout(...) narut::IO::print(cout, ' ', __VA_ARGS__)
	#ifdef NARUT_LOCAL
	#define Debug(...) narut::IO::print(cerr << "\033[0;31m", ", ", __VA_ARGS__) << "\033[0m"
	#else
	#define Debug(...) 0
	#endif
	[[maybe_unused]] struct Cin { 
		template <class T> Cin const &operator>>(T &t) const { return narut::IO::in_(cin, t, 0), *this; }
		template <class T> operator T() const { T t; return *this >> t, t;  }	
	} Cin;
	TM_(T) auto operator%(T &t, size_t n) -> decltype(t.resize(n), t)& { return t.resize(n), t; }
	#define FOR(i, j, n) for (int i = int(j); i < int(n); ++i)
	#define ROF(i, j, n) for (int i = int(n) - 1; i >= int(j); --i)

// clang-format on





auto Run() {
	string s;
	cin>>s;
	auto f = s.find('7');	
	return f != s.npos;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
#ifdef NARUT_LOCAL
	assert(freopen("io/test.in", "r", stdin));
	cin.exceptions(cin.badbit | cin.failbit);
	cerr << fixed << setprecision(10);
#endif

	cout << (Run() ? "Yes\n" : "No\n");
}


Measured memory_bytes: 3656
n = int(input())
S = []
for i in range(n):
    S.append(input())
march = [0, 0, 0, 0, 0]
for i in S:
    #print(i)
    if i[0] == "M":
        march[0] += 1
    if i[0] == "A":
        march[1] += 1
    if i[0] == "R":
        march[2] += 1
    if i[0] == "C":
        march[3] += 1
    if i[0] == "H":
        march[4] += 1
march.sort()
i = 0
while True:
    if i >= len(march):
        break
    if march[i] == 0:
        del march[i]
        i -= 1
    i += 1
ans = 0
#print(march)
for i in range(len(march)):
    for j in range(i + 1, len(march)):
        for k in range(j + 1, len(march)):
            ans += march[i] * march[j] * march[k]
            
print(ans)


Measured memory_bytes: 9776
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

D = INT()
C = LIST()
S = [[]] * D
for i in range(D):
    S[i]  = LIST()
M = 26

def check(i, score, t, last):
    score += S[i][t]
    for j in range(M):
        last[j] += 1
    last[t] = 0
    for j in range(M):
        score -= C[j] * last[j]
    return score

last = [0] * M
ans = []
score = 0
for i in range(D):
    mx = -INF
    idx = -1
    for t in range(M):
        res = check(i, score, t, last[:])
        if res > mx:
            mx = res
            idx = t
    t = idx
    score += S[i][t]
    for j in range(M):
        last[j] += 1
    last[t] = 0
    for j in range(M):
        score -= C[j] * last[j]
    ans.append(t+1)
for t in ans:
    print(t)


Measured memory_bytes: 9796
#include<iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <math.h>
#include <cctype>
#include <iostream>
using namespace std;
//ITP1-8
int a,count=0;
string x,y,str;
int main(){
	cin>>y>>a;
	for(int ii=0;ii<a;ii++){
		cin>>x;x+=x;
	for(int i=0;i<x.size()-y.size();i++){
	str=x.substr(i,y.size());
	if(str==y){count++;break;}}
	}
	cout<<count<<endl;
	return 0;
}


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

int main()
{
	// {3 * 5 * 5}, {3 * 25}, {5 * 15}, {75}
	// {2 * 4 * 4}, {2 * 24}, {4 * 14}, {74}
	int N;
	scanf("%d", &N);
	std::vector<bool> isPrime(N + 1, true);
	std::vector<int> prime, primeCount;
	for (int i{2}; i <= N; i++)
	{
		if (isPrime[i])
		{
			prime.push_back(i);
			primeCount.push_back(1);
			for (int j{2 * i}; j <= N; j += i)
				isPrime[j] = false;
		}
		else
		{
			for (int j{}, num{i}; j < (int)prime.size() && num > 1; j++)
				while (num % prime[j] == 0)
				{
					primeCount[j]++;
					num /= prime[j];
				}
		}
	}
	// 2, 4, 14, 24, 74
	int boundary[5]{2, 4, 14, 24, 74};
	int greater_equal[5]{};
	for (auto& e: primeCount)
		for (int i{}; i < 5; i++)
			if (e >= boundary[i])
				greater_equal[i]++;
	int64_t ans{};
	ans += greater_equal[1] * (greater_equal[1] - 1) / 2 * (greater_equal[0] - 2);
	ans += greater_equal[3] * (greater_equal[0] - 1);
	ans += greater_equal[2] * (greater_equal[1] - 1);
	ans += greater_equal[4];
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int n;
  int i;
  int num[100];

  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &num[i]);
  }
  for(i=0;i<n;i++){
    if((num[i]%2==0) && (num[i]%3!=0) && (num[i]%5!=0)){
        puts("DENIED");
      return 0;
      }
  }
    puts("APPROVED");
    
    return 0;
}
    
  
  


Measured memory_bytes: 1616
unittest
{
	assert( [ "2" ].parse.expand.solve == 4 );
	assert( [ "100" ].parse.expand.solve == 10000 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto r = input.front.to!( long );
	return tuple( r );
}

auto solve( long r )
{
	return r * r;
}


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

int main(){
  int N;
  string S, T;
  cin >> N >> S >> T;
  string ans;
  for(int i=0; i<N; i++){
    ans+=S.at(i);
    ans+=T.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    cin >> A >> B;
    if (A==1) A+=13;
    if (B==1) B+=13;
    if (A>B)
        cout << "Alice" << endl;
    else if (A<B)
        cout << "Bob" << endl;
    else
        cout << "Draw" << endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static String I = "IMPOSSIBLE";
	public static String B = "Bad";
	public static String G = "Good";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int k = ni();
		String s = n();
		int sl = s.length();
		if (sl <= k) {
			out(s);
		} else {
			out(s.substring(0, k) + "...");
		}

	}

	public static int count(String search, String text) {
		int nsearch = search.length();
		int ntext = text.length();
		int count = 0;

		for (int i = 0; i <= ntext - nsearch + 1; i++) {
			for (int j = i + nsearch - 1; j < ntext; j++) {
				if (search.equals(text.substring(i, j + 1))) {
					count++;
				}
			}
		}

		return count;
	}

	/*
	 * 以下メソッド集
	 */
	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static int max(int a, int b) {
		return Math.max(a, b);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static int min(int a, int b) {
		return Math.min(a, b);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}


Measured memory_bytes: 38396
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
#ifdef BOOST_RANGE_ALGORITHM_FOR_EACH_HPP_INCLUDED
  boost::for_each(vc, [&os](T value) {
#else
  std::for_each(vc.begin(), vc.end(), [&os](T value) {
#endif
    os << value << '\n';
    });
  return os;
}

template<class T1, class T2>
inline
std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  using std::cin;
  //string S{}; std::cin >> S;
  ui N{}; cin >> N;
  vector<ull> H(N);
  rep(0, N) cin >> H[i];

  bool ans{true};
  rep_si_down(N - 2, -1)
  {
    if (H[i] > H[i + 1]) --H[i];
    if (H[i] > H[i + 1])
    {
      ans = false;
      break;
    }
  }

  using std::cout;
  cout << (ans ? "Yes" : "No" ) << '\n';
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair
#define eb emplace_back

const int MAX_N = 2e6+10;

int K;

void solve()
{
	for(int i=0;i<K;++i) cout<<"ACL";
	cout<<'\n';
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> K;
	solve();
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll n;
	cin >> n;
	string s, t,m;
	cin >> s >> t;
	m=s+t;
	for (ll i = 0; i <2*n; i++) {
		if (i % 2 == 0) {
			m[i] = s[i / 2];
		}
		else {
			m[i] = t[(i - 1) / 2];
		}
	}
	cout << m << endl;
}



Measured memory_bytes: 256
# dp
# N円を作るのに最も小さい操作回数

import sys
readline = sys.stdin.readline

N = int(readline())

dp = [i for i in range(N + 1)]

for i in range(len(dp)):
  n = 6
  while i + n < len(dp):
    if dp[i + n] > dp[i] + 1:
      dp[i + n] = dp[i] + 1
    n *= 6
  n = 9
  while i + n < len(dp):
    if dp[i + n] > dp[i] + 1:
      dp[i + n] = dp[i] + 1
    n *= 9
print(dp[N])


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

using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    int mn1=0;
    int mn2=0;
    char x='1';
    char y='0';
    for(int i=0;i<(int)s.size();++i){
        if(i%2==0){
            if(s[i]!=x) ++mn1;
        }else if(s[i]!=y) ++mn1;
    }
    x='0';
    y='1';
    for(int i=0;i<(int)s.size();++i){
        if(i%2==0){
            if(s[i]!=x) ++mn2;
        }else if(s[i]!=y) ++mn2;
    }
    cout<<min(mn1,mn2)<<endl;
}


Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M = mapint()
graph = [[] for _ in range(N)]
for _ in range(M):
    a, b = mapint()
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

from collections import deque
stack = deque([0])
colors = [-1]*N
colors[0] = 0

while stack:
    v = stack.pop()
    for nx in graph[v]:
        if colors[nx]==-1:
            colors[nx] = colors[v]^1
            stack.append(nx)
        else:
            if colors[nx]==colors[v]:
                print(N*(N-1)//2-M)
                exit()

ones = sum(colors)
zeros = N-ones
print(ones*zeros-M)

Measured memory_bytes: 87288
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;

int main() {
	string S, T;
	cin >> S >> T;
	bool pass;
	queue<string> u;
	for (size_t i = 0; i < S.size()-T.size()+1; i++)
	{
		pass = true;
		for (size_t j = 0; j < T.size(); j++)
		{
			if (S.at(i + j) != '?' && S.at(i + j) != T.at(j))pass = false;
		}
		if (pass)u.push(S.substr(0, i) + T + S.substr(i + T.size(), S.size() - i - T.size()));
	}
	vector<string>ans;
	string q;
	if (u.empty()) { cout << "UNRESTORABLE"; return 0; }
	while (!u.empty())
	{
		q = u.front();
		u.pop();
		for (size_t i = 0; i < q.size(); i++)
		{
			if (q.at(i) == '?')q.at(i) = 'a';
		}
		ans.emplace_back(q);
	}
	sort(ans.begin(), ans.end());
	cout << ans.at(0);
}


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

int main(void) {
  int n;
  cin >> n;

  vector<bool> d(101, false);
  d[4] = d[7] = true;
  for (int i = 1; i <= 100; i++) {
    if(d[i]){
      if(i+4<=100){
	d[i+4]=true;
      }
      if(i+7<=100){
	d[i+7]=true;
      }
    }
  }

  if(d[n]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

typedef struct {
  int B;
  int C;
} st_nums;

int int_sort(const void *a, const void *b) {
  return (*(int*)a - *(int*)b);
}

int nums_sort(const void *a, const void *b) {
  return (((st_nums*)a)->C - ((st_nums*)b)->C);
}

int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);
  int A[100000];
  uint64_t X = 0;
  for(int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    X += A[i];
  }
  qsort(A, N, sizeof(int), int_sort);

  st_nums nums[100000];
  for(int i = 0; i < M; i++) {
    scanf("%d %d", &nums[i].B, &nums[i].C);
  }
  qsort(nums, M, sizeof(st_nums), nums_sort);

  int dst = 0;
  for(int i = M; i >= 0; i--) {
    for(int j = 0; j < nums[i].B; j++) {
      if(dst >= N)
	break;
      if(A[dst] >= nums[i].C)
	break;
      X += (nums[i].C - A[dst++]);
      //A[dst++] = nums[i].C;
    }
  }

  printf("%ld\n", X);
  return 0;
}


Measured memory_bytes: 2164
let scan_int () = Scanf.scanf " %d" (fun x -> x)
let scan_string () = Scanf.scanf " %s" (fun x -> x)
let scan_array len read_func = Array.init len (fun _ -> read_func())
let print_int n = Printf.printf "%d\n" n

let () =
  let n = scan_int() and s = scan_string() in
  let rec solve i n ret =
    if (i+1) = n then ret
    else
      if s.[i] <> s.[i+1] then solve (i+1) n (ret+1)
      else solve (i+1) n ret in
  print_int (solve 0 n 1)


Measured memory_bytes: 2688
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long
const int maxn = 1e5+10;
ll a[maxn];
int main(){
	ll n, l, t, x, y, num = 0;
	scanf("%lld%lld%lld", &n, &l, &t);
	for(int i = 0; i < n; ++i){
		scanf("%lld%lld", &x, &y);
		a[i] = x + (y == 1 ? t : -t);
		num += a[i]/l;
		a[i] %= l;
		if(a[i] < 0) a[i] += l, num --;
	}
	num %= n;
	sort(a, a+n);
	for(int i = 0; i < n; ++i){
		if(i == n-1) printf("%lld\n", a[(i+num+n)%n]);
		else printf("%lld ", a[(i+num+n)%n]);
	}
	return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const int MAX = 510000;
const int MOD = 1e9+7;

ll fac[MAX], finv[MAX], inv[MAX];


ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll m) {
    // return a^-1 mod m
    ll x = a, y = m, u = 1, v = 0;
    while (y) {
        ll div = x / y;
        x -= div * y; swap(x, y);
        u -= div * v; swap(u, v);
    }
    return (u % m + m) % m;
}

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

ll COM(ll n, ll k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll com(ll n, ll k) {
    ll divided = 1, divisor = 1;
    rep(i, k) {
        divided = divided * (n - i) % MOD;
        divisor = divisor * inv[i + 1] % MOD;
    }
    return ((divided * divisor % MOD) + MOD) % MOD;
}

int main()
{
    COMinit();
    ll n, a, b; cin >> n >> a >> b;
    ll sum = ((modpow(2, n, 1e9+7) - com(n, a) - com(n, b) - 1) + MOD) % MOD;
    if (sum < 0) sum += MOD;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 12160
s = input().split("/")
for i in range(3):
    s[i] = int(s[i])
if s[0] <= 2019:
    if s[1] <= 4:
        if s[2] <= 30:
            print("Heisei")
        else:
            print("TBD")
    else:
        print("TBD")
else:
    print("TBD")


Measured memory_bytes: 2940
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<59;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

char a,b,c,d,e,f;

int main(){
	cin>>a>>b>>c>>d>>e>>f;
	if(a==f&&b==e&&c==d) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll n, m; cin >> n >> m;
  vector<vector<bool>> G(n, vector<bool>(n, false));
  rep(i, m) {
    ll a, b; cin >> a >> b; --a, --b;
    G[a][b] = G[b][a] = true;
  }
  vector<vector<bool>> used(n, vector<bool>(n, false));
  vector<bool> vused(n, false);
  vused[0] = true;
  ll v = 0, cnt = 0, vcnt = 1;
  while (vcnt < n || cnt < m || v != 0) {
    bool is_update = false;
    rep(to, n) {
      if (v == to) continue;
      if (!used[v][to] && G[v][to]) {
        used[v][to] = used[to][v] = true;
        ++cnt;
        v = to;
        is_update = true;
        break;
      }
    }
    if (!is_update) {
      rep(to, n) {
        if (v == to) continue;
        if (!used[v][to]) {
          used[v][to] = used[to][v] = true;
          v = to;
          is_update = true;
          break;
        }
      }
    }
    if (!is_update) {
      cout << -1 << endl;
      return;
    }
    if (!vused[v]) {
      vused[v] = true;
      ++vcnt;
    }
    // cout << v << endl;
  }
  vector<P> ans;
  rep(i, n) rep(j, i) {
    if (used[i][j] && !G[i][j]) {
      ans.eb(j, i);
    }
  }
  cout << ans.size() << endl;
  each(p, ans) {
    cout << p.first+1 << " " << p.second+1 << endl;
  }
}



Measured memory_bytes: 3336
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define sd(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define pl(n) printf("%lld",n)
#define sf(n) scanf("%f",&n)
#define pf(n) printf("%.12f",n)
#define psp printf(" ")
#define endc printf("\n")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int maxn = 2e5 + 7; 
//const int md = 1e9 + 7;

set<int> s;

int main() {
	int n; sd(n);
	for (int i = 1; i<= n;i++) {
		int x; sd(x); if (s.count(x) == 0) { s.insert(x); } else { s.erase(x); }
	}
	pd(s.size()); endc;
}

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

int main(){
  int a[100001],n,count=0;
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>a[i];

  for(int i=0;i<n;i++)
    if(a[i]>a[n-1])
      count++;
    else 
      swap(a[i],a[i-count]);

  for(int i=0;i<n-count-1;i++)
    cout<<a[i]<<' ';
  cout<<'['<<a[n-count-1]<<']'<<' ';
  for(int i=n-count;i<n-1;i++)
    cout<<a[i]<<' ';
  cout<<a[n-1]<<endl;

  return 0;
}

Measured memory_bytes: 1548
#include <stdio.h>

int main (){
	char a,b;
	scanf ("%c %c",&a,&b);getchar();
	int satu,dua;
	if(a=='A'){
		satu=10;
	}else if (a=='B'){
		satu=11;
	}else if (a=='C'){
		satu=12;
	}else if (a=='D'){
		satu=13;
	}else if (a=='E'){
		satu=14;
	}else if (a=='F'){
		satu=15;
	}
	if(b=='A'){
		dua=10;
	}else if (b=='B'){
		dua=11;
	}else if (b=='C'){
		dua=12;
	}else if (b=='D'){
		dua=13;
	}else if (b=='E'){
		dua=14;
	}else if (b=='F'){
		dua=15;
	}
	
	if(satu<dua){
		printf ("<\n");
	}else if (satu>dua){
		printf (">\n");
	}else if (satu==dua){
		printf ("=\n");
	}	
}

Measured memory_bytes: 128
object Main {
  def main(args: Array[String]): Unit = {
    val Array(t_cookie, a_cookie, required_cookie) = io.StdIn.readLine.split(" ").map{_.toLong}
    var t_after_cookie = 0L
    var a_after_cookie = 0L
    if(t_cookie + a_cookie >= required_cookie) {
      t_after_cookie = if (t_cookie >= required_cookie) t_cookie - required_cookie else 0
      a_after_cookie = if (t_after_cookie > 0)          a_cookie                   else t_cookie + a_cookie - required_cookie
    }
    else {
      t_after_cookie = 0
      a_after_cookie = 0
    }

    println(t_after_cookie.toString + " " + a_after_cookie.toString)
  }
}

Measured memory_bytes: 27320
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


const long long MOD = 1000000000 + 7;

long long n;
long long f[1000010][4];	//0--none, 1--zero, 2--nine, 3--all

int main()
{
	scanf("%lld", &n);
	
	long long count = n - 2;
	if (n == 1) {
		printf("0\n");
		return 0;
	}
	
	f[0][0] = 1;
	f[0][1] = 0;
	f[0][2] = 0;
	f[0][3] = 0;
	
	for (int i = 1 ; i <= n ; i++) {
		f[i][0] = (f[i - 1][0]) * 8 % MOD;
		
		f[i][1] = ((f[i - 1][1] * 9) % MOD + f[i - 1][0]) % MOD;
		
		f[i][2] = ((f[i - 1][2] * 9) % MOD + f[i - 1][0]) % MOD;
		
		f[i][3] = ((f[i - 1][3] * 10) % MOD + f[i - 1][1] + f[i - 1][2]) % MOD;
	}
	
	long long ans = f[n][3] % MOD;
	printf("%lld\n", ans);

	return 0;
}




Measured memory_bytes: 32904
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
int test[213456], sum[213456], cnt[213456];
signed main() {
	int n, k, a = 0, b = 0, ok = 0, ans = 0; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> test[h]; ok += test[h];
	}
	for (int h = 0; h < n; h++) {
		cin >> sum[h]; ok -= sum[h];
	}
	for (int h = 0; h < n; h++) {
		if (test[h] > sum[h]) { cnt[a] = test[h] - sum[h]; a++; }
		if (test[h] < sum[h]) { b += sum[h] - test[h]; ans++; }
	}
	sort(cnt, cnt + a);
	if (ok < 0) {
		cout << -1 << endl; return 0;
	}
	for (int h = a - 1; h >= 0; h--) {
		if (b > 0) { b -= cnt[h]; ans++; }
		else { break; }
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3072
fun main(args: Array<String>) {
    val nk = nextIntList()
    val n = nk[0]
    val k = nk[1]

    val an = nextLongList()

    fun fCalc (n:Int):Long{
        var res = 0L
        for(i in n-k+1..n){
            res += an[i]
        }
        return res
    }
    fun nCalc(before :Long, n:Int):Long{
         return before - an[n-k] + an[n]
    }
    fun check(a:Long,b:Long){
        if(a > b) println("Yes") else println("No")
    }

    var b = -1L
    var a = -1L

    // 1~k-1 x
    for(i in k-1 until an.size){
        if(b < 0L){
            b = fCalc(i)
            continue
        }
        a = nCalc(b,i)
        check(a, b)
        b = a
    }

}
fun next() = readLine()!!
fun nextIntList() = next().split(" ").map{ it.toInt() }
fun nextLongList() = next().split(" ").map{ it.toLong() }

Measured memory_bytes: 72224
import Data.Maybe

main = do
  _ <- getLine
  s <- getLine

  putStrLn $ h $ catMaybes [g a b s | a<-"SW", b<-"SW"]
  
  where
    h [] = "-1"
    h a = head a
    g a b xs = if b == rl && a == (last ri) then Just ri else Nothing
      where
        r = f a b xs
        ri = init r
        rl = last r
    f _ b [] = [b]
    f 'S' 'S' ('o':xs) = 'S' : (f 'S' 'S' xs)
    f 'S' 'S' ('x':xs) = 'S' : (f 'S' 'W' xs)
    f 'W' 'S' ('o':xs) = 'S' : (f 'S' 'W' xs)
    f 'W' 'S' ('x':xs) = 'S' : (f 'S' 'S' xs)
    f 'S' 'W' ('o':xs) = 'W' : (f 'W' 'W' xs)
    f 'S' 'W' ('x':xs) = 'W' : (f 'W' 'S' xs)
    f 'W' 'W' ('o':xs) = 'W' : (f 'W' 'S' xs)
    f 'W' 'W' ('x':xs) = 'W' : (f 'W' 'W' xs)


Measured memory_bytes: 15740
s=input()+'TE'
x,y=list(map(int,input().split()))

ini = s.find('T')
s=s[ini+1:]

is_y=1
point=[set([ini]),set([0])]

while len(s)>1:
    tmp=s.find('T')
    if tmp != 0:
        set_=set()
        for z in point[is_y]:
            set_.add(z+tmp)
            set_.add(z-tmp)
        point[is_y]=set_
    is_y+=1
    is_y%=2
    s=s[tmp+1:]

if x in point[0] and y in point[1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3948
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef pair<ll,P> PP;
string s; int n;
bool can(int k) {
	int ri = k;
	int le = n - k;
	char memo='a';
	Rep(i, le, ri) {
		if (memo == 'a') {
			memo = s[i];
		}
		else {
			if (memo != s[i])return false;
		}
	}
	return true;
}
int main() {
	cin >> s; n = s.length();
	int le = 1; int ri = n+1;
	while (ri - le > 1) {
		int mid = (ri + le) / 2;
		if (can(mid))le = mid;
		else ri = mid;
	}
	if (n == 2 && s[0] == s[1])le = 2;
	cout << le << endl;
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int n;
  int ans;

  cin >> n;

  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    if (i == 0)
      ans = a;
    else
      ans = __gcd(a, ans);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x;
int main()
{
	cin>>x;
	if(x==25)
	{
		cout<<"Christmas"<<endl;
		return 0;
	}
	if(x==24)
	{
		cout<<"Christmas Eve"<<endl;
		return 0;
	}
	if(x==23)
	{
		cout<<"Christmas Eve Eve"<<endl;
		return 0;
	}
	if(x==22)
	{
		cout<<"Christmas Eve Eve Eve"<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(true){


			int n =sc.nextInt();
			int m =sc.nextInt();
			if(n+m==0)break;
			long[][]dp=new long[n+1][m+1];
			int k = sc.nextInt();
			for(int i=0;i<k;i++){
				dp[sc.nextInt()][sc.nextInt()]=-1;
			}
			dp[1][1]=1;
			for (int i = 1; i < dp.length; i++) {
				for (int j = 1; j < dp[i].length; j++) {
					if(dp[i][j]==-1)continue;
					if(dp[i-1][j]!=-1){
						dp[i][j]+=dp[i-1][j];
					}
					if(dp[i][j-1]!=-1){
						dp[i][j]+=dp[i][j-1];
					}
				}
			}
			System.out.println(dp[n][m]);
		}
	}

}

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

int main(){
    int h,w;
    cin >> h >> w;
    int a,b;
    string abc[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> abc[i][j];
            if(abc[i][j]=="snuke"){
                a=i;
                b=j;
            }
        }
    }
    
    a++;
    char aaa='A'+b;
    
    cout << aaa << a << endl;

    return 0;
}







Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <class T>
void setmin(T &a, T const &b) {
    if (a > b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

const int INF = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    repeat(i, N) cin >> A[i];
    deque<int> deq;
    repeat(i, N) {
        int p = lower_bound(deq.begin(), deq.end(), A[i]) - deq.begin();
        if (p == 0) {
            deq.push_front(A[i]);
        } else {
            deq[p - 1] = A[i];
        }

        // for (int p : deq) {
        //     cout << p << " ";
        // }
        // cout << endl;
    }
    int ans = deq.size();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3972
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, h = IR(3)
    print((a+b)*h//2)
    return

#B
def B():
    sa = deque(S())
    sb = deque(S())
    sc = deque(S())
    tern = "a"
    while 1:
        if tern == "a":
            if sa:
                tern = sa.popleft()
            else:
                print("A")
                return
        elif tern == "b":
            if sb:
                tern = sb.popleft()
            else:
                print("B")
                return
        else:
            if sc:
                tern = sc.popleft()
            else:
                print("C")
                return

    return

#C
def C():
    return

#D
def D():
    return



#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38512
def pos(s)
  ary = []
  (s.size).times do |i|
    if s[i]=="1" then
      ary.push(i)
    end
  end
  return ary
end

s = gets.to_i
s = (s.to_s + "0").to_i
size = s.to_s.length - 1

sum = 0

(2**size).times do |j|
  str = j.to_s(2)
  str = "0"*(size-str.size) + str
  pos_ary = pos(str)
  #pos_ary.push("1")
  sp = 0
  if(str[-1]=="1")then
    pos_ary.each do |p|
      #puts "#{sp},#{p}"
      num = s.to_s[sp..p].to_i
      #puts "#{str} num=#{num}"
      sum += num
      sp = p+1
    end
  end
end
puts sum


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define ll long long int
#define infpos INT_MAX/8
#define infneg INT_MIN
#define mk_p make_pair

using namespace std;
//ifstream in("C:/testes programas/t.txt");
//ofstream out("C:/testes programas/o.txt");
//ifstream file("C:/testes programas/out.txt");
int som[100005];
int main(){
  ios::sync_with_stdio(0);
  int n,q;
  cin>>n>>q;
  string s;
  cin>>s;
  int a = 0;
  s+=" ";
  for(int i=0;i<n;i++){
    int w = 0;
    if((s[i]=='A')&&(s[i+1]=='C')) w = 1;
    som[i+1] = som[i] + w;
  }
  for(int i=0;i<q;i++){
    int l,r;
    cin>>l>>r;
    cout<< som[r-1] - som[l-1]<<endl;
  }

}


Measured memory_bytes: 1488
function main(input) {
	const args = input.split(' ');
	const a = parseInt(args[0], 10);
	const b = parseInt(args[1], 10);
	const c = parseInt(args[2], 10);
	const d = parseInt(args[3], 10);
	var t = 0;
	if(Math.abs(a-c)<=d){
		t = 1;
	} else if(Math.abs(a-b)<=d && Math.abs(b-c)<=d){
		t = 1;
	}
	if(t == 1){
		console.log('Yes');
	} else {
		console.log('No');
	}
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <stdio.h>
#define swap(type, x, y) do{ type t = x; x = y; y = t; }while(0)

void quick(long array[], int left, int right){
  int pl = left, pr = right, x = array[(left + right) / 2];
  do{
    while(array[pl] > x)  pl++;
    while(array[pr] < x)  pr--;
    if(pl <= pr){
      swap(long, array[pl], array[pr]);
      pl++, pr--;
    }
  }while(pl <= pr);
  if(pl < right)  quick(array, pl, right);
  if(pr > left)   quick(array, left, pr);
}

int main(){
  int n;  scanf("%d", &n);
  long tarin = 0, tarisum = 0;
  long amari[100005] = {0}, amalen = 0, amasum = 0;
  long a[100005], b[100005];
  for(int i=1; i<=n; i++)  scanf("%ld", a+i);
  for(int i=1; i<=n; i++){
    scanf("%ld", b+i);
    if(a[i] < b[i]){
      tarin++;
      tarisum += (b[i]-a[i]);
    }else{
      amari[++amalen] = a[i] - b[i];
      amasum += amari[amalen];
    }
  }
  if(tarisum > amasum){
    printf("-1\n");
    return 0;
  }
  quick(amari, 1, amalen);

  int i = 1;
  while(tarisum > 0 && i <= amalen){
    tarisum -= amari[i++];
    tarin++;
  }

  printf("%ld\n", tarin);

  return 0;
}


Measured memory_bytes: 4036
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp=[[0 for i in range(n)] for j in range(2)]
dp[0][0]=a[0]
for i in range(1,n):
    dp[0][i]=a[i]+dp[0][i-1]
dp[1][0]=dp[0][0]+b[0]
for i in range(1,n):
    dp[1][i]=max(dp[0][i],dp[1][i-1])+b[i]
print(dp[1][n-1])



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

int main(){
	int n; cin >> n;
	int ans = 0;
	bool used[n] = {0};
	int a[n];
	int now = 0;
	for(int i = 0; i < n; ++i){
		int b; cin >> b;
		a[i] = b - 1;
	}
	while(1){
		++ans;
		if(a[now] == 1){
			cout << ans << endl;
			break;
		}else if(used[a[now]]){
			cout << -1 << endl;
			break;
		}else{
			used[a[now]] = 1;
			now = a[now];
		}
	}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
  int n;
  cin>>n;
  int a[n][n];
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cin>>a[i][j];
    }
  }
  int s=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      s+=min(a[i][j],a[j][i]);
    }
  }
  cout<<s<<endl;
}



Measured memory_bytes: 3184
#include <iomanip>
#define _USE_MATH_DEFINES
#include<math.h>
#include<iostream>
using namespace std;


int main()
{
	double a, b, C, S, L, h, cpi, dab;

	cin >> a >> b >> C;
	cpi = C / (double)180 * M_PI;
	
	S = b*a*sin(cpi) / (double)2;
	dab = sqrt(((a*sin(cpi))*(a*sin(cpi))) + ((b - a*cos(cpi))*(b - a*cos(cpi))));
	L = a + b + dab;
	h = b*sin(cpi);

	cout << fixed << setprecision(8) << S << endl;
	cout << fixed << setprecision(8) << L << endl;
	cout << fixed << setprecision(8) << h << endl;
	
	return 0;
}


Measured memory_bytes: 3656
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    a, b, c = MI()
    if a%2 or b%2 or c%2:
        print(0)
        sys.exit()
    if (a == b) and (b == c):
        print(-1)
        sys.exit()
    cnt = 0
    while True:
        if a%2 or b%2 or c%2:
            break
        temp_a = a
        temp_b = b
        temp_c = c
        a = temp_b//2 + temp_c//2
        b = temp_a//2 + temp_c//2
        c = temp_a//2 + temp_b//2
        cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()

Measured memory_bytes: 8976
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int n = sc.nextInt();
			
			long sum = 0;
			long prev = 0;
			
			for(int i = 0 ; i < n ; i++ ) {
				long current = sc.nextLong();
				
				if ( current < prev ) {
					sum += prev - current;
				}
				else {
					prev = current;
				}
			}
			
			System.out.println(sum);
		}
	}

}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int ans = 0;
    rep(i, n) {
        if (i % 2 == 0 && a[i] % 2 == 1) ++ans;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	s := readString()
	println(strings.Count(s, "1"))
}


Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int n,ans=0; cin>>n;
    rep(i,n){
        int l,r; cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
num = [0]*10
for _ in range(h):
    a = list(map(int, input().split()))
    for i in a:
        if i == -1:
            continue
        num[i] += 1
#a = [list(map(int, input().split())) for _ in range(h)]
#print(num)
for i in range(10):
    for j in range(10):
        for k in range(10):
                c[j][k] = min(c[j][k], c[j][i]+c[i][k])
#print(c)
print(sum(num[x]*c[x][1] for x in range(10)))


Measured memory_bytes: 9244
def readinput():
    a,b,c=map(int,input().split())
    k=int(input())
    return a,b,c,k

def main(a,b,c,k):
    count=0
    while not (a<b):
        b*=2
        count+=1
    while not (b<c):
        c*=2
        count+=1
    #print(a,b,c,count)
    if count<=k:
        return 'Yes'
    else:
        return 'No'

if __name__=='__main__':
    a,b,c,k=readinput()
    ans=main(a,b,c,k)
    print(ans)


Measured memory_bytes: 9192
package main

import "fmt"

func call(n int) {
    for i:=1; i<=n; i++ {
        x := i
        if x % 3 == 0 {
            fmt.Printf(" %d", i)
            continue
        }

        for {
            if x % 10 == 3 {
                fmt.Printf(" %d", i)
                break
            }

            x /= 10
            if x == 0 {
                break
            }
        }
    }
    fmt.Println("")
}

func main() {
    var n int

    fmt.Scanf("%d", &n)
    call(n)
}


Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    int n;
    cin>>n;
    vector<ll> a(n);

    rep(i,n) cin>>a[i];
    vector<ll> s1(n+1,0),s2(n+1,0);
    rep(i,n) s1[i+1]=s1[i]+a[i];
    reverse(all(a));
    rep(i,n) s2[i+1]=s2[i]+a[i];
    reverse(all(a));

    ll ans=1LL<<60;
    for(int i=1;i<=n-1;i++){
        ll x=s1[i];
        ll y=s2[n-i];
        ll tmp=abs(x-y);
        ans=min(ans,tmp);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 7972
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstdio>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define int long long
using namespace std;

signed main() {
    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: 256