akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

ll gcd(ll x, ll y)
{
  return y ? gcd(y, x % y) : x;
}
ll lcm(ll x, ll y)
{
  return x * y / gcd(x, y);
}
bool is_prime(int x)
{
  for (int i = 2; i * i <= x; i++)
  {
    if (x % i == 0)
      return 0;
  }
  return true;
}
vector<bool> prime_table(int n)
{
  vector<bool> prime(n + 1, 1);
  prime[0] = 0;
  prime[1] = 0;
  for (int i = 2; i * i <= n; i++)
  {
    if (!prime[i])
      continue;
    for (int j = i * i; j <= n; j++)
      prime[j] = 0;
  }
  return prime;
}
map<int, int> prime_factor(int n)
{
  map<int, int> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1)
    res[n]++;
  return res;
}

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

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

  int l=s.size();
  REP(i,l) cout<<'x';
  cout<<endl;
  
  return 0;
}


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

int main() {
    int N;
    int d[110];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> d[i];
    
    int num[110] = {0};
    for (int i = 0; i < N; ++i) {
        num[d[i]]++;  // d[i] が 1 個増える
    }
    
    int res = 0;  // 答えを格納
    for (int i = 1; i <= 100; ++i) {  // 1 <= d[i] <= 100 なので 1 から 100 まで探索
        if (num[i]) {  // 0 より大きかったら
            ++res;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<unordered_set>
using namespace std;
const int MAX = 0;
const int INF = 100000000;

int main() {
	int N;
	unordered_set<long long> s;

	cin >> N;
	for (int i = 0; i < N; i++) {
		long long a;
		cin >> a;
		if (s.count(a) == 0) {
			s.insert(a);
		}
		else {
			s.erase(a);
		}
	}

	cout << s.size();
	return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n,a,b;
    cin>>n>>a>>b;
    if(a>b) swap(a,b);
    if((b-a)%2==0){
        cout<<(b-a)/2<<endl;
    }else{
        cout<<min(a+(b-a-1)/2,n-b+1+(b-a-1)/2)<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  int N;
  cin>>N;
  
  vector<int> d(N);
  rep(i,N){
    cin>>d[i];
  }
  
  int ans=0;
  for(int i=0;i<N-1;++i){
    for(int j=i+1;j<N;++j){
      ans+=(d[i]*d[j]);
    }
  }
  
  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    a = list(map(int, input().rstrip('\n').split()))
    print(((n-1) + (k-1) - 1) // (k-1))


if __name__ == '__main__':
    slove()


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

int main()
{
	int N;
	cin >> N;
	vector<ll> A(N), B(N);
	vector<pair<ll, int>> vp;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
		vp.emplace_back(A[i], i);
		vp.emplace_back(B[i], i);
	}
	if (*max_element(A.begin(), A.end()) <= *min_element(B.begin(), B.end())) {
		cout << accumulate(A.begin(), A.end(), 0LL) << endl;
		return 0;
	}
	if (*max_element(B.begin(), B.end()) <= *min_element(A.begin(), A.end())) {
		cout << accumulate(B.begin(), B.end(), 0LL) << endl;
		return 0;
	}
	sort(vp.begin(), vp.end());
	ll res = 0;
	int c = 0;
	vector<int> cnt(N);
	for (int i = 0; i < N; i++) {
		res += vp[i].first;
		c += cnt[vp[i].second];
		cnt[vp[i].second] = 1;
	}
	if (c == 0) {
		res += vp[N].second != vp[N - 1].second ? vp[N].first - vp[N - 1].first : min(vp[N + 1].first - vp[N - 1].first, vp[N].first - vp[N - 2].first);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 8048
/*
 ID: swagchicken1
 PROG:
 LANG: C++11
 */
 
#include <iostream>
#include <tuple>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <vector>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <cctype>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vector <int> > vvi;
typedef pair<int, int> pii;
typedef pair < pair < int, int >, int > piii;
typedef pair < pair <int, int > , pair <int, int> > piiii;
 
#define FOR(i,a,b) for(int i = a; i < b; i ++)
#define RFOR(i,a,b) for(int i = a-1; i >= b; i --)
 
//#define endl '\n';
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
 
const int MOD = 1000000007;
double PI = 4*atan(1);
 
 
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //     ofstream fout("trapped.out");
    //      ifstream fin("trapped.in");
    int N; cin >> N;
    int M; cin >> M;
    int C; cin >> C;
    int b[20] = {};
    FOR(i,0,M) {
        cin >> b[i];
    }
    int a[20][20] = {};
    FOR(i,0,N) {
        FOR(j,0,M) {
            cin >> a[i][j];
        }
    }
    int ans = 0;
    FOR(i,0,N) {
        int tot = 0;
        FOR(j,0,M) {
            tot += b[j]*a[i][j];
        }
        tot += C;
      if(tot > 0) {
        ans += 1;
      }
        
    }
 
    cout << ans << endl;
    
    //  fin.close();
    //    fout.close();
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
using namespace std;
int pow;
void powa(int a){
    if (a==0){
        cout<<0<<endl;
        return;
    }
    for(int i=0;i<=a+1;i++){
        if(i*i>a){
            cout<<pow<<endl;
            return;
        }
        pow=i*i;
        
    }
}

int main(int argc, const char * argv[]) {

    int su;
    cin >>su;
    powa(su);
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)



int main(){
	int N,K;
	cin>>N>>K;
	
	int now = (N-1)*(N-2)/2;
	if(K>now){
		cout<<-1<<endl;
		return 0;
	}
	
	vector<pair<int,int>> ans(0);
	
	for(int i=0;i<N-1;i++){
		ans.push_back(make_pair(1,i+2));
	}
	K = now-K;
	for(int i=2;i<=N;i++){
		for(int j=i+1;j<=N;j++){
			if(K==0)goto Label;
			K--;
			ans.push_back(make_pair(i,j));
		}
	}
	Label:
	
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++){
		cout<<ans[i].first<<' '<<ans[i].second<<endl;
	}

	
	return 0;
}


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

int main() {

    int n;
    cin >> n;

    vector<string> s(n);
    vector<int> p(n);
    vector<int> c(n);

    for(int i = 0;i < n; ++i){
        cin >> s.at(i) >> p.at(i);
        c.at(i) = i+1;
    }

    for(int i = 0; i < n; ++i){
        for(int j = i; j < n; ++j){
            if(s.at(i) > s.at(j)){
                swap(s.at(i), s.at(j));
                swap(p.at(i), p.at(j));
                swap(c.at(i), c.at(j));
            }
        }
    }

    for(int i = 0; i < n; ++i){
        for(int j = i; j < n; ++j){
            if(s.at(i) == s.at(j) && p.at(i) < p.at(j)){
                swap(s.at(i), s.at(j));
                swap(p.at(i), p.at(j));
                swap(c.at(i), c.at(j));
            }
        }
    }

    for(int i = 0; i < n; ++i){
        cout << c.at(i) << endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,i,j=0;
   cin>>n;
   int a[n];
   for(i=0;i<n;i++) cin>>a[i];
   for(i=1;i<n-1;i++){
    if((a[i]>a[i-1] && a[i]<a[i+1]) || (a[i]<a[i-1] && a[i]>a[i+1])) j++;
   }
   cout << j <<endl;
   return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            long N = in.Long();
            List<String> name = new ArrayList<>();
            while (N > 0) {
                int a = (int) ((N - 1) % 26);
                N = (N - 1) / 26;
                name.add(String.valueOf((char) ('a' + a)));
            }
            Collections.reverse(name);
            out.println(String.join("", name));
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public long Long() {
            return Long.parseLong(next());
        }

    }
}



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

int main(){
int n;
cin >> n;
int p=n/100000;
int q=(n-p*100000)/10000;
int r=(n-p*100000-q*10000)/1000;
int s=(n-p*100000-q*10000-r*1000)/100;
int t=(n-p*100000-q*10000-r*1000-s*100)/10;
int u=n%10;
int x=p+q+r+s+t+u;
if (x==1) x=10;
cout << x << endl;
}

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

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

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

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

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

void finish() {
    cout << -1 << endl;
    exit(0);
}

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

const ll MAX_N = 3010;
ll fact[MAX_N];
ll fact_inv[MAX_N];

ll MOD;

inline ll pow_mod(ll x, ll y, ll m = MOD) { //x^y mod m
    if (x % MOD == 0) return 0;
    ll prod = 1;
    while (y > 0) {
        if (y % 2 == 1) prod = (prod * x) % m;
        x = (x * x) % m;
        y /= 2;
    }
    return prod % m;
}

void init_fact() {
    fact[0] = fact_inv[0] = 1;

    REP(i, 1, MAX_N) {
        fact[i] = (fact[i - 1] * i) % MOD;
        fact_inv[i] = pow_mod(fact[i], MOD - 2);
    }
}

inline ll C_mod(ll n, ll r) {
    return ((fact[n] * fact_inv[n - r]) % MOD * fact_inv[r]) % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);

    ll p;
    ll ans[3010] = {};
    cin >> p;
    MOD = p;
    init_fact();

    rep(j, p) {
        ll a;
        cin >> a;
        if (a == 0) continue;
        //1-(x-j)^(p-1)を展開して可算
        ans[0] = (ans[0] == p - 1 ? 0 : ans[0] + 1);

        if (j == 0) {
            ans[p - 1]--;
            if (ans[p - 1] < 0) ans[p - 1] += p;
            continue;
        }

        ll pow_j = 1;

        rep(i, p) {
            ans[p - 1 - i] += p - C_mod(p - 1, i) * pow_j % p;
            ans[p - 1 - i] %= p;
            pow_j *= (p - j);
            pow_j %= p;
        }
    }

    rep(i, p) cout << ans[i] << (i == p - 1 ? "\n" : " ");

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
#define all(v) v.begin(),v.end()

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

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int sum(int n){
    int s=0;
    while(n!=0)
    {
        s+=n%10;
        n/=10;
    }
    return s;
}
int main()
{
    int n,s;
    scanf("%d",&n);
    s=sum(n);
    if(n%s==0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
	G:
	while(getline(cin,s),s!="."){
		stack<char> p;
		for(int i=0;i<s.length();i++){
			if(s[i]=='('||s[i]=='[')p.push(s[i]);
			if(s[i]==')'){if(p.empty()||p.top()!='('){cout<<"no"<<endl;goto G;}p.pop();}
			if(s[i]==']'){if(p.empty()||p.top()!='['){cout<<"no"<<endl;goto G;}p.pop();}
		}
		cout<<(p.empty()?"yes":"no")<<endl;
	}

}

Measured memory_bytes: 3124
N, K = map(int, raw_input().split())
word = raw_input()
newword = ""
for i in xrange(N):
  if i == K - 1:
    if word[i] == "A":
      newword += "a"
    elif word[i] == "B":
      newword += "b"
    else:
      newword += "c"
  else:
    newword += word[i]
    
print newword

Measured memory_bytes: 2568
n = int(input())
B = list(map(int, input().split()))
ans = [B[0]]
for i in range(len(B)):
    if i != len(B)-1:
        if B[i] > B[i+1]:
            ans.append(B[i+1])
        else:
            ans.append(B[i])
    else:
        ans.append(B[i])
print(sum(ans))

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int n;
int A[(int) 1e5 + 3], B[(int)1e5 + 3], C[(int)1e5 + 3];
int dp[int(1e5) + 3][5];

int solve(int day, int prevDay)
{
    if(day > n)
        return INT_MIN;
    if(day == n)
        return 0;
    int &ret = dp[day][prevDay];
    if(~ret)
        return ret;
    ret = INT_MIN;
    if(prevDay != 1 && prevDay != 2 && prevDay != 3)
    {
        ret = max(ret, solve(day, 1));
        ret = max(ret, solve(day, 2));
        ret = max(ret, solve(day, 3));
    }
    if(prevDay == 1)
    {
        ret = max(ret, solve(day + 1, 2) + B[day]);
        ret = max(ret, solve(day + 1, 3) + C[day]);
    }
    else if(prevDay == 2)
    {
        ret = max(ret, solve(day + 1, 1) + A[day]);
        ret = max(ret, solve(day + 1, 3) + C[day]);
    }
    else if(prevDay == 3)
    {
        ret = max(ret, solve(day + 1, 1) + A[day]);
        ret = max(ret, solve(day + 1, 2) + B[day]);
    }
    return ret;
}

int main()
{
    IO;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> A[i] >> B[i] >> C[i];
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0);
    return 0;
}


Measured memory_bytes: 9600
#include<stdio.h>

int LinearSearch(int *, int);

int n;

int main(void){

  int q,s[10000],t[501],count=0,i;


  scanf("%d",&n);
  for(i = 0 ; i < n ; i++)
    scanf("%d",&s[i]);


  scanf("%d",&q);
  for(i = 0 ; i < q ; i++){
    scanf("%d",&t[i]);

    if(LinearSearch(s,t[i])==1) count++;

  }

  printf("%d\n",count);

  return 0;

}


int LinearSearch(int *s, int key){

  int i = 0;

  s[n] = key;

  while(s[i]!=key){
    i++;
  }
  
  if(i == n) return 0;
  
  return 1;
  
}

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

int main() {
  int N;
  std::cin >> N;
  std::vector<int> H(N);
  for (int i=0; i<N; i++) std::cin >> H[i];
  
  int cnt = 0;
  for (int i=0; i<N; i++) {
    int flg = true;
    for (int j=0; j<i; j++) {
      if (H[j] > H[i]) flg = false;
    }
    if (flg) cnt++;
  }
  
  std::cout << cnt << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
int main() {
    int n,k;
    scanf("%d",&n);
    scanf("%d",&k);
    vector<int>h(n);
    for(int& x : h)
    {
        scanf("%d",&x);
    }

    vector<int> dp(n,INF);
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=i+k;++j)
        {
            if(j<n)
            {
              //  cout<<j<<" ** ";
                dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
            }
        }
      //  cout<<endl;
    }
    printf("%d",dp[n-1]);
}


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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll llinf = LLONG_MAX;
const ull ullinf = ULLONG_MAX;

int n;
const int maxn = 200001;
ll a[maxn];

bool check(ll mid1, ll mid2) {
  ll res1 = 0;
  for (int i = 0; i < n; i++) {
    res1 += abs(a[i] - mid1);
  }
  ll res2 = 0;
  for (int i = 0; i < n; i++) {
    res2 += abs(a[i] - mid2);
  }
  return res1 > res2;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;
#endif
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= i + 1;
  }
  sort(a, a + n);
  ll left = a[0];
  ll right = a[n - 1];
  while (right - left > 5) {
    ll mid1 = (left * 2 + right) / 3;
    ll mid2 = (left + right * 2) / 3;
    if (check(mid1, mid2)) {
      left = mid1;
    } else {
      right = mid2;
    }
  }
  ll now = llinf;
  for (ll i = left; i <= right; i++) {
    ll res = 0;
    for (int j = 0; j < n; j++) {
      res += abs(a[j] - i);
    }
    now = min(now, res);
  }
  cout << now << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}


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

using namespace std;

const int N = 1e5 + 10;
typedef long long LL;

int n, A, B, h[N];

bool ok(int m){
    LL d = 1LL * B * m, c, a;
    for(int i=0; i<n; i++){
		a = h[i] - d;
		if(a <= 0)	continue;
		if(a % A == 0){
			c = a / A;
		} else {
			c = a / A + 1;
		}
		if(m < c){
			return 0;
		}
		m = m - c;
    }

    return 1;
}

int solve(){
    A -= B;
    int low = 1, top = 1000000000, mid, ret = top;
    while(low <= top){
		mid = low + top >> 1;
		if(ok(mid)){
			ret = min(ret, mid);
			top = mid - 1;
		} else {
			low = mid + 1;
		}
    }

    return ret;
}

int main(){
	while(~scanf("%d %d %d", &n, &A, &B)){
		for(int i=0; i<n; i++)	scanf("%d", h+i);
		printf("%d\n", solve());
	}
	return 0;
}


Measured memory_bytes: 640
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

fn main() {
    input! {
        A: i32,
        B: i32,
        C: i32,
    }

    let ans = if (A < C && C < B) || (B < C && C < A) {
        "Yes"
    } else {
        "No"
    };

    println!("{}", ans);
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
int main()
{
   char A,B,C,D,E,F,x,y;
   cin>>x>>y;
   A=10;
   B=11;
   C=12;
   D=13;
   E=14;
   F=15;
if(x>y)
{
    cout<<">";
}
else if(x<y)
{
    cout<<"<";
}
else if(x==y)
{
    cout<<"=";
}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
const int MAX=2e5;
const ll MOD=1e9+7;
const int INF=1<<30;

bool isprime(int n){
  if (n==1) return false;
  else if(n==2) return true;
  else if(n%2==0) return false;
  else{
    for(int i=3;i*i<=n;i+=2){
      if(n%i==0) return false;
    }
    return true;
  }
}

int Q;
const int maxr=1e5+10;
int a[maxr];
int S[maxr];

int main(){
  cin >> Q;
  for(int i=1;i<maxr;i+=2){
    if(isprime(i)&&isprime((i+1)/2)) a[i]=1;
  }
  for(int i=0;i<maxr;i++){
    S[i+1]=S[i]+a[i];
  }
  rep(i,Q){
    int l,r;
    cin >> l >> r;
    cout << S[r+1]-S[l] << endl;
  }

}

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

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  string s;
  cin >> s;

  int oversea = 1;
  int pass = 1;
  for(int i=0; i < n; i++) {
    if(s[i] == 'a') {
      if(a+b >= pass) {
        pass++;
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
    if(s[i] == 'b') {
      if(a+b >= pass && b >= oversea) {
        pass++;
        oversea++;
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
    if(s[i] == 'c') {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    double n, k;
    cin >> n >> k;

    double rate = 0.0;
    if(k <= n){
        rate += (n-k+1)/n;
    }

    Int mx = k<=n ? k-1 : n;
    for(Int i=1; i<=mx; i++){
        tmpd = i;
        double cnt = 0.0;
        while(tmpd < k){
            tmpd *= 2.0;
            cnt++;
        }
        rate += pow(0.5, cnt)*(1.0/n);
    }
    printf("%.10lf", rate);
    return 0;
}

Measured memory_bytes: 384
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a = Array.fill(3 * n)(sc.nextInt()-1)

  def compose(x1: Int, x2: Int): Int = {
    x1 * n + x2
  }

  val dp = Array.fill(n * n)(Int.MinValue)
  val m1 = Array.fill(n)(Int.MinValue)
  val m2 = Array.fill(n)(Int.MinValue)
  var m = 0
  var ans = 0

  dp(compose(a(0), a(1))) = 0
  m1(a(0)) = 0
  m2(a(1)) = 0

  var update = List[(Int, Int, Int)]()

  for (i <- 1 until n) {
    val p = a(3 * i - 1)
    val q = a(3 * i)
    val r = a(3 * i + 1)
    if (p == q && q == r) {
      ans += 1
    } else {
      if (p == q || p == r || q == r) {
        val x = if (p == q || p == r) p else q
        val y = if (p == q) r else if (p == r) q else p
        for (i <- 0 until n) {
          update ::= (i, y, dp(compose(x, i)).max(dp(compose(i, x))) + 1)
        }
      }

      update ::= (q, r, dp(compose(p, p)) + 1)
      update ::= (p, r, dp(compose(q, q)) + 1)
      update ::= (p, q, dp(compose(r, r)) + 1)

      update ::= (p, q, m)
      update ::= (p, r, m)
      update ::= (q, r, m)

      for (i <- 0 until n) {
        update ::= (i, p, m1(i).max(m2(i)))
        update ::= (i, q, m1(i).max(m2(i)))
        update ::= (i, r, m1(i).max(m2(i)))
      }

      for ((i, j, v) <- update) {
        dp(compose(i, j)) = dp(compose(i, j)).max(v)
        m1(i) = m1(i).max(dp(compose(i, j)))
        m2(j) = m2(j).max(dp(compose(i, j)))
        m = m.max(dp(compose(i, j)))
      }
      update = Nil
    }
  }

  val last = a(3*n - 1)
  m = m.max(dp(compose(last, last)) + 1)

  println(ans + m)
}


Measured memory_bytes: 74408
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;

int main() {
    ll Q,H,S,D;
    cin >> Q >> H >> S >> D;
    ll N;
    cin >> N;
    ll one = min(4*Q,min(2*H,S));
    if(2*one<=D){
        cout << one*N << endl;
    }
    else {
        if(N&1) cout << D*(N-1)/2+one << endl;
        else cout << D*N/2 << endl;
    }

}

Measured memory_bytes: 256
input_lines = gets.chomp
array_num = input_lines.split("\s").map(&:to_i)
apples = array_num[0]
parts = array_num[1]
sum = 0
def make_parts(apples)
  apples * 3
end

sum = parts + make_parts(apples)
def cakes(sum)
  sum / 2
end

puts cakes(sum)


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
const ll mod = 1000000000 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  string s;
  cin >> s;
  if (s[s.size() - 1] == 's')
    s += "es";
  else
    s += "s";
  cout << s << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string a,b;
  cin>>a>>b;
  int l=a.length();
  int m=b.length();
  vector<vector<int>> v(l+1,vector<int>(m+1));
  for(int i=1;i<=l;i++)
  {
    for(int j=1;j<=m;j++)
    {
      if(a[i-1]==b[j-1])
      {
        v[i][j]=v[i-1][j-1]+1;
      }
      else
      {
        v[i][j]=max(v[i-1][j],v[i][j-1]);
      }
    }
  }
  string s;
  int lth=v[l][m];
  int p=l,q=m;
  //cout<<ans.a<<" "<<ans.b<<" "<<ans.c<<endl;
  while(lth>0)
  {
    if(a[p-1]==b[q-1])
    {
      s+=a[p-1];
      lth--;
      p--;
      q--;
    }
    else
    {
      if(v[p][q-1]>v[p-1][q])
      q--;
      else
      p--;
    }
  }
  reverse(s.begin(),s.end());
  cout<<s<<endl;
  return 0;
}





Measured memory_bytes: 35584
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

n,m=map(int,input().split())
print((1900*m+100*(n-m))*(2**m))

Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> v(H + 2, vector<char>(W + 2));
  for (int i = 1; i < H + 1; i++) {
    for (int j = 1; j < W + 1; j++) {
      cin >> v[i][j];
    }
  }
  for (int i = 0; i < H + 2; i++) {
    for (int j = 0; j < W + 2; j++) {
      if (i == 0 || j == 0 || i == H + 1 || j == W + 1) {
        cout << '#';
      } else {
        cout << v[i][j];
      }
    }
    cout << endl;
  }
  return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        int R = int.Parse(Console.ReadLine());
        string OutputString;

        if(R < 1200)
        {
            OutputString = "ABC";
        }
        else if(R < 2800)
        {
            OutputString = "ARC";
        }
        else
        {
            OutputString = "AGC";
        }
        Console.WriteLine(OutputString);
    }
}


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    if(N >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <vector>
#include <map>
#include <iostream>
#define M make_pair
#define F first
#define S second
using namespace std;
typedef vector<pair<
	pair<
		pair<int,int>,
		pair<int,int>
	>,string
> >links;
main(){
	int N,n,x1,y1,x2,y2,cur;
	string s,t;
	for(;cin>>N>>x1>>y1;){
		map<string,links>m;
		vector<string>visit;
		for(cur=-1;N;N--){
			links v;
			for(cin>>s>>n;n;n--)
				cin>>x1>>y1>>x2>>y2>>t,v.push_back(M(M(M(x1,x2),M(y1,y2)),t));
			m[s]=v;
			if(cur==-1)visit.push_back(s),cur=0;
		}
		for(cin>>N;N;N--){
			if(cin>>s,s=="show")cout<<visit[cur]<<endl;
			if(s=="back"){if(cur>0)cur--;}
			if(s=="forward"){if(cur<visit.size()-1)cur++;}
			if(s=="click"){
				cin>>x1>>y1;
				links v=m[visit[cur]];
				for(n=0;n<v.size();n++){
					if(v[n].F.F.F<=x1&&x1<=v[n].F.F.S && v[n].F.S.F<=y1&&y1<=v[n].F.S.S){
						for(;cur<visit.size()-1;)visit.erase(visit.begin()+cur+1);
						visit.push_back(v[n].S);cur++;
					}
				}
			}
		}
	}
}

Measured memory_bytes: 1256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std; 

bool isPrime(int n) 
{ 
    // Corner case 
    if (n <= 1) 
        return false; 
  
    // Check from 2 to n-1 
    for (int i = 2; i < n; i++) 
        if (n % i == 0) 
            return false; 
  
    return true; 
} 
int main()
{
  ll n;
  cin>>n;
  ll i=n;
  while(!isPrime(i))
  {
    ++i;
  }
  cout<<i;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	ll n;
	cin>>n;
	string s="";
	while(n)
	{
		int x=n%26-1;
		if(x==-1)x=25;
		s+=char(x+'a');
		if(n%26==0)n-=26;
		n/=26;
	}
	reverse(s.begin(),s.end());
	cout<<s<<endl;
	return 0;
}



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

const int INF = 1000000000;

typedef pair<int,int> P;

#define fr first
#define sc second

int cnt(int n){
	int ret = 0;
	while(n>0){
		ret += n&1;
		n >>= 1;
	}
	return ret;
}

int N;
int p[20];

int CNT(){
	int ret = 0;
	for(int i = 0 ; i < N ; i ++){
		for(int j = i+1 ; j < N ; j ++){
			if(p[i] > p[j])ret ++;
		}
	}
	return ret;
}

int main(){
	int n;
	int a[20],b[20];
	scanf("%d",&n);
	for(int i = 0 ; i < n ; i ++){
		scanf("%d",&a[i]);
	}
	for(int i = 0 ; i < n ; i ++){
		scanf("%d",&b[i]);
	}
	for(int i = 0 ; i < n ; i ++){
		if(i&1)swap(a[i],b[i]);
	}
	N = n;
	
	int ret = INF;
	for(int s = 0 ; s < (1<<n) ; s ++){
		if(cnt(s) != n/2)continue;
		vector<P> A,B;
		for(int i = 0 ; i < n ; i ++){
			if((s>>i)&1)B.push_back(P(b[i],i));
			else A.push_back(P(a[i],i));
		}
		sort(A.begin(),A.end());
		sort(B.begin(),B.end());
		bool can = true;
		for(int i = 0 ; i < A.size() ; i ++){
			p[2*i] = A[i].sc;
			if(i > 0 && A[i].fr < B[i-1].fr)can = false;
		}
		for(int j = 0 ; j < B.size() ; j ++){
			p[2*j+1] = B[j].sc;
			if(B[j].fr < A[j].fr)can = false;
		}
		if(can)ret = min( ret , CNT() );
		
		/*if(CNT() == 2){
			for(int i = 0 ; i < n ; i ++){
				cout << p[i] << " ";
			}
			cout << endl;
		}*/
	}
	if(ret == INF)puts("-1");
	else cout << ret << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iomanip>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <new>
#include <cmath>
#include<fstream>
using namespace std;
#define Precision(i) cout << fixed << setprecision(i)
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
const ll N = 1e5 + 100, MOD = 1e9 + 7, INF = 1e17, SQ = 350, LOG = 20;
ll n, m, x1, x2, d, z , t, sum,y, maxi,mini, ans, ptr, x, q, a[N], b[N], k;
map <ll, int> mp;
int main()  
{
	//ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		b[i] = a[i];
	}
	sort(a, a + n);
	for (int i = 0; i < n; i++)
	{
		mp[a[i]] = i % 2;
	}
	for (int i = 0; i < n; i++)
	{
		if (mp[b[i]] != i % 2) ans++;
	}
	cout << ans / 2;
}


Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,i,k,j,minimum,b;
   cin>>n>>k;
   long long int arr[n];
   long long int s[n];
   s[0]=0;
   cin>>arr[0];
   cin>>arr[1];

   s[1]=abs(arr[1]-arr[0]);
   for ( i = 2; i < n; ++i)
   { 
   	cin>>arr[i];
   	minimum=abs(arr[i]-arr[i-1])+s[i-1];
   for (int j = 2; j <=k&&i-j>=0; ++j)
   {
         long long int a=abs(arr[i]-arr[i-j])+s[i-j];
            if (minimum>a)
            {
            	minimum=a;
            }

   }
   s[i]=minimum;
   	
   }

   cout<<s[n-1];

	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vi a(n);
	REP(i, n) {
		cin >> a[i];
	}
	ll res = 0;
	map<int, int> wys;
	wys[a[0]] = 1;
	FOR(i, 1, n - 1) {
		int szuk = i - a[i];
		res += wys[szuk];
		++wys[a[i] + i];
	}
	cout << res << endl;
}

Measured memory_bytes: 21116
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using namespace std;

using lli = long long int;
using ulli = unsigned long long int;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int X, A, B;

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

	cin >> X >>A >> B;
	if(B <= A) {
		cout << "delicious" << endl;
	}else if(B-A <= X){
		cout << "safe" << endl;
	}else{
		cout << "dangerous" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[3];
		int b[] =  {0,0,0};
		
		while(sc.hasNext()) {
			for(int i=0;i<3;i++)a[i]=sc.nextInt();
			Arrays.sort(a);
			if(a[2]>=a[0]+a[1]) {
				System.out.println((b[0]+b[1]+b[2])+" "+b[0]+" "+b[1]+" "+b[2]);
				break;
			}
			else if(Math.pow(a[2], 2)==Math.pow(a[0], 2)+Math.pow(a[1], 2))b[0]++;
			else if(Math.pow(a[2], 2)<Math.pow(a[0], 2)+Math.pow(a[1], 2))b[1]++;
			else if(Math.pow(a[2], 2)>Math.pow(a[0], 2)+Math.pow(a[1], 2))b[2]++;
			else System.out.println("EEE");
			
		}
		
		sc.close();
	}
	
}


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

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		ArrayList<Integer> list_line = new ArrayList<Integer>();
		int count = 0;
		int count_high = 0;
		boolean isChain = false;
		boolean until = true;
		boolean unfinish  =false;

		for(int i = 0;i < n;i++) {
			list_line.add(scan.nextInt());
		}


		while(until) {
			for(int i = 0;i < n;i++) {
				if(count_high >= list_line.get(i)) {
					if(isChain) {
						isChain = false;
						count++;
					}

				}else {
					if(!isChain) {
						isChain = true;
					}
				}
			}
			count_high++;

			for(int i = 0;i < n;i++) {
				if(count_high < list_line.get(i)) {
					unfinish = true;
					break;
				}
			}

			if(!unfinish) {
				until = false;
			}

			if(isChain) {
				isChain = false;
				count++;
			}
			unfinish = false;
		}

		System.out.println(count);
	}
}


Measured memory_bytes: 35576
N, K = map(int, input().split())

ans = 0
for i in range(1, N+1):
  cnt, score = 0, i
  if i >= K:
    ans += 1.0/N
  else:
    while score < K:
      score *= 2
      cnt += 1
    ans += (1.0/N) * (1/2)**cnt
print(ans)

Measured memory_bytes: 3060
using System;
    class ABC136_A
    {
        static void Main(string[] args)
        {
            int a, b, c;
            string[] str = Console.ReadLine().Split(' ');
            a = int.Parse(str[0]);
            b = int.Parse(str[1]);
            c = int.Parse(str[2]);
            if (a - b >= c)
            {
                Console.Write(0);
            }
            else
            {
                Console.Write(c - a + b);
            }
        }
    }


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string x,y;
	int m,n,i,j;
	cin >> x >> y;
	m = x.length(); //use i for x
	n = y.length() ;//use j for y
	int dp[m+1][n+1] ; //rows  for x and coloumns for y
	for(i=0;i<=m;i++)
	{
		for(j=0;j<=n;j++)
		{
			if(i==0 || j==0)
			dp[i][j] = 0;
			else if(x[i-1] == y[j-1])
			dp[i][j] = 1 + dp[i-1][j-1];
			else
			dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
		}
	}
	if(dp[m][n] == 0)
	{
		cout << " "<<endl;
		return 0;
	}
	string res = "";
	for(i=m,j=n;i>0 && j>0;)
	{
		if(dp[i][j] != dp[i-1][j] && dp[i][j] != dp[i][j-1])
		{
			res.push_back(x[i-1]);
			i--;
			j--;
		}
		else if(dp[i][j-1] > dp[i-1][j])
		j--;
		else
		i--;
	}
	/*while(!s.empty())
	{
		cout<<s.top();
		s.pop();
	}
	return 0;*/
	reverse(res.begin(),res.end());
    cout<<res<<"\n";
    return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n;cin>>n;
  string s;cin>>s;
  int cr=0,cb=0;
  for(int i=0;i<n;i++){
    if(s[i]=='B')cb++;
    else cr++;
  }
  if(cr>cb)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_variables)]
        #[allow(unused_mut)]
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn read<T : std::str::FromStr>() -> Vec<T> {
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).unwrap();
    a.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

fn main() {
    let aaa: Vec<usize> = read();
    let n = aaa[0];
    let mut graph: Vec<Vec<usize>> = vec![vec![]; n];
    for _ in 0..n {
        let inputs: Vec<usize> = read();
        let v = inputs[0];
        let d = inputs[1];
        for i in 0..d {
            let value = inputs[i + 2];
            graph[v - 1].push(value - 1);
        }
    }

    let mut que: VecDeque<usize> = VecDeque::new();
    let mut dist: Vec<i32> = vec![-1; n];
    que.push_back(0);
    dist[0] = 0;
    while !que.is_empty() {
        let v = match que.pop_front() {
            Some(x) => x,
            _ => 0
        };
        let p = dist[v] + 1;

        for item in &graph[v] {
            if dist[*item] != -1 {continue;}
            dist[*item] = p;
            que.push_back(*item);
        }

    }

    for i in 0..n {
        println!("{} {}", i + 1, dist[i]);
    }
}



Measured memory_bytes: 5040
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <array>
#include <stack>
#include <tuple>

using namespace std;

template<typename ISTREAM>
void readGraphListAsMatrix(const size_t n, ISTREAM& cin, vector< vector<int> >& graphMatrix) {
	graphMatrix = vector< vector<int> >(n, vector<int>(n, 0));
	for (size_t i = 0; i != n; ++i) {
		size_t u;
		size_t k;
		cin >> u;
		cin >> k;
		for (size_t j = 0; j != k; ++j) {
			size_t v;
			cin >> v;
			graphMatrix.at(u - 1).at(v - 1) = 1;
		}
	}
}

void printMatrix(const vector< vector<int> >& graphMatrix) {
	const size_t n = graphMatrix.size();
	for (size_t i = 0; i != n; ++i) {
		const vector<int>& adj = graphMatrix.at(i);
		cout << adj.front();
		for (size_t j = 1; j != n; ++j) {
			cout << " " << adj.at(j);
		}
		cout << endl;
	}
}

template<typename T>
void execute(T& cin) {
	size_t n;
	cin >> n;
	vector< vector<int> > graphMatrix;
	readGraphListAsMatrix(n, cin, graphMatrix);
	stack<size_t> visitedNodeIDs;
	vector<vector<int>::iterator> searchBeginPos;
	searchBeginPos.reserve(n);
	for (auto& v : graphMatrix)searchBeginPos.push_back(v.begin());
	int time = 0;
	vector<pair<int, int>> timeStamp(n,make_pair(0,0));//pair<初回訪問時刻, 完了時刻>
	for (int i = 0; i != n; ++i) {
		pair<int, int>& dp = timeStamp.at(i);
		if (dp.first != 0)continue;
		visitedNodeIDs.push(i);
		dp.first = ++time;
		while (!visitedNodeIDs.empty()) {
			const int nodeID_1 = visitedNodeIDs.top();
			vector<int>& neighbourNodeList = graphMatrix.at(nodeID_1);
			vector<int>::iterator& searchStart = searchBeginPos.at(nodeID_1);
			while (true) {
				searchStart = find(searchStart, neighbourNodeList.end(),1);
				if (searchStart == neighbourNodeList.end()) {
					timeStamp.at(nodeID_1).second = time + 1;
					visitedNodeIDs.pop();
					break;
				}
				else {
					const size_t nextVisitID_1 = distance(neighbourNodeList.begin(), searchStart);
					++searchStart;
					if (timeStamp.at(nextVisitID_1).first == 0) {
						timeStamp.at(nextVisitID_1).first = time + 1;
						visitedNodeIDs.push(nextVisitID_1);
						break;
					}
				}
			}
			++time;
		}
	}
	for (int i = 0; i != n; ++i) {
		cout << i + 1 << " " << timeStamp.at(i).first << " " << timeStamp.at(i).second << endl;
	}
}

int main()
{

	execute(cin);


	return 0;
}


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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll ret = 0;
ll A, B, C;

void input() {
  IN(A);
  IN(B);
  IN(C);
}

void solve() {
  ll temp = B/A;
  ret = min(temp, C);
}

int main(void){
  input();
  solve();
  PRINT(ret);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;

ll a, b, q, k, x, y, mn, s[100005], t[100005];
int main() {
	int i, j;
	cin >> a >> b >> q;
	for(i=1; i<=a; i++) scanf("%lld", &s[i]);
	for(i=1; i<=b; i++) scanf("%lld", &t[i]);
	s[0] = t[0] = -1e18;
	s[a+1] = t[b+1] = 1e18;
	while(q--) {
		scanf("%lld", &k);
		x = lower_bound(s, s+a+2, k) - s;
		y = lower_bound(t, t+b+2, k) - t;
		mn = 1e18;
		for(i=x-1; i<=x; i++) for(j=y-1; j<=y; j++) {
			mn = min(mn, (ll)abs(k - s[i]) + (ll)abs(s[i] - t[j]));
			mn = min(mn, (ll)abs(k - t[j]) + (ll)abs(s[i] - t[j]));
		}
		printf("%lld\n", mn);
	}
	return 0;
}

Measured memory_bytes: 2816