akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc072.contest.atcoder.jp/tasks/arc072_a>
問題文============================================================
 長さ N の数列があり、i 番目の数は ai です。
 あなたは 1 回の操作でどれか 1 つの項の値を 1 だけ増やすか減らすことができます。
 
 以下の条件を満たすために必要な操作回数の最小値を求めてください。
 
 すべてのi(1≦i≦n) に対し、第 1 項から第 i 項までの和は 0 でない
 すべてのi(1≦i≦n−1) に対し、i 項までの和と i+1 項までの和の符号が異なる
=================================================================

解説=============================================================

================================================================
*/

ll calc(ll n,vector<ll>&a,ll s,ll sum){
    ll ret = s;
    
    ll S = sum;
    for(int i = 1; i < n;i++){
        if(S > 0){
            if(S + a[i] < 0){
                S += a[i];
            }else{
                ret += abs(S+a[i]) + 1;
                S = -1;
            }
        }else{
            if(S + a[i] > 0){
                S += a[i];
            }else{
                ret += abs(S+a[i]) + 1;
                S = 1;
            }
        }
    }
    return ret;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n);
    for(auto& in:a) cin >> in;
    cout << min(
                calc(n,a,a[0]>0?0:abs(a[0])+1,a[0]>0?a[0]:1),
                calc(n,a,a[0]<0?0:abs(a[0])+1,a[0]<0?a[0]:-1)
    ) << endl;
	return 0;
}


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

int main(void){
    int N;
    std::cin >> N;
    std::vector<std::vector<long long>> a(3, std::vector<long long>(N));
    std::vector<std::vector<long long>> dp(3, std::vector<long long>(N, 0));
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++) std::cin >> a[j][i];
    }
    for(int i = 0; i < 3; i++) dp[i][0] = a[i][0];
    for(int i = 1; i < N; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j == k) continue;
                dp[j][i] = std::max(dp[j][i], dp[k][i - 1] + a[j][i]);
            }
        }
    }

    long long ans = 0;
    for(int i = 0; i < 3; i++) ans = std::max(ans, dp[i][N - 1]);
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 5744
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;
ll GCD(ll x, ll y) {if (x % y == 0) return y;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x * y / GCD(x, y);}

int main(){
 ll n,ans=0,t=0; cin>>n;
  vector<ll>v(n);
  rep(i,n) cin>>v[i];
  rep(i,n-1){
  if(v[i]>=v[i+1]) t++; 
    else t=0;
      ans=max(ans,t);
  }
  cout<< ans<<endl;
  
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MAX3(a, b, c) ((a) > (MAX(b, c)) ? (a) : (MAX(b, c)))
#define MIN3(a, b, c) ((a) < (MIN(b, c)) ? (a) : (MIN(b, c)))

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    int a, b, c;
    ll x, y;
    cin >> a >> b >> c >> x >> y;
    ll cost = 0;
    cost += min(x, y) * min(a + b, 2 * c);
    if (x > y) {
        cost += min(a, 2 * c) * (x - y);
    } else {
        cost += min(b, 2 * c) * (y - x);
    }
    cout << cost << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int compare(const void *a,const void *b){
    return  *(int*) b - *(int*) a ;
}
int main()
{   
    int i,n,a[101],alice=0,bob=0;
    scanf("%d",&n);
        for(i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
    qsort(a,n,sizeof(int),compare);
    for(i=0;i<n;i++){
        if(i%2==0){
            alice+=a[i];
        }else{
            bob+=a[i];
        }
    }
    printf("%d",alice-bob);
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

ll powmod(ll x, ll n) { // like pow(x, n)
  ll r = 1;
  while (n) {
    if (n & 1) {
      r = r * x % MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return r;
}

int main(int argc, char** argv) {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) {
    cin >> S[i];
  }
  // First, we want to calculate the all distance in width and heights
  vector< vector<int> > w_blocks(H);
  vector< vector<int> > h_blocks(W);
  rep(i, H) {
    rep(j, W) {
      if (S[i][j] == '#') {
        w_blocks[i].push_back(j);
      }
    }
  }
  rep(j, W) {
    rep(i, H) {
      if (S[i][j] == '#') {
        h_blocks[j].push_back(i);
      }
    }
  }

  // For Debug
  // cout << "w_blocks" << endl;
  // rep(i, H) {
  //   cout << i << ": ";
  //   for (auto e : w_blocks[i]) {
  //     cout << e << ", ";
  //   }
  //   cout << endl;
  // }
  // cout << "h_blocks" << endl;
  // rep(i, W) {
  //   cout << i << ": ";
  //   for (auto e : h_blocks[i]) {
  //     cout << e << ", ";
  //   }
  //   cout << endl;
  // }

  // Now, each w_block and h_block is sorted.
  int ans = 0;
  rep(i, H) {
    rep(j, W) {
      if (S[i][j] == '#') { continue; }

      int w, h;
      if (w_blocks[i].size() > 0) {
        auto w_i = upper_bound(all(w_blocks[i]), j);
        if (w_i == w_blocks[i].end()) { // j is the end
          --w_i;
          w = W-1 - *w_i;
        } else if (w_i == w_blocks[i].begin()) { // j is the first
          w = *w_i;
        } else {
          int r = *w_i;
          --w_i;
          int l = *w_i;
          w = r - l - 1;
        }
      } else {
        w = W;
      }

      if (h_blocks[j].size() > 0) {
        auto h_i = upper_bound(all(h_blocks[j]), i);
        if (h_i == h_blocks[j].end()) { // j is the end
          --h_i;
          h = H-1 - *h_i;
        } else if (h_i == h_blocks[j].begin()) { // j is the fi
          h = *h_i;
        } else {
          int r = *h_i;
          --h_i;
          int l = *h_i;
          h = r - l - 1;
        }
      } else {
        h = H;
      }

      ans = max(ans, h + w - 1);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 36480
#include <iostream>
using namespace std; 
int main() {
  int n, k; 
  string s;
  cin >> n >> k >> s;
  for ( int i =0; i < n; i++) {
    if (i==k-1) {
      if (s.at(i)=='A') cout << "a";
      else if (s.at(i)=='B') cout << "b";
      else if (s.at(i)=='C') cout << "c";
    }
  else  cout << s.at(i);
  }
  cout << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

lint ruiseki_xor(lint x){
    if(x%4==0)return x;
    if(x%4==1)return 1;
    if(x%4==2)return x+1;
    if(x%4==3)return 0;
}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    lint a,b;cin>>a>>b;
    lint ans=ruiseki_xor(a-1)^ruiseki_xor(b);
    cout<<ans<<endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;
typedef unsigned long long ull;

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
using namespace std;
int tri[10][10];
int vis[10];
int main()
{
    for(int i = 1; i <= 3; i++)
    {
        for(int j = 1; j <= 3; j++)
        cin >> tri[i][j];
    }
    int sum = tri[1][1]+tri[2][2]+tri[3][3];
    bool ok = true;
    for(int i = 1; i <= 3; i++)
    {
        vis[i] = 1;
        for(int j = 1; j <=3 ; j++)
        {
            if(vis[j] == 1)continue;
            vis[j] = 1;
            for(int k = 1; k <= 3; k++)
            {
                if(vis[k] == 1)continue;
                if(tri[1][i]+tri[2][j]+tri[3][k] != sum)ok = false;
            }
            vis[j] = 0;
        }
        vis[i] = 0;
    }
    if(ok)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}
/*
                 ___====-_  _-====___
           _--^^^#####//      \\#####^^^--_
        _-^##########// (    ) \\##########^-_
       -############//  |\^^/|  \\############-
     _/############//   (@::@)   \\############\_
    /#############((     \\//     ))#############\
   -###############\\    (oo)    //###############-
  -#################\\  / VV \  //#################-
 -###################\\/      \//###################-
_#/|##########/\######(   /\   )######/\##########|\#_
|/ |#/\#/\#/\/  \#/\##\  |  |  /##/\#/  \/\#/\#/\#| \|
`  |/  V  V  `   V  \#\| |  | |/#/  V   '  V  V  \|  '
   `   `  `      `   / | |  | | \   '      '  '   '
                    (  | |  | |  )
                   __\ | |  | | /__
                  (vvv(VVV)(VVV)vvv)
                  ÁúÉñ±£ÓÓ ÓÀÎÞbug
*/


Measured memory_bytes: 256
#![allow(dead_code, unused_imports, deprecated)]
use std::cmp::{max, min, Reverse};
use std::collections::*;
use maplit::*;
use num::Integer;
use proconio::input;
use proconio::marker::*;
use proconio::fastout;

const INF : usize = 1000000007;

#[fastout]
fn main() {
  input! {
    n: usize,
  };
  
  let res = (1..=n).map(|i| n / i * i * (n / i + 1) / 2 )
    .sum::<usize>();
  println!("{}", res);
}

Measured memory_bytes: 2204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> vi;
#define endl '\n'
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define rf(i,a,b) for(int i=a;i>=b;i--) 
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define pret(x) cout<<x<<endl; return 0;
#define disp(x) cout<<x<<" ";
#define let(x,y) cout<<x<<" "<<y<<endl;
ll MOD=1e9+7;
const int maxn=2e5+5;

int ans[maxn];

int32_t main(){
    fast_io;
    int x,n;
    cin>>x>>n;
    int a[n];
    for (int i = 0; i < n; ++i)
    {
    	cin>>a[i];
    	ans[a[i]]=1;
    }
    int dist = 1000,val = -1000;
    fo(i,0,101){
    	if(ans[i]) continue;
    	if(dist > abs(i-x)){
    		dist = abs(i-x);
    		val = i;
    	}
    }
    show(val);
    return 0;
}

Measured memory_bytes: 3652
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define sum(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class BTag {
public:
  static void solve(istream &cin, ostream &cout) {
    int A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    if (W >= V) {
      cout << "NO" << endl;
    } else if (abs(A - B) <= T * (V - W)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  BTag solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
int main()
{
	int S,h,m,s;
	
        scanf("%d",&S);
	((S>=0)&&(S<86400));
	h = S/3600;
	S %= 3600;
	m = S/60;
	S %= 60;
	s = S;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}
	

Measured memory_bytes: 592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

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

		String first_line = input.readLine();

		// ??´??°n
		int num_n = Integer.parseInt(first_line);

		String secound_line = input.readLine();

		// 2???????????\???
		String[] vector_x_array = secound_line.split(" ");

		String third_line = input.readLine();

		// 3???????????\???
		String[] vector_y_array = third_line.split(" ");

		double p_first = 0;

		double p_secound_square = 0;

		double p_third_squar = 0;

		double p_secound = 0;
		
		double max=0;

		for (int array_spot = 0; array_spot < num_n; array_spot++) {

			double vector_x = Double.parseDouble(vector_x_array[array_spot]);

			double vector_y = Double.parseDouble(vector_y_array[array_spot]);

			
			
			double chebi=0;
			
			if (vector_x < vector_y) {

				double tum = vector_x;

				vector_x = vector_y;

				vector_y = tum;
			}

			chebi=vector_x - vector_y;
			
			p_first += vector_x - vector_y;
			
			if(max<chebi){
				
				max=chebi;
			}

			p_secound_square += Math.pow(vector_x - vector_y, 2);

			p_third_squar+=Math.pow(vector_x - vector_y, 3);
		}

		System.out.println(p_first);

		p_secound=Math.sqrt(p_secound_square);


		double p_third=Math.cbrt(p_third_squar);

		System.out.println(p_secound);

		System.out.println(p_third);
		
		System.out.println(max);

		
	}

}

Measured memory_bytes: 24508
from collections import Counter
def nCr(n, r):
    t = 1
    for i in range(n - r + 1, n + 1):
        t *= i
    for i in range(2, r + 1):
        t //= i
    return t

def main():
    N, A, B = map(int, input().split())
    V = list(map(int, input().split()))
    VV = Counter(V)
    m = 0
    c = 0
    for v in sorted(VV.keys(), reverse=True):
        vc = VV[v]
        if c + vc <= A:
            m += v * vc
            c += vc
            continue
        break
    else:
        print(m / c)
        print(1)
        return
    min_c = A - c
    max_c = min(B - c, vc)
    m += v * min_c
    c += min_c
    print(m / c)
    if m != c * v:
        max_c = min_c
    r = 0
    for i in range(min_c, max_c + 1):
        r += nCr(vc, i)
    print(r)

main()


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

int main(){
  int n;
  cin >> n;
  
  vector<double> x(n);
  vector<string> u(n);
  
  for(int i = 0; i < n; i++){
  	cin >> x.at(i) >> u.at(i);
  	if(u.at(i) == "BTC"){
    	x.at(i) *= 380000.0;
    }
  }
  double ans = 0;
  for(int i = 0; i < n; i++){
  	ans += x.at(i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN 110
#define MAXW 10010

int main(){
  int N, W, v[MAXN], w[MAXN], dp[MAXN][MAXW] = {};

  cin>>N>>W;

  for(int i = 1; i <= N; i++)
    cin>>v[i]>>w[i];

  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= W; j++){
      if(j < w[i]) dp[i][j] = dp[i-1][j];
      else dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
    }
  }

  cout<<dp[N][W]<<endl;
  
  return 0;
}



Measured memory_bytes: 7404
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>

#define REP(i,n) for(i=0;i<n;i++)
#define ll long long

int main(void){
    int i, N;
    int x, y;
    bool yn = 0;
    scanf("%d",&N);

    REP(x, N){
        REP(y, N){
            if (N==4*x+7*y) yn = 1;
        }
    }
    
    if (yn == 1) printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 128
// https://atcoder.jp/contests/abc048/tasks/arc064_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, X;
  cin >> N >> X;

  VL as(N);
  rep(i, N) cin >> as[i];

  ll res = 0;

  rep1(i, N - 1) {
    ll cur_sum = as[i] + as[i - 1];

    if (cur_sum > X) {
      res += cur_sum - X;

      ll later_diff = min(cur_sum - X, as[i]);
      ll former_diff = cur_sum - X - later_diff;
      as[i] -= later_diff;
      as[i - 1] -= former_diff;
    }
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

#ifndef TEST
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


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

int main(void){
    int n,k,q ;
    cin >> n >> k >> q ;
    int count[n] ;
    for (int i=0; i<n; i++){
        count[i]=0 ;
    }
    for (int i=0; i<q; i++){
        int x ;
        cin >> x ;
        count[x-1]++ ;
    }
    for (int i=0; i<n; i++){
        if (k-(q-count[i])>0){
            cout << "Yes" << endl ;
        } else {
            cout << "No" << endl ;
        }
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vlll = vector<vll>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, LIS, digitDP, treeDP, Rerooting//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA, FordFulkerson//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q, T;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vl flag, D; vector<vpll> path;

int main() {
	cin >> N;
	vl A(N);
	for (i = 0; i < N; i++) cin >> A[i];
	ll height = A[0];
	for (i = 1; i < N; i++) {
		if (height > A[i]) {
			ans += height - A[i];
		}
		else {
			height = A[i];
		}
	}
	co(ans);
}







Measured memory_bytes: 4840
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int h = scan.nextInt();
		
		int result = (a+b)*h/2;
		
		System.out.println(result);
	}

}


Measured memory_bytes: 21844
#include <stdio.h>
#define H 250
int main()
{
  int A[H],n,i,j;
  while(1)
    {
      scanf("%d",&n);
      if(n<=H)
	break;
    }
  for(i=1;i<=n;i++)
    {
      scanf("%d",&A[i]);
    }
  for(i=1;i<=n;i++)
    {
      printf("node %d: key = %d,",i,A[i]);
      if((double)i/2>=1)
	printf(" parent key = %d,",A[i/2]);
      if(i*2<=n)
	{
	  printf(" left key = %d,",A[2*i]);
	   if(i*2+1<=n)
	     printf(" right key = %d,",A[2*i+1]);
	}
	printf(" \n");
    }
  
  return 0;
}



Measured memory_bytes: 2112
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>


#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define deg_to_rad(deg) (((deg)/360)*2*M_PI)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

using namespace std;

int main()
{

  int n;
  string s;
  cin >>n;
  cin >>s;
  
  rep(i,s.length())
  {
    char si= s[i]+n;
    if(si>90)
    {
      si-=26;
    }
    cout <<si;
    
  }
return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
  int n,ans=0;
  string s;
  cin >> n;
  cin >> s;
  n = s.size();
  rep(i,n){
    if(s.substr(i,3) == "ABC") ans++; 
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

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

  vector<vector<int>> sc(M,vector<int>(2));
  for(int i=0;i<M;i++){
    cin >> sc.at(i).at(0) >> sc.at(i).at(1);
  }
  sort(sc.begin(),sc.end());

  vector<int> ans(N,0);
  vector<int> flag(N,0);
  for(int i=0;i<M;i++){
    if(N>1 && sc.at(i).at(0)==1 && sc.at(i).at(1)==0){
      cout << -1 << endl;
      return 0;
    }
    if(flag.at(sc.at(i).at(0)-1)==1){
      if(sc.at(i).at(1)!=ans.at(sc.at(i).at(0)-1)){
	cout << -1 << endl;
	return 0;
      }
    }
    ans.at(sc.at(i).at(0)-1)=sc.at(i).at(1);
    flag.at(sc.at(i).at(0)-1)=1;
  }
  int ret=0;
  if(N>1 && flag.at(0)==0){
    ret=pow(10,N-1);
  }
  for(int i=0;i<N;i++){
    if(flag.at(i)==1)
      ret += ans.at(i)*pow(10,(N-1)-i);
  }
  cout << ret << endl;

  return 0;
}


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

const int N = 2e5 + 100;

int n, q, l[N], r[N], x[N], d[N], ans[N];
vector<int> add[N], del[N];// avval add bad del
multiset<int> st;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> q;
	for (int i = 0; i < n; i++) {
		cin >> l[i] >> r[i] >> x[i];
		l[i] = max(0, l[i] - x[i]);
		r[i] = max(0, r[i] - x[i]);
	}
	for (int i = 0; i < q; i++)
		cin >> d[i];
	for (int i = 0; i < n; i++) {
		add[lower_bound(d, d + q, l[i]) - d].push_back(x[i]);
		del[lower_bound(d, d + q, r[i]) - d].push_back(x[i]);
	}
	for (int i = 0; i < q; i++) {
		for (int num: add[i])
			st.insert(num);
		for (int num: del[i])
			st.erase(st.find(num));
		ans[i] = (st.empty()? -1: *st.begin());
	}
	for (int i = 0; i < q; i++)
		cout << ans[i] << '\n';
	return 0;
}

Measured memory_bytes: 30964
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<string>
using namespace std;
#define rep2(x,from,to) for(long long x=from;x<to;x++)
#define rep(x,to) rep2(x,0,to)
long long m;
long long saiki(long long n)
{
    if(n==1)return 1;
    else return (2*saiki((long long)(n/2))+1);
}
int  main()
{
    cin>>m;
    cout<<saiki(m)<<endl;
    return 0;

}

Measured memory_bytes: 256
A, B, C, X, Y = [int(x) for x in input().split()]
ans = 0
#A, Bを1枚ずつ同時
if A + B >= 2 * C:
    c = min(X, Y)
    ans += c * 2 * C
    X -= c
    Y -= c

if 2 * C <= A:
    ans += 2 * C * X
else:
    ans += A * X

if 2 * C <= B:
    ans += 2 * C * Y
else:
    ans += B * Y

print(ans)

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

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int v = Integer.valueOf(a+b);
    int count = 0;
    for(int i=1;i<v/2;i++) {
      if(i*i == v) {
        count++;
      } 
    }
    String ans = (count>0) ? "Yes" : "No";
    System.out.println(ans);
    }
    }
  


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

int main(){
    long double n,m;
    cin>>n>>m;
    ll time=1900*m+(n-m)*100;
    long double p=pow(0.5,m);
    cout<<time/p<<endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int MX = 205;

vector<ll> gaus;

void run_gaus() {
	
	for (int bit = 61; bit >= 0; bit--) {
		
		const ll find_mask = 1LL << bit;
		const ll max_mask  = 2 * find_mask - 1;
		
		for (size_t i = 0; i < gaus.size(); i++) {
			if (gaus[i] & find_mask && gaus[i] <= max_mask) {
				
				for (size_t j = 0; j < gaus.size(); j++) {
					if (i == j) continue;
					if (gaus[j] & find_mask) gaus[j] ^= gaus[i];
				}// j
				break;
			} // if ok(i)
		} // i
	} // bit
	
	sort(gaus.begin(), gaus.end());
/*
	printf("Gaus : [\n");
	for (auto x : gaus) {
		printf("\t%lld\n", x);
	}
	printf("]\n");
*/
}

bool we_can_get(ll x) {
	static_assert(1LL << 62LL > 1e18);
	
	for (int bit = 61; bit >= 0; bit--) {
		const ll find_mask = 1LL << bit;
		if ((x & find_mask) == 0) continue;

		for (const auto& y : gaus) {
			if (y & find_mask) {
				x ^= y;
				break;
			}
		}
	}	
	
	return x == 0LL;
	
}

void solve() {
	static ll a[MX];
	static char s[MX];

	gaus.clear();
	
	int n;
	ignore = scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		ignore = scanf("%lld", &a[i]);
	}
	ignore = scanf("%s", s);

	bool fail = false;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '0') {
//			cout << "add " << a[i] << endl;
			gaus.push_back(a[i]);
			run_gaus();
		}
		else {
//			cout << "ask for " << a[i] << endl;
			if (we_can_get(a[i]) == false) {
				fail = true;
			}
		}
		
	}
	printf("%d\n", (fail ? 1 : 0));
}


int main() {
	int t;
	ignore = scanf("%d", &t);
	
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3768
using System;
using System.Linq;

class Program {
  static void Main() {
    var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int n = 100 * a[0] + 10 * a[1] + a[2];
    Console.WriteLine(n % 4 == 0 ? "YES" : "NO");
  }
}

Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, a;
  in(n);
  vector<ll> c(n);
  rep(i, n)
    in(c[i]);
  a = 0;
  sort(all(c));
  rep(i, n - 1)
    a += c[i];
  a += c[n - 1] / 2;
  out(a);
  memi;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Scanner;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public void printAdjMatrix() {
		int[][] adjMatrix = new int[totalVertex][totalVertex];
        //complete the following
        for (int i = 0; i < totalVertex; i++) {
            for (int neighbor : adjList.get(i)) {
                adjMatrix[i][neighbor] = 1;
            }
        }

        for (int i = 0; i < totalVertex; i++) {
            for (int j = 0; j < totalVertex; j++) {
                System.out.print(adjMatrix[i][j] + (j < totalVertex - 1 ? " " : ""));
            }
            System.out.println();
        }
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.printAdjMatrix();
	}
}


Measured memory_bytes: 32256
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#define INF 100000000000000
using namespace std;

typedef struct _RECT{
    long long H;
    long long W;
}RECT;

int main() {
    vector<RECT> rect_list;
    RECT rect;
    long long h, w;
    while(1){
        cin >> h >> w;
        if(h==0 && w==0){
            break;
        }
        rect.H = h;
        rect.W = w;
        rect_list.push_back(rect);
    }
    for(int i=0; i<rect_list.size(); i++){
        h = rect_list.at(i).H;
        w = rect_list.at(i).W;
        for(int j=0; j<h; j++){
            for(int k=0; k<w; k++){
                cout << "#";
            }
            cout << endl;
        }   
        cout << endl;
    }
}




Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s=="RRR")cout<<3<<endl;
    else if(s=="SRR" || s=="RRS")cout<<2<<endl;
    else if(s=="RSS" || s=="SRS" || s=="SSR" || s=="RSR")cout<<1<<endl;
    else cout<<0<<endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lint N, K;
    cin >> N >> K;
    vector<lint> A(N);
    REP(i, N) cin >> A[i];
    REP(k, K) {
      vector<lint> A2(N);
      REP(i, N) {
        A2[max(0LL, i-A[i])]++;
        if(i+A[i]+1 < N) A2[i+A[i]+1]--;
      }
      FOR(i, 1, N) {
        A2[i] += A2[i-1];
      }
      bool flg = true;
      A = A2;
      REP(i, N) {
        if(A[i] != N) {
          flg = false;
          break;
        }
      }
      if(flg) break;

    }
    REP(i, N) cout << A[i] << (i!=N-1 ? " " : "");
    cout << "\n";
}

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

int main() {
  int d,t,s;cin>>d>>t>>s;
  if((d+s-1)/s<=t)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3628
//#include <iostream>
//#include <vector>
//#include <set>
//#include <map>
//#include <algorithm>

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const ll len = 2 * (int) 1e5 + 1;


int main() {
//    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    cout << max(0, a - 2 * b);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lson (o<<1)
#define rson (o<<1|1)
#define fi first
#define sc second
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
using namespace std;
const double pi=acos(-1);
const double eps=1e-6;
inline int lowbit(int x){return x&(-x);}
inline int read(){
	int f=1,x=0;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
	return f*x;
}
template<typename T> inline T max(T x,T y,T z){return max(max(x,y),z);}
template<typename T> inline T min(T x,T y,T z){return min(min(x,y),z);}
template<typename T> inline T sqr(T x){return x*x;}
template<typename T> inline void checkmax(T &x,T y){x=max(x,y);}
template<typename T> inline void checkmin(T &x,T y){x=min(x,y);}
template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}
template<typename A,typename B,typename C> inline A fpow(A x,B p,C yql){
	A ans=1;
	for(;p;p>>=1,x=1LL*x*x%yql)if(p&1)ans=1LL*x*ans%yql;
	return ans;
}
struct FastIO{
	static const int S=1310720;
	int wpos;char wbuf[S];
	FastIO():wpos(0){}
	inline int xchar(){
		static char buf[S];
		static int len=0,pos=0;
		if(pos==len)pos=0,len=fread(buf,1,S,stdin);
		if(pos==len)return -1;
		return buf[pos++];
	}
	inline int read(){
		int c=xchar(),x=0;
		while(c<=32&&~c)c=xchar();
		if(c==-1)return -1;
		for(;'0'<=c&&c<='9';c=xchar())x=x*10+c-'0';
		return x;
	}
}io;
//#define read io.read
int main()
{
	string s;
	int sum=0,maxv=0;
	cin >> s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G')
		{
			sum++;
		}
		else
		{
			sum=0;
		}
      	maxv=max(sum,maxv);
	}
	cout << maxv;
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 練習１
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ');
            var lines = new decimal[2];
            for (var i = 0; i < line.Length; i++)
            {
              lines[i] = decimal.Parse(line[i]);
            }
            
            var count = lines[0] * lines[1];
            var counts = Math.Ceiling(count/2);
            if ((lines[0] == 1) || (lines[1] == 1))
                counts = 1;

            Console.WriteLine(counts);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <string>
using namespace std;
string s, t;
vector<vector<pair<int,int> > > parent; 
void print(pair<int,int> p, int cnt){
    if(cnt){
	print(parent[p.first][p.second], cnt-1);
	cout<<s.at(p.first);
    }
}
int main(){
    cin>>s>>t;
    int N = s.size(); int M = t.size();
    parent.assign(N+1, vector<pair<int,int> >(M+1, make_pair(0,0)));
    vector<vector<int> > dp(N+1, vector<int>(M+1, 0));
    for(int i = 1; i <= N; i++){
	for(int j = 1; j <= M; j++){
	    if(s.at(i-1)==t.at(j-1)){
		dp[i][j] = dp[i-1][j-1] + 1;
		parent[i][j] = make_pair(i-1,j-1);
	    }else{
		if(dp[i][j-1] > dp[i-1][j]){
		    dp[i][j] = dp[i][j-1];
		    parent[i][j] = parent[i][j-1];
		}else{
		    dp[i][j] = dp[i-1][j];
		    parent[i][j] = parent[i-1][j];
		}
	    }
	}
    }
    // cout<<dp[N][M]<<endl;
    pair<int,int> p = parent[N][M];    
    // find some way to print!
    print(p, dp[N][M]);
}


Measured memory_bytes: 106112
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (n); ++i)

int main () {
  int N, K;
  std::cin >> N >> K;
  std::vector<int> p(N, 0);
  REP(i, N) std::cin >> p[i];
  std::sort(p.begin(), p.end());
  int result = 0;
  REP(j, K) result = result + p[j];
  std::cout << result << std::endl;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<double> v(N);
  rep(i,N)
  {
    cin >> v[i];
  }
  sort(ALL(v));
  rep(i,N-1)
  {
    v[i+1] = (v[i]+v[i+1])/2;
  }
  cout << v[N-1] << endl;
  return 0;
}


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

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

Measured memory_bytes: 256
/// author: Mr.Hakimov
 
#include <bits/stdc++.h>
#include <chrono>
 
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define Pb pop_back
#define Pf pop_front
#define all(x) (x).begin(), (x).end()
#define fin(s) freopen(s, "r", stdin);
#define fout(s) freopen(s, "w", stdout);
 
/* Just some advices:
1. If I use set/multiset, I will check it - is it correct to use set/multiset in a problem?
2. If I can't solve problem, I must write a program, which could help me to understand it much more better)
...
*/
 
using namespace std;
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
typedef long long LL;
typedef long double LD;
 
int TN = 1;
 
void solve() {
	int n;
	cin >> n;
	string s;
	cin >> s;

	vector<set<int>> vs(26);
	
	for (int i = 0; i < n; ++i) {
		vs[s[i] - 'a'].insert(i + 1);
	}
	
	int q;
	cin >> q;
	for (int i = 0; i < q; ++i) {
		int tp;
		cin >> tp;
		if (tp == 1) {
			int pos;
			string c;
			cin >> pos >> c;
			vs[s[pos - 1] - 'a'].erase(pos);
			vs[c[0] - 'a'].insert(pos);
			s[pos - 1] = c[0];
		} else if (tp == 2) {
			int l;
			int r;
			cin >> l >> r;
			
			int answer = 0;
			for (int j = 0; j < 26; ++j) {
				if (vs[j].empty()) {
					continue;
				}
				auto it = vs[j].lower_bound(l);
				// auto it = vs[j].begin();
				// cout << *it << endl;
				if (it != vs[j].end() && l <= *it && *it <= r) {
					++answer;
				}
			}
			
			cout << answer << endl;
		}
	}
}
 
int main() {
    auto start = chrono::steady_clock::now();
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    /// =========================================
    /// fin("input.txt"); fout("output.txt");
    /// fin("file.in"); fout("file.out");
    /// cin >> TN;
    /// =========================================
    while (TN--) solve();
    auto finish = chrono::steady_clock::now();
    auto elapsed_ms = chrono::duration_cast<chrono::milliseconds>(finish - start);
    cerr << endl << "Time: " << elapsed_ms.count() << " ms\n";
    return 0;
}


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

int main() {
  int A, B, C, D;
  cin>>A>>B>>C>>D;
  if(C>=A){
        if(C>B){
            cout<<0<<endl;
        }
        else if(B<D){
            cout<<B-C<<endl;
        }
        else if(B>=D){
            cout<<D-C<<endl;
        }
    }
    else{
        if(D<A){
            cout<<0<<endl;
        }
        else if(B>=D){
            cout<<D-A<<endl;
        }
        else if(B<D){
            cout<<B-A<<endl;
        }
    } 
}

Measured memory_bytes: 256
num = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for x in range(num):
    strval = input()
    if strval == "AC": ac += 1
    elif strval == "WA": wa += 1
    elif strval == "TLE": tle += 1
    elif strval == "RE": re += 1

print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))


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

using namespace std;

template <typename T>
using vec1 = vector<T>;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

template <typename T>
vec1<T> cin2vec(size_t size)
{
    vec1<T> vec1(size);
    for (auto& v : vec1) {
        v = cin2var<T>();
    }
    return vec1;
}

void sub()
{
    const auto N(cin2var<size_t>());
    const auto As(cin2vec<size_t>(N));

    map<size_t, size_t> map_ans;
    for (size_t i = 0; i < N; ++i) {
        map_ans[As[i]] = i + 1;
    }
    bool first = true;
    for (const auto& ans : map_ans) {
        if (!first) cout << ' '; first = false;
        cout << ans.second;
    }
    cout << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    sub();
    return 0;
}


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

int main(void)
{
  long long n, m, k;
  cin>>n>>m>>k;
  for(long long i=0; i<=n; i++) {
    for(long long j=0; j<=m; j++) {
      if(k==j*n+i*m-2*i*j) {
	cout<<"Yes"<<endl;	
	return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define RST(a) memset(a, 0, sizeof(a))
#define RSTV(a, v) memset(a, v, sizeof(a))
#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
const int INF = 0x3f3f3f3f;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (b - a >= 2019) {
    cout << 0;
    return 0;
  }
  a = a % 2019;
  b = b % 2019;
  if (a >= b) b += 2019;
  int M = 2018;
  FOR(i, a, b + 1) FOR(j, i + 1, b + 1) M = min(M, i * j % 2019);
  cout << M;
}

Measured memory_bytes: 256
#include <stdio.h>

#include <string.h>

int input[1001];

    

int q_sort(int start, int end){

	if(end == start) return 0; 	else{ 

		int p = start;

		for(int i = (start + 1); i < end + 1; i++){ 

			if(input[i] < input[p]){ 

				int temp = input[i]; 

				memmove(input + start + 1, input + start, (i - start)*sizeof(int));

				input[start] = temp;

				p++; 

			}

		}

		if(start != p) q_sort(start,p-1);

		if(end != p) q_sort(p+1,end); 

		return 0;

	}

}

int main(){

	int a, b, c, d;

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

	c = 0;

	for(int i = 0; i < a; i++){

		scanf("%d", &input[i]);

	}

	q_sort(0,a-1);

	for(int i = 0; i < b; i++){

		c = c + input[i];

	}

	printf("%d",c);

	return 0;

}

Measured memory_bytes: 1708
import java.util.Scanner;

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

        while(sc.hasNext()){
            int n = sc.nextInt();
            int x = sc.nextInt();
            int count=0;

            if (n==0&&x==0)
                break;

            for (int i=1; i<=n; i++){
                for (int j=i+1; j<=n; j++){
                    for (int k=j+1; k<=n; k++){
                        if (i+j+k==x)
                            count++;
                    }
                }
            }
            System.out.println(count);
        }

    }
}



Measured memory_bytes: 26632
import heapq
 
x, y, z, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
 
n = []
heapq.heapify(n)
heapq.heappush(n, (-(a[0]+b[0] + c[0]), 0,0,0))
for i in range(K):
    (m, j, k, l) = heapq.heappop(n)
    print(-m)
    if j + 1 <=x-1:
        s = (-(a[j+1]+b[k]+c[l]), j+1, k, l)
        if s not in n:
            heapq.heappush(n ,s)
 
    if k + 1 <=y-1:
        s = (-(a[j]+b[k+1]+c[l]), j, k+1, l)
        if s not in n:
            heapq.heappush(n ,s)
    
    if l+ 1 <=z-1:
        s = (-(a[j]+b[k]+c[l+1]), j, k, l+1)
        if s not in n:
            heapq.heappush(n ,s)

Measured memory_bytes: 55000
import java.util.*;
import java.lang.*;

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

        for(int i = 0; i  < N; i++){
          h[i] = sc.nextInt();
        }

        int n = 0;

        for(int i = 0; i  < N; i++){
            if(h[i] >= K){
                n++;
            }
          }
        System.out.println(n);



    }
}







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

int main() {
	int a, b;
	char c;
	int l[100];
	for (int i = 0;; i++) {
		cin >> a >> c >> b;
		if (c == '+') {
			l[i] = a + b;
		}else if (c == '-') {
			l[i] = a - b;
		}else if (c == '*'){
			l[i] = a * b;
		}else if (c=='/'){
			l[i] = a / b;
		}else if (c=='?'){
			for (int j = 0; j < i; j++){
				cout << l[j] << endl;
			}
			break;
		}
	}
}



Measured memory_bytes: 3096
n, k = map(int,input().split())

if (n - 2) * (n - 1) // 2 < k:
    print(-1)
    exit()

ans = []
for i in range(n - 1):
    ans.append((1, i + 2))

cnt = (n - 1) * (n - 2) // 2 - k
for i in range(2, n):
    for j in range(i + 1, n + 1):
        if cnt == 0:break
        ans.append((i, j))
        cnt -= 1
    if cnt == 0:break

print(len(ans))
for i in ans:
    print(*i)

Measured memory_bytes: 3992
import java.io.PrintWriter
import java.util.*
import java.math.*

val pw = PrintWriter(System.out)

fun main(args: Array<String>) {
    val (t, x) = readListOfDouble()

    println((t / x).format(10))
    pw.flush()
}

fun inputList() = 
    readLine()!!.split(" ").map(String::toInt)

fun sum_digits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

/****** Decrared Functions ******/

// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = java.lang.String.format("%.${digits}f", this)


fun println(value : Any) {
    pw.println(value)
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)


Measured memory_bytes: 38004
N = int(input())
alines = input().split(' ')
#num = [int(x) for x in alines]
num = list(map(int, alines))
c = -1

while 0 not in num:
	c += 1
	num = list(map(lambda x: x/2 if x%2 == 0 else 0, num))

print(c)

Measured memory_bytes: 3060