akhauriyash/Code-Regression huggingface dataset:
// template version 1.11
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings {{{
#define infile "../test/sample-1.in"
#define int long long
const int INF=1e18;
const int MOD=1e9+7;
// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int w,a,b;
  cin >> w >> a >> b;
  if(a+w < b){
    cout << b-a-w << "\n";
  }
  else if(b+w < a){
    cout << a-b-w << "\n";
  }
  else{
    cout << 0 << "\n";
  }
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
a=int(input())
b,c=map(int,input().split())
s=[]
total=a+c
for i in range(a):
    s.append(int(input()))
for i in s:
    for j in range(2,b+1):
        if i==1:
            total+=1
        elif j%i==1:
            total+=1
print(total)

Measured memory_bytes: 9168
#include<stdio.h>
int main()
{
	int a,b,c,d;
	scanf("%d",&a);
	b=a/3600;
	a= a-((60*60)*b);
	c=a / 60;
	a= a - (60*c);
	printf("%d:%d:%d\n",b,c,a);
	
	return 0;
}


Measured memory_bytes: 1928
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 21
#define M 300300
int a[N][N], n;
ll Sum[M], f[M];
int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
    for (int s = 0; s < (1 << n); s++) {
        vector<int> v;
        for (int i = 0; i < n; i++)
            if (s >> i & 1ll) v.push_back(i);
        ll sum = 0;
        for (int i = 0; i < v.size(); i++)
            for (int j = i + 1; j < v.size(); j++) sum += a[v[i]][v[j]];
        Sum[s] = sum;
    }
    for (int s = 0; s < (1 << n); s++) {
        f[s] = Sum[s];
        for (int k = s; k; k = (k - 1) & s) f[s] = max(f[s], f[s ^ k] + Sum[k]);
    }
    printf("%lld\n", f[(1 << n) - 1]);
    return 0;
}

Measured memory_bytes: 2816
#include <stdio.h>
int main(int argc, char const *argv[]) {

  int N,L;
  int A[200];
  int M = 101;
  int j = 0;
  int ans=0;

  scanf("%d %d",&N,&L );
  for (int i = 0; i < N; i++) {
      A[i] = (L+i);
  }
  for (int i = 0; i < N; i++) {
    if(abs(A[i]) < M){
      M = abs(A[i]);
      j = i;
    }
  }
  for (int i = 0; i < N; i++) {
    if( i != j){
      ans += A[i];
    }
  }
  printf("%d",ans);

  return 0;
}


Measured memory_bytes: 128
//knapsack-2
#include <bits/stdc++.h>
using namespace std;

#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define int long long int
#define mod 1000000007
const int N=1e5+5;

int n,w;
int a[N],b[N],cache[100+5][N];

int dp(int pos,int val)
{
	if(val==0)
		return 0;
	if(val<0)
		return 1e15;
	if(pos==n)
		return 1e15;
	if(cache[pos][val]!=-1)
		return cache[pos][val];
	
	cache[pos][val]=min(dp(pos+1,val),a[pos]+dp(pos+1,val-b[pos]));
	return cache[pos][val];
}

int32_t main()
{
	fastIO;
	
	int i;
	cin>>n>>w;
	for(i=0;i<n;i++)
		cin>>a[i]>>b[i];

	memset(cache,-1,sizeof(cache));

	int ans=0;
	for(i=1;i<=100000;i++)
	{
		int x=dp(0,i);
		if(x<=w)
			ans=i;
	}
	cout<<ans<<"\n";

	return 0;
}


Measured memory_bytes: 82304
n=int(input())
a=list(map(int,input().split()))

a.sort(reverse=True)

import heapq
heap=[a[0]*(-1)]

ans=0

for aa in a[1:]:
    tmp=heapq.heappop(heap)
    ans+=((-1)*tmp)
    heapq.heappush(heap,-1*aa)
    heapq.heappush(heap,-1*aa)

print(ans)



Measured memory_bytes: 31616
package main

import "fmt"

func main() {
	var p, q,r int
	fmt.Scan(&p, &q, &r)


	fmt.Println(p+q+r-max(p, q, r))
}
func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		if res < nums[i] {
			res = nums[i]
		}
	}
	return res
}


Measured memory_bytes: 1768
#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
  int nums;
  string tmp;
  cin >> nums;
  map<string, int> store;
  for (int i = 0; i < nums; i++) {
    cin >> tmp;
    if (store.count(tmp))
      continue;
    else
      store.insert(pair<string, int>(tmp, 1));
  }
  cout << store.size() << endl;
}

Measured memory_bytes: 19228
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<deque>
#include<functional>
#include<ctime>
#include<cassert>
#include<cstring>
#include<unordered_map>
using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<=b;++i)
#define fj(a,b) for(int j=a;j<=b;++j)
#define fo(a,b) for(int o=a;o<=b;++o)
#define fdi(a,b) for(int i=a;i>=b;--i)
#define fdj(a,b) for(int j=a;j>=b;--j)
#define fdo(a,b) for(int o=a;o>=b;--o)
#define pb push_back
#define mp make_pair
#ifdef LOCAL
#define err(format, ...) fprintf(stderr, format, __VA_ARGS__);
#else
#define err(format, ...) while(false) {}
#endif
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double ld;
typedef vector<int> vi;

template<class T> bool uin(T &a, T b){ return (a > b ? a = b, true : false); }
template<class T> bool uax(T &a, T b){ return (a < b ? a = b, true : false); }

/////////////////////////////////

string const F = "Takahashi";
string const S = "Aoki";

int const MAXN = 241;

int n, a[MAXN], k[MAXN], g[MAXN];

int getg(int n, int k) {
	if (k > n) return 0;
	if (n % k == 0) return n / k;
	int c = n / k + 1;
	int m = (n / k) * k;
	int q = (n - m + c - 1) / c;
	return getg(n - c * q, k);
}

void solve() {
	fi(1, n) {
		g[i] = getg(a[i], k[i]);
	}	
	int x = 0;
	fi(1, n) {
		x ^= g[i];
	}
	if (x) {
		printf("%s\n", F.c_str());
	} else {
		printf("%s\n", S.c_str());
	}
}

int main() {
#ifdef LOCAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d", &n);
	fi(1, n) {
		scanf("%d %d", &a[i], &k[i]);
	}
	solve();		

	
#ifdef LOCAL
	fprintf(stderr, "ELAPSED TIME: %.3lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 256
#https://atcoder.jp/contests/diverta2019/tasks/diverta2019_c

N = int(input())
s = []
for i in range(N):
    s.append(list(str(input())))

flag = False
count = 0
for i in range(len(s)):
    flag = False
    for j in range(len(s[i])):
        if flag == True and s[i][j] == 'B':
            count += 1
            flag = False
        elif s[i][j] == 'A':
            flag = True
        else:
            flag = False

#print(count)

startcnt = [0] * N
endcnt = [0] * N
for i in range(len(s)):
    if s[i][0] == 'B':
        startcnt[i] = 1
    if s[i][len(s[i])-1] == 'A':
        endcnt[i] = 1

#print(startcnt,endcnt)

cntpls = [0,0,0] #始め、終わり、両方
for i in range(N):
    if startcnt[i] == 1 and  endcnt[i] == 0:
        cntpls[0]+= 1
    elif startcnt[i] == 0 and  endcnt[i] == 1:
            cntpls[1] += 1
    elif startcnt[i] == 1 and  endcnt[i] == 1:
        cntpls[2] += 1

#print(cntpls)

add = 0
if cntpls[2] > 0:
    count += cntpls[2] - 1
    if cntpls[1] >= 1:
        add += 1
        cntpls[1] -= 1

    if cntpls[0] >= 1:
        add += 1
        cntpls[0] -= 1

print(count + add + min(cntpls[0],cntpls[1]))

Measured memory_bytes: 4852
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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

















int main(){
    ll k;
    cin >> k;
    ll ans = 0;
    for(ll a = 1; a <= k; a++){
        for(ll b = 1; b <= k; b++){
            for(ll c = 1; c <= k; c++){
                ans += gcd(a, gcd(b, c));
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

template<typename T>
struct SlideMin {
  deque<T> dq;

  void push(const T &v) {
    while (dq.size() && dq.back() >= v) {
      dq.pop_back();
    }
    dq.push_back(v);
  }

  void shift() {
    dq.pop_front();
  }

  T front() {
    return dq.front();
  }

  size_t size() {
    return dq.size();
  }
};

ll dp[SIZE];

int main() {
  int N, M, K, A[SIZE];

  scanf("%d%d%d", &N, &M, &K);

  for (int i = 0; i < N; i++) {
    scanf("%d", A + i);
  }

  for (int i = 0; i < K; i++) {
    SlideMin<pair<ll, int>> dq;
    if (i == 0) dq.push({0, INF});
    for (int j = 0; j < N; j++) {
      ll tmp = dp[j];

      while (dq.size() && j - dq.front().second > M) {
        dq.shift();
      }

      if (dq.size()) {
        dp[j] = dq.front().first - (ll)(i + 1) * A[j];
      } else {
        dp[j] = LLINF;
      }

      if (tmp <= 0) dq.push({tmp, j});
    }
  }
  ll ans = 0;

  for (int i = 0; i < N; i++) {
    ans = max(ans, -dp[i]);
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 6180
#include<iostream>
#include<vector>
#include <algorithm>
#include <climits>
using namespace std;
vector< vector<int> > dp;
vector<int> value;
vector<int> weight;
int N,W;
int max_value(int n, int w){
  if(n == 0 || w <= 0){
    return 0;
  }
  if(n > N){
    return 0;
  }
  if(dp[n][w] >= 0){
    return dp[n][w];
  }

  int unused = 0;
  int used = 0;
  //cout << n << endl;

  if(weight[n] > w){
    dp[n][w] = max_value(n+1, w);
  }else{
    unused = max_value(n+1, w);
    used = max_value(n+1, w-weight[n])+value[n];
    dp[n][w] = max({unused, used});
  }
  return dp[n][w];

}


int main(){

  int v,w;
  int result;
  cin >> N >> W;
  value.push_back(0);
  weight.push_back(0);

  for(int i=0; i<N; i++){
    cin >> v >> w;
    value.push_back(v);
    weight.push_back(w);
  }

  dp = vector< vector<int> >(N+1, vector<int>(W+1, -1));

  result = max_value(1, W);
/*
  for(int y=1; y<=W; y++){
    for(int x=1; x<=N; x++){
      cout << dp[x][y] << " ";
    }
    cout << endl;
  }
  */
  cout <<  result <<  endl;


  return 0;
}



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

namespace test05a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int k = int.Parse(str[0]);
            int s = int.Parse(str[1]);

            int icnt = Cal(k, s);

            Console.WriteLine(icnt);
            
        }

        private static int Cal(int inputK, int inputS)
        {
            int icnt = 0;

            for (int i = 0; i <= inputK; i++)
            {
                if (i == inputS)
                {
                    icnt++;
                    break;
                }
                for (int j = 0; j <= inputK; j++)
                {
                    if ((i + j) == inputS)
                    {
                        icnt++;
                        break;
                    }
                    int k = inputS - (i + j);
                    if ((0 <= k) && (k <= inputK))
                    {
                        icnt++;
                    }
                }
            }
            return icnt;
        }
    }
}


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

using ll = long long;
using P = pair<ll, ll>;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

ll N, K;
ll V[100];

int main(int argc, char **argv)
{
	cin >> N >> K;
	REP(i, N) cin >> V[i];

	ll M = min(K, N);

	ll res{-INF};
	for (ll l = 0; l <= M; ++l)
	{
		for (ll r = 0; r <= M; ++r)
		{
			if (l + r > M) continue;

			ll th = K - l - r;
			
			vector<ll> tmp;
			for (ll i = 0; i < l; ++i)
				tmp.push_back(V[i]);
			for (ll i = 0; i < r; ++i)
				tmp.push_back(V[N-1-i]);

			sort(ALL(tmp));
			for (ll i = 0; i < th; ++i)
			{
				if (i >= tmp.size()) break;
				tmp[i] = max(tmp[i], 0ll);
			}

			res = max(res, accumulate(ALL(tmp), 0ll));
			
		}
	}

	std::cout << res << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define ctoi(x) (x - '0')
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

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

int n, ans;
vi v(200010);
unordered_map<int, int> M;

int main() {
	fastio;
	cin >> n;
	FOR(i, n) {
		cin >> v[i + 1];
		M[v[i + 1]]++;
	}
	for (int i = 1; i <= n; i++) {
		int flag = 1;
		for (ll j = 1; j * j <= v[i]; j++) {
			if (v[i] % j == 0) {
				//v[i]/j, j
				if (j == v[i] && M[j] >= 2 || j != v[i] && M[j] >= 1 || v[i]/j == v[i] && M[v[i]/j] >= 2 || v[i]/j != v[i] && M[v[i]/j] >= 1) {
					flag = 0;
					break;
				}
			}
		}
		if (flag) ans++;
	}
	cout << ans;
}

Measured memory_bytes: 32564
#include <cmath>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <set>
const int maxlongint=2147483647;
const int mo=1e9+7;	
const int N=505;
using namespace std;
int n,m,a[N][N],v[N][N],v1[N][N];
int main()
{
	//freopen("agc004c.in","r",stdin);
	//freopen("agc004c.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			char c=getchar();
			while(c!='.' && c!='#') c=getchar();
			v[i][j]=v1[i][j]=a[i][j]=c=='#';
		}
	for(int i=1;i<=n;i++)
	{
		v[i][1]=1,v1[i][m]=1;
		if(i&1)
			for(int j=1;j<=m-1;j++) v[i][j]=1;
		else
			for(int j=2;j<=m;j++) v1[i][j]=1;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++) printf("%c",v[i][j]?'#':'.');
		putchar('\n');
	}
	putchar('\n');
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++) printf("%c",v1[i][j]?'#':'.');
		putchar('\n');
	}
}

Measured memory_bytes: 3712
#include <stdio.h>

int main(){
	int i,j=0;
	char k[15];
	
	scanf("%s",k);
	
	for(i=0;i<=14;i++){
		if(k[i]=='x'){
			j++;
		}
	}
	
	if(j>=8){
		printf("NO\n");
	}else{
		printf("YES\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
  typedef struct{

    char pname[200];
    int runtime;

  }process;

process runprocess[200005];

int head,tail;
void enqueue(int);
int dequeue();

int main(){


  int sumdata,rtime,i,data,sumtime;

  sumtime = 0;
  head = 0;
  tail =0;

  scanf("%d%d",&sumdata,&rtime);


  for(i = 0; i < sumdata; i++){

    scanf("%s%d",runprocess[i].pname,&runprocess[i].runtime);

  }

  tail =  sumdata;

  while(head != tail){

    data = dequeue();

    data = data  - rtime;

    if(data > 0){

      enqueue(data);
      sumtime = sumtime + rtime;

	}

    else{

      sumtime = sumtime + runprocess[head-1].runtime;
      printf("%s %d\n",runprocess[head -1].pname,sumtime);

	}

  }

  return 0;
}

void enqueue(int data){

  

  strcpy(runprocess[tail].pname,runprocess[head -1].pname);
  runprocess[tail].runtime = data;
  tail = tail + 1;

}

int dequeue(){

  head = head + 1;

  return runprocess[head -1].runtime;

}

Measured memory_bytes: 39516
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		List<String> list = new ArrayList<String>();
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
				if(i == 0) {
				} else if(list.size() == 0){
				} else {
					list.remove(list.size() - 1);
				}
			} else {
				list.add(s.charAt(i) + "");
			}
		}
		for(String a:list) {
			System.out.print(a);
		}
		System.out.println();
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> P(N);
	for (auto &x : P) cin >> x;

	vector<int> c(N + 1, 0);
	for (int i = 0; i < N; ++i) {
		c[P[i]] = c[P[i] - 1] + 1;
	}

	int ans = N - *max_element(c.begin(), c.end());
	cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,t,a[100010],smux[100010],ans=0;
    vll v;
    cin>>n>>t;
    rep(i,n) cin>>a[i];
    smux[n-1]=a[n-1];
    repr(i,n-1){
        smux[i]=max(smux[i+1],a[i]);
    }
    rep(i,n){
        v.pb(smux[i]-a[i]);
    }
    sort(all(v));
    ans=v.end()-lower_bound(all(v),v[n-1]);
    cout<<ans<<endl;
    return 0;
}

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

long long koubaisuu(long long a, long long b);

int main()
{
	long long a, b, c, d,cd,ans[5];
	cin >> a >> b >> c >> d;
	ans[0] = b / c - (a - 1) / c;
	ans[1] = b / d - (a - 1) / d;
	cd = koubaisuu(c, d);
	ans[2] = b / (cd) - (a - 1) / (cd);
	ans[3] = ans[0] + ans[1] - ans[2];
	cout << b - a + 1 - ans[3];
}

long long koubaisuu(long long a, long long b)
{
	long long aa, bb;
	aa = a;
	bb = b;
	while (aa != bb)
	{
		if (aa > bb) bb += b;
		else aa += a;
	}
	return aa;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define il inline
#define vd void
typedef long long ll;
il ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int a[100010],b[100010];
std::bitset<410>bit[410];
bool del[410];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),m=gi();
	for(int i=1;i<=m;++i)a[i]=gi(),b[i]=gi();
	for(int i=1;i<=n;++i){
		bit[i][i]=1;
		for(int j=m;j;--j){
			bool x=bit[i][a[j]],y=bit[i][b[j]];
			if(x&&y){del[i]=1;break;}
			if(x)bit[i][b[j]]=1;
			if(y)bit[i][a[j]]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;++i){
		if(del[i])continue;
		for(int j=i+1;j<=n;++j){
			if(del[j])continue;
			if(!(bit[i]&bit[j]).any())++ans;
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>

using namespace std;


//MAX
#define N 10001
#define Q 501

int main(){


  int n[N];
  int q[Q];

  int num,num2,i,j,count=0;

  //load number
  cin >>num;
  //load data
  for(i=0;i<num;i++){
    cin >>n[i];
  }
  //load number
  cin >>num2;
  //load data
  for(i=0;i<num2;i++){
    cin >>q[i];
  }

  //search
  for(i=0;i<num2;i++){
    for(j=0;j<num;j++){
      //if q[i]=n[j] then count and break
      if(q[i]==n[j]){
	count++;
	break;
      }
    }
  }
  //print count
  cout <<count<<endl;

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;

//ll num[50];
//ll num2[50];
//ll num[ten52];
//stack<char> stk;
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<pair<ll,ll>,ll>::iterator iter;
//map<ll,ll> mp;
//deque<char> deq;
//vector<ll> vll;


int main(void)
{
    double ans=0.0,d,d1,d2;
    //float f,g,h;
    long long int m,n,i,j,k=1;
    long long int a,a1,a2,a3,sum;
    string s,s1,s2;
    char c,c1;
    sum=a=a1=a2=a3=0;
    cin>>n;
    cout<<2*n*PI;
    return 0;
}





Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;

int h, w;
string m[51];

bool isIN(int y, int x){
    return (0 <= y && y < h && 0 <= x && x < w);
}

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

int dist[51][51];

void dfs(int y, int x, int d){
    rep(i, 4){
        int nx = x + dx[i];
        int ny = y + dy[i];
        if(isIN(ny, nx) && m[ny][nx] == '.' && d+1 < dist[ny][nx]){
            dist[ny][nx] = d+1;
            dfs(ny, nx, d+1);
        }
    }
}

int main(){
    const int INF = 1e9;
    rep(i, 51){
        rep(j, 51) dist[i][j] = INF;
    }

    cin >> h >> w;
    rep(i, h) cin >> m[i];

    int ans = 0;
    rep(i, h){
        rep(j, w) if(m[i][j] == '.') ans++;
    }

    dfs(0, 0, 1);

    if(dist[h-1][w-1] != INF) cout << ans - dist[h-1][w-1] << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    string a,b;
    cin>>a>>b;
    if(a.size() > b.size())
        cout<<"GREATER";
    else if(a.size() < b.size())
        cout<<"LESS";
    else{
        if(a>b)
            cout<<"GREATER";
        else if(a<b)
            cout<<"LESS";
        else
            cout<<"EQUAL";
    }   
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
using namespace std;
//x以下の最大のべき乗数を出力せよ
int main(){
	int x, ans = 1;
	cin >> x;
	for(int i = 2; i <= x; i++){
		int tmp = i;
		while(tmp <= x){ 
			tmp *= i;
			if(x >= tmp && tmp >= ans) ans = tmp;
		}
	}
	cout << ans << endl;
	return EXIT_SUCCESS;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double x = sc.nextDouble();
    double S = x / a;
    double ans = 0;
    if(((a * b) / (double)2) >= S) {
      double a1 = (2 * S) / b;
      ans = Math.atan(b / a1);
    } else {
      double y = (2 * S) / a - b;
      double t = b - y;
      ans = Math.atan(t / a);
    }
    System.out.println(Math.toDegrees(ans));
  }
}

Measured memory_bytes: 25172
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#include <set>
#include <map>
#include <iomanip>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define rrep(i, n) for(long long i = (long long)(n - 1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()

using ll = long long;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	string ans;
	if (a == b && b == c)
	{
		ans = "No";
	}
	else if (a == b || b == c || a == c)
	{
		ans = "Yes";
	}
	else
	{
		ans = "No";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
function Main(input){
  var arr = input.split("\n");
  var n = parseInt(arr[0],10);
  if(n == 1){
    console.log('Hello World');
  }
  else if(n == 2){
    var a = parseInt(arr[1],10);
    var b = parseInt(arr[2],10);
    var sum = a + b;
    console.log(sum);
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
 
#define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define ll long long
 
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long>
 
#define infi INT_MAX
#define infl LONG_LONG_MAX
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b) for(ll i=(b-1);i>=a;i--)
#define F first
#define S second
#define G(a,b) get<a>(b)
#define MP make_pair
#define MT make_tuple
#define pll pair<ll,ll> 
#define endl "\n"
#define ALL(v) v.begin(),v.end()
#define nl cout<<"\n";
#define pr(x) cout<<x;
#define pr1(x) cout<<x<<" ";
#define pr2(x,y) cout<<x<<" "<<y;
#define deb printf("***************************************************************************************\n");
#define moshi printf("moshi moshi ! \n");
#define hi printf("hi ! \n");
#define bye printf("bye bye ! \n");

//const ll N=1e5+5;
ll p=1e9+7;
//ll fac[N];

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

ll max(ll x,ll y,ll z)
{
  return max(x,max(y,z));
}


ll modpro(ll x,ll y,ll z=1)
{
  x%=p;
  y%=p;
  z%=p;
  ll res=(x*y)%p;
  res=(res*z)%p;
  return res;
}

ll modadd(ll x,ll y,ll z=0)
{
  ll res=(x+y)%p;
  res=(res+z)%p;
  return res;
}


ll pow_mod_p(ll a,ll b)
{
  a=a%p;
  ll res=1;
  while(b>0)
  {
    if(b&1) res=(res*a)%p;
    b=b>>1;
    a=(a*a)%p;
  }
  return res;
}

inline ll mod_inv(ll x)
{
  return pow_mod_p(x,p-2);
}
/*
ll nCr(ll x,ll y)
{
  if(x<y) return 0;
  ll res=fac[x];
  ll den=(fac[y]*fac[x-y])%p;
  ll deni=mod_inv(den);
  res=(res*deni)%p;
  return res;
}
*/

void func()
{
  ll a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c<<endl;
} 


int main() 
{
    fast
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE*/

    ll ntc=1;
    //cin>>ntc;

    f(i,1,ntc+1)
    {
      //cout<<"Case #"<<i<<": ";
      func();
    }
 
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[]$) {
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        int[] h=new int[n];
        for (int i = 0; i < n; i++) {
            h[i]=sc.nextInt();
        }
      //ソートしてしまえばK個の区間で添え字が一番大きいものがhmax,小さいものがhmin
        Arrays.sort(h);
        int ans=h[n-1];
      //iをソート済み配列内のK個の区間の左端のindexにして動かす
      //0-indexedであることに注意（右からK個目のindexはn-kである）
        for (int i = 0; i <=n-k ; i++) {
            ans=min(h[i+k-1]-h[i],ans);
        }
        out.println(ans);
    }
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= c && c <= b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    
}

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

int main(){
    int n;
    cin >> n;
    long long ans = 0;
    
    for (int i = 1; i <= n; i++){
        if(i%3 == 0 || i%5 == 0)
            ;
        else
            ans += i;

    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
monstor_param = input().split()

takahashi_hp = int(monstor_param[0])
takahashi_ap = int(monstor_param[1])
aoki_hp = int(monstor_param[2])
aoki_ap = int(monstor_param[3])

result = "No"

while takahashi_hp >= 0 or aoki_hp >= 0:
    aoki_hp = aoki_hp - takahashi_ap
    if aoki_hp <= 0:
        result = "Yes"
        break
    else:
        takahashi_hp = takahashi_hp - aoki_ap
        if takahashi_hp <= 0:
            break

print(result)

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

const long long INF = 1001001001001;

long long make_ans(long long x){
  vector<long long> res;
  long long a;
  long long min_move = INF;
  for(long long i = 1; i * i <=x; ++i){
    if(x % i == 0){
      a = x / i;
      min_move = min(min_move, i + a);
    }
  }
  return min_move;
}

int main(){
  long long n;
  cin >> n;
  cout << make_ans(n) - 2 << endl;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	vector<int> x(n);
	rep(i, n)scanf("%d", &x[i]);
	int ans = INF, tmp = 0;
	rep(i, 2001) {
		tmp = 0;
		rep(j, n)tmp = max(abs(i - x[j]), tmp);
		ans = min(ans, tmp);
	}
	printf("%d\n", ans);

	Please AC;
}


Measured memory_bytes: 3184
from collections import defaultdict
import sys
def solve():
    readline = sys.stdin.readline
    write = sys.stdout.write
    mod = 10**9 + 9
    base = 37
    ca = ord('a')

    N = int(readline())
    SS = [readline().strip() for i in range(N)]
    SS.sort(key = len)

    T = readline().strip()
    L = len(T)

    L0 = max(max(map(len, SS)), L)

    r = 1
    pw = [1]*(L0+1)
    for i in range(L0):
        pw[i+1] = r = r * base % mod

    SM = defaultdict(dict)
    E = [None]*N
    for i in range(N):
        s = SS[i][::-1]
        h = 0
        p = -1
        for j, c in enumerate(s):
            h = (h + pw[j] * (ord(c) - ca)) % mod
            if j+1 in SM and h in SM[j+1]:
                p = SM[j+1][h]
        l = len(s)
        E[i] = (E[p] + [l]) if p != -1 else [l]
        SM[l][h] = i

    *SI, = SM.items()
    SI.sort()
    H = [0]*(L+1)
    r = 0
    for i, c in enumerate(T):
        H[i+1] = r = (base * r + (ord(c) - ca)) % mod

    MOD = 10**9 + 7
    dp = [0]*(L+1)
    dp[0] = 1
    SI.append((L+10, set()))
    it = iter(SI).__next__
    ln, sn = it()
    SL = []
    for i in range(1, L+1):
        if i == ln:
            SL.append((ln, sn, pw[ln]))
            ln, sn = it()
        hi = H[i]
        for l, hs, w in reversed(SL):
            v = (hi - H[i-l]*w) % mod
            if v in hs:
                dp[i] = sum(dp[i-e] for e in E[hs[v]]) % MOD
                break
    write("%d\n" % dp[L])
solve()


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

const ll MOD=1e9+7;
const double EPS=1e-9;
const double PI=acos(-1.0);
//const long double PI=acos(-1.0L);

struct Point{
    double x,y;
    Point(){}
    Point(double x,double y):x(x),y(y){}

    Point operator +(const Point &b) const {return Point(x+b.x,y+b.y);}
    Point operator -(const Point &b) const {return Point(x-b.x,y-b.y);}
    Point operator *(const double b) const {return Point(x*b,y*b);}
    Point operator /(const double b) const {return Point(x/b,y/b);}
};

struct Line{
    Point a,b;
    Line(){}
    Line(Point a,Point b):a(a),b(b){}
};

int sgn(double a) {return (a>EPS)-(a<-EPS);}
int sgn(double a,double b) {return sgn(a-b);}

double dot(const Point &a,const Point &b) {return (a.x*b.x+a.y*b.y);}
double cross(const Point &a,const Point &b) {return (a.x*b.y-a.y*b.x);}
double norm(const Point &p) {return dot(p,p);}
double abs(const Point &p) {return sqrt(norm(p));}

Point projection(const Point &p,const Line &l){
    double r=dot(p-l.a,l.b-l.a)/norm(l.b-l.a);
    return l.a+(l.b-l.a)*r;
}
Point reflection(const Point &p,const Line &l){
    return p+(projection(p,l)-p)*2;
}

//1:Counter_Clockwise -1:Clockwise
//2:a-b-c -2:c-a-b 0:a-c-b
int ccw(const Point &p,const Point &q){
    int s=sgn(cross(p,q));
    if(s!=0) return s;
    if(dot(p,q)<0) return -2;
    if(norm(p)<norm(q)) return 2;
    return 0;
}
int ccw(const Point &a,const Point &b,const Point &c){return ccw(b-a,c-a);}

bool isParallel(const Line &l,const Line &r){
    if(sgn(cross(l.b-l.a,r.b-r.a))==0) return true;
    return false;
}
bool isOrthogonal(const Line &l,const Line &r){
    if(sgn(dot(l.b-l.a,r.b-r.a))==0) return true;
    return false;
}

Point crosspoint(const Line &s,const Line &t){
    Point v=t.b-t.a;
    double d1=abs(cross(v,s.a-t.a));
    double d2=abs(cross(v,s.b-t.a));
    double w=d1/(d1+d2);
    return s.a+(s.b-s.a)*w;
}

double isIntersectedPL(const Point &p,const Line &l){
    return (sgn(abs(p-projection(p,l)))==0);
}
double isIntersectedPS(const Point &p,const Line &s){
    return (ccw(s.a,s.b,p)==0);
}
bool isIntersectedSS(const Line &s,const Line &t){
    if(ccw(s.b-s.a,t.a-s.a)*ccw(s.b-s.a,t.b-s.a)>0) return false;
    if(ccw(t.b-t.a,s.a-t.a)*ccw(t.b-t.a,s.b-t.a)>0) return false;
    return true;
}
double distancePL(const Point &p,const Line &l){
    return abs(p-projection(p,l));
}
double distancePS(const Point &p,const Line &s){
    Point h=projection(p,s);
    if(isIntersectedPS(h,s)) return abs(h-p);
    return min(abs(p-s.a),abs(p-s.b));
}
double distanceSS(const Line &s,const Line &t){
    if(isIntersectedSS(s,t)) return 0.0;
    return min(min(distancePS(s.a,t),distancePS(s.b,t)),min(distancePS(t.a,s),distancePS(t.b,s)));
}

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

    for(int q=0;q<Q;q++){
        Point P1,P2;
        cin>>P1.x>>P1.y>>P2.x>>P2.y;
        Point P3,P4;
        cin>>P3.x>>P3.y>>P4.x>>P4.y;

        Line L1(P1,P2);
        Line L2(P3,P4);
        double ans=distanceSS(L1,L2);
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }

    return 0;
}



Measured memory_bytes: 3296
import math
import copy
import sys


inputa = input().split()
inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

x = str(inputb[0])
# y = int(inputb[1])

# inputaList = [int(n) for n in inputa]

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
#     inputNum = input()
#     inputNumList = list(inputNum)
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

if a >= 3200:
    print(x)
else:
    print("red")



Measured memory_bytes: 3444
//****************************//
/**********  main *************/
//****************************//
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for(i = 0; i < n; i++)
#define FOR(i, a, b) for(i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())

double pi = 3.141592653589793;

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

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    double d;
    cin >> n >> d;

    double x, y;
    double res;
    int count=0;
    for(int i = 0; i < n; i++) {
        cin >> x >> y ;
        res = sqrt(x*x + y*y);
        if(res <= d) count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3820
/*@authored by: Subham Pratap*/

/* ************************************************************************************************************************** */

#include <bits/stdc++.h>
using namespace std;
#define PKMKB ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define lli long long int
#define ull unsigned long long
#define INT_MAX 2147483647
#define all(a) begin(a),end(a)
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define MOD 1000000007
#define MAXN 10000005

  int main()
  {
    PKMKB;
    string s;
    cin >> s ;
    lli flag=1;
    for(lli i=0;i<s.length()-1;i++)
    {
        if(s[i]==s[i+1])
        {
            flag=0;
            break;
        }
    }
    cout << (flag==1?"Good":"Bad") << endl;
    //cout << count << endl;
    clock_t clk = clock();
    clk = clock() - clk;
    cerr << "Time Elapsed: " << fixed << setprecision(10) << ((long double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}



	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int c[]=new int[n];
		int s[]=new int[n];
		int f[]=new int[n];
		for(int i=0; i<n-1; i++) {
			c[i]=sc.nextInt();
			s[i]=sc.nextInt();
			f[i]=sc.nextInt();
		}
		int cnt[] = new int[n];
		for(int i=0; i<n-1; i++) {
			for(int j=i; j<n-1; j++) {
				if(cnt[i]<s[j]) {
					cnt[i]=s[j];
				} else if(cnt[i]%f[j]==0) {
					;
				} else {
					cnt[i] = cnt[i] + f[j] - cnt[i] % f[j];
				}
				cnt[i]+=c[j];
			}
		}
		for(int i=0; i<n; i++) {
			System.out.println(cnt[i]);
		}
		sc.close();
	}

}


Measured memory_bytes: 26184
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define modp(x) ((x)%modn)
using namespace std;
const int maxn=100005;
int f[maxn][5],n;
int main()
{
	scanf("%d",&n);
	rep(i,1,n)
	{
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		if(i==1) f[i][1]=a,f[i][2]=b,f[i][3]=c;
		else f[i][1]=a+max(f[i-1][2],f[i-1][3]),f[i][2]=b+max(f[i-1][1],f[i-1][3]),f[i][3]=c+max(f[i-1][1],f[i-1][2]);
	}
	printf("%d",max(f[n][1],max(f[n][2],f[n][3])));
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll tmp, n, m, i, j;
string str[51];

void check(ll a, ll b)
{
	ll x[] = {-1,0,1};
	for(ll i=-1;i<2;i++)
		for(ll j=-1;j<2;j++)
		{
			if( (i || j) && (i+a >=0 && i+a <n) && (j+b >=0 && j+b <m))
				if(str[i+a][j+b] == '#')
				tmp++;
		}
}

int main()
{
    
	cin>>n>>m;
	for(i=0;i<n;i++)
		cin>>str[i];
	for(i=0;i<n;i++){
		for(j=0;j<m;j++)
		{
			if(str[i][j]!='.')continue;
			tmp=0;
			check(i,j);
			str[i][j]='0'+tmp;
		}
		cout<<str[i]<<"\n";
	}
    return 0;
}


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

int main()
{
	int num[MAX];
	int n;

	cin >> n;
	for (int i=0; i<n; ++i)
		cin >> num[i];

	sort(num, num+n);

	cout << num[n/2] - num[n/2-1] << '\n';

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;

vector<int> dp;
int find(vector<int>& arr, int i) {
	if (i < 0)
		return 1e5;

	if (i == 0)
		return 0;

	if (dp[i] != -1)
		return dp[i];

	int ans = abs(arr[i] - arr[i - 1]) + find(arr, i - 1);
	ans = min(ans, abs(arr[i] - arr[i - 2]) + find(arr, i - 2));
	dp[i] = ans;
	return ans;
}


int main() {
	int n;
	cin >> n;
	dp.resize(n, -1);
	vector<int> arr(n);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	cout << find(arr, n - 1);
	return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

ll c[51][51];

void combination() {
    rep(i, 51)rep(j, i + 1) {
        if (j == 0 || i == j) c[i][j] = 1;
        else c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
    }
}


int main(){
    cin.sync_with_stdio(false);
    ll n, a, b;
    cin >> n >> a >> b;
    ll v[n];
    rep(i, n) cin >> v[i];

    sort(v, v + n, greater<ll>());

    double ave = 0;
    rep(i, a) ave += v[i];
    ave /= a;

    combination();

    int num = 0, in = 0;
    rep(i, n) {
        if (v[i] == v[a - 1]) {
            num++;
            if (i < a) in++;
        }
    }

    ll cnt = 0;
    if (v[0] == v[a - 1]) {
        repl(i, a, b + 1) cnt += c[num][i];
    } else {
        cnt += c[num][in];
    }
    printf("%.10f\n%ld\n", ave, cnt);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dbg() cerr <<
#define name(x) (#x) << ": " << (x) << ' ' <<

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  int n, q; cin >> n >> q;
  string s; cin >> s;
  vector<pair<char, int>> qrs(q);
  for (auto &p : qrs) {
    char dir; cin >> p.first >> dir;
    p.second = dir == 'L' ? -1 : +1;
  }
  auto GetPos = [&](int pos) {
    for (auto &p : qrs) {
      if (s[pos] == p.first) {
        pos += p.second;
      }
      if (pos < 0 || pos == n) return pos;
    }
    return pos;
  };
  auto Check = [&](bool type, int pos) {
    pos = GetPos(pos);
    return type ? (pos >= 0 && pos < n) : (pos == -1);
  };
  auto BinSearch = [&](bool type) {
    int lo = 0, hi = n - 1, ans = -1;
    while (lo <= hi) {
      int mid = lo + (hi - lo) / 2;
      if (Check(type, mid)) {
        ans = mid;
        lo = mid + 1;
      } else {
        hi = mid - 1;
      }
    }
    if (type && ans == -1) {
      cout << 0 << endl;
      exit(0);
    }
    return ans;
  };

  cout << BinSearch(1) - BinSearch(0) << endl;
}


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

#define MAX_M 1000
#define MAX_N 1000

int n, m, dp[MAX_M+1][MAX_N+1];

int main() {
	string s;
	cin >> s;
	if (s[0] == s[2]) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::*;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    n: i64,
    m: i64,
    }

    let mut l_vec = vec![];
    let mut r_vec = vec![];

    for _ in 0..m {
      input!{
        l: i64,
        r: i64,
      }

      l_vec.push(l);
      r_vec.push(r);
      
    }

    let r_min = r_vec.iter().min().unwrap();
    let l_max = l_vec.iter().max().unwrap();

    let mut ans =0 ;
    if r_min - l_max >= 0 {
      ans = r_min - l_max + 1;
    }else{
      ans = 0;
    }


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


Measured memory_bytes: 4872