akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String[] line;
      MyList list = new MyList();

      for(int i=0; i<n; i++) {
        line = br.readLine().split(" ");
        switch( line[0] ) {
          case "insert" :
            list.insertFirst( Integer.parseInt(line[1]) );
            break;
          case "delete" :
            list.delete( Integer.parseInt(line[1]) );
            break;
          case "deleteFirst" :
            list.deleteFirst();
            break;
          case "deleteLast" :
            list.deleteLast();
            break;
          default :
            System.out.println("n:" + i + " is failed.");
        }
      }

      System.out.println ( list.getAllElements() );
    }
  }
}

class Node {
  Node next,prev;
  int key;

  public Node(int key) {
    this.key = key;
  }
}

class MyList {
  Node nil;
  Node current;
  int size;

  public MyList() {
    nil = new Node(0);
    nil.next = nil.prev = nil;
    size = 0;
  }

  public String getAllElements() {
    StringBuilder buf = new StringBuilder(size*3);

    if(size > 0){
      current = nil.next;
      for(int i=0; i<size; i++){
        buf.append(current.key).append(" ");
        current = current.next;
      }
    }
    buf.setLength(buf.length()-1);

    return buf.toString();
  }
  public void insertFirst(int x) {
    if(size == 0) {
      current = new Node(x);
      nil.next = current;
      nil.prev = current;
      current.prev = nil;
      current.next = nil;
      size++;
    }
    else {
      Node add = new Node(x);
      
      current.prev.next = add;
      add.prev = current.prev;

      add.next = current;
      current.prev = add;

      current = add;
      size++;
    }
  }
  public void deleteFirst() {
    nil.next = current.next;
    current.next.prev = current.prev;

    current = current.next;
    size--;
  }
  public void deleteLast() {
    current = nil.prev;

    nil.prev = current.prev;
    current.prev.next = current.next;

    current = nil.next;
    size--;
  }
  public void delete(int x) {
    Node target = findFirst(x);

    if(target == nil) current = current.next;
    else {
      current.prev.next = target.next;
      current.next.prev = target.prev;
      current = nil.next;
      size--;
    }
  }
  private Node findFirst(int x) {
    while(current != nil) {
      if(current.key == x) break;
      current = current.next;
    }

    return current;
  }
}


Measured memory_bytes: 188808
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
#include <utility>
#include <queue>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926435;

class UnionFind
{
public:
    UnionFind(int N) : par(N)
    {
        for (ll i = 0; i < N; i++)
        {
            par[i] = i;
        }
    }

    int root(int x)
    {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        par[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

private:
    vector<int> par;
};

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

ll fact(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return 1;
    }
    return n * fact(n - 1) % MOD;
}

ll pow_fast(ll n, ll k)
{
    if (k == 0)
    {
        return 1;
    }
    if (k == 1)
    {
        return n;
    }

    if (k % 2 == 0)
    {
        ll tmp = pow_fast(n, k / 2LL);
        return tmp * tmp % MOD;
    }
    else
    {
        ll tmp = pow_fast(n, k / 2LL);
        tmp *= tmp;
        tmp %= MOD;
        return tmp * n % MOD;
    }
}

map<ll, ll> sosuu(ll n)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            res[i] += 1;
            n /= i;
        }
    }
    if (n != 1)
    {
        res[n] += 1;
    }
    return res;
}

struct Dish
{
    ll time;
    ll taste;
};

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

    if ("a" <= a && a <= "z") {
        cout << "a" << endl;
    } else {
        cout << "A" << endl;
    }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  int counter = 0;
  cin >> S;
  int norm;
  int size = S.size();
  if(size>=0&&size<8){
    norm = 0;
  }
  else if(size>=8){
    norm = size - 7;
  }
  for(int i = 0; i < size; ++i){
    if(S[i] == 'o'){
      counter ++;
    }
  }
  if(counter >= norm){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef struct{
    int s,c;
}list;
int str_comp(const void*a,const void*b){return ((list*)a)->s-((list*)b)->s;}

int main(){
    list ss[10];
    int n,m;
    int num[10]={},number;
    int flg=0;
    int min,max;

    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d %d",&ss[i].s,&ss[i].c);
        num[ss[i].s-1]=ss[i].c;
        if(ss[i].s==1&&ss[i].c==0&&n>=2){
            printf("-1\n");
            return 0;
        }
    }
    qsort(ss,m,sizeof(list),str_comp);
    for(int i=1;i<m;i++){
        if(ss[i].s==ss[i-1].s){
            if(ss[i].c!=ss[i-1].c){
                printf("-1\n");
                return 0;
            }
        }
        
    }
    
    if(num[0]==0&&n>=2){
        num[0]=1;
    }
    if(n==1&&num[0]==0){
        printf("0\n");
        return 0;
    }
    number=0;
    for(int i=0;i<n;i++){
        number+=num[i]*(int)pow(10,n-i-1);
    }
    //printf("---------%d\n",number);
    min=max=1;
    for(int i=0;i<n-1;i++){
        min*=10;
    }
    max=min*10-1;
    for(int i=min;i<=max;i++){
        if(number==i){
            printf("%d\n",i);
            return 0;
        }
    }
    printf("-1\n");
    return 0;
}

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

#ifdef LOCAL
#include "prabh.hpp"
#endif

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define rrange(v) v.rbegin(), v.rend()
#define mod (int)(1e9 + 7)
#define inf (int)(5e18)
#define N (int)(2e5 + 10)

using namespace std;

void solve() {
	int n; cin >> n;
	vector<int> a(n);
	for (int &i : a) cin >> i;
	vector<vector<int>> dp(n, vector<int>(n));

	for (int l = n - 1; l >= 0; l--) {
		for (int r = l; r < n; r++) {
			if (l == r) dp[l][r] = a[l];
			else if (l + 1 == r) dp[l][r] = max(a[l], a[r]);
			else {
				int &ans = dp[l][r];
				ans = a[l] + min(dp[l + 2][r], dp[l + 1][r - 1]),
				ans = max(ans, a[r] + min(dp[l + 1][r - 1], dp[l][r - 2]));
			}
		}
	}

	int tot = accumulate(range(a), 0ll);
	int ans = 2 * dp[0][n - 1] - tot;
	cout << ans << endl;

}
// Remember to clear the global containers



// Got stuck and want to leave ? look at the bottom once..
int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
	// cin >> t_c;
	while (t_c--)
		solve();
}
/* Come on Dude .. Dont get up until u get the solution
 * Giving up not gonna help ryt ? So get ur lazy ass to code already
 * You can do it ... Stay Calm and Dont Panic :)
 */


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

int main() {
  int k,n;
  cin >> k >> n;
  vector<int> a(n);
  int max=0;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    if(0<i){
    int d = a.at(i)-a.at(i-1);
    if(d>max)
      max = d;
    }
  }
  if(k+a.at(0)-a.at(n-1)>max)
    max = k+a.at(0)-a.at(n-1);
    cout << k-max << endl;
}





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

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
//		String s = sc.next();
		int n = sc.nextInt();
		int k = sc.nextInt();

		ArrayList<Double> list = new ArrayList<>();
		for(int i=0;i<n;i++) {
			list.add(sc.nextInt()*0.5+0.5);
		}

		double ans = 0;

		double sum = 0;
		for(int i=0;i<=n-k;i++) {
			if(i==0) {
				for(int j=0;j<k;j++) {
					sum += list.get(i+j);
				}
				ans = sum;

			}else {

				sum -= list.get(i-1);
				sum += list.get(i+k-1);
				if(sum > ans) {
					ans = sum;
				}

			}

		}

		System.out.println(ans);



	}
}


Measured memory_bytes: 83496
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T>
void print(T& x){printf("%d\n", x);}
 
int main()
{
    vector<ll> vec;
    int n;
    cin >> n;
    int t, s;
    REP(i, n){
        scanf("%d", &t);
        if(t==0){
            scanf("%d", &s);
            vec.emplace_back(s);
        }else if(t==1){
            scanf("%d", &s);
            printf("%d\n", vec[s]);
        }else if(t==2){
            vec.pop_back();
        }
    }    
    return 0;
}


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

void trace(int N, int A[]) {
    if (N <= 0) return;
    cout << A[0];
    for (int i = 1; i < N; i++)
        cout << " " << A[i];
    cout << endl;
}

int intervalSize(int max) {
    int n = 1;
    int g = 1;
    while ( (g = 3 * g + 1) <= max) n++;
    return n;
}

void intervals(int gn, int gs[]) {
    if (gn <= 0) return;
    gs[gn - 1] = 1;
    for (int i = gn - 1; i > 0; i--) {
        gs[i - 1] = 3 * gs[i] + 1;
    }
}

int insertionSort(int N, int A[], int g) {
    int n_swapped = 0;
    for (int i = g; i < N; i++) {
        int v = A[i];
        int iBef = i - g;
        while (0 <= iBef && v < A[iBef]) {
            A[iBef + g] = A[iBef];
            iBef -= g;
            n_swapped++;
        }
        A[iBef + g] = v;
    }
    return n_swapped;
}

int shellSort(int N, int A[], int gn, int gs[]) {
    int n_swapped = 0;
    for (int i = 0; i < gn; i++) {
        n_swapped += insertionSort(N, A, gs[i]);
    }
    return n_swapped;
}

/* ALDS1_2_D: Shell Sort */
int main() {
    int N;
    cin >> N;

    int A[N];
    for (int i = 0; i < N; i++)
        cin >> A[i];

    int gn = intervalSize(N);
    int gs[gn];
    intervals(gn, gs);

    int n_swapped = shellSort(N, A, gn, gs);

    // Output results.
    cout << gn << endl;
    trace(gn, gs);
    cout << n_swapped << endl;
    for (int i = 0; i < N; i++)
        cout << A[i] << endl;

    return 0;
}

Measured memory_bytes: 5064
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
template<typename T> inline void in(T &e){cin>>e;}
template<typename T> inline void out(T e){cout<<e<<endl;}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

std::vector<int> par;  // 親
std::vector<int> ufrank; // 木の深さ

// n要素で初期化
void init(int n){
    par.resize(n);ufrank.resize(n);
    for(int i=0;i<n;i++){
        par[i]=i;
        ufrank[i]=0;
    }
}

// 木の根を求める
int find(int x){
    if(par[x]==x){
        return x;
    }else{
        return par[x]=find(par[x]);
    }
}

// xとyの属する集合を併合する
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y) return;

    if(ufrank[x]<ufrank[y]){
        par[x]=y;
    }else{
        par[y]=x;
        if(ufrank[x]==ufrank[y])ufrank[x]++;
    }
}

// xとyが同じ集合に属するか否か
bool same(int x,int y){
    return find(x)==find(y);
}

int n,m;
vi p,x,y;

signed main(){
    io();
    cin>>n>>m;
    p.resize(n+1);
    init(n+10);
    x.resize(m);y.resize(m);
    rep(i,n) in(p[i]);

    rep(i,m){
        cin>>x[i]>>y[i];
        unite(x[i],y[i]);
    }
    int ans=0;
    REP(i,1,n+1){
        if(same(p[i-1],i)) ans++;
    }
    out(ans);

    return 0;
}


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

signed main() {
  int N;cin>>N;
  std::vector<int> a(N),b(N);
  for(int i=0;i<N;i++)cin>>a[i]>>b[i];
  typedef pair<int,int> P;
  std::vector<P> p(N);
  for(int i=0;i<N;i++)p[i]=P(a[i]+b[i],i);
  sort(p.rbegin(),p.rend());
  int tt=0;
  int at=0;
  for(int i=0;i<N;i++){
    if(i%2)at+=b[p[i].second];
    else tt+=a[p[i].second];
  }
  cout<<tt-at<<endl;
}


Measured memory_bytes: 3328
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    static long gcd(long ai, long aj) {
        if (aj == 0)
            return ai;
        else
            return gcd(aj, ai % aj);
    }

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        long sum = 0;

        PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());

        for (int i = 0; i < N; i++) {
            pq.add(sc.nextInt());
        }

        for (int i = 0; i < M; i++) {
            int top = pq.poll();
            pq.add(top / 2);
        }

        for (int i = 0; i < N; i++) {
            sum += pq.poll();
        }

        System.out.println(sum);
    }
}


Measured memory_bytes: 60496
#include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

set<int> mergeSet(set<int> s1, set<int> s2) {
	for (int ele : s2) {
		s1.insert(ele);
	}
	return s1;
}


void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif

	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		string str;
		cin >> str;
		cout << str << endl << str << endl;
	}
}




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


	solve();
#ifdef _WIN32
	system("PAUSE");
#endif
	return 0;
}

Measured memory_bytes: 384
h, w, k = [int(i) for i in input().split()]
s = [input() for _ in range(h)]

ans = float("inf")
for i in range(2 ** (h - 1)):
    a = 0
    for j in range(h - 1):
        if (i >> j) & 1 == 1:
            a += 1
    c = a
    b = [0] * (c + 1)
    ok2 = True
    for j in range(w):
        tmp = 0
        for l in range(h):
            if s[l][j] == "1":
                b[tmp] += 1
            if (i >> l) & 1 == 1:
                tmp += 1

        ok = True
        for l in b:
            if l > k:
                ok = False

        if not ok:
            a += 1
            b = [0] * (c + 1)

            tmp = 0
            for l in range(h):
                if s[l][j] == "1":
                    b[tmp] += 1
                if (i >> l) & 1 == 1:
                    tmp += 1

            ok = True
            for l in b:
                if l > k:
                    ok = False
            if not ok:
                ok2 = False
                break
    if ok2:
        ans = min(ans, a)

print(ans)


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

typedef long long int ll;
const int N_MAX = 100005;
const ll INF = 1000000000000000005;

int n;
int A[N_MAX];
ll nres[N_MAX];


int main(){
    cin >> n;
    for(int i = 0; i <= n; i++) cin >> A[i];
    ll an;
    ll nodenum = 0;
    ll now = 0;
    ll benode = 1;
    nres[0] = 1;
    ll exi = 0;
    if (A[0] > 0)nodenum = -1;
    for(int i = 1; i <= n; i++){
        if (nodenum == -1)break;
        benode = min(2 * benode, INF);
        nres[i] = benode;
        if (A[i] > 0){
            if (benode < A[i]){
                nodenum = -1;
                break;
            }
            nres[i] -= A[i];
            benode -= A[i];

            ll res = A[i];
            while(res > 0){
                if (res <= nres[now]){
                    nres[now] -= res;
                    nodenum += res * (i - now + 1);
                    exi += res;
                    break;
                }
                res -= nres[now];
                nodenum += nres[now] * (i - now + 1);
                exi += nres[now];
                now++;
                exi -= A[now];
                nres[now] -= exi;

            }
        }
    }
    if (n == 0 && A[0] == 1) nodenum = 1;
    cout << nodenum << endl;
}

Measured memory_bytes: 4776
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()


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

	map<string, int> m;

	rep(i, N)
	{
		string s;
		cin >> s;

		m[s]++;
	}

	int count = 0;
	for (auto s : m)
	{
		count = max(count, s.second);
	}

	vector<string> v;
	for (auto s : m)
	{
		if (s.second == count) v.push_back(s.first);
	}

	sort(all(v));

	for (auto s : v)
	{
		cout << s << endl;
	}
	
	return 0;
}

Measured memory_bytes: 26868
str = gets.split
N,Q = str[0].to_i, str[1].to_i
a = Array.new(N+1){Array.new(0)}
b = Array.new(N+1,0)
c = Array.new(0)
x,y = 0,0
for i in 1...N do
    str = gets.split
    x,y = str[0].to_i, str[1].to_i
    a[x].push(y)
    a[y].push(x)
end
for i in 0...Q do
    str = gets.split
    x,y = str[0].to_i, str[1].to_i
    b[x] += y
end

for i in 0...a[1].size do
    c.push(1)
    c.push(a[1][i])
end

d = 0
while !c.empty?
    d = c.pop
    a[d].delete(c.pop)
    for i in 0...a[d].size do
        c.push(d)
        c.push(a[d][i])
    end
end

while !a[1].empty?
    c.push(1)
    c.push(a[1].pop)
end
while !c.empty?
    d = c.pop
    b[d] += b[c.pop]
    while !a[d].empty?
        c.push(d)
        c.push(a[d].pop)
    end
end

for i in 1..N do
    print b[i]," "
end
puts

Measured memory_bytes: 22780
def kaijo(n):
    if n == 1:
        return n
    return n * kaijo(n-1)

def main():
    n = int(input())
    
    x_list = []
    y_list = []
    for i in range(n):
        x, y = map(int, input().split())
        x_list.append(x)
        y_list.append(y)

    tmp = 0
    for i in range(n):
        for j in range((i+1),n):
            tmp += ((x_list[i]-x_list[j])**2 + (y_list[i]-y_list[j])**2)**(0.5)

    print(tmp*2/n)



    

if __name__ == '__main__':
    main()



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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << 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; }
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
 
int main()
{
	int n, m;	
	cin >> n >> m;	
	priority_queue<ll> p_que;
	rep(i,n){
		ll x;
		cin >> x;
		p_que.push(x);
	}
	while(m--){
		ll now = p_que.top();
		p_que.pop();
		now /= 2;
		p_que.push(now);
	}

	ll ans = 0;
	while(n--){
		ans += p_que.top();
		p_que.pop();
	}
	cout << ans << endl;
}


Measured memory_bytes: 4288
//{{{
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
const int MOD = 1e9+7;
//}}}

int a[1000];
int main(){
	int N;
	cin >> N;
	rep(i,N)cin>>a[i];
	int ans=0;
	rep(i,N){
		rep(j,N){
			ans = max(ans, a[i]-a[j]);
			ans = max(ans, a[j]-a[i]);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long ll;
template<typename T>
inline T read(T&x){
	x=0;int f=0;char ch=getchar();
	while (ch<'0'||ch>'9') f|=(ch=='-'),ch=getchar();
	while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x=f?-x:x;
}
const int N=2e5+10;
int n,i,l,r;
ll a[N],sum[N],sumxor[N];
int main(){
	read(n);
	for (i=1;i<=n;i++) read(a[i]),sum[i]=sum[i-1]+a[i],sumxor[i]=sumxor[i-1]^a[i];
	ll ans=0;
	/*for (i=1;i<=n;i++){
		l=i,r=n;
		int res=i;
		while (l<=r){
			int mid=l+((r-l)>>1);
			if ((sum[mid]-sum[i-1])==(sumxor[mid]^sumxor[i-1])){
				res=mid;
				l=mid+1;
			}
			else r=mid-1;
		}
		ans+=res-i+1;
	}
	printf("%lld\n",ans);*/
	int l=1;
	for (int r=1;r<=n;r++){
		for(;(sum[r]-sum[l-1])!=(sumxor[r]^sumxor[l-1]);l++);
		ans+=r-l+1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4992
//https://atcoder.jp/contests/dp/tasks/dp_c
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n; cin>>n;
    vector<int> dp(3);
    //dp[i]- thetoal cost such that we did activity i on the last considered day
    for(int day = 0;  day<n;  day++){
        vector<int> new_dp(3, 0);
        vector<int> c(3);
        for(int i = 0;i<3; i++)
            cin>>c[i];
        for(int i =0; i<3; i++){
            for(int j = 0; j<3; j++){
                if(i != j){
                    new_dp[j] = max(new_dp[j], dp[i] + c[j]);
                }
            }
        }
        dp = new_dp;
    }   
    cout<<max(dp[0], max(dp[1], dp[2]));
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	ll N, K;
	cin >> N >> K;

	ll A[60][50][50] = {};
	rep(i, N) rep(j, N) cin >> A[0][i][j];

	ll mod = 1e9 + 7;
	rep(i, 59) {
		rep(j, N) {
			rep(k, N) {
				rep(x, N) {
					A[i + 1][j][k] += A[i][j][x] * A[i][x][k];
					A[i + 1][j][k] %= mod;
				}
			}
		}
	}

	ll B[50];
	rep(i, N) B[i] = 1;
	rep(i, 60) {
		if (K >> i & 1) {
			ll C[50] = {};
			rep(j, N) {
				rep(k, N) {
					C[j] += A[i][j][k] * B[k];
					C[j] %= mod;
				}
			}
			rep(j, N) B[j] = C[j];
		}
	}
	
	ll kotae = 0;
	rep(i, N) kotae = (kotae + B[i]) % mod;
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <cstdlib>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int N, K;
    cin >> N >> K;
    vector<int> v(N);
    REP (i, 0, N) cin >> v[i];
    vector<lli> sum(N + 1, 0);
    vector<lli> plus(N + 1, 0);
    REP (i, 0, N) {
        sum[i + 1] = sum[i] + v[i];
        lli add = 0;
        if (v[i] > 0) add = v[i];
        plus[i + 1] = plus[i] + add;
    }
    lli ans = 0;
    REP (i, 0, N - K + 1) {
        lli base = sum[i + K] - sum[i];
        lli add = plus[i] - plus[0] + plus[N] - plus[i + K];
        ans = max(ans, max(base + add, add));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2176
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
 
#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rept(i,n) rep(i,0,n)
 
//int型を受け取ってその桁数を返す
int check_digits(int n,int m) {
	int digits = 0;
	while (n != 0) {
		n /= m;
		digits++;
	}
	return digits;
}
 
//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}
 
 
//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}
 
 
//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}
 
 
//入力された文字列が回文か判断してboolを返す
bool is_kaibun(string s) {
	string s_r(s.rbegin(), s.rend());
	return (s == s_r);
}
 
 
void yes() {cout << "Yes" << endl;}
void no() {cout << "No" << endl;}
 
 
//問題文を落ち着いて読む！
//型に注意！！
//出力例もちゃんと全部見る！！！！！
int main() {
	int n;
	cin >> n;
	string temp;
	temp = to_string(n);
	rept(i, temp.size()) {
		if (temp[i] == '7') {
			yes();
			//system("pause");
			return 0;
		}
	}
 
	no();
	//system("pause");
	return 0;
}

Measured memory_bytes: 3784
// 2020-08-23 22:40:24
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  int n, x, t;
  cin >> n >> x >> t;
  cout << (n+x-1)/x*t << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3648
use proconio::input;

const MOD: u64 = 1_000_000_007;

fn main() {
    input!(a: [u64]);

    let (ans, _) = a.iter().fold((0, 0), |(acc, cum), a| {
        ((acc + cum * a) % MOD, (cum + a) % MOD)
    });

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


Measured memory_bytes: 5584
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

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

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long

const int N = 111;
const int MOD = 1e9 + 7;

int n;
int h[500];
int dp[N];
int kek[N][N];

long long inq(long long x, long long y)
{
    if (y == 0) return 1;
    long long l = inq(x, y / 2);
    if (y % 2) return l * l % MOD * x % MOD;
    return l * l % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    h[0] = 1, h[n + 1] = 1;
    for (int i = 1; i <= n; i++) cin >> h[i];
    for (int l = 1; l <= n; l++)
    {
    	for (int r = l; r <= n; r++)
    	{
    		int limit = min(h[r], h[r + 1]);
    		for (int i = r; i >= l; i--)
            {
                int a = max(h[i - 1], limit);
                int b = h[i];
                if (b >= a)
                {
                    kek[l][r] += b - a;
                }
                limit = min(limit, h[i]);
            }
    	}
    }
    //for (int l = 1; l <= n; cout << "\n", l++) for (int r = 1; r <= n; r++) cout << kek[l][r] << " ";
    dp[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j < i; j++)
        {
            dp[i] = (dp[i] + dp[j] * inq(2, kek[j + 1][i])) % MOD;
        }
    }
    cout << 2 * dp[n] % MOD;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)

# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

def main():
	#N, K = map(int, input().split(" "))
	N = int(input())
	#S = input()
	#V = input().split(" ")
	#V = [int(s) for s in V]

	tmp = (180 * (N-2) )

	print(tmp)

if __name__ == "__main__":
	main()

Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

    sort(s.begin(),s.end());
    sort(t.begin(),t.end(),greater<char>());

    if(s < t)cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
                using namespace std;
                typedef long long ll;
                #define INPUT()              freopen("input.txt", "r", stdin)
                #define OUTPUT()             freopen("output.txt", "w", stdout)
                #define F                    first
                #define S                    second
            //Templatefunctions
                template<typename T>T gcd(T x, T y) { if (y == 0)return x; else return gcd(y, x%y);}
                template <class T> T euclideanDistance(T x1 , T x2 , T y1 , T y2){return sqrt(( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ));}
                template <class T> T digitSum(T n){T sum = 0;while(n > 0)sum += n % 10,n /= 10;return sum;}
            //datatypes
                typedef long long int ll;
                typedef unsigned long long int ull;
                typedef long double ld;
            //constants
                const double INF = 1e+9;
                const double INFLL = 1e+18;
                const double EPS = 1e-9;
                const double PI = acos(-1);
                const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
                       //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
                       //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
                const int dx[] = {0 , 1 , 0 , -1};
                const int dy[] = {1 , 0 , -1 , 0};
            //helpers
                //#define MOD         1000000007LL
                #define MAX         1000005
                const ll MOD = 1000000000 + 7;
                int arr[MAX];
                char str[MAX+10];
            //Global Variables
                int price[MAX] = {0 , 1 , 5 , 8 , 9 , 10 , 17 , 17 , 20 , 24 , 30};
                int dp[MAX],n;

                int main()
                {
                   ll s,c;
                   scanf("%lld%lld",&s,&c);
                   ll ans = 0;
                   if(c < s * 2 || c < s)
                   {
                        ans = c / 2;
                   }else
                   {
                        ans = s + (c-s*2)/4;
                   }
                   printf("%lld\n",ans);
                }


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long int64;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 3e3+5;
struct Edge
{
    int next, to;
    Edge(int next = 0, int to = 0):next(next), to(to) {};
}edge[N<<1];
int tot, head[N];
void _add(int x, int y) { edge[++tot] = Edge(head[x], y), head[x] = tot; }
void add(int x, int y) { _add(x, y), _add(y, x); } 
int n, a[N];
bool dfs(int x, int fa)
{
    if(a[x] >= a[fa]) return true;
    for(int i = head[x]; i; i = edge[i].next)
    {
        int y = edge[i].to; if(y == fa) continue;
        if(!dfs(y, x)) return true;
    }
    return false;
}
int main()
{
    a[0] = 1e9+1, n = read();
    for(int i = 1; i <= n; ++i) a[i] = read();
    for(int i = 1; i < n; ++i)
    {
        int x = read(), y = read();
        add(x, y);
    }
    for(int x = 1; x <= n; ++x) if(dfs(x, 0)) printf("%d ", x);
    return 0;
}
/*
4
3 2 1 1
1 2
2 3
3 4
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
//const int MOD = 998244353;
//const long long int MOD = 998244353;
int N, M, K, H, W, L, R;
//long long int N, M, K, H, W, L, R;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	vector<int>x(N);
	vector<int>y(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
	}
	if (N == 1) {
		cout << 1 << endl;
		return 0;
	}
	int ans = MOD;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i == j)
				continue;
			int cx = x[j] - x[i];
			int cy = y[j] - y[i];
			int cnt = 0;
			for (int k = 0; k < N; k++) {
				for (int l = 0; l < N; l++) {
					if (cx == x[l] - x[k] && cy == y[l] - y[k])
						cnt++;
				}
			}
			ans = min(ans, N - cnt);
		}
	}
	cout <<ans<< endl;
	return 0;
}



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

#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
int powmod(int a,int l, int md){a%=md; int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
int invmod(int a, int md){return powmod(a,md-2,md);}
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
typedef vector<int> vi; typedef pair<int, int> ii; typedef vector< ii > vii;
#define pb push_back
int __set(int b, int i) {return b|(1LL<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1LL<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return (((a%md)*(b%md))%md+md)%md;}
int addmod(int a, int b, int md) {return ((a%md+b%md)%md+md)%md;}
int submod(int a, int b, int md) {return (((a%md-b%md)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int MOD = 1e9+7;
const int MX = 400010;

int f[MX];
int rf[MX];

int C(int l,int k, int md) 
{
    if (k<0||k>l){
        return 0;
    }
    return f[l]*rf[k]%md*rf[l-k]%md;
}

void precfac() {
    f[0]=1;
    for (int i=1;i<MX;i++){
        f[i]=f[i-1]*i%MOD;
    }
    rf[MX-1]=powmod(f[MX-1],MOD-2, MOD);
    for (int i=MX-2;i>=0;i--){
        rf[i]=rf[i+1]*(i+1)%MOD;
    }
}
signed main(void)
{
	IOS;
	int n; cin>>n;
	int tmp = (powmod(10,n,MOD)+powmod(8,n,MOD)-2*powmod(9,n,MOD))%MOD;
	tmp += MOD;
	tmp %= MOD;
	cout<<tmp<<endl;
	return 0;
}

Measured memory_bytes: 3552
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.HashSet;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int b = sc.nextInt();
		System.out.println(Math.min(b, k*n));
	}
	
	static long factr(long n,long p,long q) {
		if(n==p) {
			return 1l;
		}
		long ma = Math.max(p, q);
		long mi = Math.min(p, q);
		ArrayList<Long> mm = new ArrayList<Long>();
		for(int i=1;i<=mi;i++) {
			mm.add((long) i);
		}
		long ret = fact(n,ma,mm);
		return ret;
	}
	static long fact(long n,long m,ArrayList<Long> mm) {
		if(n==m) {
			return 1l;
		}
		long pre = fact(n-1,m,mm);
		for(int i=0;i<mm.size();i++) {
			if(pre%mm.get(i) ==0) {
				pre = pre/mm.get(i);
				mm.set(i, 1l);
			}
		}
		return (n*pre);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
#define _GLIBCXX_DEBUG

using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) {
        a.at(i) = i+1;
    }
    ll sum = 0;
    rep(i, N) {
        if ((a.at(i) %3 != 0) && (a.at(i) % 5 != 0)) {
            sum += a.at(i);
            cerr << sum << "\n";
        }
    }
        cout << sum << "\n";
}


Measured memory_bytes: 10808
#include<bits/stdc++.h>
using namespace std;
#define loop(i,L,R) for(int i=(L);i<=(R);i++)
#define rept(i,L,R) for(int i=(L);i<(R);i++)
#define isc(n) scanf("%d",&n)
#define llsc(n) scanf("%lld",&n)
#define dsc(n) scanf("%lf",&n)
#define enl cout<<endl
#define pb(x) push_back(x)
#define xx first
#define yy second
typedef long long ll;
typedef pair<int,int>PI;
typedef pair<pair<int,int>,int>PII;

int main()
{
	int a,b;
	cin>>a;
	cin>>b;
	string s;
	cin>>s;
	int i=0;
	rept(j,0,a)
	{
		if(s[i]>='0' && s[i]<='9')i++;
		else break;
	}
	if(i<a)
	{
		cout<<"No"<<endl;
		return 0;
	}
	if(s[i]=='-')i++;
	else 
	{
		cout<<"No"<<endl;
		return 0;
	}
	rept(j,0,b)
	{
		if(s[i]>='0' && s[i]<='9')i++;
		else break;
	}
	if(i<s.size())cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int A,B;
    cin>>A>>B;
    cout << A*B<<endl;
    return 0;
}

Measured memory_bytes: 3648
/*
    HARSHAD VAGHASIYA

        @DAIICT
        
          H_M_Vaghasiya

            */
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define INF 10000000000
#define ld long double
#define pb push_back
#define mp make_pair
#define pu push
#define vsz(v) cout<<v.size()<<endl; 
#define printv(v) for(ll i=0;i<v.size();i++)cout<<v[i]<<" "; cout<<endl;
#define printvpair(v) for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<endl;
#define sz size()
#define ff first
#define ss second
#define setpri(x) cout<<setprecision(x);
#define all(v) v.begin(),v.end()
ll gcd(ll a,ll b){return __gcd(a,b);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k,ll m){ll ans=1;
    while(k>0){if(k%2==1)ans=ans*n;
        n=n*n;k/=2;
    }return ans;
}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
	return a.first > b.first;
}
void solve(){
	FS;
    ll i,j,k,q,n,m,x,y,z;
	cin>>n>>k;
	ll ans=0;
	for(i=0;i<n;i++){
		cin>>x;
		if(x>=k)ans++;
	}
	cout<<ans<<endl;
}
int main(){
	ll i,j,k,n,m,x,y,z;
	n=1;
	//cin>>n;
	while(n--)solve();
	return 0;
}

Measured memory_bytes: 256
h,w,k = map(int,input().split())
s = [input() for _ in range(h)]
row = []
col = []

flagr = flagc = flags = False
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if flagc:
                col.append(j)
            else:
                flagc = True
            flags = True
    if flags:
        col.append(w)
        if flagr:
            row.append(i)
        else:
            flagr = True
        flagc = flags = False
row.append(h)

ans = [["" for _ in range(w)] for _ in range(h)]
cnt = 1
idx = 0
sr = sc = 0
for er in row:
    while sc != w:
        ec = col[idx]
        for i in range(sr,er):
            for j in range(sc,ec):
                ans[i][j] = str(cnt)
        cnt += 1
        idx += 1
        sc = ec
    sc = 0
    sr = er

for i in range(h): print(" ".join(ans[i]))

Measured memory_bytes: 10540
// https://atcoder.jp/contests/abc114/tasks/abc114_d

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// http://tutuz.hateblo.jp/entry/2018/12/22/125205
ll dp[110][101];
int main() {
    int n;
    cin >> n;
    map<int, int> cnt;
    for (int i = 2; i <= n; i++) {
        int tmp = i;
        for (int j = 2; j <= i; j++) {
            while (tmp % j == 0) {
                cnt[j]++;
                tmp /= j;
            }
        }
    }
    dp[0][1] = 1;
    for (int i = 0; i <= n; i++) {
        for (int have = 1; have <= 75; have++) {
            for (int take = 1; take <= cnt[i] + 1 && have * take <= 75;
                 take++) {
                dp[i + 1][have * take] += dp[i][have];
            }
        }
    }
    cout << dp[n][75] << endl;

    return 0;
}


Measured memory_bytes: 384
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<d,int>
#define pb push_back
#define cases int tc;cin>>tc;while(tc--)
#define N 100003
#define M 1003
int mod=1e9+7;
//int mod=998244353;

int f(int n)
{
    int m=n%4;
    if(m==0)
        return n;
    else if(m==1)
        return 1;
    else if(m==2)
        return n+1;
    else
        return 0;
}

signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int a,b;
    cin>>a>>b;
    cout<<(f(a-1)^f(b));




    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]

a = A[0]
ans = True if a == 2 else False
cnt = 0
for i in range(N):
    cnt += 1
    if a == 2:
        ans |= True
        break
    a = A[a - 1]

if ans:
    print(cnt)
else:
    print(-1)


Measured memory_bytes: 7084
n,m = gets.split.map(&:to_i)
while n != 0 && m != 0
	sn = []
	sm = []

	sum_sn = 0
	sum_sm = 0
	n.times do  
		i = gets.to_i
		sn.push(i)
		sum_sn += i
	end
	m.times do 
		i = gets.to_i
		sm.push(i)
		sum_sm += i
	end
	sn = sn.sort
	sm = sm.sort

	if sum_sn > sum_sm
		diff = sum_sn - sum_sm
	else
		diff = sum_sm - sum_sn
	end

	a = 0
	b = 0
	sn = sn.reverse
	sm = sm.reverse
	sn.each do |sn_tmp|
		sm.each do |sm_tmp|
			if sn_tmp > sm_tmp && sum_sn - (sn_tmp - sm_tmp) == sum_sm + (sn_tmp - sm_tmp)
				a = sn_tmp
				b = sm_tmp
			elsif sn_tmp < sm_tmp && sum_sm - (sm_tmp - sn_tmp) == sum_sn + (sm_tmp - sn_tmp)
				a = sn_tmp
				b = sm_tmp
			elsif  diff == 0 && sn_tmp == sm_tmp
				a = sn_tmp
				b = sm_tmp
			end
		end
	end
	if a == 0 && b == 0
		puts "-1"
	else
		print(a," ",b)
		puts
	end
	n,m = gets.split.map(&:to_i)
end

Measured memory_bytes: 8764