akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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 T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    ll N,x;
    ll a[100010];
    cin>>N>>x;
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    ll cnt=0;
    for(int i=0;i<N-1;i++){
        if(a[i]+a[i+1]>x){
            cnt+=(a[i]+a[i+1])-x;
            if(a[i+1] >= a[i]+a[i+1] - x ){
            a[i+1]=x-a[i];
            }
            else{
                a[i]=x;
                a[i+1]=0;
            }
        }
        //cout<<cnt<<endl;
    }
    cout<<cnt<<endl;


    return 0;
}

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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

const ll MAX_N = 1000000000000001LL;

int main() {
  ll N;
  std::cin >> N;

  std::string alphabet = "abcdefghijklmnopqrstuvwxyz";
  ll sa = 26;

  std::vector<char> ans;
  while(true) {
    --N;
    int r = N % sa;
    N /= sa;
    ans.push_back(alphabet[r]);
    if(N == 0) break;
  }

  for(auto it = ans.rbegin(); it != ans.rend(); ++it) {
    std::cout << *it;
  }
  std::cout << "" << '\n';
}


Measured memory_bytes: 3628
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range (A+1):
    for j in range (B+1):
        for k in range (C+1):
            if 500*i+100*j+50*k==X:
                count+=1
print (count)

Measured memory_bytes: 3060
n=int(input())
lis=list(map(int,input().split()))
lis.sort()
a=(lis[0]+lis[1])/2
ans=[a]
if n>=3:
    for i in range(n-2):
        b=(ans[i]+lis[i+2])/2
        ans.append(b)

print(ans[n-2])


Measured memory_bytes: 3060
// #include <stdio.h>
// #include <string.h>
//#include <iostream>
#include <utility>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include <set>

using namespace std;
typedef pair<int, int> XY;// Pair型変数の宣言


    
int main()
{
  	int Nmax = 100;
    int A[Nmax];
    char String[Nmax];
    int N;
    int i,j,k;
    int len;   // 文字列の長さ
    int flag=0;
    double tmp;

    

        
    
    // 入力読込

    // 数列
   scanf("%d", &N);
   for(i=1;i<=N;i++){
        scanf("%d ",&A[i]);
    }
    
        // 文字列
//   scanf("%s", String);   
    
    
    // 文字列の長さをチェック
    // 文字列は配列の0からlen-1に格納されてる
//    len = strlen( String );
//  	printf("%d\n",len);
    
    tmp =0;
    for(i=1;i<=N;i++){
        tmp = tmp+ 1.0/double(A[i]);
    }
    
    printf("%f\n", 1.0/tmp);
    
 
  
        
  
  return 0;
   
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>

using namespace std;


int main() {
  int c, A, B;
  cin >> A >> B;
  c=0;
  for(int i=A;i<B+1;i++)
  {
    string s;
    s = to_string(i);
    if(s[0]==s[4] && s[1]==s[3])
    {
      c++;
    }
  }
  cout << c << endl;
  return 0;
}

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

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

  bool broken[N + 1] = {};
  int a;
  for (int i = 0; i < M; i++) {
    cin >> a;
    broken[a] = true;
  }

  long long ans = 0, prev1 = 1, prev2 = 0;
  for (int i = 1; i <= N; i++) {
    if (broken[i])
      ans = 0;
    else
      ans = (prev1 + prev2) % 1000000007;
    prev2 = prev1;
    prev1 = ans;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main() { 
   int num[3]; rep(i,3) cin >> num[i];
   sort(num, num+3);
   int res = ((num[2]-num[0]) + (num[2]-num[1]))/2;
   if(num[0]%2 != num[1]%2) res += 2;
   cout << res << ln;
}








Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int r,d,x;
	cin >> r >> d >>x;
	syc(r,2,5);
	syc(d,1,100);
	syc(x,d,200);
	int sum=0;
	for(int i=0;i<10;i++){
		sum=r*x-d;
		cout << sum << endl;
		x=sum;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

#define MAX 10000

int main(void){

	long n, m, S = 0;
	scanf("%ld", &n);
	long a[n];
	for (int i = 0; i < n; i++){
		scanf("%ld", &a[i]);
	}

	for (long i = 0; i < n - 1; i++){
		for (long j = 0; j < n - 1; j++){
			if (a[j]>a[j + 1]){
				m = a[j];
				a[j] = a[j + 1];
				a[j + 1] = m;
			}
		}
	}

	for (long i = 0; i < n; i++){
		S += a[i];
	}

	printf("%ld %ld %ld\n", a[0], a[n - 1], S);

	return 0;
}

Measured memory_bytes: 3256
import java.util.Scanner;

public class Main {
    private static Scanner sc;

    public Main() {
    }

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

    }

    private void solve() {
        int N = sc.nextInt();
        int K = sc.nextInt();
        int ans = 1;
        for (int i = 0; i < N; i++) {
            if (2 * ans < ans + K) {
                ans *= 2;
            } else {
                ans += K;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <stdio.h>

int main()
{
	int a,b,c,n;
	
	scanf("%d", &n);
	
	while(n-- > 0){
		scanf("%d %d %d", &a, &b, &c);
		
		if(a > b && a > c){
			if(a * a == c * c + b * b){ 
				printf("YES\n");
				continue;
			}
		}
		else if(b > a && b > c){
			if(b * b == a*a + c*c){
				printf("YES\n");
				continue;
			}
		}
		else if(c > a && c > b){
			if(c * c == a*a + b*b){
				 printf("YES\n");
				 continue;
			}
		}
		printf("NO\n");
	}
	
	return(0);
}

Measured memory_bytes: 580
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
    
    while(x!=NIL){
        y=x;
        if(z->key < x->key) x=x->left;
        else x=x->right;
    }
    z->parent=y;
    if(y==NIL) root=z;
    else if(z->key < y->key) y->left=z;
    else y->right=z;
    
}

void inorder(Node u){
    if(u->left != NIL){
    inorder(u->left);
  }
  printf(" %d",u->key);
  if(u->right != NIL) inorder(u->right);
}

void preorder(Node u){
    printf(" %d",u->key);
    if(u->left != NIL){
        preorder(u->left);
    }
    if(u->right != NIL){
        preorder(u->right);
    }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } 
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
  }

  return 0;
}

Measured memory_bytes: 24040
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll n = in(), q = in();
	string s; cin >> s;

	vector<ll>ac(n);
	REP(i, n - 1) {
		if (s[i] == 'A' && s[i + 1] == 'C') {
			++ac[i];
		}
	}
	REPR1(i, n - 1) {
		ac[i - 1] += ac[i];
	}

	REP(i, q) {
		ll l = in() - 1, r = in() - 1;
		cout << ac[l] - ac[r] << endl;
	}
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	//座圧
	vector<vector<int>>v(n + 1);
	//要素数nの配列aがある
	vector<int> p(m), y(m);
	for (int i = 0; i < m; ++i) {
		cin >> p[i] >> y[i];
		v[p[i]].push_back(y[i]);
	}
	repp(i, 1, n + 1)sort(v[i].begin(), v[i].end());
	
	int k = 0;
	for (int i = 0; i < m; ++i) {
		int id = lower_bound(v[p[i]].begin(), v[p[i]].end(), y[i]) - v[p[i]].begin();
		printf("%06ld%06ld\n",p[i],id+1);
	}
	return 0;
}


Measured memory_bytes: 7808
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  ll W, H, x, y;
  while (cin >> W >> H >> x >> y) {
    double area = H * W * 0.5;
    printf("%.20f %d\n", area, 2 * x == W && 2 * y == H);
  }
  return 0;
}


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

int A, B, C;
int main() {
    cin >> A >> B >> C;
    int res = 0;
    int cur = 0;
    for (int i = 1;; ++i) {
        cur += A;
        if (i % 7 == 0) cur += B;
        if (cur >= C) {
            res = i;
            break;
        }
    }
    cout << res << endl;
}



Measured memory_bytes: 3112
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn run() {
    input! {
        a: i64,
        b: i64,
        x: i64,
    }
    let mut ans = 0;
    ans += b / x + 1;
    if a > 0 {
        ans -= (a - 1) / x + 1;
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
package main

import "fmt"

func main() {
	var n, k int
	var s string
	fmt.Scan(&n, &s, &k)
	for i := 0; i < len(s); i++ {
		if s[i] != s[k-1] {
			fmt.Print("*")
		} else {
			fmt.Print(string(s[i]))
		}
	}
	fmt.Println()
}


Measured memory_bytes: 512
import java.io.*;
import java.util.*;
import java.lang.Math;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int A[] = new int[20];
        for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        }

        Boolean dp[][] = new Boolean[21][2001];
        for(int i = 0; i < 21; i++)for(int j = 0; j <= 2000; j++)dp[i][j] = false;
        dp[0][0] = true;
        for(int i = 0; i < n; i++){
            for(int j = 0; j <= 2000; j++){
                if(dp[i][j]){
                    dp[i + 1][j] = true;
                    if(j + A[i] <= 2000){
                        dp[i + 1][j + A[i]] = true;
                    }
                }
            }
        }

        int q = sc.nextInt();
        for(; q > 0; q--){
            int m = sc.nextInt();
            if(dp[n][m])System.out.println("yes");
            else System.out.println("no");
        }

    }
  
}


Measured memory_bytes: 26716
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////
LL N;//10^5
vector<int> A;

class BITree {//1-index
	int N;
	vector<LL> bit;
public:
	BITree(int n) {
		N = n;
		bit = vector<LL>(N + 1, 0);//1-index
	}
	void add(int a, LL w) {//aにwを足す
		if (a <= 0 || N < a) return;//a:[1,N]
		for (int i = a; i <= N; i += i & -i) {
			bit[i] += w;
		}
	}
	LL sum(int a) {//[1,a]の和,a:[1,N]
		/*
		1番目からa番目までの和、1-index
		*/
		LL ret = 0;
		if (a > N) a = N;
		for (int i = a; i > 0; i -= i & -i) {
			ret += bit[i];
		}
		return ret;
	}
};

bool check(LL mid) {
	vector<int> B(N,0);

	//1,-1変換
	for (int i = 0; i < N; ++i) {
		if (A[i] >= mid) {
			B[i] = 1;
		}
		else {
			B[i] = -1;
		}
	}

	//累積和
	vector<int> C(N + 1, 0);
	LL Min = 0;
	for (int i = 0; i < N; ++i) {
		C[i + 1] = C[i] + B[i];
		if (Min > C[i + 1]) {
			Min = C[i + 1];
		}
	}
	
	if (Min <= 0) {
		for (int i = 0; i <= N; ++i) {
			C[i] -= (Min-1);
		}
	}
	LL MAX = 0;
	for (int i = 0; i <= N; ++i) {
		if (MAX < C[i]) {
			MAX = C[i];
		}

	}
	
	//Cの転倒数
	LL ans = 0;
	BITree bit(MAX + 1);//
	for (int i = 0; i <= N; ++i) {
		ans += bit.sum((int)C[i]);
		bit.add((int)C[i], 1);
	}
	//ans;
	
	
	if (ans >= (N*(N+1)/4) ) {
		return true; 
	}
	return false;
}
void solve() {
	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	if (N == 1) {
		cout << A[0] << endl;
		return;
	}
	if (N == 2) {
		int ret = A[0];
		if (A[0] < A[1]) {
			ret = A[1];
		}
		cout << ret << endl;
		return;
	}
	/////////////////
	LL L, R,mid;
	L = 1;
	R = INF+1;
	while (L + 1 < R) {
		mid = (L + R) / 2;
		if (check(mid)) {
			L = mid;
		}
		else {
			R = mid;
		}
	}
	cout << L << endl;
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 2320
#include <stdio.h>
int main()
{
  int i, j, H, W;
  for(;;){
    scanf("%d %d", &H, &W);
    if(H == 0 && W == 0)break;
    for(i = 0; i < H; i++){
      for(j = 0; j < W; j++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

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

std::vector<bool > canuse(10, true);


bool irohaok(int n){
  std::vector<int > digit;
  while(n>0){
    digit.push_back(n%10);
    n /= 10;
  }
  bool ok=true;
  for (int i=0; i<digit.size(); i++){
    if (!canuse[digit[i]]){
      ok=false;
      break;
    }
  }
  return ok;
}

int main(){
  int N, K;
  scanf("%d", &N);
  scanf("%d", &K);
  for (int i=0; i<K; i++){
    int D;
    scanf("%d", &D);
    canuse[D]=false;
  }
  for (int i=N; i<11*N; i++){
    if (irohaok(i)){
      std::cout << i << std::endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod=1000000007;
int n,m,dp[5005][5005];
char s[5005];
inline int ksm(int x,int n) {
    int ret=1;
    while (n) {
        if (n&1) ret=1ll*ret*x%mod;
        n>>=1;
        x=1ll*x*x%mod;
    }
    return ret;
}
int main()
{
    scanf("%d%s",&n,s+1);
    m=strlen(s+1);
    dp[0][0]=1;
    for (int i=1;i<=n;++i) {
        dp[i][0]=(dp[i][0]+dp[i-1][0])%mod;
        for (int j=0;j<=i;++j) {
            if (j) dp[i][j]=(dp[i][j]+2*dp[i-1][j-1]%mod)%mod;
            dp[i][j]=(dp[i][j]+dp[i-1][j+1])%mod;
        }
    }
    int res=1ll*dp[n][m]*ksm(ksm(2,m),mod-2)%mod;
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 70648
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello
{

    public static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        int ans = 0;
        int A = int.Parse(s[0]);
        int B = int.Parse(s[1]);
        int C = int.Parse(s[2]);
        int D = int.Parse(s[3]);

        int min = A;
        if (A < C) {
            min = C;
        }

        int max = D;
        if (B < D) {
            max = B;
        }
        ans = max - min;
        if (0 >= max - min) ans = 0;
        Console.WriteLine(ans);
    }
}

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

  int main(){
    int N, D;
    cin >> N >> D;
    int D2 = 2 * D + 1;
    int a = N % D2;
    
    if(a == 0){
    cout << N / D2 << endl;
    }
    else if(a != 0){
    cout << (N - a)/ D2 + 1 << endl;
    }
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=100005;
int n,m,a[N],s[N],v[N],k,ans,l,r,sz;
signed main()
{
	cin>>n>>a[1]>>m;
	s[1]=a[1];
	for(k=2;;k++)
	{
		a[k]=a[k-1]*a[k-1]%m;
		if(v[a[k]])
		{
			l=v[a[k]];
			r=k-1;
			sz=r-l+1;
			break;
		}
		s[k]=s[k-1]+a[k];
		v[a[k]]=k;
	}
	if(n<=l)
	{
		cout<<s[n]<<endl;
		return 0;
	}
	ans+=s[l-1];
	n-=l-1;
	ans+=n/sz*(s[r]-s[l-1]);
	ans+=s[l+n%sz-1]-s[l-1];
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  int N;
  cin >>N;
  
  int sum =0;
  int sum2 =0;
  
  for (int i=0; i<N;i++){
    int x;
    cin >>x;
    sum += x;
    sum2 += x*x;
  }
  
  int P = sum/N;
  int Q = P+1;
  
  if(N*P*P-2*P*sum+sum2<=N*Q*Q-2*Q*sum+sum2){
    cout<<N*P*P-2*P*sum+sum2<<endl;
  }
  else{
    cout<<N*Q*Q-2*Q*sum+sum2<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,takahashi=0,aoki=0;
cin>>a>>b>>c>>d;
while(a>0){
    a-=d;
    takahashi++;
}
while(c>0){
    c-=b;
    aoki++;
}
if(takahashi>=aoki) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=2e5+10;
const int mod=1e9+7;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,d;
    cin>>n>>d;
    ll D=d*d;
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        ll x,y;
        cin>>x>>y;
        if((x*x+y*y)<=D)
        {
            cnt++;
        }
    }
    cout<<cnt<<'\n';



}


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

using namespace std;

int n,a[100010],k1,k2;

int main()
{
	scanf("%d",&n);
	k1=n;
	k2=0;
	for(int i=1; i<=n; i++)
	{
		scanf("%d",&a[i]);
		k1=min(k1,a[i]);
		k2=max(k2,a[i]);
	}
	if(k2-k1>1)printf("No");
	else
	{
		if(k1==k2)
		{
			if((n/k1)>=2||n==(k1+1))printf("Yes");
			else printf("No");
		}
		else
		{
			int x=0,y=0;
			for(int i=1; i<=n; i++)
			{
				if(a[i]==k1)x++;
				else y++;
			}
			if(y>1&&x+1<=k2&&(y/(k2-x))>=2)printf("Yes");
			else printf("No");
		}
	}
	return 0;
}

Measured memory_bytes: 640
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

type Graph = Vec<Vec<Edge>>;

#[derive(Debug, Clone, Copy)]
struct Edge {
    to: usize,
    cost: i64
}

fn main() {
    let n: usize = read();
    let mut graph: Graph = vec![vec![]; n];
    for _ in 0..n-1 {
        let (f, t, c): (usize, usize, i64) = read();
        graph[f-1].push(Edge { to: t-1, cost: c });
        graph[t-1].push(Edge { to: f-1, cost: c });
    }

    let (q, k): (usize, usize) = read();
    let mut distances: Vec<i64> = vec![0; n];


    dfs(k-1, n, 0, &graph, &mut distances);

    for _ in 0..q {
        let (from, to): (usize, usize) = read();
        println!("{}", distances[from-1] + distances[to-1]);
    }
}

fn dfs(from: usize, par: usize, cost: i64, graph: &Graph, dist: &mut Vec<i64>) {
    dist[from] = cost;
    for &edge in &graph[from] {
        if edge.to == par {
            continue
        }
        dfs(edge.to, from, cost + edge.cost, graph, dist);
    }
}

Measured memory_bytes: 22396
#include <iostream>
#include <vector>
#include <array>
#include <cmath>
#include <string>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {

  ll N, K;
  std::cin >> N >> K;
  std::vector<std::pair<ll, ll>> S(N);
  for(int i=0; i<N; i++) std::cin >> S[i].second >> S[i].first;
  std::sort(S.rbegin(), S.rend());

  std::vector<ll> cnt(N + 1);
  ll ans = 0, tmp = 0, x = 0;
  std::priority_queue<std::pair<ll, ll>, std::vector<std::pair<ll, ll>>, std::greater<std::pair<ll, ll>>> pq;
  for(ll i = 0; i < K; ++i){
    tmp += S[i].first;
    if( !cnt[S[i].second] ) x++;
    else pq.push(S[i]);
    cnt[S[i].second]++;
  }

  ans = std::max(ans, tmp + x * x);
  for(auto i = K; i < N && x <= K; ++i){
    if( cnt[S[i].second] ) continue;
    if ( pq.empty() ) break;
    auto t = pq.top();
    pq.pop();
    tmp -= t.first;
    cnt[t.second]--;
    tmp += S[i].first;
    cnt[S[i].second]++;
    x++;
    ans = std::max(ans, tmp + x * x);
  }

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

Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int r, D, x;
  cin >> r >> D >> x;

  rep(i,10){
    x = r * x - D;
    cout << x << endl;
  }
}


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

using i64 = int64_t;

constexpr i64 MOD = 998244353;

int main(){
    i64 n, s;
    cin >> n >> s;
    vector<i64> v;
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
    }

    vector<vector<i64>> dp(n+1, vector<i64>(s+1));
    for(int i=0;i<=n;++i)dp[i][0] = 1;
    for(int i=0;i<n;++i){
        for(int j=0;j<=s;++j){
            dp[i+1][j] += dp[i][j];
            dp[i+1][j] %= MOD;
            if(j+v[i] > s)continue;
            dp[i+1][j+v[i]] += dp[i][j];
            dp[i+1][j+v[i]] %= MOD;
        }
    }

    i64 ans = 0;
    for(int i=1;i<=n;++i){
        ans += dp[i][s];
        ans %= MOD;
        //cerr << dp[i][s] << " " << ans << endl;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1'000'000'007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

int main()
{
    string s;
    ll k;
    cin >> s >> k;
    int n = s.size();
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'a')
        {
            continue;
        }
        if ('z' - s[i] + 1 <= k)
        {
            k -= ('z' - s[i] + 1);
            s[i] = 'a';
        }
    }
    k %= 26;
    s[n - 1] += k;
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
#define endl '\n';
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod2 = 1000000007;
constexpr ll mod = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int N;
vector<string> S(210);
vector<int> color(210,0);
bool dfs(int v,int c){
  color[v] = c;
  for(int nv=0; nv<N; nv++){
    if(S[v][nv] == '0') continue;
    if(nv == v) continue;
    if(color[nv] == c){
      return false;
    }
    if(color[nv]==0 and !dfs(nv,-c)) return false;
  }
  return true;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> S[i];
  }
  vector<vector<int>> G(N, vector<int> (N,inf));
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(i == j){
        G[i][j] = 0;
      }
      if(S[i][j] == '1'){
        G[i][j] = 1;
      }
    }
  }
  if(!dfs(0,1)){
    cout << -1 << endl;
    return 0;
  }
  for(int k=0; k<N; k++){
    for(int i=0; i<N; i++){
      for(int j=0; j<N; j++){
        chmin(G[i][j],G[i][k]+G[k][j]);
      }
    }
  }
  int ans = 0;
  for(int i=0; i<N; i++){
    for(int j=i+1; j<N; j++){
      chmax(ans,G[i][j]);
    }
  }
  cout << ans+1 << endl;
  return 0;
}


Measured memory_bytes: 512
var n,k,w = new Array(100000);


function judge(p){
    i = 0;
    for(var j = 0;j < k;j++){
        var sum = 0;
        while(i < n && sum + w[i] <= p)
            sum += w[i++];
    }
    if(i == n)
        return true;
    else
        return false
}


function Main(input){
    input = input.split("\n");

    input[0] = input[0].split(" ");
    n = parseInt(input[0][0],10);
    k = parseInt(input[0][1],10);
    for(var i = 1;i <= n;i++){
        w[i - 1] = parseInt(input[i],10);
    }
    var max = 0;
    for(var i = 0;i < n;i++){
        if(max < w[i])
            max = w[i];
    }

    var left = 0;right = Math.floor(n / k) + 1;
    right *= max;

    while(right - left > 1){
        var mid = Math.floor((right + left) / 2);
        if(judge(mid))right = mid;
        else left = mid;
    }
    console.log(right);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

ll get(ll x, ll y) {
  return (x / y);
}

int main() {
  ll n, m; cin >> n >> m;
  ll total = (n - m) * 100ll + m * 1900ll;
  ll cur = 1ll;
  while(m--) cur *= 2ll;
  cout << total * cur << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
typedef pair<P,int>P2;
#define fi first
#define se second
 
typedef unsigned long long ull;
 
 
struct RollingHash{
  typedef unsigned long long ull;
  string S;
  ull B;
  int len;
  vector<ull> hash,p;
  RollingHash(){}
  RollingHash(string S_,ull B_=1000000009LL):
    S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){
    hash[0]=0;p[0]=1;
    for(int i=0;i<len;i++){
      hash[i+1]=hash[i]*B+S[i];
      p[i+1]=p[i]*B;
    }
  }
  //S[l,r)
  ull find(int l,int r){
    return hash[r]-hash[l]*p[r-l];
  }
};
 
signed main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  string t=s;
 
   set<char>st;
  r(i,n){
    st.insert(s[i]);
  }
 
  reverse(t.begin(),t.end());
 
  if(st.size()==1){
    cout<<2<<endl;
    return 0;
  }
 
  RollingHash S(s);
  RollingHash T(t);
 
  for(int i=2;i<=n;i++){
 
    int idx=0 , F=0 ;
    ull A=S.find(0,i);
 
    for(int j=0;;j++){
 
      if(j%2==0){
 
        if(idx+i>n){//cout<<j<<endl;
          int x=n-idx;
          ull has=S.find(0,x);
 
          if(S.find(idx,n)!=has){
            F++;
            break;
          }
        }
 
        else{
        if(S.find(idx,idx+i) != A){
          F++;
          break;
        }}
      }
 
      else{
 
        if(n-idx-i<0){
 
          ull has=S.find(i-(n-idx),i);
 
          //cout<<i-n-idx<<' '<<i<<endl;
 
          if(T.find(0,n-idx)!=has){
            F++;
            break;
          }
        }
 
        else{
        if(T.find(n-idx-i,n-idx) != A){
          //cout<<n-idx-i<<' '<<n-idx<<endl;
          F++;
          break;
        }}
      }
 
      idx+=i-1;
 
      //cout<<idx<<endl;
 
      if(idx>n)break;
    }
 
    //cout<<idx<<' '<<i<<endl;
    if(!F){
 
      cout<<i<<endl;
      return 0;
 
    }
  }
 
}


Measured memory_bytes: 39128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)

int		main(void)
{
	int a, b;
	cin >> a >> b;
	cout << a / b << " " << a % b << " ";
	printf("%f\n", a / (double)b);
	return (0);
}



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

using namespace std;

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

  set<int> c;
  while (c.count(s) == 0) {
    c.insert(s);
    if (s % 2 == 0)
      s /= 2;
    else
      s = 3 * s + 1;
  }
  cout << c.size() + 1 << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int n,k;
		cin >> n >> k;
		int h[n];
		rep(i,0,n) cin >> h[i];
		int dp[n];
		dp[0] = 0;
		rep(i,1,n){
			dp[i] = INF;
			for(int j=i-1; j>=0&&j>=i-k;j--){
				dp[i] = min(dp[i], dp[j]+abs(h[i]-h[j]));
			}
		}
		cout<<dp[n-1];
	}
}

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


int main() 
{ 
    ios_base::sync_with_stdio(0) ;
    cin.tie(0); cout.tie(0) ;
    
    int n,Max=0,d=0;
    cin >> n;
    long a[n] ;
    for( int i = 0 ; i < n ; i ++ ) 
    {
    	cin >> a[i];
	}
	for( int i = 0 ; i < n-1 ; i ++ )
	{
		if( a[i] >= a[i+1] ) d++;
		else 
		{
			Max = max(Max,d) ;
			d=0 ;
		}
	}
	Max = max(Max,d) ;
	cout << Max ; 
    return 0; 
}  

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;


int main(){
  int n,k,r,p,s;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  ll ans = 0;
  string st;
  rep(i,n){
    if(i<k || t[i]!=t[i-k] || (t[i]==t[i-k] && st[i-k]=='Z')){
      if(t[i]=='s'){ st.push_back('r'); ans+= r; continue; }
      if(t[i]=='p'){ st.push_back('s'); ans+= s; continue; }
      if(t[i]=='r'){ st.push_back('p'); ans+= p; continue; }
    }
    st.push_back('Z');
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int H, W;

void fill_y(vector<vector<int>> &V, int sy, int ey, int x, int cnt){
    for(int i=sy; i<ey; i++){
        V[i][x] += cnt;
    }
    return;
}

void fill_x(vector<vector<int>> &V, int sx, int ex, int y, int cnt){
    for(int i=sx; i<ex; i++){
        V[y][i] += cnt - 1;
    }
    return;
}



int main() {
    cin >> H >> W;
    vector<string> S(H);
    for(string &s:S){
        cin >> s;
    }
    vector<vector<int>> V(H, vector<int>(W));

    for(int i=0; i<W; i++){
        for(int j=0; j<H; j++){
            int sy = j;
            int cnt = 0;
            while(j<H && S[j][i] != '#'){
                cnt++;
                j++;
            }
            
            fill_y(V, sy, j, i, cnt);
        }
    }
    
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            int sx = j;
            int cnt = 0;
            while(j<W && S[i][j] != '#'){
                cnt++;
                j++;
            }
            
            fill_x(V, sx, j, i, cnt);
        }
    }
    
    int ans = 0;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            ans = max(ans, V[i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 20352
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e18;
const double PI=3.1415926535897932;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod


const ll MAXN=1000010;

ll bit[MAXN];
void add(ll a, ll w) {
for (ll x = a; x <= MAXN; x += (x & -x)) bit[x] += w;
}
ll sum(ll a) {
 ll ret = 0;
for (ll x = a; x > 0; x -= (x & -x)) ret += bit[x];
 return ret;
}

vector<P> d[MAXN];
int main(){
    ll N,Q; cin>>N>>Q;
    vec c(N+1);
    REP(i,1,N+1) cin>>c[i];
    rep(i,Q){
        ll l,r; cin>>l>>r; 
        d[r].pb(mp(l,i));
    }
    vec G(N+1,-1);
    vec ans(Q);
    REP(i,1,N+1){
        //cout<<i<<':'<<c[i]<<endl;
        add(i,1);
        if(G[c[i]]>=0) add(G[c[i]],-1);
        G[c[i]]=i;
        ll X=sum(i);
        rep(j,d[i].size()){
            ll LL=d[i][j].first, QQ=d[i][j].second;
            //cout<<LL<<'|'<<i<<'|'<<QQ<<endl;
            ans[QQ]=X;
            if(LL>1) ans[QQ]-=sum(LL-1);
        }
    }
    rep(i,Q) cout<<ans[i]<<endl;

}

Measured memory_bytes: 56012
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

template<typename T> void remove(std::vector<T>& vector, unsigned int index)
{ vector.erase(vector.begin() + index); }


int main() {
  ll N, K;  cin >> N >> K;
  vector<ll> h(N);  rep(i, N) cin >> h[i];

  sort(all(h));
  reverse(all(h));
  ll cnt = 0;
  rep(i, N) {
    if (h[i] < K) break;
    cnt++;
  }

  print(cnt);

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
class UnionFind {
private:
	int siz;
	vector<int> rank, par;
public:
	UnionFind(){}
	UnionFind(int n):siz(n), rank(n, 1), par(n, 0) {
		iota(par.begin(), par.end(), 0);
	}
	int find(int x) {
		return (x == par[x] ? x : par[x] = find(par[x]));
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(rank[x] < rank[y]) swap(x, y);
		rank[x] += rank[y];
		par[y] = x;
	}
};

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

	int n, l, k;
	cin >> n >> k >> l;
	UnionFind a(n), b(n);
	for(int i = 0; i < k; i++) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		a.unite(x, y);
	}
	for(int i = 0; i < l; i++) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		b.unite(x, y);
	}
	map<pair<int, int>, int> mp;
	for(int i = 0; i < n; i++) {
		mp[make_pair(a.find(i), b.find(i))]++;
	}
	for(int i = 0; i < n; i++) {
		if(i > 0) cout << " ";
		cout << mp[make_pair(a.find(i), b.find(i))];
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 15104
#include<stdio.h>
int main(void){
    int n, i;
    float x1, x2, x3, x4, y1, y2, y3, y4, x, y;
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ) {
        scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        if ( ( y2 - y1 ) / ( x2 - x1 ) == ( ( y4 - y3 ) / ( x4 - x3 ) ) )printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	string t = s[0] + s;
	int bound = s.l_ength();
	int cnt = 0;
	for( int i = 1; i <= bound; ++i ){
		if( t[i-1] != t[i] ) ++cnt;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 512
MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)

def main():
    x = int(input())
    a = 100
    cnt = 0
    while a < x:
        a = a*101//100
        cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()


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

const int MOD = 1000000007;
typedef pair<long long, long long> Pairs;

long long n;
map<long long,int> dp;

inline void Add(int &x, int a) {
    x += a; while (x >= MOD) x -= MOD;
}
inline int Calc(long long v)
{
    if (v < 0) return 0;
    if (!v) return 1;
    if (dp.count(v)) return dp[v];
    int res = 0;
    Add(res, Calc(v >> 1));
    Add(res, Calc((v - 1) >> 1));
    if (v >= 2) Add(res, Calc((v - 2) >> 1));
    return dp[v] = res;
}

int main(void) {
    //freopen("1.in", "r", stdin);
    cin >> n;
    cout << Calc(n) << endl;
    return 0;
}

Measured memory_bytes: 256
a = []
for _ in range(5):
    a.append(int(input()))
res = 0
last_num = a[0]
for i in range(5):
    if a[i] % 10 == 0:
        res += a[i]
    else:
        if last_num % 10 == 0:
            last_num = a[i]
        elif a[i] % 10 < last_num % 10:
            last_num = a[i]
        res += (a[i] // 10 + 1) * 10

if last_num % 10 != 0:
    res -= 10 - last_num % 10
print(res)


Measured memory_bytes: 9076
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    sort(p.begin(), p.end());

    int ans = 0;
    rep(i, k){
        ans += p[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

typedef struct edge{ll s,g;}E;
int edgehikaku(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}

ll n,m;
E e[200010];
int id[100010];
void readgraph(){
	scanf("%lld%lld",&n,&m);
	rep(i,0,m){
		ll x,y;
		scanf("%lld %lld",&x,&y);
		x--,y--;
		e[2*i].s=x;
		e[2*i].g=y;
		e[2*i+1].s=y;
		e[2*i+1].g=x;
	}
	m*=2;
	qsort(e,m,sizeof(E),edgehikaku);

	int p=0;
	rep(i,1,n){
		while(p<m&&e[p].s<i)p++;
		id[i]=p;
	}
	id[n]=m;
}


ll v[100010];
ll d[100010];
ll c[100010];
ll dp[100010][2];
//dp[v][*]……vの色はdp[v][0]であり、vから距離dp[v][1]以内の頂点は既に全部塗った

void dfs(ll vv,ll dd,ll cc){
	if(!dp[vv][0])dp[vv][0]=cc;
	if(dp[vv][1]>=dd)return;
	dp[vv][1]=dd;
	rep(i,id[vv],id[vv+1])dfs(e[i].g,dd-1,cc);
}

int main(){
	readgraph();
	int q;
	scanf("%d",&q);
	rep(i,0,q){
		scanf("%lld%lld%lld",v+i,d+i,c+i);
		v[i]--;
	}
	for(int i=q-1;i>=0;i--)dfs(v[i],d[i],c[i]);
	rep(i,0,n)printf("%lld\n",dp[i][0]);
	
}

Measured memory_bytes: 8004
#include<bits/stdc++.h>
using namespace std;
long long int fnc(int dp[],int h[],int n,int i)
{
  if(dp[i]==-1)
  {
  if(i<n-2)
  {
    dp[i]= min(abs(h[i]-h[i+1])+fnc(dp,h,n,i+1),abs(h[i]-h[i+2])+fnc(dp,h,n,i+2));
  }
  else if(i==n-2)
  {
    dp[i]= abs(h[i]-h[i+1]);
  }
  else
  {
    dp[i]=0;
  }
  }
  return dp[i];
}
int main()
{
  int n;
  cin>>n;
  int h[n];
  int i=0;
  while(i<n)
  {
    cin>>h[i];
    i++;
  }
  int dp[n];
  memset(dp,-1,sizeof(dp));
  cout<<fnc(dp,h,n,0)<<endl;
  return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
	long long n,a[10],b[10];
	cin>>n;long long ans=1e17;
	for(int i=0;i<5;i++) cin>>a[i],ans=min(a[i],ans);
	if(n%ans) cout<<n/ans+5;
	else cout<<n/ans-1+5;
} 


Measured memory_bytes: 256
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()));
        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)*}
    };
}

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

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 main() {
    input!{
        n: usize,
    };

    for i in 1..10{
        for j in 1..10{
            if n == i * j{
                println!("Yes");
                std::process::exit(0);
            }
        }
    }
    println!("No");  
}



Measured memory_bytes: 2128
import java.util.Scanner;
     
public class Main {
    	
    private final static Scanner sc = new Scanner(System.in);
    	
    public static void main(String[] arg) {
    	int N  = sc.nextInt();
        int pred = sc.nextInt();
      	int max = 0;
      	int tmp = 0;
      	for (int i = 0; i < N-1; i++) {
         	int now = sc.nextInt();
          	if(now <= pred) {
              	tmp++;
              	if(tmp > max) max = tmp;
            } else {
              tmp = 0;
            }
          	pred = now;
        }  
      	System.out.println(max);
   	}
}

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

int main() {
    int A, B, C, X, Y, Z;
    int work = 0;

    cin >> X >> Y >> Z;

    A = Z;
    B = X;
    C = Y;

    cout << A << " " << B << " " << C << endl;

}

Measured memory_bytes: 256