akhauriyash/Code-Regression huggingface dataset:
def main():

    TaroScore = HanaScore = 0
    n = int(input())
    for _ in range(n):
        [Taro, Hana] = list(input().lower().split())

        lenT = len(Taro)
        lenH = len(Hana)
        lenMin = min(lenT, lenH)

        if Taro == Hana:
            TaroScore += 1
            HanaScore += 1
        
        else:
            for i in range(lenMin+1):
                if Taro == '':
                    HanaScore += 3
                    break
                elif Hana == '':
                    TaroScore += 3
                    break
                elif ord(Taro[0]) > ord(Hana[0]):
                    TaroScore += 3
                    break
                elif ord(Taro[0]) < ord(Hana[0]):
                    HanaScore += 3
                    break
                else:
                    Taro = Taro[1:]
                    Hana = Hana[1:]

    print(TaroScore, HanaScore)

if __name__ == '__main__':
    main()



Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

const double eps = 1e-16;

int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    c -= a+b;
    if((c <= 0)){
        cout << "No" << endl;
        return 0;
    }
    if(c*c > 4*a*b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define _ << ' ' <<
#define _squ(x)  ((x) * (x))
#define _var_name(var)  cout << #var << " : ";
#define _dbg(var)  VAR_NAME(var); view(var);
#define _max(v)  *max_element(v.begin(), v.end())
#define _min(v)  *min_element(v.begin(), v.end())
#define _sort(var)  std::sort(var.begin(), var.end());
#define _rsort(var)  std::sort(var.begin(), var.end(), std::greater<>());
using namespace std;
using ll = long long;
int gcd(int m, int n){return !n ? m : gcd(n, m%n);}
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<typename T> void view(const T e){ std::cout << e << std::endl;}
template<typename T> void view(const vector<T>& v){ for(const auto& e : v) std::cout << e << " "; std::cout << std::endl; }
template<typename T> void view(const VV<T>& vv){ for(const auto& v : vv){ view(v); } }

int main(){
  int i, j;
  int A, P;
//  cin >> N;
//  V<int> v(N);
//  for(i=0; i<v.size(); i++) cin >> v[i];
  cin >> A >> P;
  cout << (3*A+P)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
w,h,n = gets.chomp.split(" ").map(&:to_i)
x = n.times.map{gets.chomp.split(" ").map(&:to_i)}
y = Array.new(h).map{Array.new(w,0)}
for i in 0..n-1
  if x[i][2] == 1
    y.each do |arr|
      for j in 0..x[i][0]-1
        arr[j] = 1
      end
    end
  elsif x[i][2] == 2
    y.each do |arr|
      for j in x[i][0]..w-1
        arr[j] = 1
      end
    end
  elsif x[i][2] == 3
    for j in 0..x[i][1]-1
      for k in 0..w-1
        y[j][k] = 1
      end
    end
  else x[i][2] == 4
    for j in x[i][1]..h-1
      for k in 0..w-1
        y[j][k] = 1
      end
    end
  end
end
ans = 0
y.each do |arr|
  ans += arr.count(0)
end
puts ans

Measured memory_bytes: 1916
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#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 complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    string s = to_string(n);
    int sum = 0;
    rep(i, (int)s.size()) {
        sum += s[i] - '0';
    }
    if(n % sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	cin>>s;
	cin>>t;
	int a,b;
	cin>>a>>b;
	string u;
	cin>>u;
	if(u==s)
	a--;
	else
	if(u==t)
	b--;
	cout<<a<<" "<<b;
	return 0;
}

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

int main() {
  int N,A,B;
  cin >> N >> A>>B;
A=N+A;
  if (A>=B&&B>=N) {
    cout << "YES"<< endl;
  }
  else {
  cout << "NO" <<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

int main(){
  char c[3][3];
  rep(i,3) rep(j,3) cin>>c[i][j];
  rep(i,3) cout<<c[i][i];
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
s = int(input())
if 400 <= s <= 599:
    print("8")
elif 600 <= s <= 799:
    print("7")
elif 800 <= s <= 999:
    print("6")
elif 1000 <= s <= 1199:
    print("5")
elif 1200 <= s <= 1399:
    print("4")
elif 1400 <= s <= 1599:
    print("3")
elif 1600 <= s <= 1799:
    print("2")
elif 1800 <= s <= 1999:
    print("1")

Measured memory_bytes: 9188
from collections import Counter
import itertools
 
N = int(input())
src = [input() for i in range(N)]
 
ctr = Counter()
for s in src:
    ctr.update(s[0])
 
ans = 0
for ptn in itertools.combinations('MARCH',3):
    a,b,c = ptn
    ans += ctr[a] * ctr[b] * ctr[c]
print(ans)

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

int main() {
    int a, b;
    cin >> a >> b;
    if(a == b){
        puts("Yes");
    }else{
        puts("No");
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  vector<pair<long long, long long>>ju;
  for (int i = 0; i < N; i ++) {
    int A, B;
    cin >> A >> B;
    ju.push_back(make_pair(A, B));
  }
  sort(ju.begin(), ju.end());
  long long ans = 0;
  int i = 0;
  long long co = 0;
  while(co < M) {
    co += ju[i].second;
    ans += ju[i].first * ju[i].second;
    i ++;
  }
  ans -= (co - M) * ju[--i].first;
  cout << ans << endl;
}
  


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;

    rep(i, s.length()) {
        if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C') s[i] = '1';
        else s[i] = '0';
    }

    int Max = 0, cnt = 0;

    rep(i, s.length()) {
        if (s[i] == '1') cnt++;
        else cnt = 0;
        Max = max(Max, cnt);
    }
    cout << Max << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  long long n,m,sum=0;
  cin>>n>>m;
  if(2*n>=m) 
    cout<<m/2<<endl;
  else{
    sum+=n;
    m-=n*2;
    cout<<sum+m/4<<endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n,r;

int main(){
	while(cin >> n >> r && n+r){
		vector<ll> v(n);
		rep(i,n)v[i] = n-i;
		rep(i,r){
			ll p,c;
			vector<ll> vv;
			cin >> p >> c;
			p--;
			rep(i,c)vv.push_back(v[p+i]);
			rep(i,n){
				if(i < p || i >= p+c)vv.push_back(v[i]);
			}
			v.clear();
			v = vv;
		}
		cout << v[0] << endl;
	}
}


Measured memory_bytes: 3088
#include<iostream>
#include<ios>
using namespace std;
template<int N>struct a{
	long ar[N+1];
	constexpr a():ar(){
		ar[0]=1;
		for(long i=1;i<=N;i++)ar[i]=ar[i-1]*i%1000000007;
	}
};
constexpr auto ans=a<100000>();
int n;
main(){
	scanf("%d",&n);
	printf("%d",ans.ar[n]);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

int main() {
    int k, a, b;
    scanf("%d %d %d", &k, &a, &b);
    bool ok = 0;
    for (int i = a; i <= b; i++)
        if (i % k == 0) ok = 1;
    if (ok) printf("OK\n");
    else printf("NG\n");
}

Measured memory_bytes: 1660
'use strict'

const Main = (input) => {
    const S = input.split('\n')[0]
    const K = Number(input.split('\n')[1])

    for(let i = 0; i < K; i++) {
        if(S[i] !== '1') {
            console.log(S[i]);
            return;
        }
    }
    console.log('1')
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long

int main() {
	int  a;
	cin >> a;
	LL sum = a + a*a + a*a*a;
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

const int INF = 100100;

int main()
{
    string S;
    cin >> S;
    int n = S.length();

    int ans = INF;
    for (int i = 0; i < 2; i++) {
        int tmp = 0;
        int k = i;
        for (int j = 0; j < n; j++) {
            if ((S[j] - '0') != k) tmp++;
            k = 1 - k;
        }
        ans = min(tmp, ans);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
//https://atcoder.jp/contests/dp/tasks/dp_a
//29-02-2020
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // #ifndef ONLINE_JUDGE
  // freopen ("input.txt", "r", stdin);
  // freopen ("output.txt", "w", stdout);
  // #endif 
  int n;  cin >> n;
  vector <int> h(n), dp(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
  } 
  dp[0] = 0;
  dp[1] = abs (h[1] - h[0]);
  for (int i = 2; i < n; ++i) {
    dp[i] = min (dp[i - 1] + abs (h[i] - h[i - 1]), dp[i - 2] + abs (h[i] - h[i - 2]));
  }
  cout << dp[n - 1] << '\n';
}

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

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

int main(){
  int i,j,k,n;

  while(1){
    int ares = 0, bres = 0;
    cin >> n; if(n == 0) break;
    while(n--){
      int a, b;
      cin >> a >> b;
      if(a == b){ares += a; bres += b;}
      if(a > b) ares += (a + b);
      if(a < b) bres += (a + b);
    }
    cout << ares << " " << bres << endl;
  }

  return 0;
}

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

int main(){

    int a,b,c;
    cin >> a >> b >> c;
    
    if(a==b) cout << c << endl;
    else if(b==c)cout << a<< endl;
    else cout << b<<endl;
    return 0;
}


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

int main(){
  int N, T;
  cin >> N >> T;
  int minc = 999999;
  for(int i = 0; i < N; i++){
    int c, t;
    cin >> c >> t;
    if(t <= T){
      minc = min(minc, c);
    }
  }
  if(minc == 999999){
    cout << "TLE" << endl;
  }
  else{
    cout << minc << endl;    
  }
}
      


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

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

int main() {
    int N;
    cin >>N;
    vector<int> height(N);
    vector<int> dp(N+10);
    for(int i=0;i<N;i++){
        cin>> height.at(i);
    }
    for(int i=0;i<N+10;i++){
        dp[i]=1<<29;
    }
    dp[0]=0;
    for(int i=1;i<N;++i){
        chmin(dp[i],dp[i-1]+abs(height.at(i)-height.at(i-1)));
        if(i>1)chmin(dp[i],dp[i-2]+abs(height.at(i)-height.at(i-2)));
    }
    cout <<dp[N-1]<<endl;



    return 0;
}

Measured memory_bytes: 1024
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c1 = 0
c2 = 0
for i in range(len(b)):
    if b[i] < a[2]:
        c1 = c1 + 1
for i in range(len(b)):
    if b[i] > a[2]:
        c2 = c2 + 1
print(min(c1, c2))

Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

int main(){
  int H, W;
  scanf("%d", &H);
  scanf("%d", &W);
  int N;
  scanf("%d", &N);
  std::vector<int > a(N);
  for (int i=0; i<N; i++){
    scanf("%d", &a[i]);
  }
  int index = 0;
  int counter = 0;
  int ans[104][104];
  for (int i=0; i<H; i++){
    if (i%2==0){
      for (int j=0; j<W; j++){
        ans[i][j]=index;
        counter++;
        if (counter==a[index]){
          index++;
          counter=0;
        }
      }
    } else {
      for (int j=W-1; j>=0; j--){
        ans[i][j]=index;
        counter++;
        if (counter==a[index]){
          index++;
          counter=0;
        }
      }
    }
  }
  
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      printf("%d%c",ans[i][j]+1,(j==W-1)?'\n':' ');
    }    
  }
  return 0;
}


Measured memory_bytes: 384
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void solve()
{
    int64_t N;
    std::cin >> N;
    std::vector<int64_t> A(N + 2);
    A[0] = 0;
    A[N + 1] = 0;
    for (int64_t i = 1; i < N + 1; i++) std::cin >> A[i];

    int64_t s = 0;
    for (int64_t i = 0; i < N + 1; i++)
    {
        s += std::abs(A[i + 1] - A[i]);
    }

    for (int64_t i = 1; i < N + 1; i++)
    {
        int64_t ans = s - (std::abs(A[i + 1] - A[i]) + std::abs(A[i] - A[i - 1])) + std::abs(A[i + 1] - A[i - 1]);
        std::cout << ans << std::endl;
    }

}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}


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

typedef long long lint;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const lint inv = MOD - 2;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

string solve(void){
    int c[5][5];
    rep(i, 3){
        rep(j, 3){
            cin >> c[i][j];
        }
    }
    int a[5] = {0}, b[5];
    rep(j, 3){
        b[j] = c[0][j];
    }
    rep(i, 3){
        a[i] = c[i][0] - b[0];
    }
    rep(i, 3){
        rep(j, 3){
            if(c[i][j] != a[i] + b[j]){
                return "No";
            }
        }
    }
    return "Yes";
}

int main(){
    string ans = solve();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"
typedef long long ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll NN;
  std::cin >> NN;

  ll A[NN];
  for (ll i = 0; i < NN; i++) {
    std::cin >> A[i];
  }

  ll B[NN];
  for (ll i = 0; i < NN; i++) {
    std::cin >> B[i];
  }

  ll sum_A=0;
  ll sum_B=0;
  for (ll i = 0; i < NN; i++) {
    sum_A+=A[i];
    sum_B+=B[i];
  }

  if (sum_B > sum_A) {
    std::cout << -1 << '\n';
    return 0;
  }

  ll count_minus = 0;
  ll value_minus = 0;
  ll count_plus = 0;
  ll values_plus[NN];

  for (ll i = 0; i < NN; i++) {
    if (A[i] >= B[i]) {
      values_plus[count_plus] = A[i] - B[i];
      count_plus++;
    }else{
      count_minus++;
      value_minus+= B[i] - A[i];
    }
  }

  std::vector<ll> v(count_plus);
  for (ll i = 0; i < count_plus; i++) {
    v[i] = values_plus[i];
  }

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

  // for (ll i = 0; i < count_plus; i++) {
  //   std::cout << v[i] << '\n';
  // }

  ll inv_sum = 0;
  ll ans = count_minus;
  for (ll i = 0; i < count_plus; i++) {
    ll inv_order = count_plus - i - 1;
    if (value_minus <= inv_sum ) {
      // std::cout << "count_minus: "<< count_minus << '\n';
      // std::cout << "inv_sum: "<< inv_sum << '\n';

      std::cout << ans << '\n';
      return 0;
    }
    // inv_sum+= v[inv_order];
    value_minus -= v[inv_order];
    ans++;
  }



  std::cout << ans << '\n';

  return 0;
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    string s;
    cin >> s;
    int x = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'x') {
            x++;
        }
    }
    cout << (x < 8 ? "YES" : "NO") << endl;
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ans, d;
  int64_t n;
  cin >> n;
  d = pow(n, 0.5);
  for (int i = d; i >= 1; i--){
    if (n % i == 0) {
      ans = i;
      break;
    }
  }
  if (ans == 1) {
    cout << n - 1 << "\n";
  } else {
    cout << ans + n/ans - 2 << "\n";
  }
}

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

int A[100001];

int main(void) {
	int N, K, Q;
	cin >> N >> K >> Q;
	for (int i = 1; i <= N; i++) A[i] = 0;
	for (int i = 1; i <= Q; i++) {
		int Ai;
		cin >> Ai;
		A[Ai]++;
	}
	for (int i = 1; i <= N; i++) {
		if ((K-Q+A[i])>0) cout << "Yes" << endl;
		else              cout << "No"  << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
module Main where

import qualified Data.Vector as V 
import qualified Data.Map as M
import Control.Monad
import qualified Data.ByteString.Char8 as BS

readint :: IO Int
readint = (read . BS.unpack) <$> BS.getLine

readvec :: IO [Int]
readvec = (fmap (read . BS.unpack) . BS.words) <$> BS.getLine

main :: IO()
main = do
  s <- BS.getLine
  let ones = BS.count '1' s
  let zeros = BS.count '0' s
  print $ 2 * min ones zeros


Measured memory_bytes: 636
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

D, T, S = MAP()

print("Yes" if S*T >= D else "No")


Measured memory_bytes: 10040
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;

    if(k>(n-1)*(n-2)/2){
        cout<<"-1\n"; return 0;
    }

    int re = (n-1)*(n-2)/2-k;

    vector<pii> res;

    m = n-1+re;

    for(int i=2;i<=n;i++)
        res.push_back(pii(1,i));

    for(int i=2;i<=n;i++)
        for(int j=i+1;j<=n;j++){
            if(re==0)break;
            res.push_back(pii(i,j));
            re--;
        }

    cout<<m<<"\n";

    for(int i=0;i<res.size();i++)
        cout<<res[i].f<<" "<<res[i].s<<"\n";

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    int N,p[100],c;
    cin  >> N;
    rep(i,N){
        cin >> p[i];
        if(p[i]!=i+1){
            c++;
        }
    }
    if(c==0 || c==2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 888
#include <iostream>

int pal(int n)
{
  int o=n;
  int rev=0;
  while(n!=0)
  {
    rev*=10;
    rev+=n%10;
    n/=10;
  }
  
  if(o==rev)
      return 1;
  else
      return 0;
}

int main()
{
  int n;
  scanf("%d",&n);
  if(pal(n))
      printf("Yes");
  
  else
     printf("No");
}

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

int main(){
  int n;cin>>n;
  int a[n];for(int i=0;i<n;i++){cin>>a[i];}
  bool flag=true;
  int coun=0;
  
  while(flag){
    flag=true;
    for(int i=0;i<n;i++){
      if(a[i]%2==0){
        a[i]=a[i]/2;
      }else{
        flag=false;
      }
    }
    ++coun;
  }
  cout<<coun-1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep_ll(i,n) for(ll i = 0; i < (ll)(n); i++)

using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;

const long double PI = (acos(-1));
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

 
int gcd(int a, int b){
    if(b == 0) return a;
 
    return gcd(b, a%b);
}
 
int main(){

   double res;
   int N, K;
 
    cin >> N >> K;
 
    vector<double> p_(N);
    double ma_= 0;
 
    for(int i = 0; i < N; i++) {
        cin >> p_.at(i);
        //cout << p_.at(i) << endl;
    }

    //res = func(0, 0, p_);
    res = 0;
    for(int i = 0; i < K; i++) {
        res += (p_.at(i)+1) / 2;
    }
    ma_ = res;
    //cout << res << endl;
    for(int i = 1; i < N-K+1; i++) {
        res += (p_.at(i+K-1)+1) / 2;
        res -= (p_.at(i-1)+1) / 2;
        //cout << p_.at(i+K-1) << " " << p_.at(i-1) << " ";
        //cout << res << endl;
        ma_ = max(ma_, res);
    } 
 
    //for(double c : ma_p_) cout << c << " "; 
 
    cout << fixed << setprecision(6) << ma_;

  
  return 0;
}

Measured memory_bytes: 1792
from itertools import product

value, variety = map(int, input().split())
coins = list(map(int, input().split()))
dp = [float("inf") for _ in range(value + 1)]
dp[0] = 0
for (c,j) in product(coins,list(range(value + 1))):
    if c <= j:
        dp[j] = min(dp[j], dp[j - c] + 1)
    else:
        dp[j] = dp[j]
print(dp[value])

Measured memory_bytes: 11760
# -*- coding: utf-8 -*-


def main():
    from collections import Counter
    import sys
    input = sys.stdin.readline

    n = int(input())
    a = list(map(int, input().split()))
    b = Counter(a)
    diff = dict()
    total = 0

    # 余事象
    for key, value in b.items():
        comb1 = value * (value - 1) // 2
        comb2 = (value - 1) * (value - 2) // 2
        total += comb1
        diff[key] = max(0, comb1 - comb2)

    ans = [0 for _ in range(n)]

    for index, ai in enumerate(a):
        ans[index] = total - diff[ai]

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 45428
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
import itertools
n=i1()
d=sorted(i2())
m=i1()
t=sorted(i2())
def a():
 j=0
 for i in range(m):
    while t[i]!=d[j]:
        if t[i]<d[j]:
            print("NO")
            return 0
        j+=1
    j+=1

 print("YES")
a()

Measured memory_bytes: 123348
#include<stdio.h>

int main(){
  int i,j,k;
  
  int N;
  
  scanf("%d",&N);
  
 int A[N];
  int dif,tmp;
  for(i=0;i<N;i++)
    scanf("%d ",&A[i]);
  
    for (i=0; i<N; ++i) {
    for (j=i+1; j<N; ++j) {
      if (A[i] > A[j]) {
        tmp =  A[i];
        A[i] = A[j];
        A[j] = tmp;
      }
    }
  }
	dif = A[N-1]-A[0];
  printf("%d\n",dif);
  return 0;
}


Measured memory_bytes: 128
N, M = map(int, input().split())
H = list(map(int, input().split()))
Hn = [0] * N
for _ in range(M):
    A, B = map(int, input().split())
    Hn[A - 1] = max(Hn[A - 1], H[B - 1])
    Hn[B - 1] = max(Hn[B - 1], H[A - 1])
print(sum([1 for n in range(N) if H[n] > Hn[n]]))


Measured memory_bytes: 20112
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int MOD = 1000000007;
int A(ll x,ll y,ll Ax){
	
	return Ax*labs(x - y);

};
int main() {
	char C;
	cin >> C;
	int a;
	a = C + 1;
	C = a;
	cout << C;




}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, m: usize, sc: [[usize; 2]; m]};

    let ten: i64 = 10;

    if m > 0 {
        if n != 1 {
            f(ten.pow((n - 1) as u32), ten.pow(n as u32), sc, n);
        } else {
            f(0, 10, sc, n);
        }
    } else {
        if n == 1 {
            println!("0");
        } else {
            println!("{}", ten.pow((n - 1) as u32))
        }
    }
}

fn f(br: i64, ur: i64, sc: Vec<Vec<usize>>, n: usize) {
    let mut is_valid = true;
    for num in br..ur {
        let mut judge = true;
        for sc_i in sc.iter() {
            let s = sc_i[0];
            let c = sc_i[1];

            let ns = num.to_string();

            if s == 1 && c == 0 && n != 1 {
                judge = false;
                break;
            }

            if &ns[s - 1..s] != c.to_string() {
                judge = false;
            }
        }

        if judge {
            println!("{}", num);
            is_valid = false;
            break;
        }
    }

    if is_valid {
        println!("-1");
    }
}


Measured memory_bytes: 2164
#include<stdio.h>
int main(void){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if((r <= x) && (r <= y) && (r <= W-x) && (r <= H-y)){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <stdio.h>
#include <algorithm>
typedef long long ll;

int main(void) {
  ll i, j, k, n, now = 0, ansa, ansb;
  scanf("%lld", &n);
  ll a[n];
  for(i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
  }
  std::sort(a, a + n);
  for(i = 0; i < n; ++i) {
    while(now != n - 2 && a[now + 1] < a[i] / 2) ++now;
    ll ta = a[i], tb = (a[now] > a[i] - a[now + 1] || now + 1 == i) ? a[now] : a[now + 1];
    ansa = ta, ansb = tb;
  }
  printf("%lld %lld\n", ansa, ansb);
  return 0;
}

Measured memory_bytes: 896
void solve();

int main() {
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
using namespace std;

string S, T;
vector<int> Sc[26];
vector<long long> dp;

void solve() {
	cin >> S >> T;
	for (int c = 0; c < 26; c++)Sc[c].resize(2 * S.size(), 0);
	for (int n = 0; n < S.size(); n++) {
		Sc[S[n] - 'a'][n]++;
		Sc[S[n] - 'a'][n + S.size()]++;
	}
	for (int c = 0; c < 26; c++) {
		for (int n = 1; n < 2 * S.size(); n++) {
			Sc[c][n] += Sc[c][n - 1];
		}
	}
	bool flag = false;
	for (int n = 0; n < T.size(); n++) {
		if (Sc[T[n] - 'a'][2 * S.size() - 1] == 0) {
			flag = true;
			break;
		}
	}
	if (flag) {
		cout << -1 << endl;
		return;
	}
	dp.resize(T.size());
	for (int n = 0; n < S.size(); n++) {
		if (Sc[T[0] - 'a'][n] == 1) {
			dp[0] = n;
			break;
		}
	}
	for (int n = 1; n < T.size(); n++) {
		int find = T[n] - 'a';
		long long olds = dp[n - 1] % S.size();
		long long s = olds, e = s + S.size();
		while (e - s > 1) {
			int m = (e + s) / 2;
			if (Sc[find][m] == Sc[find][olds])s = m;
			else e = m;
		}
		dp[n] = dp[n - 1] + e - olds;
	}
	cout << dp[T.size() - 1] + 1 << endl;
	return;
}

Measured memory_bytes: 21760
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = (1<<30);
 
int main() {
  int x,y,z;
  cin >> x >> y >> z;
  
  cout << z << " " << x << " " << y;
}

Measured memory_bytes: 3620
A, B, K = list(map(int, input().split()))

R = [A, B]

for k in range(1, K):
    if A + k >= B:
        break
    R.append(A + k)

for k in range(1, K):
    if B - k <= A:
        break
    R.append(B - k)


R = list(set(R))
R.sort()

for r in R:
    print(r)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}

template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	ll l, r, d;
	cin >> l >> r >> d;
	cout << r / d - (l - 1) / d << '\n';
}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}

int main(){
  int r;
  cin >> r;
  cout<< 3*r*r <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int X[] = 
{
0, 4, 16, 61, 230, 865, 3247, 12185, 45719, 171531, 643550, 2414454, 9058467, 33985227, 127504505, 478366600, 794717734, 733354121, 261943303, 776803305, 580025381, 51688048, 44657419, 737209731, 604119499, 159693437, 858533109, 639056669, 549054109, 996291083, 531294469, 23314687, 783022045, 855462856, 649970414, 68697295, 409213624, 604356692, 88638656, 978442997, 534833116, 763737161, 785892908, 123883652, 639213333, 181836645, 998121103, 124885216, 501575626, 39816123, 113468411, 799008836, 775465589, 256852905, 664630886, 971550783, 751629411, 51018086, 702530485, 725438992, 696683714, 792638194, 221791721, 149602322, 414054379, 986519078, 981760191, 305799096, 515140586, 406959393, 975058685, 245601370, 324759692, 673385295, 191483611, 570246669, 427196161, 781042769, 569725155, 842176273, 25328739, 847501730, 206282374, 353770801, 323137024, 371653459, 940737264, 123820509, 915711339, 847205021, 252858375, 718889563, 866398347, 738390145, 133009077, 333099663, 170591295, 329869205, 616680192, 597534442, 388130742, 242665550, 575271674, 397941849, 981474093, 155065456, 796147714, 816321026, 767518821, 652618063
};

int main()
{
int N;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;

	cout << X[ N ] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,ca=0,cc=0;
bool s = true;
cin >> a >> b >> c >> d;

while (a > 0){
    a -= d;
    ca++;
}
while (c > 0){
    c -= b;
    cc ++;
}
if (ca >= cc)
    cout << "Yes" << endl;
else 
    cout << "No" << endl;



}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	vector<long long> primecounter(n + 1, 0);
	for (int i = 1; i <= n; ++i) {
		int num = i;
		for (int j = 2; j <= n; ++j) {
			while (num % j == 0) {
				++primecounter[j];
				num /= j;
			}
		}
	}
	long long MOD = 1e9 + 7;
	long long ans = 1;
	for (int i = 0; i < primecounter.size(); ++i) {
		ans *= (primecounter[i] + 1);
		ans = ans % MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const int sz=2e5+100;
ll sum[sz];
ll ans[sz];
vector<ll> ad[sz];
void DFS(ll p,ll parent,ll last)
{
    ans[p]=sum[p]+last;
    for(auto xx: ad[p])
    {
        if(xx != parent){
            DFS(xx,p,ans[p]);
        }
    }
}
int main()
{
    Khela
    ll a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;
    while(cin>>n>>m)
    {
        for(i=0;i<=n;i++) ad[i].clear();
        for(i=1;i<n;i++){
            cin>>p>>q;
            ad[p].push_back(q);
            ad[q].push_back(p);
        }
 
        memset(sum,0,sizeof sum);
        memset(ans,0,sizeof ans);
        
        while(m--)
        {
            cin>>p>>q;
            sum[p]+=q;
        }
 
        DFS(1ll,-1,0ll);
        for(i=1;i<=n;i++) cout<<ans[i]<<" ";
        cout<<endl;
        
    }
 
 
 
 
}

Measured memory_bytes: 25856
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String c = sc.next();
        String s = "a";
        for(int i = 0; i < 301; i++){
        	if(s.equals("a")){
                if(a.isEmpty()){
                    System.out.println("A");
                    return;
                }else{
                	s = a.substring(0,1);
            		a = a.substring(1);
                }
            }else if(s.equals("b")){
            	if(b.isEmpty()){
                    System.out.println("B");
                    return;
                }else{
                	s = b.substring(0,1);
            		b = b.substring(1);
                }
            }else if(s.equals("c")){
            	if(c.isEmpty()){
                    System.out.println("C");
                    return;
                }else{
                	s = c.substring(0,1);
            		c = c.substring(1);
                }
            }
        }
    }
}

Measured memory_bytes: 35796
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int inf = 1000000009;
int i, j, k, m, n, l;
int ans;

int main() {
	//freopen("x.in", "r", stdin);
	int a, b;
	cin >> a >> b;
	if (a <= 0 && 0 <= b)cout << "Zero"; 
	else {
		if (b >= 0) b = -1;
		if (a <= b && (b - a) % 2 == 0) cout << "Negative";
		else cout << "Positive";
	}
	return 0;
}


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

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int N;
	cin >> N;
	double d = (double)((N + 1) / 2) / N;
	cout << fixed;
	cout.precision(20);
	cout << d;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rep2(r, aa, bb) for (int r = (aa)-1; r >= (bb); r--)
#define be(x) (x.begin(), x.end())
#define pb(t) push_back(t)
#define ll long long
#define mp(a, b) make_pair(a, b)
#define f first
#define s second
const int MAX=1000*100+5;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	int n;
	cin>>n;
	vector<int>A(n);
	rep(i,0,n){
		cin>>A[i];
		if(A[i]%2)continue;
		if(A[i]%3==0||A[i]%5==0)continue;
		cout<<"DENIED\n";
		return 0;
	}
	cout<<"APPROVED\n";
}


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

using namespace std;

typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	
	int N, T, t;
	cin >> N >> T;
	cin >> t;
	
	ll ans = T, end = T;

	for (int i = 1; i < N; i++) {
		cin >> t;
		if (t <= end) {
			ans = ans + T - (end - t);
		}
		else
			ans += T;
		end = t + T;
	}

	cout << ans << 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 A[]=new int[N];
		int X[]=new int[N];
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
		}
		sc.close();
		X[0]=A[N-1];
		for(int j=0;j<(N-1);j++) {
			X[0]-=A[j]*(int)Math.pow(-1, N-j);
		}
		for(int k=1;k<N;k++) {
			X[k]=2*A[k-1]-X[k-1];
		}
		for(int l=0;l<N;l++) {
			System.out.print(X[l]+" ");
		}
	}
}

Measured memory_bytes: 63132
#include<bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define MAX 100005
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef long long ll;

int main()
{
    FASTIO
   /* 
   double start_time = clock();
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
  #endif
    */
    int n,k;
    cin >> n >> k;
    vector<int> H(n);
    for(int i = 0; i < n; i++) cin >> H[i];

      vector<int> ans(n, INF);
    ans[0] = 0;
    for(int i = 0; i < n; i++){
      for(int j = 1; j <= k && (i+j) < n; j++){
      ans[i+j] = min(ans[i+j], ans[i] + abs(H[i+j] - H[i]));
    }
  }
    cout << ans[n-1]<<endl;

     //double end_time = clock();
  //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
   
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
int main(){
  int N,M;cin>>N>>M;
  vector<int>oks(N+1,true);
  for(int i=0;i<M;++i){
  int a;cin>>a;
  oks[a]=false; }
  vector<long long int>dp(N+1); dp[0]=1;


  for(int now=0;now<N;++now){
    for(int next=now+1;next<=min(N,now+2);++next){
      if(oks[next]){
        dp[next]+=dp[now];
        dp[next]%=mod;}
      }
    }
    cout<<dp[N]<<endl;
    return 0;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int first = Integer.parseInt(scan.next());
        int second = Integer.parseInt(scan.next());

        //long input = scan.nextLong();
//        String first = scan.next();
//        String second = scan.next();
        //for (int i = 1; i <=input; i++) {
        //}
        System.out.println((1+2+3)-first-second);
    }
//        int[] input = new int[5];
//        for(int i=0;i<5;i++) {
//            input[i] = Integer.parseInt(scan.next());
//        }
    //int c = Integer.parseInt(scan.next());
//        int cnt = 0;
//        while(h>0) {
//            h = h-a;
//            cnt++;
//        }
//        if(cnt*500 >= total) {
//            System.out.println("Yes");
//        } else {
//            System.out.println("No");
//        }
//        List<Integer> result = new ArrayList<Integer>();
//        for(int i=0;i<input.length; i++) {
//            for(int j=i+1;j<input.length; j++) {
//                for (int k = j+1; k<input.length; k++) {
//                    result.add(i+j+k);
//                }
//            }
//        }
//        Collections.sort(result, Collections.reverseOrder());
//        System.out.println(result.get(2));
       static int gcd (int a, int b) {
        int temp;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return b;
    }
}


Measured memory_bytes: 22612
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int lli;
const long long int MaxN=300005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	lli arr[MaxN];
	void solve(){
		lli N,lim,i,j,res=0;
		cin>>N>>lim;
		for(i=N;i<=lim;i=i+i){
			res+=1;
		}
		cout<<res;
	}
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <list>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(void)
{
    string s;

    cin >> s;

    int l = s.length();
    int m = 0;
    for (int x = 0; x < l; ++x)
    {
        bool b = true;
        for (int y = x; y < l; ++y)
        {
            if (s[y] != 'A' && s[y] != 'T' && s[y] != 'C' && s[y] != 'G')
            {
                m = max(m, y-x);
                b = false;
                break;
            }
        }
        if (b)
        {
            m = max(m, l-x);
        }
    }

    cout << m << endl;
        
    return 0;
}

Measured memory_bytes: 760
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String N = in.readLine();
		String[] tmp = N.split(" ");

		int ans = 0 ;
		int max = 0;

		for(int i=0;i<tmp.length;i++){
			int x = Integer.parseInt(tmp[i]);
			ans +=x;
			if(max < x){
				max = x;
			}
		}
		ans -= max;

		System.out.println(ans);
	}
}


Measured memory_bytes: 22992