akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = 1LL<<60;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    rep(i,0,n) cin >> a[i];
    ll ans = 0;
    map<ll,ll> m;
    m[-a[0]-1]++;
    rep(i,1,n){
        ans += m[a[i]-i-1];
        m[-a[i]-i-1]++;
    }
    cout << ans << endl;
} 

Measured memory_bytes: 27428
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define pob pop_back
#define MP make_pair
#define MT make_tuple
#define rep(i,a,b) for(int i=a;i<b;i++)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define rept(it,v) for(auto it=v.begin();it!=v.end();it++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define endl "\n"
#define ct continue
ll mod=1e9+7;
ll abs(ll a)
{
	if(a<0)
		return -1*a;
	return a;
}

ll bin(ll a, ll b, ll mod)
{
	if(b==0)
	return 1;
	if(b&1)
		return (a*bin((a*a)%mod,b/2,mod))%mod;
	return (1*bin((a*a)%mod,b/2,mod))%mod;
}

void I_m_Beast()
{
	int n;
	cin>>n;
	int H[n+1];
	rep(i,1,n+1)
		cin>>H[i];
	ll dp[n+1];
	rep(i,0,n)
		dp[i]=1e12;
	dp[1]=0;
	rep(i,1,n+1)
	{
		if(i+1<=n)
		{
			dp[i+1]=min(dp[i+1],dp[i]+abs(H[i+1]-H[i]));
		}
		if(i+2<=n)
		{
			dp[i+2]=min(dp[i+2],dp[i]+abs(H[i+2]-H[i]));
		}
	}
	cout<<dp[n]<<endl;
	
	
}

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

Measured memory_bytes: 4760
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.*;
public class Main {
	static int INF = (int)1e9 + 7;
	int N,W;
	int[] v,w;
	int[][] dp;
	
	public void solve() {
		N = nextInt();
		W = nextInt();
		v = new int[N];
		w = new int[N];
		dp = new int[N + 1][W + 1];
		for(int i = 0;i < N;i++){
			v[i] = nextInt();
			w[i] = nextInt();
		}
		int ans = 0;
		for(int i = 1;i <= N;i++){
			for(int j = 0;j <= W;j++){
				if(j + w[i - 1] <= W){
					dp[i][j + w[i - 1]] = Math.max(dp[i][j + w[i - 1]],dp[i - 1][j] + v[i - 1]);
					dp[i - 1][j + w[i - 1]] = Math.max(dp[i - 1][j + w[i - 1]],dp[i - 1][j] + v[i - 1]);
				}
				dp[i][j] = Math.max(dp[i][j],dp[i - 1][j]);
				ans = Math.max(ans,dp[i][j]);
			}
		}
		out.println(ans);
	}
 
	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}
 
	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;
 
	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}
 
	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}
 
	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}
 
	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}
 
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}
 
	public int nextInt() {
		return Integer.parseInt(next());
	}
 
	public long nextLong() {
		return Long.parseLong(next());
	}
 
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 29364
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll powmod(ll a, ll b, const ll mod = 1e9+7) {
    a %= mod;
    ll res = 1;
    while (b > 0) {
        if (b % 2 == 1)res = res * a % mod;
        a = a * a % mod;
        b /= 2;
    }
    return res;
}


vector<ll> f;
void cominit(ll n = 210000, const ll mod = 1e9+7) {
    f.resize(n + 1);
    f[0] = 1;
    REP(i, n)f[i + 1] = f[i] * (i + 1) % mod;
}

ll nCr(ll n, ll r, const ll mod = 1e9+7) {
    if (n < r)return 0;
    if (n < 0 or r < 0)return 0;
    return f[n] * powmod(f[r] * f[n - r], mod - 2, mod) % mod;
}

ll nPr(ll n, ll r, const ll mod = 1e9+7) {
    if (n < r)return 0;
    if (n < 0 or r < 0)return 0;
    return f[n] * powmod(f[n - r], mod - 2, mod) % mod;
}

ll nHr(ll n, ll r, const ll mod = 1e9+7) {
    if (n < r)return 0;
    if (n < 0 or r < 0)return 0;
    return nCr(n + r - 1, r, mod);
}

ll k, ans;
string s;
int main() {
    cominit(2100000);
    cin >> k >> s;
    ll sz = s.size();
    ll n = k + sz;
    ans = powmod(26, n);
    REP(i, sz){
        ans -= nCr(n, i) * powmod(25, n - i) % MOD;
        ans = (ans + MOD * 2) % MOD;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 21732
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a,b,e,f;
  cin>>a>>b;
  vector<pair<int,int>> c(b),d(a);
  fo(i,a){
    d[i].fi=1;
    d[i].se=0;
  }
  fo(i,b){
    cin>>c[i].fi>>c[i].se;
    c[i].fi--;
    c[i].se--;
  }
  d[0].se=1;
  fo(i,b){
    e=c[i].fi;
    f=c[i].se;
    if(d[e].se==1){
      d[f].fi++;
      d[f].se=1;
      d[e].fi--;
      if(d[e].fi==0)
        d[e].se=0;
    }
    else{
      d[e].fi--;
      d[f].fi++;
    }
  }
  int g=0;
  fo(i,a){
    if(d[i].se==1)
      g++;
  }
  cout<<g<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
  int a,b,c;
  int d,e;
  scanf("%d%d%d",&a,&b,&c);
  if(a>b){
    d=a;
    a=b;
    b=d;
  }
  if(b>c){
    e=b;
    b=c;
    c=e;
    if(a>b){
    d=a;
    a=b;
    b=d;
  }
  }
 
  printf("%d %d %d\n",a,b,c);
  return 0;
}


Measured memory_bytes: 2100
import sys
from collections import Counter
from math import gcd

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

N = INT()
K = 10**9
L = 10**18
A = [0] * N
C = Counter()
for i in range(N):
    a = float(input())
    # ここint()だと切り捨てでバグる
    A[i] = round(a * K)
    C[gcd(A[i], L)] += 1

ans = 0
for k1, v1 in C.items():
    for k2, v2 in C.items():
        if k1 == k2:
            if k1*k2 % L == 0:
                ans += v1*(v1-1) // 2
        elif k1 < k2:
            if k1*k2 % L == 0:
                ans += v1 * v2
print(ans)


Measured memory_bytes: 71072
import java.util.Scanner;

/**
 * B
 */
public class Main {

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

        int n = sc.nextInt();
        int k = sc.nextInt();

        int result = k;
        for (int i = 1; i < n; i++) {
            result *= k - 1;
        }

        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <climits>
#include <vector>
#include <numeric>
#include <complex>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
using namespace std;

#define __int64 long long
#define long __int64
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
const int Vec = 4;
const int Vecy[Vec] = {0,-1,0,1};
const int Vecx[Vec] = {1,0,-1,0};
const int Modd = 1000000007;

int result[11];

int main(){
    int r, D;

    cin >> r >> D >> result[0];

    for(int i=1; i<=10; i++){
        result[i] = r * result[i-1] - D;
    }

    for(int i=1; i<=10; i++){
        cout << result[i] << endl;
    }
}

Measured memory_bytes: 256
#![allow(dead_code)]
use std::io;

fn main() {
    solve_a();
}

fn solve_a() {
    let mut w = String::new();
    io::stdin().read_line(&mut w).unwrap();
    let w = w.trim();
    let mut count = 0;
    loop {
        let mut line = String::new();
        io::stdin().read_line(&mut line).unwrap();
        let line: Vec<&str> = line.trim().split_whitespace().map(|s| s).collect();

        let mut end = false;
        for l in line {
            if l == "END_OF_TEXT" {
                end = true;
                break;
            } else {
                let x = l.to_lowercase();
                let x = x.as_str();
                if x == w {
                    count += 1;
                }
            }
        }
        if end {
            break;
        }
    }
    println!("{}", count);
}



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

void out()
{
	puts("No");
	exit(0);
}
#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=500+5;
int cnt[N],px[N],q[N],a[N*N];
bool x_xiao(int a,int b)
{
	return px[a]<px[b];
}

int main()
{
	//freopen("1.in","r",stdin);
	int n;
	cin>>n;
	rep(i,1,n)cin>>px[i];
	rep(i,1,n)q[i]=i;
	sort(q+1,q+n+1,x_xiao);
	rep(i,1,n)cnt[i]=q[i]-1;
	int j1=1,j2=1,j3=1;//[j2,n]>i,[1,j1)solved,[j2,j3)solved
	rep(i,1,n*n)
	if(px[q[j2]]==i)
	{
		if(cnt[j2])out();
		a[i]=q[j2];
		cnt[j2]=n-q[j2];
		++j2;
		if(j3<j2)j3=j2;
	}
	else
	{
		while(!cnt[j3]&&j3<=n)++j3;
		if(j3<=n)
		{
			a[i]=q[j3];
			--cnt[j3];
			continue;
		}
		while(!cnt[j1]&&j1<=n)++j1;
		if(j1>n)out();
		a[i]=q[j1];
		--cnt[j1];
	}
	puts("Yes");
	rep(i,1,n*n)printf("%d ",a[i]);
}

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

int main()
{
  long long a, b;
  cin >> a;
  long long m = 1;
  for (ll i = 2; i*i <= a; i++)
  {
    if (a % i == 0) m = i;
  }
  cout << m + a / m -2 << '\n';
}


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

void solve(int a,int b, int c){
	a*=a; b*=b; c*=c;
	if(a+b==c) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

int main() {
	int a,b,c,N;
	cin>>N;
	for(;N>0;N--){
		cin>>a>>b>>c;
		if(a<c && b<c) solve(a,b,c);
		else if(a<b && c<b) solve(a,c,b);
		else solve(b,c,a);
	}
	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<cmath>
#include<bitset>
#include<cstdio>

#define PII pair<int,int>
#define LLI long long int

using namespace std;

int main(){
	int N,M;cin>>N>>M;
	priority_queue<int>A;
	for(int i=0;i<N;i++){
		int tmp;cin>>tmp;
		A.push(tmp);
	}
	while(M--){
		int tmp=A.top();A.pop();
		A.push(tmp/2);
	}
	LLI ans=0;
	while(!A.empty()){
		int tmp=A.top();A.pop();
		ans+=tmp;
	}
	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
//typedef pair<ll,ll> P;

ll N,A,B,C,D;
ll P[1010][1010];
ll dp[1010][1010];
ll kaijo[1010];
ll i_kaijo[1010];

ll pow(ll x , ll n){
  ll ret = 1;
  while(n>0){
    if(n & 1){
      ret = (ret * x) % MOD;
    }
    x = (x*x) % MOD;
    n >>= 1;
  }
  return ret;
}
int main(){
  cin >> N >> A >> B >> C >> D;
  rep(i,N+1){
    rep(j,i+1){
      if(i==0){
        P[i][j] = 1;
      }
      else if(j == 0){
        P[i][j] = 1;
      }
      else{
        P[i][j] = (P[i][j-1] * (i-j+1)) % MOD; 
      }
      //cout << P[i][j] << " ";
    }
    //cout << endl;
  }
  kaijo[0] = 1;
  i_kaijo[0] = 1;
  rep(i,N){
    kaijo[i+1] = (kaijo[i]*(i+1)) % MOD;
    i_kaijo[i+1] = pow(kaijo[i+1],MOD-2);
    //cout << kaijo[i+1] << " " << i_kaijo[i+1] << endl;
  }
  rep(i,A){
    dp[i][0] = 1;
  }

  for(ll i=A;i<=B;i++){
    for(ll j=0;j<=N;j++){
      for(ll k=0;k<=D;k++){
        if(k>0 && k<C) continue;
        if(j-i*k < 0) break;
        ll tmp = (dp[i-1][j-i*k]*P[N-j+i*k][i*k])%MOD;
        tmp = (tmp*pow(i_kaijo[i],k)) %MOD;
        tmp = (tmp*i_kaijo[k]) % MOD;
        dp[i][j] = (dp[i][j]+tmp)%MOD;
      }
      //cout << dp[i][j] << " ";
    }
    //cout << endl;
  }
  cout << dp[B][N] << endl;
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

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

    ll cnt = 0;
    rep(i,n){
        for(int j=i+1; j<n; j++){
            for(int k=j+1; k<n; k++){
                if(l[i] != l[j] && l[i] != l[k] && l[k] != l[j]){
                    vector<int> sl;
                    sl.push_back(l[i]);
                    sl.push_back(l[j]);
                    sl.push_back(l[k]);
                    sort(sl.begin(), sl.end());
                    if(sl[2] < sl[0]+sl[1]){
                        cnt++;
                    }
                }
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3644
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;
use smallvec::alloc::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
    n: usize,
    mut a: [usize; n]
    }
    a.sort();
    a.reverse();
    let mut q = BinaryHeap::new();
    q.push(a[0]);
    let mut ans = 0;
    for i in 1..n {
        let k = q.pop().unwrap();
        ans += k;
        q.push(a[i]);
        q.push(a[i]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 7796
#include <bits/stdc++.h>
#include <iomanip>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  int xy[N][2];
  for(int i = 0; i < N; i++){
    cin >> xy[i][0] >> xy[i][1];
  }
  double dis = 0;
  for(int i = 0; i < N-1; i++){
    for(int j = i+1; j < N; j++){
      dis += sqrt((xy[i][0] - xy[j][0]) * (xy[i][0] - xy[j][0]) + (xy[i][1] - xy[j][1]) * (xy[i][1] - xy[j][1]));
    }
  }
  dis = 2 * dis / ((N-1) * N);
  printf("%.9f\n",dis * (N-1));
}


Measured memory_bytes: 256
##
## python3
##

N = input()
X, Y, Z = N.split()

Xh = int(X, 10)
Yh = int(Y, 10)
Zh = int(Z, 10)

sum = 0

for i in range(1, Xh):
    if (Yh+Zh)*i+Zh <= Xh:
        sum += 1
    else:
        break

print(sum)

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

ll count(string s){
    ll countx = 0;
    ll ans = 0;
    for(int i=s.size();i>=0;i--){
        if(s[i]=='X')countx++;
        if(s[i]=='A')ans+=countx;
    }

    return ans;
}


int main() {
    string s;
    cin >> s;

    int seqabc=0;
    char prev = 'z';
    int countbc = 0;
    ll ans=0;
    string tmps = "";

    for(int i=0;i<s.size();i++){
        if( (s[i]=='A'&&prev=='B') || (s[i]=='B'&&prev=='B') || (s[i]=='C'&&prev!='B')  ){
            ans += count(tmps);
            tmps ="";
        }

        if(s[i]=='A')tmps+='A';
        if(s[i]=='C'&&prev=='B')tmps+='X';
        prev = s[i];
    }

    ans += count(tmps);

    cout << ans << endl;



}



Measured memory_bytes: 904
def gcd(a, b):
    while b: a, b = b, a % b
    return a
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2, 7, 61] if n < 1<<32 else [2, 3, 5, 7, 11, 13, 17] if n < 1<<48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = y * y % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1
def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n // g): return n // g
            return findFactorRho(g)
def primeFactor(n):
    i = 2
    ret = {}
    rhoFlg = 0
    while i * i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += i % 2 + (3 if i % 3 == 1 else 1)
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k

    if n > 1: ret[n] = 1
    if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}
    return ret
def divisors(N):
    pf = primeFactor(N)
    ret = [1]
    for p in pf:
        ret_prev = ret
        ret = []
        for i in range(pf[p]+1):
            for r in ret_prev:
                ret.append(r * (p ** i))
    return sorted(ret)
def calc(n, k):
    if n % k == 0:
        return n // k
    return n % k
def chk(n, k):
    while n >= k:
        n = calc(n, k)
    return 1 if n == 1 else 0

N = int(input())
L = list(set(divisors(N) + divisors(N-1)))
print(len([l for l in L if l > 1 and chk(N, l)]))

Measured memory_bytes: 4048
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

struct node{
	vi c;
	vi c_sz;
	ll sz;
	node(){sz = 1e9;};
};

vector<node> ns;

ll f(int n){
	if(ns[n].sz != 1e9) return ns[n].sz;
	if(ns[n].c.size() == 0) return ns[n].sz = 0LL;
	ns[n].c_sz.resize(ns[n].c.size());
	rep(i, ns[n].c.size()) ns[n].c_sz[i] = f(ns[n].c[i]);
	sort(rall(ns[n].c_sz));
	ll ret = 0LL;
	rep(i, ns[n].c_sz.size()) ret = max(ret, (ll)ns[n].c_sz[i] + i+1);
	return ns[n].sz = ret;
}

int main(){
	int n;
	cin>>n;
	vi a(n-1);
	rep(i, n-1) cin>>a[i];
	ns.resize(n);
	rep(i, n-1){
		ns[a[i]-1].c.pb(i+1);
	}
	cout<<f(0)<<endl;
	// rep(i, n) {
	// 	cout<<" "<<i<<" : ";
	// 	rep(j, ns[i].c.size()) cout<<" "<<ns[i].c[j];
	// 	cout<<endl;
	// 	cout<<"  -> " << ns[i].sz<<endl;
	// }
}

Measured memory_bytes: 20224
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
	for(int i=1;i<10;i++)
	{
		for(int j=1;j<10;j++)
		{
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	return 0;
}

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

void Main()
{
    int k;
    cin >> k;
    long x = 7;
    for (int i = 0; i < 1000000; i++)
    {
        if(x % k == 0){
            cout << i+1 << endl;
            return;
        }
        x = (x*10 + 7) % k;
    }
    
    cout << -1 << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3648
N, K = map(int, input().split())
ans = 0
for i in range(1, N + 1):
    # i * 2^n >= K
    cnt = 0
    p = i
    for j in range(100000):
        if p >= K:
            cnt = j
            break
        p *= 2

    ans += 1/N * 1/pow(2, cnt)

print("{:.10f}".format(ans))


Measured memory_bytes: 2940
x = input()
N = int(x)
L = list(map(int,input().split()))
count = 0


for i in range(N-2):
    for j in range(i+1,N-1):
        if L[i] != L[j]:
            for k in range(j+1,N):
                if (L[i] != L[k]) and (L[j] != L[k]) and (L[i] + L[j] > L[k]) and (L[j] + L[k] > L[i]) and (L[k] + L[i] > L[j]):
                    count = count + 1

print(count)

Measured memory_bytes: 8976
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(int i=a; i<n; i++)
#define loop(i,a,n)	for(int i=a; i>=n; i--)

int main() 
{	
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	int a[3][3],b[3][3]={};
	forr(i,0,3)
	{
		forr(j,0,3)
		{
			cin>>a[i][j];
		}
	}
	int n;
	cin>>n;
	forr(i,0,n)
	{
		int x;
		cin>>x;
		forr(j,0,3)
		{
			forr(k,0,3)
			{
				if(a[j][k]==x)
				{
					b[j][k]=1; break;
				}
			}
		}
	}
	if((b[0][0]==1 and b[1][1]==1 and b[2][2]==1 )or(b[0][0]==1 and b[0][1]==1 and b[0][2]==1) or(b[1][0]==1 and b[1][1]==1 and b[1][2]==1)or(b[2][0]==1 and b[2][1]==1 and b[2][2]==1)or(b[0][0]==1 and b[1][0]==1 and b[2][0]==1)or(b[0][1]==1 and b[1][1]==1 and b[2][1]==1)or(b[0][2]==1 and b[1][2]==1 and b[2][2]==1) or(b[0][2]==1 and b[1][1]==1 and b[2][0]==1))	cout<<"Yes";
	else cout<<"No";
	
	
	
	return 0;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast()              ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define input()             freopen("G:/daily practise/in0.txt","r",stdin)
#define output()            freopen("G:/daily practise/out0.txt","w",stdout)
int main()
{
	fast();
	set<ll> st={1,2,3,4,5,6,7,8,9};
	std::vector<ll> v;
	std::map<ll, bool> mp;
	while(!st.empty())
	{
		ll f=*st.begin();
		mp[f]=1;
		st.erase(st.begin());
		v.push_back(f);
		ll tmp=f*10*1LL+f%10;
		if(mp.count(tmp)==0) st.insert(tmp);
		if(mp.count(tmp+1)==0&&tmp%10!=9) st.insert(tmp+1);
		if(mp.count(tmp-1)==0&&tmp%10!=0) st.insert(tmp-1);
		if(v.size()>1e5) break;
	}
	ll k;
	cin>>k;
	cout<<v[k-1]<<endl;
}

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

ll mod = 1e9+7;

int main(){
    int N, M;
    cin >> N >> M;
    vector<ll> S(N+1, 0), T(M+1, 0);
    for (int i = 1; i <= N; i++) cin >> S[i];
    for (int i = 1; i <= M; i++) cin >> T[i];
    vector<vector<ll>> dp(N+1, vector<ll>(M+1, 0));
    for (int i = 0; i <= N; i++) dp[i][0] = 1;
    for (int j = 0; j <= M; j++) dp[0][j] = 1;
    //dp[i][j] = #{S[1..i]の部分列とT[1..j]の部分列で一致するものの総数}
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            dp[i][j] = dp[i][j-1] + dp[i-1][j] - dp[i-1][j-1];
            if (S[i] == T[j]) dp[i][j] += dp[i-1][j-1];
            dp[i][j] = (dp[i][j] + mod) % mod;
            //cout << i << j << " " << dp[i][j] << endl;
        }
    }
    cout << dp[N][M] << endl;
    return 0;
}

Measured memory_bytes: 31616
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main(){
	char pic[128][128];
	int H,W;

	scanf("%d %d",&H,&W);

	for(int i=0;i<=H+1;i++){
		for(int j=0;j<=W+1;j++){
			pic[i][j] = '#';
		}
	}
	for(int i=1;i<=H;i++){
		scanf("%s",&pic[i][1]);
		pic[i][W+1] = '#';
		pic[i][W+2] = '\0';
	}

	for(int i=0;i<=H+1;i++){
		printf("%s\n",pic[i]);
	}

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    ll N,A,B;
    cin >> N >> A >> B;
    cout << A * (N/(A+B)) + min(N%(A+B),A )<< endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> P;
#define REP(i,x,y) for(int i=x;i<=y;i++)
const int maxn = 1000006, inf = 0x3f3f3f3f;
int n;
char s[maxn];
int main(){
	cin>>n;
	cin>>s;
	int j=0,ans=inf,cur=0;
	for(int i=0;i<n;i++){
		if(s[i]!='#') cur++;
	}
	for(j=0;j<=n;j++){
		ans=min(ans,cur);
		if(j<n) {
			if(s[j]!='#') cur--;
			else cur++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
N = input()
a = map(int, raw_input().split())

mn = min(a)
mx = max(a)
mincost = float('inf')
for n in range(mn, mx+1):
    cost = 0
    for e in a:
        cost += (e-n)**2
    mincost = min(cost, mincost)
print mincost


Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> x(n), dist(n);
    rep(i, 0, n){
        cin >> x[i];
        dist[i] = abs(x[i]);
    }

    ll ans = 1e9;
    ll l = 0, r = l + k - 1;

    for(l = 0; l < n - k + 1; l++){
        r = l + k - 1;
        if(x[r] <= 0){
            ans = min(ans, dist[l]);
        }else if(x[r] > 0 && x[l] < 0){
            ans = min(ans, min(dist[l]+2*dist[r], dist[r]+2*dist[l]));
        }else{
            ans = min(ans, dist[r]);
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define all(a) (a).begin(), (a).end()


int main(){
    int N, L;
    cin >> N >> L;
    int start = L;
    int end = L + N - 1;
    int min;
    if(start <= 0 and 0 <= end) min = 0;
    else if(0 <= start and 0 <= end) min = start;
    else min = end;
    cout << (L + L + N - 1) * N / 2 - min << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> b = a;
    sort(all(b));
    if (b[n-1] == b[n-2]){
        rep(i,n) cout << b[n-1] << endl;
    }else{
        rep(i,n){
            if (a[i] == b[n-1]) cout << b[n-2] << endl;
            else cout << b[n-1] << endl;
        }
    }
    return 0;
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

#define int ll

const int inf = 1ll<<62;
const int mod = 1e9+7;

main(){
  int n; cin >> n;
  vi l(2 * n); rep(i, sz(l)) cin >> l[i];
  sort(all(l));
  int ans = 0;
  rep(i, n) ans += l[2 * i];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

const ll inf = 1LL<<60;


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

    int n; cin >> n;
    vector<int> a(n, 0);
    rep(i, n){
        int x; cin >> x;
        ++a[x-1];
    }
    sort(a.begin(), a.end());
    vector<int> sum(n+1, 0);
    rep(i, n) sum[i+1] = sum[i] + a[i];
    auto check = [&](auto mid, auto k){
        int i = lower_bound(a.begin(), a.end(), mid) - a.begin();
        int val = sum[i] + mid * (n - i);
        return (val >= mid * k);
    };
    repr(k, 1, n+1){
        int ok = 0, ng = n / k + 1;
        while(ng-ok > 1){
            int mid = (ok + ng) >> 1;
            if(check(mid, k)) ok = mid;
            else ng = mid;
        }
        cout << ok << endl;
    }

    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, M, X, Y, x, y; cin >> N >> M >> X >> Y;
  while (N--) cin >> x, X = max(X, x); while (cin >> y) Y = min(Y, y);
  puts(X < Y ? "No War" : "War");}

Measured memory_bytes: 3616
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

class MyClass
{
    public static void Main(string[] args)
    {
        var str = "";
        while ((str = Console.ReadLine()) != null)
        {
            var vmin = double.Parse(str);
            Console.WriteLine(Math.Ceiling(vmin * vmin / 98) + 1);
        }
    }
}


Measured memory_bytes: 17892
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const ll MOD = (ll)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

ll fac[1] = {1}, inv[1] = {1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll mp(ll a,ll b){ll ret=1;while(b){if(b&1)ret=ret*a%MOD;a=a*a%MOD;b>>=1;}return ret;}
ll cmb(ll r, ll c) {return fac[r] * inv[c] % MOD * inv[r - c] % MOD;}

priority_queue<int, vector<int>, greater<int>> pq;
vector<int> v;

int main() {
    int l, r, d;
    scanf("%d %d %d", &l, &r, &d);
    int cnt = 0;
    for (int i = l; i <= r; i++)
        cnt += (i%d==0);

    printf("%d", cnt);
}

Measured memory_bytes: 3820
#include<stdio.h>
int main(){
	int x=0,y=0,i,j;
	for(i=0; i<9; i++){
	y=0;
	++x;
	for(j=0; j<9; j++){
	++y;
	printf("%dx%d=%d\n",x,y,x*y);
	};
	};
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
using namespace std;

int BitCount(int64_t x) {
    x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
    x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
    x = (x & 0x0f0f0f0f0f0f0f0f) + (x >> 4 & 0x0f0f0f0f0f0f0f0f);
    x = (x & 0x00ff00ff00ff00ff) + (x >> 8 & 0x00ff00ff00ff00ff);
    x = (x & 0x0000ffff0000ffff) + (x >> 16 & 0x0000ffff0000ffff);
    x = (x & 0x00000000ffffffff) + (x >> 32 & 0x00000000ffffffff);
    return (int)(x);
}

const int INF = 1e8;

// O(N * 8^N)
int main() {
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<int> l;
    for(int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        l.push_back(tmp);
    }
    int P = 1 << N;
    int ans = INF;
    vector<int> m;
    for(int i = 0; i < P; i++) {
        int L = 0;
        for(int k = 0; k < N; k++) {
            if(i & (1 << k)) L += l[k];
        }
        m.push_back(L);
    }
    for(int a = 1; a < P; a++) {
        for(int b = 1; b < P; b++) {
            if(a & b) continue;
            for(int c = 1; c < P; c++) {
                if(b & c || c & a) continue;
                ans = min(ans, 10 * (BitCount(a) + BitCount(b) + BitCount(c) - 3) +
                        abs(m[a] - A) + abs(m[b] - B) + abs(m[c] - C));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

a = get_int
s = gets.chomp

puts a >= 3200 ? s : 'red'


Measured memory_bytes: 14420
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true) {
		int n = sc.nextInt();
		if(n==0) {break;}
		int max_yen = sc.nextInt();
		int temp_max=0;
		


		ArrayList<Integer> price = new ArrayList<Integer>();
		
		for(int i=0;i<n;i++) {
			int in = sc.nextInt();
			for(int p:price) {
				int x= in+p;
				if(x > temp_max && x <= max_yen) {
					temp_max = x;
				}
			}
			price.add(in);
		}
		if(temp_max == 0) {
			System.out.println("NONE");
		}else {
		System.out.println(temp_max);
		}

		}
		sc.close();
	}

}


Measured memory_bytes: 52468
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
  int N,C,K;
  int T[100010];
  cin>>N>>C>>K;
  for (int i=0; i<N; i++) {
    scanf("%d",T+i);
  }

  sort(T,T+N);
  int ans=0,cnt=0,limit=T[0]+K;
  for (int i=0; i<N; i++) {
    cnt++;
    if (cnt>C || limit<T[i]) {
      ans++;
      cnt=1;
      limit=T[i]+K;
    }
  }

  ans++;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
const int MOD=1e9+7;
const int INF=1e15;

string S;
int X;
int N=S.size();
int ans=0;

bool han(string S){
    bool ok3,ok5,ok7;
    ok3=ok5=ok7=false;
    REP(i,S.size()){
        int d=S[i]-'0';
        if(d==3)ok3=true;
        if(d==5)ok5=true;
        if(d==7)ok7=true;
    }
    if(ok3&&ok5&&ok7)return true;
    else return false;
}

bool dfs(int x){
    if(x>X)return false;
    string d=to_string(x);
    if(han(d))ans++;
    dfs(x*10+3);dfs(x*10+5);dfs(x*10+7);
    return true;
}

signed main(){
    cin>>S;
  	X=stoi(S);
    dfs(0);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
N, H = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(N)]

ab.sort(key = lambda x: x[1], reverse = True)

ma = max(ab, key = lambda x: x[0])[0]
ans = 0
for i in range(N):
  if ab[i][1] > ma:
    H -= ab[i][1]
    ans += 1
  else:
    ans += (H - 1) // ma + 1
    break
  if H <= 0:
    break
else:
  ans += (H - 1) // ma + 1

print(ans)

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

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}
int gyaku(int n){
    return modpow(n,MOD-2);
}
signed main() {
  int n;
  int ans=0;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  vector<int>ball(n);
  for(int i=n-1;i>=0;i--){
    int p=i+1;
    int count=0;
    while(p<=n){
      if(ball[p-1])count++;
      p+=i+1;
    }
    ball[i]=abs((count%2)-a[i]);
    if(ball[i]) ans++;
  }
  cout<<ans<<endl;
  rep(i,n){
    if(ball[i])cout<<i+1<<endl;
  }
}


Measured memory_bytes: 6372
n = int(input())
X = list(map(int, input().split()))
mX = sum(X)//n
mX1 = mX+1
r = 0
r1 = 0
for i in range(n):
    r += (X[i]-mX)**2
    r1 += (X[i]-mX1)**2
print(min(r, r1))

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

using namespace std;

int main(){
	int a[3];
	for (int i = 0; i < 3; i++){
		scanf("%d", a + i);
	}
	sort(a, a + 3);
	int ans = a[2] * 10 + a[1] + a[0];
	printf("%d\n", ans);
	return 0;
}


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

int main(){
    int a[10],b[10];
    for(int i=0;i<10;i++){
        cin >> a[i];
    }
    for(int i=0;i<10;i++){
        cin >> b[i];
    }
    sort(a,a + 10,greater<int>());
    sort(b,b + 10,greater<int>());
    cout << a[0]+a[1]+a[2] << " ";
    cout << b[0]+b[1]+b[2] << endl;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int A, B, ans = 0; cin >> A >> B;
    rep (i, 0, 2) {
        if (A > B) {
            ans += A;
            A--;
        } else {
            ans += B;
            B--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
   int i,j,n;
   double s;
 
   scanf("%d",&n);
   s=0.0;
   for (i=0;i<n;i++) {
      scanf("%d",&j);
      s=s+1.0/j;
   }
   printf("%f",1/s);
   return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    string s;
    cin >> s;

    int n = static_cast<int>(s.size());

    vector<int> dl(n, 0);
    for (int i = n - 2; i >= 0; i--) {
        if (s[i] == 'R') {
            dl[i] = dl[i + 1] + 1;
        }
    }

    vector<int> dr(n, 0);
    for (int i = 1; i < n; i++) {
        if (s[i] == 'L') {
            dr[i] = dr[i - 1] + 1;
        }
    }

    vector<int> res(n, 0);
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            res[i - dr[i] + (dr[i] % 2)]++;
        } else {
            res[i + dl[i] - (dl[i] % 2)]++;
        }
    }

    for (int i = 0; i < n; i++) {
        cout << (i == 0 ? "" : " ") << res[i];
    }
    cout << endl;
}


Measured memory_bytes: 1792
a,b,s[104],n,i;main(c){for(scanf("%d",&n);~scanf("%d%d%d%d",&a,&b,&c,s);)c-*s?s[c>*s?a:b]+=3:++s[a]-++s[b];for(;a=b=i++<n;printf("%d\n",b))for(;a<=n;)b+=s[i]<s[a++];}

Measured memory_bytes: 0
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Sun Dec  2 04:44:44 2018
//
package main

import (
	"fmt"
	"sort"
)

func main() {
	d := make([]int, 3)
	fmt.Scan(&d[0], &d[1], &d[2])
	sort.Ints(d)
	fmt.Println(d[0] + d[1] + d[2]*10)
}


Measured memory_bytes: 512
/*
ID: Bipin Singh [bipinsingh061]
LANG: C++
TASK: gift1
*/
#include<bits/stdc++.h> 
using namespace std; 
#define deb(x) cout <<"\n"<< (#x) << " = " << (x) << "\n"
#define int long long int

void inputoutput()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
}



bool dfs(int src,int c , bool *vis , vector<int> (&v)[2001] , int col[])
{
	vis[src]=true;
	col[src]=c ;
	// cout<<src<<" ";

	for(auto it : v[src])
	{
		if(!vis[it])
		{
			if(dfs(it,c*-1,vis,v,col)==false)
				return false;
		}
		else
		{
			if(col[src]==col[it])
				return false;
		}
	}
	return true ;
}

int mod=1e9+7 ;


void update(vector<int>& D, int l, int r, int x) 
{ 
    D[l] += x; 
    D[r + 1] -= x; 
}

int32_t main()
{
	inputoutput();


	string s,t;
	cin>>s>>t;
	int ans=INT_MAX ;
	for(int i=0 ; (i+t.size()-1)<s.size() ; ++i)
	{
		int err=0;
		for(int j=0 ; j<t.size() ; ++j)
		{
			if(s[i+j]!=t[j])
				++err;
		}
		ans=min(ans,err);
	}
	cout<<ans;

	

    



	return 0;
}




Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  string s, t;
  cin >> s >> t;
  string u = t.erase(s.size(), 1);
  if(s == u)
    cout << "Yes";
  else
    cout << "No";
}


Measured memory_bytes: 3636
// Why am I so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)1e5 + 5;

int ql[MAXN], qr[MAXN];

int cnt[MAXN];

int n, m;

void solve() {                   
	scanf("%d %d", &n, &m);

    for (int i = 1; i <= m; ++i) {
    	scanf("%d %d", &ql[i], &qr[i]);

    	if (ql[i] > qr[i]) {
    		swap(ql[i], qr[i]);
    	}

  		--qr[i];
    }

    for (int i = 1; i <= m; ++i) {
    	++cnt[ql[i]];
    	--cnt[qr[i] + 1];
    }

	for (int i = 2; i <= n; ++i) {
		cnt[i] += cnt[i - 1];
	}

	for (int i = 1; i <= n; ++i) {
		if (cnt[i] & 1) {
			printf("NO\n");
			return;
		}
	}

	printf("YES\n");
}

int main() {    
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 1408
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
int a[MAXN];

int main() {
	int n, k; scanf("%d %d", &n, &k);nai(a, n);sort(a,a+n);
	ll sm = 0, ans = 0;
	for (int i = n-1; ~i; i--)
		if (sm + a[i] < k)
			ans++, sm += a[i];
		else
			ans = 0;
	prl(ans);
	return 0;
}


Measured memory_bytes: 256